@tencentcloud/tccc-sip-js 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jssip.esm.js CHANGED
@@ -1 +1 @@
1
- import e from"trtc-js-sdk";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(r){var n,e=r.default;return"function"==typeof e?(n=function(){return e.apply(this,arguments)}).prototype=e.prototype:n={},Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(e){var t=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:function(){return r[e]}})}),n}var n={name:"@tencentcloud/tccc-sip-js",title:"TCCCSIP",description:"TCCC JavaScript SIP SDK",version:"0.1.1",homepage:"https://tccc.qcloud.com",contributors:["TCCC Frontend Team"],types:"dist/jssip.d.ts",main:"dist/jssip.cjs.js",module:"dist/jssip.esm.js",browser:"dist/jssip.umd.js",miniprogram:"miniprogram_dist",exports:{".":{import:"dist/jssip.esm.js",require:"dist/index.cjs.js",browser:"dist/jssip.umd.js",types:"dist/jssip.d.ts",default:"dist/jssip.esm.js"}},files:["dist","miniprogram_dist"],keywords:["sip","websocket","webrtc","node","browser","library","tccc","腾讯云呼叫中心","腾讯云联络中心"],license:"MIT",peerDependencies:{"trtc-js-sdk":"^4.13.0"},dependencies:{debug:"^4.3.1",events:"^3.3.0","sdp-transform":"^2.14.1","trtc-js-sdk":"^4.13.0"},devDependencies:{"@babel/core":"^7.19.6","@babel/plugin-external-helpers":"^7.18.6","@babel/plugin-transform-runtime":"^7.18.10","@babel/preset-env":"^7.19.4","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.208.0","@opentelemetry/exporter-logs-otlp-http":"^0.208.0","@opentelemetry/exporter-trace-otlp-http":"^0.208.0","@opentelemetry/resources":"^2.2.0","@opentelemetry/sdk-logs":"^0.208.0","@opentelemetry/sdk-trace-base":"^2.2.0","@opentelemetry/sdk-trace-web":"^2.2.0","@opentelemetry/semantic-conventions":"^1.38.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^22.0.2","@rollup/plugin-eslint":"^8.0.2","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.4.0","@types/debug":"^4.1.5","@types/node":"^14.14.34","@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","ansi-colors":"^3.2.4",browserify:"^16.5.1","cross-env":"^7.0.3",eslint:"7.32.0","fancy-log":"^1.3.3",gulp:"^4.0.2","gulp-babel":"^8.0.0","gulp-eslint":"^5.0.0","gulp-expect-file":"^1.0.2","gulp-header":"^2.0.9","gulp-nodeunit-runner":"^0.2.2","gulp-plumber":"^1.2.1","gulp-rename":"^1.4.0","gulp-uglify-es":"^1.0.4","lodash.template":"^4.5.0",pegjs:"^0.7.0",rimraf:"^3.0.2",rollup:"^2.79.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-filesize":"^10.0.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-polyfill-node":"^0.10.2","rollup-plugin-progress":"^1.1.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-uglify":"^6.0.4",typescript:"^4.8.2","vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},scripts:{lint:"node npm-scripts.js lint",test:"node npm-scripts.js test",prepublish:"node npm-scripts.js prepublish",release:"node npm-scripts.js release",dev:"cross-env NODE_ENV=development rollup -c rollup.config.js -w",build:"cross-env rimraf dist && rollup -c rollup.config.js && node config/build-package.js",prepublishOnly:"npm run build",grammar:"gulp grammar"},packageManager:"pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"},o=n,i={USER_AGENT:"".concat(o.title," ").concat(o.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,LOG_LEVEL:{TRACE:0,DEBUG:1,WARN:2,ERROR:3,NONE:4}};function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t,r){t=h(t);var n=e,t=m()?Reflect.construct(t,r||[],h(e).constructor):t.apply(e,r);if(!t||"object"!=typeof t&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=n))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function c(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t){var r,n,o,s,i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return o=!(n=!0),{s:function(){i=i.call(e)},n:function(){var e=i.next();return n=e.done,e},e:function(e){o=!0,r=e},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}};if(Array.isArray(e)||(i=S(e))||t&&e&&"number"==typeof e.length)return i&&(e=i),s=0,{s:t=function(){},n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function g(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _(e,t){return(_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(e=>{if(Array.isArray(e))return s(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||S(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function b(e){e=(e=>{if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")})(e);return"symbol"==typeof e?e:e+""}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})(e)}function S(e,t){var r;if(e)return"string"==typeof e?s(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}function w(e){var r="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||!(t=>{try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}})(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return function(e,t,r){var n;return m()?Reflect.construct.apply(null,arguments):((n=[null]).push.apply(n,t),t=new(e.bind.apply(e,n)),r&&_(t,r.prototype),t)}(e,arguments,h(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),_(t,e)})(e)}var E,A,O,x,C,R,N,I=(()=>{function n(e,t){var r;return u(this,n),(r=a(this,n)).code=1,r.name="CONFIGURATION_ERROR",r.parameter=e,r.value=t,r.message=r.value?"Invalid value ".concat(JSON.stringify(r.value),' for parameter "').concat(r.parameter,'"'):"Missing parameter: ".concat(r.parameter),r}return f(n,w(Error)),c(n)})(),P=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).code=2,t.name="INVALID_STATE_ERROR",t.status=e,t.message="Invalid status: ".concat(e),t}return f(r,w(Error)),c(r)})(),U=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).code=3,t.name="NOT_SUPPORTED_ERROR",t.message=e,t}return f(r,w(Error)),c(r)})(),k=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).code=4,t.name="NOT_READY_ERROR",t.message=e,t}return f(r,w(Error)),c(r)})(),L={ConfigurationError:I,InvalidStateError:P,NotSupportedError:U,NotReadyError:k},j={};function D(){var o,t;return A||(A=1,o=V(),t=M(),E=c(s,[{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}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=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){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"clone",value:function(){return new s(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}},{key:"_quote",value:function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var e,t=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"";for(e in t+="<".concat(this._uri.toString(),">"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(t+=";".concat(e),null!==this._parameters[e])&&(t+="=".concat(this._parameters[e]));return t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"Name_Addr_Header"))?e:void 0}}])),E;function s(e,t,r){if(u(this,s),!(e&&e instanceof o))throw new TypeError('missing or invalid "uri" parameter');for(var n in this._uri=e,this._parameters={},this.display_name=t,r)Object.prototype.hasOwnProperty.call(r,n)&&this.setParam(n,r[n])}}function M(){return x||(x=1,(e={parse:function(g,u){var e={CRLF:B,DIGIT:l,ALPHA:i,HEXDIG:a,WSP:c,OCTET:r,DQUOTE:p,SP:h,HTAB:d,alphanum:o,reserved:F,unreserved:n,mark:q,escaped:f,LWS:m,SWS:v,HCOLON:H,TEXT_UTF8_TRIM:G,TEXT_UTF8char:b,UTF8_NONASCII:T,UTF8_CONT:S,LHEX:function(){var e;return null===(e=l())&&(/^[a-f]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-f]"))),e},token:w,token_nodot:z,separators:function(){var e;return 40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),e=null===e&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"')),null===e)&&(60===g.charCodeAt(y)?(e="<",y++):(e=null,_('"<"')),null===e)&&(62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null===e)&&null===(e=p())&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e)&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(123===g.charCodeAt(y)?(e="{",y++):(e=null,_('"{"')),null===e)&&(125===g.charCodeAt(y)?(e="}",y++):(e=null,_('"}"')),null===e)&&null===(e=h())?d():e},word:E,STAR:K,SLASH:Y,EQUAL:A,LPAREN:J,RPAREN:W,RAQUOT:$,LAQUOT:X,COMMA:O,SEMI:x,COLON:Q,LDQUOT:Z,RDQUOT:ee,comment:function e(){var t,r,n,o=y;if(null!==(t=J())){for(r=[],null===(n=te())&&null===(n=R())&&(n=e());null!==n;)r.push(n),null===(n=te())&&null===(n=R())&&(n=e());null!==r&&null!==(n=W())?t=[t,r,n]:(t=null,y=o)}else t=null,y=o;return t},ctext:te,quoted_string:re,quoted_string_clean:C,qdtext:ne,quoted_pair:R,SIP_URI_noparams:oe,SIP_URI:se,uri_scheme:ie,uri_scheme_sips:ae,uri_scheme_sip:ue,userinfo:le,user:ce,user_unreserved:pe,password:he,hostport:de,host:fe,hostname:me,domainlabel:ge,toplabel:ye,IPv6reference:_e,IPv6address:ve,h16:N,ls32:I,IPv4address:be,dec_octet:Te,port:Se,uri_parameters:we,uri_parameter:Ee,transport_param:Ae,user_param:Oe,method_param:xe,ttl_param:Ce,maddr_param:Re,lr_param:Ne,other_param:Ie,pname:Pe,pvalue:Ue,paramchar:Le,param_unreserved:ke,headers:Me,header:je,hname:De,hvalue:Ve,hnv_unreserved:Be,Request_Response:function(){var e;return e=null===(e=gt())?Fe():e},Request_Line:Fe,Request_URI:qe,absoluteURI:He,hier_part:Ge,net_path:ze,abs_path:Ke,opaque_part:Ye,uric:Je,uric_no_slash:We,path_segments:$e,segment:Xe,param:Qe,pchar:Ze,scheme:et,authority:tt,srvr:rt,reg_name:nt,query:ot,SIP_Version:st,INVITEm:it,ACKm:at,OPTIONSm:ut,BYEm:lt,CANCELm:ct,REGISTERm:pt,SUBSCRIBEm:ht,NOTIFYm:dt,REFERm:ft,Method:mt,Status_Line:gt,Status_Code:yt,extension_code:_t,Reason_Phrase:vt,Allow_Events:function(){var e,t,r,n,o,s=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Call_ID:function(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(j=g.substring(y,o)):e)&&(y=o),e},Contact:function(){var e,t,r,n,o,s,i=y;if(null===(e=K()))if(o=y,null!==(e=bt())){for(t=[],s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==r;)t.push(r),s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?(()=>{for(var e=j.multi_header.length,t=0;t<e;t++)if(null===j.multi_header[t].parsed){j=null;break}j=null!==j?j.multi_header:-1})():e)&&(y=i),e},contact_param:bt,name_addr:P,display_name:Tt,contact_params:St,c_p_q:wt,c_p_expires:Et,delta_seconds:U,qvalue:At,generic_param:L,gen_value:Ot,Content_Disposition:function(){var e,t,r,n,o,s=y;if(null!==(e=xt())){for(t=[],o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},disp_type:xt,disp_param:Ct,handling_param:Rt,Content_Encoding:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Content_Length:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(j=parseInt(e.join(""))):e)&&(y=r),e},Content_Type:function(){var e,t=y;return null===(e=null!==(e=Nt())?void(j=g.substring(y,t)):e)&&(y=t),e},media_type:Nt,m_type:It,discrete_type:Pt,composite_type:Ut,extension_token:Lt,x_token:kt,m_subtype:Mt,m_parameter:jt,m_value:Dt,CSeq:function(){var e,t,r,n=y;return null!==(e=Vt())&&null!==(t=m())&&null!==(r=mt())?e=[e,t,r]:(e=null,y=n),e},CSeq_value:Vt,Expires:function(){var e,t=y;return null===(e=null!==(e=U())?void(j=e):e)&&(y=t),e},Event:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],e=void(j.event=i.join("").toLowerCase())),null===e&&(y=s),e},event_type:Bt,From:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Ft())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ft())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=j.tag;try{j=new M(j.uri,j.display_name,j.params),e&&j.setParam("tag",e)}catch(e){j=-1}})():e)&&(y=s),e},from_param:Ft,tag_param:qt,Max_Forwards:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(j=parseInt(e.join(""))):e)&&(y=r),e},Min_Expires:function(){var e,t=y;return null===(e=null!==(e=U())?void(j=e):e)&&(y=t),e},Name_Addr_Header:function(){for(var e,t,r,n,o,s,i=y,a=y,u=[],l=Tt();null!==l;)u.push(l),l=Tt();if(null!==u)if(null!==(l=X()))if(null!==(e=se()))if(null!==(t=$())){for(r=[],s=y,null!==(n=x())&&null!==(o=L())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,null!==(n=x())&&null!==(o=L())?n=[n,o]:(n=null,y=s);null!==r?u=[u,l,e,t,r]:(u=null,y=a)}else u=null,y=a;else u=null,y=a;else u=null,y=a;else u=null,y=a;return null===(u=null!==u?(()=>{try{j=new M(j.uri,j.display_name,j.params)}catch(e){j=-1}})():u)&&(y=i),u},Proxy_Authenticate:Ht,challenge:Ht,other_challenge:Gt,auth_param:zt,digest_cln:Kt,realm:Yt,realm_value:Jt,domain:Wt,URI:$t,nonce:Xt,nonce_value:Qt,opaque:Zt,stale:er,algorithm:tr,qop_options:rr,qop_value:nr,Proxy_Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Record_Route:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=or())){for(t=[],o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{for(var e=j.multi_header.length,t=0;t<e;t++)if(null===j.multi_header[t].parsed){j=null;break}j=null!==j?j.multi_header:-1})():e)&&(y=s),e},rec_route:or,Reason:function(){var e,t,r,n,o,s=y,i=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],j.protocol=i.toLowerCase(),j.params||(j.params={}),e=void(j.params.text&&'"'===j.params.text[0]&&(i=j.params.text,j.text=i.substring(1,i.length-1),delete j.params.text))),null===e&&(y=s),e},reason_param:sr,reason_cause:ir,Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Route:function(){var e,t,r,n,o,s=y;if(null!==(e=ar())){for(t=[],o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},route_param:ar,Subscription_State:function(){var e,t,r,n,o,s=y;if(null!==(e=ur())){for(t=[],o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},substate_value:ur,subexp_params:lr,event_reason_value:cr,Subject:function(){var e;return null!==(e=G())?e:""},Supported:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null!==e?e:""},To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=j.tag;try{j=new M(j.uri,j.display_name,j.params),e&&j.setParam("tag",e)}catch(e){j=-1}})():e)&&(y=s),e},to_param:pr,Via:function(){var e,t,r,n,o,s=y;if(null!==(e=hr())){for(t=[],o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},via_param:hr,via_params:dr,via_ttl:fr,via_maddr:mr,via_received:gr,via_branch:yr,response_port:_r,rport:vr,sent_protocol:br,protocol_name:Tr,transport:Sr,sent_by:wr,via_host:Er,via_port:Ar,ttl:Or,WWW_Authenticate:Ht,Session_Expires:function(){var e,t,r,n,o,s=y;if(null!==(e=xr())){for(t=[],o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},s_e_expires:xr,s_e_params:Cr,s_e_refresher:Rr,extension_header:function(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=H())&&null!==(r=Nr())?e=[e,t,r]:(e=null,y=n),e},header_value:Nr,message_body:function(){for(var e=[],t=r();null!==t;)e.push(t),t=r();return e},uuid_URI:function(){var e,t,r=y;return"uuid:"===g.substr(y,5)?(e="uuid:",y+=5):(e=null,_('"uuid:"')),null!==e&&null!==(t=Ir())?e=[e,t]:(e=null,y=r),e},uuid:Ir,hex4:k,hex8:Pr,hex12:Ur,Refer_To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{try{j=new M(j.uri,j.display_name,j.params)}catch(e){j=-1}})():e)&&(y=s),e},Replaces:function(){var e,t,r,n,o,s=y;if(null!==(e=Lr())){for(t=[],o=y,null!==(r=x())&&null!==(n=kr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=kr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},call_id:Lr,replaces_param:kr,to_tag:Mr,from_tag:jr,early_flag:Dr};if(void 0!==u){if(void 0===e[u])throw new Error("Invalid rule name: "+qr(u)+".")}else u="CRLF";var y=0,s=0,t=[];function _(e){y<s||(s<y&&(s=y,t=[]),t.push(e))}function B(){var e;return"\r\n"===g.substr(y,2)?(e="\r\n",y+=2):(e=null,_('"\\r\\n"')),e}function l(){var e;return/^[0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9]")),e}function i(){var e;return/^[a-zA-Z]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z]")),e}function a(){var e;return/^[0-9a-fA-F]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9a-fA-F]")),e}function c(){var e;return e=null===(e=h())?d():e}function r(){var e;return/^[\0-\xFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\0-\\xFF]")),e}function p(){var e;return/^["]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_('["]')),e}function h(){var e;return 32===g.charCodeAt(y)?(e=" ",y++):(e=null,_('" "')),e}function d(){var e;return 9===g.charCodeAt(y)?(e="\t",y++):(e=null,_('"\\t"')),e}function o(){var e;return/^[a-zA-Z0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z0-9]")),e}function F(){var e;return 59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function n(){var e;return e=null===(e=o())?q():e}function q(){var e;return 45===g.charCodeAt(y)?(e="-",y++):(e=null,_('"-"')),null===e&&(95===g.charCodeAt(y)?(e="_",y++):(e=null,_('"_"')),null===e)&&(46===g.charCodeAt(y)?(e=".",y++):(e=null,_('"."')),null===e)&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(126===g.charCodeAt(y)?(e="~",y++):(e=null,_('"~"')),null===e)&&(42===g.charCodeAt(y)?(e="*",y++):(e=null,_('"*"')),null===e)&&(39===g.charCodeAt(y)?(e="'",y++):(e=null,_('"\'"')),null===e)&&(40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),null===e)&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"'))),e}function f(){var e,t,r,n=y,o=y;return 37===g.charCodeAt(y)?(e="%",y++):(e=null,_('"%"')),null!==e&&null!==(t=a())&&null!==(r=a())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?e.join(""):e)&&(y=n),e}function m(){for(var e,t=y,r=y,n=y,o=[],s=c();null!==s;)o.push(s),s=c();if(null!==o&&null!==(s=B())?o=[o,s]:(o=null,y=n),null!==(o=null!==o?o:"")){if(null!==(e=c()))for(s=[];null!==e;)s.push(e),e=c();else s=null;null!==s?o=[o,s]:(o=null,y=r)}else o=null,y=r;return null===(o=null!==o?" ":o)&&(y=t),o}function v(){var e;return null!==(e=m())?e:""}function H(){var e,t,r=y,n=y,o=[];for(null===(e=h())&&(e=d());null!==e;)o.push(e),null===(e=h())&&(e=d());return null!==o&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null!==e)&&null!==(t=v())?o=[o,e,t]:(o=null,y=n),null===(o=null!==o?":":o)&&(y=r),o}function G(){var e,t,r,n,o,s=y,i=y;if(null!==(t=b()))for(e=[];null!==t;)e.push(t),t=b();else e=null;if(null!==e){for(t=[],o=y,r=[],n=m();null!==n;)r.push(n),n=m();for(null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o);null!==r;){for(t.push(r),o=y,r=[],n=m();null!==n;)r.push(n),n=m();null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o)}null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?g.substring(y,s):e)&&(y=s),e}function b(){var e;return/^[!-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-~]")),e=null===e?T():e}function T(){var e;return/^[\x80-\uFFFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\uFFFF]")),e}function S(){var e;return/^[\x80-\xBF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\xBF]")),e}function w(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function z(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function E(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function K(){var e,t,r,n=y,o=y;return null!==(e=v())&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"*":e)&&(y=n),e}function Y(){var e,t,r,n=y,o=y;return null!==(e=v())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"/":e)&&(y=n),e}function A(){var e,t,r,n=y,o=y;return null!==(e=v())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"=":e)&&(y=n),e}function J(){var e,t,r,n=y,o=y;return null!==(e=v())&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"(":e)&&(y=n),e}function W(){var e,t,r,n=y,o=y;return null!==(e=v())&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?")":e)&&(y=n),e}function $(){var e,t,r=y,n=y;return 62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null!==e&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?">":e)&&(y=r),e}function X(){var e,t,r=y,n=y;return null!==(e=v())&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null!==t)?e=[e,t]:(e=null,y=n),null===(e=null!==e?"<":e)&&(y=r),e}function O(){var e,t,r,n=y,o=y;return null!==(e=v())&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?",":e)&&(y=n),e}function x(){var e,t,r,n=y,o=y;return null!==(e=v())&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?";":e)&&(y=n),e}function Q(){var e,t,r,n=y,o=y;return null!==(e=v())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?":":e)&&(y=n),e}function Z(){var e,t,r=y,n=y;return null!==(e=v())&&null!==(t=p())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function ee(){var e,t,r=y,n=y;return null!==(e=p())&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function te(){var e;return/^[!-']/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-']")),e=null===e&&(/^[*-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[*-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)&&null===(e=T())?m():e}function re(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(t=p())){for(r=[],null===(n=ne())&&(n=R());null!==n;)r.push(n),null===(n=ne())&&(n=R());null!==r&&null!==(n=p())?e=[e,t,r,n]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?g.substring(y,o):e)&&(y=o),e}function C(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(n=p())){for(t=[],null===(r=ne())&&(r=R());null!==r;)t.push(r),null===(r=ne())&&(r=R());null!==t&&null!==(r=p())?e=[e,n,t,r]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?(n=g.substring(y,o).trim()).substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1"):e)&&(y=o),e}function ne(){var e;return e=null===(e=m())&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(/^[#-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[#-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)?T():e}function R(){var e,t,r=y;return 92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null!==e&&(/^[\0-\t]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\0-\\t]")),null===t&&(/^[\x0B-\f]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0B-\\f]")),null===t)&&(/^[\x0E-]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0E-]"))),null!==t)?e=[e,t]:(e=null,y=r),e}function oe(){var e,t,r,n,o=y,s=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())?e=[e,t,r,n]:(e=null,y=s),null===(e=null!==e?(()=>{try{j.uri=new Fr(j.scheme,j.user,j.host,j.port),delete j.scheme,delete j.user,delete j.host,delete j.host_type,delete j.port}catch(e){j=-1}})():e)&&(y=o),e}function se(){var e,t,r,n,o,s,i=y,a=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())&&null!==(o=we())&&null!==(s=null!==(s=Me())?s:"")?e=[e,t,r,n,o,s]:(e=null,y=a),null===(e=null!==e?(()=>{try{j.uri=new Fr(j.scheme,j.user,j.host,j.port,j.uri_params,j.uri_headers),delete j.scheme,delete j.user,delete j.host,delete j.host_type,delete j.port,delete j.uri_params,"SIP_URI"===u&&(j=j.uri)}catch(e){j=-1}})():e)&&(y=i),e}function ie(){var e;return e=null===(e=ae())?ue():e}function ae(){var e,t,r=y;return"sips"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"sips"')),null!==e&&(t=e,e=void(j.scheme=t.toLowerCase())),null===e&&(y=r),e}function ue(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"sip"')),null!==e&&(t=e,e=void(j.scheme=t.toLowerCase())),null===e&&(y=r),e}function le(){var e,t,r,n,o=y,s=y;return null!==(e=ce())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=he())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))&&(64===g.charCodeAt(y)?(r="@",y++):(r=null,_('"@"')),null!==r)?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(j.user=decodeURIComponent(g.substring(y-1,o))):e)&&(y=o),e}function ce(){var e,t;if(null!==(t=null===(t=n())&&null===(t=f())?pe():t))for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(t=pe());else e=null;return e}function pe(){var e;return 38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"'))),e}function he(){var e,t=y,r=[];for(null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));null!==e;)r.push(e),null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));return null===(r=null!==r?void(j.password=g.substring(y,t)):r)&&(y=t),r}function de(){var e,t,r,n,o=y;return null!==(e=fe())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=Se())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function fe(){var e,t=y;return null!==(e=null===(e=me())&&null===(e=be())?_e():e)&&(j.host=g.substring(y,t).toLowerCase(),e=j.host),null===e&&(y=t),e}function me(){var e,t,r=y,n=y,o=[],s=y;for(null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);null!==e;)o.push(e),s=y,null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);return null!==o&&null!==(e=ye())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==(t=null!==t?t:""))?o=[o,e,t]:(o=null,y=n),null!==o&&(n=r,j.host_type="domain",o=g.substring(y,n)),null===o&&(y=r),o}function ge(){var e,t,r,n=y;if(null!==(e=o())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function ye(){var e,t,r,n=y;if(null!==(e=i())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function _e(){var e,t,r,n=y,o=y;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null!==e&&null!==(r=ve())&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=n,j.host_type="IPv6",e=g.substring(y,r)),null===e&&(y=n),e}function ve(){var e,t,r,n,o,s,i,a,u,l,c,p,h,d,f=y,m=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=N())&&(58===g.charCodeAt(y)?(p=":",y++):(p=null,_('":"')),null!==p)&&null!==(d=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p,d]:(e=null,y=m),null===e&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=N())&&(58===g.charCodeAt(y)?(c=":",y++):(c=null,_('":"')),null!==c)&&null!==(p=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=I())?e=[e,t,r,n,o,s]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=I())?e=[e,t,r,n]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=I())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&("::"===g.substr(y,2)?(t="::",y+=2):(t=null,_('"::"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=I())?e=[e,t,r,n,o,s,i,a,u,l,c]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&("::"===g.substr(y,2)?(r="::",y+=2):(r=null,_('"::"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&("::"===g.substr(y,2)?(n="::",y+=2):(n=null,_('"::"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=I())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&("::"===g.substr(y,2)?(o="::",y+=2):(o=null,_('"::"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&("::"===g.substr(y,2)?(s="::",y+=2):(s=null,_('"::"')),null!==s)&&null!==(i=I())?e=[e,t,r,n,o,s,i]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&("::"===g.substr(y,2)?(i="::",y+=2):(i=null,_('"::"')),null!==i)&&null!==(a=N())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&(h=y,58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i&&null!==(a=N())?i=[i,a]:(i=null,y=h),null!==(i=null!==i?i:""))&&("::"===g.substr(y,2)?(a="::",y+=2):(a=null,_('"::"')),null!==a)?e=[e,t,r,n,o,s,i,a]:(e=null,y=m)),null!==e&&(d=f,j.host_type="IPv6",e=g.substring(y,d)),null===e&&(y=f),e}function N(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=null!==(t=a())?t:"")&&null!==(r=null!==(r=a())?r:"")&&null!==(n=null!==(n=a())?n:"")?e=[e,t,r,n]:(e=null,y=o),e}function I(){var e,t,r,n=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())?e=[e,t,r]:(e=null,y=n),e=null===e?be():e}function be(){var e,t,r,n,o,s,i,a=y,u=y;return null!==(e=Te())&&(46===g.charCodeAt(y)?(i=".",y++):(i=null,_('"."')),null!==i)&&null!==(t=Te())&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r)&&null!==(n=Te())&&(46===g.charCodeAt(y)?(o=".",y++):(o=null,_('"."')),null!==o)&&null!==(s=Te())?e=[e,i,t,r,n,o,s]:(e=null,y=u),null!==e&&(i=a,j.host_type="IPv4",e=g.substring(y,i)),null===e&&(y=a),e}function Te(){var e,t,r,n=y;return"25"===g.substr(y,2)?(e="25",y+=2):(e=null,_('"25"')),null!==e&&(/^[0-5]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-5]")),null!==t)?e=[e,t]:(e=null,y=n),e=null===e&&(n=y,50===g.charCodeAt(y)?(e="2",y++):(e=null,_('"2"')),null!==e&&(/^[0-4]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-4]")),null!==t)&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,49===g.charCodeAt(y)?(e="1",y++):(e=null,_('"1"')),null!==e&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,/^[1-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[1-9]")),null!==e&&null!==(t=l())?e=[e,t]:(e=null,y=n),null===e)?l():e}function Se(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,o=parseInt(o.join("")),e=j.port=o),null===e&&(y=s),e}function we(){var e,t,r=[],n=y;for(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);null!==e;)r.push(e),n=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);return r}function Ee(){var e;return e=null===(e=Ae())&&null===(e=Oe())&&null===(e=xe())&&null===(e=Ce())&&null===(e=Re())&&null===(e=Ne())?Ie():e}function Ae(){var e,t,r=y,n=y;return"transport="===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"transport="')),null!==e&&("udp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"udp"')),null!==(t=null===t&&("tcp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tcp"')),null===t)&&("sctp"===g.substr(y,4).toLowerCase()?(t=g.substr(y,4),y+=4):(t=null,_('"sctp"')),null===t)&&("tls"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tls"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.transport=t.toLowerCase())),null===e&&(y=r),e}function Oe(){var e,t,r=y,n=y;return"user="===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"user="')),null!==e&&("phone"===g.substr(y,5).toLowerCase()?(t=g.substr(y,5),y+=5):(t=null,_('"phone"')),null!==(t=null===t&&("ip"===g.substr(y,2).toLowerCase()?(t=g.substr(y,2),y+=2):(t=null,_('"ip"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.user=t.toLowerCase())),null===e&&(y=r),e}function xe(){var e,t,r=y,n=y;return"method="===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"method="')),null!==e&&null!==(t=mt())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.method=t)),null===e&&(y=r),e}function Ce(){var e,t,r=y,n=y;return"ttl="===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"ttl="')),null!==e&&null!==(t=Or())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.params||(j.params={}),e=void(j.params.ttl=t)),null===e&&(y=r),e}function Re(){var e,t,r=y,n=y;return"maddr="===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"maddr="')),null!==e&&null!==(t=fe())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.maddr=t)),null===e&&(y=r),e}function Ne(){var e,t,r,n,o=y,s=y;return"lr"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"lr"')),null!==e&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=w())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(j.uri_params||(j.uri_params={}),e=void(j.uri_params.lr=void 0)),null===e&&(y=o),e}function Ie(){var e,t,r,n,o=y,s=y;return null!==(e=Pe())&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=Ue())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],j.uri_params||(j.uri_params={}),n=void 0===n?void 0:n[1],e=void(j.uri_params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Pe(){var e,t,r=y;if(null!==(t=Le()))for(e=[];null!==t;)e.push(t),t=Le();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function Ue(){var e,t,r=y;if(null!==(t=Le()))for(e=[];null!==t;)e.push(t),t=Le();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function Le(){var e;return e=null===(e=ke())&&null===(e=n())?f():e}function ke(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function Me(){var e,t,r,n,o,s,i=y;if(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null!==e)if(null!==(t=je())){for(r=[],s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=je())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=je())?n=[n,o]:(n=null,y=s);null!==r?e=[e,t,r]:(e=null,y=i)}else e=null,y=i;else e=null,y=i;return e}function je(){var e,t,r,n=y,o=y;return null!==(e=De())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=Ve())?e=[e,t,r]:(e=null,y=o),null!==e&&(t=e[0],r=e[2],t=t.join("").toLowerCase(),r=r.join(""),j.uri_headers||(j.uri_headers={}),e=void(j.uri_headers[t]?j.uri_headers[t].push(r):j.uri_headers[t]=[r])),null===e&&(y=n),e}function De(){var e,t;if(null!==(t=null===(t=Be())&&null===(t=n())?f():t))for(e=[];null!==t;)e.push(t),null===(t=Be())&&null===(t=n())&&(t=f());else e=null;return e}function Ve(){var e,t=[];for(null===(e=Be())&&null===(e=n())&&(e=f());null!==e;)t.push(e),null===(e=Be())&&null===(e=n())&&(e=f());return t}function Be(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function Fe(){var e,t,r,n,o,s=y;return null!==(e=mt())&&null!==(t=h())&&null!==(r=qe())&&null!==(n=h())&&null!==(o=st())?e=[e,t,r,n,o]:(e=null,y=s),e}function qe(){var e;return e=null===(e=se())?He():e}function He(){var e,t,r,n=y;return null!==(e=et())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null===(r=Ge())?Ye():r)?e=[e,t,r]:(e=null,y=n),e}function Ge(){var e,t,r,n,o=y;return null!==(e=null===(e=ze())?Ke():e)&&(n=y,63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null!==t&&null!==(r=ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function ze(){var e,t,r,n=y;return"//"===g.substr(y,2)?(e="//",y+=2):(e=null,_('"//"')),null!==e&&null!==(t=tt())&&null!==(r=null!==(r=Ke())?r:"")?e=[e,t,r]:(e=null,y=n),e}function Ke(){var e,t,r=y;return 47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null!==e&&null!==(t=$e())?e=[e,t]:(e=null,y=r),e}function Ye(){var e,t,r,n=y;if(null!==(e=We())){for(t=[],r=Je();null!==r;)t.push(r),r=Je();null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function Je(){var e;return e=null===(e=F())&&null===(e=n())?f():e}function We(){var e;return null===(e=n())&&null===(e=f())&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function $e(){var e,t,r,n,o,s=y;if(null!==(e=Xe())){for(t=[],o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=Xe())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=Xe())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function Xe(){for(var e,t,r,n=y,o=[],s=Ze();null!==s;)o.push(s),s=Ze();if(null!==o){for(s=[],r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==e;)s.push(e),r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==s?o=[o,s]:(o=null,y=n)}else o=null,y=n;return o}function Qe(){for(var e=[],t=Ze();null!==t;)e.push(t),t=Ze();return e}function Ze(){var e;return null===(e=n())&&null===(e=f())&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function et(){var e,t,r,n=y,o=y;if(null!==(e=i())){for(t=[],null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==r;)t.push(r),null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?void(j.scheme=g.substring(y,n)):e)&&(y=n),e}function tt(){var e;return e=null===(e=rt())?nt():e}function rt(){var e,t,r=y,n=y;return null!==(e=le())&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t)?e=[e,t]:(e=null,y=n),null!==(e=null!==e?e:"")&&null!==(t=de())?e=[e,t]:(e=null,y=r),null!==e?e:""}function nt(){var e,t;if(null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')));else e=null;return e}function ot(){for(var e=[],t=Je();null!==t;)e.push(t),t=Je();return e}function st(){var e,t,r,n,o,s,i=y,a=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==e)if(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t){if(null!==(n=l()))for(r=[];null!==n;)r.push(n),n=l();else r=null;if(null!==r)if(46===g.charCodeAt(y)?(n=".",y++):(n=null,_('"."')),null!==n){if(null!==(s=l()))for(o=[];null!==s;)o.push(s),s=l();else o=null;null!==o?e=[e,t,r,n,o]:(e=null,y=a)}else e=null,y=a;else e=null,y=a}else e=null,y=a;else e=null,y=a;return null===(e=null!==e?void(j.sip_version=g.substring(y,i)):e)&&(y=i),e}function it(){var e;return"INVITE"===g.substr(y,6)?(e="INVITE",y+=6):(e=null,_('"INVITE"')),e}function at(){var e;return"ACK"===g.substr(y,3)?(e="ACK",y+=3):(e=null,_('"ACK"')),e}function ut(){var e;return"OPTIONS"===g.substr(y,7)?(e="OPTIONS",y+=7):(e=null,_('"OPTIONS"')),e}function lt(){var e;return"BYE"===g.substr(y,3)?(e="BYE",y+=3):(e=null,_('"BYE"')),e}function ct(){var e;return"CANCEL"===g.substr(y,6)?(e="CANCEL",y+=6):(e=null,_('"CANCEL"')),e}function pt(){var e;return"REGISTER"===g.substr(y,8)?(e="REGISTER",y+=8):(e=null,_('"REGISTER"')),e}function ht(){var e;return"SUBSCRIBE"===g.substr(y,9)?(e="SUBSCRIBE",y+=9):(e=null,_('"SUBSCRIBE"')),e}function dt(){var e;return"NOTIFY"===g.substr(y,6)?(e="NOTIFY",y+=6):(e=null,_('"NOTIFY"')),e}function ft(){var e;return"REFER"===g.substr(y,5)?(e="REFER",y+=5):(e=null,_('"REFER"')),e}function mt(){var e,t=y;return null!==(e=null===(e=it())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&null===(e=ct())&&null===(e=pt())&&null===(e=ht())&&null===(e=dt())&&null===(e=ft())?w():e)&&(j.method=g.substring(y,t),e=j.method),null===e&&(y=t),e}function gt(){var e,t,r,n,o,s=y;return null!==(e=st())&&null!==(t=h())&&null!==(r=yt())&&null!==(n=h())&&null!==(o=vt())?e=[e,t,r,n,o]:(e=null,y=s),e}function yt(){var e,t,r=y;return null!==(e=_t())&&(t=e,e=void(j.status_code=parseInt(t.join("")))),null===e&&(y=r),e}function _t(){var e,t,r,n=y;return null!==(e=l())&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),e}function vt(){var e,t=y,r=[];for(null===(e=F())&&null===(e=n())&&null===(e=f())&&null===(e=T())&&null===(e=S())&&null===(e=h())&&(e=d());null!==e;)r.push(e),null===(e=F())&&null===(e=n())&&null===(e=f())&&null===(e=T())&&null===(e=S())&&null===(e=h())&&(e=d());return null===(r=null!==r?void(j.reason_phrase=g.substring(y,t)):r)&&(y=t),r}function bt(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=St())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=St())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;j.multi_header||(j.multi_header=[]);try{t=new M(j.uri,j.display_name,j.params),delete j.uri,delete j.display_name,delete j.params}catch(e){t=null}j.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function P(){var e,t,r,n,o=y;return null!==(e=null!==(e=Tt())?e:"")&&null!==(t=X())&&null!==(r=se())&&null!==(n=$())?e=[e,t,r,n]:(e=null,y=o),e}function Tt(){var e,t,r,n,o,s=y,i=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==(e=null===e?C():e)&&(i=e,e=void(j.display_name="string"==typeof i?i:i[1].reduce(function(e,t){return e+t[0]+t[1]},i[0]))),null===e&&(y=s),e}function St(){var e;return e=null===(e=wt())&&null===(e=Et())?L():e}function wt(){var e,t,r,n=y,o=y;return"q"===g.substr(y,1).toLowerCase()?(e=g.substr(y,1),y++):(e=null,_('"q"')),null!==e&&null!==(r=A())&&null!==(t=At())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],j.params||(j.params={}),e=void(j.params.q=r)),null===e&&(y=n),e}function Et(){var e,t,r,n=y,o=y;return"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(r=A())&&null!==(t=U())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],j.params||(j.params={}),e=void(j.params.expires=r)),null===e&&(y=n),e}function U(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?parseInt(e.join("")):e)&&(y=r),e}function At(){var e,t,r,n,o,s,i=y,a=y;return 48===g.charCodeAt(y)?(e="0",y++):(e=null,_('"0"')),null!==e&&(s=y,46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(o=null!==(o=l())?o:"")?t=[t,r,n,o]:(t=null,y=s),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=a),null===(e=null!==e?parseFloat(g.substring(y,i)):e)&&(y=i),e}function L(){var e,t,r,n,o=y,s=y;return null!==(e=w())&&(n=y,null!==(t=A())&&null!==(r=Ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],j.params||(j.params={}),n=void 0===n?void 0:n[1],e=void(j.params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Ot(){var e;return e=null===(e=w())&&null===(e=fe())?re():e}function xt(){var e;return"render"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"render"')),e=null===e&&("session"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"session"')),null===e)&&("icon"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"icon"')),null===e)&&("alert"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"alert"')),null===e)?w():e}function Ct(){var e;return e=null===(e=Rt())?L():e}function Rt(){var e,t,r,n=y;return"handling"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"handling"')),null!==e&&null!==(t=A())&&("optional"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"optional"')),null!==(r=null===r&&("required"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"required"')),null===r)?w():r))?e=[e,t,r]:(e=null,y=n),e}function Nt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=It()))if(null!==(t=Y()))if(null!==(r=Mt())){for(n=[],i=y,null!==(o=x())&&null!==(s=jt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=jt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function It(){var e;return e=null===(e=Pt())?Ut():e}function Pt(){var e;return"text"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"text"')),e=null===e&&("image"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"image"')),null===e)&&("audio"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"audio"')),null===e)&&("video"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"video"')),null===e)&&("application"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"application"')),null===e)?Lt():e}function Ut(){var e;return"message"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"message"')),e=null===e&&("multipart"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"multipart"')),null===e)?Lt():e}function Lt(){var e;return e=null===(e=w())?kt():e}function kt(){var e,t,r=y;return"x-"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"x-"')),null!==e&&null!==(t=w())?e=[e,t]:(e=null,y=r),e}function Mt(){var e;return e=null===(e=Lt())?w():e}function jt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=Dt())?e=[e,t,r]:(e=null,y=n),e}function Dt(){var e;return e=null===(e=w())?re():e}function Vt(){var e,t,r,n=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(r=e,e=void(j.value=parseInt(r.join("")))),null===e&&(y=n),e}function Bt(){var e,t,r,n,o,s=y;if(null!==(e=z())){for(t=[],o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=z())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=z())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function Ft(){var e;return e=null===(e=qt())?L():e}function qt(){var e,t,r,n=y,o=y;return"tag"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.tag=r)),null===e&&(y=n),e}function Ht(){var e,t,r,n,o,s,i,a=y;if("digest"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"Digest"')),null!==e)if(null!==(t=m()))if(null!==(r=Kt())){for(n=[],i=y,null!==(o=O())&&null!==(s=Kt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=Kt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e=null===e?Gt():e}function Gt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=w()))if(null!==(t=m()))if(null!==(r=zt())){for(n=[],i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function zt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=null===(r=w())?re():r)?e=[e,t,r]:(e=null,y=n),e}function Kt(){var e;return e=null===(e=Yt())&&null===(e=Wt())&&null===(e=Xt())&&null===(e=Zt())&&null===(e=er())&&null===(e=tr())&&null===(e=rr())?zt():e}function Yt(){var e,t,r,n=y;return"realm"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"realm"')),null!==e&&null!==(t=A())&&null!==(r=Jt())?e=[e,t,r]:(e=null,y=n),e}function Jt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(j.realm=t)),null===e&&(y=r),e}function Wt(){var e,t,r,n,o,s,i,a,u=y;if("domain"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"domain"')),null!==e)if(null!==(t=A()))if(null!==(r=Z()))if(null!==(n=$t())){if(o=[],a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;for(null!==s&&null!==(i=$t())?s=[s,i]:(s=null,y=a);null!==s;){if(o.push(s),a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;null!==s&&null!==(i=$t())?s=[s,i]:(s=null,y=a)}null!==o&&null!==(s=ee())?e=[e,t,r,n,o,s]:(e=null,y=u)}else e=null,y=u;else e=null,y=u;else e=null,y=u;else e=null,y=u;return e}function $t(){var e;return e=null===(e=He())?Ke():e}function Xt(){var e,t,r,n=y;return"nonce"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"nonce"')),null!==e&&null!==(t=A())&&null!==(r=Qt())?e=[e,t,r]:(e=null,y=n),e}function Qt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(j.nonce=t)),null===e&&(y=r),e}function Zt(){var e,t,r,n=y,o=y;return"opaque"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"opaque"')),null!==e&&null!==(r=A())&&null!==(t=C())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.opaque=r)),null===e&&(y=n),e}function er(){var e,t,r,n,o=y;return"stale"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"stale"')),null!==e&&null!==(t=A())&&(n=y,"true"===g.substr(y,4).toLowerCase()?(r=g.substr(y,4),y+=4):(r=null,_('"true"')),null===(r=null!==r?void(j.stale=!0):r)&&(y=n),null===r&&(n=y,"false"===g.substr(y,5).toLowerCase()?(r=g.substr(y,5),y+=5):(r=null,_('"false"')),null===(r=null!==r?void(j.stale=!1):r))&&(y=n),null!==r)?e=[e,t,r]:(e=null,y=o),e}function tr(){var e,t,r,n=y,o=y;return"algorithm"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"algorithm"')),null!==e&&null!==(r=A())&&("md5"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"MD5"')),null!==(t=null===t&&("md5-sess"===g.substr(y,8).toLowerCase()?(t=g.substr(y,8),y+=8):(t=null,_('"MD5-sess"')),null===t)?w():t))?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.algorithm=r.toUpperCase())),null===e&&(y=n),e}function rr(){var e,t,r,n,o,s,i,a,u,l=y;if("qop"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"qop"')),null!==e)if(null!==(t=A()))if(null!==(r=Z())){if(a=y,null!==(n=nr())){for(o=[],u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==s;)o.push(s),u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==o?n=[n,o]:(n=null,y=a)}else n=null,y=a;null!==n&&null!==(o=ee())?e=[e,t,r,n,o]:(e=null,y=l)}else e=null,y=l;else e=null,y=l;else e=null,y=l;return e}function nr(){var e,t,r=y;return"auth-int"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"auth-int"')),null!==(e=null===e&&("auth"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"auth"')),null===e)?w():e)&&(t=e,j.qop||(j.qop=[]),e=void j.qop.push(t.toLowerCase())),null===e&&(y=r),e}function or(){var e,t,r,n,o,s=y,i=y;if(null!==(e=P())){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;j.multi_header||(j.multi_header=[]);try{t=new M(j.uri,j.display_name,j.params),delete j.uri,delete j.display_name,delete j.params}catch(e){t=null}j.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function sr(){var e;return e=null===(e=ir())?L():e}function ir(){var e,t,r,n,o=y,s=y;if("cause"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"cause"')),null!==e)if(null!==(n=A())){if(null!==(r=l()))for(t=[];null!==r;)t.push(r),r=l();else t=null;null!==t?e=[e,n,t]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null!==e&&(n=e[2],e=void(j.cause=parseInt(n.join("")))),null===e&&(y=o),e}function ar(){var e,t,r,n,o,s=y;if(null!==(e=P())){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function ur(){var e,t=y;return"active"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"active"')),null===(e=null!==(e=null===e&&("pending"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"pending"')),null===e)&&("terminated"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"terminated"')),null===e)?w():e)?void(j.state=g.substring(y,t)):e)&&(y=t),e}function lr(){var e,t,r,n,o=y,s=y;return"reason"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"reason"')),null!==e&&null!==(t=A())&&null!==(r=cr())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(j.reason=n)):e)&&(y=o),e=null===e&&(s=o=y,"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(t=A())&&null!==(r=U())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(j.expires=n)):e)&&(y=o),null===e)&&(s=o=y,"retry_after"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"retry_after"')),null!==e&&null!==(t=A())&&null!==(r=U())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(j.retry_after=n)):e)&&(y=o),null===e)?L():e}function cr(){var e;return"deactivated"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"deactivated"')),e=null===e&&("probation"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"probation"')),null===e)&&("rejected"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"rejected"')),null===e)&&("timeout"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"timeout"')),null===e)&&("giveup"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"giveup"')),null===e)&&("noresource"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"noresource"')),null===e)&&("invariant"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"invariant"')),null===e)?w():e}function pr(){var e;return e=null===(e=qt())?L():e}function hr(){var e,t,r,n,o,s,i,a=y;if(null!==(e=br()))if(null!==(t=m()))if(null!==(r=wr())){for(n=[],i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function dr(){var e;return e=null===(e=fr())&&null===(e=mr())&&null===(e=gr())&&null===(e=yr())&&null===(e=_r())?L():e}function fr(){var e,t,r,n=y,o=y;return"ttl"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"ttl"')),null!==e&&null!==(r=A())&&null!==(t=Or())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.ttl=r)),null===e&&(y=n),e}function mr(){var e,t,r,n=y,o=y;return"maddr"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"maddr"')),null!==e&&null!==(r=A())&&null!==(t=fe())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.maddr=r)),null===e&&(y=n),e}function gr(){var e,t,r,n=y,o=y;return"received"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"received"')),null!==e&&null!==(r=A())&&null!==(t=null===(t=be())?ve():t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.received=r)),null===e&&(y=n),e}function yr(){var e,t,r,n=y,o=y;return"branch"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"branch"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.branch=r)),null===e&&(y=n),e}function _r(){var e,t,r,n,o=y;return"rport"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"rport"')),null!==e&&(n=y,null!==(t=A())&&null!==(r=vr())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function vr(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(j.rport=parseInt(o.join("")))),null===e&&(y=s),e}function br(){var e,t,r,n,o,s=y;return null!==(e=Tr())&&null!==(t=Y())&&null!==(r=w())&&null!==(n=Y())&&null!==(o=Sr())?e=[e,t,r,n,o]:(e=null,y=s),e}function Tr(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)&&(t=e,e=void(j.protocol=t)),null===e&&(y=r),e}function Sr(){var e,t,r=y;return"udp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"UDP"')),null!==(e=null===e&&("tcp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TCP"')),null===e)&&("tls"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TLS"')),null===e)&&("sctp"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"SCTP"')),null===e)?w():e)&&(t=e,e=void(j.transport=t)),null===e&&(y=r),e}function wr(){var e,t,r,n,o=y;return null!==(e=Er())&&(n=y,null!==(t=Q())&&null!==(r=Ar())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function Er(){var e,t=y;return null===(e=null!==(e=null===(e=be())&&null===(e=_e())?me():e)?void(j.host=g.substring(y,t)):e)&&(y=t),e}function Ar(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(j.port=parseInt(o.join("")))),null===e&&(y=s),e}function Or(){var e,t,r,n=y,o=y;return null!==(e=l())&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?parseInt(e.join("")):e)&&(y=n),e}function xr(){var e,t,r=y;return null!==(e=U())&&(t=e,e=void(j.expires=t)),null===e&&(y=r),e}function Cr(){var e;return e=null===(e=Rr())?L():e}function Rr(){var e,t,r,n=y,o=y;return"refresher"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"refresher"')),null!==e&&null!==(r=A())&&("uac"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uac"')),null===t&&("uas"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uas"'))),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.refresher=r.toLowerCase())),null===e&&(y=n),e}function Nr(){var e,t=[];for(null===(e=b())&&null===(e=S())&&(e=m());null!==e;)t.push(e),null===(e=b())&&null===(e=S())&&(e=m());return t}function Ir(){var e,t,r,n,o,s,i,a,u,l=y,c=y;return null!==(e=Pr())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null!==t)&&null!==(r=k())&&(45===g.charCodeAt(y)?(n="-",y++):(n=null,_('"-"')),null!==n)&&null!==(o=k())&&(45===g.charCodeAt(y)?(s="-",y++):(s=null,_('"-"')),null!==s)&&null!==(i=k())&&(45===g.charCodeAt(y)?(a="-",y++):(a=null,_('"-"')),null!==a)&&null!==(u=Ur())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=c),null!==e&&(e[0],e=void(j=g.substring(y+5,l))),null===e&&(y=l),e}function k(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=a())&&null!==(r=a())&&null!==(n=a())?e=[e,t,r,n]:(e=null,y=o),e}function Pr(){var e,t,r=y;return null!==(e=k())&&null!==(t=k())?e=[e,t]:(e=null,y=r),e}function Ur(){var e,t,r,n=y;return null!==(e=k())&&null!==(t=k())&&null!==(r=k())?e=[e,t,r]:(e=null,y=n),e}function Lr(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(j.call_id=g.substring(y,o)):e)&&(y=o),e}function kr(){var e;return e=null===(e=Mr())&&null===(e=jr())&&null===(e=Dr())?L():e}function Mr(){var e,t,r,n=y,o=y;return"to-tag"===g.substr(y,6)?(e="to-tag",y+=6):(e=null,_('"to-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.to_tag=r)),null===e&&(y=n),e}function jr(){var e,t,r,n=y,o=y;return"from-tag"===g.substr(y,8)?(e="from-tag",y+=8):(e=null,_('"from-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.from_tag=r)),null===e&&(y=n),e}function Dr(){var e,t=y;return"early-only"===g.substr(y,10)?(e="early-only",y+=10):(e=null,_('"early-only"')),null===(e=null!==e?void(j.early_only=!0):e)&&(y=t),e}var Vr,Br,Fr=V(),M=D(),j={};return null===e[u]()||y!==g.length?(Vr=(e=Math.max(y,s))<g.length?g.charAt(e):null,Br=(()=>{for(var e=1,t=1,r=!1,n=0;n<Math.max(y,s);n++)var o=g.charAt(n),r="\n"===o?(r||e++,!(t=1)):"\r"===o||"\u2028"===o||"\u2029"===o?(e++,t=1,!0):(t++,!1);return{line:e,column:t}})(),new this.SyntaxError((e=>{e.sort();for(var t=null,r=[],n=0;n<e.length;n++)e[n]!==t&&(r.push(e[n]),t=e[n]);return r})(t),Vr,e,Br.line,Br.column),-1):j},toSource:function(){return this._source},SyntaxError:function(e,t,r,n,o){this.name="SyntaxError",this.expected=e,this.found=t,this.message=((e,t)=>{var r;switch(e.length){case 0:r="end of input";break;case 1:r=e[0];break;default:r=e.slice(0,e.length-1).join(", ")+" or "+e[e.length-1]}return"Expected "+r+" but "+(t?qr(t):"end of input")+" found."})(e,t),this.offset=r,this.line=n,this.column=o}}).SyntaxError.prototype=Error.prototype,O=e),O;function qr(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 e}function V(){var l,a,t;return R||(R=1,l=i,a=B(),t=M(),C=c(h,[{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}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=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){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[a.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[a.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(a.headerize(e))}},{key:"deleteHeader",value:function(e){var t;if(e=a.headerize(e),this._headers.hasOwnProperty(e))return t=this._headers[e],delete this._headers[e],t}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new h(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,r=[],n="".concat(this._scheme,":");for(e in this._user&&(n+="".concat(a.escapeUser(this._user),"@")),n+=this._host,!this._port&&0!==this._port||(n+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(n+=";".concat(e),null!==this._parameters[e])&&(n+="=".concat(this._parameters[e]));for(t in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,t)){var o,s=p(this._headers[t]);try{for(s.s();!(o=s.n()).done;){var i=o.value;r.push("".concat(t,"=").concat(i))}}catch(r){s.e(r)}finally{s.f()}}return 0<r.length&&(n+="?".concat(r.join("&"))),n}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(a.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"SIP_URI"))?e:void 0}}])),C;function h(e,t,r,n){var o,s,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{};if(u(this,h),!r)throw new TypeError('missing or invalid "host" parameter');for(o in this._parameters={},this._headers={},this._scheme=e||l.SIP,this._user=t,this._host=r,this._port=n,i)Object.prototype.hasOwnProperty.call(i,o)&&this.setParam(o,i[o]);for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&this.setHeader(s,a[s])}}function B(){var s,a,t,u,e,l;return N||(N=1,s=i,a=V(),t=M(),j.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},u=j.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},j.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},j.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},j.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},j.hasMethods=function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var o=0,s=r;o<s.length;o++){var i=s[o];if(u(e[i]))return!1}return!0},e=j.createRandomToken=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32,r="",n=0;n<e;n++)r+=(Math.random()*t|0).toString(t);return r},j.newTag=function(){return e(10)},j.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},j.hostType=function(e){return e&&-1!==(e=t.parse(e,"host"))?e.host_type:void 0},l=j.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},j.normalizeTarget=function(e,t){if(e){if(e instanceof a)return e;if("string"==typeof e){var r,n,o=e.split("@");switch(o.length){case 1:if(!t)return;r=e,n=t;break;case 2:r=o[0],n=o[1];break;default:r=o.slice(0,o.length-1).join("@"),n=o[o.length-1]}return r=r.replace(/^(sips?|tel):/i,""),/^[-.()]*\+?[0-9\-.()]+$/.test(r)&&(r=r.replace(/[-.()]/g,"")),e="".concat(s.SIP,":").concat(l(r),"@").concat(n),a.parse(e)||void 0}}},j.headerize=function(e){for(var t={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),n="",o=r.length,s=0;s<o;s++)0!==s&&(n+="-"),n+=r[s].charAt(0).toUpperCase()+r[s].substring(1);return n=t[n]?t[n]:n},j.sipErrorCause=function(e){for(var t in s.SIP_ERROR_CAUSES)if(-1!==s.SIP_ERROR_CAUSES[t].indexOf(e))return s.causes[t];return s.causes.SIP_FAILURE_CODE},j.getRandomTestNetIP=function(){return"192.0.2.".concat(Math.floor(254*Math.random()+1))},j.calculateMD5=function(e){function a(e,t){return e<<t|e>>>32-t}function u(e,t){var r=2147483648&e,n=2147483648&t,o=1073741824&e,s=1073741824&t,e=(1073741823&e)+(1073741823&t);return o&s?2147483648^e^r^n:o|s?1073741824&e?3221225472^e^r^n:1073741824^e^r^n:e^r^n}function t(e,t,r,n,o,s,i){return e=u(e,u(u(t&r|~t&n,o),i)),u(a(e,s),t)}function r(e,t,r,n,o,s,i){return e=u(e,u(u(t&n|r&~n,o),i)),u(a(e,s),t)}function n(e,t,r,n,o,s,i){return e=u(e,u(u(t^r^n,o),i)),u(a(e,s),t)}function o(e,t,r,n,o,s,i){return e=u(e,u(u(r^(t|~n),o),i)),u(a(e,s),t)}function s(e){for(var t="",r="",n=0;n<=3;n++)t+=(r="0".concat((e>>>8*n&255).toString(16))).substr(r.length-2,2);return t}for(var i,l,c,p,h=(e=>{for(var t,r=e.length,n=16*(((n=r+8)-n%64)/64+1),o=new Array(n-1),s=0,i=0;i<r;)s=i%4*8,o[t=(i-i%4)/4]=o[t]|e.charCodeAt(i)<<s,i++;return o[t=(i-i%4)/4]=o[t]|128<<(s=i%4*8),o[n-2]=r<<3,o[n-1]=r>>>29,o})(e=(e=>{for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):(127<n&&n<2048?t+=String.fromCharCode(n>>6|192):t=(t+=String.fromCharCode(n>>12|224))+String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t})(e)),d=1732584193,f=4023233417,m=2562383102,g=271733878,y=0;y<h.length;y+=16)d=t(i=d,l=f,c=m,p=g,h[y+0],7,3614090360),g=t(g,d,f,m,h[y+1],12,3905402710),m=t(m,g,d,f,h[y+2],17,606105819),f=t(f,m,g,d,h[y+3],22,3250441966),d=t(d,f,m,g,h[y+4],7,4118548399),g=t(g,d,f,m,h[y+5],12,1200080426),m=t(m,g,d,f,h[y+6],17,2821735955),f=t(f,m,g,d,h[y+7],22,4249261313),d=t(d,f,m,g,h[y+8],7,1770035416),g=t(g,d,f,m,h[y+9],12,2336552879),m=t(m,g,d,f,h[y+10],17,4294925233),f=t(f,m,g,d,h[y+11],22,2304563134),d=t(d,f,m,g,h[y+12],7,1804603682),g=t(g,d,f,m,h[y+13],12,4254626195),m=t(m,g,d,f,h[y+14],17,2792965006),d=r(d,f=t(f,m,g,d,h[y+15],22,1236535329),m,g,h[y+1],5,4129170786),g=r(g,d,f,m,h[y+6],9,3225465664),m=r(m,g,d,f,h[y+11],14,643717713),f=r(f,m,g,d,h[y+0],20,3921069994),d=r(d,f,m,g,h[y+5],5,3593408605),g=r(g,d,f,m,h[y+10],9,38016083),m=r(m,g,d,f,h[y+15],14,3634488961),f=r(f,m,g,d,h[y+4],20,3889429448),d=r(d,f,m,g,h[y+9],5,568446438),g=r(g,d,f,m,h[y+14],9,3275163606),m=r(m,g,d,f,h[y+3],14,4107603335),f=r(f,m,g,d,h[y+8],20,1163531501),d=r(d,f,m,g,h[y+13],5,2850285829),g=r(g,d,f,m,h[y+2],9,4243563512),m=r(m,g,d,f,h[y+7],14,1735328473),d=n(d,f=r(f,m,g,d,h[y+12],20,2368359562),m,g,h[y+5],4,4294588738),g=n(g,d,f,m,h[y+8],11,2272392833),m=n(m,g,d,f,h[y+11],16,1839030562),f=n(f,m,g,d,h[y+14],23,4259657740),d=n(d,f,m,g,h[y+1],4,2763975236),g=n(g,d,f,m,h[y+4],11,1272893353),m=n(m,g,d,f,h[y+7],16,4139469664),f=n(f,m,g,d,h[y+10],23,3200236656),d=n(d,f,m,g,h[y+13],4,681279174),g=n(g,d,f,m,h[y+0],11,3936430074),m=n(m,g,d,f,h[y+3],16,3572445317),f=n(f,m,g,d,h[y+6],23,76029189),d=n(d,f,m,g,h[y+9],4,3654602809),g=n(g,d,f,m,h[y+12],11,3873151461),m=n(m,g,d,f,h[y+15],16,530742520),d=o(d,f=n(f,m,g,d,h[y+2],23,3299628645),m,g,h[y+0],6,4096336452),g=o(g,d,f,m,h[y+7],10,1126891415),m=o(m,g,d,f,h[y+14],15,2878612391),f=o(f,m,g,d,h[y+5],21,4237533241),d=o(d,f,m,g,h[y+12],6,1700485571),g=o(g,d,f,m,h[y+3],10,2399980690),m=o(m,g,d,f,h[y+10],15,4293915773),f=o(f,m,g,d,h[y+1],21,2240044497),d=o(d,f,m,g,h[y+8],6,1873313359),g=o(g,d,f,m,h[y+15],10,4264355552),m=o(m,g,d,f,h[y+6],15,2734768916),f=o(f,m,g,d,h[y+13],21,1309151649),d=o(d,f,m,g,h[y+4],6,4149444226),g=o(g,d,f,m,h[y+11],10,3174756917),m=o(m,g,d,f,h[y+2],15,718787259),f=o(f,m,g,d,h[y+9],21,3951481745),d=u(d,i),f=u(f,l),m=u(m,c),g=u(g,p);return(s(d)+s(f)+s(m)+s(g)).toLowerCase()},j.closeMediaStream=function(e){if(e)try{if(e.getTracks){var t,r=p(e.getTracks());try{for(r.s();!(t=r.n()).done;)t.value.stop()}catch(e){r.e(e)}finally{r.f()}}else{var n,o=p(e.getAudioTracks());try{for(o.s();!(n=o.n()).done;)n.value.stop()}catch(e){o.e(e)}finally{o.f()}var s,i=p(e.getVideoTracks());try{for(i.s();!(s=i.n()).done;)s.value.stop()}catch(e){i.e(e)}finally{i.f()}}}catch(t){"function"!=typeof e.stop&&"object"!==T(e.stop)||e.stop()}},j.cloneArray=function(e){return e&&e.slice()||[]},j.cloneObject=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},j.toPlainObject=function(r){var n;return"object"!==T(r)||null===r?r:(n={},Object.keys(r).forEach(function(e){var t=r[e];!t||"function"==typeof t||t instanceof Date||t instanceof RegExp||"symbol"===T(t)||"object"===T(t)&&t.constructor!==Object||(n[e]=t)}),n)},j.isMiniProgram=function(){return"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo&&"undefined"==typeof window}),j}function F(){}function q(){q.init.call(this)}function H(e){return void 0===e._maxListeners?q.defaultMaxListeners:e._maxListeners}function G(e,t,r,n){var o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');return(o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener||r),o=e._events),s=o[t]):(o=e._events=new F,e._eventsCount=0),s?("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(n=H(e))&&0<n&&s.length>n&&(s.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=s.length,n=n,"function"==typeof console.warn?console.warn(n):console.log(n))):(s=o[t]=r,++e._eventsCount),e}function z(e,t,r){var n=!1;function o(){e.removeListener(t,o),n||(n=!0,r.apply(e,arguments))}return o.listener=r,o}function K(e){var t=this._events;if(t){t=t[e];if("function"==typeof t)return 1;if(t)return t.length}return 0}function Y(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}F.prototype=Object.create(null),(q.EventEmitter=q).usingDomains=!1,q.prototype.domain=void 0,q.prototype._events=void 0,q.prototype._maxListeners=void 0,q.defaultMaxListeners=10,q.init=function(){this.domain=null,q.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new F,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},q.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},q.prototype.getMaxListeners=function(){return H(this)},q.prototype.emit=function(e){var t,r,n,o,s,i="error"===e;if(s=this._events)i=i&&null==s.error;else if(!i)return!1;if(a=this.domain,i){if(i=arguments[1],a)return(i=i||new Error('Uncaught, unspecified "error" event')).domainEmitter=this,i.domain=a,i.domainThrown=!1,a.emit("error",i),!1;if(i instanceof Error)throw i;var a=new Error('Uncaught, unspecified "error" event. ('+i+")");throw a.context=i,a}if(!(t=s[e]))return!1;var u="function"==typeof t;switch(r=arguments.length){case 1:var l=t,c=this;if(u)l.call(c);else for(var p=l.length,k=Y(l,p),h=0;h<p;++h)k[h].call(c);break;case 2:var l=t,d=u,f=this,m=arguments[1];if(d)l.call(f,m);else for(var g=l.length,M=Y(l,g),y=0;y<g;++y)M[y].call(f,m);break;case 3:var d=t,_=u,v=this,b=arguments[1],T=arguments[2];if(_)d.call(v,b,T);else for(var S=d.length,j=Y(d,S),w=0;w<S;++w)j[w].call(v,b,T);break;case 4:var _=t,E=u,A=this,O=arguments[1],x=arguments[2],C=arguments[3];if(E)_.call(A,O,x,C);else for(var R=_.length,D=Y(_,R),N=0;N<R;++N)D[N].call(A,O,x,C);break;default:for(n=new Array(r-1),o=1;o<r;o++)n[o-1]=arguments[o];var E=t,I=this,P=n;if(u)E.apply(I,P);else for(var U=E.length,V=Y(E,U),L=0;L<U;++L)V[L].apply(I,P)}return!0},q.prototype.addListener=function(e,t){return G(this,e,t,!1)},q.prototype.on=q.prototype.addListener,q.prototype.prependListener=function(e,t){return G(this,e,t,!0)},q.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,z(this,e,t)),this},q.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,z(this,e,t)),this},q.prototype.removeListener=function(e,t){var r,n,o,s,i;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if((n=this._events)&&(r=n[e]))if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new F:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length;0<s--;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new F,this;delete n[e]}else{var a=r;for(var u=o,l=u+1,c=a.length;l<c;u+=1,l+=1)a[u]=a[l];a.pop()}n.removeListener&&this.emit("removeListener",e,i||t)}return this},q.prototype.off=function(e,t){return this.removeListener(e,t)},q.prototype.removeAllListeners=function(e){var t,r;if(r=this._events)if(r.removeListener){if(0===arguments.length){for(var n,o=Object.keys(r),s=0;s<o.length;++s)"removeListener"!==(n=o[s])&&this.removeAllListeners(n);this.removeAllListeners("removeListener"),this._events=new F,this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(;this.removeListener(e,t[t.length-1]),t[0];);}else 0===arguments.length?(this._events=new F,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new F:delete r[e]);return this},q.prototype.listeners=function(e){var t=this._events;{if(t&&(t=t[e])){if("function"==typeof t)return[t.listener||t];for(var r=t,n=new Array(r.length),o=0;o<n.length;++o)n[o]=r[o].listener||r[o];return n}return[]}},q.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):K.call(e,t)},q.prototype.listenerCount=K,q.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]};var W=r(Object.freeze({__proto__:null,default:q,EventEmitter:q})),$="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function J(){throw new Error("setTimeout has not been defined")}function X(){throw new Error("clearTimeout has not been defined")}var Q=J,Z=X;function ee(t){if(Q===setTimeout)return setTimeout(t,0);if((Q===J||!Q)&&setTimeout)return(Q=setTimeout)(t,0);try{return Q(t,0)}catch(e){try{return Q.call(null,t,0)}catch(e){return Q.call(this,t,0)}}}"function"==typeof $.setTimeout&&(Q=setTimeout),"function"==typeof $.clearTimeout&&(Z=clearTimeout);var te,re=[],ne=!1,oe=-1;function ie(){ne&&te&&(ne=!1,te.length?re=te.concat(re):oe=-1,re.length)&&se()}function se(){if(!ne){var e=ee(ie);ne=!0;for(var t=re.length;t;){for(te=re,re=[];++oe<t;)te&&te[oe].run();oe=-1,t=re.length}te=null,ne=!1,function(t){if(Z===clearTimeout)return clearTimeout(t);if((Z===X||!Z)&&clearTimeout)return(Z=clearTimeout)(t);try{Z(t)}catch(e){try{return Z.call(null,t)}catch(e){return Z.call(this,t)}}}(e)}}function ae(e,t){this.fun=e,this.array=t}function ue(){}ae.prototype.run=function(){this.fun.apply(null,this.array)};var ve,be,le=ue,ce=ue,pe=ue,de=ue,he=ue,fe=ue,me=ue,ge=$.performance||{},ye=ge.now||ge.mozNow||ge.msNow||ge.oNow||ge.webkitNow||function(){return(new Date).getTime()},_e=new Date,Te={nextTick:function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];re.push(new ae(e,t)),1!==re.length||ne||ee(se)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:le,addListener:ce,once:pe,off:de,removeListener:he,removeAllListeners:fe,emit:me,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ye.call(ge),r=Math.floor(t),t=Math.floor(t%1*1e9);return e&&(r-=e[0],(t-=e[1])<0)&&(r--,t+=1e9),[r,t]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-_e)/1e3}},Se={exports:{}};function we(){if(be)return ve;be=1;var o=1e3,s=60*o,i=60*s,a=24*i,u=7*a,l=365.25*a;function c(e,t,r,n){t=1.5*r<=t;return Math.round(e/r)+" "+n+(t?"s":"")}return ve=function(e,t){t=t||{};var r=typeof e;if(!("string"==r&&0<e.length)){if("number"==r&&isFinite(e))return t.long?(r=e,t=Math.abs(r),a<=t?c(r,t,a,"day"):i<=t?c(r,t,i,"hour"):s<=t?c(r,t,s,"minute"):o<=t?c(r,t,o,"second"):r+" ms"):(t=e,r=Math.abs(t),a<=r?Math.round(t/a)+"d":i<=r?Math.round(t/i)+"h":s<=r?Math.round(t/s)+"m":o<=r?Math.round(t/o)+"s":t+"ms");throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}r=e;if(!(100<(r=String(r)).length)){r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(r){var n=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"weeks":case"week":case"w":return n*u;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}}var Ee=function(t){function a(e){let r,t,n,o=null;function i(...s){if(i.enabled){let n=i,e=Number(new Date),t=e-(r||e),o=(n.diff=t,n.prev=r,n.curr=e,r=e,s[0]=a.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O"),0);s[0]=s[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;r=a.formatters[r];if("function"==typeof r){let e=s[o];t=r.call(n,e),s.splice(o,1),o--}return t}),a.formatArgs.call(n,s),(n.log||a.log).apply(n,s)}}return i.namespace=e,i.useColors=a.useColors(),i.color=a.selectColor(e),i.extend=s,i.destroy=a.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(t!==a.namespaces&&(t=a.namespaces,n=a.enabled(e)),n),set:e=>{o=e}}),"function"==typeof a.init&&a.init(i),i}function s(e,t){t=a(this.namespace+(void 0===t?":":t)+e);return t.log=this.log,t}function n(e,t){let r=0,n=0,o=-1,s=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,s=r):r++,n++;else{if(-1===o)return;n=o+1,s++,r=s}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return((a.debug=a).default=a).coerce=function(e){return e instanceof Error?e.stack||e.message:e},a.disable=function(){var e=[...a.names,...a.skips.map(e=>"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){a.save(e),a.namespaces=e,a.names=[],a.skips=[];var t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let e of t)"-"===e[0]?a.skips.push(e.slice(1)):a.names.push(e)},a.enabled=function(e){for(var t of a.skips)if(n(e,t))return!1;for(var r of a.names)if(n(e,r))return!0;return!1},a.humanize=we(),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(t){let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return a.colors[Math.abs(r)%a.colors.length]},a.enable(a.load()),a},Ae=(((t,r)=>{r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e)&&(r=t)}),e.splice(r,0,n)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}return e=!e&&"env"in Te?Te.env.DEBUG:e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&31<=parseInt(e[1],10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=(()=>{try{return localStorage}catch(e){}})(),r.destroy=(()=>{let e=!1;return()=>{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`."))}})(),r.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"],r.log=console.debug||console.log||(()=>{}),t.exports=Ee(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})(Se,Se.exports),{}),Oe=[],xe=[],Ce="undefined"!=typeof Uint8Array?Uint8Array:Array,Re=!1;function Ne(){Re=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Oe[t]=e[t],xe[e.charCodeAt(t)]=t;xe["-".charCodeAt(0)]=62,xe["_".charCodeAt(0)]=63}function Ie(e){return Oe[e>>18&63]+Oe[e>>12&63]+Oe[e>>6&63]+Oe[63&e]}function Pe(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(Ie(n));return o.join("")}function Ue(e){var t;Re||Ne();for(var r=e.length,n=r%3,o="",s=[],i=0,a=r-n;i<a;i+=16383)s.push(Pe(e,i,a<i+16383?a:i+16383));return 1==n?(t=e[r-1],o=(o+=Oe[t>>2])+Oe[t<<4&63]+"=="):2==n&&(t=(e[r-2]<<8)+e[r-1],o=(o=(o+=Oe[t>>10])+Oe[t>>4&63])+Oe[t<<2&63]+"="),s.push(o),s.join("")}function ke(e,t,r,n,o){var s,i,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,p=r?o-1:0,h=r?-1:1,o=e[t+p];for(p+=h,s=o&(1<<-c)-1,o>>=-c,c+=a;0<c;s=256*s+e[t+p],p+=h,c-=8);for(i=s&(1<<-c)-1,s>>=-c,c+=n;0<c;i=256*i+e[t+p],p+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return i?NaN:1/0*(o?-1:1);i+=Math.pow(2,n),s-=l}return(o?-1:1)*i*Math.pow(2,s-n)}function Le(e,t,r,n,o,s){var i,a,u=8*s-o-1,l=(1<<u)-1,c=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,d=n?1:-1,s=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-i))<1&&(i--,n*=2),2<=(t+=1<=i+c?p/n:p*Math.pow(2,1-c))*n&&(i++,n/=2),l<=i+c?(a=0,i=l):1<=i+c?(a=(t*n-1)*Math.pow(2,o),i+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),i=0));8<=o;e[r+h]=255&a,h+=d,a/=256,o-=8);for(i=i<<o|a,u+=o;0<u;e[r+h]=255&i,h+=d,i/=256,u-=8);e[r+h-d]|=128*s}var je={}.toString,De=Array.isArray||function(e){return"[object Array]"==je.call(e)};function Me(){return Be.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ve(e,t){if(Me()<t)throw new RangeError("Invalid typed array length");return Be.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Be.prototype:(e=null===e?new Be(t):e).length=t,e}function Be(e,t,r){if(!(Be.TYPED_ARRAY_SUPPORT||this instanceof Be))return new Be(e,t,r);if("number"!=typeof e)return Fe(this,e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return He(this,e)}function Fe(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var o=e,s=t,i=r;if(s.byteLength,i<0||s.byteLength<i)throw new RangeError("'offset' is out of bounds");if(s.byteLength<i+(n||0))throw new RangeError("'length' is out of bounds");return s=void 0===i&&void 0===n?new Uint8Array(s):void 0===n?new Uint8Array(s,i):new Uint8Array(s,i,n),Be.TYPED_ARRAY_SUPPORT?(o=s).__proto__=Be.prototype:o=Ge(o,s),o}if("string"==typeof t){i=e,n=t,s=r;if(Be.isEncoding(s="string"==typeof s&&""!==s?s:"utf8"))return(n=(i=Ve(i,o=0|Ye(n,s))).write(n,s))!==o?i.slice(0,n):i;throw new TypeError('"encoding" must be a valid string encoding')}var a,r=e,n=t;if(Ke(n))return 0!==(r=Ve(r,a=0|ze(n.length))).length&&n.copy(r,0,0,a),r;if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||(a=n.length)!=a?Ve(r,0):Ge(r,n);if("Buffer"===n.type&&De(n.data))return Ge(r,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function qe(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function He(e,t){if(qe(t),e=Ve(e,t<0?0:0|ze(t)),!Be.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Ge(e,t){var r=t.length<0?0:0|ze(t.length);e=Ve(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function ze(e){if(e>=Me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Me().toString(16)+" bytes");return 0|e}function Ke(e){return!(null==e||!e._isBuffer)}function Ye(e,t){if(Ke(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var r=(e="string"!=typeof e?""+e:e).length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return bt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Tt(e).length;default:if(n)return bt(e).length;t=(""+t).toLowerCase(),n=!0}}function We(e,t,r){var n=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return lt(this,t,r);case"utf8":case"utf-8":return it(this,t,r);case"ascii":return at(this,t,r);case"latin1":case"binary":return ut(this,t,r);case"base64":return ot(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ct(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function $e(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Je(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,(r=(r=isNaN(r)?o?0:e.length-1:r)<0?e.length+r:r)>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if(Ke(t="string"==typeof t?Be.from(t,n):t))return 0===t.length?-1:Xe(e,t,r,n,o);if("number"==typeof t)return t&=255,Be.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):Xe(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Xe(e,t,r,n,o){var s=1,i=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i/=s=2,a/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o)for(var l=-1,c=r;c<i;c++)if(u(e,c)===u(t,-1===l?0:c-l)){if(c-(l=-1===l?c:l)+1===a)return l*s}else-1!==l&&(c-=c-l),l=-1;else for(c=r=i<r+a?i-a:r;0<=c;c--){for(var p=!0,h=0;h<a;h++)if(u(e,c+h)!==u(t,h)){p=!1;break}if(p)return c}return-1}function Qe(e,t,r,n){r=Number(r)||0;var o=e.length-r,o=((!n||(n=Number(n))>o)&&(n=o),t.length);if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(n=o/2);for(var s=0;s<n;++s){var i=parseInt(t.substr(2*s,2),16);if(isNaN(i))return s;e[r+s]=i}return s}function Ze(e,t,r,n){return St(bt(t,e.length-r),e,r,n)}function et(e,t,r,n){return St((e=>{for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t})(t),e,r,n)}function tt(e,t,r,n){return et(e,t,r,n)}function rt(e,t,r,n){return St(Tt(t),e,r,n)}function nt(e,t,r,n){return St(((e,t)=>{for(var r,n,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o.push(r%256),o.push(n);return o})(t,e.length-r),e,r,n)}function ot(e,t,r){return 0===t&&r===e.length?Ue(e):Ue(e.slice(t,r))}function it(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var s,i,a,u,l=e[o],c=null,p=239<l?4:223<l?3:191<l?2:1;if(o+p<=r)switch(p){case 1:l<128&&(c=l);break;case 2:128==(192&(s=e[o+1]))&&127<(u=(31&l)<<6|63&s)&&(c=u);break;case 3:s=e[o+1],i=e[o+2],128==(192&s)&&128==(192&i)&&2047<(u=(15&l)<<12|(63&s)<<6|63&i)&&(u<55296||57343<u)&&(c=u);break;case 4:s=e[o+1],i=e[o+2],a=e[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&s)<<12|(63&i)<<6|63&a)&&u<1114112&&(c=u)}null===c?(c=65533,p=1):65535<c&&(n.push((c-=65536)>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=p}var h=n,d=h.length;if(d<=st)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<d;)f+=String.fromCharCode.apply(String,h.slice(m,m+=st));return f}Be.TYPED_ARRAY_SUPPORT=void 0===$.TYPED_ARRAY_SUPPORT||$.TYPED_ARRAY_SUPPORT,Me(),Be.poolSize=8192,Be._augment=function(e){return e.__proto__=Be.prototype,e},Be.from=function(e,t,r){return Fe(null,e,t,r)},Be.TYPED_ARRAY_SUPPORT&&(Be.prototype.__proto__=Uint8Array.prototype,Be.__proto__=Uint8Array),Be.alloc=function(e,t,r){return t=t,r=r,qe(e=e),!(e<=0)&&void 0!==t?"string"==typeof r?Ve(null,e).fill(t,r):Ve(null,e).fill(t):Ve(null,e)},Be.allocUnsafe=function(e){return He(null,e)},Be.allocUnsafeSlow=function(e){return He(null,e)},Be.isBuffer=function(e){return null!=e&&(!!e._isBuffer||wt(e)||"function"==typeof(e=e).readFloatLE&&"function"==typeof e.slice&&wt(e.slice(0,0)))},Be.compare=function(e,t){if(!Ke(e)||!Ke(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},Be.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Be.concat=function(e,t){if(!De(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Be.alloc(0);if(void 0===t)for(o=t=0;o<e.length;++o)t+=e[o].length;for(var r=Be.allocUnsafe(t),n=0,o=0;o<e.length;++o){var s=e[o];if(!Ke(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},Be.byteLength=Ye,Be.prototype._isBuffer=!0,Be.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)$e(this,t,t+1);return this},Be.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)$e(this,t,t+3),$e(this,t+1,t+2);return this},Be.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)$e(this,t,t+7),$e(this,t+1,t+6),$e(this,t+2,t+5),$e(this,t+3,t+4);return this},Be.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?it(this,0,e):We.apply(this,arguments)},Be.prototype.equals=function(e){if(Ke(e))return this===e||0===Be.compare(this,e);throw new TypeError("Argument must be a Buffer")},Be.prototype.inspect=function(){var e="";return 0<this.length&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length)&&(e+=" ... "),"<Buffer "+e+">"},Be.prototype.compare=function(e,t,r,n,o){if(!Ke(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),a=Math.min(s,i),u=this.slice(n,o),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){s=u[c],i=l[c];break}return s<i?-1:i<s?1:0},Be.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Be.prototype.indexOf=function(e,t,r){return Je(this,e,t,r,!0)},Be.prototype.lastIndexOf=function(e,t,r){return Je(this,e,t,r,!1)},Be.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||o<r)&&(r=o),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var s=!1;;)switch(n){case"hex":return Qe(this,e,t,r);case"utf8":case"utf-8":return Ze(this,e,t,r);case"ascii":return et(this,e,t,r);case"latin1":case"binary":return tt(this,e,t,r);case"base64":return rt(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nt(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},Be.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var st=4096;function at(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function ut(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function lt(e,t,r){var n=e.length;(!r||r<0||n<r)&&(r=n);for(var o="",s=t=!t||t<0?0:t;s<r;++s)o+=vt(e[s]);return o}function ct(e,t,r){for(var n=e.slice(t,r),o="",s=0;s<n.length;s+=2)o+=String.fromCharCode(n[s]+256*n[s+1]);return o}function pt(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function dt(e,t,r,n,o,s){if(!Ke(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<t||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function ht(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-r,2);o<s;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function ft(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-r,4);o<s;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function mt(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function gt(e,t,r,n,o){return o||mt(e,0,r,4),Le(e,t,r,n,23,4),r+4}function yt(e,t,r,n,o){return o||mt(e,0,r,8),Le(e,t,r,n,52,8),r+8}Be.prototype.slice=function(e,t){var r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e),Be.TYPED_ARRAY_SUPPORT)(o=this.subarray(e,t)).__proto__=Be.prototype;else for(var n=t-e,o=new Be(n,void 0),s=0;s<n;++s)o[s]=this[s+e];return o},Be.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||pt(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n},Be.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||pt(e,t,this.length);for(var n=this[e+--t],o=1;0<t&&(o*=256);)n+=this[e+--t]*o;return n},Be.prototype.readUInt8=function(e,t){return t||pt(e,1,this.length),this[e]},Be.prototype.readUInt16LE=function(e,t){return t||pt(e,2,this.length),this[e]|this[e+1]<<8},Be.prototype.readUInt16BE=function(e,t){return t||pt(e,2,this.length),this[e]<<8|this[e+1]},Be.prototype.readUInt32LE=function(e,t){return t||pt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Be.prototype.readUInt32BE=function(e,t){return t||pt(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Be.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||pt(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},Be.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||pt(e,t,this.length);for(var n=t,o=1,s=this[e+--n];0<n&&(o*=256);)s+=this[e+--n]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*t)),s},Be.prototype.readInt8=function(e,t){return t||pt(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Be.prototype.readInt16LE=function(e,t){t||pt(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},Be.prototype.readInt16BE=function(e,t){t||pt(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},Be.prototype.readInt32LE=function(e,t){return t||pt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Be.prototype.readInt32BE=function(e,t){return t||pt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Be.prototype.readFloatLE=function(e,t){return t||pt(e,4,this.length),ke(this,e,!0,23,4)},Be.prototype.readFloatBE=function(e,t){return t||pt(e,4,this.length),ke(this,e,!1,23,4)},Be.prototype.readDoubleLE=function(e,t){return t||pt(e,8,this.length),ke(this,e,!0,52,8)},Be.prototype.readDoubleBE=function(e,t){return t||pt(e,8,this.length),ke(this,e,!1,52,8)},Be.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||dt(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},Be.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||dt(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,s=1;for(this[t+o]=255&e;0<=--o&&(s*=256);)this[t+o]=e/s&255;return t+r},Be.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,1,255,0),Be.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Be.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,2,65535,0),Be.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ht(this,e,t,!0),t+2},Be.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,2,65535,0),Be.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ht(this,e,t,!1),t+2},Be.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,4,4294967295,0),Be.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):ft(this,e,t,!0),t+4},Be.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,4,4294967295,0),Be.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ft(this,e,t,!1),t+4},Be.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||dt(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,s=1,i=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},Be.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||dt(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,s=1,i=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},Be.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,1,127,-128),Be.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},Be.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,2,32767,-32768),Be.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ht(this,e,t,!0),t+2},Be.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,2,32767,-32768),Be.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ht(this,e,t,!1),t+2},Be.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,4,2147483647,-2147483648),Be.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ft(this,e,t,!0),t+4},Be.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||dt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Be.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ft(this,e,t,!1),t+4},Be.prototype.writeFloatLE=function(e,t,r){return gt(this,e,t,!0,r)},Be.prototype.writeFloatBE=function(e,t,r){return gt(this,e,t,!1,r)},Be.prototype.writeDoubleLE=function(e,t,r){return yt(this,e,t,!0,r)},Be.prototype.writeDoubleBE=function(e,t,r){return yt(this,e,t,!1,r)},Be.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0<n&&n<r?r:n)===r)return 0;if(0===e.length||0===this.length)return 0;if((t=t||0)<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o,s=(n=e.length-t<n-r?e.length-t+r:n)-r;if(this===e&&r<t&&t<n)for(o=s-1;0<=o;--o)e[o+t]=this[o+r];else if(s<1e3||!Be.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},Be.prototype.fill=function(e,t,r,n){if("string"==typeof e){var o;if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length&&(o=e.charCodeAt(0))<256&&(e=o),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Be.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(!(r<=t))if(t>>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(a=t;a<r;++a)this[a]=e;else for(var s=Ke(e)?e:bt(new Be(e,n).toString()),i=s.length,a=0;a<r-t;++a)this[a+t]=s[a%i];return this};var _t=/[^+\/0-9A-Za-z-_]/g;function vt(e){return e<16?"0"+e.toString(16):e.toString(16)}function bt(e,t){var r;t=t||1/0;for(var n=e.length,o=null,s=[],i=0;i<n;++i){if(55295<(r=e.charCodeAt(i))&&r<57344){if(!o){if(56319<r){-1<(t-=3)&&s.push(239,191,189);continue}if(i+1===n){-1<(t-=3)&&s.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(t-=3)&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(t-=3)&&s.push(239,191,189);if(o=null,r<128){if(--t<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Tt(e){var t=(e=>{if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(_t,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e})(e);Re||Ne();var r,e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");for(var n="="===t[e-2]?2:"="===t[e-1]?1:0,o=new Ce(3*e/4-n),s=0<n?e-4:e,i=0,a=0;a<s;a+=4)r=xe[t.charCodeAt(a)]<<18|xe[t.charCodeAt(a+1)]<<12|xe[t.charCodeAt(a+2)]<<6|xe[t.charCodeAt(a+3)],o[i++]=r>>16&255,o[i++]=r>>8&255,o[i++]=255&r;return 2==n?(r=xe[t.charCodeAt(a)]<<2|xe[t.charCodeAt(a+1)]>>4,o[i++]=255&r):1==n&&(r=xe[t.charCodeAt(a)]<<10|xe[t.charCodeAt(a+1)]<<4|xe[t.charCodeAt(a+2)]>>2,o[i++]=r>>8&255,o[i++]=255&r),o}function St(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function wt(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Et="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;function r(){}r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},At=/%[sdj%]/g;function Ot(e){if(!qt(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(It(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(e).replace(At,function(e){if("%%"===e)return"%";if(o<=r)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),i=n[r];r<o;i=n[++r])Vt(i)||!Kt(i)?s+=" "+i:s+=" "+It(i);return s}function xt(e,t){var r;return Gt($.process)?function(){return xt(e,t).apply(this,arguments)}:!0===Te.noDeprecation?e:(r=!1,function(){if(!r){if(Te.throwDeprecation)throw new Error(t);Te.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)})}var Ct,Rt={};function Nt(t){return Gt(Ct)&&(Ct=Te.env.NODE_DEBUG||""),t=t.toUpperCase(),Rt[t]||(new RegExp("\\b"+t+"\\b","i").test(Ct)?Rt[t]=function(){var e=Ot.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:Rt[t]=function(){}),Rt[t]}function It(e,t){var r={seen:[],stylize:Ut};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),Mt(t)?r.showHidden=t:t&&rr(r,t),Gt(r.showHidden)&&(r.showHidden=!1),Gt(r.depth)&&(r.depth=2),Gt(r.colors)&&(r.colors=!1),Gt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Pt),kt(r,e,r.depth)}function Pt(e,t){t=It.styles[t];return t?"["+It.colors[t][0]+"m"+e+"["+It.colors[t][1]+"m":e}function Ut(e,t){return e}function kt(t,r,n){if(t.customInspect&&r&&$t(r.inspect)&&r.inspect!==It&&(!r.constructor||r.constructor.prototype!==r))return qt(e=r.inspect(n,t))?e:kt(t,e,n);e=t;var e,o=Gt(i=r)?e.stylize("undefined","undefined"):qt(i)?(o="'"+JSON.stringify(i).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(o,"string")):Ft(i)?e.stylize(""+i,"number"):Mt(i)?e.stylize(""+i,"boolean"):Vt(i)?e.stylize("null","null"):void 0;if(o)return o;var s,i=Object.keys(r),a=(s={},i.forEach(function(e,t){s[e]=!0}),s);if(t.showHidden&&(i=Object.getOwnPropertyNames(r)),Wt(r)&&(0<=i.indexOf("message")||0<=i.indexOf("description")))return Lt(r);if(0===i.length){if($t(r))return c=r.name?": "+r.name:"",t.stylize("[Function"+c+"]","special");if(zt(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(Yt(r))return t.stylize(Date.prototype.toString.call(r),"date");if(Wt(r))return Lt(r)}var u,l,c="",p=!1,h=["{","}"];return Dt(r)&&(p=!0,h=["[","]"]),$t(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),zt(r)&&(c=" "+RegExp.prototype.toString.call(r)),Yt(r)&&(c=" "+Date.prototype.toUTCString.call(r)),Wt(r)&&(c=" "+Lt(r)),0!==i.length||p&&0!=r.length?n<0?zt(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),i=p?((t,r,n,o,e)=>{for(var s=[],i=0,a=r.length;i<a;++i)nr(r,String(i))?s.push(jt(t,r,n,o,String(i),!0)):s.push("");return e.forEach(function(e){e.match(/^\d+$/)||s.push(jt(t,r,n,o,e,!0))}),s})(t,r,n,a,i):i.map(function(e){return jt(t,r,n,a,e,p)}),t.seen.pop(),u=c,l=h,60<(i=i).reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)?l[0]+(""===u?"":u+"\n ")+" "+i.join(",\n ")+" "+l[1]:l[0]+u+" "+i.join(", ")+" "+l[1]):h[0]+c+h[1]}function Lt(e){return"["+Error.prototype.toString.call(e)+"]"}function jt(e,t,r,n,o,s){var i,a;if((t=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=t.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.set&&(a=e.stylize("[Setter]","special")),nr(n,o)||(i="["+o+"]"),a||(e.seen.indexOf(t.value)<0?-1<(a=Vt(r)?kt(e,t.value,null):kt(e,t.value,r-1)).indexOf("\n")&&(a=s?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),Gt(i)){if(s&&o.match(/^\d+$/))return a;i=(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(i,"string"))}return i+": "+a}function Dt(e){return Array.isArray(e)}function Mt(e){return"boolean"==typeof e}function Vt(e){return null===e}function Bt(e){return null==e}function Ft(e){return"number"==typeof e}function qt(e){return"string"==typeof e}function Ht(e){return"symbol"==typeof e}function Gt(e){return void 0===e}function zt(e){return Kt(e)&&"[object RegExp]"===Qt(e)}function Kt(e){return"object"==typeof e&&null!==e}function Yt(e){return Kt(e)&&"[object Date]"===Qt(e)}function Wt(e){return Kt(e)&&("[object Error]"===Qt(e)||e instanceof Error)}function $t(e){return"function"==typeof e}function Jt(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Xt(e){return Be.isBuffer(e)}function Qt(e){return Object.prototype.toString.call(e)}function Zt(e){return e<10?"0"+e.toString(10):e.toString(10)}It.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},It.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var er=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function tr(){var e,t;console.log("%s - %s",(t=[Zt((e=new Date).getHours()),Zt(e.getMinutes()),Zt(e.getSeconds())].join(":"),[e.getDate(),er[e.getMonth()],t].join(" ")),Ot.apply(null,arguments))}function rr(e,t){if(t&&Kt(t))for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function nr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var or,ir={inherits:Et,_extend:rr,log:tr,isBuffer:Xt,isPrimitive:Jt,isFunction:$t,isError:Wt,isDate:Yt,isObject:Kt,isRegExp:zt,isUndefined:Gt,isSymbol:Ht,isString:qt,isNumber:Ft,isNullOrUndefined:Bt,isNull:Vt,isBoolean:Mt,isArray:Dt,inspect:It,deprecate:xt,format:Ot,debuglog:Nt},sr=r(Object.freeze({__proto__:null,format:Ot,deprecate:xt,debuglog:Nt,inspect:It,isArray:Dt,isBoolean:Mt,isNull:Vt,isNullOrUndefined:Bt,isNumber:Ft,isString:qt,isSymbol:Ht,isUndefined:Gt,isRegExp:zt,isObject:Kt,isDate:Yt,isError:Wt,isFunction:$t,isPrimitive:Jt,isBuffer:Xt,log:tr,inherits:Et,_extend:rr,default:ir}));class ar{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class ur extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}function lr(e){if(Number.isFinite(e)&&0<e)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function cr(e,t,r){return{timeoutMillis:lr(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}(e=>{e.NONE="none",e.GZIP="gzip"})(or=or||{});class pr{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var e=()=>{var e=this._sendingPromises.indexOf(t);this._sendingPromises.splice(e,1)};t.then(e,e)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function dr(e){return new pr(e.concurrencyLimit)}var hr="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof $?$:{},fr="1.9.0",mr=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,gr=(t=>{var o,s,i,a=new Set([t]),u=new Set,e=t.match(mr);return e?(o=+e[1],s=+e[2],i=+e[3],null!=e[4]?function(e){return e===t}:function(e){var t,r,n;return!!a.has(e)||!u.has(e)&&(!(t=e.match(mr))||(r=+t[1],n=+t[2],null!=t[4])||o!=r?l:0==o?s==n&&i<=+t[3]?c:l:s<=n?c:l)(e)}):function(){return!1};function l(e){return u.add(e),!1}function c(e){return a.add(e),!0}})(fr),yr=fr.split(".")[0],_r=Symbol.for("opentelemetry.js.api."+yr),vr=hr;function br(e,t,r,n){void 0===n&&(n=!1);var o,s=vr[_r]=null!=(s=vr[_r])?s:{version:fr};return!n&&s[e]?(o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e),r.error(o.stack||o.message),!1):s.version!==fr?(o=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+e+" does not match previously registered API v"+fr),r.error(o.stack||o.message),!1):(s[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+fr+"."),!0)}function Tr(e){var t=null==(t=vr[_r])?void 0:t.version;return!t||!gr(t)||null==(t=vr[_r])?void 0:t[e]}function Sr(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+fr+".");t=vr[_r];t&&delete t[e]}var wr,Er=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Ar=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Or=(()=>{function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xr("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xr("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xr("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xr("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xr("verbose",this._namespace,e)},e})();function xr(e,t,r){var n=Tr("diag");if(n)return r.unshift(t),n[e].apply(n,Ar([],Er(r),!1))}(e=>{e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(wr=wr||{});var Cr=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Rr=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Nr=(()=>{function e(){function e(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Tr("diag");if(r)return r[n].apply(r,Rr([],Cr(e),!1))}}var a=this;a.setLogger=function(e,t){if(void 0===t&&(t={logLevel:wr.INFO}),e===a)return s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation"),a.error(null!=(o=s.stack)?o:s.message),!1;"number"==typeof t&&(t={logLevel:t});var r,n,o=Tr("diag"),s=(r=null!=(s=t.logLevel)?s:wr.INFO,n=e,r<wr.NONE?r=wr.NONE:r>wr.ALL&&(r=wr.ALL),n=n||{},{error:i("error",wr.ERROR),warn:i("warn",wr.WARN),info:i("info",wr.INFO),debug:i("debug",wr.DEBUG),verbose:i("verbose",wr.VERBOSE)});function i(e,t){e=n[e];return"function"==typeof e&&t<=r?e.bind(n):function(){}}return o&&!t.suppressOverrideMessage&&(t=null!=(e=(new Error).stack)?e:"<failed to generate stacktrace>",o.warn("Current logger will be overwritten from "+t),s.warn("Current logger will overwrite one already registered from "+t)),br("diag",s,a,!0)},a.disable=function(){Sr("diag",a)},a.createComponentLogger=function(e){return new Or(e)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})(),Ir=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Pr=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ur=(()=>{function u(e){this._entries=e?new Map(e):new Map}return u.prototype.getEntry=function(e){e=this._entries.get(e);if(e)return Object.assign({},e)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){e=Ir(e,2);return[e[0],e[1]]})},u.prototype.setEntry=function(e,t){var r=new u(this._entries);return r._entries.set(e,t),r},u.prototype.removeEntry=function(e){var t=new u(this._entries);return t._entries.delete(e),t},u.prototype.removeEntries=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=new u(this._entries);try{for(var s=Pr(r),i=s.next();!i.done;i=s.next()){var a=i.value;o._entries.delete(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return o},u.prototype.clear=function(){return new u},u})(),kr=Symbol("BaggageEntryMetadata"),Lr=Nr.instance();function jr(e){return void 0===e&&(e={}),new Ur(new Map(Object.entries(e)))}function Dr(e){return"string"!=typeof e&&(Lr.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:kr,toString:function(){return e}}}function Mr(e){return Symbol.for(e)}var Vr,Br,Fr=function n(e){var o=this;o._currentContext=e?new Map(e):new Map,o.getValue=function(e){return o._currentContext.get(e)},o.setValue=function(e,t){var r=new n(o._currentContext);return r._currentContext.set(e,t),r},o.deleteValue=function(e){var t=new n(o._currentContext);return t._currentContext.delete(e),t}},qr=new Fr,Hr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Gr=function(){for(var e=0;e<Hr.length;e++)this[Hr[e].n]=(n=>function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(console){var r=console[n];if("function"==typeof(r="function"!=typeof r?console.log:r))return r.apply(console,e)}})(Hr[e].c)},zr=(Vr=function(e,t){return(Vr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Vr(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Kr=(()=>{function e(){}return e.prototype.createGauge=function(e,t){return on},e.prototype.createHistogram=function(e,t){return sn},e.prototype.createCounter=function(e,t){return nn},e.prototype.createUpDownCounter=function(e,t){return an},e.prototype.createObservableGauge=function(e,t){return ln},e.prototype.createObservableCounter=function(e,t){return un},e.prototype.createObservableUpDownCounter=function(e,t){return cn},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e})(),Yr=function(){},Wr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t.prototype.add=function(e,t){},t})(Yr),$r=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t.prototype.add=function(e,t){},t})(Yr),Jr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t.prototype.record=function(e,t){},t})(Yr),Xr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t.prototype.record=function(e,t){},t})(Yr),Qr=(()=>{function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e})(),Zr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t})(Qr),en=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t})(Qr),tn=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return zr(t,e),t})(Qr),rn=new Kr,nn=new Wr,on=new Jr,sn=new Xr,an=new $r,un=new Zr,ln=new en,cn=new tn;function pn(){return rn}(e=>{e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(Br=Br||{});var dn,hn={get:function(e,t){if(null!=e)return e[t]},keys:function(e){return null==e?[]:Object.keys(e)}},fn={set:function(e,t,r){null!=e&&(e[t]=r)}},mn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},gn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},yn=(()=>{function e(){}return e.prototype.active=function(){return qr},e.prototype.with=function(e,t,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];return t.call.apply(t,gn([r],mn(n),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),_n=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},vn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},bn="context",Tn=new yn,Sn=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return br(bn,e,Nr.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var n,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(n=this._getContextManager()).with.apply(n,vn([e,t,r],_n(o),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return Tr(bn)||Tn},e.prototype.disable=function(){this._getContextManager().disable(),Sr(bn,Nr.instance())},e})(),wn=((e=>{e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(dn=dn||{}),"0000000000000000"),En="00000000000000000000000000000000",An={traceId:En,spanId:wn,traceFlags:dn.NONE},On=(()=>{function e(e){this._spanContext=e=void 0===e?An:e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e})(),xn=Mr("OpenTelemetry Context Key SPAN");function Cn(e){return e.getValue(xn)||void 0}function Rn(){return Cn(Sn.getInstance().active())}function Nn(e,t){return e.setValue(xn,t)}function In(e){return e.deleteValue(xn)}function Pn(e,t){return Nn(e,new On(t))}function Un(e){return null==(e=Cn(e))?void 0:e.spanContext()}var kn=/^([0-9a-f]{32})$/i,Ln=/^[0-9a-f]{16}$/i;function jn(e){return kn.test(e)&&e!==En}function Dn(e){return Ln.test(e)&&e!==wn}function Mn(e){return jn(e.traceId)&&Dn(e.spanId)}function Vn(e){return new On(e)}var qn,Hn,Gn,Bn=Sn.getInstance(),Fn=(()=>{function e(){}return e.prototype.startSpan=function(e,t,r){return void 0===r&&(r=Bn.active()),!Boolean(null==t?void 0:t.root)&&"object"==typeof(t=r&&Un(r))&&"string"==typeof t.spanId&&"string"==typeof t.traceId&&"number"==typeof t.traceFlags&&Mn(t)?new On(t):new On},e.prototype.startActiveSpan=function(e,t,r,n){var o,s;if(!(arguments.length<2))return t=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),s=Nn(r=null!=s?s:Bn.active(),n=this.startSpan(e,o,r)),Bn.with(s,t,void 0,n)},e})(),zn=new Fn,Kn=(()=>{function e(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,n){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){var e;return this._delegate||((e=this._provider.getDelegateTracer(this.name,this.version,this.options))?(this._delegate=e,this._delegate):zn)},e})(),Yn=new((()=>{function e(){}return e.prototype.getTracer=function(e,t,r){return new Fn},e})()),Wn=(()=>{function e(){}return e.prototype.getTracer=function(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new Kn(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:Yn},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)},e})(),$n=((e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(qn=qn||{}),(e=>{e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Hn=Hn||{}),(e=>{e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Gn=Gn||{}),"[_0-9a-z-*/]"),Jn=new RegExp("^(?:[a-z]"+$n+"{0,255}|[a-z0-9]"+$n+"{0,240}@[a-z]"+$n+"{0,13})$"),Xn=/^[ -~]{0,255}[!-~]$/,Qn=/,|=/,Zn=(()=>{function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,t){var r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r},t.prototype.unset=function(e){var t=this._clone();return t._internalState.delete(e),t},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,t){return e.push(t+"="+r.get(t)),e},[]).join(",")},t.prototype._parse=function(e){512<e.length||(this._internalState=e.split(",").reverse().reduce(function(e,t){var r,n=t.trim(),o=n.indexOf("=");return-1!==o&&(r=n.slice(0,o),n=n.slice(o+1,t.length),Jn.test(r))&&(o=n,Xn.test(o))&&!Qn.test(o)&&e.set(r,n),e},new Map),32<this._internalState.size&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})(),eo=Sn.getInstance(),to=Nr.instance(),ro=new((()=>{function e(){}return e.prototype.getMeter=function(e,t,r){return rn},e})()),no="metrics",oo=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return br(no,e,Nr.instance())},e.prototype.getMeterProvider=function(){return Tr(no)||ro},e.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},e.prototype.disable=function(){Sr(no,Nr.instance())},e})(),io=oo.getInstance(),so=(()=>{function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e})(),ao=Mr("OpenTelemetry Baggage Key");function uo(e){return e.getValue(ao)||void 0}function lo(){return uo(Sn.getInstance().active())}function co(e,t){return e.setValue(ao,t)}function po(e){return e.deleteValue(ao)}var Ho,Go,ho="propagation",fo=new so,mo=(()=>{function e(){this.createBaggage=jr,this.getBaggage=uo,this.getActiveBaggage=lo,this.setBaggage=co,this.deleteBaggage=po}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return br(ho,e,Nr.instance())},e.prototype.inject=function(e,t,r){return void 0===r&&(r=fn),this._getGlobalPropagator().inject(e,t,r)},e.prototype.extract=function(e,t,r){return void 0===r&&(r=hn),this._getGlobalPropagator().extract(e,t,r)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){Sr(ho,Nr.instance())},e.prototype._getGlobalPropagator=function(){return Tr(ho)||fo},e})(),go=mo.getInstance(),yo="trace",_o=(()=>{function e(){this._proxyTracerProvider=new Wn,this.wrapSpanContext=Vn,this.isSpanContextValid=Mn,this.deleteSpan=In,this.getSpan=Cn,this.getActiveSpan=Rn,this.getSpanContext=Un,this.setSpan=Nn,this.setSpanContext=Pn}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=br(yo,this._proxyTracerProvider,Nr.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return Tr(yo)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){Sr(yo,Nr.instance()),this._proxyTracerProvider=new Wn},e})(),vo=_o.getInstance(),bo={context:eo,diag:to,metrics:io,propagation:go,trace:vo},To=Object.freeze({__proto__:null,context:eo,diag:to,metrics:io,propagation:go,trace:vo,default:bo,baggageEntryMetadataFromString:Dr,createContextKey:Mr,ROOT_CONTEXT:qr,DiagConsoleLogger:Gr,get DiagLogLevel(){return wr},createNoopMeter:pn,get ValueType(){return Br},defaultTextMapGetter:hn,defaultTextMapSetter:fn,ProxyTracer:Kn,ProxyTracerProvider:Wn,get SamplingDecision(){return qn},get SpanKind(){return Hn},get SpanStatusCode(){return Gn},get TraceFlags(){return dn},createTraceState:function(e){return new Zn(e)},isSpanContextValid:Mn,isValidTraceId:jn,isValidSpanId:Dn,INVALID_SPANID:wn,INVALID_TRACEID:En,INVALID_SPAN_CONTEXT:An});let So=Mr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function wo(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!Eo(e))return!1;t=e}}return!0})(e):Eo(typeof e))}function Eo(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let Ao=e=>{var t;to.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function Oo(e){try{Ao(e)}catch{}}let xo=performance,Co="exception.message",Ro="exception.type",No="service.name",Io="telemetry.sdk.language",Po="webjs",Uo="telemetry.sdk.name",ko="telemetry.sdk.version",Lo="process.runtime.name",jo={[Uo]:"opentelemetry",[Lo]:"browser",[Io]:Po,[ko]:"2.2.0"},Do=Math.pow(10,6),Mo=Math.pow(10,9);function Vo(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Do)]}function Bo(){let e=xo.timeOrigin;var t;return"number"!=typeof e&&(t=xo,e=t.timing&&t.timing.fetchStart),e}function Fo(e){var t=Vo(Bo()),e=Vo("number"==typeof e?e:xo.now());return(t=[t[0]+e[0],t[1]+e[1]])[1]>=Mo&&(t[1]-=Mo,t[0]+=1),t}function qo(e){if(t=e,Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])return e;if("number"==typeof e)return(e<Bo()?Fo:Vo)(e);if(e instanceof Date)return Vo(e.getTime());throw TypeError("Invalid input type");var t}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Ho=Ho||{}),(Go=Go||{}).HTTP="http";let zo="[object Null]",Ko="[object Undefined]",Yo=Function.prototype.toString,Wo=Yo.call(Object),$o=Object.getPrototypeOf,Jo=Object.prototype,Xo=Jo.hasOwnProperty,Qo=Symbol?Symbol.toStringTag:void 0,Zo=Jo.toString;function ei(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?Ko:zo;if(Qo&&Qo in Object(t)){var r=t,n=Xo.call(r,Qo),o=r[Qo];let e=!1;try{r[Qo]=void 0,e=!0}catch{}var s=Zo.call(r);return e&&(n?r[Qo]=o:delete r[Qo]),s}return n=t,Zo.call(n)})(e)&&(null===(e=$o(e))||"function"==typeof(e=Xo.call(e,"constructor")&&e.constructor)&&e instanceof e&&Yo.call(e)===Wo)}function ti(e){return oi(e)?e.slice():e}function ri(r,n,o=0,s){let i;if(!(20<o)){if(o++,ai(r)||ai(n)||ii(n))i=ti(n);else if(oi(r)){if(i=r.slice(),oi(n))for(let e=0,t=n.length;e<t;e++)i.push(ti(n[e]));else if(si(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];i[e]=ti(n[e])}}}else if(si(r))if(si(n)){if(e=n,!ei(r)||!ei(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e],l=n[u];if(ai(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(ni(r,u,s)||ni(n,u,s))delete i[u];else{if(si(c)&&si(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=ri(i[u],l,o,s)}}}}else i=n;return i}var e}function ni(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function oi(e){return Array.isArray(e)}function ii(e){return"function"==typeof e}function si(e){return!ai(e)&&!oi(e)&&!ii(e)&&"object"==typeof e}function ai(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class ui extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ui.prototype)}}function li(e,r){let n;var t=new Promise(function(e,t){n=setTimeout(function(){t(new ui("Operation timed out."))},r)});return Promise.race([e,t]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}class ci{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class pi{_callback;_that;_isCalled=!1;_deferred=new ci;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}wr.ALL,wr.VERBOSE,wr.DEBUG,wr.INFO,wr.WARN,wr.ERROR,wr.NONE;let di={_export:function(e,r){return new Promise(t=>{eo.with(eo.active().setValue(So,!0),()=>{e.export(r,e=>{t(e)})})})}};function hi(){return{handleResponse(e){null!=e&&Object.prototype.hasOwnProperty.call(e,"partialSuccess")&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&to.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class fi{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,r,n,o){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=n,this._timeout=o,this._diagLogger=to.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()?r({code:Ho.FAILED,error:new Error("Concurrent export limit reached")}):null!=(e=this._serializer.serializeRequest(e))?this._promiseQueue.pushPromise(this._transport.send(e,this._timeout).then(t=>{if("success"!==t.status)"failure"===t.status&&t.error?r({code:Ho.FAILED,error:t.error}):"retryable"===t.status?r({code:Ho.FAILED,error:new ur("Export failed with retryable status")}):r({code:Ho.FAILED,error:new ur("Export failed with unknown error")});else{if(null!=t.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(t.data))}catch(e){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",e,t.data)}r({code:Ho.SUCCESS})}},e=>r({code:Ho.FAILED,error:e}))):r({code:Ho.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function mi(e,t,r){return r={transport:r,serializer:t,promiseHandler:dr(e)},t={timeout:e.timeoutMillis},new fi(r.transport,r.serializer,hi(),r.promiseHandler,t.timeout)}var gi,yi,Ti,Si,wi,Ei,Ai,Oi,xi,_i={exports:{}},vi={},bi={},Ci={};function Ri(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ni,Ii,Pi,Ui,ki,ji,Di,Li={},Mi={exports:{}};function Vi(){if(!ji){ji=1;var e=Mi,t=Mi.exports,r=t,h=(Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,null);try{h=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function d(e){return!0===(e&&e.__isLong__)}function o(e){var t=Math.clz32(e&-e);return e?31-t:t}Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=d;var s={},i={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=m(e,0,!0),o&&(i[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=m(e,e<0?-1:0,!1),o&&(s[e]=r),r)}function f(e,t){if(isNaN(e))return t?b:v;if(t){if(e<0)return b;if(p<=e)return A}else{if(e<=-y)return O;if(y<=e+1)return E}return e<0?f(-e,t).neg():m(e%u|0,e/u|0,t)}function m(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=f,n.fromBits=m;var l=Math.pow;function c(e,t,r){if(0===e.length)throw Error("empty string");if(t="number"==typeof t?(r=t,!1):!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:v;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if(0<(n=e.indexOf("-")))throw Error("interior hyphen");if(0===n)return c(e.substring(1),t,r).neg();for(var o=f(l(r,8)),s=v,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),u=parseInt(e.substring(i,i+a),r);s=(a<8?(a=f(l(r,a)),s.mul(a)):s=s.mul(o)).add(f(u))}return s.unsigned=t,s}function g(e,t){return"number"==typeof e?f(e,t):"string"==typeof e?c(e,t):m(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=c,n.fromValue=g;var u=4294967296,p=u*u,y=p/2,_=a(1<<24),v=a(0),b=(n.ZERO=v,a(0,!0)),T=(n.UZERO=b,a(1)),S=(n.ONE=T,a(1,!0)),w=(n.UONE=S,a(-1)),E=(n.NEG_ONE=w,m(-1,2147483647,!1)),A=(n.MAX_VALUE=E,m(-1,-1,!0)),O=(n.MAX_UNSIGNED_VALUE=A,m(0,-2147483648,!1)),x=(n.MIN_VALUE=O,n.prototype);x.toInt=function(){return this.unsigned?this.low>>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},x.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";var t,r;if(this.isNegative())return this.eq(O)?(r=f(e),r=(t=this.div(r)).mul(r).sub(this),t.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(var n=f(l(e,6),this.unsigned),o=this,s="";;){var i=o.div(n),a=(o.sub(i.mul(n)).toInt()>>>0).toString(e);if((o=i).isZero())return a+s;for(;a.length<6;)a="0"+a;s=""+a+s}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0<t&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},x.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1==e&&!(0===this.low&&-2097152===this.high)},x.isZero=function(){return 0===this.high&&0===this.low},x.eqz=x.isZero,x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||0<=this.high},x.isOdd=function(){return!(1&~this.low)},x.isEven=function(){return!(1&this.low)},x.equals=function(e){return d(e)||(e=g(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},x.eq=x.equals,x.notEquals=function(e){return!this.eq(e)},x.neq=x.notEquals,x.ne=x.notEquals,x.lessThan=function(e){return this.comp(e)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(e){return this.comp(e)<=0},x.lte=x.lessThanOrEqual,x.le=x.lessThanOrEqual,x.greaterThan=function(e){return 0<this.comp(e)},x.gt=x.greaterThan,x.greaterThanOrEqual=function(e){return 0<=this.comp(e)},x.gte=x.greaterThanOrEqual,x.ge=x.greaterThanOrEqual,x.compare=function(e){var t,r;return d(e)||(e=g(e)),this.eq(e)?0:(t=this.isNegative(),r=e.isNegative(),t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1)},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(T)},x.neg=x.negate,x.add=function(e){d(e)||(e=g(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,u=0,l=0,c=0,p=0;return l+=(c=c+((p+=o+(65535&e.low))>>>16)+(n+a))>>>16,m((c&=65535)<<16|(p&=65535),((u+=(l+=r+i)>>>16)+(t+s)&65535)<<16|(l&=65535),this.unsigned)},x.subtract=function(e){return d(e)||(e=g(e)),this.add(e.neg())},x.sub=x.subtract,x.multiply=function(e){var t,r,n,o,s,i,a,u,l,c,p;return this.isZero()?this:(d(e)||(e=g(e)),h?m(h.mul(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):e.isZero()?this.unsigned?b:v:this.eq(O)?e.isOdd()?O:v:e.eq(O)?this.isOdd()?O:v:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(_)&&e.lt(_)?f(this.toNumber()*e.toNumber(),this.unsigned):(t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,p=(p=c=l=u=0)+((l=l+((c+=o*(e=65535&e.low))>>>16)+n*e)>>>16)+((l=(l&65535)+o*a)>>>16),m((l&=65535)<<16|(c&=65535),(u=(u=(u+=(p+=r*e)>>>16)+((p=(p&65535)+n*a)>>>16)+((p=(p&65535)+o*i)>>>16))+(t*e+r*a+n*i+o*s)&65535)<<16|(p&=65535),this.unsigned)))},x.mul=x.multiply,x.divide=function(e){if((e=d(e)?e:g(e)).isZero())throw Error("division by zero");var t,r;if(h)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?m((this.unsigned?h.div_u:h.div_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:v;if(this.unsigned){if((e=e.unsigned?e:e.toUnsigned()).gt(this))return b;if(e.gt(this.shru(1)))return S;r=b}else{if(this.eq(O))return e.eq(T)||e.eq(w)?O:e.eq(O)?T:(n=this.shr(1).div(e).shl(1)).eq(v)?e.isNegative()?T:w:(t=this.sub(e.mul(n)),n.add(t.div(e)));if(e.eq(O))return this.unsigned?b:v;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=v}for(t=this;t.gte(e);){for(var n=Math.max(1,Math.floor(t.toNumber()/e.toNumber())),o=Math.ceil(Math.log(n)/Math.LN2),s=o<=48?1:l(2,o-48),i=f(n),a=i.mul(e);a.isNegative()||a.gt(t);)a=(i=f(n-=s,this.unsigned)).mul(e);i.isZero()&&(i=T),r=r.add(i),t=t.sub(a)}return r},x.div=x.divide,x.modulo=function(e){return d(e)||(e=g(e)),h?m((this.unsigned?h.rem_u:h.rem_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},x.mod=x.modulo,x.rem=x.modulo,x.not=function(){return m(~this.low,~this.high,this.unsigned)},x.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},x.clz=x.countLeadingZeros,x.countTrailingZeros=function(){return this.low?o(this.low):o(this.high)+32},x.ctz=x.countTrailingZeros,x.and=function(e){return d(e)||(e=g(e)),m(this.low&e.low,this.high&e.high,this.unsigned)},x.or=function(e){return d(e)||(e=g(e)),m(this.low|e.low,this.high|e.high,this.unsigned)},x.xor=function(e){return d(e)||(e=g(e)),m(this.low^e.low,this.high^e.high,this.unsigned)},x.shiftLeft=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):m(0,this.low<<e-32,this.unsigned)},x.shl=x.shiftLeft,x.shiftRight=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):m(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):m(32===e?this.high:this.high>>>e-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.shr_u=x.shiftRightUnsigned,x.rotateLeft=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.low<<e|this.high>>>(t=32-e),this.high<<e|this.low>>>t,this.unsigned):(t=32-(e-=32),m(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},x.rotl=x.rotateLeft,x.rotateRight=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.high<<(t=32-e)|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned):(t=32-(e-=32),m(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},x.rotr=x.rotateRight,x.toSigned=function(){return this.unsigned?m(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:m(this.low,this.high,!0)},x.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},x.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(n.fromBigInt=function(e,t){return m(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},n.fromValue=function(e,t){return"bigint"==typeof e?n.fromBigInt(e,t):g(e,t)},x.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),r.default=n,e.exports=t.default||t}return Mi.exports}function Bi(){return Di||(Di=1,(p=bi).asPromise=(yi||(yi=1,gi=function(e,t){for(var r=new Array(arguments.length-1),s=0,n=2,i=!0;n<arguments.length;)r[s++]=arguments[n++];return new Promise(function(n,o){r[s]=function(e){if(i)if(i=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,o(e))}})}),gi),p.base64=(Ti||(Ti=1,(()=>{var e=Ci;e.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;1<--t%4&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var l=new Array(64),u=new Array(123),t=0;t<64;)u[l[t]=t<26?t+65:t<52?t+71:t<62?t-4:t-59|43]=t++;e.encode=function(e,t,r){for(var n,o=null,s=[],i=0,a=0;t<r;){var u=e[t++];switch(a){case 0:s[i++]=l[u>>2],n=(3&u)<<4,a=1;break;case 1:s[i++]=l[n|u>>4],n=(15&u)<<2,a=2;break;case 2:s[i++]=l[n|u>>6],s[i++]=l[63&u],a=0}8191<i&&((o=o||[]).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=l[n],s[i++]=61,1===a)&&(s[i++]=61),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var c="invalid encoding";e.decode=function(e,t,r){for(var n,o=r,s=0,i=0;i<e.length;){var a=e.charCodeAt(i++);if(61===a&&1<s)break;if(void 0===(a=u[a]))throw Error(c);switch(s){case 0:n=a,s=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,s=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,s=3;break;case 3:t[r++]=(3&n)<<6|a,s=0}}if(1===s)throw Error(c);return r-o},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}})()),Ci),p.EventEmitter=(wi||(wi=1,(Si=s).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},s.prototype.off=function(e,t){if(void 0===e)this._listeners=Object.create(null);else if(void 0===t)this._listeners[e]=[];else{var r=this._listeners[e];if(!r)return this;for(var n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n}return this},s.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}),Si),p.float=Ai?Ei:(Ai=1,Ei=r(r)),p.inquire=xi?Oi:(xi=1,Oi=function(e){try{var t=Ri(e);return t&&(t.length||Object.keys(t).length)?t:null}catch(e){return null}}),p.utf8=(Ni||(Ni=1,(c=Li).length=function(e){for(var t,r=0,n=0;n<e.length;++n)(t=e.charCodeAt(n))<128?r+=1:t<2048?r+=2:55296==(64512&t)&&56320==(64512&e.charCodeAt(n+1))?(++n,r+=4):r+=3;return r},c.read=function(e,t,r){if(r-t<1)return"";for(var n="",o=t;o<r;){var s,i=e[o++];i<=127?n+=String.fromCharCode(i):192<=i&&i<224?n+=128<=(s=(31&i)<<6|63&e[o++])?String.fromCharCode(s):"�":224<=i&&i<240?n+=2048<=(s=(15&i)<<12|(63&e[o++])<<6|63&e[o++])?String.fromCharCode(s):"�":240<=i&&((i=(7&i)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])<65536||1114111<i?n+="�":(i-=65536,n=(n+=String.fromCharCode(55296+(i>>10)))+String.fromCharCode(56320+(1023&i))))}return n},c.write=function(e,t,r){for(var n,o,s=r,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(i+1)))?(++i,t[r++]=(n=65536+((1023&n)<<10)+(1023&o))>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128);return r-s}),Li),p.pool=(Pi||(Pi=1,Ii=function(t,r,e){var n=e||8192,o=n>>>1,s=null,i=n;return function(e){if(e<1||o<e)return t(e);n<i+e&&(s=t(n),i=0);e=r.call(s,i,i+=e);return 7&i&&(i=1+(7|i)),e}}),Ii),p.LongBits=(ki||(ki=1,Ui=o,i=Bi(),(u=o.zero=new o(0,0)).toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){var t,r;return 0===e?u:(r=(e=(t=e<0)?-e:e)>>>0,e=(e-r)/4294967296>>>0,t&&(e=~e>>>0,r=~r>>>0,4294967295<++r)&&(r=0,4294967295<++e)&&(e=0),new o(r,e))},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(i.isString(e)){if(!i.Long)return o.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):u},o.prototype.toNumber=function(e){var t;return!e&&this.hi>>>31?(e=1+~this.lo>>>0,t=~this.hi>>>0,-(e+4294967296*(t=e?t:t+1>>>0))):this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}},l=String.prototype.charCodeAt,o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?u:new o((l.call(e,0)|l.call(e,1)<<8|l.call(e,2)<<16|l.call(e,3)<<24)>>>0,(l.call(e,4)|l.call(e,5)<<8|l.call(e,6)<<16|l.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0==r?0==t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}),Ui),p.isUnsafeProperty=a,p.isNode=Boolean(void 0!==t&&t&&t.process&&t.process.versions&&t.process.versions.node),p.global=p.isNode&&t||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||t,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},p.isString=function(e){return"string"==typeof e||e instanceof String},p.isObject=function(e){return e&&"object"==typeof e},p.isset=p.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||0<(Array.isArray(r)?r:Object.keys(r)).length)},p.Buffer=(()=>{try{var e=p.global.Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}})(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(e){return"number"==typeof e?p.Buffer?p._Buffer_allocUnsafe(e):new p.Array(e):p.Buffer?p._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},p.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||(()=>{try{var e=Vi();return e&&e.isLong?e:null}catch(e){return null}})(),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(e){return e?p.LongBits.from(e).toHash():p.LongBits.zeroHash},p.longFromHash=function(e,t){e=p.LongBits.fromHash(e);return p.Long?p.Long.fromBits(e.lo,e.hi,t):e.toNumber(Boolean(t))},p.merge=n,p.nestingLimit=32,p.recursionLimit=100,p.makeProp=function(e,t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0})},p.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},p.newError=e,p.ProtocolError=e("ProtocolError"),p.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;-1<t;--t)if(1===r[e[t]]&&null!=this[e[t]])return e[t]}},p.oneOfSetter=function(r){return function(e){for(var t=0;t<r.length;++t)r[t]!==e&&delete this[r[t]]}},p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},p._configure=function(){var r=p.Buffer;r?(p._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,t){return new r(e,t)},p._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}):p._Buffer_from=p._Buffer_allocUnsafe=null}),bi;function a(e){return"__proto__"===e||"prototype"===e||"constructor"===e}function n(e){for(var t=(r="boolean"==typeof arguments[arguments.length-1])?arguments.length-1:arguments.length,r=r&&arguments[arguments.length-1],n=1;n<t;++n){var o=arguments[n];if(o)for(var s=Object.keys(o),i=0;i<s.length;++i)a(s[i])||void 0!==e[s[i]]&&r||(e[s[i]]=o[s[i]])}return e}function e(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}function o(e,t){this.lo=e>>>0,this.hi=t>>>0}function r(e){return"undefined"!=typeof Float32Array?(l=new Float32Array([-0]),c=new Uint8Array(l.buffer),p=128===c[3],e.writeFloatLE=p?f:m,e.writeFloatBE=p?m:f,e.readFloatLE=p?g:y,e.readFloatBE=p?y:g):(e.writeFloatLE=h.bind(null,_),e.writeFloatBE=h.bind(null,v),e.readFloatLE=d.bind(null,b),e.readFloatBE=d.bind(null,T)),"undefined"!=typeof Float64Array?(a=new Float64Array([-0]),u=new Uint8Array(a.buffer),p=128===u[7],e.writeDoubleLE=p?n:o,e.writeDoubleBE=p?o:n,e.readDoubleLE=p?s:i,e.readDoubleBE=p?i:s):(e.writeDoubleLE=t.bind(null,_,0,4),e.writeDoubleBE=t.bind(null,v,4,0),e.readDoubleLE=r.bind(null,b,0,4),e.readDoubleBE=r.bind(null,T,4,0)),e;function t(e,t,r,n,o,s){var i,a,u=n<0?1:0;0===(n=u?-n:n)?(e(0,o,s+t),e(0<1/n?0:2147483648,o,s+r)):isNaN(n)?(e(0,o,s+t),e(2146959360,o,s+r)):17976931348623157e292<n?(e(0,o,s+t),e((u<<31|2146435072)>>>0,o,s+r)):n<22250738585072014e-324?(e((i=n/5e-324)>>>0,o,s+t),e((u<<31|i/4294967296)>>>0,o,s+r)):(1024===(a=Math.floor(Math.log(n)/Math.LN2))&&(a=1023),e(4503599627370496*(i=n*Math.pow(2,-a))>>>0,o,s+t),e((u<<31|a+1023<<20|1048576*i&1048575)>>>0,o,s+r))}function r(e,t,r,n,o){t=e(n,o+t),e=e(n,o+r),n=2*(e>>31)+1,o=e>>>20&2047,r=4294967296*(1048575&e)+t;return 2047==o?r?NaN:1/0*n:0==o?5e-324*n*r:n*Math.pow(2,o-1075)*(r+4503599627370496)}function n(e,t,r){a[0]=e,t[r]=u[0],t[r+1]=u[1],t[r+2]=u[2],t[r+3]=u[3],t[r+4]=u[4],t[r+5]=u[5],t[r+6]=u[6],t[r+7]=u[7]}function o(e,t,r){a[0]=e,t[r]=u[7],t[r+1]=u[6],t[r+2]=u[5],t[r+3]=u[4],t[r+4]=u[3],t[r+5]=u[2],t[r+6]=u[1],t[r+7]=u[0]}function s(e,t){return u[0]=e[t],u[1]=e[t+1],u[2]=e[t+2],u[3]=e[t+3],u[4]=e[t+4],u[5]=e[t+5],u[6]=e[t+6],u[7]=e[t+7],a[0]}function i(e,t){return u[7]=e[t],u[6]=e[t+1],u[5]=e[t+2],u[4]=e[t+3],u[3]=e[t+4],u[2]=e[t+5],u[1]=e[t+6],u[0]=e[t+7],a[0]}var a,u,l,c,p;function h(e,t,r,n){var o=t<0?1:0;0===(t=o?-t:t)?e(0<1/t?0:2147483648,r,n):isNaN(t)?e(2143289344,r,n):e(34028234663852886e22<t?(o<<31|2139095040)>>>0:t<11754943508222875e-54?(o<<31|Math.round(t/1401298464324817e-60))>>>0:(o<<31|(e=Math.floor(Math.log(t)/Math.LN2))+127<<23|8388607&Math.round(t*Math.pow(2,-e)*8388608))>>>0,r,n)}function d(e,t,r){e=e(t,r),t=2*(e>>31)+1,r=e>>>23&255,e&=8388607;return 255==r?e?NaN:1/0*t:0==r?1401298464324817e-60*t*e:t*Math.pow(2,r-150)*(8388608+e)}function f(e,t,r){l[0]=e,t[r]=c[0],t[r+1]=c[1],t[r+2]=c[2],t[r+3]=c[3]}function m(e,t,r){l[0]=e,t[r]=c[3],t[r+1]=c[2],t[r+2]=c[1],t[r+3]=c[0]}function g(e,t){return c[0]=e[t],c[1]=e[t+1],c[2]=e[t+2],c[3]=e[t+3],l[0]}function y(e,t){return c[3]=e[t],c[2]=e[t+1],c[1]=e[t+2],c[0]=e[t+3],l[0]}}function _(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function v(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function T(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function s(){this._listeners=Object.create(null)}var i,u,l,c,p}var Fi,qi=Ji,Hi=Bi(),Gi=Hi.LongBits,zi=Hi.base64,Ki=Hi.utf8;function Yi(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function Wi(){}function $i(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function Ji(){this.len=0,this.head=new Yi(Wi,0,0),this.tail=this.head,this.states=null}var Xi=function(){return Hi.Buffer?function(){return(Ji.create=function(){return new Fi})()}:function(){return new Ji}};function Qi(e,t,r){t[r]=255&e}function Zi(e,t){this.len=e,this.next=void 0,this.val=t}function es(e,t,r){for(var n=e.lo,o=e.hi;o;)t[r++]=127&n|128,n=(n>>>7|o<<25)>>>0,o>>>=7;for(;127<n;)t[r++]=127&n|128,n>>>=7;t[r++]=n}function ts(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}Ji.create=Xi(),Ji.alloc=function(e){return new Hi.Array(e)},Hi.Array!==Array&&(Ji.alloc=Hi.pool(Ji.alloc,Hi.Array.prototype.subarray)),Ji.prototype._push=function(e,t,r){return this.tail=this.tail.next=new Yi(e,t,r),this.len+=t,this},Zi.prototype=Object.create(Yi.prototype),Zi.prototype.fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},Ji.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Zi((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Ji.prototype.int32=function(e){return(e|=0)<0?this._push(es,10,Gi.fromNumber(e)):this.uint32(e)},Ji.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Ji.prototype.uint64=function(e){e=Gi.from(e);return this._push(es,e.length(),e)},Ji.prototype.int64=Ji.prototype.uint64,Ji.prototype.sint64=function(e){e=Gi.from(e).zzEncode();return this._push(es,e.length(),e)},Ji.prototype.bool=function(e){return this._push(Qi,1,e?1:0)},Ji.prototype.fixed32=function(e){return this._push(ts,4,e>>>0)},Ji.prototype.sfixed32=Ji.prototype.fixed32,Ji.prototype.fixed64=function(e){e=Gi.from(e);return this._push(ts,4,e.lo)._push(ts,4,e.hi)},Ji.prototype.sfixed64=Ji.prototype.fixed64,Ji.prototype.float=function(e){return this._push(Hi.float.writeFloatLE,4,e)},Ji.prototype.double=function(e){return this._push(Hi.float.writeDoubleLE,8,e)};var rs=Hi.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]},ns=(Ji.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(Hi.isString(e)&&(t=Ji.alloc(r=zi.length(e)),zi.decode(e,t,0),e=t),this.uint32(r)._push(rs,r,e)):this._push(Qi,1,0)},Ji.prototype.string=function(e){var t=Ki.length(e);return t?this.uint32(t)._push(Ki.write,t,e):this._push(Qi,1,0)},Ji.prototype.fork=function(){return this.states=new $i(this),this.head=this.tail=new Yi(Wi,0,0),this.len=0,this},Ji.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Yi(Wi,0,0),this.len=0),this},Ji.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},Ji.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},Ji._configure=function(e){Fi=e,Ji.create=Xi(),Fi._configure()},ss),os=qi,is=((ss.prototype=Object.create(os.prototype)).constructor=ss,Bi());function ss(){os.call(this)}function as(e,t,r){e.length<40?is.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}ss._configure=function(){ss.alloc=is._Buffer_allocUnsafe,ss.writeBytesBuffer=is.Buffer&&is.Buffer.prototype instanceof Uint8Array&&"set"===is.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},ss.prototype.bytes=function(e){var t=(e=is.isString(e)?is._Buffer_from(e,"base64"):e).length>>>0;return this.uint32(t),t&&this._push(ss.writeBytesBuffer,t,e),this},ss.prototype.string=function(e){var t=is.Buffer.byteLength(e);return this.uint32(t),t&&this._push(as,t,e),this},ss._configure();var us,ls=fs,cs=Bi(),ps=cs.LongBits,ds=cs.utf8;function hs(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function fs(e){this.buf=e,this.pos=0,this.len=e.length}var ms,gs="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new fs(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new fs(e);throw Error("illegal buffer")},ys=function(){return cs.Buffer?function(e){return(fs.create=function(e){return cs.Buffer.isBuffer(e)?new us(e):gs(e)})(e)}:gs};function _s(){var e=new ps(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw hs(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw hs(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function vs(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function bs(){if(this.pos+8>this.len)throw hs(this,8);return new ps(vs(this.buf,this.pos+=4),vs(this.buf,this.pos+=4))}fs.create=ys(),fs.prototype._slice=cs.Array.prototype.subarray||cs.Array.prototype.slice,fs.prototype.uint32=(ms=4294967295,function(){if(ms=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(ms=(ms|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(ms=(ms|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(ms=(ms|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(ms=(ms|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return ms;throw this.pos=this.len,hs(this,10)}),fs.prototype.int32=function(){return 0|this.uint32()},fs.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},fs.prototype.bool=function(){return 0!==this.uint32()},fs.prototype.fixed32=function(){if(this.pos+4>this.len)throw hs(this,4);return vs(this.buf,this.pos+=4)},fs.prototype.sfixed32=function(){if(this.pos+4>this.len)throw hs(this,4);return 0|vs(this.buf,this.pos+=4)},fs.prototype.float=function(){if(this.pos+4>this.len)throw hs(this,4);var e=cs.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},fs.prototype.double=function(){if(this.pos+8>this.len)throw hs(this,4);var e=cs.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},fs.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw hs(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?(e=cs.Buffer)?e.alloc(0):new this.buf.constructor(0):this._slice.call(this.buf,t,r)},fs.prototype.string=function(){var e=this.bytes();return ds.read(e,0,e.length)},fs.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw hs(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw hs(this)}while(128&this.buf[this.pos++]);return this},fs.recursionLimit=cs.recursionLimit,fs.prototype.skipType=function(e,t){if((t=void 0===t?0:t)>fs.recursionLimit)throw Error("maximum nesting depth exceeded");switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e,t+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},fs._configure=function(e){us=e,fs.create=ys(),us._configure();var t=cs.Long?"toLong":"toNumber";cs.merge(fs.prototype,{int64:function(){return _s.call(this)[t](!1)},uint64:function(){return _s.call(this)[t](!0)},sint64:function(){return _s.call(this).zzDecode()[t](!1)},fixed64:function(){return bs.call(this)[t](!0)},sfixed64:function(){return bs.call(this)[t](!1)}})};var Ts=Es,Ss=ls,ws=((Es.prototype=Object.create(Ss.prototype)).constructor=Es,Bi());function Es(e){Ss.call(this,e)}Es._configure=function(){ws.Buffer&&(Es.prototype._slice=ws.Buffer.prototype.slice)},Es.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},Es._configure();var As={},Os=Cs,xs=Bi();function Cs(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");xs.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((Cs.prototype=Object.create(xs.EventEmitter.prototype)).constructor=Cs).prototype.rpcCall=function e(r,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return xs.asPromise(e,i,r,t,n,o);if(i.rpcImpl)try{return i.rpcImpl(r,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return i.emit("error",e,r),s(e);if(null!==t){if(!(t instanceof n))try{t=n[i.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return i.emit("error",e,r),s(e)}return i.emit("data",t,r),s(null,t)}i.end(!0)})}catch(e){i.emit("error",e,r),setTimeout(function(){s(e)},0)}else setTimeout(function(){s(Error("already ended"))},0)},Cs.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},As.Service=Os;var Rs=Object.create(null);(()=>{var e=vi;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=qi,e.BufferWriter=ns,e.Reader=ls,e.BufferReader=Ts,e.util=Bi(),e.rpc=As,e.roots=Rs,e.configure=t,t()})();var Ns,Is,Ps,Us,ks,na,oa,ia,sa,ga,Ta,Ls=_i.exports=vi,js=Ls.Reader,Ds=Ls.Writer,Ms=Ls.util,Vs=Ls.roots.default||(Ls.roots.default={}),Bs=(Vs.opentelemetry=((ks={}).proto=((Us={}).common=(()=>{var e,t,r={};return r.v1=((e={}).AnyValue=(u.prototype.stringValue=null,u.prototype.boolValue=null,u.prototype.intValue=null,u.prototype.doubleValue=null,u.prototype.arrayValue=null,u.prototype.kvlistValue=null,u.prototype.bytesValue=null,Object.defineProperty(u.prototype,"value",{get:Ms.oneOfGetter(t=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:Ms.oneOfSetter(t)}),u.create=function(e){return new u(e)},u.encode=function(e,t){return t=t||Ds.create(),null!=e.stringValue&&Object.hasOwnProperty.call(e,"stringValue")&&t.uint32(10).string(e.stringValue),null!=e.boolValue&&Object.hasOwnProperty.call(e,"boolValue")&&t.uint32(16).bool(e.boolValue),null!=e.intValue&&Object.hasOwnProperty.call(e,"intValue")&&t.uint32(24).int64(e.intValue),null!=e.doubleValue&&Object.hasOwnProperty.call(e,"doubleValue")&&t.uint32(33).double(e.doubleValue),null!=e.arrayValue&&Object.hasOwnProperty.call(e,"arrayValue")&&Vs.opentelemetry.proto.common.v1.ArrayValue.encode(e.arrayValue,t.uint32(42).fork()).ldelim(),null!=e.kvlistValue&&Object.hasOwnProperty.call(e,"kvlistValue")&&Vs.opentelemetry.proto.common.v1.KeyValueList.encode(e.kvlistValue,t.uint32(50).fork()).ldelim(),null!=e.bytesValue&&Object.hasOwnProperty.call(e,"bytesValue")&&t.uint32(58).bytes(e.bytesValue),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.common.v1.AnyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.stringValue=e.string();break;case 2:o.boolValue=e.bool();break;case 3:o.intValue=e.int64();break;case 4:o.doubleValue=e.double();break;case 5:o.arrayValue=Vs.opentelemetry.proto.common.v1.ArrayValue.decode(e,e.uint32());break;case 6:o.kvlistValue=Vs.opentelemetry.proto.common.v1.KeyValueList.decode(e,e.uint32());break;case 7:o.bytesValue=e.bytes();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.value=1,!Ms.isString(e.stringValue)))return"stringValue: string expected";if(null!=e.boolValue&&e.hasOwnProperty("boolValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"boolean"!=typeof e.boolValue)return"boolValue: boolean expected"}if(null!=e.intValue&&e.hasOwnProperty("intValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(Ms.isInteger(e.intValue)||e.intValue&&Ms.isInteger(e.intValue.low)&&Ms.isInteger(e.intValue.high)))return"intValue: integer|Long expected"}if(null!=e.doubleValue&&e.hasOwnProperty("doubleValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"number"!=typeof e.doubleValue)return"doubleValue: number expected"}if(null!=e.arrayValue&&e.hasOwnProperty("arrayValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=Vs.opentelemetry.proto.common.v1.ArrayValue.verify(e.arrayValue))return"arrayValue."+t}if(null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=Vs.opentelemetry.proto.common.v1.KeyValueList.verify(e.kvlistValue))return"kvlistValue."+t}if(null!=e.bytesValue&&e.hasOwnProperty("bytesValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(e.bytesValue&&"number"==typeof e.bytesValue.length||Ms.isString(e.bytesValue)))return"bytesValue: buffer expected"}return null},u.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.common.v1.AnyValue)return e;var t=new Vs.opentelemetry.proto.common.v1.AnyValue;if(null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),null!=e.intValue&&(Ms.Long?(t.intValue=Ms.Long.fromValue(e.intValue)).unsigned=!1:"string"==typeof e.intValue?t.intValue=parseInt(e.intValue,10):"number"==typeof e.intValue?t.intValue=e.intValue:"object"==typeof e.intValue&&(t.intValue=new Ms.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.arrayValue){if("object"!=typeof e.arrayValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");t.arrayValue=Vs.opentelemetry.proto.common.v1.ArrayValue.fromObject(e.arrayValue)}if(null!=e.kvlistValue){if("object"!=typeof e.kvlistValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");t.kvlistValue=Vs.opentelemetry.proto.common.v1.KeyValueList.fromObject(e.kvlistValue)}return null!=e.bytesValue&&("string"==typeof e.bytesValue?Ms.base64.decode(e.bytesValue,t.bytesValue=Ms.newBuffer(Ms.base64.length(e.bytesValue)),0):0<=e.bytesValue.length&&(t.bytesValue=e.bytesValue)),t},u.toObject=function(e,t){t=t||{};var r={};return null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.stringValue=e.stringValue,t.oneofs)&&(r.value="stringValue"),null!=e.boolValue&&e.hasOwnProperty("boolValue")&&(r.boolValue=e.boolValue,t.oneofs)&&(r.value="boolValue"),null!=e.intValue&&e.hasOwnProperty("intValue")&&("number"==typeof e.intValue?r.intValue=t.longs===String?String(e.intValue):e.intValue:r.intValue=t.longs===String?Ms.Long.prototype.toString.call(e.intValue):t.longs===Number?new Ms.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber():e.intValue,t.oneofs)&&(r.value="intValue"),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(r.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue,t.oneofs)&&(r.value="doubleValue"),null!=e.arrayValue&&e.hasOwnProperty("arrayValue")&&(r.arrayValue=Vs.opentelemetry.proto.common.v1.ArrayValue.toObject(e.arrayValue,t),t.oneofs)&&(r.value="arrayValue"),null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")&&(r.kvlistValue=Vs.opentelemetry.proto.common.v1.KeyValueList.toObject(e.kvlistValue,t),t.oneofs)&&(r.value="kvlistValue"),null!=e.bytesValue&&e.hasOwnProperty("bytesValue")&&(r.bytesValue=t.bytes===String?Ms.base64.encode(e.bytesValue,0,e.bytesValue.length):t.bytes===Array?Array.prototype.slice.call(e.bytesValue):e.bytesValue,t.oneofs)&&(r.value="bytesValue"),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.AnyValue"},u),e.ArrayValue=(a.prototype.values=Ms.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ds.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)Vs.opentelemetry.proto.common.v1.AnyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.common.v1.ArrayValue;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(Vs.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=Vs.opentelemetry.proto.common.v1.AnyValue.verify(e.values[t]);if(r)return"values."+r}}return null},a.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.common.v1.ArrayValue)return e;var t=new Vs.opentelemetry.proto.common.v1.ArrayValue;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");t.values[r]=Vs.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=Vs.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.ArrayValue"},a),e.KeyValueList=(i.prototype.values=Ms.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ds.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.common.v1.KeyValueList;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},i.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.values[t]);if(r)return"values."+r}}return null},i.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.common.v1.KeyValueList)return e;var t=new Vs.opentelemetry.proto.common.v1.KeyValueList;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");t.values[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[r])}}return t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[n],t)}return r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValueList"},i),e.KeyValue=(s.prototype.key=null,s.prototype.value=null,s.create=function(e){return new s(e)},s.encode=function(e,t){return t=t||Ds.create(),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).string(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&Vs.opentelemetry.proto.common.v1.AnyValue.encode(e.value,t.uint32(18).fork()).ldelim(),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.common.v1.KeyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.key=e.string();break;case 2:o.value=Vs.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.key&&e.hasOwnProperty("key")&&!Ms.isString(e.key))return"key: string expected";if(null!=e.value&&e.hasOwnProperty("value")){e=Vs.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(e)return"value."+e}return null},s.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.common.v1.KeyValue)return e;var t=new Vs.opentelemetry.proto.common.v1.KeyValue;if(null!=e.key&&(t.key=String(e.key)),null!=e.value){if("object"!=typeof e.value)throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");t.value=Vs.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return t},s.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.key="",r.value=null),null!=e.key&&e.hasOwnProperty("key")&&(r.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=Vs.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,t)),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValue"},s),e.InstrumentationScope=(o.prototype.name=null,o.prototype.version=null,o.prototype.attributes=Ms.emptyArray,o.prototype.droppedAttributesCount=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ds.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(18).string(e.version),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.version=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Ms.isString(e.name))return"name: string expected";if(null!=e.version&&e.hasOwnProperty("version")&&!Ms.isString(e.version))return"version: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Ms.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.common.v1.InstrumentationScope)return e;var t=new Vs.opentelemetry.proto.common.v1.InstrumentationScope;if(null!=e.name&&(t.name=String(e.name)),null!=e.version&&(t.version=String(e.version)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(r.name="",r.version="",r.droppedAttributesCount=0),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.version&&e.hasOwnProperty("version")&&(r.version=e.version),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.InstrumentationScope"},o),e.EntityRef=(n.prototype.schemaUrl=null,n.prototype.type=null,n.prototype.idKeys=Ms.emptyArray,n.prototype.descriptionKeys=Ms.emptyArray,n.create=function(e){return new n(e)},n.encode=function(e,t){if(t=t||Ds.create(),null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(10).string(e.schemaUrl),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(18).string(e.type),null!=e.idKeys&&e.idKeys.length)for(var r=0;r<e.idKeys.length;++r)t.uint32(26).string(e.idKeys[r]);if(null!=e.descriptionKeys&&e.descriptionKeys.length)for(r=0;r<e.descriptionKeys.length;++r)t.uint32(34).string(e.descriptionKeys[r]);return t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.common.v1.EntityRef;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.schemaUrl=e.string();break;case 2:o.type=e.string();break;case 3:o.idKeys&&o.idKeys.length||(o.idKeys=[]),o.idKeys.push(e.string());break;case 4:o.descriptionKeys&&o.descriptionKeys.length||(o.descriptionKeys=[]),o.descriptionKeys.push(e.string());break;default:e.skipType(7&s)}}return o},n.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl))return"schemaUrl: string expected";if(null!=e.type&&e.hasOwnProperty("type")&&!Ms.isString(e.type))return"type: string expected";if(null!=e.idKeys&&e.hasOwnProperty("idKeys")){if(!Array.isArray(e.idKeys))return"idKeys: array expected";for(var t=0;t<e.idKeys.length;++t)if(!Ms.isString(e.idKeys[t]))return"idKeys: string[] expected"}if(null!=e.descriptionKeys&&e.hasOwnProperty("descriptionKeys")){if(!Array.isArray(e.descriptionKeys))return"descriptionKeys: array expected";for(t=0;t<e.descriptionKeys.length;++t)if(!Ms.isString(e.descriptionKeys[t]))return"descriptionKeys: string[] expected"}return null},n.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.common.v1.EntityRef)return e;var t=new Vs.opentelemetry.proto.common.v1.EntityRef;if(null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),null!=e.type&&(t.type=String(e.type)),e.idKeys){if(!Array.isArray(e.idKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.idKeys: array expected");t.idKeys=[];for(var r=0;r<e.idKeys.length;++r)t.idKeys[r]=String(e.idKeys[r])}if(e.descriptionKeys){if(!Array.isArray(e.descriptionKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.descriptionKeys: array expected");for(t.descriptionKeys=[],r=0;r<e.descriptionKeys.length;++r)t.descriptionKeys[r]=String(e.descriptionKeys[r])}return t},n.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.idKeys=[],r.descriptionKeys=[]),t.defaults&&(r.schemaUrl="",r.type=""),null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),null!=e.type&&e.hasOwnProperty("type")&&(r.type=e.type),e.idKeys&&e.idKeys.length){r.idKeys=[];for(var n=0;n<e.idKeys.length;++n)r.idKeys[n]=e.idKeys[n]}if(e.descriptionKeys&&e.descriptionKeys.length)for(r.descriptionKeys=[],n=0;n<e.descriptionKeys.length;++n)r.descriptionKeys[n]=e.descriptionKeys[n];return r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.EntityRef"},n),e),r;function n(e){if(this.idKeys=[],this.descriptionKeys=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Us.resource=((Is={}).v1=((Ns={}).Resource=(()=>{function t(e){if(this.attributes=[],this.entityRefs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return t.prototype.attributes=Ms.emptyArray,t.prototype.droppedAttributesCount=null,t.prototype.entityRefs=Ms.emptyArray,t.create=function(e){return new t(e)},t.encode=function(e,t){if(t=t||Ds.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(16).uint32(e.droppedAttributesCount),null!=e.entityRefs&&e.entityRefs.length)for(r=0;r<e.entityRefs.length;++r)Vs.opentelemetry.proto.common.v1.EntityRef.encode(e.entityRefs[r],t.uint32(26).fork()).ldelim();return t},t.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},t.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.resource.v1.Resource;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.droppedAttributesCount=e.uint32();break;case 3:o.entityRefs&&o.entityRefs.length||(o.entityRefs=[]),o.entityRefs.push(Vs.opentelemetry.proto.common.v1.EntityRef.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},t.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Ms.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.entityRefs&&e.hasOwnProperty("entityRefs")){if(!Array.isArray(e.entityRefs))return"entityRefs: array expected";for(t=0;t<e.entityRefs.length;++t){var r;if(r=Vs.opentelemetry.proto.common.v1.EntityRef.verify(e.entityRefs[t]))return"entityRefs."+r}}return null},t.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.resource.v1.Resource)return e;var t=new Vs.opentelemetry.proto.resource.v1.Resource;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.entityRefs){if(!Array.isArray(e.entityRefs))throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: array expected");for(t.entityRefs=[],r=0;r<e.entityRefs.length;++r){if("object"!=typeof e.entityRefs[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: object expected");t.entityRefs[r]=Vs.opentelemetry.proto.common.v1.EntityRef.fromObject(e.entityRefs[r])}}return t},t.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[],r.entityRefs=[]),t.defaults&&(r.droppedAttributesCount=0),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),e.entityRefs&&e.entityRefs.length)for(r.entityRefs=[],n=0;n<e.entityRefs.length;++n)r.entityRefs[n]=Vs.opentelemetry.proto.common.v1.EntityRef.toObject(e.entityRefs[n],t);return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},t.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.resource.v1.Resource"},t})(),Ns),Is),Us.trace=(()=>{var e,t,r,n={};return n.v1=((r={}).TracesData=(c.prototype.resourceSpans=Ms.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Ds.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)Vs.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.TracesData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(Vs.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},c.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=Vs.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},c.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.TracesData)return e;var t=new Vs.opentelemetry.proto.trace.v1.TracesData;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");t.resourceSpans[r]=Vs.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},c.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=Vs.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},c.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.TracesData"},c),r.ResourceSpans=(l.prototype.resource=null,l.prototype.scopeSpans=Ms.emptyArray,l.prototype.schemaUrl=null,l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Ds.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Vs.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeSpans&&e.scopeSpans.length)for(var r=0;r<e.scopeSpans.length;++r)Vs.opentelemetry.proto.trace.v1.ScopeSpans.encode(e.scopeSpans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Vs.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeSpans&&o.scopeSpans.length||(o.scopeSpans=[]),o.scopeSpans.push(Vs.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Vs.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeSpans&&e.hasOwnProperty("scopeSpans")){if(!Array.isArray(e.scopeSpans))return"scopeSpans: array expected";for(var t,r=0;r<e.scopeSpans.length;++r)if(t=Vs.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[r]))return"scopeSpans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl)?"schemaUrl: string expected":null},l.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.ResourceSpans)return e;var t=new Vs.opentelemetry.proto.trace.v1.ResourceSpans;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");t.resource=Vs.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeSpans){if(!Array.isArray(e.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");t.scopeSpans=[];for(var r=0;r<e.scopeSpans.length;++r){if("object"!=typeof e.scopeSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");t.scopeSpans[r]=Vs.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},l.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeSpans=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Vs.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeSpans&&e.scopeSpans.length){r.scopeSpans=[];for(var n=0;n<e.scopeSpans.length;++n)r.scopeSpans[n]=Vs.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},l.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ResourceSpans"},l),r.ScopeSpans=(u.prototype.scope=null,u.prototype.spans=Ms.emptyArray,u.prototype.schemaUrl=null,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Ds.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Vs.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.spans&&e.spans.length)for(var r=0;r<e.spans.length;++r)Vs.opentelemetry.proto.trace.v1.Span.encode(e.spans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.spans&&o.spans.length||(o.spans=[]),o.spans.push(Vs.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Vs.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.spans&&e.hasOwnProperty("spans")){if(!Array.isArray(e.spans))return"spans: array expected";for(var t,r=0;r<e.spans.length;++r)if(t=Vs.opentelemetry.proto.trace.v1.Span.verify(e.spans[r]))return"spans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl)?"schemaUrl: string expected":null},u.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.ScopeSpans)return e;var t=new Vs.opentelemetry.proto.trace.v1.ScopeSpans;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");t.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.spans){if(!Array.isArray(e.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");t.spans=[];for(var r=0;r<e.spans.length;++r){if("object"!=typeof e.spans[r])throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");t.spans[r]=Vs.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.spans=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.spans&&e.spans.length){r.spans=[];for(var n=0;n<e.spans.length;++n)r.spans[n]=Vs.opentelemetry.proto.trace.v1.Span.toObject(e.spans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ScopeSpans"},u),r.Span=(s.prototype.traceId=null,s.prototype.spanId=null,s.prototype.traceState=null,s.prototype.parentSpanId=null,s.prototype.flags=null,s.prototype.name=null,s.prototype.kind=null,s.prototype.startTimeUnixNano=null,s.prototype.endTimeUnixNano=null,s.prototype.attributes=Ms.emptyArray,s.prototype.droppedAttributesCount=null,s.prototype.events=Ms.emptyArray,s.prototype.droppedEventsCount=null,s.prototype.links=Ms.emptyArray,s.prototype.droppedLinksCount=null,s.prototype.status=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ds.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.parentSpanId&&Object.hasOwnProperty.call(e,"parentSpanId")&&t.uint32(34).bytes(e.parentSpanId),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(42).string(e.name),null!=e.kind&&Object.hasOwnProperty.call(e,"kind")&&t.uint32(48).int32(e.kind),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(57).fixed64(e.startTimeUnixNano),null!=e.endTimeUnixNano&&Object.hasOwnProperty.call(e,"endTimeUnixNano")&&t.uint32(65).fixed64(e.endTimeUnixNano),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(80).uint32(e.droppedAttributesCount),null!=e.events&&e.events.length)for(r=0;r<e.events.length;++r)Vs.opentelemetry.proto.trace.v1.Span.Event.encode(e.events[r],t.uint32(90).fork()).ldelim();if(null!=e.droppedEventsCount&&Object.hasOwnProperty.call(e,"droppedEventsCount")&&t.uint32(96).uint32(e.droppedEventsCount),null!=e.links&&e.links.length)for(r=0;r<e.links.length;++r)Vs.opentelemetry.proto.trace.v1.Span.Link.encode(e.links[r],t.uint32(106).fork()).ldelim();return null!=e.droppedLinksCount&&Object.hasOwnProperty.call(e,"droppedLinksCount")&&t.uint32(112).uint32(e.droppedLinksCount),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&Vs.opentelemetry.proto.trace.v1.Status.encode(e.status,t.uint32(122).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(133).fixed32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.Span;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.parentSpanId=e.bytes();break;case 16:o.flags=e.fixed32();break;case 5:o.name=e.string();break;case 6:o.kind=e.int32();break;case 7:o.startTimeUnixNano=e.fixed64();break;case 8:o.endTimeUnixNano=e.fixed64();break;case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 10:o.droppedAttributesCount=e.uint32();break;case 11:o.events&&o.events.length||(o.events=[]),o.events.push(Vs.opentelemetry.proto.trace.v1.Span.Event.decode(e,e.uint32()));break;case 12:o.droppedEventsCount=e.uint32();break;case 13:o.links&&o.links.length||(o.links=[]),o.links.push(Vs.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break;case 14:o.droppedLinksCount=e.uint32();break;case 15:o.status=Vs.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Ms.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Ms.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!Ms.isString(e.traceState))return"traceState: string expected";if(null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&"number"==typeof e.parentSpanId.length||Ms.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags))return"flags: integer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Ms.isString(e.name))return"name: string expected";if(null!=e.kind&&e.hasOwnProperty("kind"))switch(e.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Ms.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Ms.isInteger(e.startTimeUnixNano.low)&&Ms.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&!(Ms.isInteger(e.endTimeUnixNano)||e.endTimeUnixNano&&Ms.isInteger(e.endTimeUnixNano.low)&&Ms.isInteger(e.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Ms.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(t=0;t<e.events.length;++t)if(r=Vs.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[t]))return"events."+r}if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&!Ms.isInteger(e.droppedEventsCount))return"droppedEventsCount: integer expected";if(null!=e.links&&e.hasOwnProperty("links")){if(!Array.isArray(e.links))return"links: array expected";for(t=0;t<e.links.length;++t)if(r=Vs.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[t]))return"links."+r}return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&!Ms.isInteger(e.droppedLinksCount)?"droppedLinksCount: integer expected":null!=e.status&&e.hasOwnProperty("status")&&(r=Vs.opentelemetry.proto.trace.v1.Status.verify(e.status))?"status."+r:null;var r},s.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.Span)return e;var t=new Vs.opentelemetry.proto.trace.v1.Span;switch(null!=e.traceId&&("string"==typeof e.traceId?Ms.base64.decode(e.traceId,t.traceId=Ms.newBuffer(Ms.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Ms.base64.decode(e.spanId,t.spanId=Ms.newBuffer(Ms.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),null!=e.parentSpanId&&("string"==typeof e.parentSpanId?Ms.base64.decode(e.parentSpanId,t.parentSpanId=Ms.newBuffer(Ms.base64.length(e.parentSpanId)),0):0<=e.parentSpanId.length&&(t.parentSpanId=e.parentSpanId)),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.name&&(t.name=String(e.name)),e.kind){default:"number"==typeof e.kind&&(t.kind=e.kind);break;case"SPAN_KIND_UNSPECIFIED":case 0:t.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:t.kind=1;break;case"SPAN_KIND_SERVER":case 2:t.kind=2;break;case"SPAN_KIND_CLIENT":case 3:t.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:t.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:t.kind=5}if(null!=e.startTimeUnixNano&&(Ms.Long?(t.startTimeUnixNano=Ms.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.endTimeUnixNano&&(Ms.Long?(t.endTimeUnixNano=Ms.Long.fromValue(e.endTimeUnixNano)).unsigned=!1:"string"==typeof e.endTimeUnixNano?t.endTimeUnixNano=parseInt(e.endTimeUnixNano,10):"number"==typeof e.endTimeUnixNano?t.endTimeUnixNano=e.endTimeUnixNano:"object"==typeof e.endTimeUnixNano&&(t.endTimeUnixNano=new Ms.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber())),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.events){if(!Array.isArray(e.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");for(t.events=[],r=0;r<e.events.length;++r){if("object"!=typeof e.events[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");t.events[r]=Vs.opentelemetry.proto.trace.v1.Span.Event.fromObject(e.events[r])}}if(null!=e.droppedEventsCount&&(t.droppedEventsCount=e.droppedEventsCount>>>0),e.links){if(!Array.isArray(e.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");for(t.links=[],r=0;r<e.links.length;++r){if("object"!=typeof e.links[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");t.links[r]=Vs.opentelemetry.proto.trace.v1.Span.Link.fromObject(e.links[r])}}if(null!=e.droppedLinksCount&&(t.droppedLinksCount=e.droppedLinksCount>>>0),null!=e.status){if("object"!=typeof e.status)throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");t.status=Vs.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.events=[],n.links=[]),t.defaults&&(t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Ms.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Ms.newBuffer(n.spanId))),n.traceState="",t.bytes===String?n.parentSpanId="":(n.parentSpanId=[],t.bytes!==Array&&(n.parentSpanId=Ms.newBuffer(n.parentSpanId))),n.name="",n.kind=t.enums===String?"SPAN_KIND_UNSPECIFIED":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.endTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.endTimeUnixNano=t.longs===String?"0":0,n.droppedAttributesCount=0,n.droppedEventsCount=0,n.droppedLinksCount=0,n.status=null,n.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Ms.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Ms.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(n.traceState=e.traceState),null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&(n.parentSpanId=t.bytes===String?Ms.base64.encode(e.parentSpanId,0,e.parentSpanId.length):t.bytes===Array?Array.prototype.slice.call(e.parentSpanId):e.parentSpanId),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=t.enums!==String||void 0===Vs.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]?e.kind:Vs.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&("number"==typeof e.endTimeUnixNano?n.endTimeUnixNano=t.longs===String?String(e.endTimeUnixNano):e.endTimeUnixNano:n.endTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.endTimeUnixNano):t.longs===Number?new Ms.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber():e.endTimeUnixNano),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),e.events&&e.events.length)for(n.events=[],o=0;o<e.events.length;++o)n.events[o]=Vs.opentelemetry.proto.trace.v1.Span.Event.toObject(e.events[o],t);if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&(n.droppedEventsCount=e.droppedEventsCount),e.links&&e.links.length)for(n.links=[],o=0;o<e.links.length;++o)n.links[o]=Vs.opentelemetry.proto.trace.v1.Span.Link.toObject(e.links[o],t);return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&(n.droppedLinksCount=e.droppedLinksCount),null!=e.status&&e.hasOwnProperty("status")&&(n.status=Vs.opentelemetry.proto.trace.v1.Status.toObject(e.status,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span"},s.SpanKind=(e={},(t=Object.create(e))[e[0]="SPAN_KIND_UNSPECIFIED"]=0,t[e[1]="SPAN_KIND_INTERNAL"]=1,t[e[2]="SPAN_KIND_SERVER"]=2,t[e[3]="SPAN_KIND_CLIENT"]=3,t[e[4]="SPAN_KIND_PRODUCER"]=4,t[e[5]="SPAN_KIND_CONSUMER"]=5,t),s.Event=(a.prototype.timeUnixNano=null,a.prototype.name=null,a.prototype.attributes=Ms.emptyArray,a.prototype.droppedAttributesCount=null,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ds.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(18).string(e.name),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.Span.Event;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 2:o.name=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Ms.isString(e.name))return"name: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Ms.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},a.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.Span.Event)return e;var t=new Vs.opentelemetry.proto.trace.v1.Span.Event;if(null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.name&&(t.name=String(e.name)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.name="",n.droppedAttributesCount=0),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Event"},a),s.Link=(i.prototype.traceId=null,i.prototype.spanId=null,i.prototype.traceState=null,i.prototype.attributes=Ms.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.flags=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ds.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(34).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(40).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(53).fixed32(e.flags),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.Span.Link;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 5:o.droppedAttributesCount=e.uint32();break;case 6:o.flags=e.fixed32();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Ms.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Ms.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!Ms.isString(e.traceState))return"traceState: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Ms.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags)?"flags: integer expected":null},i.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.Span.Link)return e;var t=new Vs.opentelemetry.proto.trace.v1.Span.Link;if(null!=e.traceId&&("string"==typeof e.traceId?Ms.base64.decode(e.traceId,t.traceId=Ms.newBuffer(Ms.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Ms.base64.decode(e.spanId,t.spanId=Ms.newBuffer(Ms.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(t.bytes===String?r.traceId="":(r.traceId=[],t.bytes!==Array&&(r.traceId=Ms.newBuffer(r.traceId))),t.bytes===String?r.spanId="":(r.spanId=[],t.bytes!==Array&&(r.spanId=Ms.newBuffer(r.spanId))),r.traceState="",r.droppedAttributesCount=0,r.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(r.traceId=t.bytes===String?Ms.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(r.spanId=t.bytes===String?Ms.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(r.traceState=e.traceState),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(r.flags=e.flags),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Link"},i),s),r.Status=(o.prototype.message=null,o.prototype.code=null,o.create=function(e){return new o(e)},o.encode=function(e,t){return t=t||Ds.create(),null!=e.message&&Object.hasOwnProperty.call(e,"message")&&t.uint32(18).string(e.message),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(24).int32(e.code),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.trace.v1.Status;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 2:o.message=e.string();break;case 3:o.code=e.int32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.message&&e.hasOwnProperty("message")&&!Ms.isString(e.message))return"message: string expected";if(null!=e.code&&e.hasOwnProperty("code"))switch(e.code){default:return"code: enum value expected";case 0:case 1:case 2:}return null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.trace.v1.Status)return e;var t=new Vs.opentelemetry.proto.trace.v1.Status;switch(null!=e.message&&(t.message=String(e.message)),e.code){default:"number"==typeof e.code&&(t.code=e.code);break;case"STATUS_CODE_UNSET":case 0:t.code=0;break;case"STATUS_CODE_OK":case 1:t.code=1;break;case"STATUS_CODE_ERROR":case 2:t.code=2}return t},o.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.message="",r.code=t.enums===String?"STATUS_CODE_UNSET":0),null!=e.message&&e.hasOwnProperty("message")&&(r.message=e.message),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums!==String||void 0===Vs.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]?e.code:Vs.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Status"},o.StatusCode=(e={},(t=Object.create(e))[e[0]="STATUS_CODE_UNSET"]=0,t[e[1]="STATUS_CODE_OK"]=1,t[e[2]="STATUS_CODE_ERROR"]=2,t),o),r.SpanFlags=(e={},(t=Object.create(e))[e[0]="SPAN_FLAGS_DO_NOT_USE"]=0,t[e[255]="SPAN_FLAGS_TRACE_FLAGS_MASK"]=255,t[e[256]="SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"]=256,t[e[512]="SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"]=512,t),r),n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.events=[],this.links=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.spans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.scopeSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Us.collector=((Ps={}).trace=(()=>{var e,t={};return t.v1=((e={}).TraceService=(((s.prototype=Object.create(Ls.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportTraceServiceRequest=(o.prototype.resourceSpans=Ms.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ds.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)Vs.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(Vs.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=Vs.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return e;var t=new Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");t.resourceSpans[r]=Vs.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=Vs.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},o),e.ExportTraceServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ds.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return e;var t=new Vs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");t.partialSuccess=Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},n),e.ExportTracePartialSuccess=(r.prototype.rejectedSpans=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ds.create(),null!=e.rejectedSpans&&Object.hasOwnProperty.call(e,"rejectedSpans")&&t.uint32(8).int64(e.rejectedSpans),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedSpans=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&!(Ms.isInteger(e.rejectedSpans)||e.rejectedSpans&&Ms.isInteger(e.rejectedSpans.low)&&Ms.isInteger(e.rejectedSpans.high))?"rejectedSpans: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Ms.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess?e:(t=new Vs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess,null!=e.rejectedSpans&&(Ms.Long?(t.rejectedSpans=Ms.Long.fromValue(e.rejectedSpans)).unsigned=!1:"string"==typeof e.rejectedSpans?t.rejectedSpans=parseInt(e.rejectedSpans,10):"number"==typeof e.rejectedSpans?t.rejectedSpans=e.rejectedSpans:"object"==typeof e.rejectedSpans&&(t.rejectedSpans=new Ms.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.rejectedSpans=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedSpans=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&("number"==typeof e.rejectedSpans?n.rejectedSpans=t.longs===String?String(e.rejectedSpans):e.rejectedSpans:n.rejectedSpans=t.longs===String?Ms.Long.prototype.toString.call(e.rejectedSpans):t.longs===Number?new Ms.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber():e.rejectedSpans),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Ls.rpc.Service.call(this,e,t,r)}})(),Ps.metrics=(()=>{var e,t={};return t.v1=((e={}).MetricsService=(((s.prototype=Object.create(Ls.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportMetricsServiceRequest=(o.prototype.resourceMetrics=Ms.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ds.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return e;var t=new Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");t.resourceMetrics[r]=Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},o),e.ExportMetricsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ds.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return e;var t=new Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");t.partialSuccess=Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},n),e.ExportMetricsPartialSuccess=(r.prototype.rejectedDataPoints=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ds.create(),null!=e.rejectedDataPoints&&Object.hasOwnProperty.call(e,"rejectedDataPoints")&&t.uint32(8).int64(e.rejectedDataPoints),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedDataPoints=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&!(Ms.isInteger(e.rejectedDataPoints)||e.rejectedDataPoints&&Ms.isInteger(e.rejectedDataPoints.low)&&Ms.isInteger(e.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Ms.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess?e:(t=new Vs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess,null!=e.rejectedDataPoints&&(Ms.Long?(t.rejectedDataPoints=Ms.Long.fromValue(e.rejectedDataPoints)).unsigned=!1:"string"==typeof e.rejectedDataPoints?t.rejectedDataPoints=parseInt(e.rejectedDataPoints,10):"number"==typeof e.rejectedDataPoints?t.rejectedDataPoints=e.rejectedDataPoints:"object"==typeof e.rejectedDataPoints&&(t.rejectedDataPoints=new Ms.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.rejectedDataPoints=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedDataPoints=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&("number"==typeof e.rejectedDataPoints?n.rejectedDataPoints=t.longs===String?String(e.rejectedDataPoints):e.rejectedDataPoints:n.rejectedDataPoints=t.longs===String?Ms.Long.prototype.toString.call(e.rejectedDataPoints):t.longs===Number?new Ms.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber():e.rejectedDataPoints),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Ls.rpc.Service.call(this,e,t,r)}})(),Ps.logs=(()=>{var e,t={};return t.v1=((e={}).LogsService=(((s.prototype=Object.create(Ls.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportLogsServiceRequest=(o.prototype.resourceLogs=Ms.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ds.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)Vs.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(Vs.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=Vs.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return e;var t=new Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");t.resourceLogs[r]=Vs.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=Vs.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},o),e.ExportLogsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ds.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return e;var t=new Vs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");t.partialSuccess=Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},n),e.ExportLogsPartialSuccess=(r.prototype.rejectedLogRecords=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ds.create(),null!=e.rejectedLogRecords&&Object.hasOwnProperty.call(e,"rejectedLogRecords")&&t.uint32(8).int64(e.rejectedLogRecords),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedLogRecords=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&!(Ms.isInteger(e.rejectedLogRecords)||e.rejectedLogRecords&&Ms.isInteger(e.rejectedLogRecords.low)&&Ms.isInteger(e.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Ms.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess?e:(t=new Vs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess,null!=e.rejectedLogRecords&&(Ms.Long?(t.rejectedLogRecords=Ms.Long.fromValue(e.rejectedLogRecords)).unsigned=!1:"string"==typeof e.rejectedLogRecords?t.rejectedLogRecords=parseInt(e.rejectedLogRecords,10):"number"==typeof e.rejectedLogRecords?t.rejectedLogRecords=e.rejectedLogRecords:"object"==typeof e.rejectedLogRecords&&(t.rejectedLogRecords=new Ms.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.rejectedLogRecords=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedLogRecords=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&("number"==typeof e.rejectedLogRecords?n.rejectedLogRecords=t.longs===String?String(e.rejectedLogRecords):e.rejectedLogRecords:n.rejectedLogRecords=t.longs===String?Ms.Long.prototype.toString.call(e.rejectedLogRecords):t.longs===Number?new Ms.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber():e.rejectedLogRecords),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Ls.rpc.Service.call(this,e,t,r)}})(),Ps),Us.metrics=(()=>{var e,t,r,n={};return n.v1=((r={}).MetricsData=(v.prototype.resourceMetrics=Ms.emptyArray,v.create=function(e){return new v(e)},v.encode=function(e,t){if(t=t||Ds.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},v.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},v.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.MetricsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},v.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},v.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.MetricsData)return e;var t=new Vs.opentelemetry.proto.metrics.v1.MetricsData;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");t.resourceMetrics[r]=Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},v.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=Vs.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},v.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},v.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.MetricsData"},v),r.ResourceMetrics=(_.prototype.resource=null,_.prototype.scopeMetrics=Ms.emptyArray,_.prototype.schemaUrl=null,_.create=function(e){return new _(e)},_.encode=function(e,t){if(t=t||Ds.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Vs.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeMetrics&&e.scopeMetrics.length)for(var r=0;r<e.scopeMetrics.length;++r)Vs.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(e.scopeMetrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},_.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},_.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Vs.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeMetrics&&o.scopeMetrics.length||(o.scopeMetrics=[]),o.scopeMetrics.push(Vs.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},_.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},_.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Vs.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeMetrics&&e.hasOwnProperty("scopeMetrics")){if(!Array.isArray(e.scopeMetrics))return"scopeMetrics: array expected";for(var t,r=0;r<e.scopeMetrics.length;++r)if(t=Vs.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[r]))return"scopeMetrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl)?"schemaUrl: string expected":null},_.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var t=new Vs.opentelemetry.proto.metrics.v1.ResourceMetrics;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");t.resource=Vs.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeMetrics){if(!Array.isArray(e.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");t.scopeMetrics=[];for(var r=0;r<e.scopeMetrics.length;++r){if("object"!=typeof e.scopeMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");t.scopeMetrics[r]=Vs.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},_.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeMetrics=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Vs.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeMetrics&&e.scopeMetrics.length){r.scopeMetrics=[];for(var n=0;n<e.scopeMetrics.length;++n)r.scopeMetrics[n]=Vs.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},_.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},_.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},_),r.ScopeMetrics=(y.prototype.scope=null,y.prototype.metrics=Ms.emptyArray,y.prototype.schemaUrl=null,y.create=function(e){return new y(e)},y.encode=function(e,t){if(t=t||Ds.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Vs.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.metrics&&e.metrics.length)for(var r=0;r<e.metrics.length;++r)Vs.opentelemetry.proto.metrics.v1.Metric.encode(e.metrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},y.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},y.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.metrics&&o.metrics.length||(o.metrics=[]),o.metrics.push(Vs.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},y.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Vs.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t,r=0;r<e.metrics.length;++r)if(t=Vs.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[r]))return"metrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl)?"schemaUrl: string expected":null},y.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var t=new Vs.opentelemetry.proto.metrics.v1.ScopeMetrics;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");t.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");t.metrics=[];for(var r=0;r<e.metrics.length;++r){if("object"!=typeof e.metrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");t.metrics[r]=Vs.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},y.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metrics=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.metrics&&e.metrics.length){r.metrics=[];for(var n=0;n<e.metrics.length;++n)r.metrics[n]=Vs.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},y.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},y.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},y),r.Metric=(g.prototype.name=null,g.prototype.description=null,g.prototype.unit=null,g.prototype.gauge=null,g.prototype.sum=null,g.prototype.histogram=null,g.prototype.exponentialHistogram=null,g.prototype.summary=null,g.prototype.metadata=Ms.emptyArray,Object.defineProperty(g.prototype,"data",{get:Ms.oneOfGetter(t=["gauge","sum","histogram","exponentialHistogram","summary"]),set:Ms.oneOfSetter(t)}),g.create=function(e){return new g(e)},g.encode=function(e,t){if(t=t||Ds.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.description&&Object.hasOwnProperty.call(e,"description")&&t.uint32(18).string(e.description),null!=e.unit&&Object.hasOwnProperty.call(e,"unit")&&t.uint32(26).string(e.unit),null!=e.gauge&&Object.hasOwnProperty.call(e,"gauge")&&Vs.opentelemetry.proto.metrics.v1.Gauge.encode(e.gauge,t.uint32(42).fork()).ldelim(),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&Vs.opentelemetry.proto.metrics.v1.Sum.encode(e.sum,t.uint32(58).fork()).ldelim(),null!=e.histogram&&Object.hasOwnProperty.call(e,"histogram")&&Vs.opentelemetry.proto.metrics.v1.Histogram.encode(e.histogram,t.uint32(74).fork()).ldelim(),null!=e.exponentialHistogram&&Object.hasOwnProperty.call(e,"exponentialHistogram")&&Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(e.exponentialHistogram,t.uint32(82).fork()).ldelim(),null!=e.summary&&Object.hasOwnProperty.call(e,"summary")&&Vs.opentelemetry.proto.metrics.v1.Summary.encode(e.summary,t.uint32(90).fork()).ldelim(),null!=e.metadata&&e.metadata.length)for(var r=0;r<e.metadata.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.metadata[r],t.uint32(98).fork()).ldelim();return t},g.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},g.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.Metric;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.description=e.string();break;case 3:o.unit=e.string();break;case 5:o.gauge=Vs.opentelemetry.proto.metrics.v1.Gauge.decode(e,e.uint32());break;case 7:o.sum=Vs.opentelemetry.proto.metrics.v1.Sum.decode(e,e.uint32());break;case 9:o.histogram=Vs.opentelemetry.proto.metrics.v1.Histogram.decode(e,e.uint32());break;case 10:o.exponentialHistogram=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(e,e.uint32());break;case 11:o.summary=Vs.opentelemetry.proto.metrics.v1.Summary.decode(e,e.uint32());break;case 12:o.metadata&&o.metadata.length||(o.metadata=[]),o.metadata.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},g.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},g.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.name&&e.hasOwnProperty("name")&&!Ms.isString(e.name))return"name: string expected";if(null!=e.description&&e.hasOwnProperty("description")&&!Ms.isString(e.description))return"description: string expected";if(null!=e.unit&&e.hasOwnProperty("unit")&&!Ms.isString(e.unit))return"unit: string expected";if(null!=e.gauge&&e.hasOwnProperty("gauge")&&(t.data=1,r=Vs.opentelemetry.proto.metrics.v1.Gauge.verify(e.gauge)))return"gauge."+r;if(null!=e.sum&&e.hasOwnProperty("sum")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Vs.opentelemetry.proto.metrics.v1.Sum.verify(e.sum))return"sum."+r}if(null!=e.histogram&&e.hasOwnProperty("histogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Vs.opentelemetry.proto.metrics.v1.Histogram.verify(e.histogram))return"histogram."+r}if(null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(e.exponentialHistogram))return"exponentialHistogram."+r}if(null!=e.summary&&e.hasOwnProperty("summary")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Vs.opentelemetry.proto.metrics.v1.Summary.verify(e.summary))return"summary."+r}if(null!=e.metadata&&e.hasOwnProperty("metadata")){if(!Array.isArray(e.metadata))return"metadata: array expected";for(var r,n=0;n<e.metadata.length;++n)if(r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.metadata[n]))return"metadata."+r}return null},g.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.Metric)return e;var t=new Vs.opentelemetry.proto.metrics.v1.Metric;if(null!=e.name&&(t.name=String(e.name)),null!=e.description&&(t.description=String(e.description)),null!=e.unit&&(t.unit=String(e.unit)),null!=e.gauge){if("object"!=typeof e.gauge)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");t.gauge=Vs.opentelemetry.proto.metrics.v1.Gauge.fromObject(e.gauge)}if(null!=e.sum){if("object"!=typeof e.sum)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");t.sum=Vs.opentelemetry.proto.metrics.v1.Sum.fromObject(e.sum)}if(null!=e.histogram){if("object"!=typeof e.histogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");t.histogram=Vs.opentelemetry.proto.metrics.v1.Histogram.fromObject(e.histogram)}if(null!=e.exponentialHistogram){if("object"!=typeof e.exponentialHistogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");t.exponentialHistogram=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(e.exponentialHistogram)}if(null!=e.summary){if("object"!=typeof e.summary)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");t.summary=Vs.opentelemetry.proto.metrics.v1.Summary.fromObject(e.summary)}if(e.metadata){if(!Array.isArray(e.metadata))throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: array expected");t.metadata=[];for(var r=0;r<e.metadata.length;++r){if("object"!=typeof e.metadata[r])throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: object expected");t.metadata[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.metadata[r])}}return t},g.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metadata=[]),t.defaults&&(r.name="",r.description="",r.unit=""),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.description&&e.hasOwnProperty("description")&&(r.description=e.description),null!=e.unit&&e.hasOwnProperty("unit")&&(r.unit=e.unit),null!=e.gauge&&e.hasOwnProperty("gauge")&&(r.gauge=Vs.opentelemetry.proto.metrics.v1.Gauge.toObject(e.gauge,t),t.oneofs)&&(r.data="gauge"),null!=e.sum&&e.hasOwnProperty("sum")&&(r.sum=Vs.opentelemetry.proto.metrics.v1.Sum.toObject(e.sum,t),t.oneofs)&&(r.data="sum"),null!=e.histogram&&e.hasOwnProperty("histogram")&&(r.histogram=Vs.opentelemetry.proto.metrics.v1.Histogram.toObject(e.histogram,t),t.oneofs)&&(r.data="histogram"),null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")&&(r.exponentialHistogram=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(e.exponentialHistogram,t),t.oneofs)&&(r.data="exponentialHistogram"),null!=e.summary&&e.hasOwnProperty("summary")&&(r.summary=Vs.opentelemetry.proto.metrics.v1.Summary.toObject(e.summary,t),t.oneofs)&&(r.data="summary"),e.metadata&&e.metadata.length){r.metadata=[];for(var n=0;n<e.metadata.length;++n)r.metadata[n]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.metadata[n],t)}return r},g.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},g.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Metric"},g),r.Gauge=(m.prototype.dataPoints=Ms.emptyArray,m.create=function(e){return new m(e)},m.encode=function(e,t){if(t=t||Ds.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},m.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},m.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.Gauge;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},m.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},m.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},m.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.Gauge)return e;var t=new Vs.opentelemetry.proto.metrics.v1.Gauge;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");t.dataPoints[r]=Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}return t},m.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return r},m.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},m.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Gauge"},m),r.Sum=(f.prototype.dataPoints=Ms.emptyArray,f.prototype.aggregationTemporality=null,f.prototype.isMonotonic=null,f.create=function(e){return new f(e)},f.encode=function(e,t){if(t=t||Ds.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),null!=e.isMonotonic&&Object.hasOwnProperty.call(e,"isMonotonic")&&t.uint32(24).bool(e.isMonotonic),t},f.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},f.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.Sum;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;case 3:o.isMonotonic=e.bool();break;default:e.skipType(7&s)}}return o},f.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},f.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&"boolean"!=typeof e.isMonotonic?"isMonotonic: boolean expected":null},f.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.Sum)return e;var t=new Vs.opentelemetry.proto.metrics.v1.Sum;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");t.dataPoints[r]=Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return null!=e.isMonotonic&&(t.isMonotonic=Boolean(e.isMonotonic)),t},f.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,r.isMonotonic=!1),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Vs.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Vs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Vs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&(r.isMonotonic=e.isMonotonic),r},f.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},f.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Sum"},f),r.Histogram=(d.prototype.dataPoints=Ms.emptyArray,d.prototype.aggregationTemporality=null,d.create=function(e){return new d(e)},d.encode=function(e,t){if(t=t||Ds.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},d.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},d.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.Histogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},d.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},d.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},d.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.Histogram)return e;var t=new Vs.opentelemetry.proto.metrics.v1.Histogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");t.dataPoints[r]=Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},d.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Vs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Vs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},d.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},d.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Histogram"},d),r.ExponentialHistogram=(h.prototype.dataPoints=Ms.emptyArray,h.prototype.aggregationTemporality=null,h.create=function(e){return new h(e)},h.encode=function(e,t){if(t=t||Ds.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},h.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},h.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},h.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},h.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},h.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var t=new Vs.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");t.dataPoints[r]=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},h.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Vs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Vs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},h.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},h.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},h),r.Summary=(p.prototype.dataPoints=Ms.emptyArray,p.create=function(e){return new p(e)},p.encode=function(e,t){if(t=t||Ds.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},p.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},p.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.Summary;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},p.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},p.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},p.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.Summary)return e;var t=new Vs.opentelemetry.proto.metrics.v1.Summary;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");t.dataPoints[r]=Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[r])}}return t},p.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[n],t)}return r},p.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},p.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Summary"},p),r.AggregationTemporality=(t={},(e=Object.create(t))[t[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,e[t[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,e[t[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,e),r.DataPointFlags=(t={},(e=Object.create(t))[t[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,e[t[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,e),r.NumberDataPoint=(c.prototype.attributes=Ms.emptyArray,c.prototype.startTimeUnixNano=null,c.prototype.timeUnixNano=null,c.prototype.asDouble=null,c.prototype.asInt=null,c.prototype.exemplars=Ms.emptyArray,c.prototype.flags=null,Object.defineProperty(c.prototype,"value",{get:Ms.oneOfGetter(t=["asDouble","asInt"]),set:Ms.oneOfSetter(t)}),c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Ds.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(33).double(e.asDouble),null!=e.exemplars&&e.exemplars.length)for(var r=0;r<e.exemplars.length;++r)Vs.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(42).fork()).ldelim();if(null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.NumberDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 5:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Vs.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},c.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var n=0;n<e.attributes.length;++n)if(t=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[n]))return"attributes."+t}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Ms.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Ms.isInteger(e.startTimeUnixNano.low)&&Ms.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(r.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===r.value)return"value: multiple values";if(r.value=1,!(Ms.isInteger(e.asInt)||e.asInt&&Ms.isInteger(e.asInt.low)&&Ms.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(n=0;n<e.exemplars.length;++n)if(t=Vs.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[n]))return"exemplars."+t}return null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags)?"flags: integer expected":null},c.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.NumberDataPoint)return e;var t=new Vs.opentelemetry.proto.metrics.v1.NumberDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Ms.Long?(t.startTimeUnixNano=Ms.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(Ms.Long?(t.asInt=Ms.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new Ms.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");t.exemplars[r]=Vs.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},c.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.exemplars=[],n.attributes=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),e.exemplars&&e.exemplars.length){n.exemplars=[];for(var o=0;o<e.exemplars.length;++o)n.exemplars[o]=Vs.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t)}if(null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?Ms.Long.prototype.toString.call(e.asInt):t.longs===Number?new Ms.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},c.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},c),r.HistogramDataPoint=(l.prototype.attributes=Ms.emptyArray,l.prototype.startTimeUnixNano=null,l.prototype.timeUnixNano=null,l.prototype.count=null,l.prototype.sum=null,l.prototype.bucketCounts=Ms.emptyArray,l.prototype.explicitBounds=Ms.emptyArray,l.prototype.exemplars=Ms.emptyArray,l.prototype.flags=null,l.prototype.min=null,l.prototype.max=null,Object.defineProperty(l.prototype,"_sum",{get:Ms.oneOfGetter(e=["sum"]),set:Ms.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_min",{get:Ms.oneOfGetter(e=["min"]),set:Ms.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_max",{get:Ms.oneOfGetter(e=["max"]),set:Ms.oneOfSetter(e)}),l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Ds.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(50).fork();for(var r=0;r<e.bucketCounts.length;++r)t.fixed64(e.bucketCounts[r]);t.ldelim()}if(null!=e.explicitBounds&&e.explicitBounds.length){for(t.uint32(58).fork(),r=0;r<e.explicitBounds.length;++r)t.double(e.explicitBounds[r]);t.ldelim()}if(null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)Vs.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(66).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(89).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(97).double(e.max),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.fixed64());else o.bucketCounts.push(e.fixed64());break;case 7:if(o.explicitBounds&&o.explicitBounds.length||(o.explicitBounds=[]),2==(7&s))for(i=e.uint32()+e.pos;e.pos<i;)o.explicitBounds.push(e.double());else o.explicitBounds.push(e.double());break;case 8:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Vs.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 10:o.flags=e.uint32();break;case 11:o.min=e.double();break;case 12:o.max=e.double();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Ms.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Ms.isInteger(e.startTimeUnixNano.low)&&Ms.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Ms.isInteger(e.count)||e.count&&Ms.isInteger(e.count.low)&&Ms.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(t=0;t<e.bucketCounts.length;++t)if(!(Ms.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&Ms.isInteger(e.bucketCounts[t].low)&&Ms.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}if(null!=e.explicitBounds&&e.hasOwnProperty("explicitBounds")){if(!Array.isArray(e.explicitBounds))return"explicitBounds: array expected";for(t=0;t<e.explicitBounds.length;++t)if("number"!=typeof e.explicitBounds[t])return"explicitBounds: number[] expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=Vs.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags)?"flags: integer expected":null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null},l.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint)return e;var t=new Vs.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Ms.Long?(t.startTimeUnixNano=Ms.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Ms.Long?(t.count=Ms.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Ms.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");for(t.bucketCounts=[],r=0;r<e.bucketCounts.length;++r)Ms.Long?(t.bucketCounts[r]=Ms.Long.fromValue(e.bucketCounts[r])).unsigned=!1:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new Ms.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber())}if(e.explicitBounds){if(!Array.isArray(e.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");for(t.explicitBounds=[],r=0;r<e.explicitBounds.length;++r)t.explicitBounds[r]=Number(e.explicitBounds[r])}if(e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");t.exemplars[r]=Vs.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),t},l.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.bucketCounts=[],n.explicitBounds=[],n.exemplars=[],n.attributes=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Ms.Long.prototype.toString.call(e.count):t.longs===Number?new Ms.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),e.bucketCounts&&e.bucketCounts.length){n.bucketCounts=[];for(var o=0;o<e.bucketCounts.length;++o)"number"==typeof e.bucketCounts[o]?n.bucketCounts[o]=t.longs===String?String(e.bucketCounts[o]):e.bucketCounts[o]:n.bucketCounts[o]=t.longs===String?Ms.Long.prototype.toString.call(e.bucketCounts[o]):t.longs===Number?new Ms.LongBits(e.bucketCounts[o].low>>>0,e.bucketCounts[o].high>>>0).toNumber():e.bucketCounts[o]}if(e.explicitBounds&&e.explicitBounds.length)for(n.explicitBounds=[],o=0;o<e.explicitBounds.length;++o)n.explicitBounds[o]=t.json&&!isFinite(e.explicitBounds[o])?String(e.explicitBounds[o]):e.explicitBounds[o];if(e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=Vs.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),n},l.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},l),r.ExponentialHistogramDataPoint=(a.prototype.attributes=Ms.emptyArray,a.prototype.startTimeUnixNano=null,a.prototype.timeUnixNano=null,a.prototype.count=null,a.prototype.sum=null,a.prototype.scale=null,a.prototype.zeroCount=null,a.prototype.positive=null,a.prototype.negative=null,a.prototype.flags=null,a.prototype.exemplars=Ms.emptyArray,a.prototype.min=null,a.prototype.max=null,a.prototype.zeroThreshold=null,Object.defineProperty(a.prototype,"_sum",{get:Ms.oneOfGetter(t=["sum"]),set:Ms.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_min",{get:Ms.oneOfGetter(t=["min"]),set:Ms.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_max",{get:Ms.oneOfGetter(t=["max"]),set:Ms.oneOfSetter(t)}),a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ds.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.scale&&Object.hasOwnProperty.call(e,"scale")&&t.uint32(48).sint32(e.scale),null!=e.zeroCount&&Object.hasOwnProperty.call(e,"zeroCount")&&t.uint32(57).fixed64(e.zeroCount),null!=e.positive&&Object.hasOwnProperty.call(e,"positive")&&Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.positive,t.uint32(66).fork()).ldelim(),null!=e.negative&&Object.hasOwnProperty.call(e,"negative")&&Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.negative,t.uint32(74).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)Vs.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(90).fork()).ldelim();return null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(97).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(105).double(e.max),null!=e.zeroThreshold&&Object.hasOwnProperty.call(e,"zeroThreshold")&&t.uint32(113).double(e.zeroThreshold),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.scale=e.sint32();break;case 7:o.zeroCount=e.fixed64();break;case 8:o.positive=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 9:o.negative=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 10:o.flags=e.uint32();break;case 11:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Vs.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 12:o.min=e.double();break;case 13:o.max=e.double();break;case 14:o.zeroThreshold=e.double();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Ms.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Ms.isInteger(e.startTimeUnixNano.low)&&Ms.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Ms.isInteger(e.count)||e.count&&Ms.isInteger(e.count.low)&&Ms.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.scale&&e.hasOwnProperty("scale")&&!Ms.isInteger(e.scale))return"scale: integer expected";if(null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&!(Ms.isInteger(e.zeroCount)||e.zeroCount&&Ms.isInteger(e.zeroCount.low)&&Ms.isInteger(e.zeroCount.high)))return"zeroCount: integer|Long expected";if(null!=e.positive&&e.hasOwnProperty("positive")&&(r=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.positive)))return"positive."+r;if(null!=e.negative&&e.hasOwnProperty("negative")&&(r=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.negative)))return"negative."+r;if(null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags))return"flags: integer expected";if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=Vs.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&"number"!=typeof e.zeroThreshold?"zeroThreshold: number expected":null},a.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return e;var t=new Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Ms.Long?(t.startTimeUnixNano=Ms.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Ms.Long?(t.count=Ms.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Ms.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),null!=e.scale&&(t.scale=0|e.scale),null!=e.zeroCount&&(Ms.Long?(t.zeroCount=Ms.Long.fromValue(e.zeroCount)).unsigned=!1:"string"==typeof e.zeroCount?t.zeroCount=parseInt(e.zeroCount,10):"number"==typeof e.zeroCount?t.zeroCount=e.zeroCount:"object"==typeof e.zeroCount&&(t.zeroCount=new Ms.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber())),null!=e.positive){if("object"!=typeof e.positive)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");t.positive=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.positive)}if(null!=e.negative){if("object"!=typeof e.negative)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");t.negative=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.negative)}if(null!=e.flags&&(t.flags=e.flags>>>0),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");t.exemplars[r]=Vs.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),null!=e.zeroThreshold&&(t.zeroThreshold=Number(e.zeroThreshold)),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.exemplars=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.scale=0,Ms.Long?(r=new Ms.Long(0,0,!1),n.zeroCount=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.zeroCount=t.longs===String?"0":0,n.positive=null,n.negative=null,n.flags=0,n.zeroThreshold=0),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Ms.Long.prototype.toString.call(e.count):t.longs===Number?new Ms.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),null!=e.scale&&e.hasOwnProperty("scale")&&(n.scale=e.scale),null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&("number"==typeof e.zeroCount?n.zeroCount=t.longs===String?String(e.zeroCount):e.zeroCount:n.zeroCount=t.longs===String?Ms.Long.prototype.toString.call(e.zeroCount):t.longs===Number?new Ms.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber():e.zeroCount),null!=e.positive&&e.hasOwnProperty("positive")&&(n.positive=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.positive,t)),null!=e.negative&&e.hasOwnProperty("negative")&&(n.negative=Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.negative,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=Vs.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);return null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&(n.zeroThreshold=t.json&&!isFinite(e.zeroThreshold)?String(e.zeroThreshold):e.zeroThreshold),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},a.Buckets=(u.prototype.offset=null,u.prototype.bucketCounts=Ms.emptyArray,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Ds.create(),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).sint32(e.offset),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(18).fork();for(var r=0;r<e.bucketCounts.length;++r)t.uint64(e.bucketCounts[r]);t.ldelim()}return t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.offset=e.sint32();break;case 2:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.uint64());else o.bucketCounts.push(e.uint64());break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.offset&&e.hasOwnProperty("offset")&&!Ms.isInteger(e.offset))return"offset: integer expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(var t=0;t<e.bucketCounts.length;++t)if(!(Ms.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&Ms.isInteger(e.bucketCounts[t].low)&&Ms.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}return null},u.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return e;var t=new Vs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(null!=e.offset&&(t.offset=0|e.offset),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");t.bucketCounts=[];for(var r=0;r<e.bucketCounts.length;++r)Ms.Long?(t.bucketCounts[r]=Ms.Long.fromValue(e.bucketCounts[r])).unsigned=!0:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new Ms.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber(!0))}return t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.bucketCounts=[]),t.defaults&&(r.offset=0),null!=e.offset&&e.hasOwnProperty("offset")&&(r.offset=e.offset),e.bucketCounts&&e.bucketCounts.length){r.bucketCounts=[];for(var n=0;n<e.bucketCounts.length;++n)"number"==typeof e.bucketCounts[n]?r.bucketCounts[n]=t.longs===String?String(e.bucketCounts[n]):e.bucketCounts[n]:r.bucketCounts[n]=t.longs===String?Ms.Long.prototype.toString.call(e.bucketCounts[n]):t.longs===Number?new Ms.LongBits(e.bucketCounts[n].low>>>0,e.bucketCounts[n].high>>>0).toNumber(!0):e.bucketCounts[n]}return r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},u),a),r.SummaryDataPoint=(s.prototype.attributes=Ms.emptyArray,s.prototype.startTimeUnixNano=null,s.prototype.timeUnixNano=null,s.prototype.count=null,s.prototype.sum=null,s.prototype.quantileValues=Ms.emptyArray,s.prototype.flags=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ds.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.quantileValues&&e.quantileValues.length)for(var r=0;r<e.quantileValues.length;++r)Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(e.quantileValues[r],t.uint32(50).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.quantileValues&&o.quantileValues.length||(o.quantileValues=[]),o.quantileValues.push(Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Ms.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Ms.isInteger(e.startTimeUnixNano.low)&&Ms.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Ms.isInteger(e.count)||e.count&&Ms.isInteger(e.count.low)&&Ms.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.quantileValues&&e.hasOwnProperty("quantileValues")){if(!Array.isArray(e.quantileValues))return"quantileValues: array expected";for(t=0;t<e.quantileValues.length;++t){var r;if(r=Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[t]))return"quantileValues."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags)?"flags: integer expected":null},s.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var t=new Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Ms.Long?(t.startTimeUnixNano=Ms.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Ms.Long?(t.count=Ms.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Ms.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.quantileValues){if(!Array.isArray(e.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");for(t.quantileValues=[],r=0;r<e.quantileValues.length;++r){if("object"!=typeof e.quantileValues[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");t.quantileValues[r]=Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.quantileValues=[],n.attributes=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Ms.Long?(r=new Ms.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.sum=0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Ms.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Ms.Long.prototype.toString.call(e.count):t.longs===Number?new Ms.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum),e.quantileValues&&e.quantileValues.length){n.quantileValues=[];for(var o=0;o<e.quantileValues.length;++o)n.quantileValues[o]=Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(e.quantileValues[o],t)}if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},s.ValueAtQuantile=(i.prototype.quantile=null,i.prototype.value=null,i.create=function(e){return new i(e)},i.encode=function(e,t){return t=t||Ds.create(),null!=e.quantile&&Object.hasOwnProperty.call(e,"quantile")&&t.uint32(9).double(e.quantile),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(17).double(e.value),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.quantile=e.double();break;case 2:o.value=e.double();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},i.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.quantile&&e.hasOwnProperty("quantile")&&"number"!=typeof e.quantile?"quantile: number expected":null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},i.fromObject=function(e){var t;return e instanceof Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile?e:(t=new Vs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile,null!=e.quantile&&(t.quantile=Number(e.quantile)),null!=e.value&&(t.value=Number(e.value)),t)},i.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.quantile=0,r.value=0),null!=e.quantile&&e.hasOwnProperty("quantile")&&(r.quantile=t.json&&!isFinite(e.quantile)?String(e.quantile):e.quantile),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.json&&!isFinite(e.value)?String(e.value):e.value),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},i),s),r.Exemplar=(o.prototype.filteredAttributes=Ms.emptyArray,o.prototype.timeUnixNano=null,o.prototype.asDouble=null,o.prototype.asInt=null,o.prototype.spanId=null,o.prototype.traceId=null,Object.defineProperty(o.prototype,"value",{get:Ms.oneOfGetter(e=["asDouble","asInt"]),set:Ms.oneOfSetter(e)}),o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ds.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(17).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(25).double(e.asDouble),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(34).bytes(e.spanId),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(42).bytes(e.traceId),null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.filteredAttributes&&e.filteredAttributes.length)for(var r=0;r<e.filteredAttributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.filteredAttributes[r],t.uint32(58).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.metrics.v1.Exemplar;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.filteredAttributes&&o.filteredAttributes.length||(o.filteredAttributes=[]),o.filteredAttributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.timeUnixNano=e.fixed64();break;case 3:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 4:o.spanId=e.bytes();break;case 5:o.traceId=e.bytes();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.filteredAttributes&&e.hasOwnProperty("filteredAttributes")){if(!Array.isArray(e.filteredAttributes))return"filteredAttributes: array expected";for(var r=0;r<e.filteredAttributes.length;++r){var n=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.filteredAttributes[r]);if(n)return"filteredAttributes."+n}}if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(t.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===t.value)return"value: multiple values";if(t.value=1,!(Ms.isInteger(e.asInt)||e.asInt&&Ms.isInteger(e.asInt.low)&&Ms.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}return null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Ms.isString(e.spanId))?"spanId: buffer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Ms.isString(e.traceId))?"traceId: buffer expected":null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.metrics.v1.Exemplar)return e;var t=new Vs.opentelemetry.proto.metrics.v1.Exemplar;if(e.filteredAttributes){if(!Array.isArray(e.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");t.filteredAttributes=[];for(var r=0;r<e.filteredAttributes.length;++r){if("object"!=typeof e.filteredAttributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");t.filteredAttributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.filteredAttributes[r])}}return null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(Ms.Long?(t.asInt=Ms.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new Ms.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),null!=e.spanId&&("string"==typeof e.spanId?Ms.base64.decode(e.spanId,t.spanId=Ms.newBuffer(Ms.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceId&&("string"==typeof e.traceId?Ms.base64.decode(e.traceId,t.traceId=Ms.newBuffer(Ms.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.filteredAttributes=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Ms.newBuffer(n.spanId))),t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Ms.newBuffer(n.traceId)))),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Ms.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Ms.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?Ms.Long.prototype.toString.call(e.asInt):t.longs===Number?new Ms.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.filteredAttributes&&e.filteredAttributes.length){n.filteredAttributes=[];for(var o=0;o<e.filteredAttributes.length;++o)n.filteredAttributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.filteredAttributes[o],t)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Exemplar"},o),r),n;function o(e){if(this.filteredAttributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.quantileValues=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.bucketCounts=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function p(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function h(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function d(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function f(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function m(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function g(e){if(this.metadata=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function y(e){if(this.metrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function _(e){if(this.scopeMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function v(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Us.logs=(()=>{var e,t,r,n={};return n.v1=((r={}).LogsData=(a.prototype.resourceLogs=Ms.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ds.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)Vs.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.logs.v1.LogsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(Vs.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=Vs.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},a.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.logs.v1.LogsData)return e;var t=new Vs.opentelemetry.proto.logs.v1.LogsData;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");t.resourceLogs[r]=Vs.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=Vs.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogsData"},a),r.ResourceLogs=(i.prototype.resource=null,i.prototype.scopeLogs=Ms.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ds.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Vs.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeLogs&&e.scopeLogs.length)for(var r=0;r<e.scopeLogs.length;++r)Vs.opentelemetry.proto.logs.v1.ScopeLogs.encode(e.scopeLogs[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Vs.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeLogs&&o.scopeLogs.length||(o.scopeLogs=[]),o.scopeLogs.push(Vs.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Vs.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeLogs&&e.hasOwnProperty("scopeLogs")){if(!Array.isArray(e.scopeLogs))return"scopeLogs: array expected";for(var t,r=0;r<e.scopeLogs.length;++r)if(t=Vs.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[r]))return"scopeLogs."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.logs.v1.ResourceLogs)return e;var t=new Vs.opentelemetry.proto.logs.v1.ResourceLogs;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");t.resource=Vs.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeLogs){if(!Array.isArray(e.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");t.scopeLogs=[];for(var r=0;r<e.scopeLogs.length;++r){if("object"!=typeof e.scopeLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");t.scopeLogs[r]=Vs.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeLogs=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Vs.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeLogs&&e.scopeLogs.length){r.scopeLogs=[];for(var n=0;n<e.scopeLogs.length;++n)r.scopeLogs[n]=Vs.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ResourceLogs"},i),r.ScopeLogs=(s.prototype.scope=null,s.prototype.logRecords=Ms.emptyArray,s.prototype.schemaUrl=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ds.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Vs.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.logRecords&&e.logRecords.length)for(var r=0;r<e.logRecords.length;++r)Vs.opentelemetry.proto.logs.v1.LogRecord.encode(e.logRecords[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.logRecords&&o.logRecords.length||(o.logRecords=[]),o.logRecords.push(Vs.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Vs.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.logRecords&&e.hasOwnProperty("logRecords")){if(!Array.isArray(e.logRecords))return"logRecords: array expected";for(var t,r=0;r<e.logRecords.length;++r)if(t=Vs.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[r]))return"logRecords."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Ms.isString(e.schemaUrl)?"schemaUrl: string expected":null},s.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.logs.v1.ScopeLogs)return e;var t=new Vs.opentelemetry.proto.logs.v1.ScopeLogs;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");t.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.logRecords){if(!Array.isArray(e.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");t.logRecords=[];for(var r=0;r<e.logRecords.length;++r){if("object"!=typeof e.logRecords[r])throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");t.logRecords[r]=Vs.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},s.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.logRecords=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Vs.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.logRecords&&e.logRecords.length){r.logRecords=[];for(var n=0;n<e.logRecords.length;++n)r.logRecords[n]=Vs.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ScopeLogs"},s),r.SeverityNumber=(e={},(t=Object.create(e))[e[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,t[e[1]="SEVERITY_NUMBER_TRACE"]=1,t[e[2]="SEVERITY_NUMBER_TRACE2"]=2,t[e[3]="SEVERITY_NUMBER_TRACE3"]=3,t[e[4]="SEVERITY_NUMBER_TRACE4"]=4,t[e[5]="SEVERITY_NUMBER_DEBUG"]=5,t[e[6]="SEVERITY_NUMBER_DEBUG2"]=6,t[e[7]="SEVERITY_NUMBER_DEBUG3"]=7,t[e[8]="SEVERITY_NUMBER_DEBUG4"]=8,t[e[9]="SEVERITY_NUMBER_INFO"]=9,t[e[10]="SEVERITY_NUMBER_INFO2"]=10,t[e[11]="SEVERITY_NUMBER_INFO3"]=11,t[e[12]="SEVERITY_NUMBER_INFO4"]=12,t[e[13]="SEVERITY_NUMBER_WARN"]=13,t[e[14]="SEVERITY_NUMBER_WARN2"]=14,t[e[15]="SEVERITY_NUMBER_WARN3"]=15,t[e[16]="SEVERITY_NUMBER_WARN4"]=16,t[e[17]="SEVERITY_NUMBER_ERROR"]=17,t[e[18]="SEVERITY_NUMBER_ERROR2"]=18,t[e[19]="SEVERITY_NUMBER_ERROR3"]=19,t[e[20]="SEVERITY_NUMBER_ERROR4"]=20,t[e[21]="SEVERITY_NUMBER_FATAL"]=21,t[e[22]="SEVERITY_NUMBER_FATAL2"]=22,t[e[23]="SEVERITY_NUMBER_FATAL3"]=23,t[e[24]="SEVERITY_NUMBER_FATAL4"]=24,t),r.LogRecordFlags=(e={},(t=Object.create(e))[e[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,t[e[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,t),r.LogRecord=(o.prototype.timeUnixNano=null,o.prototype.observedTimeUnixNano=null,o.prototype.severityNumber=null,o.prototype.severityText=null,o.prototype.body=null,o.prototype.attributes=Ms.emptyArray,o.prototype.droppedAttributesCount=null,o.prototype.flags=null,o.prototype.traceId=null,o.prototype.spanId=null,o.prototype.eventName=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ds.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.severityNumber&&Object.hasOwnProperty.call(e,"severityNumber")&&t.uint32(16).int32(e.severityNumber),null!=e.severityText&&Object.hasOwnProperty.call(e,"severityText")&&t.uint32(26).string(e.severityText),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&Vs.opentelemetry.proto.common.v1.AnyValue.encode(e.body,t.uint32(42).fork()).ldelim(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Vs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(50).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(56).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(69).fixed32(e.flags),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(74).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(82).bytes(e.spanId),null!=e.observedTimeUnixNano&&Object.hasOwnProperty.call(e,"observedTimeUnixNano")&&t.uint32(89).fixed64(e.observedTimeUnixNano),null!=e.eventName&&Object.hasOwnProperty.call(e,"eventName")&&t.uint32(98).string(e.eventName),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof js||(e=js.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Vs.opentelemetry.proto.logs.v1.LogRecord;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 11:o.observedTimeUnixNano=e.fixed64();break;case 2:o.severityNumber=e.int32();break;case 3:o.severityText=e.string();break;case 5:o.body=Vs.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;case 6:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Vs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 7:o.droppedAttributesCount=e.uint32();break;case 8:o.flags=e.fixed32();break;case 9:o.traceId=e.bytes();break;case 10:o.spanId=e.bytes();break;case 12:o.eventName=e.string();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof js||(e=new js(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Ms.isInteger(e.timeUnixNano)||e.timeUnixNano&&Ms.isInteger(e.timeUnixNano.low)&&Ms.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&!(Ms.isInteger(e.observedTimeUnixNano)||e.observedTimeUnixNano&&Ms.isInteger(e.observedTimeUnixNano.low)&&Ms.isInteger(e.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(null!=e.severityNumber&&e.hasOwnProperty("severityNumber"))switch(e.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:}if(null!=e.severityText&&e.hasOwnProperty("severityText")&&!Ms.isString(e.severityText))return"severityText: string expected";if(null!=e.body&&e.hasOwnProperty("body")&&(t=Vs.opentelemetry.proto.common.v1.AnyValue.verify(e.body)))return"body."+t;if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t,r=0;r<e.attributes.length;++r)if(t=Vs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[r]))return"attributes."+t}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Ms.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!Ms.isInteger(e.flags)?"flags: integer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Ms.isString(e.traceId))?"traceId: buffer expected":null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Ms.isString(e.spanId))?"spanId: buffer expected":null!=e.eventName&&e.hasOwnProperty("eventName")&&!Ms.isString(e.eventName)?"eventName: string expected":null},o.fromObject=function(e){if(e instanceof Vs.opentelemetry.proto.logs.v1.LogRecord)return e;var t=new Vs.opentelemetry.proto.logs.v1.LogRecord;switch(null!=e.timeUnixNano&&(Ms.Long?(t.timeUnixNano=Ms.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.observedTimeUnixNano&&(Ms.Long?(t.observedTimeUnixNano=Ms.Long.fromValue(e.observedTimeUnixNano)).unsigned=!1:"string"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=parseInt(e.observedTimeUnixNano,10):"number"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=e.observedTimeUnixNano:"object"==typeof e.observedTimeUnixNano&&(t.observedTimeUnixNano=new Ms.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber())),e.severityNumber){default:"number"==typeof e.severityNumber&&(t.severityNumber=e.severityNumber);break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:t.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:t.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:t.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:t.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:t.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:t.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:t.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:t.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:t.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:t.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:t.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:t.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:t.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:t.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:t.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:t.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:t.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:t.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:t.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:t.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:t.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:t.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:t.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:t.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:t.severityNumber=24}if(null!=e.severityText&&(t.severityText=String(e.severityText)),null!=e.body){if("object"!=typeof e.body)throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");t.body=Vs.opentelemetry.proto.common.v1.AnyValue.fromObject(e.body)}if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");t.attributes[r]=Vs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.traceId&&("string"==typeof e.traceId?Ms.base64.decode(e.traceId,t.traceId=Ms.newBuffer(Ms.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Ms.base64.decode(e.spanId,t.spanId=Ms.newBuffer(Ms.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.eventName&&(t.eventName=String(e.eventName)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(Ms.Long?(r=new Ms.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.severityNumber=t.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,n.severityText="",n.body=null,n.droppedAttributesCount=0,n.flags=0,t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Ms.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Ms.newBuffer(n.spanId))),Ms.Long?(r=new Ms.Long(0,0,!1),n.observedTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.observedTimeUnixNano=t.longs===String?"0":0,n.eventName=""),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Ms.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.severityNumber&&e.hasOwnProperty("severityNumber")&&(n.severityNumber=t.enums!==String||void 0===Vs.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]?e.severityNumber:Vs.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]),null!=e.severityText&&e.hasOwnProperty("severityText")&&(n.severityText=e.severityText),null!=e.body&&e.hasOwnProperty("body")&&(n.body=Vs.opentelemetry.proto.common.v1.AnyValue.toObject(e.body,t)),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Vs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Ms.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Ms.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&("number"==typeof e.observedTimeUnixNano?n.observedTimeUnixNano=t.longs===String?String(e.observedTimeUnixNano):e.observedTimeUnixNano:n.observedTimeUnixNano=t.longs===String?Ms.Long.prototype.toString.call(e.observedTimeUnixNano):t.longs===Number?new Ms.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),null!=e.eventName&&e.hasOwnProperty("eventName")&&(n.eventName=e.eventName),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ls.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogRecord"},o),r),n;function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.logRecords=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.scopeLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Us),ks),Vs);function Fs(e){return 48<=e&&e<=57?e-48:97<=e&&e<=102?e-87:e-55}function qs(t){var r=new Uint8Array(t.length/2);let n=0;for(let e=0;e<t.length;e+=2){var o=Fs(t.charCodeAt(e)),s=Fs(t.charCodeAt(e+1));r[n++]=o<<4|s}return r}function Hs(e){var t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Gs(e){return e=Hs(e),{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}let zs="undefined"!=typeof BigInt?function(e){return Hs(e).toString()}:function(e){return e[0]*Mo+e[1]};function Ks(e){return e}function Ys(e){if(void 0!==e)return qs(e)}let Ws={encodeHrTime:Gs,encodeSpanContext:qs,encodeOptionalSpanContext:Ys};function $s(e){var t;return void 0===e?Ws:(t=e.useLongBits??!0,e=e.useHex??!1,{encodeHrTime:t?Gs:zs,encodeSpanContext:e?Ks:qs,encodeOptionalSpanContext:e?Ks:Ys})}function Js(e){var t={attributes:Qs(e.attributes),droppedAttributesCount:0},e=e.schemaUrl;return e&&""!==e&&(t.schemaUrl=e),t}function Xs(e){return{name:e.name,version:e.version}}function Qs(t){return Object.keys(t).map(e=>Zs(e,t[e]))}function Zs(e,t){return{key:e,value:ea(t)}}function ea(e){var t=typeof e;return"string"==t?{stringValue:e}:"number"==t?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:"boolean"==t?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(ea)}}:"object"==t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>Zs(e,t))}}:{}}function ta(e,r){e=(e=>{var i,a=new Map;for(i of e){let{resource:e,instrumentationScope:{name:t,version:r="",schemaUrl:n=""}}=i,o=a.get(e);o||(o=new Map,a.set(e,o));var u=t+`@${r}:`+n;let s=o.get(u);s||(s=[],o.set(u,s)),s.push(i)}return a})(e);return Array.from(e,([e,t])=>{e=Js(e);return{resource:e,scopeLogs:Array.from(t,([,e])=>({scope:Xs(e[0].instrumentationScope),logRecords:e.map(e=>{return e=e,{timeUnixNano:(t=r).encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:ea(e.body),eventName:e.eventName,attributes:ra(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)};var t}),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:e.schemaUrl}})}function ra(t){return Object.keys(t).map(e=>Zs(e,t[e]))}Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,(e=>{e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(na=na||{}),(e=>{e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(oa=oa||{}),(e=>{e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(ia=ia||{}),(e=>{e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(sa=sa||{});let aa=1023,ua=aa,la=Math.pow(2,-1022);function ca(e){var t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((2146435072&t.getUint32(0))>>20)-aa}function pa(e){var t=new DataView(new ArrayBuffer(8)),e=(t.setFloat64(0,e),t.getUint32(0)),t=t.getUint32(4);return(1048575&e)*Math.pow(2,32)+t}function da(e,t){return 0===e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}class ha extends Error{}class fa{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<la?this._minNormalLowerBoundaryIndex():ca(e)+this._rightShift(pa(e)-1,52)>>this._shift}lowerBoundary(e){var t=this._minNormalLowerBoundaryIndex();if(e<t)throw new ha(`underflow: ${e} is < minimum lower boundary: `+t);t=this._maxNormalLowerBoundaryIndex();if(t<e)throw new ha(`overflow: ${e} is > maximum lower boundary: `+t);return da(1,e<<this._shift)}get scale(){return 0===this._shift?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=-1022>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return ua>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}}class ma{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=da(Math.LOG2E,e),this._inverseFactor=da(Math.LN2,-e)}mapToIndex(e){var t;return e<=la?this._minNormalLowerBoundaryIndex()-1:0===pa(e)?(ca(e)<<this._scale)-1:(e=Math.floor(Math.log(e)*this._scaleFactor),(t=this._maxNormalLowerBoundaryIndex())<=e?t:e)}lowerBoundary(e){var t=this._maxNormalLowerBoundaryIndex();if(t<=e){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new ha(`overflow: ${e} is > maximum lower boundary: `+t)}t=this._minNormalLowerBoundaryIndex();if(e<=t){if(e===t)return la;if(e===t-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new ha(`overflow: ${e} is < minimum lower boundary: `+t)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}Array.from({length:31},(e,t)=>new(10<t?ma:fa)(t-10)),(e=>{e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(ga=ga||{});let ya=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class _a{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new _a({},t);return t._rawAttributes=ba(e),t._asyncAttributesPending=0<e.filter(([,e])=>ya(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(ya(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ba(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void to.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,ya(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&to.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)ya(t)?to.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void to.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,_a.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function va(){return e={[No]:"unknown_service",[Io]:jo[Io],[Uo]:jo[Uo],[ko]:jo[ko]},_a.FromAttributeList(Object.entries(e),void 0);var e}function ba(e){return e.map(([t,e])=>ya(e)?[t,e.catch(e=>{to.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}function Sa(e,t){let r=255&e|256;return t&&(r|=512),r}function wa(e,r){var t=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?r.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:r.encodeSpanContext(t.traceId),spanId:r.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:r.encodeHrTime(e.startTime),endTimeUnixNano:r.encodeHrTime(e.endTime),attributes:Qs(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>{return t=r,{attributes:(e=e).attributes?Qs(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0};var t}),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(e=>{return t=r,{attributes:(e=e).attributes?Qs(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Sa(e.context.traceFlags,e.context.isRemote)};var t}),droppedLinksCount:e.droppedLinksCount,flags:Sa(t.traceFlags,e.parentSpanContext?.isRemote)}}function Ea(e,s){let t=(e=>{var r,n=new Map;for(r of e){let e=n.get(r.resource);e||(e=new Map,n.set(r.resource,e));var o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:`+(r.instrumentationScope.schemaUrl||"");let t=e.get(o);t||(t=[],e.set(o,t)),t.push(r)}return n})(e),i=[],a=t.entries(),u=a.next();for(;!u.done;){let[e,t]=u.value,r=[],n=t.values(),o=n.next();for(;!o.done;){let t=o.value;if(0<t.length){let e=t.map(e=>wa(e,s));r.push({scope:Xs(t[0].instrumentationScope),spans:e,schemaUrl:t[0].instrumentationScope.schemaUrl})}o=n.next()}var l=Js(e),l={resource:l,scopeSpans:r,schemaUrl:l.schemaUrl};i.push(l),u=a.next()}return i}(e=>{e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Ta=Ta||{}),Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;let Aa={serializeRequest:e=>{e={resourceLogs:ta(e,$s({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}},Oa={serializeRequest:e=>{e={resourceSpans:Ea(e,$s({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}};function xa(){return.4*Math.random()-.2}class Ca{_transport;constructor(e){this._transport=e}retry(r,n,o){return new Promise((e,t)=>{setTimeout(()=>{this._transport.send(r,n).then(e,t)},o)})}async send(t,e){var r=Date.now()+e;let n=await this._transport.send(t,e),o=5,s=1e3;for(;"retryable"===n.status&&0<o;){o--;let e=Math.max(Math.min(s,5e3)+xa(),0);s*=1.5;var i=n.retryInMillis??e,a=r-Date.now();if(a<i)return n;n=await this.retry(t,a,i)}return n}shutdown(){return this._transport.shutdown()}}function Ra(e){return new Ca(e.transport)}function Na(e){return[429,502,503,504].includes(e)}function Ia(e){var t;if(null!=e)return t=Number.parseInt(e,10),Number.isInteger(t)?0<t?1e3*t:-1:0<=(t=new Date(e).getTime()-Date.now())?t:0}class Pa{_parameters;constructor(e){this._parameters=e}async send(e,n){let o=await this._parameters.headers();return new Promise(t=>{let r=new XMLHttpRequest;r.timeout=n,r.open("POST",this._parameters.url),Object.entries(o).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{t({status:"failure",error:new Error("XHR request timed out")})},r.onreadystatechange=()=>{200<=r.status&&r.status<=299?(to.debug("XHR success"),t({status:"success"})):r.status&&Na(r.status)?t({status:"retryable",retryInMillis:Ia(r.getResponseHeader("Retry-After"))}):0!==r.status&&t({status:"failure",error:new Error("XHR request failed with non-retryable status")})},r.onabort=()=>{t({status:"failure",error:new Error("XHR request aborted")})},r.onerror=()=>{t({status:"failure",error:new Error("XHR request errored")})},r.send(e)})}shutdown(){}}class Ua{_params;constructor(e){this._params=e}async send(t){let r=(await this._params.headers())["Content-Type"];return new Promise(e=>{navigator.sendBeacon(this._params.url,new Blob([t],{type:r}))?(to.debug("SendBeacon success"),e({status:"success"})):e({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}class ka{_parameters;constructor(e){this._parameters=e}async send(n,e){let o=new AbortController,t=setTimeout(()=>o.abort(),e);try{let e=!!globalThis.location,t=new URL(this._parameters.url),r=await fetch(t.href,{method:"POST",headers:await this._parameters.headers(),body:n,signal:o.signal,keepalive:e,mode:e?globalThis.location?.origin===t.origin?"same-origin":"cors":"no-cors"});if(200<=r.status&&r.status<=299)return to.debug("response success"),{status:"success"};if(Na(r.status)){let e=r.headers.get("Retry-After");return{status:"retryable",retryInMillis:Ia(e)}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(n){return"AbortError"===n?.name?{status:"failure",error:new Error("Fetch request timed out",{cause:n})}:{status:"failure",error:new Error("Fetch request errored",{cause:n})}}finally{clearTimeout(t)}}shutdown(){}}function La(e,t){return mi(e,t,Ra({transport:(t=e,new Pa(t))}))}function ja(e,t){return mi(e,t,Ra({transport:(t=e,new ka(t))}))}function Da(e,t){return mi(e,t,Ra({transport:(t={url:e.url,headers:e.headers},new Ua(t))}))}function Ma(r,n,o){return async()=>{var e={...await o()},t={};return null!=n&&Object.assign(t,await n()),null!=r&&Object.assign(t,(e=>{let r={};return Object.entries(e??{}).forEach(([e,t])=>{void 0!==t?r[e]=String(t):to.warn(`Header "${e}" has invalid value (${t}) and will be ignored`)}),r})(await r())),Object.assign(t,e)}}function Va(e){if(null!=e)try{var t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Ba(e){var t;return"function"==typeof e.headers?e.headers:null!=(t=e.headers)?async()=>t:void 0}function Fa(e,t,r){return e={url:e.url,timeoutMillis:e.timeoutMillis,headers:Ba(e),concurrencyLimit:e.concurrencyLimit},n=r,{...cr(e,r={},t={timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>n,url:"http://localhost:4318/"+t}),headers:Ma(e.headers,r.headers,t.headers),url:Va(e.url)??r.url??t.url};var n}function qa(e,t,r,n){return(e.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?ja:La:Da)(Fa(e,r,n),t)}var Ha,Ga=Object.freeze({__proto__:null,OTLPLogExporter:class extends ar{constructor(e={}){super(qa(e,Aa,"v1/logs",{"Content-Type":"application/json"}))}}}),za=r(Ga);(e=>{e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(Ha=Ha||{});class Ka{emit(e){}}let Ya=new Ka,Wa=new class{getLogger(e,t,r){return new Ka}};class $a{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}emit(e){this._getLogger().emit(e)}_getLogger(){var e;return this._delegate||((e=this._provider._getDelegateLogger(this.name,this.version,this.options))?(this._delegate=e,this._delegate):Ya)}}class Ja{getLogger(e,t,r){var n;return null!=(n=this._getDelegateLogger(e,t,r))?n:new $a(this,e,t,r)}_getDelegate(){var e;return null!=(e=this._delegate)?e:Wa}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getLogger(e,t,r)}}let Xa="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof $?$:{},Qa=Symbol.for("io.opentelemetry.js.api.logs"),Za=Xa;class eu{constructor(){this._proxyLoggerProvider=new Ja}static getInstance(){return this._instance||(this._instance=new eu),this._instance}setGlobalLoggerProvider(e){return Za[Qa]?this.getLoggerProvider():(Za[Qa]=(t=e,r=Wa,e=>1===e?t:r),this._proxyLoggerProvider._setDelegate(e),e);var t,r}getLoggerProvider(){var e;return null!=(e=null==(e=Za[Qa])?void 0:e.call(Za,1))?e:this._proxyLoggerProvider}getLogger(e,t,r){return this.getLoggerProvider().getLogger(e,t,r)}disable(){delete Za[Qa],this._proxyLoggerProvider=new Ja}}let tu=eu.getInstance();var ru=r(Object.freeze({__proto__:null,logs:tu,get SeverityNumber(){return Ha},NOOP_LOGGER:Ya,NoopLogger:Ka,ProxyLoggerProvider:Ja}));class nu{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,r){var{timestamp:r,observedTimestamp:n,eventName:o,severityNumber:s,severityText:i,body:a,attributes:u={},context:l}=r,c=Date.now();if(this.hrTime=qo(r??c),this.hrTimeObserved=qo(n??c),l){let e=vo.getSpanContext(l);e&&Mn(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=i,this.body=a,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=o,this.setAttributes(u)}setAttribute(e,t){return this._isLogRecordReadonly()||null===t||(0===e.length?to.warn("Invalid attribute key: "+e):wo(t)||"object"==typeof t&&!Array.isArray(t)&&0<Object.keys(t).length?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?1===this.droppedAttributesCount&&to.warn("Dropping extra attributes."):wo(t)?this.attributes[e]=this._truncateToSize(t):this.attributes[e]=t):to.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var[t,r]of Object.entries(e))this.setAttribute(t,r);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;return t<=0?(to.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&to.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class ou{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){var t=e.context||eo.active(),e=new nu(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.activeProcessor.onEmit(e,t),e._makeReadonly()}}class iu{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}class su{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(e=>li(e.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(e=>e.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}class au{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,t,r,n){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,0<(this.processors=n).length?(this.registeredLogRecordProcessors=n,this.activeProcessor=new su(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new iu}}class uu{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new pi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(to.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[],n=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<n;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedLogRecords.length?Promise.resolve():new Promise((e,t)=>{li(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(t)})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,0<this._finishedLogRecords.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Oo(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){var t=()=>di._export(this._exporter,e).then(e=>{e.code!==Ho.SUCCESS&&Oo(e.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(Oo),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return 0===r.length?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,Oo)}}var Lu,Wu,lu=Object.freeze({__proto__:null,LoggerProvider:class{_shutdownOnce;_sharedState;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=ri(t,e.shift(),0,r);return t})([{},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},e]),r=e.resource??va();this._sharedState=new au(r,t.forceFlushTimeoutMillis,{attributeCountLimit:(r=t.logRecordLimits).attributeCountLimit??128,attributeValueLengthLimit:r.attributeValueLengthLimit??1/0},e?.processors??[]),this._shutdownOnce=new pi(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return to.warn("A shutdown LoggerProvider cannot provide a Logger"),Ya;e||to.warn("Logger requested without instrumentation scope name.");var e=e||"unknown",n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._sharedState.loggers.has(n)||this._sharedState.loggers.set(n,new ou({name:e,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(n)}forceFlush(){return this._shutdownOnce.isCalled?(to.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(to.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},ConsoleLogRecordExporter:class{export(e,t){this._sendLogRecords(e,t)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:1e6*(t=e.hrTime)[0]+t[1]/1e3,traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes};var t}_sendLogRecords(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});e?.({code:Ho.SUCCESS})}},SimpleLogRecordProcessor:class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new pi(this._shutdown,this),this._unresolvedExports=new Set}onEmit(r){if(!this._shutdownOnce.isCalled){let t=()=>di._export(this._exporter,[r]).then(e=>{e.code!==Ho.SUCCESS&&Oo(e.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(Oo);if(r.resource.asyncAttributesPending){let e=r.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(e),t()),Oo);null!=e&&this._unresolvedExports.add(e)}else t()}}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},InMemoryLogRecordExporter:class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Ho.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:Ho.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}},BatchLogRecordProcessor:class extends uu{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}_onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}}}),cu=r(lu);let pu=Mr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function du(e){return e.setValue(pu,!0)}function hu(e){return!0===e.getValue(pu)}let fu="baggage";class mu{inject(e,r,n){var o=go.getBaggage(e);if(o&&!hu(e)){let e=o.getAllEntries().map(([e,t])=>{let r=encodeURIComponent(e)+"="+encodeURIComponent(t.value);return void 0!==t.metadata&&(r+=";"+t.metadata.toString()),r}).filter(e=>e.length<=4096).slice(0,180),t=e.reduce((e,t)=>{t=e+(""!==e?",":"")+t;return 8192<t.length?e:t},"");0<t.length&&n.set(r,fu,t)}}extract(e,t,r){r=r.get(t,fu),t=Array.isArray(r)?r.join(","):r;if(!t)return e;let n={};return 0===t.length||(t.split(",").forEach(e=>{var t=(n=>{if(n){var o=n.indexOf(";"),s=-1===o?n:n.substring(0,o),e=s.indexOf("=");if(!(e<=0)){var i=s.substring(0,e).trim(),s=s.substring(e+1).trim();if(i&&s){let e,t,r;try{e=decodeURIComponent(i),t=decodeURIComponent(s)}catch{return}return-1!==o&&o<n.length-1&&(r=Dr(n.substring(o+1))),{key:e,value:t,metadata:r}}}}})(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),n[t.key]=e}}),0===Object.entries(n).length)?e:go.setBaggage(e,go.createBaggage(n))}fields(){return[fu]}}function gu(e){var t,r={};if("object"==typeof e&&null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(yu(n)?_u(t=e[n])?Array.isArray(t)?r[n]=t.slice():r[n]=t:to.warn("Invalid attribute value set for key: "+n):to.warn("Invalid attribute key: "+n));return r}function yu(e){return"string"==typeof e&&""!==e}function _u(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!vu(e))return!1;t=e}}return!0})(e):vu(typeof e))}function vu(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let bu=e=>{var t;to.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function Tu(e){try{bu(e)}catch{}}let Su="process.runtime.name",wu={[Uo]:"opentelemetry",[Su]:"browser",[Io]:Po,[ko]:"2.7.1"},Eu=performance,Au=Math.pow(10,6),Ou=Math.pow(10,9);function xu(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Au)]}function Cu(e){return ku(xu(Eu.timeOrigin),xu("number"==typeof e?e:Eu.now()))}function Ru(e){if(Pu(e))return e;if("number"==typeof e)return(e<Eu.timeOrigin?Cu:xu)(e);if(e instanceof Date)return xu(e.getTime());throw TypeError("Invalid input type")}function Nu(e){return e[0]*Ou+e[1]}function Iu(e){return 1e6*e[0]+e[1]/1e3}function Pu(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Uu(e){return Pu(e)||"number"==typeof e||e instanceof Date}function ku(e,t){e=[e[0]+t[0],e[1]+t[1]];return e[1]>=Ou&&(e[1]-=Ou,e[0]+=1),e}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Lu=Lu||{});class ju{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];var t=new Set;for(let e of this._propagators){var r="function"==typeof e.fields?e.fields():[];for(let e of r)t.add(e)}this._fields=Array.from(t)}inject(e,t,r){for(var n of this._propagators)try{n.inject(e,t,r)}catch(e){to.warn(`Failed to inject with ${n.constructor.name}. Err: `+e.message)}}extract(e,r,n){return this._propagators.reduce((e,t)=>{try{return t.extract(e,r,n)}catch(e){to.warn(`Failed to extract with ${t.constructor.name}. Err: `+e.message)}return e},e)}fields(){return this._fields.slice()}}let Du="[_0-9a-z-*/]",Mu=new RegExp(`^(?:${`[a-z]${Du}{0,255}`}|${`[a-z0-9]${Du}{0,240}@[a-z]${Du}{0,13}`})$`),Vu=/^[ -~]{0,255}[!-~]$/,Bu=/,|=/;function Fu(e){return Mu.test(e)}function qu(e){return Vu.test(e)&&!Bu.test(e)}class Hu{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState="string"==typeof e?e:"",this._length=this._rawTraceState.length}set(e,t){var r,n,o;return!Fu(e)||!qu(t)||(o=(r=this._getState()).get(e),n=this._length,512<(n+="string"==typeof o?t.length-o.length:e.length+t.length+(0<r.size?2:1)))?this:((o=new Map(r)).delete(e),o.set(e,t),this._fromState(o,n))}unset(e){var t=this._getState(),r=t.get(e);if("string"!=typeof r)return this;let n=this._length-(e.length+r.length+1);1<t.size&&--n;r=new Map(t);return r.delete(e),this._fromState(r,n)}get(e){return this._getState().get(e)}serialize(){let e="",t=0;for(var r of this._getState())0<t&&(e=","+e),e=r[0]+"="+r[1]+e,t++;return e}_getState(){if(!this._internalState){let e=this._rawTraceState.split(","),r=new Map,n=0;for(var o of e){let e=o.trim(),t=e.indexOf("=");if(-1!==t){var o=e.slice(0,t),s=e.slice(t+1);if(Fu(o)&&qu(s)){var i=n+e.length+(0<r.size?1:0);if(!(512<i)&&(r.set(o,s),n=i,32<=r.size))break}}}this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse())}return this._internalState}_fromState(e,t){var r=Object.create(Hu.prototype);return r._internalState=e,r._length=t,r}}let Gu="traceparent",zu="tracestate",Ku=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class Yu{inject(e,t,r){var n=vo.getSpanContext(e);n&&!hu(e)&&Mn(n)&&(e=`00-${n.traceId}-${n.spanId}-0`+Number(n.traceFlags||dn.NONE).toString(16),r.set(t,Gu,e),n.traceState)&&r.set(t,zu,n.traceState.serialize())}extract(e,t,r){var n=r.get(t,Gu);if(!n)return e;n=Array.isArray(n)?n[0]:n;if("string"!=typeof n)return e;n=(e=>!(e=Ku.exec(e))||"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)})(n);if(!n)return e;n.isRemote=!0;r=r.get(t,zu);if(r){let e=Array.isArray(r)?r.join(","):r;n.traceState=new Hu("string"==typeof e?e:void 0)}return vo.setSpanContext(e,n)}fields(){return[Gu,zu]}}(Wu=Wu||{}).HTTP="http";let $u="[object Null]",Ju="[object Undefined]",Xu=Function.prototype.toString,Qu=Xu.call(Object),Zu=Object.getPrototypeOf,el=Object.prototype,tl=el.hasOwnProperty,rl=Symbol?Symbol.toStringTag:void 0,nl=el.toString;function ol(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?Ju:$u;if(rl&&rl in Object(t)){var r=t,n=tl.call(r,rl),o=r[rl];let e=!1;try{r[rl]=void 0,e=!0}catch{}var s=nl.call(r);return e&&(n?r[rl]=o:delete r[rl]),s}return n=t,nl.call(n)})(e)&&(null===(e=Zu(e))||"function"==typeof(e=tl.call(e,"constructor")&&e.constructor)&&e instanceof e&&Xu.call(e)===Qu)}function il(e){return ul(e)?e.slice():e}function sl(r,n,o=0,s){let i;if(!(20<o)){if(o++,pl(r)||pl(n)||ll(n))i=il(n);else if(ul(r)){if(i=r.slice(),ul(n))for(let e=0,t=n.length;e<t;e++)i.push(il(n[e]));else if(cl(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(i[e]=il(n[e]))}}}else if(cl(r))if(cl(n)){if(e=n,!ol(r)||!ol(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e];if("__proto__"!==u&&"constructor"!==u&&"prototype"!==u){var l=n[u];if(pl(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(al(r,u,s)||al(n,u,s))delete i[u];else{if(cl(c)&&cl(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=sl(i[u],l,o,s)}}}}}else i=n;return i}var e}function al(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function ul(e){return Array.isArray(e)}function ll(e){return"function"==typeof e}function cl(e){return!pl(e)&&!ul(e)&&!ll(e)&&"object"==typeof e}function pl(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class dl{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class hl{_isCalled=!1;_deferred=new dl;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}wr.ALL,wr.VERBOSE,wr.DEBUG,wr.INFO,wr.WARN,wr.ERROR,wr.NONE;let fl={_export:function(t,r){return new Promise(e=>{eo.with(du(eo.active()),()=>{t.export(r,e)})})}},ml;function gl(){if(void 0===ml)try{var e=globalThis.process.argv0;ml=e?"unknown_service:"+e:"unknown_service"}catch{ml="unknown_service"}return ml}let yl=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class _l{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new _l({},t);return t._rawAttributes=Sl(e),t._asyncAttributesPending=0<e.filter(([,e])=>yl(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(yl(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Sl(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void to.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,yl(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&to.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)yl(t)?to.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void to.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,_l.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function vl(e,t){return _l.FromAttributeList(Object.entries(e),t)}function bl(){return vl({})}function Tl(){return vl({[No]:gl(),[Io]:wu[Io],[Uo]:wu[Uo],[ko]:wu[ko]})}function Sl(e){return e.map(([t,e])=>yl(e)?[t,e.catch(e=>{to.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}let wl=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let o={},t=e.split(this._COMMA_SEPARATOR).filter(e=>""!==e.trim());for(let n of t){let e=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(2!==e.length)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);var[s,i]=e,s=s.trim(),i=i.trim();if(0===s.length)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let t,r;try{t=decodeURIComponent(s),r=decodeURIComponent(i)}catch(o){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": `+(o instanceof Error?o.message:o))}if(t.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${t}".`);if(r.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${t}".`);o[t]=r}return o}},El=new class{detect(){return{attributes:{}}}},Al=El,Ol=El,xl=El,Cl=El;var id,sd,Rd,Rl=Object.freeze({__proto__:null,detectResources:(n={})=>(n.detectors||[]).map(t=>{try{r=t.detect(n);var e=new _l(r,void 0);return to.debug(t.constructor.name+" found resource.",e),e}catch(e){return to.debug(t.constructor.name+" failed: "+e.message),bl()}var r}).reduce((e,t)=>e.merge(t),bl()),envDetector:wl,hostDetector:Al,osDetector:Ol,processDetector:xl,serviceInstanceIdDetector:Cl,resourceFromAttributes:vl,defaultResource:Tl,emptyResource:bl,defaultServiceName:gl}),Nl=r(Rl),Il={exports:{}},Pl=(Il.exports=e,sr.inspect),Ul=za.OTLPLogExporter,kl=ru,Ll=cu.LoggerProvider,jl=cu.BatchLogRecordProcessor,Dl=Nl,Ml=Il.exports,Vl=B(),Bl=n,Fl="tccc",ql="https://otlp.tccc.qcloud.com/v1/logs",Hl=Vl.newUUID(),Gl=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Pl.apply(void 0,t.concat([{compact:!0,breakLength:1/0}])).slice(1,-1).replace(/((\\r|\\n)\\n(\\n)?)/g,"\n")},zl=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=y({url:e.url||ql,headers:{"X-Tps-TenantID":e.tenantId||Fl},attributes:{}},e);return new Ll({resource:Dl.defaultResource().merge(Dl.resourceFromAttributes(y({"tps.tenant.id":e.tenantId||Fl,"service.name":"JsSIP","service.version":Bl.version},t))),processors:[new jl(new Ul(r))]}).getLogger("JsSIP",Bl.version)},Kl={provider:zl({tenantId:Fl,url:ql}),attributes:{uuid:Hl,"trtc.version":Ml.VERSION}},Yl=(Ae.setConfig=function(e){Kl.provider=zl(e)},Ae.setAttributes=function(e){Kl.attributes=Object.assign(Kl.attributes,e)},{DEBUG:{severityNumber:kl.SeverityNumber.DEBUG,severityText:"debug"},INFO:{severityNumber:kl.SeverityNumber.INFO,severityText:"info"},WARN:{severityNumber:kl.SeverityNumber.WARN,severityText:"warn"},ERROR:{severityNumber:kl.SeverityNumber.ERROR,severityText:"error"}}),Wl=(Ae.log=function(e,t,r){for(var n=arguments.length,o=new Array(3<n?n-3:0),s=3;s<n;s++)o[s-3]=arguments[s];Kl.provider.emit(y(y({},Yl[(null==t?void 0:t.toUpperCase())||"DEBUG"]),{},{attributes:y(y({},Vl.toPlainObject(r)),Vl.toPlainObject(Kl.attributes)),body:"".concat(e||""," ").concat(Gl.apply(void 0,o))}))},Se.exports),$l=i,Jl=Ae,Xl="TCCCSIP",Ql=(()=>{function s(e){u(this,s),e?(this._debug=Wl.default("".concat(Xl,":").concat(e)),this._warn=Wl.default("".concat(Xl,":WARN:").concat(e)),this._error=Wl.default("".concat(Xl,":ERROR:").concat(e)),this.prefix=e):(this._debug=Wl.default(Xl),this._warn=Wl.default("".concat(Xl,":WARN")),this._error=Wl.default("".concat(Xl,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}return c(s,[{key:"debug",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["debug"].concat(t)),!(s._logLevel>$l.LOG_LEVEL.DEBUG))return n._debug.apply(n,t)}}},{key:"warn",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["warn"].concat(t)),!(s._logLevel>$l.LOG_LEVEL.WARN))return n._warn.apply(n,t)}}},{key:"error",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["error"].concat(t)),!(s._logLevel>$l.LOG_LEVEL.ERROR))return n._error.apply(n,t)}}},{key:"report",value:function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(s._log_report){var o={};try{0<r.length&&"object"===T(r[r.length-1])&&(Object.assign(o,r[r.length-1]),r=r.slice(0,-1))}catch(e){}Jl.log.apply(Jl,[this.prefix,e,o].concat(v(r)))}}}],[{key:"setLogLevel",value:function(e){s._logLevel=e}},{key:"setLogReport",value:function(e){s._log_report=e}},{key:"setConfig",value:function(e){Jl.setConfig(e)}},{key:"setAttributes",value:function(e){Jl.setAttributes(e)}}])})(),Zl=(Ql.setLogLevel($l.LOG_LEVEL.TRACE),Ql.setLogReport(!0),Ql),ec={},tc={},rc={exports:{}},nc=rc.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s",t=(t+=null!=e.raddr?" raddr %s rport %d":"%v%v")+(null!=e.tcptype?" tcptype %s":"%v");return null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value)&&(t+=":%s"),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return(t=(t+=null!=e.id?"id=%s %s":"%v%s")+(null!=e.mediaClockValue?"=%s":"")+(null!=e.rateNumerator?" rate=%s":""))+(null!=e.rateDenominator?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]},oc=(Object.keys(nc).forEach(function(e){nc[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),(e=>{function f(e){return String(Number(e))===e?Number(e):e}function t(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=f(r[1]):1===r.length&&1<t.length&&(e[r[0]]=void 0),e}var m=rc.exports,r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},h=[],d=t;return e.split(/(\r\n|\r|\n)/).filter(r).forEach(function(e){var t=e[0],r=e.slice(2);"m"===t&&(h.push({rtp:[],fmtp:[]}),d=h[h.length-1]);for(var n=0;n<(m[t]||[]).length;n+=1){var o=m[t][n];if(o.reg.test(r)){var s=d;var i=r;var a=o.name&&o.names,a=(o.push&&!s[o.push]?s[o.push]=[]:a&&!s[o.name]&&(s[o.name]={}),o.push?{}:a?s[o.name]:s),u=i.match(o.reg),l=a,c=o.names;if((i=o.name)&&!c)l[i]=f(u[1]);else for(var p=0;p<c.length;p+=1)null!=u[p+1]&&(l[c[p]]=f(u[p+1]));o.push&&s[o.push].push(a);return}}}),t.media=h,t},e.parseParams=function(e){return e.split(/;\s?/).reduce(t,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(f),n=0;n<r.length;n+=3)t.push({component:r[n],ip:r[n+1],port:r[n+2]});return t},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(t,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=f(e):(t=f(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}})(tc),rc.exports),ic=/%[sdv%]/g,sc=function(e){var r=1,n=arguments,o=n.length;return e.replace(ic,function(e){if(o<=r)return e;var t=n[r];switch(r+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},ac=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var o=0;o<t.names.length;o+=1){var s=t.names[o];n.push(t.name?r[t.name][s]:r[t.names[o]])}else n.push(r[t.name]);return sc.apply(null,n)},uc=["v","o","s","i","u","e","p","c","b","t","r","z","a"],lc=["i","c","b","a"],cc=tc,pc=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var r=t.outerOrder||uc,n=t.innerOrder||lc,o=[];return r.forEach(function(r){oc[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(ac(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(ac(r,t,e))})})}),e.media.forEach(function(e){o.push(ac("m",oc.m[0],e)),n.forEach(function(r){oc[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(ac(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(ac(r,t,e))})})})}),o.join("\r\n")+"\r\n"},dc=rc.exports,hc=(ec.grammar=dc,ec.write=pc,ec.parse=cc.parse,ec.parseParams=cc.parseParams,ec.parseFmtpConfig=cc.parseFmtpConfig,ec.parsePayloads=cc.parsePayloads,ec.parseRemoteCandidates=cc.parseRemoteCandidates,ec.parseImageAttributes=cc.parseImageAttributes,ec.parseSimulcastStreamList=cc.parseSimulcastStreamList,ec),fc=Zl,mc=i,gc=B(),yc=D(),_c=M(),vc=new fc("SIPMessage"),bc=(()=>{function i(e,t,r,n,o,s){if(u(this,i),!e||!t||!r)return null;n=n||{},this.ua=r,this.headers={},this.method=e,this.ruri=t,this.body=s,this.extraHeaders=gc.cloneArray(o),this.ua.configuration.extra_headers&&(this.extraHeaders=this.extraHeaders.concat(this.ua.configuration.extra_headers)),n.route_set?this.setHeader("route",n.route_set):r.configuration.use_preloaded_route&&this.setHeader("route","<".concat(r.transport.sip_uri,";lr>")),this.setHeader("via",""),this.setHeader("max-forwards",mc.MAX_FORWARDS);s=n.to_uri||t,o=n.to_tag?{tag:n.to_tag}:null,t=void 0!==n.to_display_name?n.to_display_name:null;this.to=new yc(s,t,o),this.setHeader("to",this.to.toString());s=n.from_uri||r.configuration.uri,t={tag:n.from_tag||gc.newTag()},o=void 0!==n.from_display_name?n.from_display_name:r.configuration.display_name||null,this.from=new yc(s,o,t),this.setHeader("from",this.from.toString()),s=n.call_id||r.configuration.jssip_id+gc.createRandomToken(15),this.call_id=s,this.setHeader("call-id",s),o=n.cseq||Math.floor(1e4*Math.random());this.cseq=o,this.setHeader("cseq","".concat(o," ").concat(e))}return c(i,[{key:"setHeader",value:function(e,t){for(var r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=0;n<this.extraHeaders.length;n++)r.test(this.extraHeaders[n])&&this.extraHeaders.splice(n,1);this.headers[gc.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[gc.headerize(e)];if(t){if(t[0])return t[0]}else{var r,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),o=p(this.extraHeaders);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(n.test(s))return s.substring(s.indexOf(":")+1).trim()}}catch(e){o.e(e)}finally{o.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[gc.headerize(e)],r=[];if(t){var n,o=p(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value)}catch(e){o.e(e)}finally{o.f()}}else{var s,i=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),a=p(this.extraHeaders);try{for(a.s();!(s=a.n()).done;){var u=s.value;i.test(u)&&r.push(u.substring(u.indexOf(":")+1).trim())}}catch(e){a.e(e)}finally{a.f()}}return r}},{key:"hasHeader",value:function(e){if(this.headers[gc.headerize(e)])return!0;var t,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=p(this.extraHeaders);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(r.test(o))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=hc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){var e,t="".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n");for(e in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,e)){var r,n=p(this.headers[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;t+="".concat(e,": ").concat(o,"\r\n")}}catch(t){n.e(t)}finally{n.f()}}var s,i=p(this.extraHeaders);try{for(i.s();!(s=i.n()).done;){var a=s.value;t+="".concat(a.trim(),"\r\n")}}catch(t){i.e(t)}finally{i.f()}var u=[];switch(this.method){case mc.REGISTER:u.push("path","gruu");break;case mc.INVITE:this.ua.configuration.session_timers&&u.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&u.push("gruu"),u.push("ice","replaces");break;case mc.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||mc.USER_AGENT;return t=(t=(t+="Allow: ".concat(mc.ALLOWED_METHODS,"\r\n"))+"Supported: ".concat(u,"\r\n"))+"User-Agent: ".concat(l,"\r\n"),this.body?(l=gc.str_utf8_length(this.body),t=(t+="Content-Length: ".concat(l,"\r\n\r\n"))+this.body):t+="Content-Length: 0\r\n\r\n",t}},{key:"clone",value:function(){var t=new i(this.method,this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=gc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}])})(),Tc=(()=>{function s(e,t,r,n,o){return u(this,s),(e=a(this,s,[mc.INVITE,e,t,r,n,o])).transaction=null,e}return f(s,bc),c(s,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var t=new s(this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=gc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t.transaction=this.transaction,t}}])})(),Sc=c(function e(){u(this,e),this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null},[{key:"addHeader",value:function(e,t){t={raw:t};e=gc.headerize(e),this.headers[e]?this.headers[e].push(t):this.headers[e]=[t]}},{key:"getHeader",value:function(e){e=this.headers[gc.headerize(e)];return e&&e[0]?e[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[gc.headerize(e)],r=[];if(!t)return[];var n,o=p(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value.raw)}catch(e){o.e(e)}finally{o.f()}return r}},{key:"hasHeader",value:function(e){return!!this.headers[gc.headerize(e)]}},{key:"parseHeader",value:function(e){var t,r,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(e=gc.headerize(e),this.headers[e]){if(!(o>=this.headers[e].length))return r=(t=this.headers[e][o]).raw,t.parsed||(-1===(n=_c.parse(r,e.replace(/-/g,"_")))?(this.headers[e].splice(o,1),void vc.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):t.parsed=n);vc.debug('not so many "'.concat(e,'" headers present'))}else vc.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){t={raw:t};this.headers[gc.headerize(e)]=[t]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=hc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),wc=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).ua=e,t.headers={},t.ruri=null,t.transport=null,t.server_transaction=null,t}return f(r,Sc),c(r,[{key:"reply",value:function(e,t,r,n,o,s){var i=[],a=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||699<e)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||mc.REASON_PHRASE[e]||"",r=gc.cloneArray(r),this.ua.configuration.extra_headers&&(r=r.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===mc.INVITE&&100<e&&e<=200){var l,c=p(this.getHeaders("record-route"));try{for(c.s();!(l=c.n()).done;)u+="Record-Route: ".concat(l.value,"\r\n")}catch(e){c.e(e)}finally{c.f()}}var h,d=p(this.getHeaders("via"));try{for(d.s();!(h=d.n()).done;)u+="Via: ".concat(h.value,"\r\n")}catch(e){d.e(e)}finally{d.f()}!this.to_tag&&100<e?a+=";tag=".concat(gc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),u=(u=(u=(u+="To: ".concat(a,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var f,m=p(r);try{for(m.s();!(f=m.n()).done;){var g=f.value;u+="".concat(g.trim(),"\r\n")}}catch(e){m.e(e)}finally{m.f()}switch(this.method){case mc.INVITE:this.ua.configuration.session_timers&&i.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&i.push("gruu"),i.push("ice","replaces");break;case mc.UPDATE:this.ua.configuration.session_timers&&i.push("timer"),n&&i.push("ice"),i.push("replaces")}i.push("outbound"),this.method===mc.OPTIONS?u=(u+="Allow: ".concat(mc.ALLOWED_METHODS,"\r\n"))+"Accept: ".concat(mc.ACCEPTED_BODY_TYPES,"\r\n"):405===e?u+="Allow: ".concat(mc.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(mc.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(i,"\r\n"),n?(t=gc.str_utf8_length(n),u=(u+="Content-Type: application/sdp\r\n")+"Content-Length: ".concat(t,"\r\n\r\n")+n):u+="Content-Length: ".concat(0,"\r\n\r\n"),this.server_transaction.receiveResponse(e,u,o,s)}},{key:"reply_sl",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this.getHeaders("via");if(!e||e<100||699<e)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));var n,t=t||mc.REASON_PHRASE[e]||"",o="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),s=p(r);try{for(s.s();!(n=s.n()).done;)o+="Via: ".concat(n.value,"\r\n")}catch(e){s.e(e)}finally{s.f()}t=this.getHeader("To");if(!this.to_tag&&100<e?t+=";tag=".concat(gc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(t+=";tag=".concat(this.to_tag)),o=(o=(o=(o+="To: ".concat(t,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var i,a=p(this.ua.configuration.extra_headers);try{for(a.s();!(i=a.n()).done;){var u=i.value;o+="".concat(u.trim(),"\r\n")}}catch(e){a.e(e)}finally{a.f()}}o+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(o)}}])})(),Ec={OutgoingRequest:bc,InitialOutgoingInviteRequest:Tc,IncomingRequest:wc,IncomingResponse:(()=>{function t(){var e;return u(this,t),(e=a(this,t)).headers={},e.status_code=null,e.reason_phrase=null,e}return f(t,Sc),c(t)})()},Ac=Zl,Oc=B(),xc=new Ac("DigestAuthentication"),Cc=c(function e(t){u(this,e),this._credentials=t,this._cnonce=null,this._nc=0,this._ncHex="00000000",this._algorithm=null,this._realm=null,this._nonce=null,this._opaque=null,this._stale=null,this._qop=null,this._method=null,this._uri=null,this._ha1=null,this._response=null},[{key:"get",value:function(e){switch(e){case"realm":return this._realm;case"ha1":return this._ha1;default:return void xc.warn('get() | cannot get "%s" parameter',e)}}},{key:"authenticate",value:function(e,t){var r=e.method,n=e.ruri,e=e.body,o=2<arguments.length&&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 xc.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return xc.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return xc.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return xc.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return xc.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(-1<t.qop.indexOf("auth-int"))this._qop="auth-int";else{if(!(-1<t.qop.indexOf("auth")))return xc.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=r,this._uri=n,this._cnonce=o||Oc.createRandomToken(12),this._nc+=1;var s,i,t=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-t.length)+t,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=Oc.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),i=Oc.calculateMD5(s),xc.debug('authenticate() | using qop=auth [a2:"%s"]',s),this._response=Oc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(i))):"auth-int"===this._qop?(s="".concat(this._method,":").concat(this._uri,":").concat(Oc.calculateMD5(e||"")),i=Oc.calculateMD5(s),xc.debug('authenticate() | using qop=auth-int [a2:"%s"]',s),this._response=Oc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(i))):null===this._qop&&(s="".concat(this._method,":").concat(this._uri),i=Oc.calculateMD5(s),xc.debug('authenticate() | using qop=null [a2:"%s"]',s),this._response=Oc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(i))),xc.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(this._response)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(", "));throw new Error("response field does not exist, cannot generate Authorization header")}}]),Rc=500,Nc={T1:Rc,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},Ic=W.EventEmitter,Pc=Zl,Uc=i,kc=Ec,Lc=Nc,jc=new Pc("NonInviteClientTransaction"),Dc=new Pc("InviteClientTransaction"),Mc=new Pc("AckClientTransaction"),Vc=new Pc("NonInviteServerTransaction"),Bc=new Pc("InviteServerTransaction"),Fc={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"},qc=(()=>{function s(e,t,r,n){u(this,s),(o=a(this,s)).type=Fc.NON_INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o.ua.newTransaction(o),o}return f(s,Ic),c(s,[{key:"C",get:function(){return Fc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(Fc.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},Lc.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){jc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){jc.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(r<200)switch(this.state){case Fc.STATUS_TRYING:case Fc.STATUS_PROCEEDING:this.stateChanged(Fc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case Fc.STATUS_TRYING:case Fc.STATUS_PROCEEDING:this.stateChanged(Fc.STATUS_COMPLETED),clearTimeout(this.F),408===r?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},Lc.TIMER_K)}}}])})(),Hc=(()=>{function s(e,t,r,n){u(this,s),(o=a(this,s)).type=Fc.INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n,r.transaction=o;var o,n="SIP/2.0/".concat(t.via_transport);return n+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",n),o.ua.newTransaction(o),o}return f(s,Ic),c(s,[{key:"C",get:function(){return Fc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(Fc.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},Lc.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==Fc.STATUS_ACCEPTED&&(Dc.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){Dc.debug("Timer M expired for transaction ".concat(this.id)),this.state===Fc.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){Dc.debug("Timer B expired for transaction ".concat(this.id)),this.state===Fc.STATUS_CALLING&&(this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){Dc.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,r=new kc.OutgoingRequest(Uc.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});r.setHeader("from",this.request.getHeader("from")),r.setHeader("via",this.request.getHeader("via")),r.setHeader("to",e.getHeader("to")),this.D=setTimeout(function(){t.timer_D()},Lc.TIMER_D),this.transport.send(r)}},{key:"cancel",value:function(e){var t;this.state===Fc.STATUS_PROCEEDING&&((t=new kc.OutgoingRequest(Uc.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq})).setHeader("from",this.request.getHeader("from")),t.setHeader("via",this.request.getHeader("via")),t.setHeader("to",this.request.getHeader("to")),e&&t.setHeader("reason",e),this.transport.send(t))}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(100<=r&&r<=199)switch(this.state){case Fc.STATUS_CALLING:this.stateChanged(Fc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case Fc.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(200<=r&&r<=299)switch(this.state){case Fc.STATUS_CALLING:case Fc.STATUS_PROCEEDING:this.stateChanged(Fc.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},Lc.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case Fc.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(300<=r&&r<=699)switch(this.state){case Fc.STATUS_CALLING:case Fc.STATUS_PROCEEDING:this.stateChanged(Fc.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case Fc.STATUS_COMPLETED:this.sendACK(e)}}}])})(),Gc=(()=>{function s(e,t,r,n){u(this,s),(o=a(this,s)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o}return f(s,Ic),c(s,[{key:"C",get:function(){return Fc}},{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Mc.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}}])})(),zc=(()=>{function o(e,t,r){var n;return u(this,o),(n=a(this,o)).type=Fc.NON_INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=Fc.STATUS_TRYING,e.newTransaction(n),n}return f(o,Ic),c(o,[{key:"C",get:function(){return Fc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){Vc.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Vc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100===e)switch(this.state){case Fc.STATUS_TRYING:this.stateChanged(Fc.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case Fc.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else if(200<=e&&e<=699)switch(this.state){case Fc.STATUS_TRYING:case Fc.STATUS_PROCEEDING:this.stateChanged(Fc.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){o.timer_J()},Lc.TIMER_J),this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}}}])})(),Kc=(()=>{function o(e,t,r){var n;return u(this,o),(n=a(this,o)).type=Fc.INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=Fc.STATUS_PROCEEDING,e.newTransaction(n),n.resendProvisionalTimer=null,r.reply(100),n}return f(o,Ic),c(o,[{key:"C",get:function(){return Fc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){Bc.debug("Timer H expired for transaction ".concat(this.id)),this.state===Fc.STATUS_COMPLETED&&Bc.debug("ACK not received, dialog will be terminated"),this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){Bc.debug("Timer L expired for transaction ".concat(this.id)),this.state===Fc.STATUS_ACCEPTED&&(this.stateChanged(Fc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Bc.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(Fc.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,r,n){var o=this;if(100<=e&&e<=199&&this.state===Fc.STATUS_PROCEEDING&&(this.transport.send(t)||this.onTransportError(),this.last_response=t),100<e&&e<=199&&this.state===Fc.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){o.resend_provisional()},Lc.PROVISIONAL_RESPONSE_INTERVAL));else if(200<=e&&e<=299)switch(this.state){case Fc.STATUS_PROCEEDING:this.stateChanged(Fc.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){o.timer_L()},Lc.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case Fc.STATUS_ACCEPTED:this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else 300<=e&&e<=699&&this.state===Fc.STATUS_PROCEEDING&&(null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(Fc.STATUS_COMPLETED),this.H=setTimeout(function(){o.timer_H()},Lc.TIMER_H),r&&r()):(this.onTransportError(),n&&n()))}}])})(),Yc={C:Fc,NonInviteClientTransaction:qc,InviteClientTransaction:Hc,AckClientTransaction:Gc,NonInviteServerTransaction:zc,InviteServerTransaction:Kc,checkTransaction:function(e,t){var r,n=e._transactions;switch(t.method){case Uc.INVITE:if(r=n.ist[t.via_branch])return r.state===Fc.STATUS_PROCEEDING&&r.transport.send(r.last_response),!0;break;case Uc.ACK:if(!(r=n.ist[t.via_branch]))return!1;if(r.state===Fc.STATUS_ACCEPTED)return!1;if(r.state===Fc.STATUS_COMPLETED)return r.state=Fc.STATUS_CONFIRMED,r.I=setTimeout(function(){r.timer_I()},Lc.TIMER_I),!0;break;case Uc.CANCEL:return(r=n.ist[t.via_branch])?(t.reply_sl(200),r.state!==Fc.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(r=n.nist[t.via_branch]){switch(r.state){case Fc.STATUS_TRYING:break;case Fc.STATUS_PROCEEDING:case Fc.STATUS_COMPLETED:r.transport.send(r.last_response)}return!0}}}},Wc=i,$c=Cc,Jc=Yc,Xc=new Zl("RequestSender"),Qc={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},Zc=c(function e(t,r,n){for(var o in u(this,e),this._ua=t,this._eventHandlers=n,this._method=r.method,this._request=r,this._auth=null,this._challenged=!1,this._staled=!1,Qc)!Object.prototype.hasOwnProperty.call(Qc,o)||this._eventHandlers[o]||(this._eventHandlers[o]=Qc[o]);t.status!==t.C.STATUS_USER_CLOSED||this._method===Wc.BYE&&this._method===Wc.ACK||this._eventHandlers.onTransportError()},[{key:"send",value:function(){var t=this,e={onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onReceiveResponse:function(e){t._receiveResponse(e)}};switch(this._method){case"INVITE":this.clientTransaction=new Jc.InviteClientTransaction(this._ua,this._ua.transport,this._request,e);break;case"ACK":this.clientTransaction=new Jc.AckClientTransaction(this._ua,this._ua.transport,this._request,e);break;default:this.clientTransaction=new Jc.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,e)}this._ua._configuration.authorization_jwt&&this._request.setHeader("Authorization",this._ua._configuration.authorization_jwt),this.clientTransaction.send()}},{key:"_receiveResponse",value:function(e){var t,r=e.status_code;401!==r&&407!==r||null===this._ua.configuration.password&&null===this._ua.configuration.ha1?this._eventHandlers.onReceiveResponse(e):(r=401===e.status_code?(t=e.parseHeader("www-authenticate"),"authorization"):(t=e.parseHeader("proxy-authenticate"),"proxy-authorization"),t?(!this._challenged||!this._staled&&!0===t.stale)&&(this._auth||(this._auth=new $c({username:this._ua.configuration.authorization_user,password:this._ua.configuration.password,realm:this._ua.configuration.realm,ha1:this._ua.configuration.ha1})),this._auth.authenticate(this._request,t))?(this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),t.stale&&(this._staled=!0),this._request=this._request.clone(),this._request.cseq+=1,this._request.setHeader("cseq","".concat(this._request.cseq," ").concat(this._method)),this._request.setHeader(r,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send()):this._eventHandlers.onReceiveResponse(e):(Xc.debug("".concat(e.status_code," with wrong or missing challenge, cannot authenticate")),this._eventHandlers.onReceiveResponse(e)))}}]),ep=Zl,tp=B(),rp=i,np=Ec,op=Zc,ip=new ep("Registrator"),sp=c(function e(t,r){u(this,e),this._reg_id=1,this._ua=t,this._transport=r,this._registrar=t.configuration.registrar_server,this._expires=t.configuration.register_expires,this._call_id=tp.createRandomToken(22),this._cseq=0,this._to_uri=t.configuration.uri,this._registrationTimer=null,this._registering=!1,this._registered=!1,this._contact=this._ua.contact.toString(),this._contact+=";+sip.ice",this._extraHeaders=[],this._extraContactParams="",this._sipInstance='"<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance),this._ua.configuration.use_trtc&&(this._contact+=";trtc")},[{key:"registered",get:function(){return this._registered}},{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){var r;Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t],this._extraContactParams+=";".concat(t),r)&&(this._extraContactParams+="=".concat(r))}}},{key:"register",value:function(){var e,n=this;this._registering?ip.debug("Register request in progress..."):((e=this._extraHeaders.slice()).push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),e.push("Expires: ".concat(this._expires)),this._ua.configuration.use_trtc&&e.push("X-TRTC: 1"),e=new np.OutgoingRequest(rp.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),e=new op(this._ua,e,{onRequestTimeout:function(){n._registrationFailure(null,rp.causes.REQUEST_TIMEOUT)},onTransportError:function(){n._registrationFailure(null,rp.causes.CONNECTION_ERROR)},onAuthenticated:function(){n._cseq+=1},onReceiveResponse:function(e){if(e.cseq===n._cseq)switch(null!==n._registrationTimer&&(clearTimeout(n._registrationTimer),n._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):var t;(n._registering=!1,e.hasHeader("Contact"))?(t=(t=(r=e.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[])).find(function(e){return n._sipInstance===e.getParam("+sip.instance")&&n._reg_id===parseInt(e.getParam("reg-id"))}))||r.find(function(e){return e.uri.user===n._ua.contact.uri.user}))?(r=(r=!(r=t.getParam("expires"))&&e.hasHeader("expires")?e.getHeader("expires"):r)||n._expires,r=64<(r=(r=Number(r))<10?10:r)?1e3*r/2+Math.floor(1e3*(r/2-32)*Math.random()):1e3*r-5e3,n._registrationTimer=setTimeout(function(){n._registrationTimer=null,0===n._ua.listeners("registrationExpiring").length?n.register():n._ua.emit("registrationExpiring")},r),t.hasParam("temp-gruu")&&(n._ua.contact.temp_gruu=t.getParam("temp-gruu").replace(/"/g,"")),t.hasParam("pub-gruu")&&(n._ua.contact.pub_gruu=t.getParam("pub-gruu").replace(/"/g,"")),n._registered||(n._registered=!0,n._ua.registered({response:e}))):ip.debug("no Contact header pointing to us, response ignored"):ip.debug("no Contact header in response to REGISTER, response ignored");break;case/^423$/.test(e.status_code):e.hasHeader("min-expires")?(n._expires=Number(e.getHeader("min-expires")),n._expires<10&&(n._expires=10),n.register()):(ip.debug("423 response received for REGISTER without Min-Expires"),n._registrationFailure(e,rp.causes.SIP_FAILURE_CODE));break;default:var r=tp.sipErrorCause(e.status_code);n._registrationFailure(e,r)}}}),this._registering=!0,e.send())}},{key:"unregister",value:function(){var e,r=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this._registered?(this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),e=this._extraHeaders.slice(),t.all?e.push("Contact: *".concat(this._extraContactParams)):e.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),e.push("Expires: 0"),t=new np.OutgoingRequest(rp.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),new op(this._ua,t,{onRequestTimeout:function(){r._unregistered(null,rp.causes.REQUEST_TIMEOUT)},onTransportError:function(){r._unregistered(null,rp.causes.CONNECTION_ERROR)},onAuthenticated:function(){r._cseq+=1},onReceiveResponse:function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):r._unregistered(e);break;default:var t=tp.sipErrorCause(e.status_code);r._unregistered(e,t)}}}).send()):ip.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})}}]),ap=r(To),up=i,lp=Yc,cp=Zc,pp={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}},dp=Zl,hp=Ec,fp=i,mp=Yc,gp=c(function e(t,r,n){for(var o in u(this,e),this._dialog=t,this._ua=t._ua,this._request=r,this._eventHandlers=n,this._reattempt=!1,this._reattemptTimer=null,pp)!Object.prototype.hasOwnProperty.call(pp,o)||this._eventHandlers[o]||(this._eventHandlers[o]=pp[o])},[{key:"request",get:function(){return this._request}},{key:"send",value:function(){var e,t=this,r=new cp(this._ua,this._request,{onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onAuthenticated:function(e){t._eventHandlers.onAuthenticated(e)},onReceiveResponse:function(e){t._receiveResponse(e)}});r.send(),(this._request.method===up.INVITE||this._request.method===up.UPDATE&&this._request.body)&&r.clientTransaction.state!==lp.C.STATUS_TERMINATED&&(this._dialog.uac_pending_reply=!0,e=function(){r.clientTransaction.state!==lp.C.STATUS_ACCEPTED&&r.clientTransaction.state!==lp.C.STATUS_COMPLETED&&r.clientTransaction.state!==lp.C.STATUS_TERMINATED||(r.clientTransaction.removeListener("stateChanged",e),t._dialog.uac_pending_reply=!1)},r.clientTransaction.on("stateChanged",e))}},{key:"_receiveResponse",value:function(e){var t=this;408===e.status_code||481===e.status_code?this._eventHandlers.onDialogError(e):e.method!==up.INVITE||491!==e.status_code||this._reattempt?200<=e.status_code&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):300<=e.status_code&&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))}}]),yp=B(),_p=new dp("Dialog"),vp={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},bp=c(function e(t,r,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:vp.STATUS_CONFIRMED;if(u(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!r.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};r instanceof hp.IncomingResponse&&(o=r.status_code<200?vp.STATUS_EARLY:vp.STATUS_CONFIRMED);t=r.parseHeader("contact");"UAS"===n?(this._id={call_id:r.call_id,local_tag:r.to_tag,remote_tag:r.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._remote_seqnum=r.cseq,this._local_uri=r.parseHeader("to").uri,this._remote_uri=r.parseHeader("from").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===n&&(this._id={call_id:r.call_id,local_tag:r.from_tag,remote_tag:r.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._local_seqnum=r.cseq,this._local_uri=r.parseHeader("from").uri,this._remote_uri=r.parseHeader("to").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),_p.debug("new ".concat(n," dialog created with status ").concat(this._state===vp.STATUS_EARLY?"EARLY":"CONFIRMED"))},[{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}},{key:"isTerminated",value:function(){return this._status===vp.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=vp.STATUS_CONFIRMED,_p.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){_p.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=vp.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=yp.cloneArray(r.extraHeaders),o=yp.cloneObject(r.eventHandlers),r=r.body||null,e=this._createRequest(e,n,r);return o.onAuthenticated=function(){t._local_seqnum+=1},new gp(this,e,o).send(),e}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===fp.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===fp.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,r){t=yp.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var n=e===fp.CANCEL||e===fp.ACK?this._local_seqnum:this._local_seqnum+=1;return new hp.OutgoingRequest(e,this._remote_target,this._ua,{cseq:n,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,r)}},{key:"_checkInDialogRequest",value:function(e){var t,r=this;if(this._remote_seqnum)if(e.cseq<this._remote_seqnum){if(e.method!==fp.ACK)return e.reply(500),!1;if(null===this._ack_seqnum||e.cseq!==this._ack_seqnum)return!1}else e.cseq>this._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===fp.INVITE||e.method===fp.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply)return t=1+(10*Math.random()|0),e.reply(500,null,["Retry-After:".concat(t)]),!1;this._uas_pending_reply=!0;var n=function(){e.server_transaction.state!==mp.C.STATUS_ACCEPTED&&e.server_transaction.state!==mp.C.STATUS_COMPLETED&&e.server_transaction.state!==mp.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),r._uas_pending_reply=!1)};e.server_transaction.on("stateChanged",n)}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===mp.C.STATUS_ACCEPTED&&(r._remote_target=e.parseHeader("contact").uri)})}else e.method===fp.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===mp.C.STATUS_COMPLETED&&(r._remote_target=e.parseHeader("contact").uri)});return!0}}],[{key:"C",get:function(){return vp}}]),Tp={exports:{}},Sp=W.EventEmitter,wp=Zl,Ep=i,Ap=L,Op=B(),xp=new wp("RTCSession:DTMF"),Cp={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500},Rp=(Tp.exports=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._session=e,t._direction=null,t._tone=null,t._duration=null,t._request=null,t}return f(r,Sp),c(r,[{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}},{key:"send",value:function(e){var t=this,r=1<arguments.length&&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 Ap.InvalidStateError(this._session.status);var n=Op.cloneArray(r.extraHeaders);if(this.eventHandlers=Op.cloneObject(r.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=r.duration,n.push("Content-Type: application/dtmf-relay");e="Signal=".concat(this._tone,"\r\n");e+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(Ep.INFO,{extraHeaders:n,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:e})}},{key:"init_incoming",value:function(e){var t,r=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this._direction="incoming",(this._request=e).reply(200),e.body&&(1<=(t=e.body.split("\n")).length&&r.test(t[0])&&(this._tone=t[0].replace(r,"$2")),2<=t.length)&&n.test(t[1])&&(this._duration=parseInt(t[1].replace(n,"$2"),10)),this._duration||(this._duration=Cp.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):xp.debug("invalid INFO DTMF received, discarded")}}])})(),Tp.exports.C=Cp,W.EventEmitter),Np=i,Ip=L,Pp=B(),Up=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._session=e,t._direction=null,t._contentType=null,t._body=null,t}return f(r,Rp),c(r,[{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&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 Ip.InvalidStateError(this._session.status);this._contentType=e,this._body=t;n=Pp.cloneArray(n.extraHeaders);n.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(Np.INFO,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){r.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){r.emit("failed",{originator:"remote",response:e})},onTransportError:function(){r._session.onTransportError()},onRequestTimeout:function(){r._session.onRequestTimeout()},onDialogError:function(){r._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",(this.request=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})}}])})(),kp=i,Lp=new Zl("RTCSession:ReferNotifier"),jp="refer",Dp="message/sipfrag;version=2.0",Mp=300,Vp=c(function e(t,r,n){u(this,e),this._session=t,this._id=r,this._expires=n||Mp,this._active=!0,this.notify(100)},[{key:"notify",value:function(e,t){var r;Lp.debug("notify()"),!1!==this._active&&(t=t||kp.REASON_PHRASE[e]||"",r=200<=e?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(kp.NOTIFY,{extraHeaders:["Event: ".concat(jp,";id=").concat(this._id),"Subscription-State: ".concat(r),"Content-Type: ".concat(Dp)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),Bp=W.EventEmitter,Fp=Zl,qp=i,Hp=M(),Gp=B(),zp=new Fp("RTCSession:ReferSubscriber"),Kp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._id=null,t._session=e,t}return f(r,Bp),c(r,[{key:"id",get:function(){return this._id}},{key:"sendRefer",value:function(e){var t,r=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=(zp.debug("sendRefer()"),Gp.cloneArray(n.extraHeaders)),s=Gp.cloneObject(n.eventHandlers);for(t in s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);var i=null,n=(n.replaces&&(i=n.replaces._request.call_id,i=(i+=";to-tag=".concat(n.replaces._to_tag))+";from-tag=".concat(n.replaces._from_tag),i=encodeURIComponent(i)),"Refer-To: <".concat(e).concat(i?"?Replaces=".concat(i):"",">")),i=(o.push(n),o.some(function(e){return e.toLowerCase().startsWith("referred-by:")})||(e="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">"),o.push(e)),o.push("Contact: ".concat(this._session.contact)),this._session.sendRequest(qp.REFER,{extraHeaders:o,eventHandlers:{onSuccessResponse:function(e){r._requestSucceeded(e)},onErrorResponse:function(e){r._requestFailed(e,qp.causes.REJECTED)},onTransportError:function(){r._requestFailed(null,qp.causes.CONNECTION_ERROR)},onRequestTimeout:function(){r._requestFailed(null,qp.causes.REQUEST_TIMEOUT)},onDialogError:function(){r._requestFailed(null,qp.causes.DIALOG_ERROR)}}}));this._id=i.cseq}},{key:"receiveNotify",value:function(e){if(zp.debug("receiveNotify()"),e.body){var t=Hp.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 zp.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){zp.debug("REFER succeeded"),zp.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){zp.debug("REFER failed"),zp.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}}])})(),Yp=W.EventEmitter,Wp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).audio=e.audio,t.video=e.video,t._mediaStream=e.mediaStream,t._player=null,t}return f(r,Yp),c(r,[{key:"mediaStream",get:function(){return this._mediaStream}},{key:"getMediaStream",value:function(){return this._mediaStream}},{key:"getAudioTrack",value:function(){if(this._mediaStream){var e=this._mediaStream.getAudioTracks();if(0<e.length)return e[0]}return null}},{key:"play",value:function(){}}])})(),$p=Wp,Jp=B(),Xp=(()=>{function t(e){return u(this,t),(e=a(this,t,[e])).type="local",e}return f(t,$p),c(t,[{key:"initialize",value:function(){var t=this;return navigator.mediaDevices.getUserMedia({audio:this.audio,video:this.video}).then(function(e){return t._mediaStream=e,t}).catch(function(e){throw e})}},{key:"close",value:function(){this._mediaStream&&Jp.closeMediaStream(this._mediaStream)}}])})(),Qp=Wp,Zp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r,[e]))._mediaStream=e.mediaStream,t.type="remote",t}return f(r,Qp),c(r)})(),ed="object"===("undefined"==typeof globalThis?"undefined":T(globalThis))?globalThis:"object"===("undefined"==typeof self?"undefined":T(self))?self:"object"===("undefined"==typeof window?"undefined":T(window))?window:"object"===T(t)?t:{},td={},rd=Object.freeze({__proto__:null,OTLPTraceExporter:class extends ar{constructor(e={}){super(qa(e,Oa,"v1/traces",{"Content-Type":"application/json"}))}}}),nd=r(rd);class od{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Gn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let e=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=Eu.now(),this._performanceOffset=e-(this._performanceStartTime+Eu.timeOrigin),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let e of t.links)this.addLink(e);this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(e,t){var r,n;return null==t||this._isSpanEnded()||(0===e.length?to.warn("Invalid attribute key: "+e):_u(t)?(r=this._spanLimits.attributeCountLimit,n=!Object.prototype.hasOwnProperty.call(this.attributes,e),void 0!==r&&this._attributesCount>=r&&n?this._droppedAttributesCount++:(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++)):to.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,o){if(!this._isSpanEnded()){var s=this._spanLimits.eventCountLimit;if(0===s)to.warn("No events allowed."),this._droppedEventsCount++;else{void 0!==s&&this.events.length>=s&&(0===this._droppedEventsCount&&to.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Uu(t)&&(Uu(o)||(o=t),t=void 0);var i=gu(t),a=this._spanLimits.attributePerEventCountLimit,u={};let r=0,n=0;for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let e=i[t];void 0!==a&&n>=a?r++:(u[t]=this._truncateToSize(e),n++)}this.events.push({name:e,attributes:u,time:this._getTime(o),droppedAttributesCount:r})}}return this}addLink(t){if(!this._isSpanEnded()){let e=this._spanLimits.linkCountLimit;if(0===e)this._droppedLinksCount++;else{void 0!==e&&this.links.length>=e&&(0===this._droppedLinksCount&&to.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);var o=this._spanLimits.attributePerLinkCountLimit,s=gu(t.attributes),i={};let r=0,n=0;for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)){let e=s[t];void 0!==o&&n>=o?r++:(i[t]=this._truncateToSize(e),n++)}t={context:t.context};0<n&&(t.attributes=i),0<r&&(t.droppedAttributesCount=r),this.links.push(t)}}return this}addLinks(e){for(var t of e)this.addLink(t);return this}setStatus(e){var t;return this._isSpanEnded()||e.code!==Gn.UNSET&&this.status.code!==Gn.OK&&(t={code:e.code},e.code===Gn.ERROR&&("string"==typeof e.message?t.message=e.message:null!=e.message&&to.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t),this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?to.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=((e,t)=>{let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(--r,n+=Ou),[r,n]})(this.startTime,this.endTime),this._duration[0]<0&&(to.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),0<this._droppedEventsCount&&to.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),0<this._droppedLinksCount&&to.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){return"number"==typeof e&&e<=Eu.now()?Cu(e+this._performanceOffset):"number"==typeof e?xu(e):e instanceof Date?xu(e.getTime()):Pu(e)?e:this._startTimeProvided?xu(Date.now()):(e=Eu.now()-this._performanceStartTime,ku(this.startTime,xu(e)))}isRecording(){return!1===this._ended}recordException(e,t){var r={};"string"==typeof e?r[Co]=e:e&&(e.code?r[Ro]=e.code.toString():e.name&&(r[Ro]=e.name),e.message&&(r[Co]=e.message),e.stack)&&(r["exception.stacktrace"]=e.stack),r[Ro]||r[Co]?this.addEvent("exception",r,t):to.warn("Failed to record an exception "+e)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){var e;return this._ended&&(e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),to.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)),this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(to.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}}(e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(id=id||{});class ad{shouldSample(){return{decision:id.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class ud{shouldSample(){return{decision:id.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class ld{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Tu(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new ud),this._remoteParentSampled=e.remoteParentSampled??new ud,this._remoteParentNotSampled=e.remoteParentNotSampled??new ad,this._localParentSampled=e.localParentSampled??new ud,this._localParentNotSampled=e.localParentNotSampled??new ad}shouldSample(e,t,r,n,o,s){var i=vo.getSpanContext(e);return(i&&Mn(i)?i.isRemote?i.traceFlags&dn.SAMPLED?this._remoteParentSampled:this._remoteParentNotSampled:i.traceFlags&dn.SAMPLED?this._localParentSampled:this._localParentNotSampled:this._root).shouldSample(e,t,r,n,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class cd{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(e,t){return{decision:jn(t)&&this._accumulate(t)<this._upperBound?id.RECORD_AND_SAMPLED:id.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return"number"!=typeof e||isNaN(e)?0:1<=e?1:e<=0?0:e}_accumulate(n){let e=0;for(let r=0;r<32;r+=8){let t=0;for(let e=0;e<8;e++){var o=n.charCodeAt(r+e);t=t<<4|(o<58?o-48:o<71?o-55:o-87)}e=(e^t)>>>0}return e}}function pd(){return{sampler:dd(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function dd(){var e=sd.ParentBasedAlwaysOn;switch(e){case sd.AlwaysOn:return new ud;case sd.AlwaysOff:return new ad;case sd.ParentBasedAlwaysOn:return new ld({root:new ud});case sd.ParentBasedAlwaysOff:return new ld({root:new ad});case sd.TraceIdRatio:return new cd(hd());case sd.ParentBasedTraceIdRatio:return new ld({root:new cd(hd())});default:return to.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${sd.ParentBasedAlwaysOn}".`),new ld({root:new ud})}}function hd(){return to.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1}(e=>{e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(sd=sd||{});let fd=1/0;class md{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize="number"==typeof t?.maxExportBatchSize?t.maxExportBatchSize:512,this._maxQueueSize="number"==typeof t?.maxQueueSize?t.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof t?.scheduledDelayMillis?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof t?.exportTimeoutMillis?t.exportTimeoutMillis:3e4,this._shutdownOnce=new hl(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(to.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||0!=(e.spanContext().traceFlags&dn.SAMPLED)&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(0===this._droppedSpansCount&&to.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++):(0<this._droppedSpansCount&&(to.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[];for(let e=0,t=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);e<t;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise((t,o)=>{let s=setTimeout(()=>{o(new Error("Timeout"))},this._exportTimeoutMillis);eo.with(du(eo.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);var e=()=>this._exporter.export(r,e=>{clearTimeout(s),e.code===Lu.SUCCESS?t():o(e.error??new Error("BatchSpanProcessor: span export failed"))});let n=null;for(let t=0,e=r.length;t<e;t++){let e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(n??=[]).push(e.resource.waitForAsyncAttributes())}null===n?e():Promise.all(n).then(e,e=>{Tu(e),o(e)})})})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,0<this._finishedSpans.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Tu(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class gd extends md{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch(e=>{Tu(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Tu(e)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}}let yd=new Uint8Array(16),_d=new Uint8Array(8),vd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bd(t){for(let e=0;e<t.length;e++)t[e]=256*Math.random()>>>0;for(let e=0;e<t.length;e++)if(0<t[e])return;t[t.length-1]=1}function Td(t){let r="";for(let e=0;e<t.length;e++)r+=vd[t[e]];return r}class Sd{generateTraceId(){return bd(yd),Td(yd)}generateSpanId(){return bd(_d),Td(_d)}}let wd="otel.span.parent.origin",Ed="otel.span.sampling_result";class Ad{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){var r=(()=>{switch(t){case id.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case id.RECORD:return"RECORD_ONLY";case id.NOT_RECORD:return"DROP"}})();if(this.startedSpans.add(1,{[wd]:Od(e),[Ed]:r}),t===id.NOT_RECORD)return()=>{};let n={[Ed]:r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}function Od(e){return e?e.isRemote?"remote":"local":"none"}class xd{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){i=t,o={sampler:dd()},s=pd(),(o=Object.assign({},s,o,i)).generalLimits=Object.assign({},s.generalLimits,i.generalLimits||{}),o.spanLimits=Object.assign({},s.spanLimits,i.spanLimits||{});var o,s=o,i=(this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=t.idGenerator||new Sd,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e,s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace","2.7.1"):pn());this._tracerMetrics=new Ad(i)}startSpan(e,t={},r=eo.active()){t.root&&(r=vo.deleteSpan(r));var n=vo.getSpan(r);if(hu(r))return to.debug("Instrumentation suppressed, returning Noop Span"),vo.wrapSpanContext(An);var n=n?.spanContext(),o=this._idGenerator.generateSpanId();let s,i,a;n&&vo.isSpanContextValid(n)?(i=n.traceId,a=n.traceState,s=n):i=this._idGenerator.generateTraceId();var u=t.kind??Hn.INTERNAL,l=(t.links??[]).map(e=>({context:e.context,attributes:gu(e.attributes)})),c=gu(t.attributes),p=this._sampler.shouldSample(r,i,e,u,c,l),n=this._tracerMetrics.startSpan(n,p.decision),o=(a=p.traceState??a,{traceId:i,spanId:o,traceFlags:p.decision===qn.RECORD_AND_SAMPLED?dn.SAMPLED:dn.NONE,traceState:a});return p.decision===qn.NOT_RECORD?(to.debug("Recording is off, propagating context in a non-recording span"),vo.wrapSpanContext(o)):(c=gu(Object.assign(c,p.attributes)),new od({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:o,name:e,kind:u,links:l,parentSpanContext:s,attributes:c,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:n}))}startActiveSpan(e,t,r,n){let o,s,i;if(!(arguments.length<2))return i=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),t=s??eo.active(),r=this.startSpan(e,o,t),n=vo.setSpan(t,r),eo.with(n,i,void 0,r)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Cd{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(var t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Tu(e||new Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(var r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(var t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(var t of this._spanProcessors)t.onEnd(e)}shutdown(){let r=[];for(var e of this._spanProcessors)r.push(e.shutdown());return new Promise((e,t)=>{Promise.all(r).then(()=>{e()},t)})}}(e=>{e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Rd=Rd||{});class Nd{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=sl(t,e.shift(),0,r);return t})([{},pd(),(t=e,(r=Object.assign({},t.spanLimits)).attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??128,r.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??fd,Object.assign({},t,{spanLimits:r}))]),r=(this._resource=t.resource??Tl(),this._config=Object.assign({},t,{resource:this._resource}),[]);e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new Cd(r)}getTracer(e,t,r){var n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._tracers.has(n)||this._tracers.set(n,new xd({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(n)}forceFlush(){let o=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(t=>{let r,n=setTimeout(()=>{t(new Error(`Span processor did not completed within timeout period of ${o} ms`)),r=Rd.timeout},o);e.forceFlush().then(()=>{clearTimeout(n),r!==Rd.timeout&&(r=Rd.resolved,t(r))}).catch(e=>{clearTimeout(n),r=Rd.error,t(e)})}));return new Promise((t,r)=>{Promise.all(e).then(e=>{e=e.filter(e=>e!==Rd.resolved);0<e.length?r(e):t()}).catch(e=>r([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class Id{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Iu(e.startTime),duration:Iu(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});if(e)return e({code:Lu.SUCCESS})}}class Pd{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Lu.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:Lu.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}class Ud{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new hl(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(t){if(!this._shutdownOnce.isCalled&&0!=(t.spanContext().traceFlags&dn.SAMPLED)){let e=this._doExport(t).catch(e=>Tu(e));this._pendingExports.add(e),e.finally(()=>this._pendingExports.delete(e))}}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();e=await fl._export(this._exporter,[e]);if(e.code!==Lu.SUCCESS)throw e.error??new Error(`SimpleSpanProcessor: span export failed (status ${e})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}class kd{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}var Ld,jd=r(Object.freeze({__proto__:null,BasicTracerProvider:Nd,BatchSpanProcessor:gd,RandomIdGenerator:Sd,ConsoleSpanExporter:Id,InMemorySpanExporter:Pd,SimpleSpanProcessor:Ud,NoopSpanProcessor:kd,AlwaysOffSampler:ad,AlwaysOnSampler:ud,ParentBasedSampler:ld,TraceIdRatioBasedSampler:cd,get SamplingDecision(){return id}}));class Dd{_enabled=!1;_currentContext=qr;_bindFunction(t=qr,r){function e(...e){return n.with(t,()=>r.apply(this,e))}let n=this;return Object.defineProperty(e,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),e}active(){return this._currentContext}bind(e,t){return void 0===e&&(e=this.active()),"function"==typeof t?this._bindFunction(e,t):t}disable(){return this._currentContext=qr,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=qr),this}with(e,t,r,...n){var o=this._currentContext;this._currentContext=e||qr;try{return t.call(r,...n)}finally{this._currentContext=o}}}(e=>{e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(Ld=Ld||{});let Md;function Vd(e,t){return t in e}function Bd(e,t,r,n=!0){if(Vd(r,t)&&"number"==typeof r[t]&&(!n||0!==r[t]))return e.addEvent(t,r[t])}function Fd(e){return e.slice().sort((e,t)=>{e=e[Ld.FETCH_START],t=t[Ld.FETCH_START];return t<e?1:e<t?-1:0})}function qd(){return"undefined"!=typeof location?location.origin:void 0}function Hd(e){var t;return"function"==typeof URL?new URL(e,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0):((t=Md=Md||document.createElement("a")).href=e,t)}var Gd=Object.freeze({__proto__:null,WebTracerProvider:class extends Nd{constructor(e={}){super(e)}register(e={}){vo.setGlobalTracerProvider(this),null!==(t=e.propagator)&&(void 0!==t?go.setGlobalPropagator(t):go.setGlobalPropagator(new ju({propagators:[new Yu,new mu]})));var t,r=e.contextManager;if(null!==r){if(void 0===r){let e=new Dd;return void(e.enable(),eo.setGlobalContextManager(e))}r.enable(),eo.setGlobalContextManager(r)}}},StackContextManager:Dd,get PerformanceTimingNames(){return Ld},addSpanNetworkEvent:Bd,addSpanNetworkEvents:function(r,n,e=!1,t,o){if(void 0===t&&(t=0!==n[Ld.START_TIME]),e||(Bd(r,Ld.FETCH_START,n,t),Bd(r,Ld.DOMAIN_LOOKUP_START,n,t),Bd(r,Ld.DOMAIN_LOOKUP_END,n,t),Bd(r,Ld.CONNECT_START,n,t),Bd(r,Ld.SECURE_CONNECTION_START,n,t),Bd(r,Ld.CONNECT_END,n,t),Bd(r,Ld.REQUEST_START,n,t),Bd(r,Ld.RESPONSE_START,n,t),Bd(r,Ld.RESPONSE_END,n,t)),!o){let e=n[Ld.ENCODED_BODY_SIZE],t=(void 0!==e&&r.setAttribute("http.response_content_length",e),n[Ld.DECODED_BODY_SIZE]);void 0!==t&&e!==t&&r.setAttribute("http.response_content_length_uncompressed",t)}},getElementXPath:function e(t,r){if(t.nodeType===Node.DOCUMENT_NODE)return"/";var n=((t,r)=>{let e=t.nodeType,n=(r=>{if(!r.parentNode)return 0;let n=[r.nodeType],e=(r.nodeType===Node.CDATA_SECTION_NODE&&n.push(Node.TEXT_NODE),Array.from(r.parentNode.childNodes));return 1<=(e=e.filter(e=>{var t=e.localName;return 0<=n.indexOf(e.nodeType)&&t===r.localName})).length?e.indexOf(r)+1:0})(t),o="";if(e===Node.ELEMENT_NODE){let e=t.getAttribute("id");if(r&&e)return`//*[@id="${e}"]`;o=t.localName}else if(e===Node.TEXT_NODE||e===Node.CDATA_SECTION_NODE)o="text()";else{if(e!==Node.COMMENT_NODE)return"";o="comment()"}return o&&1<n?`/${o}[${n}]`:"/"+o})(t,r);if(r&&0<n.indexOf("@id"))return n;let o="";return t.parentNode&&(o+=e(t.parentNode,r)),o+=n},getResource:function(e,u,n,t,o=new WeakSet,r){var s=Hd(e),e=((n,e,t,r,o)=>{let s=Nu(u),i=Nu(e),a=t.filter(e=>{var t=Nu(Ru(e[Ld.FETCH_START])),r=Nu(Ru(e[Ld.RESPONSE_END]));return e.initiatorType.toLowerCase()===(o||"xmlhttprequest")&&e.name===n&&t>=s&&r<=i});return a=0<a.length?a.filter(e=>!r.has(e)):a})(e=s.toString(),n,t,o,r);if(0===e.length)return{mainRequest:void 0};if(1!==e.length){o=Fd(e);if(s.origin!==qd()&&1<o.length){let e=o[0],t=((o,e,t)=>{var s=Nu(t),i=Nu(Ru(e));let a,u=o[1],r=o.length;for(let n=1;n<r;n++){let e=o[n],t=Nu(Ru(e[Ld.FETCH_START])),r=s-Nu(Ru(e[Ld.RESPONSE_END]));t>=i&&(!a||r<a)&&(a=r,u=e)}return u})(o,e[Ld.RESPONSE_END],n),r=e[Ld.RESPONSE_END];return t[Ld.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}}return{mainRequest:e[0]}},hasKey:Vd,normalizeUrl:function(e){return Hd(e).href},parseUrl:Hd,shouldPropagateTraceHeaders:function(t,e){let r=e||[];return("string"==typeof r||r instanceof RegExp)&&(r=[r]),Hd(t).origin===qd()||r.some(e=>"string"==typeof e?t===e:!!t.match(e))},sortResources:Fd,AlwaysOffSampler:ad,AlwaysOnSampler:ud,BasicTracerProvider:Nd,BatchSpanProcessor:gd,ConsoleSpanExporter:Id,InMemorySpanExporter:Pd,NoopSpanProcessor:kd,ParentBasedSampler:ld,RandomIdGenerator:Sd,get SamplingDecision(){return id},SimpleSpanProcessor:Ud,TraceIdRatioBasedSampler:cd}),zd=r(Gd),Kd=nd.OTLPTraceExporter,Yd=jd.BatchSpanProcessor,Wd=zd.WebTracerProvider,$d=Nl,Jd=n,Xd="tccc",Qd="https://otlp.tccc.qcloud.com/v1/traces",Zd=function(e){var t=new Kd({url:e.url||Qd,headers:{"X-Tps-TenantID":e.id||Xd}}),t=new Wd({spanProcessors:[new Yd(t,{})],resource:$d.defaultResource().merge($d.resourceFromAttributes({"tps.tenant.id":e.id||Xd,"service.name":"JsSIP","service.version":Jd.version}))});return t.register(),t.getTracer("JsSIP")},eh={provider:Zd({id:Xd,url:Qd}),attributes:{}},th=(td.setConfig=function(e){eh.provider=Zd(e)},td.setAttributes=function(e){Object.assign(eh.attributes,e)},td.trace=function(e){return Zd(e)},W.EventEmitter),rh=Il.exports,nh=ec,oh=Zl,ih=ap,sh=i,ah=L,uh=Yc,lh=B(),ch=Nc,ph=Ec,dh=bp,hh=Zc,fh=Tp.exports,mh=Up,gh=Vp,yh=Kp,_h=V(),vh=Xp,bh=Zp,Th=ed,Sh=td,wh=ih.trace,Eh=ih.context,Ah=new oh("RTCSession"),Oh={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9},xh=["audio","video"],Ch=(()=>{function i(e){u(this,i),Ah.debug("new"),(t=a(this,i))._id=null,t._ua=e,t._status=Oh.STATUS_NULL,t._dialog=null,t._earlyDialogs={},t._contact=null,t._from_tag=null,t._to_tag=null,t._use_trtc=t._ua.configuration.use_trtc,t._trtc_already_join=!1,t._is_mini_program=lh.isMiniProgram(),t._connection=null,t._connectionPromiseQueue=Promise.resolve(),t._request=null,t._is_canceled=!1,t._cancel_reason="",t._is_confirmed=!1,t._late_sdp=!1,t._rtcOfferConstraints=null,t._rtcAnswerConstraints=null,t._localStream=null,t._remoteStream={},t._remoteMediaStream={},t._localTRTCClient=null,t._localUserId=null,t._trtcLocalStream=null,t._trtcLocalStreamLocallyGenerated=!1,t._trtcLocalStreamConfig={},t._trtcRemoteStream={},t._rtcReady=!0,t._iceReady=!1,t._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},t._direction=null,t._local_identity=null,t._remote_identity=null,t._start_time=null,t._end_time=null,t._tones=null,t._audioMuted=!1,t._videoMuted=!1,t._localHold=!1,t._remoteHold=!1,t._sessionTimers={enabled:t._ua.configuration.session_timers,refreshMethod:t._ua.configuration.session_timers_refresh_method,defaultExpires:sh.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},t._referSubscribers={},t._data={};var t,e=Number(t._ua.configuration.log_level),e=1<e?e+1:e,r=null==(r=t._ua.configuration.uri.host)?void 0:r.includes("tencentcloud.com");return t.tracer=Sh.trace({id:r?"tcccsg":"tccc",url:r?"https://otlp.connect.tencentcloud.com/v1/traces":"https://otlp.tccc.qcloud.com/v1/traces"}),rh.Logger.setLogLevel(e),t._ua.configuration.log_report?rh.Logger.enableUploadLog():rh.Logger.disableUploadLog(),t}return f(i,th),c(i,[{key:"C",get:function(){return Oh}},{key:"causes",get:function(){return sh.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}},{key:"localStreams",get:function(){return this._use_trtc?[this._trtcLocalStream]:[this._localStream]}},{key:"remoteStreams",get:function(){return this._use_trtc?Object.values(this._trtcRemoteStream):Object.values(this._remoteStream)}},{key:"isInProgress",value:function(){switch(this._status){case Oh.STATUS_NULL:case Oh.STATUS_INVITE_SENT:case Oh.STATUS_1XX_RECEIVED:case Oh.STATUS_INVITE_RECEIVED:case Oh.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case Oh.STATUS_ANSWERED:case Oh.STATUS_WAITING_FOR_ACK:case Oh.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case Oh.STATUS_CANCELED:case Oh.STATUS_TERMINATED:return!0;default:return!1}}},{key:"isMuted",value:function(){return{audio:this._audioMuted,video:this._videoMuted}}},{key:"isOnHold",value:function(){return{local:this._localHold,remote:this._remoteHold}}},{key:"connect",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,o=(Ah.debug("connect()"),e),s=lh.cloneObject(r.eventHandlers),i=lh.cloneArray(r.extraHeaders),a=lh.cloneObject(r.mediaConstraints,{audio:!0,video:!0}),u=r.mediaStream||null,l=lh.cloneObject(r.pcConfig,{iceServers:[]}),c=r.rtcConstraints||null,p=r.rtcOfferConstraints||null;if(this._rtcOfferConstraints=p,this._rtcAnswerConstraints=r.rtcAnswerConstraints||null,this._trtcLocalStreamConfig=r.streamConfig||{},this._data=r.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Oh.STATUS_NULL)throw new ah.InvalidStateError(this._status);if(!Th.RTCPeerConnection&&!lh.isMiniProgram())throw new ah.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));for(t in this._sessionTimers.enabled&&lh.isDecimal(r.sessionTimersExpires)&&(r.sessionTimersExpires>=sh.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=r.sessionTimersExpires:this._sessionTimers.defaultExpires=sh.SESSION_EXPIRES),s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);this._from_tag=lh.newTag();var o=r.anonymous||!1,h={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:o,outbound:!0}),o?(h.from_display_name="Anonymous",h.from_uri=new _h("sip","anonymous","anonymous.invalid"),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),i.push("Privacy: id")):r.fromUserName&&(h.from_uri=new _h("sip",r.fromUserName,this._ua.configuration.uri.host),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(h.from_display_name=r.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._use_trtc&&i.push("X-TRTC: 1"),this._request=new ph.InitialOutgoingInviteRequest(e,this._ua,h,i),this._id=this._request.call_id+this._from_tag,this._use_trtc||this._createRTCConnection(l,c),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._use_trtc?this._sendTRTCInitialRequest():this._sendInitialRequest(a,p,u)}},{key:"init_incoming",value:function(e,t){var r,n=this,o=(Ah.debug("init_incoming()"),e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0);e.body&&"application/sdp"!==o?e.reply(415):(this._status=Oh.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")&&(r=1e3*e.getHeader("expires")),e.to_tag=lh.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=Oh.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),n._failed("local",null,sh.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),r&&(this._timers.expiresTimer=setTimeout(function(){n._status===Oh.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),n._failed("system",null,sh.causes.EXPIRES))},r)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==Oh.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 i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(Ah.debug("answer()"),this._request),t=lh.cloneArray(e.extraHeaders),r=lh.cloneObject(e.mediaConstraints),n=e.mediaStream||null,o=lh.cloneObject(e.pcConfig,{iceServers:[]}),s=e.rtcConstraints||null,u=e.rtcAnswerConstraints||null,l=lh.cloneObject(e.rtcOfferConstraints),c=!1,h=!1,d=!1,f=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=e.rtcOfferConstraints||null,this._trtcLocalStreamConfig=e.streamConfig||{},this._data=e.data||this._data,"incoming"!==this._direction)throw new ah.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==Oh.STATUS_WAITING_FOR_ANSWER)throw new ah.InvalidStateError(this._status);if(this._sessionTimers.enabled&&lh.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=sh.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=e.sessionTimersExpires:this._sessionTimers.defaultExpires=sh.SESSION_EXPIRES),this._status=Oh.STATUS_ANSWERED,this._createDialog(a,"UAS")){if(clearTimeout(this._timers.userNoAnswerTimer),t.unshift("Contact: ".concat(this._contact)),this._use_trtc){var m=a.getHeader("X-TRTC-SDKAPPID"),g=a.getHeader("X-TRTC-USERID"),y=parseInt(a.getHeader("X-TRTC-ROOMID"),10),_=a.getHeader("X-TRTC-STRROOMID"),v=a.getHeader("X-TRTC-USERSIG"),b=a.getHeader("X-TRTC-PRIVATEMAPKEY"),e=a.getHeader("X-TCCC-IVR"),T=a.getHeader("X-TRTC-PROXY");if(!this._is_mini_program&&m&&g&&(y||_)&&v)return void Promise.resolve().then(function(){return i._connecting(a),i._joinTRTCRoom({sdkAppId:m,userId:g,roomId:y,strRoomId:_,privateMapKey:b,userSig:v,proxy:T},function(e){i.terminate({status_code:480,cause:sh.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),i._failed("system",e.toString(),sh.causes.WEBRTC_ERROR)})}).then(function(e){if(i._status===Oh.STATUS_TERMINATED)throw new Error("terminated");Ah.debug("TRTC success"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=Oh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,sh.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t,r,n,o,s;if(i._status!==Oh.STATUS_TERMINATED)throw r=t=sh.causes.WEBRTC_ERROR,n=e.name,(o=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(n))&&(t=sh.causes.USER_DENIED_MEDIA_ACCESS,Ah.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e)),s=lh.isFunction(e.getCode)?e.getCode():"0","RtcError"===e.name&&Ah.error("TRTC error",e.toString(),{code:s,name:n}),!o&&e.message&&(r=e.message),Ah.debug("TRTC error then terminate",{code:s,name:n}),a.reply(480,r),i._failed("local",e.toString(),t),e});if(e||this._is_mini_program)return(new Promise.resolve).then(function(e){if(i._status===Oh.STATUS_TERMINATED)throw new Error("terminated");Ah.debug("processing pure signal mode"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=Oh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,sh.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t;if(i._status!==Oh.STATUS_TERMINATED)throw Ah.error("pure signal mode error then terminate",e.toString()),t=sh.causes.WEBRTC_ERROR,a.reply(480,t),i._failed("local",e.toString(),t),e});throw Ah.error("missing TRTC config"),a.reply(500),this._failed("system",null,sh.causes.INTERNAL_ERROR),new Error("missing config")}e=a.parseSDP();Array.isArray(e.media)||(e.media=[e.media]);var S,w=p(e.media);try{for(w.s();!(S=w.n()).done;){var E=S.value;"audio"===E.type&&(c=!0,E.direction&&"sendrecv"!==E.direction||(d=!0)),"video"===E.type&&(h=!0,E.direction&&"sendrecv"!==E.direction||(f=!0))}}catch(i){w.e(i)}finally{w.f()}if(n&&!1===r.audio){var A,O=p(n.getAudioTracks());try{for(O.s();!(A=O.n()).done;){var x=A.value;n.removeTrack(x)}}catch(i){O.e(i)}finally{O.f()}}if(n&&!1===r.video){var C,R=p(n.getVideoTracks());try{for(R.s();!(C=R.n()).done;){var N=C.value;n.removeTrack(N)}}catch(i){R.e(i)}finally{R.f()}}n||void 0!==r.audio||(r.audio=d),n||void 0!==r.video||(r.video=f),n||c||l.offerToReceiveAudio||(r.audio=!1),n||h||l.offerToReceiveVideo||(r.video=!1),this._createRTCConnection(o,s),Promise.resolve().then(function(){return n||(r.audio||r.video?new vh(r).initialize().catch(function(e){if(i._status===Oh.STATUS_TERMINATED)throw new Error("terminated");var t=sh.causes.USER_DENIED_MEDIA_ACCESS;throw a.reply(480,t),i._failed("local",null,sh.causes.USER_DENIED_MEDIA_ACCESS),Ah.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e),new Error("getUserMedia() failed")}):void 0)}).then(function(t){if(i._status===Oh.STATUS_TERMINATED)throw new Error("terminated");(i._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){i._connection.addTrack(e,t.mediaStream)})}).then(function(){var e,t;if(!i._late_sdp)return e={originator:"remote",type:"offer",sdp:a.body},Ah.debug('emit "sdp"'),i.emit("sdp",e),t=new RTCSessionDescription({type:"offer",sdp:e.sdp}),i._connectionPromiseQueue=i._connectionPromiseQueue.then(function(){return i._connection.setRemoteDescription(t)}).catch(function(e){throw a.reply(488),i._failed("system",null,sh.causes.WEBRTC_ERROR),Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),i.emit("peerconnection:setremotedescriptionfailed",e),new Error("peerconnection.setRemoteDescription() failed")}),i._connectionPromiseQueue}).then(function(){if(i._status===Oh.STATUS_TERMINATED)throw new Error("terminated");return i._connecting(a),(i._late_sdp?i._createLocalDescription("offer",i._rtcOfferConstraints):i._createLocalDescription("answer",u)).catch(function(){throw a.reply(500),new Error("_createLocalDescription() failed")})}).then(function(e){if(i._status===Oh.STATUS_TERMINATED)throw new Error("terminated");i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=Oh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,sh.causes.CONNECTION_ERROR)})}).catch(function(e){i._status!==Oh.STATUS_TERMINATED&&Ah.warn(e)})}else a.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};Ah.debug("terminate()");var r,n,o=e.cause||sh.causes.BYE,s=lh.cloneArray(e.extraHeaders),i=e.body,a=e.status_code,u=e.reason_phrase;if(this._status===Oh.STATUS_TERMINATED)throw new ah.InvalidStateError(this._status);switch(this._status){case Oh.STATUS_NULL:case Oh.STATUS_INVITE_SENT:case Oh.STATUS_1XX_RECEIVED:if(Ah.debug("canceling session"),a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&(u=u||sh.REASON_PHRASE[a]||"",r="SIP ;cause=".concat(a,' ;text="').concat(u,'"')),this._status===Oh.STATUS_NULL||this._status===Oh.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=r):this._status===Oh.STATUS_1XX_RECEIVED&&this._request.cancel(r),this._status=Oh.STATUS_CANCELED,this._failed("local",null,sh.causes.CANCELED);break;case Oh.STATUS_WAITING_FOR_ANSWER:case Oh.STATUS_ANSWERED:if(Ah.debug("rejecting session"),(a=a||480)<300||700<=a)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,u,s,i),this._failed("local",null,sh.causes.REJECTED);break;case Oh.STATUS_WAITING_FOR_ACK:case Oh.STATUS_CONFIRMED:if(Ah.debug("terminating session"),u=e.reason_phrase||sh.REASON_PHRASE[a]||"",a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&s.push("Reason: SIP ;cause=".concat(a,'; text="').concat(u,'"')),this._status===Oh.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==uh.C.STATUS_TERMINATED?(n=this._dialog,this.receiveRequest=function(e){e.method===sh.ACK&&(t.sendRequest(sh.BYE,{extraHeaders:s,body:i}),n.terminate())},this._request.server_transaction.on("stateChanged",function(){t._request.server_transaction.state===uh.C.STATUS_TERMINATED&&(t.sendRequest(sh.BYE,{extraHeaders:s,body:i}),n.terminate())}),this._ended("local",null,o),this._dialog=n,this._ua.newDialog(n)):(this.sendRequest(sh.BYE,{extraHeaders:s,body:i}),this._ended("local",null,o))}}},{key:"sendDTMF",value:function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=(Ah.debug("sendDTMF() | tones: %s",e),0),i=o.duration||null,a=o.interToneGap||null,t=o.transportType||sh.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Oh.STATUS_CONFIRMED&&this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_1XX_RECEIVED)throw new ah.InvalidStateError(this._status);if(t!==sh.DTMF_TRANSPORT.INFO&&t!==sh.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(t));if(!(e="number"==typeof e?e.toString():e)||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(i&&!lh.isDecimal(i))throw new TypeError("Invalid tone duration: ".concat(i));if(i=i?i<fh.C.MIN_DURATION?(Ah.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(fh.C.MIN_DURATION," milliseconds")),fh.C.MIN_DURATION):i>fh.C.MAX_DURATION?(Ah.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(fh.C.MAX_DURATION," milliseconds")),fh.C.MAX_DURATION):Math.abs(i):fh.C.DEFAULT_DURATION,o.duration=i,a&&!lh.isDecimal(a))throw new TypeError("Invalid interToneGap: ".concat(a));a=a?a<fh.C.MIN_INTER_TONE_GAP?(Ah.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(fh.C.MIN_INTER_TONE_GAP," milliseconds")),fh.C.MIN_INTER_TONE_GAP):Math.abs(a):fh.C.DEFAULT_INTER_TONE_GAP,t!==sh.DTMF_TRANSPORT.RFC2833?this._tones?this._tones+=e:(this._tones=e,function e(){var t,r,n=this;this._status===Oh.STATUS_TERMINATED||!this._tones||s>=this._tones.length?this._tones=null:(t=this._tones[s],s+=1,r=","===t?2e3:(r=new fh(this),o.eventHandlers={onFailed:function(){n._tones=null}},r.send(t,o),i+a),setTimeout(e.bind(this),r))}.call(this)):(t=this._getDTMFRTPSender())&&(e=t.toneBuffer+e,t.insertDTMF(e,i,a))}},{key:"sendInfo",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(Ah.debug("sendInfo()"),this._status!==Oh.STATUS_CONFIRMED&&this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_1XX_RECEIVED)throw new ah.InvalidStateError(this._status);new mh(this).send(e,t,r)}},{key:"mute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1},t=(Ah.debug("mute()"),!1),r=!1;!1===this._audioMuted&&e.audio&&(this._audioMuted=t=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(this._videoMuted=r=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==r||this._onmute({audio:t,video:r})}},{key:"unmute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0},t=(Ah.debug("unmute()"),!1),r=!1;!0===this._audioMuted&&e.audio&&(this._audioMuted=!(t=!0))===this._localHold&&this._toggleMuteAudio(!1),!0===this._videoMuted&&e.video&&(this._videoMuted=!(r=!0))===this._localHold&&this._toggleMuteVideo(!1),!0!==t&&!0!==r||this._onunmute({audio:t,video:r})}},{key:"switchMicrophones",value:function(e){if(Ah.debug("switchMicrophones(%s)",e),!this._is_confirmed||!this._trtcLocalStream)throw new ah.InvalidStateError(this._status);if(this._trtcLocalStream)return this._trtcLocalStream.switchDevice("audio",e);throw new ah.NotSupportedError("WebRTC mode not support switchMicrophones")}},{key:"switchSpeaker",value:function(t){var r=this;if(Ah.debug("switchSpeaker(%s)",t,this._trtcRemoteStream),!this._is_confirmed)throw new ah.InvalidStateError(this._status);if(this._trtcLocalStream){var e,n=[];for(e in this._trtcRemoteStream)(e=>{Object.prototype.hasOwnProperty.call(r._trtcRemoteStream,e)&&(Ah.error("stream",e),n.push(function(){return r._trtcRemoteStream[e].setAudioOutput(t)}))})(e);return Promise.all(n)}throw new ah.NotSupportedError("WebRTC mode not support switchSpeaker")}},{key:"setAudioVolume",value:function(e){if(Ah.debug("setAudioVolume(%d)",e),!this._is_confirmed)throw new ah.InvalidStateError(this._status);if(this._trtcLocalStream)for(var t in this._trtcLocalStream.setAudioVolume(e),this._trtcRemoteStream)Object.prototype.hasOwnProperty.call(this._trtcRemoteStream,t)&&this._trtcRemoteStream[t].setAudioVolume(e);throw new ah.NotSupportedError("WebRTC mode not support setAudioVolume")}},{key:"enableAudioVolumeEvaluation",value:function(e,t){if(Ah.debug("enableAudioVolumeEvaluation(%d)",e),this._localTRTCClient)return this._localTRTCClient.enableAudioVolumeEvaluation(e,t);throw new ah.InvalidStateError(this._status)}},{key:"hold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(Ah.debug("hold()"),this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:sh.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(Ah.debug("unhold()"),this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:sh.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e,t=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(Ah.debug("renegotiate()"),r.rtcOfferConstraints||null);return!(this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_CONFIRMED||!this._isReadyToReOffer()||(e={succeeded:function(){n&&n()},failed:function(){t.terminate({cause:sh.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}},this._setLocalMediaStatus(),r.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}):this._sendReinvite({eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}),0))}},{key:"refer",value:function(e,t){var r,n,o=this,s=(Ah.debug("refer()"),e);if(this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_CONFIRMED)return!1;if(e=this._ua.normalizeTarget(e))return(r=new yh(this)).sendRefer(e,t),n=r.id,(this._referSubscribers[n]=r).on("requestFailed",function(){delete o._referSubscribers[n]}),r.on("accepted",function(){delete o._referSubscribers[n]}),r.on("failed",function(){delete o._referSubscribers[n]}),r;throw new TypeError("Invalid target: ".concat(s))}},{key:"sendRequest",value:function(e,t){return Ah.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(Ah.debug("receiveRequest()"),e.method===sh.CANCEL)this._status!==Oh.STATUS_WAITING_FOR_ANSWER&&this._status!==Oh.STATUS_ANSWERED||(this._status=Oh.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,sh.causes.CANCELED));else switch(e.method){case sh.ACK:if(this._status===Oh.STATUS_WAITING_FOR_ACK)if(this._status=Oh.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:sh.causes.MISSING_SDP,status_code:400});break}var r={originator:"remote",type:"answer",sdp:e.body},n=(Ah.debug('emit "sdp"'),this.emit("sdp",r),new RTCSessionDescription({type:"answer",sdp:r.sdp}));this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(n)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:sh.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case sh.BYE:this._status===Oh.STATUS_CONFIRMED||this._status===Oh.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,sh.causes.BYE)):this._status===Oh.STATUS_INVITE_RECEIVED||this._status===Oh.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,sh.causes.BYE)):e.reply(403,"Wrong Status");break;case sh.INVITE:this._status===Oh.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case sh.INFO:this._status===Oh.STATUS_1XX_RECEIVED||this._status===Oh.STATUS_WAITING_FOR_ANSWER||this._status===Oh.STATUS_ANSWERED||this._status===Oh.STATUS_WAITING_FOR_ACK||this._status===Oh.STATUS_CONFIRMED?(r=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0)&&r.match(/^application\/dtmf-relay/i)?new fh(this).init_incoming(e):void 0!==r?new mh(this).init_incoming(e):e.reply(415):e.reply(403,"Wrong Status");break;case sh.UPDATE:this._status===Oh.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case sh.REFER:this._status===Oh.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case sh.NOTIFY:this._status===Oh.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){Ah.warn("onTransportError()"),this._status!==Oh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:sh.causes.CONNECTION_ERROR,cause:sh.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){Ah.warn("onRequestTimeout()"),this._status!==Oh.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:sh.causes.REQUEST_TIMEOUT,cause:sh.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){Ah.warn("onDialogError()"),this._status!==Oh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:sh.causes.DIALOG_ERROR,cause:sh.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){Ah.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){Ah.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||(Ah.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(Ah.debug("_isReadyToReOffer() | session not established yet"),!1):(Ah.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){var e=this;if(Ah.debug("close()"),this._localStream&&this._localStream.close(),this._trtcLocalStream&&this._trtcLocalStreamLocallyGenerated&&(Ah.debug("close() | closing trtcLocalStream"),Promise.resolve().then(function(){if(e._localTRTCClient)return e._localTRTCClient.unpublish(e._trtcLocalStream)}).then(function(){return!e._localTRTCClient||e._localTRTCClient.leave()}).then(function(){e._trtcLocalStream.close()}).catch(function(e){Ah.warn("TRTC leave room failed [error:%o]",e)}).then(function(){Ah.debug("TRTC destroy"),e._localTRTCClient&&e._localTRTCClient.destroy()})),this._status!==Oh.STATUS_TERMINATED){if(this._status=Oh.STATUS_TERMINATED,this._connection){for(var t in this._remoteStream)this.emit("removestream",t);try{this._connection.close()}catch(e){Ah.warn("close() | error closing the RTCPeerConnection: %o",e)}}for(var r in this._timers)Object.prototype.hasOwnProperty.call(this._timers,r)&&clearTimeout(this._timers[r]);for(var n in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,n)&&(this._earlyDialogs[n].terminate(),delete this._earlyDialogs[n]);for(var o in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,o)&&delete this._referSubscribers[o];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(t,r){var n=ch.T1;this._timers.invite2xxTimer=setTimeout(function e(){this._status===Oh.STATUS_WAITING_FOR_ACK&&(t.reply(200,null,["Contact: ".concat(this._contact)],r),n<ch.T2&&(n*=2)>ch.T2&&(n=ch.T2),this._timers.invite2xxTimer=setTimeout(e.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===Oh.STATUS_WAITING_FOR_ACK&&(Ah.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(sh.BYE),e._ended("remote",null,sh.causes.NO_ACK))},ch.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var r=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===r._connection.iceConnectionState&&r.terminate({cause:sh.causes.RTP_TIMEOUT,status_code:408,reason_phrase:sh.causes.RTP_TIMEOUT})}),this._connection.addEventListener("track",function(e){var t,e=e.streams[0];r._remoteStream[e.id]||(t=new bh({mediaStream:e}),r._remoteStream[e.id]=t,Ah.debug('emit "addstream" '.concat(e.id)),r.emit("addstream",{stream:t}))}),Ah.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(i,t){var a=this;if(Ah.debug("createLocalDescription(%s, %o)",i,t),"offer"!==i&&"answer"!==i)throw new Error('createLocalDescription() | invalid type "'.concat(i,'"'));var u=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===i?u.createOffer(t).catch(function(e){return Ah.warn('emit "peerconnection:createofferfailed" [error:%o]',e),a.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):u.createAnswer(t).catch(function(e){return Ah.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),a.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return u.setLocalDescription(e).catch(function(e){return a._rtcReady=!0,Ah.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),a.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){var e=t&&t.iceRestart;return"complete"===u.iceGatheringState&&!e||"gathering"===u.iceGatheringState&&a._iceReady?(a._rtcReady=!0,e={originator:"local",type:i,sdp:u.localDescription.sdp},Ah.debug('emit "sdp"'),a.emit("sdp",e),Promise.resolve(e.sdp)):new Promise(function(t){function r(){u.removeEventListener("icecandidate",n),u.removeEventListener("icegatheringstatechange",o),s=!0,a._rtcReady=!0,a._iceReady=!0;var e={originator:"local",type:i,sdp:u.localDescription.sdp};Ah.debug('emit "sdp"'),a.emit("sdp",e),t(e.sdp)}var n,o,s=!1;a._iceReady=!1;u.addEventListener("icecandidate",n=function(e){e=e.candidate;e?a.emit("icecandidate",{candidate:e,ready:r}):s||r()}),u.addEventListener("icegatheringstatechange",o=function(){"complete"!==u.iceGatheringState||s||r()})})})}},{key:"_createDialog",value:function(e,t,r){var n="UAS"===t?e.to_tag:e.from_tag,o="UAS"===t?e.from_tag:e.to_tag,n=e.call_id+n+o,o=this._earlyDialogs[n];return r?!!o||((o=new dh(this,e,t,dh.C.STATUS_EARLY)).error?(Ah.debug(o.error),this._failed("remote",e,sh.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[n]=o,!0)):(this._from_tag=e.from_tag,this._to_tag=e.to_tag,o?(o.update(e,t),this._dialog=o,delete this._earlyDialogs[n],!0):(r=new dh(this,e,t)).error?(Ah.debug(r.error),this._failed("remote",e,sh.causes.INTERNAL_ERROR),!1):(this._dialog=r,!0))}},{key:"_receiveReinvite",value:function(n){var t=this,e=(Ah.debug("receiveReinvite()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),o={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s=!0,e.status_code||403),r=e.reason_phrase||"",e=lh.cloneArray(e.extraHeaders);if(this._status!==Oh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},s=!1;function r(e){var t=this,r=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,r),this._late_sdp&&(e=this._mangleOffer(e)),n.reply(200,null,r,e,function(){t._status=Oh.STATUS_WAITING_FOR_ACK,t._setInvite2xxTimer(n,e),t._setACKTimer()}),"function"==typeof o.callback&&o.callback()}this.emit("reinvite",o),s||(this._late_sdp=!1,n.body?"application/sdp"!==e?(Ah.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==Oh.STATUS_TERMINATED&&r.call(t,e)}).catch(function(e){Ah.warn(e)}):(this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){r.call(t,e)}).catch(function(){n.reply(500)})))}},{key:"_receiveUpdate",value:function(n){var t=this,e=(Ah.debug("receiveUpdate()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),r={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(o=!0,e.status_code||403),r=e.reason_phrase||"",e=lh.cloneArray(e.extraHeaders);if(this._status!==Oh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},o=!1;function s(e){var t=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,t),n.reply(200,null,t,e),"function"==typeof r.callback&&r.callback()}this.emit("update",r),o||(n.body?"application/sdp"!==e?(Ah.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==Oh.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){Ah.warn(e)}):s.call(this,null))}},{key:"_processInDialogSdpOffer",value:function(t){var r=this;Ah.debug("_processInDialogSdpOffer()");var e,n=t.parseSDP(),o=!1,s=p(n.media);try{for(s.s();!(e=s.n()).done;){var i=e.value;if(-1!==xh.indexOf(i.type)){var a=i.direction||n.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){o=!1;break}o=!0}}}catch(t){s.e(t)}finally{s.f()}var u={originator:"remote",type:"offer",sdp:t.body},l=(Ah.debug('emit "sdp"'),this.emit("sdp",u),new RTCSessionDescription({type:"offer",sdp:u.sdp}));return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(r._status===Oh.STATUS_TERMINATED)throw new Error("terminated");return r._connection.setRemoteDescription(l).catch(function(e){throw t.reply(488),Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),r.emit("peerconnection:setremotedescriptionfailed",e),e})}).then(function(){if(r._status===Oh.STATUS_TERMINATED)throw new Error("terminated");!0===r._remoteHold&&!1===o?(r._remoteHold=!1,r._onunhold("remote")):!1===r._remoteHold&&!0===o&&(r._remoteHold=!0,r._onhold("remote"))}).then(function(){if(r._status===Oh.STATUS_TERMINATED)throw new Error("terminated");return r._createLocalDescription("answer",r._rtcAnswerConstraints).catch(function(e){throw t.reply(500),Ah.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',e),e})}).catch(function(e){Ah.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(o){var s,r=this;Ah.debug("receiveRefer()"),o.refer_to?o.refer_to.uri.scheme!==sh.SIP?(Ah.debug("Refer-To header field points to a non-SIP URI scheme"),o.reply(416)):(o.reply(202),s=new gh(this,o.cseq),Ah.debug('emit "refer"'),this.emit("refer",{request:o,accept:function(e,t){!function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(e="function"==typeof e?e:null,this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_CONFIRMED)return!1;var r,n=new i(this._ua);n.on("progress",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("accepted",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("_failed",function(e){var t=e.message,e=e.cause;t?s.notify(t.status_code,t.reason_phrase):s.notify(487,e)}),o.refer_to.uri.hasHeader("replaces")&&(r=decodeURIComponent(o.refer_to.uri.getHeader("replaces")),t.extraHeaders=lh.cloneArray(t.extraHeaders),t.extraHeaders.push("Replaces: ".concat(r))),n.connect(o.refer_to.uri.toAor(),t,e)}.call(r,e,t)},reject:function(){!function(){s.notify(603)}.call(r)}})):(Ah.debug("no Refer-To header field present in REFER"),o.reply(400))}},{key:"_receiveNotify",value:function(e){if(Ah.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t;if(e.event.params&&e.event.params.id)t=e.event.params.id,t=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");t=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}t?(t.receiveNotify(e),e.reply(200)):e.reply(481,"Subscription does not exist")}else e.reply(489)}},{key:"_receiveReplaces",value:function(n){var t=this;Ah.debug("receiveReplaces()"),this.emit("replaces",{request:n,accept:function(e){!function(e){var t=this;if(this._status!==Oh.STATUS_WAITING_FOR_ACK&&this._status!==Oh.STATUS_CONFIRMED)return!1;var r=new i(this._ua);r.on("confirmed",function(){t.terminate()}),r.init_incoming(n,e)}.call(t,e)},reject:function(){!function(){Ah.debug("Replaced INVITE rejected by the user"),n.reply(486)}.call(t)}})}},{key:"_sendInitialRequest",value:function(e,r,t){var n=this,o=new hh(this._ua,this._request,{onRequestTimeout:function(){n.onRequestTimeout()},onTransportError:function(){n.onTransportError()},onAuthenticated:function(e){n._request=e},onReceiveResponse:function(e){n._receiveInviteResponse(e)}});Promise.resolve().then(function(){return t||(e.audio||e.video?new vh(e).initialize().catch(function(e){if(n._status===Oh.STATUS_TERMINATED)throw new Error("terminated");throw n._failed("local",null,sh.causes.USER_DENIED_MEDIA_ACCESS),Ah.warn('emit "getusermediafailed" [error:%o]',e),n.emit("getusermediafailed",e),e}):void 0)}).then(function(t){if(n._status===Oh.STATUS_TERMINATED)throw new Error("terminated");return(n._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){n._connection.addTrack(e,t.mediaStream)}),n._connecting(n._request),n._createLocalDescription("offer",r).catch(function(e){throw n._failed("local",null,sh.causes.WEBRTC_ERROR),e})}).then(function(e){if(n._is_canceled||n._status===Oh.STATUS_TERMINATED)throw new Error("terminated");n._request.body=e,n._status=Oh.STATUS_INVITE_SENT,Ah.debug('emit "sending" [request:%o]',n._request),n.emit("sending",{request:n._request}),o.send()}).catch(function(e){n._status!==Oh.STATUS_TERMINATED&&Ah.warn(e)})}},{key:"_sendTRTCInitialRequest",value:function(){var t=this,e=new hh(this._ua,this._request,{onRequestTimeout:function(){t.onRequestTimeout()},onTransportError:function(){t.onTransportError()},onAuthenticated:function(e){t._request=e},onReceiveResponse:function(e){t._receiveInviteResponse(e)}});Promise.resolve().then(function(){if(t._status===Oh.STATUS_TERMINATED)throw new Error("terminated");Ah.debug("connecting"),t._connecting(t._request),t._status=Oh.STATUS_INVITE_SENT,Ah.debug('emit "sending" [request:%o]',t._request),t.emit("sending",{request:t._request}),e.send()}).catch(function(e){t._status!==Oh.STATUS_TERMINATED&&Ah.warn(e)})}},{key:"_inviteToTRTCRoom",value:function(o,e){var s=this;this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return s._joinTRTCRoom(e,function(e){s._acceptAndTerminate(o),s._failed("system",e.toString(),sh.causes.WEBRTC_ERROR)})}).then(function(){s._rtcReady=!0,"incoming"===s._direction&&(s._handleSessionTimersInIncomingResponse(o),s._accepted("remote",o),s.sendRequest(sh.ACK),s._confirmed("local",null))}).catch(function(e){var t,r,n;if(s._status!==Oh.STATUS_TERMINATED)throw r=t=sh.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=sh.causes.USER_DENIED_MEDIA_ACCESS,Ah.warn('emit "getusermediafailed" [error:%o]',e),s.emit("getusermediafailed",e)),"RtcError"===e.name&&Ah.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),s._acceptAndTerminate(o,480,r),s._failed("local",o,t),e}).then(function(){Ah.debug("trtc done")})}},{key:"_joinTRTCRoom",value:function(e,r){var n,t,o,s,i,a,u,l,c,p,h=this;if(!this._trtc_already_join)return this._trtc_already_join=!0,n=this.tracer.startSpan("trtc",void 0),t=e.sdkAppId,i=e.userSig,a=e.privateMapKey,l=e.proxy,c={sdkAppId:t,userId:o=e.userId,roomId:s=e.roomId,strRoomId:u=e.strRoomId,direction:this._direction,uri:this._ua.configuration.uri.toString(),proxy:l},Ah.debug("TRTC start",c),n.setAttributes(c),p=rh.createClient({mode:"rtc",sdkAppId:Number(t),userId:o,userSig:i,useStringRoomId:!s}),l&&p.setProxyServer({websocketProxy:"wss://".concat(l)}),this._trtcLocalStream=rh.createStream(y({userId:o,audio:!this._trtcLocalStreamConfig.screenAudio,video:!1},this._trtcLocalStreamConfig)),this._localTRTCClient=p,this._localUserId=o,this._ua.configuration.trtc_proxy_server&&p.setProxyServer(this._ua.configuration.trtc_proxy_server),this._ua.configuration.trtc_turn_server&&p.setTurnServer(this._ua.configuration.trtc_turn_server),p.on("stream-added",function(e){Ah.debug("TRTC stream-added, id:%s",e.stream.getId()),h.emit("stream-added",e),p.subscribe(e.stream,{audio:!0,video:Boolean(h._trtcLocalStream.video)}).catch(function(e){h._status!==Oh.STATUS_TERMINATED&&(Ah.error("TRTC subscribe stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-subscribed",function(e){var t=e.stream;Ah.debug("TRTC stream-subscribed, id:%o",t.getId()),h._trtcRemoteStream[t.getId()]=t,h.emit("addstream",e),h.emit("stream-subscribed",e),0<h.listenerCount("stream-subscribed")?Ah.debug("stream-subscribe listener count greater than 0"):t.play(h._getStreamPlayElement(o)).then(function(){Ah.debug("TRTC play stream success, id:%o",t.getId())}).catch(function(e){h._status!==Oh.STATUS_TERMINATED&&(Ah.error("TRTC play stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-removed",function(e){var t=e.stream;delete h._trtcRemoteStream[t.getId()],h.emit("stream-removed",e),h.emit("removestream",e)}),p.on("stream-updated",function(e){var t=e.stream;h._trtcRemoteStream[t.getId()]=t,h.emit("stream-updated",e)}),p.on("error",function(e){var t;h._status!==Oh.STATUS_TERMINATED&&(t=e.getCode(),Ah.error("TRTC errorCode: %o",t),h._failed("local",e.toString(),sh.causes.WEBRTC_ERROR))}),p.on("audio-volume",function(e){e&&Array.isArray(e.result)&&(e=e.result.map(function(e){return y(y({},e),{},{originator:e.userId===h._localUserId?"local":"remote"})}),h.emit("audiovolume",{result:e}))}),p.on("network-quality",function(e){h.emit("networkquality",e)}),Promise.resolve().then(function(){var t=h.tracer.startSpan("trtc/join",{attributes:c},wh.setSpan(Eh.active(),n));return Promise.all([t,h._trtcLocalStream.initialize().then(function(){h._trtcLocalStreamLocallyGenerated=!0}),h._localTRTCClient.join({roomId:s||u,privateMapKey:a}).then(function(){Ah.debug("TRTC join success"),t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)})])}).then(function(){var t;if(Ah.debug("TRTC join and initialize success"),h._status!==Oh.STATUS_TERMINATED)return 0<h.listenerCount("audiovolume")&&h._trtcLocalStream.play(h._getStreamPlayElement(o)),Ah.debug("TRTC join success then publish"),t=h.tracer.startSpan("trtc/publish",{attributes:c},wh.setSpan(Eh.active(),n)),h._localTRTCClient.publish(h._trtcLocalStream).then(function(){t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)});Ah.debug("TRTC join success after terminate");try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()}).catch(function(){h._localTRTCClient.destroy()})}catch(t){Ah.debug("trtc initial or join success then close error, message: ".concat(t.message))}}).then(function(){Ah.debug("TRTC publish success"),n.end()}).catch(function(e){Ah.warn("trtc join failed, status: ".concat(h._status,", error message: ").concat(e.toString()));var t=lh.isFunction(e.getCode)?e.getCode():"0";n.recordException(e),n.setAttributes({errorName:e.name,errorCode:t,errorMessage:e.toString()}),n.end();try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()})}catch(e){Ah.debug("trtc join failed then close or destroy error, error: ".concat(e.message))}if(h._status!==Oh.STATUS_TERMINATED)throw e});Ah.debug("ignore duplicate join trtc room")}},{key:"_pureSignalingRoom",value:function(){}},{key:"_getStreamPlayElement",value:function(e){var e="".concat(e,"-rtc-session-audio"),t=document.getElementById(e);return Ah.debug("get audio container",t),t||(Ah.debug("create audio container"),(t=document.createElement("div")).setAttribute("id",e),t.setAttribute("style","width:0;height:0;overflow:hidden"),document.body.appendChild(t),Ah.debug("create audio container id:%o",e)),t}},{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;Ah.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(t){var e,r,n,o,s,i,a,u,l,c,p,h,d,f,m,g,y,_=this;if(Ah.debug("receiveInviteResponse()"),this._dialog&&200<=t.status_code&&t.status_code<=299)return this._dialog.id.call_id===t.call_id&&this._dialog.id.local_tag===t.from_tag&&this._dialog.id.remote_tag===t.to_tag?void this.sendRequest(sh.ACK):void 0!==(e=new dh(this,t,"UAC")).error?void Ah.debug(e.error):(this.sendRequest(sh.ACK),void this.sendRequest(sh.BYE));if(this._is_canceled)100<=t.status_code&&t.status_code<200?this._request.cancel(this._cancel_reason):200<=t.status_code&&t.status_code<299&&this._acceptAndTerminate(t);else if(this._status===Oh.STATUS_INVITE_SENT||this._status===Oh.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(t.status_code):this._status=Oh.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(t.status_code):t.to_tag?t.hasHeader("contact")&&!this._createDialog(t,"UAC",!0)||(this._status=Oh.STATUS_1XX_RECEIVED,!this._is_mini_program&&this._use_trtc?(this._progress("remote",t),i=t.getHeader("X-TRTC-SDKAPPID"),f=t.getHeader("X-TRTC-USERID"),g=parseInt(t.getHeader("X-TRTC-ROOMID"),10),v=t.getHeader("X-TRTC-STRROOMID"),r=t.getHeader("X-TRTC-USERSIG"),n=t.getHeader("X-TRTC-PRIVATEMAPKEY"),o=t.getHeader("X-TCCC-IVR"),s=t.getHeader("X-TRTC-PROXY"),Ah.debug("".concat(t.status_code," with trtc params"),{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,isIVRCall:o,proxy:s}),i&&f&&(g||v)&&r?this._inviteToTRTCRoom(t,{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,proxy:s}):this._is_mini_program||o?Ah.debug("pure signal mode, no trtc params in 1xx response"):(this._acceptAndTerminate(t,400,sh.causes.MISSING_SDP),this._failed("remote",t,sh.causes.BAD_MEDIA_DESCRIPTION))):t.body?(i={originator:"remote",type:"answer",sdp:t.body},Ah.debug('emit "sdp"'),this.emit("sdp",i),a=new RTCSessionDescription({type:"answer",sdp:i.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return _._connection.setRemoteDescription(a)}).then(function(){return _._progress("remote",t)}).catch(function(e){Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})):this._progress("remote",t)):Ah.debug("1xx response received without to tag");break;case/^2[0-9]{2}$/.test(t.status_code):(this._status=Oh.STATUS_CONFIRMED,t.body||this._use_trtc)?this._createDialog(t,"UAC")&&(this._use_trtc?(this._handleSessionTimersInIncomingResponse(t),this._accepted("remote",t),this.sendRequest(sh.ACK),this._confirmed("local",null),u=t.getHeader("X-TRTC-SDKAPPID"),l=t.getHeader("X-TRTC-USERID"),c=parseInt(t.getHeader("X-TRTC-ROOMID"),10),p=t.getHeader("X-TRTC-STRROOMID"),h=t.getHeader("X-TRTC-USERSIG"),d=t.getHeader("X-TRTC-PRIVATEMAPKEY"),f=t.getHeader("X-TCCC-IVR"),m=t.getHeader("X-TRTC-PROXY"),Ah.debug("".concat(t.status_code," with trtc params"),{sdkAppId:u,userId:l,roomId:c,strRoomId:p,userSig:h,privateMapKey:d,isIVRCall:f,proxy:m}),u&&l&&(c||p)&&h?Promise.resolve().then(function(){return _._joinTRTCRoom({sdkAppId:u,userId:l,roomId:c,strRoomId:p,privateMapKey:d,userSig:h,proxy:m},function(e){_.terminate({status_code:480,cause:sh.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),_._failed("system",e.toString(),sh.causes.WEBRTC_ERROR)})}).catch(function(e){var t,r,n;_._status!==Oh.STATUS_TERMINATED&&(r=t=sh.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=sh.causes.USER_DENIED_MEDIA_ACCESS,Ah.warn('emit "getusermediafailed" [error:%o]',e),_.emit("getusermediafailed",e)),"RtcError"===e.name&&Ah.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),_.terminate({status_code:480,cause:t,reason_phrase:r}))}):this._is_mini_program||f?Ah.debug("pure signal mode, no trtc params in 200OK"):Ah.debug("missing trtc params in 200OK")):(g={originator:"remote",type:"answer",sdp:t.body},Ah.debug('emit "sdp"'),this.emit("sdp",g),y=new RTCSessionDescription({type:"answer",sdp:g.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===_._connection.signalingState)return _._connection.createOffer(_._rtcOfferConstraints).then(function(e){return _._connection.setLocalDescription(e)}).catch(function(e){_._acceptAndTerminate(t,500,e.toString()),_._failed("local",t,sh.causes.WEBRTC_ERROR)})}).then(function(){_._connection.setRemoteDescription(y).then(function(){_._handleSessionTimersInIncomingResponse(t),_._accepted("remote",t),_.sendRequest(sh.ACK),_._confirmed("local",null)}).catch(function(e){_._acceptAndTerminate(t,488,"Not Acceptable Here"),_._failed("remote",t,sh.causes.BAD_MEDIA_DESCRIPTION),Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})}))):(this._acceptAndTerminate(t,400,sh.causes.MISSING_SDP),this._failed("remote",t,sh.causes.BAD_MEDIA_DESCRIPTION));break;default:var v=lh.sipErrorCause(t.status_code);this._failed("remote",t,v)}}},{key:"_sendReinvite",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(Ah.debug("sendReinvite()"),lh.cloneArray(e.extraHeaders)),o=lh.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=!1;function i(e){o.failed&&o.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 r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};Ah.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(sh.INVITE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){(function(e){var t,r,n=this;this._status===Oh.STATUS_TERMINATED||(this.sendRequest(sh.ACK),s)||(this._handleSessionTimersInIncomingResponse(e),e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},Ah.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){i.call(n),Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):i.call(this))}).call(r,e),s=!0},onErrorResponse:function(e){i.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){i()})}},{key:"_sendUpdate",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(Ah.debug("sendUpdate()"),lh.cloneArray(e.extraHeaders)),o=lh.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=e.sdpOffer||!1,i=!1;function a(e){var t,r,n=this;this._status===Oh.STATUS_TERMINATED||i||(this._handleSessionTimersInIncomingResponse(e),s?e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},Ah.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){u.call(n),Ah.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):u.call(this):o.succeeded&&o.succeeded(e))}function u(e){o.failed&&o.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")),s?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};Ah.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(sh.UPDATE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){a.call(r,e),i=!0},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){u.call(r)})):this.sendRequest(sh.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){a.call(r,e)},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,r){Ah.debug("acceptAndTerminate()");var n=[];t&&(r=r||sh.REASON_PHRASE[t]||"",n.push("Reason: SIP ;cause=".concat(t,'; text="').concat(r,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(sh.ACK),this.sendRequest(sh.BYE,{extraHeaders:n})),this._status=Oh.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=nh.parse(e),this._localHold&&!this._remoteHold){Ah.debug("mangleOffer() | me on hold, mangling offer");var t,r=p(e.media);try{for(r.s();!(t=r.n()).done;){var n=t.value;-1!==xh.indexOf(n.type)&&(!n.direction||"sendrecv"===n.direction?n.direction="sendonly":"recvonly"===n.direction&&(n.direction="inactive"))}}catch(e){r.e(e)}finally{r.f()}}else if(this._localHold&&this._remoteHold){Ah.debug("mangleOffer() | both on hold, mangling offer");var o,s=p(e.media);try{for(s.s();!(o=s.n()).done;){var i=o.value;-1!==xh.indexOf(i.type)&&(i.direction="inactive")}}catch(e){s.e(e)}finally{s.f()}}else if(this._remoteHold){Ah.debug("mangleOffer() | remote on hold, mangling offer");var a,u=p(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==xh.indexOf(l.type)&&(!l.direction||"sendrecv"===l.direction?l.direction="recvonly":"recvonly"===l.direction&&(l.direction="inactive"))}}catch(e){u.e(e)}finally{u.f()}}return nh.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(t=e=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=sh.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(e)),this._sessionTimers.refresher="uas"===e,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=sh.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uac"),this._sessionTimers.refresher="uac"===e,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!==Oh.STATUS_TERMINATED&&e._isReadyToReOffer()&&(Ah.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===sh.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==Oh.STATUS_TERMINATED&&(Ah.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:sh.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteAudio():this._trtcLocalStream.unmuteAudio();throw new ah.InvalidStateError(this._status)}var t,r=p(this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteVideo():this._trtcLocalStream.unmuteVideo();throw new ah.InvalidStateError(this._status)}var t,r=p(this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){Ah.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){Ah.debug("session connecting"),Ah.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){Ah.debug("session progress"),Ah.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){Ah.debug("session accepted"),this._start_time=new Date,Ah.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){Ah.debug("session confirmed"),this._is_confirmed=!0,Ah.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,r){Ah.debug("session ended"),this._end_time=new Date,this._close(),Ah.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:r})}},{key:"_failed",value:function(e,t,r){Ah.debug("session failed"),Ah.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:r}),this._close(),Ah.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:r})}},{key:"_onhold",value:function(e){Ah.debug("session onhold"),this._setLocalMediaStatus(),Ah.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){Ah.debug("session onunhold"),this._setLocalMediaStatus(),Ah.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,e=e.video;Ah.debug("session onmute"),this._setLocalMediaStatus(),Ah.debug('emit "muted"'),this.emit("muted",{audio:t,video:e})}},{key:"_onunmute",value:function(e){var t=e.audio,e=e.video;Ah.debug("session onunmute"),this._setLocalMediaStatus(),Ah.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:e})}}],[{key:"C",get:function(){return Oh}}])})(),Rh=W.EventEmitter,Nh=Zl,Ih=i,Ph=Ec,Uh=B(),kh=Zc,Lh=L,jh=V(),Dh=new Nh("Message"),Mh=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return f(r,Rh),c(r,[{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:"send",value:function(e,t){var r=this,n=2<arguments.length&&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 s,o=Uh.cloneArray(n.extraHeaders),i=Uh.cloneObject(n.eventHandlers),a=n.contentType||"text/plain",u={};for(s in n.fromUserName&&(u.from_uri=new jh("sip",n.fromUserName,this._ua.configuration.uri.host),o.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),n.fromDisplayName&&(u.from_display_name=n.fromDisplayName),i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(a)),this._request=new Ph.OutgoingRequest(Ih.MESSAGE,e,this._ua,u,o),t&&(this._request.body=t);n=new kh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newMessage("local",this._request),n.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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=Uh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Lh.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,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=Uh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Lh.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{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=Uh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Ih.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Ih.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,r){Dh.debug("MESSAGE failed"),this._close(),Dh.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Dh.debug("MESSAGE succeeded"),this._close(),Dh.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),Vh=W.EventEmitter,Bh=Zl,Fh=i,qh=Ec,Hh=B(),Gh=Zc,zh=L,Kh=new Bh("Options"),Yh=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return f(r,Vh),c(r,[{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:"send",value:function(e,t){var r=this,n=2<arguments.length&&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 s,o=Hh.cloneArray(n.extraHeaders),i=Hh.cloneObject(n.eventHandlers),n=n.contentType||"application/sdp";for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(n)),this._request=new qh.OutgoingRequest(Fh.OPTIONS,e,this._ua,null,o),t&&(this._request.body=t);n=new Gh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newOptions("local",this._request),n.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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=Hh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new zh.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,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=Hh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new zh.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{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=Hh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Fh.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Fh.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,r){Kh.debug("OPTIONS failed"),this._close(),Kh.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Kh.debug("OPTIONS succeeded"),this._close(),Kh.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),Wh={},$h=Zl,Jh=B(),Xh=M(),Qh=new $h("Socket"),Zh=(Wh.isSocket=function(t){if(Array.isArray(t))return!1;if(void 0===t)return Qh.warn("undefined JsSIP.Socket instance"),!1;try{if(!Jh.isString(t.url))throw Qh.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!Jh.isString(t.via_transport))throw Qh.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===Xh.parse(t.sip_uri,"SIP_URI"))throw Qh.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(e){if(!Jh.isFunction(t[e]))throw Qh.warn("missing or invalid JsSIP.Socket method: ".concat(e)),new Error("Missing or invalid JsSIP.Socket method: ".concat(e))})}catch(t){return!1}return!0},Wh),ef=i,tf=new Zl("Transport"),rf={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:ef.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:ef.CONNECTION_RECOVERY_MAX_INTERVAL}},nf=c(function e(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:rf.recovery_options;u(this,e),tf.debug("new()"),this.status=rf.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=r,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(e){tf.warn("cannot use TextDecoder: ".concat(e))}if(void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");(t=t instanceof Array?t:[t]).forEach(function(e){if(!Zh.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:rf.SOCKET_STATUS_READY})},this),this._getSocket()},[{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}},{key:"connect",value:function(){tf.debug("connect()"),this.isConnected()?tf.debug("Transport is already connected"):this.isConnecting()?tf.debug("Transport is connecting"):(this.close_requested=!1,this.status=rf.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(){tf.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=rf.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){return tf.debug("send()"),this.isConnected()?(e=e.toString(),tf.debug("sending message:\n\n".concat(e,"\n")),this.socket.send(e)):(tf.warn("unable to send message, transport is not connected"),!1)}},{key:"isConnected",value:function(){return this.status===rf.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===rf.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this,t=(this.recover_attempts+=1,Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1));t<this.recovery_options.min_interval?t=this.recovery_options.min_interval:t>this.recovery_options.max_interval&&(t=this.recovery_options.max_interval),tf.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,t=[];this.sockets.forEach(function(e){e.status!==rf.SOCKET_STATUS_ERROR&&(0===t.length?t.push(e):e.weight>t[0].weight?t=[e]:e.weight===t[0].weight&&t.push(e))}),0===t.length?(this.sockets.forEach(function(e){e.status=rf.SOCKET_STATUS_READY}),this._getSocket()):(e=Math.floor(Math.random()*t.length),this.socket=t[e].socket)}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=rf.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,r){this.status=rf.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:r}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=rf.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(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(e){return void tf.debug("received binary message failed to be converted into string, message discarded")}tf.debug("received binary message:\n\n".concat(e,"\n"))}else tf.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else tf.debug("received message with CRLF Keep Alive response")}}]),of={},sf=Zl,af=M(),uf=Ec,lf=new sf("Parser");function cf(e,t){var r,n=t,o=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===o;){if(-1===(r=e.indexOf("\r\n",n)))return r;!e.substring(r+2,r+4).match(/(^\r\n)/)&&e.charAt(r+2).match(/(^\s+)/)?n=r+2:o=r}return o}function pf(e,t,r,n){var o,s=t.indexOf(":",r),i=t.substring(r,s).trim(),a=t.substring(s+1,n).trim();switch(i.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(o=e.parseHeader("Via"))&&(e.via=o,e.via_branch=o.branch):o=0;break;case"from":case"f":e.setHeader("from",a),(o=e.parseHeader("from"))&&(e.from=o,e.from_tag=o.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),(o=e.parseHeader("to"))&&(e.to=o,e.to_tag=o.getParam("tag"));break;case"record-route":if(-1===(o=af.parse(a,"Record_Route")))o=void 0;else{var u,l=p(o);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.addHeader("record-route",a.substring(c.possition,c.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=c.parsed}}catch(e){l.e(e)}finally{l.f()}}break;case"call-id":case"i":e.setHeader("call-id",a),(o=e.parseHeader("call-id"))&&(e.call_id=a);break;case"contact":case"m":if(-1===(o=af.parse(a,"Contact")))o=void 0;else{var h,d=p(o);try{for(d.s();!(h=d.n()).done;){var f=h.value;e.addHeader("contact",a.substring(f.possition,f.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=f.parsed}}catch(e){d.e(e)}finally{d.f()}}break;case"content-length":case"l":e.setHeader("content-length",a),o=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),o=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),(o=e.parseHeader("cseq"))&&(e.cseq=o.value),e instanceof uf.IncomingResponse&&(e.method=o.method);break;case"max-forwards":e.setHeader("max-forwards",a),o=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),o=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),o=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",a),(o=e.parseHeader("session-expires"))&&(e.session_expires=o.expires,e.session_expires_refresher=o.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",a),(o=e.parseHeader("refer-to"))&&(e.refer_to=o);break;case"replaces":e.setHeader("replaces",a),(o=e.parseHeader("replaces"))&&(e.replaces=o);break;case"event":case"o":e.setHeader("event",a),(o=e.parseHeader("event"))&&(e.event=o);break;default:e.addHeader(i,a),o=0}return void 0!==o||{error:'error parsing header "'.concat(i,'"')}}of.parseMessage=function(e,t){var r,n,o=e.indexOf("\r\n");if(-1!==o){var s=e.substring(0,o),i=af.parse(s,"Request_Response");if(-1!==i){i.status_code?((r=new uf.IncomingResponse).status_code=i.status_code,r.reason_phrase=i.reason_phrase):((r=new uf.IncomingRequest(t)).method=i.method,r.ruri=i.uri),r.data=e;for(var a=o+2;;){if(-2===(o=cf(e,a))){n=a+2;break}if(-1===o)return void lf.warn("parseMessage() | malformed message");if(!0!==(i=pf(r,e,a,o)))return void lf.warn("parseMessage() |",i.error);a=o+2}return r.hasHeader("content-length")?(t=r.getHeader("content-length"),r.body=e.substr(n,t)):r.body=e.substring(n),r}lf.warn('parseMessage() | error parsing first line of SIP message: "'.concat(s,'"'))}else lf.warn("parseMessage() | no CRLF found, not a SIP message")};var df,hf,ff,mf=Zl,gf=i,yf=Ec,_f=B(),vf=new mf("sanityCheck"),bf=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var r=t[e];if(!df.hasHeader(r))return vf.debug("missing mandatory header field : ".concat(r,", dropping the response")),!1}}],Tf=[function(){if("sip"!==df.s("to").uri.scheme)return wf(416),!1},function(){if(!df.to_tag&&df.call_id.substr(0,5)===hf.configuration.jssip_id)return wf(482),!1},function(){if(_f.str_utf8_length(df.body)<df.getHeader("content-length"))return wf(400),!1},function(){var e,t=df.from_tag,r=df.call_id,n=df.cseq;if(!df.to_tag)if(df.method===gf.INVITE){if(hf._transactions.ist[df.via_branch])return!1;for(var o in hf._transactions.ist)if(Object.prototype.hasOwnProperty.call(hf._transactions.ist,o)&&(e=hf._transactions.ist[o]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return wf(482),!1}else{if(hf._transactions.nist[df.via_branch])return!1;for(var s in hf._transactions.nist)if(Object.prototype.hasOwnProperty.call(hf._transactions.nist,s)&&(e=hf._transactions.nist[s]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return wf(482),!1}}],Sf=[function(){if(1<df.getHeaders("via").length)return vf.debug("more than one Via header field present in the response, dropping the response"),!1},function(){if(_f.str_utf8_length(df.body)<df.getHeader("content-length"))return vf.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function wf(e){var t,r=df.getHeaders("via"),n="SIP/2.0 ".concat(e," ").concat(gf.REASON_PHRASE[e],"\r\n"),o=p(r);try{for(o.s();!(t=o.n()).done;)n+="Via: ".concat(t.value,"\r\n")}catch(e){o.e(e)}finally{o.f()}r=df.getHeader("To"),df.to_tag||(r+=";tag=".concat(_f.newTag())),n=(n=(n=(n+="To: ".concat(r,"\r\n"))+"From: ".concat(df.getHeader("From"),"\r\n"))+"Call-ID: ".concat(df.call_id,"\r\n"))+"CSeq: ".concat(df.cseq," ").concat(df.method,"\r\n"),ff.send(n+="\r\n")}var Ef={},Af=B(),Of=i,xf=M(),Cf=V(),Rf=Wh,Nf=L,If=Zl,Pf=(Ef.settings={authorization_user:null,password:null,realm:null,ha1:null,authorization_jwt:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,session_timers_refresh_method:Of.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:Of.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:Of.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(Af.createRandomToken(12),".invalid"),log_level:Of.LOG_LEVEL.TRACE,log_report:!0,log_proxy:null,use_trtc:!0,trtc_proxy_server:null,trtc_turn_server:null},{mandatory:{sockets:function(e){var t=[];if(Rf.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var r,n=p(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;Object.prototype.hasOwnProperty.call(o,"socket")&&Rf.isSocket(o.socket)?t.push(o):Rf.isSocket(o)&&t.push({socket:o})}}catch(e){n.e(e)}finally{n.f()}}return t},uri:function(e){/^sip:/i.test(e)||(e="".concat(Of.SIP,":").concat(e));e=Cf.parse(e);return e&&e.user?e:void 0}},optional:{authorization_user:function(e){return-1===xf.parse('"'.concat(e,'"'),"quoted_string")?void 0:e},authorization_jwt:function(e){if("string"==typeof e)return e},user_agent:function(e){if("string"==typeof e)return e},connection_recovery_max_interval:function(e){if(Af.isDecimal(e)){e=Number(e);if(0<e)return e}},connection_recovery_min_interval:function(e){if(Af.isDecimal(e)){e=Number(e);if(0<e)return e}},contact_uri:function(e){if("string"==typeof e){e=xf.parse(e,"SIP_URI");if(-1!==e)return e}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===xf.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(Af.isDecimal(e)){e=Number(e);if(0<e)return e}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===Of.INVITE||e===Of.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(Af.isDecimal(e)){e=Number(e);if(0<e)return e}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(Of.SIP,":").concat(e));e=Cf.parse(e);return!e||e.user?void 0:e},use_preloaded_route:function(e){if("boolean"==typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var r,n=p(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;"string"==typeof o&&t.push(o)}}catch(e){n.e(e)}finally{n.f()}return t}},log_level:function(e){return Af.isDecimal(e)&&-1!==Object.values(Of.LOG_LEVEL).indexOf(Number(e))?(If.setLogLevel(Number(e)),e):(If.setLogLevel(Of.LOG_LEVEL.TRACE),Of.LOG_LEVEL.TRACE)},log_report:function(e){return"boolean"==typeof e?(If.setLogReport(e),e):(If.setLogReport(!0),!0)},log_proxy:function(e){return If.setLogProxy(e),e},use_trtc:function(e){if("boolean"==typeof e)return e},trtc_proxy_server:function(e){return e},trtc_turn_server:function(e){return e}}}),Uf=(Ef.load=function(e,t){for(var r in Pf.mandatory){if(!t.hasOwnProperty(r))throw new Nf.ConfigurationError(r);var n=t[r],o=Pf.mandatory[r](n);if(void 0===o)throw new Nf.ConfigurationError(r,n);e[r]=o}for(var s in Pf.optional)if(t.hasOwnProperty(s)){var i=t[s];if(Af.isEmpty(i))continue;var a=Pf.optional[s](i);if(void 0===a)throw new Nf.ConfigurationError(s,i);e[s]=a}},W.EventEmitter),kf=Zl,Lf=i,jf=sp,Df=Ch,Mf=Mh,Vf=Yh,Bf=Yc,Ff=nf,qf=B(),Hf=L,Gf=V(),zf=of,Kf=Ec,Yf=function(e,t,r){df=e,hf=t,ff=r;for(var n=0,o=bf;n<o.length;n++)if(!1===(0,o[n])())return!1;if(df instanceof yf.IncomingRequest){for(var s=0,i=Tf;s<i.length;s++)if(!1===(0,i[s])())return!1}else if(df instanceof yf.IncomingResponse)for(var a=0,u=Sf;a<u.length;a++)if(!1===(0,u[a])())return!1;return!0},Wf=Ef,$f=new kf("UA"),Jf={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},Xf=(()=>{function r(e){var t;if(u(this,r),$f.debug("new() [configuration:%o]",e),(t=a(this,r))._cache={credentials:{}},t._configuration=Object.assign({},Wf.settings),t._dynConfiguration={},t._dialogs={},t._applicants={},t._sessions={},t._transport=null,t._contact=null,t._status=Jf.STATUS_INIT,t._error=null,t._transactions={nist:{},nict:{},ist:{},ict:{}},t._data={},t._closeTimer=null,void 0===e)throw new TypeError("Not enough arguments");try{t._loadConfig(e)}catch(e){throw t._status=Jf.STATUS_NOT_READY,t._error=Jf.CONFIGURATION_ERROR,e}return t._registrator=new jf(t),t}return f(r,Uf),c(r,[{key:"C",get:function(){return Jf}},{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}},{key:"start",value:function(){$f.debug("start()",{}),this._status===Jf.STATUS_INIT?this._transport.connect():this._status===Jf.STATUS_USER_CLOSED?($f.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=Jf.STATUS_INIT,this._transport.connect()):this._status===Jf.STATUS_READY?$f.debug("UA is in READY status, not restarted"):$f.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){$f.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){$f.debug("unregister()"),this._dynConfiguration.register=!1,this._registrator.unregister(e)}},{key:"registrator",value:function(){return this._registrator}},{key:"isRegistered",value:function(){return this._registrator.registered}},{key:"isConnected",value:function(){return this._transport.isConnected()}},{key:"call",value:function(e,t){$f.debug("call()");var r=new Df(this);return r.connect(e,t),r}},{key:"sendMessage",value:function(e,t,r){$f.debug("sendMessage()");var n=new Mf(this);return n.send(e,t,r),n}},{key:"sendOptions",value:function(e,t,r){$f.debug("sendOptions()");var n=new Vf(this);return n.send(e,t,r),n}},{key:"terminateSessions",value:function(e){for(var t in $f.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if($f.debug("stop()"),this._dynConfiguration={},this._status!==Jf.STATUS_USER_CLOSED){this._registrator.close();var t,r,n=Object.keys(this._sessions).length;for(t in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,t)){$f.debug("closing session ".concat(t));try{this._sessions[t].terminate()}catch(e){}}for(r in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,r))try{this._applicants[r].close()}catch(e){}this._status=Jf.STATUS_USER_CLOSED,0===Object.keys(this._transactions.nict).length+Object.keys(this._transactions.nist).length+Object.keys(this._transactions.ict).length+Object.keys(this._transactions.ist).length&&0===n?this._transport.disconnect():this._closeTimer=setTimeout(function(){e._closeTimer=null,e._transport.disconnect()},2e3)}else $f.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return qf.normalizeTarget(e,this._configuration.hostport_params)}},{key:"get",value:function(e){switch(e){case"authorization_user":return this._configuration.authorization_user;case"realm":return this._configuration.realm;case"ha1":return this._configuration.ha1;case"authorization_jwt":return this._configuration.authorization_jwt;default:return void $f.warn('get() | cannot get "%s" parameter in runtime',e)}}},{key:"set",value:function(e,t){switch(e){case"authorization_user":this._configuration.authorization_user=String(t);break;case"password":this._configuration.password=String(t);break;case"realm":this._configuration.realm=String(t);break;case"ha1":this._configuration.ha1=String(t),this._configuration.password=null;break;case"authorization_jwt":this._configuration.authorization_jwt=String(t);break;case"display_name":this._configuration.display_name=t;break;case"log_level":qf.isDecimal(t)&&-1!==Object.values(Lf.LOG_LEVEL).indexOf(Number(t))&&kf.setLogLevel(t);break;case"log_report":kf.setLogReport(Boolean(t));break;case"log_proxy":kf.setLogProxy(t);break;case"trtc_proxy_server":case"trtc_turn_server":this._configuration[e]=t;break;default:return $f.warn('set() | cannot set "%s" parameter in runtime',e),!1}return!0}},{key:"newTransaction",value:function(e){this._transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})}},{key:"destroyTransaction",value:function(e){delete this._transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})}},{key:"newDialog",value:function(e){this._dialogs[e.id]=e}},{key:"destroyDialog",value:function(e){delete this._dialogs[e.id]}},{key:"newMessage",value:function(e,t){this._applicants[e]=e,this.emit("newMessage",t)}},{key:"newOptions",value:function(e,t){this._applicants[e]=e,this.emit("newOptions",t)}},{key:"destroyMessage",value:function(e){delete this._applicants[e]}},{key:"newRTCSession",value:function(e,t){this._sessions[e.id]=e,this.emit("newRTCSession",t)}},{key:"destroyRTCSession",value:function(e){delete this._sessions[e.id]}},{key:"registered",value:function(e){this.emit("registered",e)}},{key:"unregistered",value:function(e){this.emit("unregistered",e)}},{key:"registrationFailed",value:function(e){this.emit("registrationFailed",e)}},{key:"receiveRequest",value:function(e){var t,r,n,o=e.method;if(e.ruri.user!==this._configuration.uri.user&&e.ruri.user!==this._contact.uri.user)$f.debug("Request-URI does not point to us"),e.method!==Lf.ACK&&e.reply_sl(404);else if(e.ruri.scheme!==Lf.SIPS){if(!Bf.checkTransaction(this,e)){if(o===Lf.INVITE?new Bf.InviteServerTransaction(this,this._transport,e):o!==Lf.ACK&&o!==Lf.CANCEL&&new Bf.NonInviteServerTransaction(this,this._transport,e),o===Lf.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new Vf(this).init_incoming(e)}else if(o===Lf.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new Mf(this).init_incoming(e)}else if(o===Lf.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);if(e.to_tag)(t=this._findDialog(e.call_id,e.from_tag,e.to_tag))?t.receiveRequest(e):o===Lf.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):($f.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):o!==Lf.ACK&&e.reply(481);else switch(o){case Lf.INVITE:window.RTCPeerConnection?e.hasHeader("replaces")?(n=e.replaces,(t=this._findDialog(n.call_id,n.from_tag,n.to_tag))?(r=t.owner).isEnded()?e.reply(603):r.receiveRequest(e):e.reply(481)):(r=new Df(this)).init_incoming(e):($f.warn("INVITE received but WebRTC is not supported"),e.reply(488));break;case Lf.BYE:e.reply(481);break;case Lf.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):$f.debug("received CANCEL request for a non existent session");break;case Lf.ACK:break;case Lf.NOTIFY:this.emit("sipEvent",{event:e.event,request:e}),e.reply(200);break;default:e.reply(405)}}}else e.reply_sl(416)}},{key:"_findSession",value:function(e){var t=e.call_id,r=this._sessions[t+e.from_tag],t=this._sessions[t+e.to_tag];return r||t||null}},{key:"_findDialog",value:function(e,t,r){var n=this._dialogs[e+t+r];return n||this._dialogs[e+r+t]||null}},{key:"_loadConfig",value:function(e){try{Wf.load(this._configuration,e),kf.setAttributes({uri:this._configuration.uri.toString()})}catch(r){throw $f.error("config load: %o",e,r),r}0===this._configuration.display_name&&(this._configuration.display_name="0"),this._configuration.instance_id||(this._configuration.instance_id=qf.newUUID()),this._configuration.jssip_id=qf.createRandomToken(5);var t,r=this._configuration.uri.clone();r.user=null,this._configuration.hostport_params=r.toString().replace(/^sip:/i,"");try{this._transport=new Ff(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=Qf.bind(this),this._transport.onconnect=Zf.bind(this),this._transport.ondisconnect=em.bind(this),this._transport.ondata=tm.bind(this)}catch(e){throw $f.warn(e),new Hf.ConfigurationError("sockets",this._configuration.sockets)}delete this._configuration.sockets,this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user),this._configuration.registrar_server||((t=this._configuration.uri.clone()).user=null,t.clearParams(),t.clearHeaders(),this._configuration.registrar_server=t),this._configuration.no_answer_timeout*=1e3,this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new Gf("sip",qf.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"});var n,o,s=this._configuration.use_trtc,i=(this._contact={pub_gruu:null,temp_gruu:null,uri:this._configuration.contact_uri,toString:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,e=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!e||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),s&&(r+=";trtc"),r+">"}},["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","log_level","log_report","log_proxy","use_trtc","trtc_proxy_server","trtc_turn_server"]);for(n in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,n)&&(-1!==i.indexOf(n)?Object.defineProperty(this._configuration,n,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,n,{writable:!1,configurable:!1}));for(o in $f.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(Wf.settings,o))switch(o){case"uri":case"registrar_server":$f.debug("- ".concat(o,": ").concat(this._configuration[o]));break;case"password":case"ha1":case"authorization_jwt":$f.debug("- ".concat(o,": NOT SHOWN"));break;default:$f.debug("- ".concat(o,": ").concat(JSON.stringify(this._configuration[o])))}}}],[{key:"C",get:function(){return Jf}}])})();function Qf(e){this.emit("connecting",e)}function Zf(e){this._status!==Jf.STATUS_USER_CLOSED&&(this._status=Jf.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register)&&this._registrator.register()}function em(e){for(var t=0,r=["nict","ict","nist","ist"];t<r.length;t++){var n,o=r[t];for(n in this._transactions[o])Object.prototype.hasOwnProperty.call(this._transactions[o],n)&&this._transactions[o][n].onTransportError()}this.emit("disconnected",e),this._registrator.onTransportClosed(),this._status!==Jf.STATUS_USER_CLOSED&&(this._status=Jf.STATUS_NOT_READY,this._error=Jf.NETWORK_ERROR)}function tm(e){var t,r=e.transport,n=e.message;if((n=zf.parseMessage(n,this))&&!(this._status===Jf.STATUS_USER_CLOSED&&n instanceof Kf.IncomingRequest)&&Yf(n,this,r))if(n instanceof Kf.IncomingRequest)n.transport=r,this.receiveRequest(n);else if(n instanceof Kf.IncomingResponse)switch(n.method){case Lf.INVITE:(t=this._transactions.ict[n.via_branch])&&t.receiveResponse(n);break;case Lf.ACK:break;default:(t=this._transactions.nict[n.via_branch])&&t.receiveResponse(n)}}var rm=Zl,nm=M(),om=new rm("WebSocketInterface"),im=c(function e(t){u(this,e),om.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var r=nm.parse(t,"absoluteURI");if(-1===r)throw om.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==r.scheme&&"ws"!==r.scheme)throw om.warn("invalid WebSocket URI scheme: ".concat(r.scheme)),new TypeError("Invalid argument: ".concat(t));this._sip_uri="sip:".concat(r.host).concat(r.port?":".concat(r.port):"",";transport=ws"),this._via_transport=r.scheme.toUpperCase()},[{key:"via_transport",get:function(){return this._via_transport},set:function(e){this._via_transport=e.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}},{key:"connect",value:function(){if(om.debug("connect()"),this.isConnected())om.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())om.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),om.debug("connecting to WebSocket ".concat(this._url));try{this._ws=new WebSocket(this._url,"sip"),this._ws.binaryType="arraybuffer",this._ws.onopen=this._onOpen.bind(this),this._ws.onclose=this._onClose.bind(this),this._ws.onmessage=this._onMessage.bind(this),this._ws.onerror=this._onError.bind(this)}catch(e){this._onError(e)}}}},{key:"disconnect",value:function(){om.debug("disconnect()"),this._ws&&(this._ws.onopen=function(){},this._ws.onclose=function(){},this._ws.onmessage=function(){},this._ws.onerror=function(){},this._ws.close(),this._ws=null)}},{key:"send",value:function(e){return om.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(om.warn("unable to send message, WebSocket is not open"),!1)}},{key:"isConnected",value:function(){return this._ws&&this._ws.readyState===this._ws.OPEN}},{key:"isConnecting",value:function(){return this._ws&&this._ws.readyState===this._ws.CONNECTING}},{key:"_onOpen",value:function(){om.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,r=e.code,e=e.reason;om.debug("WebSocket ".concat(this._url," closed")),!1===t&&om.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,r,e)}},{key:"_onMessage",value:function(e){e=e.data;om.debug("received WebSocket message"),this.ondata(e)}},{key:"_onError",value:function(e){om.warn("WebSocket ".concat(this._url," error: "),e)}}]),sm=Zl,am=(M(),new sm("WxWebsocketInterface"),{}),um=Il.exports,lm=(am.getMicrophones=um.getMicrophones,am.getSpeakers=um.getSpeakers,am.getDevices=um.getDevices,n),cm=i,pm=L,dm=B(),hm=Xf,fm=V(),mm=D(),gm=M(),ym=im,_m=am,vm=Zl,bm=(Se.exports(lm.title)("version %s",lm.version),{C:cm,Exceptions:pm,Utils:dm,UA:hm,URI:fm,NameAddrHeader:mm,WebSocketInterface:ym,Grammar:gm,Devices:_m,Logger:vm,debug:Se.exports,get name(){return lm.title},get version(){return lm.version}});export{bm as default};
1
+ import e from"trtc-js-sdk";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(r){var n,e=r.default;return"function"==typeof e?(n=function(){return e.apply(this,arguments)}).prototype=e.prototype:n={},Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(e){var t=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:function(){return r[e]}})}),n}var n={name:"@tencentcloud/tccc-sip-js",title:"TCCCSIP",description:"TCCC JavaScript SIP SDK",version:"0.1.2",homepage:"https://tccc.qcloud.com",contributors:["TCCC Frontend Team"],types:"dist/jssip.d.ts",main:"dist/jssip.cjs.js",module:"dist/jssip.esm.js",browser:"dist/jssip.umd.js",miniprogram:"miniprogram_dist",exports:{".":{import:"dist/jssip.esm.js",require:"dist/index.cjs.js",browser:"dist/jssip.umd.js",types:"dist/jssip.d.ts",default:"dist/jssip.esm.js"}},files:["dist","miniprogram_dist"],keywords:["sip","websocket","webrtc","node","browser","library","tccc","腾讯云呼叫中心","腾讯云联络中心"],license:"MIT",peerDependencies:{"trtc-js-sdk":"^4.13.0"},dependencies:{debug:"^4.3.1",events:"^3.3.0","sdp-transform":"^2.14.1","trtc-js-sdk":"^4.13.0"},devDependencies:{"@babel/core":"^7.19.6","@babel/plugin-external-helpers":"^7.18.6","@babel/plugin-transform-runtime":"^7.18.10","@babel/preset-env":"^7.19.4","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.208.0","@opentelemetry/exporter-logs-otlp-http":"^0.208.0","@opentelemetry/exporter-trace-otlp-http":"^0.208.0","@opentelemetry/resources":"^2.2.0","@opentelemetry/sdk-logs":"^0.208.0","@opentelemetry/sdk-trace-base":"^2.2.0","@opentelemetry/sdk-trace-web":"^2.2.0","@opentelemetry/semantic-conventions":"^1.38.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^22.0.2","@rollup/plugin-eslint":"^8.0.2","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.4.0","@types/debug":"^4.1.5","@types/node":"^14.14.34","@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","ansi-colors":"^3.2.4",browserify:"^16.5.1","cross-env":"^7.0.3",eslint:"7.32.0","fancy-log":"^1.3.3",gulp:"^4.0.2","gulp-babel":"^8.0.0","gulp-eslint":"^5.0.0","gulp-expect-file":"^1.0.2","gulp-header":"^2.0.9","gulp-nodeunit-runner":"^0.2.2","gulp-plumber":"^1.2.1","gulp-rename":"^1.4.0","gulp-uglify-es":"^1.0.4","lodash.template":"^4.5.0",pegjs:"^0.7.0",rimraf:"^3.0.2",rollup:"^2.79.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-filesize":"^10.0.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-polyfill-node":"^0.10.2","rollup-plugin-progress":"^1.1.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-uglify":"^6.0.4",typescript:"^4.8.2","vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},scripts:{lint:"node npm-scripts.js lint",test:"node npm-scripts.js test",prepublish:"node npm-scripts.js prepublish",release:"node npm-scripts.js release",dev:"cross-env NODE_ENV=development rollup -c rollup.config.js -w",build:"cross-env rimraf dist && rollup -c rollup.config.js && node config/build-package.js",prepublishOnly:"npm run build",grammar:"gulp grammar"},packageManager:"pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"},o=n,i={USER_AGENT:"".concat(o.title," ").concat(o.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,LOG_LEVEL:{TRACE:0,DEBUG:1,WARN:2,ERROR:3,NONE:4}};function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t,r){t=h(t);var n=e,t=m()?Reflect.construct(t,r||[],h(e).constructor):t.apply(e,r);if(!t||"object"!=typeof t&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=n))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function c(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t){var r,n,o,s,i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return o=!(n=!0),{s:function(){i=i.call(e)},n:function(){var e=i.next();return n=e.done,e},e:function(e){o=!0,r=e},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}};if(Array.isArray(e)||(i=T(e))||t&&e&&"number"==typeof e.length)return i&&(e=i),s=0,{s:t=function(){},n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function g(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _(e,t){return(_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(e=>{if(Array.isArray(e))return s(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||T(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function b(e){e=(e=>{if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")})(e);return"symbol"==typeof e?e:e+""}function S(e){return(S="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})(e)}function T(e,t){var r;if(e)return"string"==typeof e?s(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}function w(e){var r="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||!(t=>{try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}})(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return function(e,t,r){var n;return m()?Reflect.construct.apply(null,arguments):((n=[null]).push.apply(n,t),t=new(e.bind.apply(e,n)),r&&_(t,r.prototype),t)}(e,arguments,h(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),_(t,e)})(e)}var E,A,O,x,C,R,N,I=(()=>{function n(e,t){var r;return u(this,n),(r=a(this,n)).code=1,r.name="CONFIGURATION_ERROR",r.parameter=e,r.value=t,r.message=r.value?"Invalid value ".concat(JSON.stringify(r.value),' for parameter "').concat(r.parameter,'"'):"Missing parameter: ".concat(r.parameter),r}return f(n,w(Error)),c(n)})(),P=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).code=2,t.name="INVALID_STATE_ERROR",t.status=e,t.message="Invalid status: ".concat(e),t}return f(r,w(Error)),c(r)})(),U=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).code=3,t.name="NOT_SUPPORTED_ERROR",t.message=e,t}return f(r,w(Error)),c(r)})(),k=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).code=4,t.name="NOT_READY_ERROR",t.message=e,t}return f(r,w(Error)),c(r)})(),L={ConfigurationError:I,InvalidStateError:P,NotSupportedError:U,NotReadyError:k},j={};function D(){var o,t;return A||(A=1,o=V(),t=M(),E=c(s,[{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}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=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){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"clone",value:function(){return new s(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}},{key:"_quote",value:function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var e,t=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"";for(e in t+="<".concat(this._uri.toString(),">"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(t+=";".concat(e),null!==this._parameters[e])&&(t+="=".concat(this._parameters[e]));return t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"Name_Addr_Header"))?e:void 0}}])),E;function s(e,t,r){if(u(this,s),!(e&&e instanceof o))throw new TypeError('missing or invalid "uri" parameter');for(var n in this._uri=e,this._parameters={},this.display_name=t,r)Object.prototype.hasOwnProperty.call(r,n)&&this.setParam(n,r[n])}}function M(){return x||(x=1,(e={parse:function(g,u){var e={CRLF:B,DIGIT:l,ALPHA:i,HEXDIG:a,WSP:c,OCTET:r,DQUOTE:p,SP:h,HTAB:d,alphanum:o,reserved:q,unreserved:n,mark:F,escaped:f,LWS:m,SWS:v,HCOLON:H,TEXT_UTF8_TRIM:G,TEXT_UTF8char:b,UTF8_NONASCII:S,UTF8_CONT:T,LHEX:function(){var e;return null===(e=l())&&(/^[a-f]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-f]"))),e},token:w,token_nodot:z,separators:function(){var e;return 40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),e=null===e&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"')),null===e)&&(60===g.charCodeAt(y)?(e="<",y++):(e=null,_('"<"')),null===e)&&(62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null===e)&&null===(e=p())&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e)&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(123===g.charCodeAt(y)?(e="{",y++):(e=null,_('"{"')),null===e)&&(125===g.charCodeAt(y)?(e="}",y++):(e=null,_('"}"')),null===e)&&null===(e=h())?d():e},word:E,STAR:K,SLASH:Y,EQUAL:A,LPAREN:J,RPAREN:W,RAQUOT:$,LAQUOT:X,COMMA:O,SEMI:x,COLON:Q,LDQUOT:Z,RDQUOT:ee,comment:function e(){var t,r,n,o=y;if(null!==(t=J())){for(r=[],null===(n=te())&&null===(n=R())&&(n=e());null!==n;)r.push(n),null===(n=te())&&null===(n=R())&&(n=e());null!==r&&null!==(n=W())?t=[t,r,n]:(t=null,y=o)}else t=null,y=o;return t},ctext:te,quoted_string:re,quoted_string_clean:C,qdtext:ne,quoted_pair:R,SIP_URI_noparams:oe,SIP_URI:se,uri_scheme:ie,uri_scheme_sips:ae,uri_scheme_sip:ue,userinfo:le,user:ce,user_unreserved:pe,password:he,hostport:de,host:fe,hostname:me,domainlabel:ge,toplabel:ye,IPv6reference:_e,IPv6address:ve,h16:N,ls32:I,IPv4address:be,dec_octet:Se,port:Te,uri_parameters:we,uri_parameter:Ee,transport_param:Ae,user_param:Oe,method_param:xe,ttl_param:Ce,maddr_param:Re,lr_param:Ne,other_param:Ie,pname:Ue,pvalue:ke,paramchar:Pe,param_unreserved:Le,headers:je,header:De,hname:Me,hvalue:Ve,hnv_unreserved:Be,Request_Response:function(){var e;return e=null===(e=gt())?qe():e},Request_Line:qe,Request_URI:Fe,absoluteURI:He,hier_part:Ge,net_path:ze,abs_path:Ke,opaque_part:Ye,uric:Je,uric_no_slash:We,path_segments:$e,segment:Xe,param:Qe,pchar:Ze,scheme:et,authority:tt,srvr:rt,reg_name:nt,query:ot,SIP_Version:st,INVITEm:it,ACKm:at,OPTIONSm:ut,BYEm:lt,CANCELm:ct,REGISTERm:pt,SUBSCRIBEm:ht,NOTIFYm:dt,REFERm:ft,Method:mt,Status_Line:gt,Status_Code:yt,extension_code:_t,Reason_Phrase:vt,Allow_Events:function(){var e,t,r,n,o,s=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Call_ID:function(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(M=g.substring(y,o)):e)&&(y=o),e},Contact:function(){var e,t,r,n,o,s,i=y;if(null===(e=K()))if(o=y,null!==(e=bt())){for(t=[],s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==r;)t.push(r),s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?(()=>{for(var e=M.multi_header.length,t=0;t<e;t++)if(null===M.multi_header[t].parsed){M=null;break}M=null!==M?M.multi_header:-1})():e)&&(y=i),e},contact_param:bt,name_addr:U,display_name:St,contact_params:Tt,c_p_q:wt,c_p_expires:Et,delta_seconds:k,qvalue:At,generic_param:P,gen_value:Ot,Content_Disposition:function(){var e,t,r,n,o,s=y;if(null!==(e=xt())){for(t=[],o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},disp_type:xt,disp_param:Ct,handling_param:Rt,Content_Encoding:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Content_Length:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(M=parseInt(e.join(""))):e)&&(y=r),e},Content_Type:function(){var e,t=y;return null===(e=null!==(e=Nt())?void(M=g.substring(y,t)):e)&&(y=t),e},media_type:Nt,m_type:It,discrete_type:Ut,composite_type:kt,extension_token:Pt,x_token:Lt,m_subtype:jt,m_parameter:Dt,m_value:Mt,CSeq:function(){var e,t,r,n=y;return null!==(e=Vt())&&null!==(t=m())&&null!==(r=mt())?e=[e,t,r]:(e=null,y=n),e},CSeq_value:Vt,Expires:function(){var e,t=y;return null===(e=null!==(e=k())?void(M=e):e)&&(y=t),e},Event:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],e=void(M.event=i.join("").toLowerCase())),null===e&&(y=s),e},event_type:Bt,From:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?U():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=qt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=qt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=M.tag;try{M=new j(M.uri,M.display_name,M.params),e&&M.setParam("tag",e)}catch(e){M=-1}})():e)&&(y=s),e},from_param:qt,tag_param:Ft,Max_Forwards:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(M=parseInt(e.join(""))):e)&&(y=r),e},Min_Expires:function(){var e,t=y;return null===(e=null!==(e=k())?void(M=e):e)&&(y=t),e},Name_Addr_Header:function(){for(var e,t,r,n,o,s,i=y,a=y,u=[],l=St();null!==l;)u.push(l),l=St();if(null!==u)if(null!==(l=X()))if(null!==(e=se()))if(null!==(t=$())){for(r=[],s=y,null!==(n=x())&&null!==(o=P())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,null!==(n=x())&&null!==(o=P())?n=[n,o]:(n=null,y=s);null!==r?u=[u,l,e,t,r]:(u=null,y=a)}else u=null,y=a;else u=null,y=a;else u=null,y=a;else u=null,y=a;return null===(u=null!==u?(()=>{try{M=new j(M.uri,M.display_name,M.params)}catch(e){M=-1}})():u)&&(y=i),u},Proxy_Authenticate:Ht,challenge:Ht,other_challenge:Gt,auth_param:zt,digest_cln:Kt,realm:Yt,realm_value:Jt,domain:Wt,URI:$t,nonce:Xt,nonce_value:Qt,opaque:Zt,stale:er,algorithm:tr,qop_options:rr,qop_value:nr,Proxy_Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Record_Route:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=or())){for(t=[],o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{for(var e=M.multi_header.length,t=0;t<e;t++)if(null===M.multi_header[t].parsed){M=null;break}M=null!==M?M.multi_header:-1})():e)&&(y=s),e},rec_route:or,Reason:function(){var e,t,r,n,o,s=y,i=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],M.protocol=i.toLowerCase(),M.params||(M.params={}),e=void(M.params.text&&'"'===M.params.text[0]&&(i=M.params.text,M.text=i.substring(1,i.length-1),delete M.params.text))),null===e&&(y=s),e},reason_param:sr,reason_cause:ir,Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Route:function(){var e,t,r,n,o,s=y;if(null!==(e=ar())){for(t=[],o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},route_param:ar,Subscription_State:function(){var e,t,r,n,o,s=y;if(null!==(e=ur())){for(t=[],o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},substate_value:ur,subexp_params:lr,event_reason_value:cr,Subject:function(){var e;return null!==(e=G())?e:""},Supported:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null!==e?e:""},To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?U():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=M.tag;try{M=new j(M.uri,M.display_name,M.params),e&&M.setParam("tag",e)}catch(e){M=-1}})():e)&&(y=s),e},to_param:pr,Via:function(){var e,t,r,n,o,s=y;if(null!==(e=hr())){for(t=[],o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},via_param:hr,via_params:dr,via_ttl:fr,via_maddr:mr,via_received:gr,via_branch:yr,response_port:_r,rport:vr,sent_protocol:br,protocol_name:Sr,transport:Tr,sent_by:wr,via_host:Er,via_port:Ar,ttl:Or,WWW_Authenticate:Ht,Session_Expires:function(){var e,t,r,n,o,s=y;if(null!==(e=xr())){for(t=[],o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},s_e_expires:xr,s_e_params:Cr,s_e_refresher:Rr,extension_header:function(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=H())&&null!==(r=Nr())?e=[e,t,r]:(e=null,y=n),e},header_value:Nr,message_body:function(){for(var e=[],t=r();null!==t;)e.push(t),t=r();return e},uuid_URI:function(){var e,t,r=y;return"uuid:"===g.substr(y,5)?(e="uuid:",y+=5):(e=null,_('"uuid:"')),null!==e&&null!==(t=Ir())?e=[e,t]:(e=null,y=r),e},uuid:Ir,hex4:L,hex8:Ur,hex12:kr,Refer_To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?U():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{try{M=new j(M.uri,M.display_name,M.params)}catch(e){M=-1}})():e)&&(y=s),e},Replaces:function(){var e,t,r,n,o,s=y;if(null!==(e=Pr())){for(t=[],o=y,null!==(r=x())&&null!==(n=Lr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Lr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},call_id:Pr,replaces_param:Lr,to_tag:jr,from_tag:Dr,early_flag:Mr};if(void 0!==u){if(void 0===e[u])throw new Error("Invalid rule name: "+Fr(u)+".")}else u="CRLF";var y=0,s=0,t=[];function _(e){y<s||(s<y&&(s=y,t=[]),t.push(e))}function B(){var e;return"\r\n"===g.substr(y,2)?(e="\r\n",y+=2):(e=null,_('"\\r\\n"')),e}function l(){var e;return/^[0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9]")),e}function i(){var e;return/^[a-zA-Z]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z]")),e}function a(){var e;return/^[0-9a-fA-F]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9a-fA-F]")),e}function c(){var e;return e=null===(e=h())?d():e}function r(){var e;return/^[\0-\xFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\0-\\xFF]")),e}function p(){var e;return/^["]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_('["]')),e}function h(){var e;return 32===g.charCodeAt(y)?(e=" ",y++):(e=null,_('" "')),e}function d(){var e;return 9===g.charCodeAt(y)?(e="\t",y++):(e=null,_('"\\t"')),e}function o(){var e;return/^[a-zA-Z0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z0-9]")),e}function q(){var e;return 59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function n(){var e;return e=null===(e=o())?F():e}function F(){var e;return 45===g.charCodeAt(y)?(e="-",y++):(e=null,_('"-"')),null===e&&(95===g.charCodeAt(y)?(e="_",y++):(e=null,_('"_"')),null===e)&&(46===g.charCodeAt(y)?(e=".",y++):(e=null,_('"."')),null===e)&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(126===g.charCodeAt(y)?(e="~",y++):(e=null,_('"~"')),null===e)&&(42===g.charCodeAt(y)?(e="*",y++):(e=null,_('"*"')),null===e)&&(39===g.charCodeAt(y)?(e="'",y++):(e=null,_('"\'"')),null===e)&&(40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),null===e)&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"'))),e}function f(){var e,t,r,n=y,o=y;return 37===g.charCodeAt(y)?(e="%",y++):(e=null,_('"%"')),null!==e&&null!==(t=a())&&null!==(r=a())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?e.join(""):e)&&(y=n),e}function m(){for(var e,t=y,r=y,n=y,o=[],s=c();null!==s;)o.push(s),s=c();if(null!==o&&null!==(s=B())?o=[o,s]:(o=null,y=n),null!==(o=null!==o?o:"")){if(null!==(e=c()))for(s=[];null!==e;)s.push(e),e=c();else s=null;null!==s?o=[o,s]:(o=null,y=r)}else o=null,y=r;return null===(o=null!==o?" ":o)&&(y=t),o}function v(){var e;return null!==(e=m())?e:""}function H(){var e,t,r=y,n=y,o=[];for(null===(e=h())&&(e=d());null!==e;)o.push(e),null===(e=h())&&(e=d());return null!==o&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null!==e)&&null!==(t=v())?o=[o,e,t]:(o=null,y=n),null===(o=null!==o?":":o)&&(y=r),o}function G(){var e,t,r,n,o,s=y,i=y;if(null!==(t=b()))for(e=[];null!==t;)e.push(t),t=b();else e=null;if(null!==e){for(t=[],o=y,r=[],n=m();null!==n;)r.push(n),n=m();for(null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o);null!==r;){for(t.push(r),o=y,r=[],n=m();null!==n;)r.push(n),n=m();null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o)}null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?g.substring(y,s):e)&&(y=s),e}function b(){var e;return/^[!-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-~]")),e=null===e?S():e}function S(){var e;return/^[\x80-\uFFFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\uFFFF]")),e}function T(){var e;return/^[\x80-\xBF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\xBF]")),e}function w(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function z(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function E(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function K(){var e,t,r,n=y,o=y;return null!==(e=v())&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"*":e)&&(y=n),e}function Y(){var e,t,r,n=y,o=y;return null!==(e=v())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"/":e)&&(y=n),e}function A(){var e,t,r,n=y,o=y;return null!==(e=v())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"=":e)&&(y=n),e}function J(){var e,t,r,n=y,o=y;return null!==(e=v())&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"(":e)&&(y=n),e}function W(){var e,t,r,n=y,o=y;return null!==(e=v())&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?")":e)&&(y=n),e}function $(){var e,t,r=y,n=y;return 62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null!==e&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?">":e)&&(y=r),e}function X(){var e,t,r=y,n=y;return null!==(e=v())&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null!==t)?e=[e,t]:(e=null,y=n),null===(e=null!==e?"<":e)&&(y=r),e}function O(){var e,t,r,n=y,o=y;return null!==(e=v())&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?",":e)&&(y=n),e}function x(){var e,t,r,n=y,o=y;return null!==(e=v())&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?";":e)&&(y=n),e}function Q(){var e,t,r,n=y,o=y;return null!==(e=v())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?":":e)&&(y=n),e}function Z(){var e,t,r=y,n=y;return null!==(e=v())&&null!==(t=p())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function ee(){var e,t,r=y,n=y;return null!==(e=p())&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function te(){var e;return/^[!-']/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-']")),e=null===e&&(/^[*-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[*-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)&&null===(e=S())?m():e}function re(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(t=p())){for(r=[],null===(n=ne())&&(n=R());null!==n;)r.push(n),null===(n=ne())&&(n=R());null!==r&&null!==(n=p())?e=[e,t,r,n]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?g.substring(y,o):e)&&(y=o),e}function C(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(n=p())){for(t=[],null===(r=ne())&&(r=R());null!==r;)t.push(r),null===(r=ne())&&(r=R());null!==t&&null!==(r=p())?e=[e,n,t,r]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?(n=g.substring(y,o).trim()).substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1"):e)&&(y=o),e}function ne(){var e;return e=null===(e=m())&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(/^[#-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[#-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)?S():e}function R(){var e,t,r=y;return 92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null!==e&&(/^[\0-\t]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\0-\\t]")),null===t&&(/^[\x0B-\f]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0B-\\f]")),null===t)&&(/^[\x0E-]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0E-]"))),null!==t)?e=[e,t]:(e=null,y=r),e}function oe(){var e,t,r,n,o=y,s=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())?e=[e,t,r,n]:(e=null,y=s),null===(e=null!==e?(()=>{try{M.uri=new qr(M.scheme,M.user,M.host,M.port),delete M.scheme,delete M.user,delete M.host,delete M.host_type,delete M.port}catch(e){M=-1}})():e)&&(y=o),e}function se(){var e,t,r,n,o,s,i=y,a=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())&&null!==(o=we())&&null!==(s=null!==(s=je())?s:"")?e=[e,t,r,n,o,s]:(e=null,y=a),null===(e=null!==e?(()=>{try{M.uri=new qr(M.scheme,M.user,M.host,M.port,M.uri_params,M.uri_headers),delete M.scheme,delete M.user,delete M.host,delete M.host_type,delete M.port,delete M.uri_params,"SIP_URI"===u&&(M=M.uri)}catch(e){M=-1}})():e)&&(y=i),e}function ie(){var e;return e=null===(e=ae())?ue():e}function ae(){var e,t,r=y;return"sips"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"sips"')),null!==e&&(t=e,e=void(M.scheme=t.toLowerCase())),null===e&&(y=r),e}function ue(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"sip"')),null!==e&&(t=e,e=void(M.scheme=t.toLowerCase())),null===e&&(y=r),e}function le(){var e,t,r,n,o=y,s=y;return null!==(e=ce())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=he())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))&&(64===g.charCodeAt(y)?(r="@",y++):(r=null,_('"@"')),null!==r)?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(M.user=decodeURIComponent(g.substring(y-1,o))):e)&&(y=o),e}function ce(){var e,t;if(null!==(t=null===(t=n())&&null===(t=f())?pe():t))for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(t=pe());else e=null;return e}function pe(){var e;return 38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"'))),e}function he(){var e,t=y,r=[];for(null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));null!==e;)r.push(e),null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));return null===(r=null!==r?void(M.password=g.substring(y,t)):r)&&(y=t),r}function de(){var e,t,r,n,o=y;return null!==(e=fe())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=Te())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function fe(){var e,t=y;return null!==(e=null===(e=me())&&null===(e=be())?_e():e)&&(M.host=g.substring(y,t).toLowerCase(),e=M.host),null===e&&(y=t),e}function me(){var e,t,r=y,n=y,o=[],s=y;for(null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);null!==e;)o.push(e),s=y,null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);return null!==o&&null!==(e=ye())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==(t=null!==t?t:""))?o=[o,e,t]:(o=null,y=n),null!==o&&(n=r,M.host_type="domain",o=g.substring(y,n)),null===o&&(y=r),o}function ge(){var e,t,r,n=y;if(null!==(e=o())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function ye(){var e,t,r,n=y;if(null!==(e=i())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function _e(){var e,t,r,n=y,o=y;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null!==e&&null!==(r=ve())&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=n,M.host_type="IPv6",e=g.substring(y,r)),null===e&&(y=n),e}function ve(){var e,t,r,n,o,s,i,a,u,l,c,p,h,d,f=y,m=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=N())&&(58===g.charCodeAt(y)?(p=":",y++):(p=null,_('":"')),null!==p)&&null!==(d=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p,d]:(e=null,y=m),null===e&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=N())&&(58===g.charCodeAt(y)?(c=":",y++):(c=null,_('":"')),null!==c)&&null!==(p=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=I())?e=[e,t,r,n,o,s]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=I())?e=[e,t,r,n]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=I())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&("::"===g.substr(y,2)?(t="::",y+=2):(t=null,_('"::"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=I())?e=[e,t,r,n,o,s,i,a,u,l,c]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&("::"===g.substr(y,2)?(r="::",y+=2):(r=null,_('"::"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&("::"===g.substr(y,2)?(n="::",y+=2):(n=null,_('"::"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=I())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&("::"===g.substr(y,2)?(o="::",y+=2):(o=null,_('"::"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&("::"===g.substr(y,2)?(s="::",y+=2):(s=null,_('"::"')),null!==s)&&null!==(i=I())?e=[e,t,r,n,o,s,i]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&("::"===g.substr(y,2)?(i="::",y+=2):(i=null,_('"::"')),null!==i)&&null!==(a=N())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&(h=y,58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i&&null!==(a=N())?i=[i,a]:(i=null,y=h),null!==(i=null!==i?i:""))&&("::"===g.substr(y,2)?(a="::",y+=2):(a=null,_('"::"')),null!==a)?e=[e,t,r,n,o,s,i,a]:(e=null,y=m)),null!==e&&(d=f,M.host_type="IPv6",e=g.substring(y,d)),null===e&&(y=f),e}function N(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=null!==(t=a())?t:"")&&null!==(r=null!==(r=a())?r:"")&&null!==(n=null!==(n=a())?n:"")?e=[e,t,r,n]:(e=null,y=o),e}function I(){var e,t,r,n=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())?e=[e,t,r]:(e=null,y=n),e=null===e?be():e}function be(){var e,t,r,n,o,s,i,a=y,u=y;return null!==(e=Se())&&(46===g.charCodeAt(y)?(i=".",y++):(i=null,_('"."')),null!==i)&&null!==(t=Se())&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r)&&null!==(n=Se())&&(46===g.charCodeAt(y)?(o=".",y++):(o=null,_('"."')),null!==o)&&null!==(s=Se())?e=[e,i,t,r,n,o,s]:(e=null,y=u),null!==e&&(i=a,M.host_type="IPv4",e=g.substring(y,i)),null===e&&(y=a),e}function Se(){var e,t,r,n=y;return"25"===g.substr(y,2)?(e="25",y+=2):(e=null,_('"25"')),null!==e&&(/^[0-5]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-5]")),null!==t)?e=[e,t]:(e=null,y=n),e=null===e&&(n=y,50===g.charCodeAt(y)?(e="2",y++):(e=null,_('"2"')),null!==e&&(/^[0-4]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-4]")),null!==t)&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,49===g.charCodeAt(y)?(e="1",y++):(e=null,_('"1"')),null!==e&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,/^[1-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[1-9]")),null!==e&&null!==(t=l())?e=[e,t]:(e=null,y=n),null===e)?l():e}function Te(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,o=parseInt(o.join("")),e=M.port=o),null===e&&(y=s),e}function we(){var e,t,r=[],n=y;for(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);null!==e;)r.push(e),n=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);return r}function Ee(){var e;return e=null===(e=Ae())&&null===(e=Oe())&&null===(e=xe())&&null===(e=Ce())&&null===(e=Re())&&null===(e=Ne())?Ie():e}function Ae(){var e,t,r=y,n=y;return"transport="===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"transport="')),null!==e&&("udp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"udp"')),null!==(t=null===t&&("tcp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tcp"')),null===t)&&("sctp"===g.substr(y,4).toLowerCase()?(t=g.substr(y,4),y+=4):(t=null,_('"sctp"')),null===t)&&("tls"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tls"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],M.uri_params||(M.uri_params={}),e=void(M.uri_params.transport=t.toLowerCase())),null===e&&(y=r),e}function Oe(){var e,t,r=y,n=y;return"user="===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"user="')),null!==e&&("phone"===g.substr(y,5).toLowerCase()?(t=g.substr(y,5),y+=5):(t=null,_('"phone"')),null!==(t=null===t&&("ip"===g.substr(y,2).toLowerCase()?(t=g.substr(y,2),y+=2):(t=null,_('"ip"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],M.uri_params||(M.uri_params={}),e=void(M.uri_params.user=t.toLowerCase())),null===e&&(y=r),e}function xe(){var e,t,r=y,n=y;return"method="===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"method="')),null!==e&&null!==(t=mt())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],M.uri_params||(M.uri_params={}),e=void(M.uri_params.method=t)),null===e&&(y=r),e}function Ce(){var e,t,r=y,n=y;return"ttl="===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"ttl="')),null!==e&&null!==(t=Or())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],M.params||(M.params={}),e=void(M.params.ttl=t)),null===e&&(y=r),e}function Re(){var e,t,r=y,n=y;return"maddr="===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"maddr="')),null!==e&&null!==(t=fe())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],M.uri_params||(M.uri_params={}),e=void(M.uri_params.maddr=t)),null===e&&(y=r),e}function Ne(){var e,t,r,n,o=y,s=y;return"lr"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"lr"')),null!==e&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=w())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(M.uri_params||(M.uri_params={}),e=void(M.uri_params.lr=void 0)),null===e&&(y=o),e}function Ie(){var e,t,r,n,o=y,s=y;return null!==(e=Ue())&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=ke())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],M.uri_params||(M.uri_params={}),n=void 0===n?void 0:n[1],e=void(M.uri_params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Ue(){var e,t,r=y;if(null!==(t=Pe()))for(e=[];null!==t;)e.push(t),t=Pe();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function ke(){var e,t,r=y;if(null!==(t=Pe()))for(e=[];null!==t;)e.push(t),t=Pe();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function Pe(){var e;return e=null===(e=Le())&&null===(e=n())?f():e}function Le(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function je(){var e,t,r,n,o,s,i=y;if(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null!==e)if(null!==(t=De())){for(r=[],s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=De())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=De())?n=[n,o]:(n=null,y=s);null!==r?e=[e,t,r]:(e=null,y=i)}else e=null,y=i;else e=null,y=i;return e}function De(){var e,t,r,n=y,o=y;return null!==(e=Me())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=Ve())?e=[e,t,r]:(e=null,y=o),null!==e&&(t=e[0],r=e[2],t=t.join("").toLowerCase(),r=r.join(""),M.uri_headers||(M.uri_headers={}),e=void(M.uri_headers[t]?M.uri_headers[t].push(r):M.uri_headers[t]=[r])),null===e&&(y=n),e}function Me(){var e,t;if(null!==(t=null===(t=Be())&&null===(t=n())?f():t))for(e=[];null!==t;)e.push(t),null===(t=Be())&&null===(t=n())&&(t=f());else e=null;return e}function Ve(){var e,t=[];for(null===(e=Be())&&null===(e=n())&&(e=f());null!==e;)t.push(e),null===(e=Be())&&null===(e=n())&&(e=f());return t}function Be(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function qe(){var e,t,r,n,o,s=y;return null!==(e=mt())&&null!==(t=h())&&null!==(r=Fe())&&null!==(n=h())&&null!==(o=st())?e=[e,t,r,n,o]:(e=null,y=s),e}function Fe(){var e;return e=null===(e=se())?He():e}function He(){var e,t,r,n=y;return null!==(e=et())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null===(r=Ge())?Ye():r)?e=[e,t,r]:(e=null,y=n),e}function Ge(){var e,t,r,n,o=y;return null!==(e=null===(e=ze())?Ke():e)&&(n=y,63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null!==t&&null!==(r=ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function ze(){var e,t,r,n=y;return"//"===g.substr(y,2)?(e="//",y+=2):(e=null,_('"//"')),null!==e&&null!==(t=tt())&&null!==(r=null!==(r=Ke())?r:"")?e=[e,t,r]:(e=null,y=n),e}function Ke(){var e,t,r=y;return 47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null!==e&&null!==(t=$e())?e=[e,t]:(e=null,y=r),e}function Ye(){var e,t,r,n=y;if(null!==(e=We())){for(t=[],r=Je();null!==r;)t.push(r),r=Je();null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function Je(){var e;return e=null===(e=q())&&null===(e=n())?f():e}function We(){var e;return null===(e=n())&&null===(e=f())&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function $e(){var e,t,r,n,o,s=y;if(null!==(e=Xe())){for(t=[],o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=Xe())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=Xe())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function Xe(){for(var e,t,r,n=y,o=[],s=Ze();null!==s;)o.push(s),s=Ze();if(null!==o){for(s=[],r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==e;)s.push(e),r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==s?o=[o,s]:(o=null,y=n)}else o=null,y=n;return o}function Qe(){for(var e=[],t=Ze();null!==t;)e.push(t),t=Ze();return e}function Ze(){var e;return null===(e=n())&&null===(e=f())&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function et(){var e,t,r,n=y,o=y;if(null!==(e=i())){for(t=[],null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==r;)t.push(r),null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?void(M.scheme=g.substring(y,n)):e)&&(y=n),e}function tt(){var e;return e=null===(e=rt())?nt():e}function rt(){var e,t,r=y,n=y;return null!==(e=le())&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t)?e=[e,t]:(e=null,y=n),null!==(e=null!==e?e:"")&&null!==(t=de())?e=[e,t]:(e=null,y=r),null!==e?e:""}function nt(){var e,t;if(null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')));else e=null;return e}function ot(){for(var e=[],t=Je();null!==t;)e.push(t),t=Je();return e}function st(){var e,t,r,n,o,s,i=y,a=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==e)if(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t){if(null!==(n=l()))for(r=[];null!==n;)r.push(n),n=l();else r=null;if(null!==r)if(46===g.charCodeAt(y)?(n=".",y++):(n=null,_('"."')),null!==n){if(null!==(s=l()))for(o=[];null!==s;)o.push(s),s=l();else o=null;null!==o?e=[e,t,r,n,o]:(e=null,y=a)}else e=null,y=a;else e=null,y=a}else e=null,y=a;else e=null,y=a;return null===(e=null!==e?void(M.sip_version=g.substring(y,i)):e)&&(y=i),e}function it(){var e;return"INVITE"===g.substr(y,6)?(e="INVITE",y+=6):(e=null,_('"INVITE"')),e}function at(){var e;return"ACK"===g.substr(y,3)?(e="ACK",y+=3):(e=null,_('"ACK"')),e}function ut(){var e;return"OPTIONS"===g.substr(y,7)?(e="OPTIONS",y+=7):(e=null,_('"OPTIONS"')),e}function lt(){var e;return"BYE"===g.substr(y,3)?(e="BYE",y+=3):(e=null,_('"BYE"')),e}function ct(){var e;return"CANCEL"===g.substr(y,6)?(e="CANCEL",y+=6):(e=null,_('"CANCEL"')),e}function pt(){var e;return"REGISTER"===g.substr(y,8)?(e="REGISTER",y+=8):(e=null,_('"REGISTER"')),e}function ht(){var e;return"SUBSCRIBE"===g.substr(y,9)?(e="SUBSCRIBE",y+=9):(e=null,_('"SUBSCRIBE"')),e}function dt(){var e;return"NOTIFY"===g.substr(y,6)?(e="NOTIFY",y+=6):(e=null,_('"NOTIFY"')),e}function ft(){var e;return"REFER"===g.substr(y,5)?(e="REFER",y+=5):(e=null,_('"REFER"')),e}function mt(){var e,t=y;return null!==(e=null===(e=it())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&null===(e=ct())&&null===(e=pt())&&null===(e=ht())&&null===(e=dt())&&null===(e=ft())?w():e)&&(M.method=g.substring(y,t),e=M.method),null===e&&(y=t),e}function gt(){var e,t,r,n,o,s=y;return null!==(e=st())&&null!==(t=h())&&null!==(r=yt())&&null!==(n=h())&&null!==(o=vt())?e=[e,t,r,n,o]:(e=null,y=s),e}function yt(){var e,t,r=y;return null!==(e=_t())&&(t=e,e=void(M.status_code=parseInt(t.join("")))),null===e&&(y=r),e}function _t(){var e,t,r,n=y;return null!==(e=l())&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),e}function vt(){var e,t=y,r=[];for(null===(e=q())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=h())&&(e=d());null!==e;)r.push(e),null===(e=q())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=h())&&(e=d());return null===(r=null!==r?void(M.reason_phrase=g.substring(y,t)):r)&&(y=t),r}function bt(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?U():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Tt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Tt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;M.multi_header||(M.multi_header=[]);try{t=new j(M.uri,M.display_name,M.params),delete M.uri,delete M.display_name,delete M.params}catch(e){t=null}M.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function U(){var e,t,r,n,o=y;return null!==(e=null!==(e=St())?e:"")&&null!==(t=X())&&null!==(r=se())&&null!==(n=$())?e=[e,t,r,n]:(e=null,y=o),e}function St(){var e,t,r,n,o,s=y,i=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==(e=null===e?C():e)&&(i=e,e=void(M.display_name="string"==typeof i?i:i[1].reduce(function(e,t){return e+t[0]+t[1]},i[0]))),null===e&&(y=s),e}function Tt(){var e;return e=null===(e=wt())&&null===(e=Et())?P():e}function wt(){var e,t,r,n=y,o=y;return"q"===g.substr(y,1).toLowerCase()?(e=g.substr(y,1),y++):(e=null,_('"q"')),null!==e&&null!==(r=A())&&null!==(t=At())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],M.params||(M.params={}),e=void(M.params.q=r)),null===e&&(y=n),e}function Et(){var e,t,r,n=y,o=y;return"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(r=A())&&null!==(t=k())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],M.params||(M.params={}),e=void(M.params.expires=r)),null===e&&(y=n),e}function k(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?parseInt(e.join("")):e)&&(y=r),e}function At(){var e,t,r,n,o,s,i=y,a=y;return 48===g.charCodeAt(y)?(e="0",y++):(e=null,_('"0"')),null!==e&&(s=y,46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(o=null!==(o=l())?o:"")?t=[t,r,n,o]:(t=null,y=s),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=a),null===(e=null!==e?parseFloat(g.substring(y,i)):e)&&(y=i),e}function P(){var e,t,r,n,o=y,s=y;return null!==(e=w())&&(n=y,null!==(t=A())&&null!==(r=Ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],M.params||(M.params={}),n=void 0===n?void 0:n[1],e=void(M.params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Ot(){var e;return e=null===(e=w())&&null===(e=fe())?re():e}function xt(){var e;return"render"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"render"')),e=null===e&&("session"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"session"')),null===e)&&("icon"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"icon"')),null===e)&&("alert"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"alert"')),null===e)?w():e}function Ct(){var e;return e=null===(e=Rt())?P():e}function Rt(){var e,t,r,n=y;return"handling"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"handling"')),null!==e&&null!==(t=A())&&("optional"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"optional"')),null!==(r=null===r&&("required"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"required"')),null===r)?w():r))?e=[e,t,r]:(e=null,y=n),e}function Nt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=It()))if(null!==(t=Y()))if(null!==(r=jt())){for(n=[],i=y,null!==(o=x())&&null!==(s=Dt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=Dt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function It(){var e;return e=null===(e=Ut())?kt():e}function Ut(){var e;return"text"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"text"')),e=null===e&&("image"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"image"')),null===e)&&("audio"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"audio"')),null===e)&&("video"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"video"')),null===e)&&("application"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"application"')),null===e)?Pt():e}function kt(){var e;return"message"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"message"')),e=null===e&&("multipart"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"multipart"')),null===e)?Pt():e}function Pt(){var e;return e=null===(e=w())?Lt():e}function Lt(){var e,t,r=y;return"x-"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"x-"')),null!==e&&null!==(t=w())?e=[e,t]:(e=null,y=r),e}function jt(){var e;return e=null===(e=Pt())?w():e}function Dt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=Mt())?e=[e,t,r]:(e=null,y=n),e}function Mt(){var e;return e=null===(e=w())?re():e}function Vt(){var e,t,r,n=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(r=e,e=void(M.value=parseInt(r.join("")))),null===e&&(y=n),e}function Bt(){var e,t,r,n,o,s=y;if(null!==(e=z())){for(t=[],o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=z())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=z())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function qt(){var e;return e=null===(e=Ft())?P():e}function Ft(){var e,t,r,n=y,o=y;return"tag"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.tag=r)),null===e&&(y=n),e}function Ht(){var e,t,r,n,o,s,i,a=y;if("digest"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"Digest"')),null!==e)if(null!==(t=m()))if(null!==(r=Kt())){for(n=[],i=y,null!==(o=O())&&null!==(s=Kt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=Kt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e=null===e?Gt():e}function Gt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=w()))if(null!==(t=m()))if(null!==(r=zt())){for(n=[],i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function zt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=null===(r=w())?re():r)?e=[e,t,r]:(e=null,y=n),e}function Kt(){var e;return e=null===(e=Yt())&&null===(e=Wt())&&null===(e=Xt())&&null===(e=Zt())&&null===(e=er())&&null===(e=tr())&&null===(e=rr())?zt():e}function Yt(){var e,t,r,n=y;return"realm"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"realm"')),null!==e&&null!==(t=A())&&null!==(r=Jt())?e=[e,t,r]:(e=null,y=n),e}function Jt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(M.realm=t)),null===e&&(y=r),e}function Wt(){var e,t,r,n,o,s,i,a,u=y;if("domain"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"domain"')),null!==e)if(null!==(t=A()))if(null!==(r=Z()))if(null!==(n=$t())){if(o=[],a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;for(null!==s&&null!==(i=$t())?s=[s,i]:(s=null,y=a);null!==s;){if(o.push(s),a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;null!==s&&null!==(i=$t())?s=[s,i]:(s=null,y=a)}null!==o&&null!==(s=ee())?e=[e,t,r,n,o,s]:(e=null,y=u)}else e=null,y=u;else e=null,y=u;else e=null,y=u;else e=null,y=u;return e}function $t(){var e;return e=null===(e=He())?Ke():e}function Xt(){var e,t,r,n=y;return"nonce"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"nonce"')),null!==e&&null!==(t=A())&&null!==(r=Qt())?e=[e,t,r]:(e=null,y=n),e}function Qt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(M.nonce=t)),null===e&&(y=r),e}function Zt(){var e,t,r,n=y,o=y;return"opaque"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"opaque"')),null!==e&&null!==(r=A())&&null!==(t=C())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.opaque=r)),null===e&&(y=n),e}function er(){var e,t,r,n,o=y;return"stale"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"stale"')),null!==e&&null!==(t=A())&&(n=y,"true"===g.substr(y,4).toLowerCase()?(r=g.substr(y,4),y+=4):(r=null,_('"true"')),null===(r=null!==r?void(M.stale=!0):r)&&(y=n),null===r&&(n=y,"false"===g.substr(y,5).toLowerCase()?(r=g.substr(y,5),y+=5):(r=null,_('"false"')),null===(r=null!==r?void(M.stale=!1):r))&&(y=n),null!==r)?e=[e,t,r]:(e=null,y=o),e}function tr(){var e,t,r,n=y,o=y;return"algorithm"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"algorithm"')),null!==e&&null!==(r=A())&&("md5"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"MD5"')),null!==(t=null===t&&("md5-sess"===g.substr(y,8).toLowerCase()?(t=g.substr(y,8),y+=8):(t=null,_('"MD5-sess"')),null===t)?w():t))?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.algorithm=r.toUpperCase())),null===e&&(y=n),e}function rr(){var e,t,r,n,o,s,i,a,u,l=y;if("qop"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"qop"')),null!==e)if(null!==(t=A()))if(null!==(r=Z())){if(a=y,null!==(n=nr())){for(o=[],u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==s;)o.push(s),u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==o?n=[n,o]:(n=null,y=a)}else n=null,y=a;null!==n&&null!==(o=ee())?e=[e,t,r,n,o]:(e=null,y=l)}else e=null,y=l;else e=null,y=l;else e=null,y=l;return e}function nr(){var e,t,r=y;return"auth-int"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"auth-int"')),null!==(e=null===e&&("auth"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"auth"')),null===e)?w():e)&&(t=e,M.qop||(M.qop=[]),e=void M.qop.push(t.toLowerCase())),null===e&&(y=r),e}function or(){var e,t,r,n,o,s=y,i=y;if(null!==(e=U())){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;M.multi_header||(M.multi_header=[]);try{t=new j(M.uri,M.display_name,M.params),delete M.uri,delete M.display_name,delete M.params}catch(e){t=null}M.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function sr(){var e;return e=null===(e=ir())?P():e}function ir(){var e,t,r,n,o=y,s=y;if("cause"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"cause"')),null!==e)if(null!==(n=A())){if(null!==(r=l()))for(t=[];null!==r;)t.push(r),r=l();else t=null;null!==t?e=[e,n,t]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null!==e&&(n=e[2],e=void(M.cause=parseInt(n.join("")))),null===e&&(y=o),e}function ar(){var e,t,r,n,o,s=y;if(null!==(e=U())){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function ur(){var e,t=y;return"active"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"active"')),null===(e=null!==(e=null===e&&("pending"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"pending"')),null===e)&&("terminated"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"terminated"')),null===e)?w():e)?void(M.state=g.substring(y,t)):e)&&(y=t),e}function lr(){var e,t,r,n,o=y,s=y;return"reason"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"reason"')),null!==e&&null!==(t=A())&&null!==(r=cr())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(M.reason=n)):e)&&(y=o),e=null===e&&(s=o=y,"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(t=A())&&null!==(r=k())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(M.expires=n)):e)&&(y=o),null===e)&&(s=o=y,"retry_after"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"retry_after"')),null!==e&&null!==(t=A())&&null!==(r=k())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(M.retry_after=n)):e)&&(y=o),null===e)?P():e}function cr(){var e;return"deactivated"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"deactivated"')),e=null===e&&("probation"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"probation"')),null===e)&&("rejected"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"rejected"')),null===e)&&("timeout"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"timeout"')),null===e)&&("giveup"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"giveup"')),null===e)&&("noresource"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"noresource"')),null===e)&&("invariant"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"invariant"')),null===e)?w():e}function pr(){var e;return e=null===(e=Ft())?P():e}function hr(){var e,t,r,n,o,s,i,a=y;if(null!==(e=br()))if(null!==(t=m()))if(null!==(r=wr())){for(n=[],i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function dr(){var e;return e=null===(e=fr())&&null===(e=mr())&&null===(e=gr())&&null===(e=yr())&&null===(e=_r())?P():e}function fr(){var e,t,r,n=y,o=y;return"ttl"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"ttl"')),null!==e&&null!==(r=A())&&null!==(t=Or())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.ttl=r)),null===e&&(y=n),e}function mr(){var e,t,r,n=y,o=y;return"maddr"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"maddr"')),null!==e&&null!==(r=A())&&null!==(t=fe())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.maddr=r)),null===e&&(y=n),e}function gr(){var e,t,r,n=y,o=y;return"received"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"received"')),null!==e&&null!==(r=A())&&null!==(t=null===(t=be())?ve():t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.received=r)),null===e&&(y=n),e}function yr(){var e,t,r,n=y,o=y;return"branch"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"branch"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.branch=r)),null===e&&(y=n),e}function _r(){var e,t,r,n,o=y;return"rport"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"rport"')),null!==e&&(n=y,null!==(t=A())&&null!==(r=vr())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function vr(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(M.rport=parseInt(o.join("")))),null===e&&(y=s),e}function br(){var e,t,r,n,o,s=y;return null!==(e=Sr())&&null!==(t=Y())&&null!==(r=w())&&null!==(n=Y())&&null!==(o=Tr())?e=[e,t,r,n,o]:(e=null,y=s),e}function Sr(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)&&(t=e,e=void(M.protocol=t)),null===e&&(y=r),e}function Tr(){var e,t,r=y;return"udp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"UDP"')),null!==(e=null===e&&("tcp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TCP"')),null===e)&&("tls"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TLS"')),null===e)&&("sctp"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"SCTP"')),null===e)?w():e)&&(t=e,e=void(M.transport=t)),null===e&&(y=r),e}function wr(){var e,t,r,n,o=y;return null!==(e=Er())&&(n=y,null!==(t=Q())&&null!==(r=Ar())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function Er(){var e,t=y;return null===(e=null!==(e=null===(e=be())&&null===(e=_e())?me():e)?void(M.host=g.substring(y,t)):e)&&(y=t),e}function Ar(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(M.port=parseInt(o.join("")))),null===e&&(y=s),e}function Or(){var e,t,r,n=y,o=y;return null!==(e=l())&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?parseInt(e.join("")):e)&&(y=n),e}function xr(){var e,t,r=y;return null!==(e=k())&&(t=e,e=void(M.expires=t)),null===e&&(y=r),e}function Cr(){var e;return e=null===(e=Rr())?P():e}function Rr(){var e,t,r,n=y,o=y;return"refresher"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"refresher"')),null!==e&&null!==(r=A())&&("uac"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uac"')),null===t&&("uas"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uas"'))),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.refresher=r.toLowerCase())),null===e&&(y=n),e}function Nr(){var e,t=[];for(null===(e=b())&&null===(e=T())&&(e=m());null!==e;)t.push(e),null===(e=b())&&null===(e=T())&&(e=m());return t}function Ir(){var e,t,r,n,o,s,i,a,u,l=y,c=y;return null!==(e=Ur())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null!==t)&&null!==(r=L())&&(45===g.charCodeAt(y)?(n="-",y++):(n=null,_('"-"')),null!==n)&&null!==(o=L())&&(45===g.charCodeAt(y)?(s="-",y++):(s=null,_('"-"')),null!==s)&&null!==(i=L())&&(45===g.charCodeAt(y)?(a="-",y++):(a=null,_('"-"')),null!==a)&&null!==(u=kr())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=c),null!==e&&(e[0],e=void(M=g.substring(y+5,l))),null===e&&(y=l),e}function L(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=a())&&null!==(r=a())&&null!==(n=a())?e=[e,t,r,n]:(e=null,y=o),e}function Ur(){var e,t,r=y;return null!==(e=L())&&null!==(t=L())?e=[e,t]:(e=null,y=r),e}function kr(){var e,t,r,n=y;return null!==(e=L())&&null!==(t=L())&&null!==(r=L())?e=[e,t,r]:(e=null,y=n),e}function Pr(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(M.call_id=g.substring(y,o)):e)&&(y=o),e}function Lr(){var e;return e=null===(e=jr())&&null===(e=Dr())&&null===(e=Mr())?P():e}function jr(){var e,t,r,n=y,o=y;return"to-tag"===g.substr(y,6)?(e="to-tag",y+=6):(e=null,_('"to-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.to_tag=r)),null===e&&(y=n),e}function Dr(){var e,t,r,n=y,o=y;return"from-tag"===g.substr(y,8)?(e="from-tag",y+=8):(e=null,_('"from-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(M.from_tag=r)),null===e&&(y=n),e}function Mr(){var e,t=y;return"early-only"===g.substr(y,10)?(e="early-only",y+=10):(e=null,_('"early-only"')),null===(e=null!==e?void(M.early_only=!0):e)&&(y=t),e}var Vr,Br,qr=V(),j=D(),M={};return null===e[u]()||y!==g.length?(Vr=(e=Math.max(y,s))<g.length?g.charAt(e):null,Br=(()=>{for(var e=1,t=1,r=!1,n=0;n<Math.max(y,s);n++)var o=g.charAt(n),r="\n"===o?(r||e++,!(t=1)):"\r"===o||"\u2028"===o||"\u2029"===o?(e++,t=1,!0):(t++,!1);return{line:e,column:t}})(),new this.SyntaxError((e=>{e.sort();for(var t=null,r=[],n=0;n<e.length;n++)e[n]!==t&&(r.push(e[n]),t=e[n]);return r})(t),Vr,e,Br.line,Br.column),-1):M},toSource:function(){return this._source},SyntaxError:function(e,t,r,n,o){this.name="SyntaxError",this.expected=e,this.found=t,this.message=((e,t)=>{var r;switch(e.length){case 0:r="end of input";break;case 1:r=e[0];break;default:r=e.slice(0,e.length-1).join(", ")+" or "+e[e.length-1]}return"Expected "+r+" but "+(t?Fr(t):"end of input")+" found."})(e,t),this.offset=r,this.line=n,this.column=o}}).SyntaxError.prototype=Error.prototype,O=e),O;function Fr(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 e}function V(){var l,a,t;return R||(R=1,l=i,a=B(),t=M(),C=c(h,[{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}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=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){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[a.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[a.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(a.headerize(e))}},{key:"deleteHeader",value:function(e){var t;if(e=a.headerize(e),this._headers.hasOwnProperty(e))return t=this._headers[e],delete this._headers[e],t}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new h(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,r=[],n="".concat(this._scheme,":");for(e in this._user&&(n+="".concat(a.escapeUser(this._user),"@")),n+=this._host,!this._port&&0!==this._port||(n+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(n+=";".concat(e),null!==this._parameters[e])&&(n+="=".concat(this._parameters[e]));for(t in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,t)){var o,s=p(this._headers[t]);try{for(s.s();!(o=s.n()).done;){var i=o.value;r.push("".concat(t,"=").concat(i))}}catch(r){s.e(r)}finally{s.f()}}return 0<r.length&&(n+="?".concat(r.join("&"))),n}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(a.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"SIP_URI"))?e:void 0}}])),C;function h(e,t,r,n){var o,s,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{};if(u(this,h),!r)throw new TypeError('missing or invalid "host" parameter');for(o in this._parameters={},this._headers={},this._scheme=e||l.SIP,this._user=t,this._host=r,this._port=n,i)Object.prototype.hasOwnProperty.call(i,o)&&this.setParam(o,i[o]);for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&this.setHeader(s,a[s])}}function B(){var s,a,t,u,e,l;return N||(N=1,s=i,a=V(),t=M(),j.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},u=j.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},j.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},j.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},j.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},j.hasMethods=function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var o=0,s=r;o<s.length;o++){var i=s[o];if(u(e[i]))return!1}return!0},e=j.createRandomToken=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32,r="",n=0;n<e;n++)r+=(Math.random()*t|0).toString(t);return r},j.newTag=function(){return e(10)},j.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},j.hostType=function(e){return e&&-1!==(e=t.parse(e,"host"))?e.host_type:void 0},l=j.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},j.normalizeTarget=function(e,t){if(e){if(e instanceof a)return e;if("string"==typeof e){var r,n,o=e.split("@");switch(o.length){case 1:if(!t)return;r=e,n=t;break;case 2:r=o[0],n=o[1];break;default:r=o.slice(0,o.length-1).join("@"),n=o[o.length-1]}return r=r.replace(/^(sips?|tel):/i,""),/^[-.()]*\+?[0-9\-.()]+$/.test(r)&&(r=r.replace(/[-.()]/g,"")),e="".concat(s.SIP,":").concat(l(r),"@").concat(n),a.parse(e)||void 0}}},j.headerize=function(e){for(var t={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),n="",o=r.length,s=0;s<o;s++)0!==s&&(n+="-"),n+=r[s].charAt(0).toUpperCase()+r[s].substring(1);return n=t[n]?t[n]:n},j.sipErrorCause=function(e){for(var t in s.SIP_ERROR_CAUSES)if(-1!==s.SIP_ERROR_CAUSES[t].indexOf(e))return s.causes[t];return s.causes.SIP_FAILURE_CODE},j.getRandomTestNetIP=function(){return"192.0.2.".concat(Math.floor(254*Math.random()+1))},j.calculateMD5=function(e){function a(e,t){return e<<t|e>>>32-t}function u(e,t){var r=2147483648&e,n=2147483648&t,o=1073741824&e,s=1073741824&t,e=(1073741823&e)+(1073741823&t);return o&s?2147483648^e^r^n:o|s?1073741824&e?3221225472^e^r^n:1073741824^e^r^n:e^r^n}function t(e,t,r,n,o,s,i){return e=u(e,u(u(t&r|~t&n,o),i)),u(a(e,s),t)}function r(e,t,r,n,o,s,i){return e=u(e,u(u(t&n|r&~n,o),i)),u(a(e,s),t)}function n(e,t,r,n,o,s,i){return e=u(e,u(u(t^r^n,o),i)),u(a(e,s),t)}function o(e,t,r,n,o,s,i){return e=u(e,u(u(r^(t|~n),o),i)),u(a(e,s),t)}function s(e){for(var t="",r="",n=0;n<=3;n++)t+=(r="0".concat((e>>>8*n&255).toString(16))).substr(r.length-2,2);return t}for(var i,l,c,p,h=(e=>{for(var t,r=e.length,n=16*(((n=r+8)-n%64)/64+1),o=new Array(n-1),s=0,i=0;i<r;)s=i%4*8,o[t=(i-i%4)/4]=o[t]|e.charCodeAt(i)<<s,i++;return o[t=(i-i%4)/4]=o[t]|128<<(s=i%4*8),o[n-2]=r<<3,o[n-1]=r>>>29,o})(e=(e=>{for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):(127<n&&n<2048?t+=String.fromCharCode(n>>6|192):t=(t+=String.fromCharCode(n>>12|224))+String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t})(e)),d=1732584193,f=4023233417,m=2562383102,g=271733878,y=0;y<h.length;y+=16)d=t(i=d,l=f,c=m,p=g,h[y+0],7,3614090360),g=t(g,d,f,m,h[y+1],12,3905402710),m=t(m,g,d,f,h[y+2],17,606105819),f=t(f,m,g,d,h[y+3],22,3250441966),d=t(d,f,m,g,h[y+4],7,4118548399),g=t(g,d,f,m,h[y+5],12,1200080426),m=t(m,g,d,f,h[y+6],17,2821735955),f=t(f,m,g,d,h[y+7],22,4249261313),d=t(d,f,m,g,h[y+8],7,1770035416),g=t(g,d,f,m,h[y+9],12,2336552879),m=t(m,g,d,f,h[y+10],17,4294925233),f=t(f,m,g,d,h[y+11],22,2304563134),d=t(d,f,m,g,h[y+12],7,1804603682),g=t(g,d,f,m,h[y+13],12,4254626195),m=t(m,g,d,f,h[y+14],17,2792965006),d=r(d,f=t(f,m,g,d,h[y+15],22,1236535329),m,g,h[y+1],5,4129170786),g=r(g,d,f,m,h[y+6],9,3225465664),m=r(m,g,d,f,h[y+11],14,643717713),f=r(f,m,g,d,h[y+0],20,3921069994),d=r(d,f,m,g,h[y+5],5,3593408605),g=r(g,d,f,m,h[y+10],9,38016083),m=r(m,g,d,f,h[y+15],14,3634488961),f=r(f,m,g,d,h[y+4],20,3889429448),d=r(d,f,m,g,h[y+9],5,568446438),g=r(g,d,f,m,h[y+14],9,3275163606),m=r(m,g,d,f,h[y+3],14,4107603335),f=r(f,m,g,d,h[y+8],20,1163531501),d=r(d,f,m,g,h[y+13],5,2850285829),g=r(g,d,f,m,h[y+2],9,4243563512),m=r(m,g,d,f,h[y+7],14,1735328473),d=n(d,f=r(f,m,g,d,h[y+12],20,2368359562),m,g,h[y+5],4,4294588738),g=n(g,d,f,m,h[y+8],11,2272392833),m=n(m,g,d,f,h[y+11],16,1839030562),f=n(f,m,g,d,h[y+14],23,4259657740),d=n(d,f,m,g,h[y+1],4,2763975236),g=n(g,d,f,m,h[y+4],11,1272893353),m=n(m,g,d,f,h[y+7],16,4139469664),f=n(f,m,g,d,h[y+10],23,3200236656),d=n(d,f,m,g,h[y+13],4,681279174),g=n(g,d,f,m,h[y+0],11,3936430074),m=n(m,g,d,f,h[y+3],16,3572445317),f=n(f,m,g,d,h[y+6],23,76029189),d=n(d,f,m,g,h[y+9],4,3654602809),g=n(g,d,f,m,h[y+12],11,3873151461),m=n(m,g,d,f,h[y+15],16,530742520),d=o(d,f=n(f,m,g,d,h[y+2],23,3299628645),m,g,h[y+0],6,4096336452),g=o(g,d,f,m,h[y+7],10,1126891415),m=o(m,g,d,f,h[y+14],15,2878612391),f=o(f,m,g,d,h[y+5],21,4237533241),d=o(d,f,m,g,h[y+12],6,1700485571),g=o(g,d,f,m,h[y+3],10,2399980690),m=o(m,g,d,f,h[y+10],15,4293915773),f=o(f,m,g,d,h[y+1],21,2240044497),d=o(d,f,m,g,h[y+8],6,1873313359),g=o(g,d,f,m,h[y+15],10,4264355552),m=o(m,g,d,f,h[y+6],15,2734768916),f=o(f,m,g,d,h[y+13],21,1309151649),d=o(d,f,m,g,h[y+4],6,4149444226),g=o(g,d,f,m,h[y+11],10,3174756917),m=o(m,g,d,f,h[y+2],15,718787259),f=o(f,m,g,d,h[y+9],21,3951481745),d=u(d,i),f=u(f,l),m=u(m,c),g=u(g,p);return(s(d)+s(f)+s(m)+s(g)).toLowerCase()},j.closeMediaStream=function(e){if(e)try{if(e.getTracks){var t,r=p(e.getTracks());try{for(r.s();!(t=r.n()).done;)t.value.stop()}catch(e){r.e(e)}finally{r.f()}}else{var n,o=p(e.getAudioTracks());try{for(o.s();!(n=o.n()).done;)n.value.stop()}catch(e){o.e(e)}finally{o.f()}var s,i=p(e.getVideoTracks());try{for(i.s();!(s=i.n()).done;)s.value.stop()}catch(e){i.e(e)}finally{i.f()}}}catch(t){"function"!=typeof e.stop&&"object"!==S(e.stop)||e.stop()}},j.cloneArray=function(e){return e&&e.slice()||[]},j.cloneObject=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},j.toPlainObject=function(r){var n;return"object"!==S(r)||null===r?r:(n={},Object.keys(r).forEach(function(e){var t=r[e];!t||"function"==typeof t||t instanceof Date||t instanceof RegExp||"symbol"===S(t)||"object"===S(t)&&t.constructor!==Object||(n[e]=t)}),n)},j.isMiniProgram=function(){return"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo&&"undefined"==typeof window}),j}function F(){}function q(){q.init.call(this)}function H(e){return void 0===e._maxListeners?q.defaultMaxListeners:e._maxListeners}function G(e,t,r,n){var o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');return(o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener||r),o=e._events),s=o[t]):(o=e._events=new F,e._eventsCount=0),s?("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(n=H(e))&&0<n&&s.length>n&&(s.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=s.length,n=n,"function"==typeof console.warn?console.warn(n):console.log(n))):(s=o[t]=r,++e._eventsCount),e}function z(e,t,r){var n=!1;function o(){e.removeListener(t,o),n||(n=!0,r.apply(e,arguments))}return o.listener=r,o}function K(e){var t=this._events;if(t){t=t[e];if("function"==typeof t)return 1;if(t)return t.length}return 0}function Y(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}F.prototype=Object.create(null),(q.EventEmitter=q).usingDomains=!1,q.prototype.domain=void 0,q.prototype._events=void 0,q.prototype._maxListeners=void 0,q.defaultMaxListeners=10,q.init=function(){this.domain=null,q.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new F,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},q.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},q.prototype.getMaxListeners=function(){return H(this)},q.prototype.emit=function(e){var t,r,n,o,s,i="error"===e;if(s=this._events)i=i&&null==s.error;else if(!i)return!1;if(a=this.domain,i){if(i=arguments[1],a)return(i=i||new Error('Uncaught, unspecified "error" event')).domainEmitter=this,i.domain=a,i.domainThrown=!1,a.emit("error",i),!1;if(i instanceof Error)throw i;var a=new Error('Uncaught, unspecified "error" event. ('+i+")");throw a.context=i,a}if(!(t=s[e]))return!1;var u="function"==typeof t;switch(r=arguments.length){case 1:var l=t,c=this;if(u)l.call(c);else for(var p=l.length,L=Y(l,p),h=0;h<p;++h)L[h].call(c);break;case 2:var l=t,d=u,f=this,m=arguments[1];if(d)l.call(f,m);else for(var g=l.length,j=Y(l,g),y=0;y<g;++y)j[y].call(f,m);break;case 3:var d=t,_=u,v=this,b=arguments[1],S=arguments[2];if(_)d.call(v,b,S);else for(var T=d.length,D=Y(d,T),w=0;w<T;++w)D[w].call(v,b,S);break;case 4:var _=t,E=u,A=this,O=arguments[1],x=arguments[2],C=arguments[3];if(E)_.call(A,O,x,C);else for(var R=_.length,M=Y(_,R),N=0;N<R;++N)M[N].call(A,O,x,C);break;default:for(n=new Array(r-1),o=1;o<r;o++)n[o-1]=arguments[o];var E=t,I=this,U=n;if(u)E.apply(I,U);else for(var k=E.length,V=Y(E,k),P=0;P<k;++P)V[P].apply(I,U)}return!0},q.prototype.addListener=function(e,t){return G(this,e,t,!1)},q.prototype.on=q.prototype.addListener,q.prototype.prependListener=function(e,t){return G(this,e,t,!0)},q.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,z(this,e,t)),this},q.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,z(this,e,t)),this},q.prototype.removeListener=function(e,t){var r,n,o,s,i;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if((n=this._events)&&(r=n[e]))if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new F:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length;0<s--;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new F,this;delete n[e]}else{var a=r;for(var u=o,l=u+1,c=a.length;l<c;u+=1,l+=1)a[u]=a[l];a.pop()}n.removeListener&&this.emit("removeListener",e,i||t)}return this},q.prototype.off=function(e,t){return this.removeListener(e,t)},q.prototype.removeAllListeners=function(e){var t,r;if(r=this._events)if(r.removeListener){if(0===arguments.length){for(var n,o=Object.keys(r),s=0;s<o.length;++s)"removeListener"!==(n=o[s])&&this.removeAllListeners(n);this.removeAllListeners("removeListener"),this._events=new F,this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(;this.removeListener(e,t[t.length-1]),t[0];);}else 0===arguments.length?(this._events=new F,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new F:delete r[e]);return this},q.prototype.listeners=function(e){var t=this._events;{if(t&&(t=t[e])){if("function"==typeof t)return[t.listener||t];for(var r=t,n=new Array(r.length),o=0;o<n.length;++o)n[o]=r[o].listener||r[o];return n}return[]}},q.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):K.call(e,t)},q.prototype.listenerCount=K,q.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]};var W=r(Object.freeze({__proto__:null,default:q,EventEmitter:q})),$={},J="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},X=[],Q=[],Z="undefined"!=typeof Uint8Array?Uint8Array:Array,ee=!1;function te(){ee=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)X[t]=e[t],Q[e.charCodeAt(t)]=t;Q["-".charCodeAt(0)]=62,Q["_".charCodeAt(0)]=63}function re(e){return X[e>>18&63]+X[e>>12&63]+X[e>>6&63]+X[63&e]}function ne(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(re(n));return o.join("")}function oe(e){var t;ee||te();for(var r=e.length,n=r%3,o="",s=[],i=0,a=r-n;i<a;i+=16383)s.push(ne(e,i,a<i+16383?a:i+16383));return 1==n?(t=e[r-1],o=(o+=X[t>>2])+X[t<<4&63]+"=="):2==n&&(t=(e[r-2]<<8)+e[r-1],o=(o=(o+=X[t>>10])+X[t>>4&63])+X[t<<2&63]+"="),s.push(o),s.join("")}function ie(e,t,r,n,o){var s,i,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,p=r?o-1:0,h=r?-1:1,o=e[t+p];for(p+=h,s=o&(1<<-c)-1,o>>=-c,c+=a;0<c;s=256*s+e[t+p],p+=h,c-=8);for(i=s&(1<<-c)-1,s>>=-c,c+=n;0<c;i=256*i+e[t+p],p+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return i?NaN:1/0*(o?-1:1);i+=Math.pow(2,n),s-=l}return(o?-1:1)*i*Math.pow(2,s-n)}function se(e,t,r,n,o,s){var i,a,u=8*s-o-1,l=(1<<u)-1,c=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,d=n?1:-1,s=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-i))<1&&(i--,n*=2),2<=(t+=1<=i+c?p/n:p*Math.pow(2,1-c))*n&&(i++,n/=2),l<=i+c?(a=0,i=l):1<=i+c?(a=(t*n-1)*Math.pow(2,o),i+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),i=0));8<=o;e[r+h]=255&a,h+=d,a/=256,o-=8);for(i=i<<o|a,u+=o;0<u;e[r+h]=255&i,h+=d,i/=256,u-=8);e[r+h-d]|=128*s}var ae={}.toString,ue=Array.isArray||function(e){return"[object Array]"==ae.call(e)};function le(){return pe.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ce(e,t){if(le()<t)throw new RangeError("Invalid typed array length");return pe.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=pe.prototype:(e=null===e?new pe(t):e).length=t,e}function pe(e,t,r){if(!(pe.TYPED_ARRAY_SUPPORT||this instanceof pe))return new pe(e,t,r);if("number"!=typeof e)return de(this,e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return fe(this,e)}function de(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var o=e,s=t,i=r;if(s.byteLength,i<0||s.byteLength<i)throw new RangeError("'offset' is out of bounds");if(s.byteLength<i+(n||0))throw new RangeError("'length' is out of bounds");return s=void 0===i&&void 0===n?new Uint8Array(s):void 0===n?new Uint8Array(s,i):new Uint8Array(s,i,n),pe.TYPED_ARRAY_SUPPORT?(o=s).__proto__=pe.prototype:o=me(o,s),o}if("string"==typeof t){i=e,n=t,s=r;if(pe.isEncoding(s="string"==typeof s&&""!==s?s:"utf8"))return(n=(i=ce(i,o=0|_e(n,s))).write(n,s))!==o?i.slice(0,n):i;throw new TypeError('"encoding" must be a valid string encoding')}var a,r=e,n=t;if(ye(n))return 0!==(r=ce(r,a=0|ge(n.length))).length&&n.copy(r,0,0,a),r;if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||(a=n.length)!=a?ce(r,0):me(r,n);if("Buffer"===n.type&&ue(n.data))return me(r,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function he(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function fe(e,t){if(he(t),e=ce(e,t<0?0:0|ge(t)),!pe.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function me(e,t){var r=t.length<0?0:0|ge(t.length);e=ce(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function ge(e){if(e>=le())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+le().toString(16)+" bytes");return 0|e}function ye(e){return!(null==e||!e._isBuffer)}function _e(e,t){if(ye(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var r=(e="string"!=typeof e?""+e:e).length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ze(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ke(e).length;default:if(n)return ze(e).length;t=(""+t).toLowerCase(),n=!0}}function ve(e,t,r){var n=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return ke(this,t,r);case"utf8":case"utf-8":return Ne(this,t,r);case"ascii":return Pe(this,t,r);case"latin1":case"binary":return Ue(this,t,r);case"base64":return Re(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function be(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Se(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,(r=(r=isNaN(r)?o?0:e.length-1:r)<0?e.length+r:r)>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if(ye(t="string"==typeof t?pe.from(t,n):t))return 0===t.length?-1:Te(e,t,r,n,o);if("number"==typeof t)return t&=255,pe.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):Te(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Te(e,t,r,n,o){var s=1,i=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i/=s=2,a/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o)for(var l=-1,c=r;c<i;c++)if(u(e,c)===u(t,-1===l?0:c-l)){if(c-(l=-1===l?c:l)+1===a)return l*s}else-1!==l&&(c-=c-l),l=-1;else for(c=r=i<r+a?i-a:r;0<=c;c--){for(var p=!0,h=0;h<a;h++)if(u(e,c+h)!==u(t,h)){p=!1;break}if(p)return c}return-1}function we(e,t,r,n){r=Number(r)||0;var o=e.length-r,o=((!n||(n=Number(n))>o)&&(n=o),t.length);if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(n=o/2);for(var s=0;s<n;++s){var i=parseInt(t.substr(2*s,2),16);if(isNaN(i))return s;e[r+s]=i}return s}function Ee(e,t,r,n){return Ye(ze(t,e.length-r),e,r,n)}function Ae(e,t,r,n){return Ye((e=>{for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t})(t),e,r,n)}function Oe(e,t,r,n){return Ae(e,t,r,n)}function xe(e,t,r,n){return Ye(Ke(t),e,r,n)}function Ce(e,t,r,n){return Ye(((e,t)=>{for(var r,n,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o.push(r%256),o.push(n);return o})(t,e.length-r),e,r,n)}function Re(e,t,r){return 0===t&&r===e.length?oe(e):oe(e.slice(t,r))}function Ne(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var s,i,a,u,l=e[o],c=null,p=239<l?4:223<l?3:191<l?2:1;if(o+p<=r)switch(p){case 1:l<128&&(c=l);break;case 2:128==(192&(s=e[o+1]))&&127<(u=(31&l)<<6|63&s)&&(c=u);break;case 3:s=e[o+1],i=e[o+2],128==(192&s)&&128==(192&i)&&2047<(u=(15&l)<<12|(63&s)<<6|63&i)&&(u<55296||57343<u)&&(c=u);break;case 4:s=e[o+1],i=e[o+2],a=e[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&s)<<12|(63&i)<<6|63&a)&&u<1114112&&(c=u)}null===c?(c=65533,p=1):65535<c&&(n.push((c-=65536)>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=p}var h=n,d=h.length;if(d<=Ie)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<d;)f+=String.fromCharCode.apply(String,h.slice(m,m+=Ie));return f}pe.TYPED_ARRAY_SUPPORT=void 0===J.TYPED_ARRAY_SUPPORT||J.TYPED_ARRAY_SUPPORT,le(),pe.poolSize=8192,pe._augment=function(e){return e.__proto__=pe.prototype,e},pe.from=function(e,t,r){return de(null,e,t,r)},pe.TYPED_ARRAY_SUPPORT&&(pe.prototype.__proto__=Uint8Array.prototype,pe.__proto__=Uint8Array),pe.alloc=function(e,t,r){return t=t,r=r,he(e=e),!(e<=0)&&void 0!==t?"string"==typeof r?ce(null,e).fill(t,r):ce(null,e).fill(t):ce(null,e)},pe.allocUnsafe=function(e){return fe(null,e)},pe.allocUnsafeSlow=function(e){return fe(null,e)},pe.isBuffer=function(e){return null!=e&&(!!e._isBuffer||We(e)||"function"==typeof(e=e).readFloatLE&&"function"==typeof e.slice&&We(e.slice(0,0)))},pe.compare=function(e,t){if(!ye(e)||!ye(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},pe.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},pe.concat=function(e,t){if(!ue(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return pe.alloc(0);if(void 0===t)for(o=t=0;o<e.length;++o)t+=e[o].length;for(var r=pe.allocUnsafe(t),n=0,o=0;o<e.length;++o){var s=e[o];if(!ye(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},pe.byteLength=_e,pe.prototype._isBuffer=!0,pe.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)be(this,t,t+1);return this},pe.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)be(this,t,t+3),be(this,t+1,t+2);return this},pe.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)be(this,t,t+7),be(this,t+1,t+6),be(this,t+2,t+5),be(this,t+3,t+4);return this},pe.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?Ne(this,0,e):ve.apply(this,arguments)},pe.prototype.equals=function(e){if(ye(e))return this===e||0===pe.compare(this,e);throw new TypeError("Argument must be a Buffer")},pe.prototype.inspect=function(){var e="";return 0<this.length&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length)&&(e+=" ... "),"<Buffer "+e+">"},pe.prototype.compare=function(e,t,r,n,o){if(!ye(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),a=Math.min(s,i),u=this.slice(n,o),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){s=u[c],i=l[c];break}return s<i?-1:i<s?1:0},pe.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},pe.prototype.indexOf=function(e,t,r){return Se(this,e,t,r,!0)},pe.prototype.lastIndexOf=function(e,t,r){return Se(this,e,t,r,!1)},pe.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||o<r)&&(r=o),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var s=!1;;)switch(n){case"hex":return we(this,e,t,r);case"utf8":case"utf-8":return Ee(this,e,t,r);case"ascii":return Ae(this,e,t,r);case"latin1":case"binary":return Oe(this,e,t,r);case"base64":return xe(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},pe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Ie=4096;function Pe(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function Ue(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function ke(e,t,r){var n=e.length;(!r||r<0||n<r)&&(r=n);for(var o="",s=t=!t||t<0?0:t;s<r;++s)o+=Ge(e[s]);return o}function Le(e,t,r){for(var n=e.slice(t,r),o="",s=0;s<n.length;s+=2)o+=String.fromCharCode(n[s]+256*n[s+1]);return o}function je(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function De(e,t,r,n,o,s){if(!ye(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<t||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function Me(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-r,2);o<s;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function Ve(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-r,4);o<s;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function Be(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Fe(e,t,r,n,o){return o||Be(e,0,r,4),se(e,t,r,n,23,4),r+4}function qe(e,t,r,n,o){return o||Be(e,0,r,8),se(e,t,r,n,52,8),r+8}pe.prototype.slice=function(e,t){var r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e),pe.TYPED_ARRAY_SUPPORT)(o=this.subarray(e,t)).__proto__=pe.prototype;else for(var n=t-e,o=new pe(n,void 0),s=0;s<n;++s)o[s]=this[s+e];return o},pe.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||je(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n},pe.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||je(e,t,this.length);for(var n=this[e+--t],o=1;0<t&&(o*=256);)n+=this[e+--t]*o;return n},pe.prototype.readUInt8=function(e,t){return t||je(e,1,this.length),this[e]},pe.prototype.readUInt16LE=function(e,t){return t||je(e,2,this.length),this[e]|this[e+1]<<8},pe.prototype.readUInt16BE=function(e,t){return t||je(e,2,this.length),this[e]<<8|this[e+1]},pe.prototype.readUInt32LE=function(e,t){return t||je(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},pe.prototype.readUInt32BE=function(e,t){return t||je(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},pe.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||je(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},pe.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||je(e,t,this.length);for(var n=t,o=1,s=this[e+--n];0<n&&(o*=256);)s+=this[e+--n]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*t)),s},pe.prototype.readInt8=function(e,t){return t||je(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},pe.prototype.readInt16LE=function(e,t){t||je(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},pe.prototype.readInt16BE=function(e,t){t||je(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},pe.prototype.readInt32LE=function(e,t){return t||je(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},pe.prototype.readInt32BE=function(e,t){return t||je(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},pe.prototype.readFloatLE=function(e,t){return t||je(e,4,this.length),ie(this,e,!0,23,4)},pe.prototype.readFloatBE=function(e,t){return t||je(e,4,this.length),ie(this,e,!1,23,4)},pe.prototype.readDoubleLE=function(e,t){return t||je(e,8,this.length),ie(this,e,!0,52,8)},pe.prototype.readDoubleBE=function(e,t){return t||je(e,8,this.length),ie(this,e,!1,52,8)},pe.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||De(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},pe.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||De(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,s=1;for(this[t+o]=255&e;0<=--o&&(s*=256);)this[t+o]=e/s&255;return t+r},pe.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,1,255,0),pe.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},pe.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,65535,0),pe.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Me(this,e,t,!0),t+2},pe.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,65535,0),pe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Me(this,e,t,!1),t+2},pe.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,4294967295,0),pe.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Ve(this,e,t,!0),t+4},pe.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,4294967295,0),pe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ve(this,e,t,!1),t+4},pe.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||De(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,s=1,i=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},pe.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||De(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,s=1,i=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},pe.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,1,127,-128),pe.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},pe.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,32767,-32768),pe.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Me(this,e,t,!0),t+2},pe.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,32767,-32768),pe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Me(this,e,t,!1),t+2},pe.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,2147483647,-2147483648),pe.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Ve(this,e,t,!0),t+4},pe.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),pe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ve(this,e,t,!1),t+4},pe.prototype.writeFloatLE=function(e,t,r){return Fe(this,e,t,!0,r)},pe.prototype.writeFloatBE=function(e,t,r){return Fe(this,e,t,!1,r)},pe.prototype.writeDoubleLE=function(e,t,r){return qe(this,e,t,!0,r)},pe.prototype.writeDoubleBE=function(e,t,r){return qe(this,e,t,!1,r)},pe.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0<n&&n<r?r:n)===r)return 0;if(0===e.length||0===this.length)return 0;if((t=t||0)<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o,s=(n=e.length-t<n-r?e.length-t+r:n)-r;if(this===e&&r<t&&t<n)for(o=s-1;0<=o;--o)e[o+t]=this[o+r];else if(s<1e3||!pe.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},pe.prototype.fill=function(e,t,r,n){if("string"==typeof e){var o;if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length&&(o=e.charCodeAt(0))<256&&(e=o),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!pe.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(!(r<=t))if(t>>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(a=t;a<r;++a)this[a]=e;else for(var s=ye(e)?e:ze(new pe(e,n).toString()),i=s.length,a=0;a<r-t;++a)this[a+t]=s[a%i];return this};var He=/[^+\/0-9A-Za-z-_]/g;function Ge(e){return e<16?"0"+e.toString(16):e.toString(16)}function ze(e,t){var r;t=t||1/0;for(var n=e.length,o=null,s=[],i=0;i<n;++i){if(55295<(r=e.charCodeAt(i))&&r<57344){if(!o){if(56319<r){-1<(t-=3)&&s.push(239,191,189);continue}if(i+1===n){-1<(t-=3)&&s.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(t-=3)&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(t-=3)&&s.push(239,191,189);if(o=null,r<128){if(--t<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Ke(e){var t=(e=>{if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(He,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e})(e);ee||te();var r,e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");for(var n="="===t[e-2]?2:"="===t[e-1]?1:0,o=new Z(3*e/4-n),s=0<n?e-4:e,i=0,a=0;a<s;a+=4)r=Q[t.charCodeAt(a)]<<18|Q[t.charCodeAt(a+1)]<<12|Q[t.charCodeAt(a+2)]<<6|Q[t.charCodeAt(a+3)],o[i++]=r>>16&255,o[i++]=r>>8&255,o[i++]=255&r;return 2==n?(r=Q[t.charCodeAt(a)]<<2|Q[t.charCodeAt(a+1)]>>4,o[i++]=255&r):1==n&&(r=Q[t.charCodeAt(a)]<<10|Q[t.charCodeAt(a+1)]<<4|Q[t.charCodeAt(a+2)]>>2,o[i++]=r>>8&255,o[i++]=255&r),o}function Ye(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function We(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function $e(){throw new Error("setTimeout has not been defined")}function Je(){throw new Error("clearTimeout has not been defined")}var Xe=$e,Qe=Je;function Ze(t){if(Xe===setTimeout)return setTimeout(t,0);if((Xe===$e||!Xe)&&setTimeout)return(Xe=setTimeout)(t,0);try{return Xe(t,0)}catch(e){try{return Xe.call(null,t,0)}catch(e){return Xe.call(this,t,0)}}}"function"==typeof J.setTimeout&&(Xe=setTimeout),"function"==typeof J.clearTimeout&&(Qe=clearTimeout);var et,tt=[],rt=!1,nt=-1;function ot(){rt&&et&&(rt=!1,et.length?tt=et.concat(tt):nt=-1,tt.length)&&it()}function it(){if(!rt){var e=Ze(ot);rt=!0;for(var t=tt.length;t;){for(et=tt,tt=[];++nt<t;)et&&et[nt].run();nt=-1,t=tt.length}et=null,rt=!1,function(t){if(Qe===clearTimeout)return clearTimeout(t);if((Qe===Je||!Qe)&&clearTimeout)return(Qe=clearTimeout)(t);try{Qe(t)}catch(e){try{return Qe.call(null,t)}catch(e){return Qe.call(this,t)}}}(e)}}function st(e,t){this.fun=e,this.array=t}function at(){}st.prototype.run=function(){this.fun.apply(null,this.array)};var ut=at,lt=at,ct=at,pt=at,dt=at,ht=at,ft=at,mt=J.performance||{},gt=mt.now||mt.mozNow||mt.msNow||mt.oNow||mt.webkitNow||function(){return(new Date).getTime()},yt=new Date,_t={nextTick:function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];tt.push(new st(e,t)),1!==tt.length||rt||Ze(it)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ut,addListener:lt,once:ct,off:pt,removeListener:dt,removeAllListeners:ht,emit:ft,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*gt.call(mt),r=Math.floor(t),t=Math.floor(t%1*1e9);return e&&(r-=e[0],(t-=e[1])<0)&&(r--,t+=1e9),[r,t]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-yt)/1e3}},vt="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;function r(){}r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},bt=/%[sdj%]/g;function St(e){if(!Dt(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(Ot(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(e).replace(bt,function(e){if("%%"===e)return"%";if(o<=r)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),i=n[r];r<o;i=n[++r])kt(i)||!Ft(i)?s+=" "+i:s+=" "+Ot(i);return s}function Tt(e,t){var r;return Vt(J.process)?function(){return Tt(e,t).apply(this,arguments)}:!0===_t.noDeprecation?e:(r=!1,function(){if(!r){if(_t.throwDeprecation)throw new Error(t);_t.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)})}var wt,Et={};function At(t){return Vt(wt)&&(wt=_t.env.NODE_DEBUG||""),t=t.toUpperCase(),Et[t]||(new RegExp("\\b"+t+"\\b","i").test(wt)?Et[t]=function(){var e=St.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:Et[t]=function(){}),Et[t]}function Ot(e,t){var r={seen:[],stylize:Ct};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),Ut(t)?r.showHidden=t:t&&Xt(r,t),Vt(r.showHidden)&&(r.showHidden=!1),Vt(r.depth)&&(r.depth=2),Vt(r.colors)&&(r.colors=!1),Vt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=xt),Rt(r,e,r.depth)}function xt(e,t){t=Ot.styles[t];return t?"["+Ot.colors[t][0]+"m"+e+"["+Ot.colors[t][1]+"m":e}function Ct(e,t){return e}function Rt(t,r,n){if(t.customInspect&&r&&Gt(r.inspect)&&r.inspect!==Ot&&(!r.constructor||r.constructor.prototype!==r))return Dt(e=r.inspect(n,t))?e:Rt(t,e,n);e=t;var e,o=Vt(i=r)?e.stylize("undefined","undefined"):Dt(i)?(o="'"+JSON.stringify(i).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(o,"string")):jt(i)?e.stylize(""+i,"number"):Ut(i)?e.stylize(""+i,"boolean"):kt(i)?e.stylize("null","null"):void 0;if(o)return o;var s,i=Object.keys(r),a=(s={},i.forEach(function(e,t){s[e]=!0}),s);if(t.showHidden&&(i=Object.getOwnPropertyNames(r)),Ht(r)&&(0<=i.indexOf("message")||0<=i.indexOf("description")))return Nt(r);if(0===i.length){if(Gt(r))return c=r.name?": "+r.name:"",t.stylize("[Function"+c+"]","special");if(Bt(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(qt(r))return t.stylize(Date.prototype.toString.call(r),"date");if(Ht(r))return Nt(r)}var u,l,c="",p=!1,h=["{","}"];return Pt(r)&&(p=!0,h=["[","]"]),Gt(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),Bt(r)&&(c=" "+RegExp.prototype.toString.call(r)),qt(r)&&(c=" "+Date.prototype.toUTCString.call(r)),Ht(r)&&(c=" "+Nt(r)),0!==i.length||p&&0!=r.length?n<0?Bt(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),i=p?((t,r,n,o,e)=>{for(var s=[],i=0,a=r.length;i<a;++i)Qt(r,String(i))?s.push(It(t,r,n,o,String(i),!0)):s.push("");return e.forEach(function(e){e.match(/^\d+$/)||s.push(It(t,r,n,o,e,!0))}),s})(t,r,n,a,i):i.map(function(e){return It(t,r,n,a,e,p)}),t.seen.pop(),u=c,l=h,60<(i=i).reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)?l[0]+(""===u?"":u+"\n ")+" "+i.join(",\n ")+" "+l[1]:l[0]+u+" "+i.join(", ")+" "+l[1]):h[0]+c+h[1]}function Nt(e){return"["+Error.prototype.toString.call(e)+"]"}function It(e,t,r,n,o,s){var i,a;if((t=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=t.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.set&&(a=e.stylize("[Setter]","special")),Qt(n,o)||(i="["+o+"]"),a||(e.seen.indexOf(t.value)<0?-1<(a=kt(r)?Rt(e,t.value,null):Rt(e,t.value,r-1)).indexOf("\n")&&(a=s?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),Vt(i)){if(s&&o.match(/^\d+$/))return a;i=(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(i,"string"))}return i+": "+a}function Pt(e){return Array.isArray(e)}function Ut(e){return"boolean"==typeof e}function kt(e){return null===e}function Lt(e){return null==e}function jt(e){return"number"==typeof e}function Dt(e){return"string"==typeof e}function Mt(e){return"symbol"==typeof e}function Vt(e){return void 0===e}function Bt(e){return Ft(e)&&"[object RegExp]"===Yt(e)}function Ft(e){return"object"==typeof e&&null!==e}function qt(e){return Ft(e)&&"[object Date]"===Yt(e)}function Ht(e){return Ft(e)&&("[object Error]"===Yt(e)||e instanceof Error)}function Gt(e){return"function"==typeof e}function zt(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Kt(e){return pe.isBuffer(e)}function Yt(e){return Object.prototype.toString.call(e)}function Wt(e){return e<10?"0"+e.toString(10):e.toString(10)}Ot.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Ot.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var $t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jt(){var e,t;console.log("%s - %s",(t=[Wt((e=new Date).getHours()),Wt(e.getMinutes()),Wt(e.getSeconds())].join(":"),[e.getDate(),$t[e.getMonth()],t].join(" ")),St.apply(null,arguments))}function Xt(e,t){if(t&&Ft(t))for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Qt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Zt,er={inherits:vt,_extend:Xt,log:Jt,isBuffer:Kt,isPrimitive:zt,isFunction:Gt,isError:Ht,isDate:qt,isObject:Ft,isRegExp:Bt,isUndefined:Vt,isSymbol:Mt,isString:Dt,isNumber:jt,isNullOrUndefined:Lt,isNull:kt,isBoolean:Ut,isArray:Pt,inspect:Ot,deprecate:Tt,format:St,debuglog:At},tr=r(Object.freeze({__proto__:null,format:St,deprecate:Tt,debuglog:At,inspect:Ot,isArray:Pt,isBoolean:Ut,isNull:kt,isNullOrUndefined:Lt,isNumber:jt,isString:Dt,isSymbol:Mt,isUndefined:Vt,isRegExp:Bt,isObject:Ft,isDate:qt,isError:Ht,isFunction:Gt,isPrimitive:zt,isBuffer:Kt,log:Jt,inherits:vt,_extend:Xt,default:er}));class rr{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class nr extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}function or(e){if(Number.isFinite(e)&&0<e)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function ir(e,t,r){return{timeoutMillis:or(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}(e=>{e.NONE="none",e.GZIP="gzip"})(Zt=Zt||{});class sr{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var e=()=>{var e=this._sendingPromises.indexOf(t);this._sendingPromises.splice(e,1)};t.then(e,e)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function ar(e){return new sr(e.concurrencyLimit)}var ur="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof J?J:{},lr="1.9.0",cr=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,pr=(t=>{var o,s,i,a=new Set([t]),u=new Set,e=t.match(cr);return e?(o=+e[1],s=+e[2],i=+e[3],null!=e[4]?function(e){return e===t}:function(e){var t,r,n;return!!a.has(e)||!u.has(e)&&(!(t=e.match(cr))||(r=+t[1],n=+t[2],null!=t[4])||o!=r?l:0==o?s==n&&i<=+t[3]?c:l:s<=n?c:l)(e)}):function(){return!1};function l(e){return u.add(e),!1}function c(e){return a.add(e),!0}})(lr),dr=lr.split(".")[0],hr=Symbol.for("opentelemetry.js.api."+dr),fr=ur;function mr(e,t,r,n){void 0===n&&(n=!1);var o,s=fr[hr]=null!=(s=fr[hr])?s:{version:lr};return!n&&s[e]?(o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e),r.error(o.stack||o.message),!1):s.version!==lr?(o=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+e+" does not match previously registered API v"+lr),r.error(o.stack||o.message),!1):(s[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+lr+"."),!0)}function gr(e){var t=null==(t=fr[hr])?void 0:t.version;return!t||!pr(t)||null==(t=fr[hr])?void 0:t[e]}function yr(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+lr+".");t=fr[hr];t&&delete t[e]}var _r,vr=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},br=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Sr=(()=>{function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tr("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tr("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tr("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tr("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tr("verbose",this._namespace,e)},e})();function Tr(e,t,r){var n=gr("diag");if(n)return r.unshift(t),n[e].apply(n,br([],vr(r),!1))}(e=>{e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(_r=_r||{});var wr=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Er=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Ar=(()=>{function e(){function e(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=gr("diag");if(r)return r[n].apply(r,Er([],wr(e),!1))}}var a=this;a.setLogger=function(e,t){if(void 0===t&&(t={logLevel:_r.INFO}),e===a)return s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation"),a.error(null!=(o=s.stack)?o:s.message),!1;"number"==typeof t&&(t={logLevel:t});var r,n,o=gr("diag"),s=(r=null!=(s=t.logLevel)?s:_r.INFO,n=e,r<_r.NONE?r=_r.NONE:r>_r.ALL&&(r=_r.ALL),n=n||{},{error:i("error",_r.ERROR),warn:i("warn",_r.WARN),info:i("info",_r.INFO),debug:i("debug",_r.DEBUG),verbose:i("verbose",_r.VERBOSE)});function i(e,t){e=n[e];return"function"==typeof e&&t<=r?e.bind(n):function(){}}return o&&!t.suppressOverrideMessage&&(t=null!=(e=(new Error).stack)?e:"<failed to generate stacktrace>",o.warn("Current logger will be overwritten from "+t),s.warn("Current logger will overwrite one already registered from "+t)),mr("diag",s,a,!0)},a.disable=function(){yr("diag",a)},a.createComponentLogger=function(e){return new Sr(e)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})(),Or=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},xr=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Cr=(()=>{function u(e){this._entries=e?new Map(e):new Map}return u.prototype.getEntry=function(e){e=this._entries.get(e);if(e)return Object.assign({},e)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){e=Or(e,2);return[e[0],e[1]]})},u.prototype.setEntry=function(e,t){var r=new u(this._entries);return r._entries.set(e,t),r},u.prototype.removeEntry=function(e){var t=new u(this._entries);return t._entries.delete(e),t},u.prototype.removeEntries=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=new u(this._entries);try{for(var s=xr(r),i=s.next();!i.done;i=s.next()){var a=i.value;o._entries.delete(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return o},u.prototype.clear=function(){return new u},u})(),Rr=Symbol("BaggageEntryMetadata"),Nr=Ar.instance();function Ir(e){return void 0===e&&(e={}),new Cr(new Map(Object.entries(e)))}function Pr(e){return"string"!=typeof e&&(Nr.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:Rr,toString:function(){return e}}}function Ur(e){return Symbol.for(e)}var kr,Lr,jr=function n(e){var o=this;o._currentContext=e?new Map(e):new Map,o.getValue=function(e){return o._currentContext.get(e)},o.setValue=function(e,t){var r=new n(o._currentContext);return r._currentContext.set(e,t),r},o.deleteValue=function(e){var t=new n(o._currentContext);return t._currentContext.delete(e),t}},Dr=new jr,Mr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Vr=function(){for(var e=0;e<Mr.length;e++)this[Mr[e].n]=(n=>function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(console){var r=console[n];if("function"==typeof(r="function"!=typeof r?console.log:r))return r.apply(console,e)}})(Mr[e].c)},Br=(kr=function(e,t){return(kr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}kr(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Fr=(()=>{function e(){}return e.prototype.createGauge=function(e,t){return Zr},e.prototype.createHistogram=function(e,t){return en},e.prototype.createCounter=function(e,t){return Qr},e.prototype.createUpDownCounter=function(e,t){return tn},e.prototype.createObservableGauge=function(e,t){return nn},e.prototype.createObservableCounter=function(e,t){return rn},e.prototype.createObservableUpDownCounter=function(e,t){return on},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e})(),qr=function(){},Hr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t.prototype.add=function(e,t){},t})(qr),Gr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t.prototype.add=function(e,t){},t})(qr),zr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t.prototype.record=function(e,t){},t})(qr),Kr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t.prototype.record=function(e,t){},t})(qr),Yr=(()=>{function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e})(),Wr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t})(Yr),$r=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t})(Yr),Jr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Br(t,e),t})(Yr),Xr=new Fr,Qr=new Hr,Zr=new zr,en=new Kr,tn=new Gr,rn=new Wr,nn=new $r,on=new Jr;function sn(){return Xr}(e=>{e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(Lr=Lr||{});var an,un={get:function(e,t){if(null!=e)return e[t]},keys:function(e){return null==e?[]:Object.keys(e)}},ln={set:function(e,t,r){null!=e&&(e[t]=r)}},cn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},pn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},dn=(()=>{function e(){}return e.prototype.active=function(){return Dr},e.prototype.with=function(e,t,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];return t.call.apply(t,pn([r],cn(n),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),hn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},fn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},mn="context",gn=new dn,yn=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return mr(mn,e,Ar.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var n,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(n=this._getContextManager()).with.apply(n,fn([e,t,r],hn(o),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return gr(mn)||gn},e.prototype.disable=function(){this._getContextManager().disable(),yr(mn,Ar.instance())},e})(),_n=((e=>{e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(an=an||{}),"0000000000000000"),vn="00000000000000000000000000000000",bn={traceId:vn,spanId:_n,traceFlags:an.NONE},Sn=(()=>{function e(e){this._spanContext=e=void 0===e?bn:e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e})(),Tn=Ur("OpenTelemetry Context Key SPAN");function wn(e){return e.getValue(Tn)||void 0}function En(){return wn(yn.getInstance().active())}function An(e,t){return e.setValue(Tn,t)}function On(e){return e.deleteValue(Tn)}function xn(e,t){return An(e,new Sn(t))}function Cn(e){return null==(e=wn(e))?void 0:e.spanContext()}var Rn=/^([0-9a-f]{32})$/i,Nn=/^[0-9a-f]{16}$/i;function In(e){return Rn.test(e)&&e!==vn}function Pn(e){return Nn.test(e)&&e!==_n}function Un(e){return In(e.traceId)&&Pn(e.spanId)}function kn(e){return new Sn(e)}var Dn,Mn,Vn,Ln=yn.getInstance(),jn=(()=>{function e(){}return e.prototype.startSpan=function(e,t,r){return void 0===r&&(r=Ln.active()),!Boolean(null==t?void 0:t.root)&&"object"==typeof(t=r&&Cn(r))&&"string"==typeof t.spanId&&"string"==typeof t.traceId&&"number"==typeof t.traceFlags&&Un(t)?new Sn(t):new Sn},e.prototype.startActiveSpan=function(e,t,r,n){var o,s;if(!(arguments.length<2))return t=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),s=An(r=null!=s?s:Ln.active(),n=this.startSpan(e,o,r)),Ln.with(s,t,void 0,n)},e})(),Bn=new jn,Fn=(()=>{function e(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,n){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){var e;return this._delegate||((e=this._provider.getDelegateTracer(this.name,this.version,this.options))?(this._delegate=e,this._delegate):Bn)},e})(),qn=new((()=>{function e(){}return e.prototype.getTracer=function(e,t,r){return new jn},e})()),Hn=(()=>{function e(){}return e.prototype.getTracer=function(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new Fn(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:qn},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)},e})(),Gn=((e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Dn=Dn||{}),(e=>{e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Mn=Mn||{}),(e=>{e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Vn=Vn||{}),"[_0-9a-z-*/]"),zn=new RegExp("^(?:[a-z]"+Gn+"{0,255}|[a-z0-9]"+Gn+"{0,240}@[a-z]"+Gn+"{0,13})$"),Kn=/^[ -~]{0,255}[!-~]$/,Yn=/,|=/,Wn=(()=>{function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,t){var r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r},t.prototype.unset=function(e){var t=this._clone();return t._internalState.delete(e),t},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,t){return e.push(t+"="+r.get(t)),e},[]).join(",")},t.prototype._parse=function(e){512<e.length||(this._internalState=e.split(",").reverse().reduce(function(e,t){var r,n=t.trim(),o=n.indexOf("=");return-1!==o&&(r=n.slice(0,o),n=n.slice(o+1,t.length),zn.test(r))&&(o=n,Kn.test(o))&&!Yn.test(o)&&e.set(r,n),e},new Map),32<this._internalState.size&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})(),$n=yn.getInstance(),Jn=Ar.instance(),Xn=new((()=>{function e(){}return e.prototype.getMeter=function(e,t,r){return Xr},e})()),Qn="metrics",Zn=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return mr(Qn,e,Ar.instance())},e.prototype.getMeterProvider=function(){return gr(Qn)||Xn},e.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},e.prototype.disable=function(){yr(Qn,Ar.instance())},e})(),eo=Zn.getInstance(),to=(()=>{function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e})(),ro=Ur("OpenTelemetry Baggage Key");function no(e){return e.getValue(ro)||void 0}function oo(){return no(yn.getInstance().active())}function io(e,t){return e.setValue(ro,t)}function so(e){return e.deleteValue(ro)}var Mo,Vo,ao="propagation",uo=new to,lo=(()=>{function e(){this.createBaggage=Ir,this.getBaggage=no,this.getActiveBaggage=oo,this.setBaggage=io,this.deleteBaggage=so}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return mr(ao,e,Ar.instance())},e.prototype.inject=function(e,t,r){return void 0===r&&(r=ln),this._getGlobalPropagator().inject(e,t,r)},e.prototype.extract=function(e,t,r){return void 0===r&&(r=un),this._getGlobalPropagator().extract(e,t,r)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){yr(ao,Ar.instance())},e.prototype._getGlobalPropagator=function(){return gr(ao)||uo},e})(),co=lo.getInstance(),po="trace",ho=(()=>{function e(){this._proxyTracerProvider=new Hn,this.wrapSpanContext=kn,this.isSpanContextValid=Un,this.deleteSpan=On,this.getSpan=wn,this.getActiveSpan=En,this.getSpanContext=Cn,this.setSpan=An,this.setSpanContext=xn}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=mr(po,this._proxyTracerProvider,Ar.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return gr(po)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){yr(po,Ar.instance()),this._proxyTracerProvider=new Hn},e})(),fo=ho.getInstance(),mo={context:$n,diag:Jn,metrics:eo,propagation:co,trace:fo},go=Object.freeze({__proto__:null,context:$n,diag:Jn,metrics:eo,propagation:co,trace:fo,default:mo,baggageEntryMetadataFromString:Pr,createContextKey:Ur,ROOT_CONTEXT:Dr,DiagConsoleLogger:Vr,get DiagLogLevel(){return _r},createNoopMeter:sn,get ValueType(){return Lr},defaultTextMapGetter:un,defaultTextMapSetter:ln,ProxyTracer:Fn,ProxyTracerProvider:Hn,get SamplingDecision(){return Dn},get SpanKind(){return Mn},get SpanStatusCode(){return Vn},get TraceFlags(){return an},createTraceState:function(e){return new Wn(e)},isSpanContextValid:Un,isValidTraceId:In,isValidSpanId:Pn,INVALID_SPANID:_n,INVALID_TRACEID:vn,INVALID_SPAN_CONTEXT:bn});let yo=Ur("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function _o(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!vo(e))return!1;t=e}}return!0})(e):vo(typeof e))}function vo(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let bo=e=>{var t;Jn.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function So(e){try{bo(e)}catch{}}let To=performance,wo="exception.message",Eo="exception.type",Ao="service.name",Oo="telemetry.sdk.language",xo="webjs",Co="telemetry.sdk.name",Ro="telemetry.sdk.version",No="process.runtime.name",Io={[Co]:"opentelemetry",[No]:"browser",[Oo]:xo,[Ro]:"2.2.0"},Po=Math.pow(10,6),Uo=Math.pow(10,9);function ko(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Po)]}function Lo(){let e=To.timeOrigin;var t;return"number"!=typeof e&&(t=To,e=t.timing&&t.timing.fetchStart),e}function jo(e){var t=ko(Lo()),e=ko("number"==typeof e?e:To.now());return(t=[t[0]+e[0],t[1]+e[1]])[1]>=Uo&&(t[1]-=Uo,t[0]+=1),t}function Do(e){if(t=e,Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])return e;if("number"==typeof e)return(e<Lo()?jo:ko)(e);if(e instanceof Date)return ko(e.getTime());throw TypeError("Invalid input type");var t}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Mo=Mo||{}),(Vo=Vo||{}).HTTP="http";let Bo="[object Null]",Fo="[object Undefined]",qo=Function.prototype.toString,Ho=qo.call(Object),Go=Object.getPrototypeOf,zo=Object.prototype,Ko=zo.hasOwnProperty,Yo=Symbol?Symbol.toStringTag:void 0,Wo=zo.toString;function $o(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?Fo:Bo;if(Yo&&Yo in Object(t)){var r=t,n=Ko.call(r,Yo),o=r[Yo];let e=!1;try{r[Yo]=void 0,e=!0}catch{}var s=Wo.call(r);return e&&(n?r[Yo]=o:delete r[Yo]),s}return n=t,Wo.call(n)})(e)&&(null===(e=Go(e))||"function"==typeof(e=Ko.call(e,"constructor")&&e.constructor)&&e instanceof e&&qo.call(e)===Ho)}function Jo(e){return Zo(e)?e.slice():e}function Xo(r,n,o=0,s){let i;if(!(20<o)){if(o++,ri(r)||ri(n)||ei(n))i=Jo(n);else if(Zo(r)){if(i=r.slice(),Zo(n))for(let e=0,t=n.length;e<t;e++)i.push(Jo(n[e]));else if(ti(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];i[e]=Jo(n[e])}}}else if(ti(r))if(ti(n)){if(e=n,!$o(r)||!$o(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e],l=n[u];if(ri(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(Qo(r,u,s)||Qo(n,u,s))delete i[u];else{if(ti(c)&&ti(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=Xo(i[u],l,o,s)}}}}else i=n;return i}var e}function Qo(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function Zo(e){return Array.isArray(e)}function ei(e){return"function"==typeof e}function ti(e){return!ri(e)&&!Zo(e)&&!ei(e)&&"object"==typeof e}function ri(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class ni extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ni.prototype)}}function oi(e,r){let n;var t=new Promise(function(e,t){n=setTimeout(function(){t(new ni("Operation timed out."))},r)});return Promise.race([e,t]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}class ii{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class si{_callback;_that;_isCalled=!1;_deferred=new ii;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}_r.ALL,_r.VERBOSE,_r.DEBUG,_r.INFO,_r.WARN,_r.ERROR,_r.NONE;let ai={_export:function(e,r){return new Promise(t=>{$n.with($n.active().setValue(yo,!0),()=>{e.export(r,e=>{t(e)})})})}};function ui(){return{handleResponse(e){null!=e&&Object.prototype.hasOwnProperty.call(e,"partialSuccess")&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&Jn.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class li{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,r,n,o){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=n,this._timeout=o,this._diagLogger=Jn.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()?r({code:Mo.FAILED,error:new Error("Concurrent export limit reached")}):null!=(e=this._serializer.serializeRequest(e))?this._promiseQueue.pushPromise(this._transport.send(e,this._timeout).then(t=>{if("success"!==t.status)"failure"===t.status&&t.error?r({code:Mo.FAILED,error:t.error}):"retryable"===t.status?r({code:Mo.FAILED,error:new nr("Export failed with retryable status")}):r({code:Mo.FAILED,error:new nr("Export failed with unknown error")});else{if(null!=t.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(t.data))}catch(e){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",e,t.data)}r({code:Mo.SUCCESS})}},e=>r({code:Mo.FAILED,error:e}))):r({code:Mo.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function ci(e,t,r){return r={transport:r,serializer:t,promiseHandler:ar(e)},t={timeout:e.timeoutMillis},new li(r.transport,r.serializer,ui(),r.promiseHandler,t.timeout)}var pi,di,gi,yi,_i,vi,bi,Si,Ti,hi={exports:{}},fi={},mi={},wi={};function Ei(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ai,Oi,xi,Ci,Ri,Ii,Pi,Ni={},Ui={exports:{}};function ki(){if(!Ii){Ii=1;var e=Ui,t=Ui.exports,r=t,h=(Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,null);try{h=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function d(e){return!0===(e&&e.__isLong__)}function o(e){var t=Math.clz32(e&-e);return e?31-t:t}Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=d;var s={},i={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=m(e,0,!0),o&&(i[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=m(e,e<0?-1:0,!1),o&&(s[e]=r),r)}function f(e,t){if(isNaN(e))return t?b:v;if(t){if(e<0)return b;if(p<=e)return A}else{if(e<=-y)return O;if(y<=e+1)return E}return e<0?f(-e,t).neg():m(e%u|0,e/u|0,t)}function m(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=f,n.fromBits=m;var l=Math.pow;function c(e,t,r){if(0===e.length)throw Error("empty string");if(t="number"==typeof t?(r=t,!1):!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:v;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if(0<(n=e.indexOf("-")))throw Error("interior hyphen");if(0===n)return c(e.substring(1),t,r).neg();for(var o=f(l(r,8)),s=v,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),u=parseInt(e.substring(i,i+a),r);s=(a<8?(a=f(l(r,a)),s.mul(a)):s=s.mul(o)).add(f(u))}return s.unsigned=t,s}function g(e,t){return"number"==typeof e?f(e,t):"string"==typeof e?c(e,t):m(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=c,n.fromValue=g;var u=4294967296,p=u*u,y=p/2,_=a(1<<24),v=a(0),b=(n.ZERO=v,a(0,!0)),S=(n.UZERO=b,a(1)),T=(n.ONE=S,a(1,!0)),w=(n.UONE=T,a(-1)),E=(n.NEG_ONE=w,m(-1,2147483647,!1)),A=(n.MAX_VALUE=E,m(-1,-1,!0)),O=(n.MAX_UNSIGNED_VALUE=A,m(0,-2147483648,!1)),x=(n.MIN_VALUE=O,n.prototype);x.toInt=function(){return this.unsigned?this.low>>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},x.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";var t,r;if(this.isNegative())return this.eq(O)?(r=f(e),r=(t=this.div(r)).mul(r).sub(this),t.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(var n=f(l(e,6),this.unsigned),o=this,s="";;){var i=o.div(n),a=(o.sub(i.mul(n)).toInt()>>>0).toString(e);if((o=i).isZero())return a+s;for(;a.length<6;)a="0"+a;s=""+a+s}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0<t&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},x.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1==e&&!(0===this.low&&-2097152===this.high)},x.isZero=function(){return 0===this.high&&0===this.low},x.eqz=x.isZero,x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||0<=this.high},x.isOdd=function(){return!(1&~this.low)},x.isEven=function(){return!(1&this.low)},x.equals=function(e){return d(e)||(e=g(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},x.eq=x.equals,x.notEquals=function(e){return!this.eq(e)},x.neq=x.notEquals,x.ne=x.notEquals,x.lessThan=function(e){return this.comp(e)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(e){return this.comp(e)<=0},x.lte=x.lessThanOrEqual,x.le=x.lessThanOrEqual,x.greaterThan=function(e){return 0<this.comp(e)},x.gt=x.greaterThan,x.greaterThanOrEqual=function(e){return 0<=this.comp(e)},x.gte=x.greaterThanOrEqual,x.ge=x.greaterThanOrEqual,x.compare=function(e){var t,r;return d(e)||(e=g(e)),this.eq(e)?0:(t=this.isNegative(),r=e.isNegative(),t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1)},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(S)},x.neg=x.negate,x.add=function(e){d(e)||(e=g(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,u=0,l=0,c=0,p=0;return l+=(c=c+((p+=o+(65535&e.low))>>>16)+(n+a))>>>16,m((c&=65535)<<16|(p&=65535),((u+=(l+=r+i)>>>16)+(t+s)&65535)<<16|(l&=65535),this.unsigned)},x.subtract=function(e){return d(e)||(e=g(e)),this.add(e.neg())},x.sub=x.subtract,x.multiply=function(e){var t,r,n,o,s,i,a,u,l,c,p;return this.isZero()?this:(d(e)||(e=g(e)),h?m(h.mul(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):e.isZero()?this.unsigned?b:v:this.eq(O)?e.isOdd()?O:v:e.eq(O)?this.isOdd()?O:v:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(_)&&e.lt(_)?f(this.toNumber()*e.toNumber(),this.unsigned):(t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,p=(p=c=l=u=0)+((l=l+((c+=o*(e=65535&e.low))>>>16)+n*e)>>>16)+((l=(l&65535)+o*a)>>>16),m((l&=65535)<<16|(c&=65535),(u=(u=(u+=(p+=r*e)>>>16)+((p=(p&65535)+n*a)>>>16)+((p=(p&65535)+o*i)>>>16))+(t*e+r*a+n*i+o*s)&65535)<<16|(p&=65535),this.unsigned)))},x.mul=x.multiply,x.divide=function(e){if((e=d(e)?e:g(e)).isZero())throw Error("division by zero");var t,r;if(h)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?m((this.unsigned?h.div_u:h.div_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:v;if(this.unsigned){if((e=e.unsigned?e:e.toUnsigned()).gt(this))return b;if(e.gt(this.shru(1)))return T;r=b}else{if(this.eq(O))return e.eq(S)||e.eq(w)?O:e.eq(O)?S:(n=this.shr(1).div(e).shl(1)).eq(v)?e.isNegative()?S:w:(t=this.sub(e.mul(n)),n.add(t.div(e)));if(e.eq(O))return this.unsigned?b:v;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=v}for(t=this;t.gte(e);){for(var n=Math.max(1,Math.floor(t.toNumber()/e.toNumber())),o=Math.ceil(Math.log(n)/Math.LN2),s=o<=48?1:l(2,o-48),i=f(n),a=i.mul(e);a.isNegative()||a.gt(t);)a=(i=f(n-=s,this.unsigned)).mul(e);i.isZero()&&(i=S),r=r.add(i),t=t.sub(a)}return r},x.div=x.divide,x.modulo=function(e){return d(e)||(e=g(e)),h?m((this.unsigned?h.rem_u:h.rem_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},x.mod=x.modulo,x.rem=x.modulo,x.not=function(){return m(~this.low,~this.high,this.unsigned)},x.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},x.clz=x.countLeadingZeros,x.countTrailingZeros=function(){return this.low?o(this.low):o(this.high)+32},x.ctz=x.countTrailingZeros,x.and=function(e){return d(e)||(e=g(e)),m(this.low&e.low,this.high&e.high,this.unsigned)},x.or=function(e){return d(e)||(e=g(e)),m(this.low|e.low,this.high|e.high,this.unsigned)},x.xor=function(e){return d(e)||(e=g(e)),m(this.low^e.low,this.high^e.high,this.unsigned)},x.shiftLeft=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):m(0,this.low<<e-32,this.unsigned)},x.shl=x.shiftLeft,x.shiftRight=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):m(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):m(32===e?this.high:this.high>>>e-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.shr_u=x.shiftRightUnsigned,x.rotateLeft=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.low<<e|this.high>>>(t=32-e),this.high<<e|this.low>>>t,this.unsigned):(t=32-(e-=32),m(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},x.rotl=x.rotateLeft,x.rotateRight=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.high<<(t=32-e)|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned):(t=32-(e-=32),m(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},x.rotr=x.rotateRight,x.toSigned=function(){return this.unsigned?m(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:m(this.low,this.high,!0)},x.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},x.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(n.fromBigInt=function(e,t){return m(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},n.fromValue=function(e,t){return"bigint"==typeof e?n.fromBigInt(e,t):g(e,t)},x.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),r.default=n,e.exports=t.default||t}return Ui.exports}function Li(){return Pi||(Pi=1,(p=mi).asPromise=(di||(di=1,pi=function(e,t){for(var r=new Array(arguments.length-1),s=0,n=2,i=!0;n<arguments.length;)r[s++]=arguments[n++];return new Promise(function(n,o){r[s]=function(e){if(i)if(i=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,o(e))}})}),pi),p.base64=(gi||(gi=1,(()=>{var e=wi;e.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;1<--t%4&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var l=new Array(64),u=new Array(123),t=0;t<64;)u[l[t]=t<26?t+65:t<52?t+71:t<62?t-4:t-59|43]=t++;e.encode=function(e,t,r){for(var n,o=null,s=[],i=0,a=0;t<r;){var u=e[t++];switch(a){case 0:s[i++]=l[u>>2],n=(3&u)<<4,a=1;break;case 1:s[i++]=l[n|u>>4],n=(15&u)<<2,a=2;break;case 2:s[i++]=l[n|u>>6],s[i++]=l[63&u],a=0}8191<i&&((o=o||[]).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=l[n],s[i++]=61,1===a)&&(s[i++]=61),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var c="invalid encoding";e.decode=function(e,t,r){for(var n,o=r,s=0,i=0;i<e.length;){var a=e.charCodeAt(i++);if(61===a&&1<s)break;if(void 0===(a=u[a]))throw Error(c);switch(s){case 0:n=a,s=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,s=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,s=3;break;case 3:t[r++]=(3&n)<<6|a,s=0}}if(1===s)throw Error(c);return r-o},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}})()),wi),p.EventEmitter=(_i||(_i=1,(yi=s).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},s.prototype.off=function(e,t){if(void 0===e)this._listeners=Object.create(null);else if(void 0===t)this._listeners[e]=[];else{var r=this._listeners[e];if(!r)return this;for(var n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n}return this},s.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}),yi),p.float=bi?vi:(bi=1,vi=r(r)),p.inquire=Ti?Si:(Ti=1,Si=function(e){try{var t=Ei(e);return t&&(t.length||Object.keys(t).length)?t:null}catch(e){return null}}),p.utf8=(Ai||(Ai=1,(c=Ni).length=function(e){for(var t,r=0,n=0;n<e.length;++n)(t=e.charCodeAt(n))<128?r+=1:t<2048?r+=2:55296==(64512&t)&&56320==(64512&e.charCodeAt(n+1))?(++n,r+=4):r+=3;return r},c.read=function(e,t,r){if(r-t<1)return"";for(var n="",o=t;o<r;){var s,i=e[o++];i<=127?n+=String.fromCharCode(i):192<=i&&i<224?n+=128<=(s=(31&i)<<6|63&e[o++])?String.fromCharCode(s):"�":224<=i&&i<240?n+=2048<=(s=(15&i)<<12|(63&e[o++])<<6|63&e[o++])?String.fromCharCode(s):"�":240<=i&&((i=(7&i)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])<65536||1114111<i?n+="�":(i-=65536,n=(n+=String.fromCharCode(55296+(i>>10)))+String.fromCharCode(56320+(1023&i))))}return n},c.write=function(e,t,r){for(var n,o,s=r,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(i+1)))?(++i,t[r++]=(n=65536+((1023&n)<<10)+(1023&o))>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128);return r-s}),Ni),p.pool=(xi||(xi=1,Oi=function(t,r,e){var n=e||8192,o=n>>>1,s=null,i=n;return function(e){if(e<1||o<e)return t(e);n<i+e&&(s=t(n),i=0);e=r.call(s,i,i+=e);return 7&i&&(i=1+(7|i)),e}}),Oi),p.LongBits=(Ri||(Ri=1,Ci=o,i=Li(),(u=o.zero=new o(0,0)).toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){var t,r;return 0===e?u:(r=(e=(t=e<0)?-e:e)>>>0,e=(e-r)/4294967296>>>0,t&&(e=~e>>>0,r=~r>>>0,4294967295<++r)&&(r=0,4294967295<++e)&&(e=0),new o(r,e))},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(i.isString(e)){if(!i.Long)return o.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):u},o.prototype.toNumber=function(e){var t;return!e&&this.hi>>>31?(e=1+~this.lo>>>0,t=~this.hi>>>0,-(e+4294967296*(t=e?t:t+1>>>0))):this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}},l=String.prototype.charCodeAt,o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?u:new o((l.call(e,0)|l.call(e,1)<<8|l.call(e,2)<<16|l.call(e,3)<<24)>>>0,(l.call(e,4)|l.call(e,5)<<8|l.call(e,6)<<16|l.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0==r?0==t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}),Ci),p.isUnsafeProperty=a,p.isNode=Boolean(void 0!==t&&t&&t.process&&t.process.versions&&t.process.versions.node),p.global=p.isNode&&t||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||t,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},p.isString=function(e){return"string"==typeof e||e instanceof String},p.isObject=function(e){return e&&"object"==typeof e},p.isset=p.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||0<(Array.isArray(r)?r:Object.keys(r)).length)},p.Buffer=(()=>{try{var e=p.global.Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}})(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(e){return"number"==typeof e?p.Buffer?p._Buffer_allocUnsafe(e):new p.Array(e):p.Buffer?p._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},p.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||(()=>{try{var e=ki();return e&&e.isLong?e:null}catch(e){return null}})(),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(e){return e?p.LongBits.from(e).toHash():p.LongBits.zeroHash},p.longFromHash=function(e,t){e=p.LongBits.fromHash(e);return p.Long?p.Long.fromBits(e.lo,e.hi,t):e.toNumber(Boolean(t))},p.merge=n,p.nestingLimit=32,p.recursionLimit=100,p.makeProp=function(e,t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0})},p.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},p.newError=e,p.ProtocolError=e("ProtocolError"),p.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;-1<t;--t)if(1===r[e[t]]&&null!=this[e[t]])return e[t]}},p.oneOfSetter=function(r){return function(e){for(var t=0;t<r.length;++t)r[t]!==e&&delete this[r[t]]}},p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},p._configure=function(){var r=p.Buffer;r?(p._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,t){return new r(e,t)},p._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}):p._Buffer_from=p._Buffer_allocUnsafe=null}),mi;function a(e){return"__proto__"===e||"prototype"===e||"constructor"===e}function n(e){for(var t=(r="boolean"==typeof arguments[arguments.length-1])?arguments.length-1:arguments.length,r=r&&arguments[arguments.length-1],n=1;n<t;++n){var o=arguments[n];if(o)for(var s=Object.keys(o),i=0;i<s.length;++i)a(s[i])||void 0!==e[s[i]]&&r||(e[s[i]]=o[s[i]])}return e}function e(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}function o(e,t){this.lo=e>>>0,this.hi=t>>>0}function r(e){return"undefined"!=typeof Float32Array?(l=new Float32Array([-0]),c=new Uint8Array(l.buffer),p=128===c[3],e.writeFloatLE=p?f:m,e.writeFloatBE=p?m:f,e.readFloatLE=p?g:y,e.readFloatBE=p?y:g):(e.writeFloatLE=h.bind(null,_),e.writeFloatBE=h.bind(null,v),e.readFloatLE=d.bind(null,b),e.readFloatBE=d.bind(null,S)),"undefined"!=typeof Float64Array?(a=new Float64Array([-0]),u=new Uint8Array(a.buffer),p=128===u[7],e.writeDoubleLE=p?n:o,e.writeDoubleBE=p?o:n,e.readDoubleLE=p?s:i,e.readDoubleBE=p?i:s):(e.writeDoubleLE=t.bind(null,_,0,4),e.writeDoubleBE=t.bind(null,v,4,0),e.readDoubleLE=r.bind(null,b,0,4),e.readDoubleBE=r.bind(null,S,4,0)),e;function t(e,t,r,n,o,s){var i,a,u=n<0?1:0;0===(n=u?-n:n)?(e(0,o,s+t),e(0<1/n?0:2147483648,o,s+r)):isNaN(n)?(e(0,o,s+t),e(2146959360,o,s+r)):17976931348623157e292<n?(e(0,o,s+t),e((u<<31|2146435072)>>>0,o,s+r)):n<22250738585072014e-324?(e((i=n/5e-324)>>>0,o,s+t),e((u<<31|i/4294967296)>>>0,o,s+r)):(1024===(a=Math.floor(Math.log(n)/Math.LN2))&&(a=1023),e(4503599627370496*(i=n*Math.pow(2,-a))>>>0,o,s+t),e((u<<31|a+1023<<20|1048576*i&1048575)>>>0,o,s+r))}function r(e,t,r,n,o){t=e(n,o+t),e=e(n,o+r),n=2*(e>>31)+1,o=e>>>20&2047,r=4294967296*(1048575&e)+t;return 2047==o?r?NaN:1/0*n:0==o?5e-324*n*r:n*Math.pow(2,o-1075)*(r+4503599627370496)}function n(e,t,r){a[0]=e,t[r]=u[0],t[r+1]=u[1],t[r+2]=u[2],t[r+3]=u[3],t[r+4]=u[4],t[r+5]=u[5],t[r+6]=u[6],t[r+7]=u[7]}function o(e,t,r){a[0]=e,t[r]=u[7],t[r+1]=u[6],t[r+2]=u[5],t[r+3]=u[4],t[r+4]=u[3],t[r+5]=u[2],t[r+6]=u[1],t[r+7]=u[0]}function s(e,t){return u[0]=e[t],u[1]=e[t+1],u[2]=e[t+2],u[3]=e[t+3],u[4]=e[t+4],u[5]=e[t+5],u[6]=e[t+6],u[7]=e[t+7],a[0]}function i(e,t){return u[7]=e[t],u[6]=e[t+1],u[5]=e[t+2],u[4]=e[t+3],u[3]=e[t+4],u[2]=e[t+5],u[1]=e[t+6],u[0]=e[t+7],a[0]}var a,u,l,c,p;function h(e,t,r,n){var o=t<0?1:0;0===(t=o?-t:t)?e(0<1/t?0:2147483648,r,n):isNaN(t)?e(2143289344,r,n):e(34028234663852886e22<t?(o<<31|2139095040)>>>0:t<11754943508222875e-54?(o<<31|Math.round(t/1401298464324817e-60))>>>0:(o<<31|(e=Math.floor(Math.log(t)/Math.LN2))+127<<23|8388607&Math.round(t*Math.pow(2,-e)*8388608))>>>0,r,n)}function d(e,t,r){e=e(t,r),t=2*(e>>31)+1,r=e>>>23&255,e&=8388607;return 255==r?e?NaN:1/0*t:0==r?1401298464324817e-60*t*e:t*Math.pow(2,r-150)*(8388608+e)}function f(e,t,r){l[0]=e,t[r]=c[0],t[r+1]=c[1],t[r+2]=c[2],t[r+3]=c[3]}function m(e,t,r){l[0]=e,t[r]=c[3],t[r+1]=c[2],t[r+2]=c[1],t[r+3]=c[0]}function g(e,t){return c[0]=e[t],c[1]=e[t+1],c[2]=e[t+2],c[3]=e[t+3],l[0]}function y(e,t){return c[3]=e[t],c[2]=e[t+1],c[1]=e[t+2],c[0]=e[t+3],l[0]}}function _(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function v(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function S(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function s(){this._listeners=Object.create(null)}var i,u,l,c,p}var ji,Di=zi,Mi=Li(),Vi=Mi.LongBits,Bi=Mi.base64,Fi=Mi.utf8;function qi(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function Hi(){}function Gi(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function zi(){this.len=0,this.head=new qi(Hi,0,0),this.tail=this.head,this.states=null}var Ki=function(){return Mi.Buffer?function(){return(zi.create=function(){return new ji})()}:function(){return new zi}};function Yi(e,t,r){t[r]=255&e}function Wi(e,t){this.len=e,this.next=void 0,this.val=t}function $i(e,t,r){for(var n=e.lo,o=e.hi;o;)t[r++]=127&n|128,n=(n>>>7|o<<25)>>>0,o>>>=7;for(;127<n;)t[r++]=127&n|128,n>>>=7;t[r++]=n}function Ji(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}zi.create=Ki(),zi.alloc=function(e){return new Mi.Array(e)},Mi.Array!==Array&&(zi.alloc=Mi.pool(zi.alloc,Mi.Array.prototype.subarray)),zi.prototype._push=function(e,t,r){return this.tail=this.tail.next=new qi(e,t,r),this.len+=t,this},Wi.prototype=Object.create(qi.prototype),Wi.prototype.fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},zi.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Wi((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},zi.prototype.int32=function(e){return(e|=0)<0?this._push($i,10,Vi.fromNumber(e)):this.uint32(e)},zi.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},zi.prototype.uint64=function(e){e=Vi.from(e);return this._push($i,e.length(),e)},zi.prototype.int64=zi.prototype.uint64,zi.prototype.sint64=function(e){e=Vi.from(e).zzEncode();return this._push($i,e.length(),e)},zi.prototype.bool=function(e){return this._push(Yi,1,e?1:0)},zi.prototype.fixed32=function(e){return this._push(Ji,4,e>>>0)},zi.prototype.sfixed32=zi.prototype.fixed32,zi.prototype.fixed64=function(e){e=Vi.from(e);return this._push(Ji,4,e.lo)._push(Ji,4,e.hi)},zi.prototype.sfixed64=zi.prototype.fixed64,zi.prototype.float=function(e){return this._push(Mi.float.writeFloatLE,4,e)},zi.prototype.double=function(e){return this._push(Mi.float.writeDoubleLE,8,e)};var Xi=Mi.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]},Qi=(zi.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(Mi.isString(e)&&(t=zi.alloc(r=Bi.length(e)),Bi.decode(e,t,0),e=t),this.uint32(r)._push(Xi,r,e)):this._push(Yi,1,0)},zi.prototype.string=function(e){var t=Fi.length(e);return t?this.uint32(t)._push(Fi.write,t,e):this._push(Yi,1,0)},zi.prototype.fork=function(){return this.states=new Gi(this),this.head=this.tail=new qi(Hi,0,0),this.len=0,this},zi.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new qi(Hi,0,0),this.len=0),this},zi.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},zi.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},zi._configure=function(e){ji=e,zi.create=Ki(),ji._configure()},ts),Zi=Di,es=((ts.prototype=Object.create(Zi.prototype)).constructor=ts,Li());function ts(){Zi.call(this)}function rs(e,t,r){e.length<40?es.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}ts._configure=function(){ts.alloc=es._Buffer_allocUnsafe,ts.writeBytesBuffer=es.Buffer&&es.Buffer.prototype instanceof Uint8Array&&"set"===es.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},ts.prototype.bytes=function(e){var t=(e=es.isString(e)?es._Buffer_from(e,"base64"):e).length>>>0;return this.uint32(t),t&&this._push(ts.writeBytesBuffer,t,e),this},ts.prototype.string=function(e){var t=es.Buffer.byteLength(e);return this.uint32(t),t&&this._push(rs,t,e),this},ts._configure();var ns,os=ls,is=Li(),ss=is.LongBits,as=is.utf8;function us(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function ls(e){this.buf=e,this.pos=0,this.len=e.length}var cs,ps="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ls(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ls(e);throw Error("illegal buffer")},ds=function(){return is.Buffer?function(e){return(ls.create=function(e){return is.Buffer.isBuffer(e)?new ns(e):ps(e)})(e)}:ps};function hs(){var e=new ss(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw us(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw us(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function fs(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function ms(){if(this.pos+8>this.len)throw us(this,8);return new ss(fs(this.buf,this.pos+=4),fs(this.buf,this.pos+=4))}ls.create=ds(),ls.prototype._slice=is.Array.prototype.subarray||is.Array.prototype.slice,ls.prototype.uint32=(cs=4294967295,function(){if(cs=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(cs=(cs|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(cs=(cs|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(cs=(cs|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(cs=(cs|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return cs;throw this.pos=this.len,us(this,10)}),ls.prototype.int32=function(){return 0|this.uint32()},ls.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},ls.prototype.bool=function(){return 0!==this.uint32()},ls.prototype.fixed32=function(){if(this.pos+4>this.len)throw us(this,4);return fs(this.buf,this.pos+=4)},ls.prototype.sfixed32=function(){if(this.pos+4>this.len)throw us(this,4);return 0|fs(this.buf,this.pos+=4)},ls.prototype.float=function(){if(this.pos+4>this.len)throw us(this,4);var e=is.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},ls.prototype.double=function(){if(this.pos+8>this.len)throw us(this,4);var e=is.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},ls.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw us(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?(e=is.Buffer)?e.alloc(0):new this.buf.constructor(0):this._slice.call(this.buf,t,r)},ls.prototype.string=function(){var e=this.bytes();return as.read(e,0,e.length)},ls.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw us(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw us(this)}while(128&this.buf[this.pos++]);return this},ls.recursionLimit=is.recursionLimit,ls.prototype.skipType=function(e,t){if((t=void 0===t?0:t)>ls.recursionLimit)throw Error("maximum nesting depth exceeded");switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e,t+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},ls._configure=function(e){ns=e,ls.create=ds(),ns._configure();var t=is.Long?"toLong":"toNumber";is.merge(ls.prototype,{int64:function(){return hs.call(this)[t](!1)},uint64:function(){return hs.call(this)[t](!0)},sint64:function(){return hs.call(this).zzDecode()[t](!1)},fixed64:function(){return ms.call(this)[t](!0)},sfixed64:function(){return ms.call(this)[t](!1)}})};var gs=vs,ys=os,_s=((vs.prototype=Object.create(ys.prototype)).constructor=vs,Li());function vs(e){ys.call(this,e)}vs._configure=function(){_s.Buffer&&(vs.prototype._slice=_s.Buffer.prototype.slice)},vs.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},vs._configure();var bs={},Ss=ws,Ts=Li();function ws(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");Ts.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((ws.prototype=Object.create(Ts.EventEmitter.prototype)).constructor=ws).prototype.rpcCall=function e(r,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return Ts.asPromise(e,i,r,t,n,o);if(i.rpcImpl)try{return i.rpcImpl(r,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return i.emit("error",e,r),s(e);if(null!==t){if(!(t instanceof n))try{t=n[i.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return i.emit("error",e,r),s(e)}return i.emit("data",t,r),s(null,t)}i.end(!0)})}catch(e){i.emit("error",e,r),setTimeout(function(){s(e)},0)}else setTimeout(function(){s(Error("already ended"))},0)},ws.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},bs.Service=Ss;var Es=Object.create(null);(()=>{var e=fi;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=Di,e.BufferWriter=Qi,e.Reader=os,e.BufferReader=gs,e.util=Li(),e.rpc=bs,e.roots=Es,e.configure=t,t()})();var As,Os,xs,Cs,Rs,Qs,Zs,ea,ta,pa,ga,Ns=hi.exports=fi,Is=Ns.Reader,Ps=Ns.Writer,Us=Ns.util,ks=Ns.roots.default||(Ns.roots.default={}),Ls=(ks.opentelemetry=((Rs={}).proto=((Cs={}).common=(()=>{var e,t,r={};return r.v1=((e={}).AnyValue=(u.prototype.stringValue=null,u.prototype.boolValue=null,u.prototype.intValue=null,u.prototype.doubleValue=null,u.prototype.arrayValue=null,u.prototype.kvlistValue=null,u.prototype.bytesValue=null,Object.defineProperty(u.prototype,"value",{get:Us.oneOfGetter(t=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:Us.oneOfSetter(t)}),u.create=function(e){return new u(e)},u.encode=function(e,t){return t=t||Ps.create(),null!=e.stringValue&&Object.hasOwnProperty.call(e,"stringValue")&&t.uint32(10).string(e.stringValue),null!=e.boolValue&&Object.hasOwnProperty.call(e,"boolValue")&&t.uint32(16).bool(e.boolValue),null!=e.intValue&&Object.hasOwnProperty.call(e,"intValue")&&t.uint32(24).int64(e.intValue),null!=e.doubleValue&&Object.hasOwnProperty.call(e,"doubleValue")&&t.uint32(33).double(e.doubleValue),null!=e.arrayValue&&Object.hasOwnProperty.call(e,"arrayValue")&&ks.opentelemetry.proto.common.v1.ArrayValue.encode(e.arrayValue,t.uint32(42).fork()).ldelim(),null!=e.kvlistValue&&Object.hasOwnProperty.call(e,"kvlistValue")&&ks.opentelemetry.proto.common.v1.KeyValueList.encode(e.kvlistValue,t.uint32(50).fork()).ldelim(),null!=e.bytesValue&&Object.hasOwnProperty.call(e,"bytesValue")&&t.uint32(58).bytes(e.bytesValue),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.common.v1.AnyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.stringValue=e.string();break;case 2:o.boolValue=e.bool();break;case 3:o.intValue=e.int64();break;case 4:o.doubleValue=e.double();break;case 5:o.arrayValue=ks.opentelemetry.proto.common.v1.ArrayValue.decode(e,e.uint32());break;case 6:o.kvlistValue=ks.opentelemetry.proto.common.v1.KeyValueList.decode(e,e.uint32());break;case 7:o.bytesValue=e.bytes();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.value=1,!Us.isString(e.stringValue)))return"stringValue: string expected";if(null!=e.boolValue&&e.hasOwnProperty("boolValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"boolean"!=typeof e.boolValue)return"boolValue: boolean expected"}if(null!=e.intValue&&e.hasOwnProperty("intValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(Us.isInteger(e.intValue)||e.intValue&&Us.isInteger(e.intValue.low)&&Us.isInteger(e.intValue.high)))return"intValue: integer|Long expected"}if(null!=e.doubleValue&&e.hasOwnProperty("doubleValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"number"!=typeof e.doubleValue)return"doubleValue: number expected"}if(null!=e.arrayValue&&e.hasOwnProperty("arrayValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=ks.opentelemetry.proto.common.v1.ArrayValue.verify(e.arrayValue))return"arrayValue."+t}if(null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=ks.opentelemetry.proto.common.v1.KeyValueList.verify(e.kvlistValue))return"kvlistValue."+t}if(null!=e.bytesValue&&e.hasOwnProperty("bytesValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(e.bytesValue&&"number"==typeof e.bytesValue.length||Us.isString(e.bytesValue)))return"bytesValue: buffer expected"}return null},u.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.common.v1.AnyValue)return e;var t=new ks.opentelemetry.proto.common.v1.AnyValue;if(null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),null!=e.intValue&&(Us.Long?(t.intValue=Us.Long.fromValue(e.intValue)).unsigned=!1:"string"==typeof e.intValue?t.intValue=parseInt(e.intValue,10):"number"==typeof e.intValue?t.intValue=e.intValue:"object"==typeof e.intValue&&(t.intValue=new Us.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.arrayValue){if("object"!=typeof e.arrayValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");t.arrayValue=ks.opentelemetry.proto.common.v1.ArrayValue.fromObject(e.arrayValue)}if(null!=e.kvlistValue){if("object"!=typeof e.kvlistValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");t.kvlistValue=ks.opentelemetry.proto.common.v1.KeyValueList.fromObject(e.kvlistValue)}return null!=e.bytesValue&&("string"==typeof e.bytesValue?Us.base64.decode(e.bytesValue,t.bytesValue=Us.newBuffer(Us.base64.length(e.bytesValue)),0):0<=e.bytesValue.length&&(t.bytesValue=e.bytesValue)),t},u.toObject=function(e,t){t=t||{};var r={};return null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.stringValue=e.stringValue,t.oneofs)&&(r.value="stringValue"),null!=e.boolValue&&e.hasOwnProperty("boolValue")&&(r.boolValue=e.boolValue,t.oneofs)&&(r.value="boolValue"),null!=e.intValue&&e.hasOwnProperty("intValue")&&("number"==typeof e.intValue?r.intValue=t.longs===String?String(e.intValue):e.intValue:r.intValue=t.longs===String?Us.Long.prototype.toString.call(e.intValue):t.longs===Number?new Us.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber():e.intValue,t.oneofs)&&(r.value="intValue"),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(r.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue,t.oneofs)&&(r.value="doubleValue"),null!=e.arrayValue&&e.hasOwnProperty("arrayValue")&&(r.arrayValue=ks.opentelemetry.proto.common.v1.ArrayValue.toObject(e.arrayValue,t),t.oneofs)&&(r.value="arrayValue"),null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")&&(r.kvlistValue=ks.opentelemetry.proto.common.v1.KeyValueList.toObject(e.kvlistValue,t),t.oneofs)&&(r.value="kvlistValue"),null!=e.bytesValue&&e.hasOwnProperty("bytesValue")&&(r.bytesValue=t.bytes===String?Us.base64.encode(e.bytesValue,0,e.bytesValue.length):t.bytes===Array?Array.prototype.slice.call(e.bytesValue):e.bytesValue,t.oneofs)&&(r.value="bytesValue"),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.AnyValue"},u),e.ArrayValue=(a.prototype.values=Us.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ps.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)ks.opentelemetry.proto.common.v1.AnyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.common.v1.ArrayValue;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(ks.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=ks.opentelemetry.proto.common.v1.AnyValue.verify(e.values[t]);if(r)return"values."+r}}return null},a.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.common.v1.ArrayValue)return e;var t=new ks.opentelemetry.proto.common.v1.ArrayValue;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");t.values[r]=ks.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=ks.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.ArrayValue"},a),e.KeyValueList=(i.prototype.values=Us.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ps.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.common.v1.KeyValueList;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},i.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.values[t]);if(r)return"values."+r}}return null},i.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.common.v1.KeyValueList)return e;var t=new ks.opentelemetry.proto.common.v1.KeyValueList;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");t.values[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[r])}}return t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[n],t)}return r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValueList"},i),e.KeyValue=(s.prototype.key=null,s.prototype.value=null,s.create=function(e){return new s(e)},s.encode=function(e,t){return t=t||Ps.create(),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).string(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&ks.opentelemetry.proto.common.v1.AnyValue.encode(e.value,t.uint32(18).fork()).ldelim(),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.common.v1.KeyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.key=e.string();break;case 2:o.value=ks.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.key&&e.hasOwnProperty("key")&&!Us.isString(e.key))return"key: string expected";if(null!=e.value&&e.hasOwnProperty("value")){e=ks.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(e)return"value."+e}return null},s.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.common.v1.KeyValue)return e;var t=new ks.opentelemetry.proto.common.v1.KeyValue;if(null!=e.key&&(t.key=String(e.key)),null!=e.value){if("object"!=typeof e.value)throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");t.value=ks.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return t},s.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.key="",r.value=null),null!=e.key&&e.hasOwnProperty("key")&&(r.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=ks.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,t)),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValue"},s),e.InstrumentationScope=(o.prototype.name=null,o.prototype.version=null,o.prototype.attributes=Us.emptyArray,o.prototype.droppedAttributesCount=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ps.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(18).string(e.version),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.version=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Us.isString(e.name))return"name: string expected";if(null!=e.version&&e.hasOwnProperty("version")&&!Us.isString(e.version))return"version: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Us.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.common.v1.InstrumentationScope)return e;var t=new ks.opentelemetry.proto.common.v1.InstrumentationScope;if(null!=e.name&&(t.name=String(e.name)),null!=e.version&&(t.version=String(e.version)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(r.name="",r.version="",r.droppedAttributesCount=0),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.version&&e.hasOwnProperty("version")&&(r.version=e.version),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.InstrumentationScope"},o),e.EntityRef=(n.prototype.schemaUrl=null,n.prototype.type=null,n.prototype.idKeys=Us.emptyArray,n.prototype.descriptionKeys=Us.emptyArray,n.create=function(e){return new n(e)},n.encode=function(e,t){if(t=t||Ps.create(),null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(10).string(e.schemaUrl),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(18).string(e.type),null!=e.idKeys&&e.idKeys.length)for(var r=0;r<e.idKeys.length;++r)t.uint32(26).string(e.idKeys[r]);if(null!=e.descriptionKeys&&e.descriptionKeys.length)for(r=0;r<e.descriptionKeys.length;++r)t.uint32(34).string(e.descriptionKeys[r]);return t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.common.v1.EntityRef;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.schemaUrl=e.string();break;case 2:o.type=e.string();break;case 3:o.idKeys&&o.idKeys.length||(o.idKeys=[]),o.idKeys.push(e.string());break;case 4:o.descriptionKeys&&o.descriptionKeys.length||(o.descriptionKeys=[]),o.descriptionKeys.push(e.string());break;default:e.skipType(7&s)}}return o},n.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl))return"schemaUrl: string expected";if(null!=e.type&&e.hasOwnProperty("type")&&!Us.isString(e.type))return"type: string expected";if(null!=e.idKeys&&e.hasOwnProperty("idKeys")){if(!Array.isArray(e.idKeys))return"idKeys: array expected";for(var t=0;t<e.idKeys.length;++t)if(!Us.isString(e.idKeys[t]))return"idKeys: string[] expected"}if(null!=e.descriptionKeys&&e.hasOwnProperty("descriptionKeys")){if(!Array.isArray(e.descriptionKeys))return"descriptionKeys: array expected";for(t=0;t<e.descriptionKeys.length;++t)if(!Us.isString(e.descriptionKeys[t]))return"descriptionKeys: string[] expected"}return null},n.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.common.v1.EntityRef)return e;var t=new ks.opentelemetry.proto.common.v1.EntityRef;if(null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),null!=e.type&&(t.type=String(e.type)),e.idKeys){if(!Array.isArray(e.idKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.idKeys: array expected");t.idKeys=[];for(var r=0;r<e.idKeys.length;++r)t.idKeys[r]=String(e.idKeys[r])}if(e.descriptionKeys){if(!Array.isArray(e.descriptionKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.descriptionKeys: array expected");for(t.descriptionKeys=[],r=0;r<e.descriptionKeys.length;++r)t.descriptionKeys[r]=String(e.descriptionKeys[r])}return t},n.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.idKeys=[],r.descriptionKeys=[]),t.defaults&&(r.schemaUrl="",r.type=""),null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),null!=e.type&&e.hasOwnProperty("type")&&(r.type=e.type),e.idKeys&&e.idKeys.length){r.idKeys=[];for(var n=0;n<e.idKeys.length;++n)r.idKeys[n]=e.idKeys[n]}if(e.descriptionKeys&&e.descriptionKeys.length)for(r.descriptionKeys=[],n=0;n<e.descriptionKeys.length;++n)r.descriptionKeys[n]=e.descriptionKeys[n];return r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.EntityRef"},n),e),r;function n(e){if(this.idKeys=[],this.descriptionKeys=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Cs.resource=((Os={}).v1=((As={}).Resource=(()=>{function t(e){if(this.attributes=[],this.entityRefs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return t.prototype.attributes=Us.emptyArray,t.prototype.droppedAttributesCount=null,t.prototype.entityRefs=Us.emptyArray,t.create=function(e){return new t(e)},t.encode=function(e,t){if(t=t||Ps.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(16).uint32(e.droppedAttributesCount),null!=e.entityRefs&&e.entityRefs.length)for(r=0;r<e.entityRefs.length;++r)ks.opentelemetry.proto.common.v1.EntityRef.encode(e.entityRefs[r],t.uint32(26).fork()).ldelim();return t},t.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},t.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.resource.v1.Resource;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.droppedAttributesCount=e.uint32();break;case 3:o.entityRefs&&o.entityRefs.length||(o.entityRefs=[]),o.entityRefs.push(ks.opentelemetry.proto.common.v1.EntityRef.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},t.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Us.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.entityRefs&&e.hasOwnProperty("entityRefs")){if(!Array.isArray(e.entityRefs))return"entityRefs: array expected";for(t=0;t<e.entityRefs.length;++t){var r;if(r=ks.opentelemetry.proto.common.v1.EntityRef.verify(e.entityRefs[t]))return"entityRefs."+r}}return null},t.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.resource.v1.Resource)return e;var t=new ks.opentelemetry.proto.resource.v1.Resource;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.entityRefs){if(!Array.isArray(e.entityRefs))throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: array expected");for(t.entityRefs=[],r=0;r<e.entityRefs.length;++r){if("object"!=typeof e.entityRefs[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: object expected");t.entityRefs[r]=ks.opentelemetry.proto.common.v1.EntityRef.fromObject(e.entityRefs[r])}}return t},t.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[],r.entityRefs=[]),t.defaults&&(r.droppedAttributesCount=0),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),e.entityRefs&&e.entityRefs.length)for(r.entityRefs=[],n=0;n<e.entityRefs.length;++n)r.entityRefs[n]=ks.opentelemetry.proto.common.v1.EntityRef.toObject(e.entityRefs[n],t);return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},t.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.resource.v1.Resource"},t})(),As),Os),Cs.trace=(()=>{var e,t,r,n={};return n.v1=((r={}).TracesData=(c.prototype.resourceSpans=Us.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Ps.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)ks.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.TracesData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(ks.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},c.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=ks.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},c.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.TracesData)return e;var t=new ks.opentelemetry.proto.trace.v1.TracesData;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");t.resourceSpans[r]=ks.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},c.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=ks.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},c.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.TracesData"},c),r.ResourceSpans=(l.prototype.resource=null,l.prototype.scopeSpans=Us.emptyArray,l.prototype.schemaUrl=null,l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Ps.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&ks.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeSpans&&e.scopeSpans.length)for(var r=0;r<e.scopeSpans.length;++r)ks.opentelemetry.proto.trace.v1.ScopeSpans.encode(e.scopeSpans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=ks.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeSpans&&o.scopeSpans.length||(o.scopeSpans=[]),o.scopeSpans.push(ks.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=ks.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeSpans&&e.hasOwnProperty("scopeSpans")){if(!Array.isArray(e.scopeSpans))return"scopeSpans: array expected";for(var t,r=0;r<e.scopeSpans.length;++r)if(t=ks.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[r]))return"scopeSpans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl)?"schemaUrl: string expected":null},l.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.ResourceSpans)return e;var t=new ks.opentelemetry.proto.trace.v1.ResourceSpans;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");t.resource=ks.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeSpans){if(!Array.isArray(e.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");t.scopeSpans=[];for(var r=0;r<e.scopeSpans.length;++r){if("object"!=typeof e.scopeSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");t.scopeSpans[r]=ks.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},l.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeSpans=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=ks.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeSpans&&e.scopeSpans.length){r.scopeSpans=[];for(var n=0;n<e.scopeSpans.length;++n)r.scopeSpans[n]=ks.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},l.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ResourceSpans"},l),r.ScopeSpans=(u.prototype.scope=null,u.prototype.spans=Us.emptyArray,u.prototype.schemaUrl=null,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Ps.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&ks.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.spans&&e.spans.length)for(var r=0;r<e.spans.length;++r)ks.opentelemetry.proto.trace.v1.Span.encode(e.spans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.spans&&o.spans.length||(o.spans=[]),o.spans.push(ks.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=ks.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.spans&&e.hasOwnProperty("spans")){if(!Array.isArray(e.spans))return"spans: array expected";for(var t,r=0;r<e.spans.length;++r)if(t=ks.opentelemetry.proto.trace.v1.Span.verify(e.spans[r]))return"spans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl)?"schemaUrl: string expected":null},u.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.ScopeSpans)return e;var t=new ks.opentelemetry.proto.trace.v1.ScopeSpans;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");t.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.spans){if(!Array.isArray(e.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");t.spans=[];for(var r=0;r<e.spans.length;++r){if("object"!=typeof e.spans[r])throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");t.spans[r]=ks.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.spans=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.spans&&e.spans.length){r.spans=[];for(var n=0;n<e.spans.length;++n)r.spans[n]=ks.opentelemetry.proto.trace.v1.Span.toObject(e.spans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ScopeSpans"},u),r.Span=(s.prototype.traceId=null,s.prototype.spanId=null,s.prototype.traceState=null,s.prototype.parentSpanId=null,s.prototype.flags=null,s.prototype.name=null,s.prototype.kind=null,s.prototype.startTimeUnixNano=null,s.prototype.endTimeUnixNano=null,s.prototype.attributes=Us.emptyArray,s.prototype.droppedAttributesCount=null,s.prototype.events=Us.emptyArray,s.prototype.droppedEventsCount=null,s.prototype.links=Us.emptyArray,s.prototype.droppedLinksCount=null,s.prototype.status=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ps.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.parentSpanId&&Object.hasOwnProperty.call(e,"parentSpanId")&&t.uint32(34).bytes(e.parentSpanId),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(42).string(e.name),null!=e.kind&&Object.hasOwnProperty.call(e,"kind")&&t.uint32(48).int32(e.kind),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(57).fixed64(e.startTimeUnixNano),null!=e.endTimeUnixNano&&Object.hasOwnProperty.call(e,"endTimeUnixNano")&&t.uint32(65).fixed64(e.endTimeUnixNano),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(80).uint32(e.droppedAttributesCount),null!=e.events&&e.events.length)for(r=0;r<e.events.length;++r)ks.opentelemetry.proto.trace.v1.Span.Event.encode(e.events[r],t.uint32(90).fork()).ldelim();if(null!=e.droppedEventsCount&&Object.hasOwnProperty.call(e,"droppedEventsCount")&&t.uint32(96).uint32(e.droppedEventsCount),null!=e.links&&e.links.length)for(r=0;r<e.links.length;++r)ks.opentelemetry.proto.trace.v1.Span.Link.encode(e.links[r],t.uint32(106).fork()).ldelim();return null!=e.droppedLinksCount&&Object.hasOwnProperty.call(e,"droppedLinksCount")&&t.uint32(112).uint32(e.droppedLinksCount),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&ks.opentelemetry.proto.trace.v1.Status.encode(e.status,t.uint32(122).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(133).fixed32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.Span;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.parentSpanId=e.bytes();break;case 16:o.flags=e.fixed32();break;case 5:o.name=e.string();break;case 6:o.kind=e.int32();break;case 7:o.startTimeUnixNano=e.fixed64();break;case 8:o.endTimeUnixNano=e.fixed64();break;case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 10:o.droppedAttributesCount=e.uint32();break;case 11:o.events&&o.events.length||(o.events=[]),o.events.push(ks.opentelemetry.proto.trace.v1.Span.Event.decode(e,e.uint32()));break;case 12:o.droppedEventsCount=e.uint32();break;case 13:o.links&&o.links.length||(o.links=[]),o.links.push(ks.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break;case 14:o.droppedLinksCount=e.uint32();break;case 15:o.status=ks.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Us.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Us.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!Us.isString(e.traceState))return"traceState: string expected";if(null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&"number"==typeof e.parentSpanId.length||Us.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags))return"flags: integer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Us.isString(e.name))return"name: string expected";if(null!=e.kind&&e.hasOwnProperty("kind"))switch(e.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Us.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Us.isInteger(e.startTimeUnixNano.low)&&Us.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&!(Us.isInteger(e.endTimeUnixNano)||e.endTimeUnixNano&&Us.isInteger(e.endTimeUnixNano.low)&&Us.isInteger(e.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Us.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(t=0;t<e.events.length;++t)if(r=ks.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[t]))return"events."+r}if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&!Us.isInteger(e.droppedEventsCount))return"droppedEventsCount: integer expected";if(null!=e.links&&e.hasOwnProperty("links")){if(!Array.isArray(e.links))return"links: array expected";for(t=0;t<e.links.length;++t)if(r=ks.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[t]))return"links."+r}return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&!Us.isInteger(e.droppedLinksCount)?"droppedLinksCount: integer expected":null!=e.status&&e.hasOwnProperty("status")&&(r=ks.opentelemetry.proto.trace.v1.Status.verify(e.status))?"status."+r:null;var r},s.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.Span)return e;var t=new ks.opentelemetry.proto.trace.v1.Span;switch(null!=e.traceId&&("string"==typeof e.traceId?Us.base64.decode(e.traceId,t.traceId=Us.newBuffer(Us.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Us.base64.decode(e.spanId,t.spanId=Us.newBuffer(Us.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),null!=e.parentSpanId&&("string"==typeof e.parentSpanId?Us.base64.decode(e.parentSpanId,t.parentSpanId=Us.newBuffer(Us.base64.length(e.parentSpanId)),0):0<=e.parentSpanId.length&&(t.parentSpanId=e.parentSpanId)),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.name&&(t.name=String(e.name)),e.kind){default:"number"==typeof e.kind&&(t.kind=e.kind);break;case"SPAN_KIND_UNSPECIFIED":case 0:t.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:t.kind=1;break;case"SPAN_KIND_SERVER":case 2:t.kind=2;break;case"SPAN_KIND_CLIENT":case 3:t.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:t.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:t.kind=5}if(null!=e.startTimeUnixNano&&(Us.Long?(t.startTimeUnixNano=Us.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.endTimeUnixNano&&(Us.Long?(t.endTimeUnixNano=Us.Long.fromValue(e.endTimeUnixNano)).unsigned=!1:"string"==typeof e.endTimeUnixNano?t.endTimeUnixNano=parseInt(e.endTimeUnixNano,10):"number"==typeof e.endTimeUnixNano?t.endTimeUnixNano=e.endTimeUnixNano:"object"==typeof e.endTimeUnixNano&&(t.endTimeUnixNano=new Us.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber())),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.events){if(!Array.isArray(e.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");for(t.events=[],r=0;r<e.events.length;++r){if("object"!=typeof e.events[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");t.events[r]=ks.opentelemetry.proto.trace.v1.Span.Event.fromObject(e.events[r])}}if(null!=e.droppedEventsCount&&(t.droppedEventsCount=e.droppedEventsCount>>>0),e.links){if(!Array.isArray(e.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");for(t.links=[],r=0;r<e.links.length;++r){if("object"!=typeof e.links[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");t.links[r]=ks.opentelemetry.proto.trace.v1.Span.Link.fromObject(e.links[r])}}if(null!=e.droppedLinksCount&&(t.droppedLinksCount=e.droppedLinksCount>>>0),null!=e.status){if("object"!=typeof e.status)throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");t.status=ks.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.events=[],n.links=[]),t.defaults&&(t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Us.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Us.newBuffer(n.spanId))),n.traceState="",t.bytes===String?n.parentSpanId="":(n.parentSpanId=[],t.bytes!==Array&&(n.parentSpanId=Us.newBuffer(n.parentSpanId))),n.name="",n.kind=t.enums===String?"SPAN_KIND_UNSPECIFIED":0,Us.Long?(r=new Us.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.endTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.endTimeUnixNano=t.longs===String?"0":0,n.droppedAttributesCount=0,n.droppedEventsCount=0,n.droppedLinksCount=0,n.status=null,n.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Us.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Us.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(n.traceState=e.traceState),null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&(n.parentSpanId=t.bytes===String?Us.base64.encode(e.parentSpanId,0,e.parentSpanId.length):t.bytes===Array?Array.prototype.slice.call(e.parentSpanId):e.parentSpanId),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=t.enums!==String||void 0===ks.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]?e.kind:ks.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&("number"==typeof e.endTimeUnixNano?n.endTimeUnixNano=t.longs===String?String(e.endTimeUnixNano):e.endTimeUnixNano:n.endTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.endTimeUnixNano):t.longs===Number?new Us.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber():e.endTimeUnixNano),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),e.events&&e.events.length)for(n.events=[],o=0;o<e.events.length;++o)n.events[o]=ks.opentelemetry.proto.trace.v1.Span.Event.toObject(e.events[o],t);if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&(n.droppedEventsCount=e.droppedEventsCount),e.links&&e.links.length)for(n.links=[],o=0;o<e.links.length;++o)n.links[o]=ks.opentelemetry.proto.trace.v1.Span.Link.toObject(e.links[o],t);return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&(n.droppedLinksCount=e.droppedLinksCount),null!=e.status&&e.hasOwnProperty("status")&&(n.status=ks.opentelemetry.proto.trace.v1.Status.toObject(e.status,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span"},s.SpanKind=(e={},(t=Object.create(e))[e[0]="SPAN_KIND_UNSPECIFIED"]=0,t[e[1]="SPAN_KIND_INTERNAL"]=1,t[e[2]="SPAN_KIND_SERVER"]=2,t[e[3]="SPAN_KIND_CLIENT"]=3,t[e[4]="SPAN_KIND_PRODUCER"]=4,t[e[5]="SPAN_KIND_CONSUMER"]=5,t),s.Event=(a.prototype.timeUnixNano=null,a.prototype.name=null,a.prototype.attributes=Us.emptyArray,a.prototype.droppedAttributesCount=null,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ps.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(18).string(e.name),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.Span.Event;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 2:o.name=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Us.isString(e.name))return"name: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Us.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},a.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.Span.Event)return e;var t=new ks.opentelemetry.proto.trace.v1.Span.Event;if(null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.name&&(t.name=String(e.name)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.name="",n.droppedAttributesCount=0),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Event"},a),s.Link=(i.prototype.traceId=null,i.prototype.spanId=null,i.prototype.traceState=null,i.prototype.attributes=Us.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.flags=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ps.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(34).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(40).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(53).fixed32(e.flags),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.Span.Link;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 5:o.droppedAttributesCount=e.uint32();break;case 6:o.flags=e.fixed32();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Us.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Us.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!Us.isString(e.traceState))return"traceState: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Us.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags)?"flags: integer expected":null},i.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.Span.Link)return e;var t=new ks.opentelemetry.proto.trace.v1.Span.Link;if(null!=e.traceId&&("string"==typeof e.traceId?Us.base64.decode(e.traceId,t.traceId=Us.newBuffer(Us.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Us.base64.decode(e.spanId,t.spanId=Us.newBuffer(Us.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(t.bytes===String?r.traceId="":(r.traceId=[],t.bytes!==Array&&(r.traceId=Us.newBuffer(r.traceId))),t.bytes===String?r.spanId="":(r.spanId=[],t.bytes!==Array&&(r.spanId=Us.newBuffer(r.spanId))),r.traceState="",r.droppedAttributesCount=0,r.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(r.traceId=t.bytes===String?Us.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(r.spanId=t.bytes===String?Us.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(r.traceState=e.traceState),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(r.flags=e.flags),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Link"},i),s),r.Status=(o.prototype.message=null,o.prototype.code=null,o.create=function(e){return new o(e)},o.encode=function(e,t){return t=t||Ps.create(),null!=e.message&&Object.hasOwnProperty.call(e,"message")&&t.uint32(18).string(e.message),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(24).int32(e.code),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.trace.v1.Status;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 2:o.message=e.string();break;case 3:o.code=e.int32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.message&&e.hasOwnProperty("message")&&!Us.isString(e.message))return"message: string expected";if(null!=e.code&&e.hasOwnProperty("code"))switch(e.code){default:return"code: enum value expected";case 0:case 1:case 2:}return null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.trace.v1.Status)return e;var t=new ks.opentelemetry.proto.trace.v1.Status;switch(null!=e.message&&(t.message=String(e.message)),e.code){default:"number"==typeof e.code&&(t.code=e.code);break;case"STATUS_CODE_UNSET":case 0:t.code=0;break;case"STATUS_CODE_OK":case 1:t.code=1;break;case"STATUS_CODE_ERROR":case 2:t.code=2}return t},o.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.message="",r.code=t.enums===String?"STATUS_CODE_UNSET":0),null!=e.message&&e.hasOwnProperty("message")&&(r.message=e.message),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums!==String||void 0===ks.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]?e.code:ks.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Status"},o.StatusCode=(e={},(t=Object.create(e))[e[0]="STATUS_CODE_UNSET"]=0,t[e[1]="STATUS_CODE_OK"]=1,t[e[2]="STATUS_CODE_ERROR"]=2,t),o),r.SpanFlags=(e={},(t=Object.create(e))[e[0]="SPAN_FLAGS_DO_NOT_USE"]=0,t[e[255]="SPAN_FLAGS_TRACE_FLAGS_MASK"]=255,t[e[256]="SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"]=256,t[e[512]="SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"]=512,t),r),n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.events=[],this.links=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.spans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.scopeSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Cs.collector=((xs={}).trace=(()=>{var e,t={};return t.v1=((e={}).TraceService=(((s.prototype=Object.create(Ns.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportTraceServiceRequest=(o.prototype.resourceSpans=Us.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ps.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)ks.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(ks.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=ks.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return e;var t=new ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");t.resourceSpans[r]=ks.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=ks.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},o),e.ExportTraceServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ps.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return e;var t=new ks.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");t.partialSuccess=ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},n),e.ExportTracePartialSuccess=(r.prototype.rejectedSpans=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ps.create(),null!=e.rejectedSpans&&Object.hasOwnProperty.call(e,"rejectedSpans")&&t.uint32(8).int64(e.rejectedSpans),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedSpans=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&!(Us.isInteger(e.rejectedSpans)||e.rejectedSpans&&Us.isInteger(e.rejectedSpans.low)&&Us.isInteger(e.rejectedSpans.high))?"rejectedSpans: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Us.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess?e:(t=new ks.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess,null!=e.rejectedSpans&&(Us.Long?(t.rejectedSpans=Us.Long.fromValue(e.rejectedSpans)).unsigned=!1:"string"==typeof e.rejectedSpans?t.rejectedSpans=parseInt(e.rejectedSpans,10):"number"==typeof e.rejectedSpans?t.rejectedSpans=e.rejectedSpans:"object"==typeof e.rejectedSpans&&(t.rejectedSpans=new Us.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.rejectedSpans=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedSpans=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&("number"==typeof e.rejectedSpans?n.rejectedSpans=t.longs===String?String(e.rejectedSpans):e.rejectedSpans:n.rejectedSpans=t.longs===String?Us.Long.prototype.toString.call(e.rejectedSpans):t.longs===Number?new Us.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber():e.rejectedSpans),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Ns.rpc.Service.call(this,e,t,r)}})(),xs.metrics=(()=>{var e,t={};return t.v1=((e={}).MetricsService=(((s.prototype=Object.create(Ns.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportMetricsServiceRequest=(o.prototype.resourceMetrics=Us.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ps.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)ks.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(ks.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=ks.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return e;var t=new ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");t.resourceMetrics[r]=ks.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=ks.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},o),e.ExportMetricsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ps.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return e;var t=new ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");t.partialSuccess=ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},n),e.ExportMetricsPartialSuccess=(r.prototype.rejectedDataPoints=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ps.create(),null!=e.rejectedDataPoints&&Object.hasOwnProperty.call(e,"rejectedDataPoints")&&t.uint32(8).int64(e.rejectedDataPoints),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedDataPoints=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&!(Us.isInteger(e.rejectedDataPoints)||e.rejectedDataPoints&&Us.isInteger(e.rejectedDataPoints.low)&&Us.isInteger(e.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Us.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess?e:(t=new ks.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess,null!=e.rejectedDataPoints&&(Us.Long?(t.rejectedDataPoints=Us.Long.fromValue(e.rejectedDataPoints)).unsigned=!1:"string"==typeof e.rejectedDataPoints?t.rejectedDataPoints=parseInt(e.rejectedDataPoints,10):"number"==typeof e.rejectedDataPoints?t.rejectedDataPoints=e.rejectedDataPoints:"object"==typeof e.rejectedDataPoints&&(t.rejectedDataPoints=new Us.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.rejectedDataPoints=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedDataPoints=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&("number"==typeof e.rejectedDataPoints?n.rejectedDataPoints=t.longs===String?String(e.rejectedDataPoints):e.rejectedDataPoints:n.rejectedDataPoints=t.longs===String?Us.Long.prototype.toString.call(e.rejectedDataPoints):t.longs===Number?new Us.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber():e.rejectedDataPoints),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Ns.rpc.Service.call(this,e,t,r)}})(),xs.logs=(()=>{var e,t={};return t.v1=((e={}).LogsService=(((s.prototype=Object.create(Ns.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportLogsServiceRequest=(o.prototype.resourceLogs=Us.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ps.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)ks.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(ks.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=ks.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return e;var t=new ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");t.resourceLogs[r]=ks.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=ks.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},o),e.ExportLogsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ps.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return e;var t=new ks.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");t.partialSuccess=ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},n),e.ExportLogsPartialSuccess=(r.prototype.rejectedLogRecords=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ps.create(),null!=e.rejectedLogRecords&&Object.hasOwnProperty.call(e,"rejectedLogRecords")&&t.uint32(8).int64(e.rejectedLogRecords),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedLogRecords=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&!(Us.isInteger(e.rejectedLogRecords)||e.rejectedLogRecords&&Us.isInteger(e.rejectedLogRecords.low)&&Us.isInteger(e.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Us.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess?e:(t=new ks.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess,null!=e.rejectedLogRecords&&(Us.Long?(t.rejectedLogRecords=Us.Long.fromValue(e.rejectedLogRecords)).unsigned=!1:"string"==typeof e.rejectedLogRecords?t.rejectedLogRecords=parseInt(e.rejectedLogRecords,10):"number"==typeof e.rejectedLogRecords?t.rejectedLogRecords=e.rejectedLogRecords:"object"==typeof e.rejectedLogRecords&&(t.rejectedLogRecords=new Us.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.rejectedLogRecords=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedLogRecords=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&("number"==typeof e.rejectedLogRecords?n.rejectedLogRecords=t.longs===String?String(e.rejectedLogRecords):e.rejectedLogRecords:n.rejectedLogRecords=t.longs===String?Us.Long.prototype.toString.call(e.rejectedLogRecords):t.longs===Number?new Us.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber():e.rejectedLogRecords),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Ns.rpc.Service.call(this,e,t,r)}})(),xs),Cs.metrics=(()=>{var e,t,r,n={};return n.v1=((r={}).MetricsData=(v.prototype.resourceMetrics=Us.emptyArray,v.create=function(e){return new v(e)},v.encode=function(e,t){if(t=t||Ps.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)ks.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},v.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},v.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.MetricsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(ks.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},v.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=ks.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},v.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.MetricsData)return e;var t=new ks.opentelemetry.proto.metrics.v1.MetricsData;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");t.resourceMetrics[r]=ks.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},v.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=ks.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},v.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},v.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.MetricsData"},v),r.ResourceMetrics=(_.prototype.resource=null,_.prototype.scopeMetrics=Us.emptyArray,_.prototype.schemaUrl=null,_.create=function(e){return new _(e)},_.encode=function(e,t){if(t=t||Ps.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&ks.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeMetrics&&e.scopeMetrics.length)for(var r=0;r<e.scopeMetrics.length;++r)ks.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(e.scopeMetrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},_.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},_.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=ks.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeMetrics&&o.scopeMetrics.length||(o.scopeMetrics=[]),o.scopeMetrics.push(ks.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},_.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},_.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=ks.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeMetrics&&e.hasOwnProperty("scopeMetrics")){if(!Array.isArray(e.scopeMetrics))return"scopeMetrics: array expected";for(var t,r=0;r<e.scopeMetrics.length;++r)if(t=ks.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[r]))return"scopeMetrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl)?"schemaUrl: string expected":null},_.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var t=new ks.opentelemetry.proto.metrics.v1.ResourceMetrics;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");t.resource=ks.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeMetrics){if(!Array.isArray(e.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");t.scopeMetrics=[];for(var r=0;r<e.scopeMetrics.length;++r){if("object"!=typeof e.scopeMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");t.scopeMetrics[r]=ks.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},_.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeMetrics=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=ks.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeMetrics&&e.scopeMetrics.length){r.scopeMetrics=[];for(var n=0;n<e.scopeMetrics.length;++n)r.scopeMetrics[n]=ks.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},_.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},_.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},_),r.ScopeMetrics=(y.prototype.scope=null,y.prototype.metrics=Us.emptyArray,y.prototype.schemaUrl=null,y.create=function(e){return new y(e)},y.encode=function(e,t){if(t=t||Ps.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&ks.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.metrics&&e.metrics.length)for(var r=0;r<e.metrics.length;++r)ks.opentelemetry.proto.metrics.v1.Metric.encode(e.metrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},y.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},y.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.metrics&&o.metrics.length||(o.metrics=[]),o.metrics.push(ks.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},y.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=ks.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t,r=0;r<e.metrics.length;++r)if(t=ks.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[r]))return"metrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl)?"schemaUrl: string expected":null},y.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var t=new ks.opentelemetry.proto.metrics.v1.ScopeMetrics;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");t.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");t.metrics=[];for(var r=0;r<e.metrics.length;++r){if("object"!=typeof e.metrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");t.metrics[r]=ks.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},y.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metrics=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.metrics&&e.metrics.length){r.metrics=[];for(var n=0;n<e.metrics.length;++n)r.metrics[n]=ks.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},y.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},y.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},y),r.Metric=(g.prototype.name=null,g.prototype.description=null,g.prototype.unit=null,g.prototype.gauge=null,g.prototype.sum=null,g.prototype.histogram=null,g.prototype.exponentialHistogram=null,g.prototype.summary=null,g.prototype.metadata=Us.emptyArray,Object.defineProperty(g.prototype,"data",{get:Us.oneOfGetter(t=["gauge","sum","histogram","exponentialHistogram","summary"]),set:Us.oneOfSetter(t)}),g.create=function(e){return new g(e)},g.encode=function(e,t){if(t=t||Ps.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.description&&Object.hasOwnProperty.call(e,"description")&&t.uint32(18).string(e.description),null!=e.unit&&Object.hasOwnProperty.call(e,"unit")&&t.uint32(26).string(e.unit),null!=e.gauge&&Object.hasOwnProperty.call(e,"gauge")&&ks.opentelemetry.proto.metrics.v1.Gauge.encode(e.gauge,t.uint32(42).fork()).ldelim(),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&ks.opentelemetry.proto.metrics.v1.Sum.encode(e.sum,t.uint32(58).fork()).ldelim(),null!=e.histogram&&Object.hasOwnProperty.call(e,"histogram")&&ks.opentelemetry.proto.metrics.v1.Histogram.encode(e.histogram,t.uint32(74).fork()).ldelim(),null!=e.exponentialHistogram&&Object.hasOwnProperty.call(e,"exponentialHistogram")&&ks.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(e.exponentialHistogram,t.uint32(82).fork()).ldelim(),null!=e.summary&&Object.hasOwnProperty.call(e,"summary")&&ks.opentelemetry.proto.metrics.v1.Summary.encode(e.summary,t.uint32(90).fork()).ldelim(),null!=e.metadata&&e.metadata.length)for(var r=0;r<e.metadata.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.metadata[r],t.uint32(98).fork()).ldelim();return t},g.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},g.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.Metric;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.description=e.string();break;case 3:o.unit=e.string();break;case 5:o.gauge=ks.opentelemetry.proto.metrics.v1.Gauge.decode(e,e.uint32());break;case 7:o.sum=ks.opentelemetry.proto.metrics.v1.Sum.decode(e,e.uint32());break;case 9:o.histogram=ks.opentelemetry.proto.metrics.v1.Histogram.decode(e,e.uint32());break;case 10:o.exponentialHistogram=ks.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(e,e.uint32());break;case 11:o.summary=ks.opentelemetry.proto.metrics.v1.Summary.decode(e,e.uint32());break;case 12:o.metadata&&o.metadata.length||(o.metadata=[]),o.metadata.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},g.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},g.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.name&&e.hasOwnProperty("name")&&!Us.isString(e.name))return"name: string expected";if(null!=e.description&&e.hasOwnProperty("description")&&!Us.isString(e.description))return"description: string expected";if(null!=e.unit&&e.hasOwnProperty("unit")&&!Us.isString(e.unit))return"unit: string expected";if(null!=e.gauge&&e.hasOwnProperty("gauge")&&(t.data=1,r=ks.opentelemetry.proto.metrics.v1.Gauge.verify(e.gauge)))return"gauge."+r;if(null!=e.sum&&e.hasOwnProperty("sum")){if(1===t.data)return"data: multiple values";if(t.data=1,r=ks.opentelemetry.proto.metrics.v1.Sum.verify(e.sum))return"sum."+r}if(null!=e.histogram&&e.hasOwnProperty("histogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=ks.opentelemetry.proto.metrics.v1.Histogram.verify(e.histogram))return"histogram."+r}if(null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=ks.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(e.exponentialHistogram))return"exponentialHistogram."+r}if(null!=e.summary&&e.hasOwnProperty("summary")){if(1===t.data)return"data: multiple values";if(t.data=1,r=ks.opentelemetry.proto.metrics.v1.Summary.verify(e.summary))return"summary."+r}if(null!=e.metadata&&e.hasOwnProperty("metadata")){if(!Array.isArray(e.metadata))return"metadata: array expected";for(var r,n=0;n<e.metadata.length;++n)if(r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.metadata[n]))return"metadata."+r}return null},g.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.Metric)return e;var t=new ks.opentelemetry.proto.metrics.v1.Metric;if(null!=e.name&&(t.name=String(e.name)),null!=e.description&&(t.description=String(e.description)),null!=e.unit&&(t.unit=String(e.unit)),null!=e.gauge){if("object"!=typeof e.gauge)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");t.gauge=ks.opentelemetry.proto.metrics.v1.Gauge.fromObject(e.gauge)}if(null!=e.sum){if("object"!=typeof e.sum)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");t.sum=ks.opentelemetry.proto.metrics.v1.Sum.fromObject(e.sum)}if(null!=e.histogram){if("object"!=typeof e.histogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");t.histogram=ks.opentelemetry.proto.metrics.v1.Histogram.fromObject(e.histogram)}if(null!=e.exponentialHistogram){if("object"!=typeof e.exponentialHistogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");t.exponentialHistogram=ks.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(e.exponentialHistogram)}if(null!=e.summary){if("object"!=typeof e.summary)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");t.summary=ks.opentelemetry.proto.metrics.v1.Summary.fromObject(e.summary)}if(e.metadata){if(!Array.isArray(e.metadata))throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: array expected");t.metadata=[];for(var r=0;r<e.metadata.length;++r){if("object"!=typeof e.metadata[r])throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: object expected");t.metadata[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.metadata[r])}}return t},g.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metadata=[]),t.defaults&&(r.name="",r.description="",r.unit=""),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.description&&e.hasOwnProperty("description")&&(r.description=e.description),null!=e.unit&&e.hasOwnProperty("unit")&&(r.unit=e.unit),null!=e.gauge&&e.hasOwnProperty("gauge")&&(r.gauge=ks.opentelemetry.proto.metrics.v1.Gauge.toObject(e.gauge,t),t.oneofs)&&(r.data="gauge"),null!=e.sum&&e.hasOwnProperty("sum")&&(r.sum=ks.opentelemetry.proto.metrics.v1.Sum.toObject(e.sum,t),t.oneofs)&&(r.data="sum"),null!=e.histogram&&e.hasOwnProperty("histogram")&&(r.histogram=ks.opentelemetry.proto.metrics.v1.Histogram.toObject(e.histogram,t),t.oneofs)&&(r.data="histogram"),null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")&&(r.exponentialHistogram=ks.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(e.exponentialHistogram,t),t.oneofs)&&(r.data="exponentialHistogram"),null!=e.summary&&e.hasOwnProperty("summary")&&(r.summary=ks.opentelemetry.proto.metrics.v1.Summary.toObject(e.summary,t),t.oneofs)&&(r.data="summary"),e.metadata&&e.metadata.length){r.metadata=[];for(var n=0;n<e.metadata.length;++n)r.metadata[n]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.metadata[n],t)}return r},g.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},g.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Metric"},g),r.Gauge=(m.prototype.dataPoints=Us.emptyArray,m.create=function(e){return new m(e)},m.encode=function(e,t){if(t=t||Ps.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)ks.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},m.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},m.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.Gauge;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(ks.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},m.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},m.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=ks.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},m.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.Gauge)return e;var t=new ks.opentelemetry.proto.metrics.v1.Gauge;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");t.dataPoints[r]=ks.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}return t},m.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=ks.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return r},m.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},m.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Gauge"},m),r.Sum=(f.prototype.dataPoints=Us.emptyArray,f.prototype.aggregationTemporality=null,f.prototype.isMonotonic=null,f.create=function(e){return new f(e)},f.encode=function(e,t){if(t=t||Ps.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)ks.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),null!=e.isMonotonic&&Object.hasOwnProperty.call(e,"isMonotonic")&&t.uint32(24).bool(e.isMonotonic),t},f.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},f.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.Sum;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(ks.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;case 3:o.isMonotonic=e.bool();break;default:e.skipType(7&s)}}return o},f.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},f.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=ks.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&"boolean"!=typeof e.isMonotonic?"isMonotonic: boolean expected":null},f.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.Sum)return e;var t=new ks.opentelemetry.proto.metrics.v1.Sum;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");t.dataPoints[r]=ks.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return null!=e.isMonotonic&&(t.isMonotonic=Boolean(e.isMonotonic)),t},f.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,r.isMonotonic=!1),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=ks.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===ks.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:ks.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&(r.isMonotonic=e.isMonotonic),r},f.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},f.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Sum"},f),r.Histogram=(d.prototype.dataPoints=Us.emptyArray,d.prototype.aggregationTemporality=null,d.create=function(e){return new d(e)},d.encode=function(e,t){if(t=t||Ps.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)ks.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},d.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},d.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.Histogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(ks.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},d.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},d.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=ks.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},d.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.Histogram)return e;var t=new ks.opentelemetry.proto.metrics.v1.Histogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");t.dataPoints[r]=ks.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},d.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=ks.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===ks.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:ks.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},d.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},d.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Histogram"},d),r.ExponentialHistogram=(h.prototype.dataPoints=Us.emptyArray,h.prototype.aggregationTemporality=null,h.create=function(e){return new h(e)},h.encode=function(e,t){if(t=t||Ps.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},h.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},h.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},h.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},h.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},h.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var t=new ks.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");t.dataPoints[r]=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},h.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===ks.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:ks.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},h.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},h.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},h),r.Summary=(p.prototype.dataPoints=Us.emptyArray,p.create=function(e){return new p(e)},p.encode=function(e,t){if(t=t||Ps.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},p.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},p.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.Summary;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},p.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},p.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},p.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.Summary)return e;var t=new ks.opentelemetry.proto.metrics.v1.Summary;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");t.dataPoints[r]=ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[r])}}return t},p.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[n],t)}return r},p.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},p.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Summary"},p),r.AggregationTemporality=(t={},(e=Object.create(t))[t[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,e[t[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,e[t[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,e),r.DataPointFlags=(t={},(e=Object.create(t))[t[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,e[t[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,e),r.NumberDataPoint=(c.prototype.attributes=Us.emptyArray,c.prototype.startTimeUnixNano=null,c.prototype.timeUnixNano=null,c.prototype.asDouble=null,c.prototype.asInt=null,c.prototype.exemplars=Us.emptyArray,c.prototype.flags=null,Object.defineProperty(c.prototype,"value",{get:Us.oneOfGetter(t=["asDouble","asInt"]),set:Us.oneOfSetter(t)}),c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Ps.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(33).double(e.asDouble),null!=e.exemplars&&e.exemplars.length)for(var r=0;r<e.exemplars.length;++r)ks.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(42).fork()).ldelim();if(null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.NumberDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 5:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(ks.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},c.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var n=0;n<e.attributes.length;++n)if(t=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[n]))return"attributes."+t}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Us.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Us.isInteger(e.startTimeUnixNano.low)&&Us.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(r.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===r.value)return"value: multiple values";if(r.value=1,!(Us.isInteger(e.asInt)||e.asInt&&Us.isInteger(e.asInt.low)&&Us.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(n=0;n<e.exemplars.length;++n)if(t=ks.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[n]))return"exemplars."+t}return null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags)?"flags: integer expected":null},c.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.NumberDataPoint)return e;var t=new ks.opentelemetry.proto.metrics.v1.NumberDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Us.Long?(t.startTimeUnixNano=Us.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(Us.Long?(t.asInt=Us.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new Us.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");t.exemplars[r]=ks.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},c.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.exemplars=[],n.attributes=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),e.exemplars&&e.exemplars.length){n.exemplars=[];for(var o=0;o<e.exemplars.length;++o)n.exemplars[o]=ks.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t)}if(null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?Us.Long.prototype.toString.call(e.asInt):t.longs===Number?new Us.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},c.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},c),r.HistogramDataPoint=(l.prototype.attributes=Us.emptyArray,l.prototype.startTimeUnixNano=null,l.prototype.timeUnixNano=null,l.prototype.count=null,l.prototype.sum=null,l.prototype.bucketCounts=Us.emptyArray,l.prototype.explicitBounds=Us.emptyArray,l.prototype.exemplars=Us.emptyArray,l.prototype.flags=null,l.prototype.min=null,l.prototype.max=null,Object.defineProperty(l.prototype,"_sum",{get:Us.oneOfGetter(e=["sum"]),set:Us.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_min",{get:Us.oneOfGetter(e=["min"]),set:Us.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_max",{get:Us.oneOfGetter(e=["max"]),set:Us.oneOfSetter(e)}),l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Ps.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(50).fork();for(var r=0;r<e.bucketCounts.length;++r)t.fixed64(e.bucketCounts[r]);t.ldelim()}if(null!=e.explicitBounds&&e.explicitBounds.length){for(t.uint32(58).fork(),r=0;r<e.explicitBounds.length;++r)t.double(e.explicitBounds[r]);t.ldelim()}if(null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)ks.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(66).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(89).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(97).double(e.max),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.HistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.fixed64());else o.bucketCounts.push(e.fixed64());break;case 7:if(o.explicitBounds&&o.explicitBounds.length||(o.explicitBounds=[]),2==(7&s))for(i=e.uint32()+e.pos;e.pos<i;)o.explicitBounds.push(e.double());else o.explicitBounds.push(e.double());break;case 8:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(ks.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 10:o.flags=e.uint32();break;case 11:o.min=e.double();break;case 12:o.max=e.double();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Us.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Us.isInteger(e.startTimeUnixNano.low)&&Us.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Us.isInteger(e.count)||e.count&&Us.isInteger(e.count.low)&&Us.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(t=0;t<e.bucketCounts.length;++t)if(!(Us.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&Us.isInteger(e.bucketCounts[t].low)&&Us.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}if(null!=e.explicitBounds&&e.hasOwnProperty("explicitBounds")){if(!Array.isArray(e.explicitBounds))return"explicitBounds: array expected";for(t=0;t<e.explicitBounds.length;++t)if("number"!=typeof e.explicitBounds[t])return"explicitBounds: number[] expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=ks.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags)?"flags: integer expected":null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null},l.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.HistogramDataPoint)return e;var t=new ks.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Us.Long?(t.startTimeUnixNano=Us.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Us.Long?(t.count=Us.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Us.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");for(t.bucketCounts=[],r=0;r<e.bucketCounts.length;++r)Us.Long?(t.bucketCounts[r]=Us.Long.fromValue(e.bucketCounts[r])).unsigned=!1:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new Us.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber())}if(e.explicitBounds){if(!Array.isArray(e.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");for(t.explicitBounds=[],r=0;r<e.explicitBounds.length;++r)t.explicitBounds[r]=Number(e.explicitBounds[r])}if(e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");t.exemplars[r]=ks.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),t},l.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.bucketCounts=[],n.explicitBounds=[],n.exemplars=[],n.attributes=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Us.Long.prototype.toString.call(e.count):t.longs===Number?new Us.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),e.bucketCounts&&e.bucketCounts.length){n.bucketCounts=[];for(var o=0;o<e.bucketCounts.length;++o)"number"==typeof e.bucketCounts[o]?n.bucketCounts[o]=t.longs===String?String(e.bucketCounts[o]):e.bucketCounts[o]:n.bucketCounts[o]=t.longs===String?Us.Long.prototype.toString.call(e.bucketCounts[o]):t.longs===Number?new Us.LongBits(e.bucketCounts[o].low>>>0,e.bucketCounts[o].high>>>0).toNumber():e.bucketCounts[o]}if(e.explicitBounds&&e.explicitBounds.length)for(n.explicitBounds=[],o=0;o<e.explicitBounds.length;++o)n.explicitBounds[o]=t.json&&!isFinite(e.explicitBounds[o])?String(e.explicitBounds[o]):e.explicitBounds[o];if(e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=ks.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),n},l.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},l),r.ExponentialHistogramDataPoint=(a.prototype.attributes=Us.emptyArray,a.prototype.startTimeUnixNano=null,a.prototype.timeUnixNano=null,a.prototype.count=null,a.prototype.sum=null,a.prototype.scale=null,a.prototype.zeroCount=null,a.prototype.positive=null,a.prototype.negative=null,a.prototype.flags=null,a.prototype.exemplars=Us.emptyArray,a.prototype.min=null,a.prototype.max=null,a.prototype.zeroThreshold=null,Object.defineProperty(a.prototype,"_sum",{get:Us.oneOfGetter(t=["sum"]),set:Us.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_min",{get:Us.oneOfGetter(t=["min"]),set:Us.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_max",{get:Us.oneOfGetter(t=["max"]),set:Us.oneOfSetter(t)}),a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ps.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.scale&&Object.hasOwnProperty.call(e,"scale")&&t.uint32(48).sint32(e.scale),null!=e.zeroCount&&Object.hasOwnProperty.call(e,"zeroCount")&&t.uint32(57).fixed64(e.zeroCount),null!=e.positive&&Object.hasOwnProperty.call(e,"positive")&&ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.positive,t.uint32(66).fork()).ldelim(),null!=e.negative&&Object.hasOwnProperty.call(e,"negative")&&ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.negative,t.uint32(74).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)ks.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(90).fork()).ldelim();return null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(97).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(105).double(e.max),null!=e.zeroThreshold&&Object.hasOwnProperty.call(e,"zeroThreshold")&&t.uint32(113).double(e.zeroThreshold),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.scale=e.sint32();break;case 7:o.zeroCount=e.fixed64();break;case 8:o.positive=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 9:o.negative=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 10:o.flags=e.uint32();break;case 11:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(ks.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 12:o.min=e.double();break;case 13:o.max=e.double();break;case 14:o.zeroThreshold=e.double();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Us.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Us.isInteger(e.startTimeUnixNano.low)&&Us.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Us.isInteger(e.count)||e.count&&Us.isInteger(e.count.low)&&Us.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.scale&&e.hasOwnProperty("scale")&&!Us.isInteger(e.scale))return"scale: integer expected";if(null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&!(Us.isInteger(e.zeroCount)||e.zeroCount&&Us.isInteger(e.zeroCount.low)&&Us.isInteger(e.zeroCount.high)))return"zeroCount: integer|Long expected";if(null!=e.positive&&e.hasOwnProperty("positive")&&(r=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.positive)))return"positive."+r;if(null!=e.negative&&e.hasOwnProperty("negative")&&(r=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.negative)))return"negative."+r;if(null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags))return"flags: integer expected";if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=ks.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&"number"!=typeof e.zeroThreshold?"zeroThreshold: number expected":null},a.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return e;var t=new ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Us.Long?(t.startTimeUnixNano=Us.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Us.Long?(t.count=Us.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Us.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),null!=e.scale&&(t.scale=0|e.scale),null!=e.zeroCount&&(Us.Long?(t.zeroCount=Us.Long.fromValue(e.zeroCount)).unsigned=!1:"string"==typeof e.zeroCount?t.zeroCount=parseInt(e.zeroCount,10):"number"==typeof e.zeroCount?t.zeroCount=e.zeroCount:"object"==typeof e.zeroCount&&(t.zeroCount=new Us.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber())),null!=e.positive){if("object"!=typeof e.positive)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");t.positive=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.positive)}if(null!=e.negative){if("object"!=typeof e.negative)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");t.negative=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.negative)}if(null!=e.flags&&(t.flags=e.flags>>>0),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");t.exemplars[r]=ks.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),null!=e.zeroThreshold&&(t.zeroThreshold=Number(e.zeroThreshold)),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.exemplars=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.scale=0,Us.Long?(r=new Us.Long(0,0,!1),n.zeroCount=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.zeroCount=t.longs===String?"0":0,n.positive=null,n.negative=null,n.flags=0,n.zeroThreshold=0),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Us.Long.prototype.toString.call(e.count):t.longs===Number?new Us.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),null!=e.scale&&e.hasOwnProperty("scale")&&(n.scale=e.scale),null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&("number"==typeof e.zeroCount?n.zeroCount=t.longs===String?String(e.zeroCount):e.zeroCount:n.zeroCount=t.longs===String?Us.Long.prototype.toString.call(e.zeroCount):t.longs===Number?new Us.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber():e.zeroCount),null!=e.positive&&e.hasOwnProperty("positive")&&(n.positive=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.positive,t)),null!=e.negative&&e.hasOwnProperty("negative")&&(n.negative=ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.negative,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=ks.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);return null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&(n.zeroThreshold=t.json&&!isFinite(e.zeroThreshold)?String(e.zeroThreshold):e.zeroThreshold),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},a.Buckets=(u.prototype.offset=null,u.prototype.bucketCounts=Us.emptyArray,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Ps.create(),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).sint32(e.offset),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(18).fork();for(var r=0;r<e.bucketCounts.length;++r)t.uint64(e.bucketCounts[r]);t.ldelim()}return t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.offset=e.sint32();break;case 2:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.uint64());else o.bucketCounts.push(e.uint64());break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.offset&&e.hasOwnProperty("offset")&&!Us.isInteger(e.offset))return"offset: integer expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(var t=0;t<e.bucketCounts.length;++t)if(!(Us.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&Us.isInteger(e.bucketCounts[t].low)&&Us.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}return null},u.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return e;var t=new ks.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(null!=e.offset&&(t.offset=0|e.offset),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");t.bucketCounts=[];for(var r=0;r<e.bucketCounts.length;++r)Us.Long?(t.bucketCounts[r]=Us.Long.fromValue(e.bucketCounts[r])).unsigned=!0:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new Us.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber(!0))}return t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.bucketCounts=[]),t.defaults&&(r.offset=0),null!=e.offset&&e.hasOwnProperty("offset")&&(r.offset=e.offset),e.bucketCounts&&e.bucketCounts.length){r.bucketCounts=[];for(var n=0;n<e.bucketCounts.length;++n)"number"==typeof e.bucketCounts[n]?r.bucketCounts[n]=t.longs===String?String(e.bucketCounts[n]):e.bucketCounts[n]:r.bucketCounts[n]=t.longs===String?Us.Long.prototype.toString.call(e.bucketCounts[n]):t.longs===Number?new Us.LongBits(e.bucketCounts[n].low>>>0,e.bucketCounts[n].high>>>0).toNumber(!0):e.bucketCounts[n]}return r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},u),a),r.SummaryDataPoint=(s.prototype.attributes=Us.emptyArray,s.prototype.startTimeUnixNano=null,s.prototype.timeUnixNano=null,s.prototype.count=null,s.prototype.sum=null,s.prototype.quantileValues=Us.emptyArray,s.prototype.flags=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ps.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.quantileValues&&e.quantileValues.length)for(var r=0;r<e.quantileValues.length;++r)ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(e.quantileValues[r],t.uint32(50).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.quantileValues&&o.quantileValues.length||(o.quantileValues=[]),o.quantileValues.push(ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Us.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Us.isInteger(e.startTimeUnixNano.low)&&Us.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Us.isInteger(e.count)||e.count&&Us.isInteger(e.count.low)&&Us.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.quantileValues&&e.hasOwnProperty("quantileValues")){if(!Array.isArray(e.quantileValues))return"quantileValues: array expected";for(t=0;t<e.quantileValues.length;++t){var r;if(r=ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[t]))return"quantileValues."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags)?"flags: integer expected":null},s.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var t=new ks.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Us.Long?(t.startTimeUnixNano=Us.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Us.Long?(t.count=Us.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Us.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.quantileValues){if(!Array.isArray(e.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");for(t.quantileValues=[],r=0;r<e.quantileValues.length;++r){if("object"!=typeof e.quantileValues[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");t.quantileValues[r]=ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.quantileValues=[],n.attributes=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Us.Long?(r=new Us.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.sum=0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Us.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Us.Long.prototype.toString.call(e.count):t.longs===Number?new Us.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum),e.quantileValues&&e.quantileValues.length){n.quantileValues=[];for(var o=0;o<e.quantileValues.length;++o)n.quantileValues[o]=ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(e.quantileValues[o],t)}if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},s.ValueAtQuantile=(i.prototype.quantile=null,i.prototype.value=null,i.create=function(e){return new i(e)},i.encode=function(e,t){return t=t||Ps.create(),null!=e.quantile&&Object.hasOwnProperty.call(e,"quantile")&&t.uint32(9).double(e.quantile),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(17).double(e.value),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.quantile=e.double();break;case 2:o.value=e.double();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},i.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.quantile&&e.hasOwnProperty("quantile")&&"number"!=typeof e.quantile?"quantile: number expected":null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},i.fromObject=function(e){var t;return e instanceof ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile?e:(t=new ks.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile,null!=e.quantile&&(t.quantile=Number(e.quantile)),null!=e.value&&(t.value=Number(e.value)),t)},i.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.quantile=0,r.value=0),null!=e.quantile&&e.hasOwnProperty("quantile")&&(r.quantile=t.json&&!isFinite(e.quantile)?String(e.quantile):e.quantile),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.json&&!isFinite(e.value)?String(e.value):e.value),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},i),s),r.Exemplar=(o.prototype.filteredAttributes=Us.emptyArray,o.prototype.timeUnixNano=null,o.prototype.asDouble=null,o.prototype.asInt=null,o.prototype.spanId=null,o.prototype.traceId=null,Object.defineProperty(o.prototype,"value",{get:Us.oneOfGetter(e=["asDouble","asInt"]),set:Us.oneOfSetter(e)}),o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ps.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(17).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(25).double(e.asDouble),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(34).bytes(e.spanId),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(42).bytes(e.traceId),null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.filteredAttributes&&e.filteredAttributes.length)for(var r=0;r<e.filteredAttributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.filteredAttributes[r],t.uint32(58).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.metrics.v1.Exemplar;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.filteredAttributes&&o.filteredAttributes.length||(o.filteredAttributes=[]),o.filteredAttributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.timeUnixNano=e.fixed64();break;case 3:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 4:o.spanId=e.bytes();break;case 5:o.traceId=e.bytes();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.filteredAttributes&&e.hasOwnProperty("filteredAttributes")){if(!Array.isArray(e.filteredAttributes))return"filteredAttributes: array expected";for(var r=0;r<e.filteredAttributes.length;++r){var n=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.filteredAttributes[r]);if(n)return"filteredAttributes."+n}}if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(t.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===t.value)return"value: multiple values";if(t.value=1,!(Us.isInteger(e.asInt)||e.asInt&&Us.isInteger(e.asInt.low)&&Us.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}return null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Us.isString(e.spanId))?"spanId: buffer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Us.isString(e.traceId))?"traceId: buffer expected":null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.metrics.v1.Exemplar)return e;var t=new ks.opentelemetry.proto.metrics.v1.Exemplar;if(e.filteredAttributes){if(!Array.isArray(e.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");t.filteredAttributes=[];for(var r=0;r<e.filteredAttributes.length;++r){if("object"!=typeof e.filteredAttributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");t.filteredAttributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.filteredAttributes[r])}}return null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(Us.Long?(t.asInt=Us.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new Us.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),null!=e.spanId&&("string"==typeof e.spanId?Us.base64.decode(e.spanId,t.spanId=Us.newBuffer(Us.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceId&&("string"==typeof e.traceId?Us.base64.decode(e.traceId,t.traceId=Us.newBuffer(Us.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.filteredAttributes=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Us.newBuffer(n.spanId))),t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Us.newBuffer(n.traceId)))),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Us.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Us.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?Us.Long.prototype.toString.call(e.asInt):t.longs===Number?new Us.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.filteredAttributes&&e.filteredAttributes.length){n.filteredAttributes=[];for(var o=0;o<e.filteredAttributes.length;++o)n.filteredAttributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.filteredAttributes[o],t)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Exemplar"},o),r),n;function o(e){if(this.filteredAttributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.quantileValues=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.bucketCounts=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function p(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function h(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function d(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function f(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function m(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function g(e){if(this.metadata=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function y(e){if(this.metrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function _(e){if(this.scopeMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function v(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Cs.logs=(()=>{var e,t,r,n={};return n.v1=((r={}).LogsData=(a.prototype.resourceLogs=Us.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ps.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)ks.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.logs.v1.LogsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(ks.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=ks.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},a.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.logs.v1.LogsData)return e;var t=new ks.opentelemetry.proto.logs.v1.LogsData;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");t.resourceLogs[r]=ks.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=ks.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogsData"},a),r.ResourceLogs=(i.prototype.resource=null,i.prototype.scopeLogs=Us.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ps.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&ks.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeLogs&&e.scopeLogs.length)for(var r=0;r<e.scopeLogs.length;++r)ks.opentelemetry.proto.logs.v1.ScopeLogs.encode(e.scopeLogs[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=ks.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeLogs&&o.scopeLogs.length||(o.scopeLogs=[]),o.scopeLogs.push(ks.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=ks.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeLogs&&e.hasOwnProperty("scopeLogs")){if(!Array.isArray(e.scopeLogs))return"scopeLogs: array expected";for(var t,r=0;r<e.scopeLogs.length;++r)if(t=ks.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[r]))return"scopeLogs."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.logs.v1.ResourceLogs)return e;var t=new ks.opentelemetry.proto.logs.v1.ResourceLogs;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");t.resource=ks.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeLogs){if(!Array.isArray(e.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");t.scopeLogs=[];for(var r=0;r<e.scopeLogs.length;++r){if("object"!=typeof e.scopeLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");t.scopeLogs[r]=ks.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeLogs=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=ks.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeLogs&&e.scopeLogs.length){r.scopeLogs=[];for(var n=0;n<e.scopeLogs.length;++n)r.scopeLogs[n]=ks.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ResourceLogs"},i),r.ScopeLogs=(s.prototype.scope=null,s.prototype.logRecords=Us.emptyArray,s.prototype.schemaUrl=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ps.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&ks.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.logRecords&&e.logRecords.length)for(var r=0;r<e.logRecords.length;++r)ks.opentelemetry.proto.logs.v1.LogRecord.encode(e.logRecords[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.logRecords&&o.logRecords.length||(o.logRecords=[]),o.logRecords.push(ks.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=ks.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.logRecords&&e.hasOwnProperty("logRecords")){if(!Array.isArray(e.logRecords))return"logRecords: array expected";for(var t,r=0;r<e.logRecords.length;++r)if(t=ks.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[r]))return"logRecords."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Us.isString(e.schemaUrl)?"schemaUrl: string expected":null},s.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.logs.v1.ScopeLogs)return e;var t=new ks.opentelemetry.proto.logs.v1.ScopeLogs;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");t.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.logRecords){if(!Array.isArray(e.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");t.logRecords=[];for(var r=0;r<e.logRecords.length;++r){if("object"!=typeof e.logRecords[r])throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");t.logRecords[r]=ks.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},s.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.logRecords=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=ks.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.logRecords&&e.logRecords.length){r.logRecords=[];for(var n=0;n<e.logRecords.length;++n)r.logRecords[n]=ks.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ScopeLogs"},s),r.SeverityNumber=(e={},(t=Object.create(e))[e[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,t[e[1]="SEVERITY_NUMBER_TRACE"]=1,t[e[2]="SEVERITY_NUMBER_TRACE2"]=2,t[e[3]="SEVERITY_NUMBER_TRACE3"]=3,t[e[4]="SEVERITY_NUMBER_TRACE4"]=4,t[e[5]="SEVERITY_NUMBER_DEBUG"]=5,t[e[6]="SEVERITY_NUMBER_DEBUG2"]=6,t[e[7]="SEVERITY_NUMBER_DEBUG3"]=7,t[e[8]="SEVERITY_NUMBER_DEBUG4"]=8,t[e[9]="SEVERITY_NUMBER_INFO"]=9,t[e[10]="SEVERITY_NUMBER_INFO2"]=10,t[e[11]="SEVERITY_NUMBER_INFO3"]=11,t[e[12]="SEVERITY_NUMBER_INFO4"]=12,t[e[13]="SEVERITY_NUMBER_WARN"]=13,t[e[14]="SEVERITY_NUMBER_WARN2"]=14,t[e[15]="SEVERITY_NUMBER_WARN3"]=15,t[e[16]="SEVERITY_NUMBER_WARN4"]=16,t[e[17]="SEVERITY_NUMBER_ERROR"]=17,t[e[18]="SEVERITY_NUMBER_ERROR2"]=18,t[e[19]="SEVERITY_NUMBER_ERROR3"]=19,t[e[20]="SEVERITY_NUMBER_ERROR4"]=20,t[e[21]="SEVERITY_NUMBER_FATAL"]=21,t[e[22]="SEVERITY_NUMBER_FATAL2"]=22,t[e[23]="SEVERITY_NUMBER_FATAL3"]=23,t[e[24]="SEVERITY_NUMBER_FATAL4"]=24,t),r.LogRecordFlags=(e={},(t=Object.create(e))[e[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,t[e[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,t),r.LogRecord=(o.prototype.timeUnixNano=null,o.prototype.observedTimeUnixNano=null,o.prototype.severityNumber=null,o.prototype.severityText=null,o.prototype.body=null,o.prototype.attributes=Us.emptyArray,o.prototype.droppedAttributesCount=null,o.prototype.flags=null,o.prototype.traceId=null,o.prototype.spanId=null,o.prototype.eventName=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ps.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.severityNumber&&Object.hasOwnProperty.call(e,"severityNumber")&&t.uint32(16).int32(e.severityNumber),null!=e.severityText&&Object.hasOwnProperty.call(e,"severityText")&&t.uint32(26).string(e.severityText),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&ks.opentelemetry.proto.common.v1.AnyValue.encode(e.body,t.uint32(42).fork()).ldelim(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)ks.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(50).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(56).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(69).fixed32(e.flags),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(74).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(82).bytes(e.spanId),null!=e.observedTimeUnixNano&&Object.hasOwnProperty.call(e,"observedTimeUnixNano")&&t.uint32(89).fixed64(e.observedTimeUnixNano),null!=e.eventName&&Object.hasOwnProperty.call(e,"eventName")&&t.uint32(98).string(e.eventName),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Is||(e=Is.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new ks.opentelemetry.proto.logs.v1.LogRecord;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 11:o.observedTimeUnixNano=e.fixed64();break;case 2:o.severityNumber=e.int32();break;case 3:o.severityText=e.string();break;case 5:o.body=ks.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;case 6:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(ks.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 7:o.droppedAttributesCount=e.uint32();break;case 8:o.flags=e.fixed32();break;case 9:o.traceId=e.bytes();break;case 10:o.spanId=e.bytes();break;case 12:o.eventName=e.string();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Is||(e=new Is(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Us.isInteger(e.timeUnixNano)||e.timeUnixNano&&Us.isInteger(e.timeUnixNano.low)&&Us.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&!(Us.isInteger(e.observedTimeUnixNano)||e.observedTimeUnixNano&&Us.isInteger(e.observedTimeUnixNano.low)&&Us.isInteger(e.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(null!=e.severityNumber&&e.hasOwnProperty("severityNumber"))switch(e.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:}if(null!=e.severityText&&e.hasOwnProperty("severityText")&&!Us.isString(e.severityText))return"severityText: string expected";if(null!=e.body&&e.hasOwnProperty("body")&&(t=ks.opentelemetry.proto.common.v1.AnyValue.verify(e.body)))return"body."+t;if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t,r=0;r<e.attributes.length;++r)if(t=ks.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[r]))return"attributes."+t}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Us.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!Us.isInteger(e.flags)?"flags: integer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Us.isString(e.traceId))?"traceId: buffer expected":null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Us.isString(e.spanId))?"spanId: buffer expected":null!=e.eventName&&e.hasOwnProperty("eventName")&&!Us.isString(e.eventName)?"eventName: string expected":null},o.fromObject=function(e){if(e instanceof ks.opentelemetry.proto.logs.v1.LogRecord)return e;var t=new ks.opentelemetry.proto.logs.v1.LogRecord;switch(null!=e.timeUnixNano&&(Us.Long?(t.timeUnixNano=Us.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.observedTimeUnixNano&&(Us.Long?(t.observedTimeUnixNano=Us.Long.fromValue(e.observedTimeUnixNano)).unsigned=!1:"string"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=parseInt(e.observedTimeUnixNano,10):"number"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=e.observedTimeUnixNano:"object"==typeof e.observedTimeUnixNano&&(t.observedTimeUnixNano=new Us.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber())),e.severityNumber){default:"number"==typeof e.severityNumber&&(t.severityNumber=e.severityNumber);break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:t.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:t.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:t.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:t.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:t.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:t.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:t.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:t.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:t.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:t.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:t.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:t.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:t.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:t.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:t.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:t.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:t.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:t.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:t.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:t.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:t.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:t.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:t.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:t.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:t.severityNumber=24}if(null!=e.severityText&&(t.severityText=String(e.severityText)),null!=e.body){if("object"!=typeof e.body)throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");t.body=ks.opentelemetry.proto.common.v1.AnyValue.fromObject(e.body)}if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");t.attributes[r]=ks.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.traceId&&("string"==typeof e.traceId?Us.base64.decode(e.traceId,t.traceId=Us.newBuffer(Us.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Us.base64.decode(e.spanId,t.spanId=Us.newBuffer(Us.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.eventName&&(t.eventName=String(e.eventName)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(Us.Long?(r=new Us.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.severityNumber=t.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,n.severityText="",n.body=null,n.droppedAttributesCount=0,n.flags=0,t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Us.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Us.newBuffer(n.spanId))),Us.Long?(r=new Us.Long(0,0,!1),n.observedTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.observedTimeUnixNano=t.longs===String?"0":0,n.eventName=""),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Us.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.severityNumber&&e.hasOwnProperty("severityNumber")&&(n.severityNumber=t.enums!==String||void 0===ks.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]?e.severityNumber:ks.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]),null!=e.severityText&&e.hasOwnProperty("severityText")&&(n.severityText=e.severityText),null!=e.body&&e.hasOwnProperty("body")&&(n.body=ks.opentelemetry.proto.common.v1.AnyValue.toObject(e.body,t)),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=ks.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Us.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Us.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&("number"==typeof e.observedTimeUnixNano?n.observedTimeUnixNano=t.longs===String?String(e.observedTimeUnixNano):e.observedTimeUnixNano:n.observedTimeUnixNano=t.longs===String?Us.Long.prototype.toString.call(e.observedTimeUnixNano):t.longs===Number?new Us.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),null!=e.eventName&&e.hasOwnProperty("eventName")&&(n.eventName=e.eventName),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,Ns.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogRecord"},o),r),n;function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.logRecords=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.scopeLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Cs),Rs),ks);function js(e){return 48<=e&&e<=57?e-48:97<=e&&e<=102?e-87:e-55}function Ds(t){var r=new Uint8Array(t.length/2);let n=0;for(let e=0;e<t.length;e+=2){var o=js(t.charCodeAt(e)),s=js(t.charCodeAt(e+1));r[n++]=o<<4|s}return r}function Ms(e){var t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Vs(e){return e=Ms(e),{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}let Bs="undefined"!=typeof BigInt?function(e){return Ms(e).toString()}:function(e){return e[0]*Uo+e[1]};function Fs(e){return e}function qs(e){if(void 0!==e)return Ds(e)}let Hs={encodeHrTime:Vs,encodeSpanContext:Ds,encodeOptionalSpanContext:qs};function Gs(e){var t;return void 0===e?Hs:(t=e.useLongBits??!0,e=e.useHex??!1,{encodeHrTime:t?Vs:Bs,encodeSpanContext:e?Fs:Ds,encodeOptionalSpanContext:e?Fs:qs})}function zs(e){var t={attributes:Ys(e.attributes),droppedAttributesCount:0},e=e.schemaUrl;return e&&""!==e&&(t.schemaUrl=e),t}function Ks(e){return{name:e.name,version:e.version}}function Ys(t){return Object.keys(t).map(e=>Ws(e,t[e]))}function Ws(e,t){return{key:e,value:$s(t)}}function $s(e){var t=typeof e;return"string"==t?{stringValue:e}:"number"==t?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:"boolean"==t?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map($s)}}:"object"==t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>Ws(e,t))}}:{}}function Js(e,r){e=(e=>{var i,a=new Map;for(i of e){let{resource:e,instrumentationScope:{name:t,version:r="",schemaUrl:n=""}}=i,o=a.get(e);o||(o=new Map,a.set(e,o));var u=t+`@${r}:`+n;let s=o.get(u);s||(s=[],o.set(u,s)),s.push(i)}return a})(e);return Array.from(e,([e,t])=>{e=zs(e);return{resource:e,scopeLogs:Array.from(t,([,e])=>({scope:Ks(e[0].instrumentationScope),logRecords:e.map(e=>{return e=e,{timeUnixNano:(t=r).encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:$s(e.body),eventName:e.eventName,attributes:Xs(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)};var t}),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:e.schemaUrl}})}function Xs(t){return Object.keys(t).map(e=>Ws(e,t[e]))}Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,(e=>{e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(Qs=Qs||{}),(e=>{e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(Zs=Zs||{}),(e=>{e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(ea=ea||{}),(e=>{e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(ta=ta||{});let ra=1023,na=ra,oa=Math.pow(2,-1022);function ia(e){var t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((2146435072&t.getUint32(0))>>20)-ra}function sa(e){var t=new DataView(new ArrayBuffer(8)),e=(t.setFloat64(0,e),t.getUint32(0)),t=t.getUint32(4);return(1048575&e)*Math.pow(2,32)+t}function aa(e,t){return 0===e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}class ua extends Error{}class la{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<oa?this._minNormalLowerBoundaryIndex():ia(e)+this._rightShift(sa(e)-1,52)>>this._shift}lowerBoundary(e){var t=this._minNormalLowerBoundaryIndex();if(e<t)throw new ua(`underflow: ${e} is < minimum lower boundary: `+t);t=this._maxNormalLowerBoundaryIndex();if(t<e)throw new ua(`overflow: ${e} is > maximum lower boundary: `+t);return aa(1,e<<this._shift)}get scale(){return 0===this._shift?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=-1022>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return na>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}}class ca{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=aa(Math.LOG2E,e),this._inverseFactor=aa(Math.LN2,-e)}mapToIndex(e){var t;return e<=oa?this._minNormalLowerBoundaryIndex()-1:0===sa(e)?(ia(e)<<this._scale)-1:(e=Math.floor(Math.log(e)*this._scaleFactor),(t=this._maxNormalLowerBoundaryIndex())<=e?t:e)}lowerBoundary(e){var t=this._maxNormalLowerBoundaryIndex();if(t<=e){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new ua(`overflow: ${e} is > maximum lower boundary: `+t)}t=this._minNormalLowerBoundaryIndex();if(e<=t){if(e===t)return oa;if(e===t-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new ua(`overflow: ${e} is < minimum lower boundary: `+t)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}Array.from({length:31},(e,t)=>new(10<t?ca:la)(t-10)),(e=>{e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(pa=pa||{});let da=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class ha{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new ha({},t);return t._rawAttributes=ma(e),t._asyncAttributesPending=0<e.filter(([,e])=>da(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(da(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ma(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void Jn.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,da(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Jn.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)da(t)?Jn.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void Jn.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,ha.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function fa(){return e={[Ao]:"unknown_service",[Oo]:Io[Oo],[Co]:Io[Co],[Ro]:Io[Ro]},ha.FromAttributeList(Object.entries(e),void 0);var e}function ma(e){return e.map(([t,e])=>da(e)?[t,e.catch(e=>{Jn.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}function ya(e,t){let r=255&e|256;return t&&(r|=512),r}function _a(e,r){var t=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?r.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:r.encodeSpanContext(t.traceId),spanId:r.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:r.encodeHrTime(e.startTime),endTimeUnixNano:r.encodeHrTime(e.endTime),attributes:Ys(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>{return t=r,{attributes:(e=e).attributes?Ys(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0};var t}),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(e=>{return t=r,{attributes:(e=e).attributes?Ys(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:ya(e.context.traceFlags,e.context.isRemote)};var t}),droppedLinksCount:e.droppedLinksCount,flags:ya(t.traceFlags,e.parentSpanContext?.isRemote)}}function va(e,s){let t=(e=>{var r,n=new Map;for(r of e){let e=n.get(r.resource);e||(e=new Map,n.set(r.resource,e));var o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:`+(r.instrumentationScope.schemaUrl||"");let t=e.get(o);t||(t=[],e.set(o,t)),t.push(r)}return n})(e),i=[],a=t.entries(),u=a.next();for(;!u.done;){let[e,t]=u.value,r=[],n=t.values(),o=n.next();for(;!o.done;){let t=o.value;if(0<t.length){let e=t.map(e=>_a(e,s));r.push({scope:Ks(t[0].instrumentationScope),spans:e,schemaUrl:t[0].instrumentationScope.schemaUrl})}o=n.next()}var l=zs(e),l={resource:l,scopeSpans:r,schemaUrl:l.schemaUrl};i.push(l),u=a.next()}return i}(e=>{e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(ga=ga||{}),Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;let ba={serializeRequest:e=>{e={resourceLogs:Js(e,Gs({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}},Sa={serializeRequest:e=>{e={resourceSpans:va(e,Gs({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}};function Ta(){return.4*Math.random()-.2}class wa{_transport;constructor(e){this._transport=e}retry(r,n,o){return new Promise((e,t)=>{setTimeout(()=>{this._transport.send(r,n).then(e,t)},o)})}async send(t,e){var r=Date.now()+e;let n=await this._transport.send(t,e),o=5,s=1e3;for(;"retryable"===n.status&&0<o;){o--;let e=Math.max(Math.min(s,5e3)+Ta(),0);s*=1.5;var i=n.retryInMillis??e,a=r-Date.now();if(a<i)return n;n=await this.retry(t,a,i)}return n}shutdown(){return this._transport.shutdown()}}function Ea(e){return new wa(e.transport)}function Aa(e){return[429,502,503,504].includes(e)}function Oa(e){var t;if(null!=e)return t=Number.parseInt(e,10),Number.isInteger(t)?0<t?1e3*t:-1:0<=(t=new Date(e).getTime()-Date.now())?t:0}class xa{_parameters;constructor(e){this._parameters=e}async send(e,n){let o=await this._parameters.headers();return new Promise(t=>{let r=new XMLHttpRequest;r.timeout=n,r.open("POST",this._parameters.url),Object.entries(o).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{t({status:"failure",error:new Error("XHR request timed out")})},r.onreadystatechange=()=>{200<=r.status&&r.status<=299?(Jn.debug("XHR success"),t({status:"success"})):r.status&&Aa(r.status)?t({status:"retryable",retryInMillis:Oa(r.getResponseHeader("Retry-After"))}):0!==r.status&&t({status:"failure",error:new Error("XHR request failed with non-retryable status")})},r.onabort=()=>{t({status:"failure",error:new Error("XHR request aborted")})},r.onerror=()=>{t({status:"failure",error:new Error("XHR request errored")})},r.send(e)})}shutdown(){}}class Ca{_params;constructor(e){this._params=e}async send(t){let r=(await this._params.headers())["Content-Type"];return new Promise(e=>{navigator.sendBeacon(this._params.url,new Blob([t],{type:r}))?(Jn.debug("SendBeacon success"),e({status:"success"})):e({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}class Ra{_parameters;constructor(e){this._parameters=e}async send(n,e){let o=new AbortController,t=setTimeout(()=>o.abort(),e);try{let e=!!globalThis.location,t=new URL(this._parameters.url),r=await fetch(t.href,{method:"POST",headers:await this._parameters.headers(),body:n,signal:o.signal,keepalive:e,mode:e?globalThis.location?.origin===t.origin?"same-origin":"cors":"no-cors"});if(200<=r.status&&r.status<=299)return Jn.debug("response success"),{status:"success"};if(Aa(r.status)){let e=r.headers.get("Retry-After");return{status:"retryable",retryInMillis:Oa(e)}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(n){return"AbortError"===n?.name?{status:"failure",error:new Error("Fetch request timed out",{cause:n})}:{status:"failure",error:new Error("Fetch request errored",{cause:n})}}finally{clearTimeout(t)}}shutdown(){}}function Na(e,t){return ci(e,t,Ea({transport:(t=e,new xa(t))}))}function Ia(e,t){return ci(e,t,Ea({transport:(t=e,new Ra(t))}))}function Pa(e,t){return ci(e,t,Ea({transport:(t={url:e.url,headers:e.headers},new Ca(t))}))}function Ua(r,n,o){return async()=>{var e={...await o()},t={};return null!=n&&Object.assign(t,await n()),null!=r&&Object.assign(t,(e=>{let r={};return Object.entries(e??{}).forEach(([e,t])=>{void 0!==t?r[e]=String(t):Jn.warn(`Header "${e}" has invalid value (${t}) and will be ignored`)}),r})(await r())),Object.assign(t,e)}}function ka(e){if(null!=e)try{var t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function La(e){var t;return"function"==typeof e.headers?e.headers:null!=(t=e.headers)?async()=>t:void 0}function ja(e,t,r){return e={url:e.url,timeoutMillis:e.timeoutMillis,headers:La(e),concurrencyLimit:e.concurrencyLimit},n=r,{...ir(e,r={},t={timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>n,url:"http://localhost:4318/"+t}),headers:Ua(e.headers,r.headers,t.headers),url:ka(e.url)??r.url??t.url};var n}function Da(e,t,r,n){return(e.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?Ia:Na:Pa)(ja(e,r,n),t)}var Ma,Va=Object.freeze({__proto__:null,OTLPLogExporter:class extends rr{constructor(e={}){super(Da(e,ba,"v1/logs",{"Content-Type":"application/json"}))}}}),Ba=r(Va);(e=>{e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(Ma=Ma||{});class Fa{emit(e){}}let qa=new Fa,Ha=new class{getLogger(e,t,r){return new Fa}};class Ga{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}emit(e){this._getLogger().emit(e)}_getLogger(){var e;return this._delegate||((e=this._provider._getDelegateLogger(this.name,this.version,this.options))?(this._delegate=e,this._delegate):qa)}}class za{getLogger(e,t,r){var n;return null!=(n=this._getDelegateLogger(e,t,r))?n:new Ga(this,e,t,r)}_getDelegate(){var e;return null!=(e=this._delegate)?e:Ha}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getLogger(e,t,r)}}let Ka="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof J?J:{},Ya=Symbol.for("io.opentelemetry.js.api.logs"),Wa=Ka;class $a{constructor(){this._proxyLoggerProvider=new za}static getInstance(){return this._instance||(this._instance=new $a),this._instance}setGlobalLoggerProvider(e){return Wa[Ya]?this.getLoggerProvider():(Wa[Ya]=(t=e,r=Ha,e=>1===e?t:r),this._proxyLoggerProvider._setDelegate(e),e);var t,r}getLoggerProvider(){var e;return null!=(e=null==(e=Wa[Ya])?void 0:e.call(Wa,1))?e:this._proxyLoggerProvider}getLogger(e,t,r){return this.getLoggerProvider().getLogger(e,t,r)}disable(){delete Wa[Ya],this._proxyLoggerProvider=new za}}let Ja=$a.getInstance();var Xa=r(Object.freeze({__proto__:null,logs:Ja,get SeverityNumber(){return Ma},NOOP_LOGGER:qa,NoopLogger:Fa,ProxyLoggerProvider:za}));class Qa{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,r){var{timestamp:r,observedTimestamp:n,eventName:o,severityNumber:s,severityText:i,body:a,attributes:u={},context:l}=r,c=Date.now();if(this.hrTime=Do(r??c),this.hrTimeObserved=Do(n??c),l){let e=fo.getSpanContext(l);e&&Un(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=i,this.body=a,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=o,this.setAttributes(u)}setAttribute(e,t){return this._isLogRecordReadonly()||null===t||(0===e.length?Jn.warn("Invalid attribute key: "+e):_o(t)||"object"==typeof t&&!Array.isArray(t)&&0<Object.keys(t).length?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?1===this.droppedAttributesCount&&Jn.warn("Dropping extra attributes."):_o(t)?this.attributes[e]=this._truncateToSize(t):this.attributes[e]=t):Jn.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var[t,r]of Object.entries(e))this.setAttribute(t,r);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;return t<=0?(Jn.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&Jn.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class Za{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){var t=e.context||$n.active(),e=new Qa(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.activeProcessor.onEmit(e,t),e._makeReadonly()}}class eu{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}class tu{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(e=>oi(e.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(e=>e.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}class ru{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,t,r,n){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,0<(this.processors=n).length?(this.registeredLogRecordProcessors=n,this.activeProcessor=new tu(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new eu}}class nu{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new si(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Jn.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[],n=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<n;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedLogRecords.length?Promise.resolve():new Promise((e,t)=>{oi(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(t)})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,0<this._finishedLogRecords.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,So(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){var t=()=>ai._export(this._exporter,e).then(e=>{e.code!==Mo.SUCCESS&&So(e.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(So),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return 0===r.length?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,So)}}var Nu,Hu,ou=Object.freeze({__proto__:null,LoggerProvider:class{_shutdownOnce;_sharedState;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=Xo(t,e.shift(),0,r);return t})([{},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},e]),r=e.resource??fa();this._sharedState=new ru(r,t.forceFlushTimeoutMillis,{attributeCountLimit:(r=t.logRecordLimits).attributeCountLimit??128,attributeValueLengthLimit:r.attributeValueLengthLimit??1/0},e?.processors??[]),this._shutdownOnce=new si(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return Jn.warn("A shutdown LoggerProvider cannot provide a Logger"),qa;e||Jn.warn("Logger requested without instrumentation scope name.");var e=e||"unknown",n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._sharedState.loggers.has(n)||this._sharedState.loggers.set(n,new Za({name:e,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(n)}forceFlush(){return this._shutdownOnce.isCalled?(Jn.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Jn.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},ConsoleLogRecordExporter:class{export(e,t){this._sendLogRecords(e,t)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:1e6*(t=e.hrTime)[0]+t[1]/1e3,traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes};var t}_sendLogRecords(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});e?.({code:Mo.SUCCESS})}},SimpleLogRecordProcessor:class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new si(this._shutdown,this),this._unresolvedExports=new Set}onEmit(r){if(!this._shutdownOnce.isCalled){let t=()=>ai._export(this._exporter,[r]).then(e=>{e.code!==Mo.SUCCESS&&So(e.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(So);if(r.resource.asyncAttributesPending){let e=r.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(e),t()),So);null!=e&&this._unresolvedExports.add(e)}else t()}}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},InMemoryLogRecordExporter:class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Mo.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:Mo.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}},BatchLogRecordProcessor:class extends nu{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}_onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}}}),iu=r(ou);let su=Ur("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function au(e){return e.setValue(su,!0)}function uu(e){return!0===e.getValue(su)}let lu="baggage";class cu{inject(e,r,n){var o=co.getBaggage(e);if(o&&!uu(e)){let e=o.getAllEntries().map(([e,t])=>{let r=encodeURIComponent(e)+"="+encodeURIComponent(t.value);return void 0!==t.metadata&&(r+=";"+t.metadata.toString()),r}).filter(e=>e.length<=4096).slice(0,180),t=e.reduce((e,t)=>{t=e+(""!==e?",":"")+t;return 8192<t.length?e:t},"");0<t.length&&n.set(r,lu,t)}}extract(e,t,r){r=r.get(t,lu),t=Array.isArray(r)?r.join(","):r;if(!t)return e;let n={};return 0===t.length||(t.split(",").forEach(e=>{var t=(n=>{if(n){var o=n.indexOf(";"),s=-1===o?n:n.substring(0,o),e=s.indexOf("=");if(!(e<=0)){var i=s.substring(0,e).trim(),s=s.substring(e+1).trim();if(i&&s){let e,t,r;try{e=decodeURIComponent(i),t=decodeURIComponent(s)}catch{return}return-1!==o&&o<n.length-1&&(r=Pr(n.substring(o+1))),{key:e,value:t,metadata:r}}}}})(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),n[t.key]=e}}),0===Object.entries(n).length)?e:co.setBaggage(e,co.createBaggage(n))}fields(){return[lu]}}function pu(e){var t,r={};if("object"==typeof e&&null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(du(n)?hu(t=e[n])?Array.isArray(t)?r[n]=t.slice():r[n]=t:Jn.warn("Invalid attribute value set for key: "+n):Jn.warn("Invalid attribute key: "+n));return r}function du(e){return"string"==typeof e&&""!==e}function hu(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!fu(e))return!1;t=e}}return!0})(e):fu(typeof e))}function fu(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let mu=e=>{var t;Jn.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function gu(e){try{mu(e)}catch{}}let yu="process.runtime.name",_u={[Co]:"opentelemetry",[yu]:"browser",[Oo]:xo,[Ro]:"2.7.1"},vu=performance,bu=Math.pow(10,6),Su=Math.pow(10,9);function Tu(e){return[Math.trunc(e/1e3),Math.round(e%1e3*bu)]}function wu(e){return Ru(Tu(vu.timeOrigin),Tu("number"==typeof e?e:vu.now()))}function Eu(e){if(xu(e))return e;if("number"==typeof e)return(e<vu.timeOrigin?wu:Tu)(e);if(e instanceof Date)return Tu(e.getTime());throw TypeError("Invalid input type")}function Au(e){return e[0]*Su+e[1]}function Ou(e){return 1e6*e[0]+e[1]/1e3}function xu(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Cu(e){return xu(e)||"number"==typeof e||e instanceof Date}function Ru(e,t){e=[e[0]+t[0],e[1]+t[1]];return e[1]>=Su&&(e[1]-=Su,e[0]+=1),e}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Nu=Nu||{});class Iu{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];var t=new Set;for(let e of this._propagators){var r="function"==typeof e.fields?e.fields():[];for(let e of r)t.add(e)}this._fields=Array.from(t)}inject(e,t,r){for(var n of this._propagators)try{n.inject(e,t,r)}catch(e){Jn.warn(`Failed to inject with ${n.constructor.name}. Err: `+e.message)}}extract(e,r,n){return this._propagators.reduce((e,t)=>{try{return t.extract(e,r,n)}catch(e){Jn.warn(`Failed to extract with ${t.constructor.name}. Err: `+e.message)}return e},e)}fields(){return this._fields.slice()}}let Pu="[_0-9a-z-*/]",Uu=new RegExp(`^(?:${`[a-z]${Pu}{0,255}`}|${`[a-z0-9]${Pu}{0,240}@[a-z]${Pu}{0,13}`})$`),ku=/^[ -~]{0,255}[!-~]$/,Lu=/,|=/;function ju(e){return Uu.test(e)}function Du(e){return ku.test(e)&&!Lu.test(e)}class Mu{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState="string"==typeof e?e:"",this._length=this._rawTraceState.length}set(e,t){var r,n,o;return!ju(e)||!Du(t)||(o=(r=this._getState()).get(e),n=this._length,512<(n+="string"==typeof o?t.length-o.length:e.length+t.length+(0<r.size?2:1)))?this:((o=new Map(r)).delete(e),o.set(e,t),this._fromState(o,n))}unset(e){var t=this._getState(),r=t.get(e);if("string"!=typeof r)return this;let n=this._length-(e.length+r.length+1);1<t.size&&--n;r=new Map(t);return r.delete(e),this._fromState(r,n)}get(e){return this._getState().get(e)}serialize(){let e="",t=0;for(var r of this._getState())0<t&&(e=","+e),e=r[0]+"="+r[1]+e,t++;return e}_getState(){if(!this._internalState){let e=this._rawTraceState.split(","),r=new Map,n=0;for(var o of e){let e=o.trim(),t=e.indexOf("=");if(-1!==t){var o=e.slice(0,t),s=e.slice(t+1);if(ju(o)&&Du(s)){var i=n+e.length+(0<r.size?1:0);if(!(512<i)&&(r.set(o,s),n=i,32<=r.size))break}}}this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse())}return this._internalState}_fromState(e,t){var r=Object.create(Mu.prototype);return r._internalState=e,r._length=t,r}}let Vu="traceparent",Bu="tracestate",Fu=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class qu{inject(e,t,r){var n=fo.getSpanContext(e);n&&!uu(e)&&Un(n)&&(e=`00-${n.traceId}-${n.spanId}-0`+Number(n.traceFlags||an.NONE).toString(16),r.set(t,Vu,e),n.traceState)&&r.set(t,Bu,n.traceState.serialize())}extract(e,t,r){var n=r.get(t,Vu);if(!n)return e;n=Array.isArray(n)?n[0]:n;if("string"!=typeof n)return e;n=(e=>!(e=Fu.exec(e))||"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)})(n);if(!n)return e;n.isRemote=!0;r=r.get(t,Bu);if(r){let e=Array.isArray(r)?r.join(","):r;n.traceState=new Mu("string"==typeof e?e:void 0)}return fo.setSpanContext(e,n)}fields(){return[Vu,Bu]}}(Hu=Hu||{}).HTTP="http";let Gu="[object Null]",zu="[object Undefined]",Ku=Function.prototype.toString,Yu=Ku.call(Object),Wu=Object.getPrototypeOf,$u=Object.prototype,Ju=$u.hasOwnProperty,Xu=Symbol?Symbol.toStringTag:void 0,Qu=$u.toString;function Zu(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?zu:Gu;if(Xu&&Xu in Object(t)){var r=t,n=Ju.call(r,Xu),o=r[Xu];let e=!1;try{r[Xu]=void 0,e=!0}catch{}var s=Qu.call(r);return e&&(n?r[Xu]=o:delete r[Xu]),s}return n=t,Qu.call(n)})(e)&&(null===(e=Wu(e))||"function"==typeof(e=Ju.call(e,"constructor")&&e.constructor)&&e instanceof e&&Ku.call(e)===Yu)}function el(e){return nl(e)?e.slice():e}function tl(r,n,o=0,s){let i;if(!(20<o)){if(o++,sl(r)||sl(n)||ol(n))i=el(n);else if(nl(r)){if(i=r.slice(),nl(n))for(let e=0,t=n.length;e<t;e++)i.push(el(n[e]));else if(il(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(i[e]=el(n[e]))}}}else if(il(r))if(il(n)){if(e=n,!Zu(r)||!Zu(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e];if("__proto__"!==u&&"constructor"!==u&&"prototype"!==u){var l=n[u];if(sl(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(rl(r,u,s)||rl(n,u,s))delete i[u];else{if(il(c)&&il(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=tl(i[u],l,o,s)}}}}}else i=n;return i}var e}function rl(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function nl(e){return Array.isArray(e)}function ol(e){return"function"==typeof e}function il(e){return!sl(e)&&!nl(e)&&!ol(e)&&"object"==typeof e}function sl(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class al{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class ul{_isCalled=!1;_deferred=new al;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}_r.ALL,_r.VERBOSE,_r.DEBUG,_r.INFO,_r.WARN,_r.ERROR,_r.NONE;let ll={_export:function(t,r){return new Promise(e=>{$n.with(au($n.active()),()=>{t.export(r,e)})})}},cl;function pl(){if(void 0===cl)try{var e=globalThis.process.argv0;cl=e?"unknown_service:"+e:"unknown_service"}catch{cl="unknown_service"}return cl}let dl=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class hl{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new hl({},t);return t._rawAttributes=yl(e),t._asyncAttributesPending=0<e.filter(([,e])=>dl(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(dl(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=yl(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void Jn.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,dl(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Jn.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)dl(t)?Jn.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void Jn.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,hl.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function fl(e,t){return hl.FromAttributeList(Object.entries(e),t)}function ml(){return fl({})}function gl(){return fl({[Ao]:pl(),[Oo]:_u[Oo],[Co]:_u[Co],[Ro]:_u[Ro]})}function yl(e){return e.map(([t,e])=>dl(e)?[t,e.catch(e=>{Jn.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}let _l=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let o={},t=e.split(this._COMMA_SEPARATOR).filter(e=>""!==e.trim());for(let n of t){let e=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(2!==e.length)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);var[s,i]=e,s=s.trim(),i=i.trim();if(0===s.length)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let t,r;try{t=decodeURIComponent(s),r=decodeURIComponent(i)}catch(o){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": `+(o instanceof Error?o.message:o))}if(t.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${t}".`);if(r.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${t}".`);o[t]=r}return o}},vl=new class{detect(){return{attributes:{}}}},bl=vl,Sl=vl,Tl=vl,wl=vl;var Zp,ed,wd,El=Object.freeze({__proto__:null,detectResources:(n={})=>(n.detectors||[]).map(t=>{try{r=t.detect(n);var e=new hl(r,void 0);return Jn.debug(t.constructor.name+" found resource.",e),e}catch(e){return Jn.debug(t.constructor.name+" failed: "+e.message),ml()}var r}).reduce((e,t)=>e.merge(t),ml()),envDetector:_l,hostDetector:bl,osDetector:Sl,processDetector:Tl,serviceInstanceIdDetector:wl,resourceFromAttributes:fl,defaultResource:gl,emptyResource:ml,defaultServiceName:pl}),Al=r(El),Ol={exports:{}},xl=(Ol.exports=e,tr.inspect),Cl=Ba.OTLPLogExporter,Rl=Xa,Nl=iu.LoggerProvider,Il=iu.BatchLogRecordProcessor,Pl=Al,Ul=Ol.exports,kl=B(),Ll=n,jl="tccc",Dl="https://otlp.tccc.qcloud.com/v1/logs",Ml=kl.newUUID(),Vl=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return xl.apply(void 0,t.concat([{compact:!0,breakLength:1/0}])).slice(1,-1).replace(/((\\r|\\n)\\n(\\n)?)/g,"\n")},Bl=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=y({url:e.url||Dl,headers:{"X-Tps-TenantID":e.tenantId||jl},attributes:{}},e);return new Nl({resource:Pl.defaultResource().merge(Pl.resourceFromAttributes(y({"tps.tenant.id":e.tenantId||jl,"service.name":"JsSIP","service.version":Ll.version},t))),processors:[new Il(new Cl(r))]}).getLogger("JsSIP",Ll.version)},Fl={provider:Bl({tenantId:jl,url:Dl}),attributes:{uuid:Ml,"trtc.version":Ul.VERSION}},ql=($.setConfig=function(e){Fl.provider=Bl(e)},$.setAttributes=function(e){Fl.attributes=Object.assign(Fl.attributes,e)},{DEBUG:{severityNumber:Rl.SeverityNumber.DEBUG,severityText:"debug"},INFO:{severityNumber:Rl.SeverityNumber.INFO,severityText:"info"},WARN:{severityNumber:Rl.SeverityNumber.WARN,severityText:"warn"},ERROR:{severityNumber:Rl.SeverityNumber.ERROR,severityText:"error"}}),Hl=function(){var e=(new Date).getMilliseconds().toString().padStart(3,"0");return"[".concat(e,"]")},Gl=($.log=function(e,t,r){for(var n=arguments.length,o=new Array(3<n?n-3:0),s=3;s<n;s++)o[s-3]=arguments[s];Fl.provider.emit(y(y({},ql[(null==t?void 0:t.toUpperCase())||"DEBUG"]),{},{attributes:y(y({},kl.toPlainObject(r)),kl.toPlainObject(Fl.attributes)),body:"".concat(Hl()," ").concat(e||""," ").concat(Vl.apply(void 0,o))}))},i),zl=$,Kl=(()=>{function s(e){u(this,s),this.prefix=e}return c(s,[{key:"debug",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["debug"].concat(t)),!(s._logLevel>Gl.LOG_LEVEL.DEBUG))return n.d.apply(n,t)}}},{key:"warn",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["warn"].concat(t)),!(s._logLevel>Gl.LOG_LEVEL.WARN))return n.w.apply(n,t)}}},{key:"error",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["error"].concat(t)),!(s._logLevel>Gl.LOG_LEVEL.ERROR))return n.e.apply(n,t)}}},{key:"report",value:function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(s._log_report){var o={};try{0<r.length&&"object"===S(r[r.length-1])&&(Object.assign(o,r[r.length-1]),r=r.slice(0,-1))}catch(e){}zl.log.apply(zl,[this.prefix,e,o].concat(v(r)))}}},{key:"d",value:function(e){this.exec("debug",e)}},{key:"i",value:function(e){this.exec("info",e)}},{key:"w",value:function(e){this.exec("warn",e)}},{key:"e",value:function(e){this.exec("error",e)}},{key:"exec",value:function(e,t){console[e](this.getPrefix(),this.getPrefixStyle(),this.getBgStyle(),this.getTime(),"string"==typeof t?t:JSON.stringify(t))}},{key:"getPrefix",value:function(){return"%c JsSIP %c"}},{key:"getPrefixStyle",value:function(){return"background:#27ae60; padding:1px; border-radius:3px; color: #fff"}},{key:"getBgStyle",value:function(){return"background:transparent"}},{key:"getTime",value:function(){var e=new Date;return"".concat(e.toLocaleTimeString("en-US",{hour12:!1}),".").concat(this.padMs(e.getMilliseconds()))}},{key:"padMs",value:function(e){var t;switch(e.toString().length){case 1:t="00".concat(e);break;case 2:t="0".concat(e);break;default:t="".concat(e)}return t}}],[{key:"setLogLevel",value:function(e){s._logLevel=e}},{key:"setLogReport",value:function(e){s._log_report=e}},{key:"setConfig",value:function(e){zl.setConfig(e)}},{key:"setAttributes",value:function(e){zl.setAttributes(e)}}])})(),Yl=(Kl.setLogLevel(Gl.LOG_LEVEL.TRACE),Kl.setLogReport(!0),Kl),Wl={},$l={},Jl={exports:{}},Xl=Jl.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s",t=(t+=null!=e.raddr?" raddr %s rport %d":"%v%v")+(null!=e.tcptype?" tcptype %s":"%v");return null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value)&&(t+=":%s"),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return(t=(t+=null!=e.id?"id=%s %s":"%v%s")+(null!=e.mediaClockValue?"=%s":"")+(null!=e.rateNumerator?" rate=%s":""))+(null!=e.rateDenominator?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]},Ql=(Object.keys(Xl).forEach(function(e){Xl[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),(e=>{function f(e){return String(Number(e))===e?Number(e):e}function t(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=f(r[1]):1===r.length&&1<t.length&&(e[r[0]]=void 0),e}var m=Jl.exports,r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},h=[],d=t;return e.split(/(\r\n|\r|\n)/).filter(r).forEach(function(e){var t=e[0],r=e.slice(2);"m"===t&&(h.push({rtp:[],fmtp:[]}),d=h[h.length-1]);for(var n=0;n<(m[t]||[]).length;n+=1){var o=m[t][n];if(o.reg.test(r)){var s=d;var i=r;var a=o.name&&o.names,a=(o.push&&!s[o.push]?s[o.push]=[]:a&&!s[o.name]&&(s[o.name]={}),o.push?{}:a?s[o.name]:s),u=i.match(o.reg),l=a,c=o.names;if((i=o.name)&&!c)l[i]=f(u[1]);else for(var p=0;p<c.length;p+=1)null!=u[p+1]&&(l[c[p]]=f(u[p+1]));o.push&&s[o.push].push(a);return}}}),t.media=h,t},e.parseParams=function(e){return e.split(/;\s?/).reduce(t,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(f),n=0;n<r.length;n+=3)t.push({component:r[n],ip:r[n+1],port:r[n+2]});return t},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(t,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=f(e):(t=f(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}})($l),Jl.exports),Zl=/%[sdv%]/g,ec=function(e){var r=1,n=arguments,o=n.length;return e.replace(Zl,function(e){if(o<=r)return e;var t=n[r];switch(r+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},tc=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var o=0;o<t.names.length;o+=1){var s=t.names[o];n.push(t.name?r[t.name][s]:r[t.names[o]])}else n.push(r[t.name]);return ec.apply(null,n)},rc=["v","o","s","i","u","e","p","c","b","t","r","z","a"],nc=["i","c","b","a"],oc=$l,ic=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var r=t.outerOrder||rc,n=t.innerOrder||nc,o=[];return r.forEach(function(r){Ql[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(tc(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(tc(r,t,e))})})}),e.media.forEach(function(e){o.push(tc("m",Ql.m[0],e)),n.forEach(function(r){Ql[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(tc(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(tc(r,t,e))})})})}),o.join("\r\n")+"\r\n"},sc=Jl.exports,ac=(Wl.grammar=sc,Wl.write=ic,Wl.parse=oc.parse,Wl.parseParams=oc.parseParams,Wl.parseFmtpConfig=oc.parseFmtpConfig,Wl.parsePayloads=oc.parsePayloads,Wl.parseRemoteCandidates=oc.parseRemoteCandidates,Wl.parseImageAttributes=oc.parseImageAttributes,Wl.parseSimulcastStreamList=oc.parseSimulcastStreamList,Wl),uc=Yl,lc=i,cc=B(),pc=D(),dc=M(),hc=new uc("SIPMessage"),fc=(()=>{function i(e,t,r,n,o,s){if(u(this,i),!e||!t||!r)return null;n=n||{},this.ua=r,this.headers={},this.method=e,this.ruri=t,this.body=s,this.extraHeaders=cc.cloneArray(o),this.ua.configuration.extra_headers&&(this.extraHeaders=this.extraHeaders.concat(this.ua.configuration.extra_headers)),n.route_set?this.setHeader("route",n.route_set):r.configuration.use_preloaded_route&&this.setHeader("route","<".concat(r.transport.sip_uri,";lr>")),this.setHeader("via",""),this.setHeader("max-forwards",lc.MAX_FORWARDS);s=n.to_uri||t,o=n.to_tag?{tag:n.to_tag}:null,t=void 0!==n.to_display_name?n.to_display_name:null;this.to=new pc(s,t,o),this.setHeader("to",this.to.toString());s=n.from_uri||r.configuration.uri,t={tag:n.from_tag||cc.newTag()},o=void 0!==n.from_display_name?n.from_display_name:r.configuration.display_name||null,this.from=new pc(s,o,t),this.setHeader("from",this.from.toString()),s=n.call_id||r.configuration.jssip_id+cc.createRandomToken(15),this.call_id=s,this.setHeader("call-id",s),o=n.cseq||Math.floor(1e4*Math.random());this.cseq=o,this.setHeader("cseq","".concat(o," ").concat(e))}return c(i,[{key:"setHeader",value:function(e,t){for(var r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=0;n<this.extraHeaders.length;n++)r.test(this.extraHeaders[n])&&this.extraHeaders.splice(n,1);this.headers[cc.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[cc.headerize(e)];if(t){if(t[0])return t[0]}else{var r,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),o=p(this.extraHeaders);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(n.test(s))return s.substring(s.indexOf(":")+1).trim()}}catch(e){o.e(e)}finally{o.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[cc.headerize(e)],r=[];if(t){var n,o=p(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value)}catch(e){o.e(e)}finally{o.f()}}else{var s,i=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),a=p(this.extraHeaders);try{for(a.s();!(s=a.n()).done;){var u=s.value;i.test(u)&&r.push(u.substring(u.indexOf(":")+1).trim())}}catch(e){a.e(e)}finally{a.f()}}return r}},{key:"hasHeader",value:function(e){if(this.headers[cc.headerize(e)])return!0;var t,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=p(this.extraHeaders);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(r.test(o))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=ac.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){var e,t="".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n");for(e in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,e)){var r,n=p(this.headers[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;t+="".concat(e,": ").concat(o,"\r\n")}}catch(t){n.e(t)}finally{n.f()}}var s,i=p(this.extraHeaders);try{for(i.s();!(s=i.n()).done;){var a=s.value;t+="".concat(a.trim(),"\r\n")}}catch(t){i.e(t)}finally{i.f()}var u=[];switch(this.method){case lc.REGISTER:u.push("path","gruu");break;case lc.INVITE:this.ua.configuration.session_timers&&u.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&u.push("gruu"),u.push("ice","replaces");break;case lc.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||lc.USER_AGENT;return t=(t=(t+="Allow: ".concat(lc.ALLOWED_METHODS,"\r\n"))+"Supported: ".concat(u,"\r\n"))+"User-Agent: ".concat(l,"\r\n"),this.body?(l=cc.str_utf8_length(this.body),t=(t+="Content-Length: ".concat(l,"\r\n\r\n"))+this.body):t+="Content-Length: 0\r\n\r\n",t}},{key:"clone",value:function(){var t=new i(this.method,this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=cc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}])})(),mc=(()=>{function s(e,t,r,n,o){return u(this,s),(e=a(this,s,[lc.INVITE,e,t,r,n,o])).transaction=null,e}return f(s,fc),c(s,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var t=new s(this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=cc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t.transaction=this.transaction,t}}])})(),gc=c(function e(){u(this,e),this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null},[{key:"addHeader",value:function(e,t){t={raw:t};e=cc.headerize(e),this.headers[e]?this.headers[e].push(t):this.headers[e]=[t]}},{key:"getHeader",value:function(e){e=this.headers[cc.headerize(e)];return e&&e[0]?e[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[cc.headerize(e)],r=[];if(!t)return[];var n,o=p(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value.raw)}catch(e){o.e(e)}finally{o.f()}return r}},{key:"hasHeader",value:function(e){return!!this.headers[cc.headerize(e)]}},{key:"parseHeader",value:function(e){var t,r,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(e=cc.headerize(e),this.headers[e]){if(!(o>=this.headers[e].length))return r=(t=this.headers[e][o]).raw,t.parsed||(-1===(n=dc.parse(r,e.replace(/-/g,"_")))?(this.headers[e].splice(o,1),void hc.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):t.parsed=n);hc.debug('not so many "'.concat(e,'" headers present'))}else hc.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){t={raw:t};this.headers[cc.headerize(e)]=[t]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=ac.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),yc=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).ua=e,t.headers={},t.ruri=null,t.transport=null,t.server_transaction=null,t}return f(r,gc),c(r,[{key:"reply",value:function(e,t,r,n,o,s){var i=[],a=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||699<e)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||lc.REASON_PHRASE[e]||"",r=cc.cloneArray(r),this.ua.configuration.extra_headers&&(r=r.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===lc.INVITE&&100<e&&e<=200){var l,c=p(this.getHeaders("record-route"));try{for(c.s();!(l=c.n()).done;)u+="Record-Route: ".concat(l.value,"\r\n")}catch(e){c.e(e)}finally{c.f()}}var h,d=p(this.getHeaders("via"));try{for(d.s();!(h=d.n()).done;)u+="Via: ".concat(h.value,"\r\n")}catch(e){d.e(e)}finally{d.f()}!this.to_tag&&100<e?a+=";tag=".concat(cc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),u=(u=(u=(u+="To: ".concat(a,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var f,m=p(r);try{for(m.s();!(f=m.n()).done;){var g=f.value;u+="".concat(g.trim(),"\r\n")}}catch(e){m.e(e)}finally{m.f()}switch(this.method){case lc.INVITE:this.ua.configuration.session_timers&&i.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&i.push("gruu"),i.push("ice","replaces");break;case lc.UPDATE:this.ua.configuration.session_timers&&i.push("timer"),n&&i.push("ice"),i.push("replaces")}i.push("outbound"),this.method===lc.OPTIONS?u=(u+="Allow: ".concat(lc.ALLOWED_METHODS,"\r\n"))+"Accept: ".concat(lc.ACCEPTED_BODY_TYPES,"\r\n"):405===e?u+="Allow: ".concat(lc.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(lc.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(i,"\r\n"),n?(t=cc.str_utf8_length(n),u=(u+="Content-Type: application/sdp\r\n")+"Content-Length: ".concat(t,"\r\n\r\n")+n):u+="Content-Length: ".concat(0,"\r\n\r\n"),this.server_transaction.receiveResponse(e,u,o,s)}},{key:"reply_sl",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this.getHeaders("via");if(!e||e<100||699<e)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));var n,t=t||lc.REASON_PHRASE[e]||"",o="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),s=p(r);try{for(s.s();!(n=s.n()).done;)o+="Via: ".concat(n.value,"\r\n")}catch(e){s.e(e)}finally{s.f()}t=this.getHeader("To");if(!this.to_tag&&100<e?t+=";tag=".concat(cc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(t+=";tag=".concat(this.to_tag)),o=(o=(o=(o+="To: ".concat(t,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var i,a=p(this.ua.configuration.extra_headers);try{for(a.s();!(i=a.n()).done;){var u=i.value;o+="".concat(u.trim(),"\r\n")}}catch(e){a.e(e)}finally{a.f()}}o+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(o)}}])})(),_c={OutgoingRequest:fc,InitialOutgoingInviteRequest:mc,IncomingRequest:yc,IncomingResponse:(()=>{function t(){var e;return u(this,t),(e=a(this,t)).headers={},e.status_code=null,e.reason_phrase=null,e}return f(t,gc),c(t)})()},vc=Yl,bc=B(),Sc=new vc("DigestAuthentication"),Tc=c(function e(t){u(this,e),this._credentials=t,this._cnonce=null,this._nc=0,this._ncHex="00000000",this._algorithm=null,this._realm=null,this._nonce=null,this._opaque=null,this._stale=null,this._qop=null,this._method=null,this._uri=null,this._ha1=null,this._response=null},[{key:"get",value:function(e){switch(e){case"realm":return this._realm;case"ha1":return this._ha1;default:return void Sc.warn('get() | cannot get "%s" parameter',e)}}},{key:"authenticate",value:function(e,t){var r=e.method,n=e.ruri,e=e.body,o=2<arguments.length&&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 Sc.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return Sc.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return Sc.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return Sc.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return Sc.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(-1<t.qop.indexOf("auth-int"))this._qop="auth-int";else{if(!(-1<t.qop.indexOf("auth")))return Sc.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=r,this._uri=n,this._cnonce=o||bc.createRandomToken(12),this._nc+=1;var s,i,t=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-t.length)+t,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=bc.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),i=bc.calculateMD5(s),Sc.debug('authenticate() | using qop=auth [a2:"%s"]',s),this._response=bc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(i))):"auth-int"===this._qop?(s="".concat(this._method,":").concat(this._uri,":").concat(bc.calculateMD5(e||"")),i=bc.calculateMD5(s),Sc.debug('authenticate() | using qop=auth-int [a2:"%s"]',s),this._response=bc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(i))):null===this._qop&&(s="".concat(this._method,":").concat(this._uri),i=bc.calculateMD5(s),Sc.debug('authenticate() | using qop=null [a2:"%s"]',s),this._response=bc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(i))),Sc.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(this._response)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(", "));throw new Error("response field does not exist, cannot generate Authorization header")}}]),wc=500,Ec={T1:wc,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},Ac=W.EventEmitter,Oc=Yl,xc=i,Cc=_c,Rc=Ec,Nc=new Oc("NonInviteClientTransaction"),Ic=new Oc("InviteClientTransaction"),Pc=new Oc("AckClientTransaction"),Uc=new Oc("NonInviteServerTransaction"),kc=new Oc("InviteServerTransaction"),Lc={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"},jc=(()=>{function s(e,t,r,n){u(this,s),(o=a(this,s)).type=Lc.NON_INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o.ua.newTransaction(o),o}return f(s,Ac),c(s,[{key:"C",get:function(){return Lc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(Lc.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},Rc.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Nc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){Nc.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(r<200)switch(this.state){case Lc.STATUS_TRYING:case Lc.STATUS_PROCEEDING:this.stateChanged(Lc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case Lc.STATUS_TRYING:case Lc.STATUS_PROCEEDING:this.stateChanged(Lc.STATUS_COMPLETED),clearTimeout(this.F),408===r?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},Rc.TIMER_K)}}}])})(),Dc=(()=>{function s(e,t,r,n){u(this,s),(o=a(this,s)).type=Lc.INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n,r.transaction=o;var o,n="SIP/2.0/".concat(t.via_transport);return n+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",n),o.ua.newTransaction(o),o}return f(s,Ac),c(s,[{key:"C",get:function(){return Lc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(Lc.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},Rc.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==Lc.STATUS_ACCEPTED&&(Ic.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){Ic.debug("Timer M expired for transaction ".concat(this.id)),this.state===Lc.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){Ic.debug("Timer B expired for transaction ".concat(this.id)),this.state===Lc.STATUS_CALLING&&(this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){Ic.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,r=new Cc.OutgoingRequest(xc.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});r.setHeader("from",this.request.getHeader("from")),r.setHeader("via",this.request.getHeader("via")),r.setHeader("to",e.getHeader("to")),this.D=setTimeout(function(){t.timer_D()},Rc.TIMER_D),this.transport.send(r)}},{key:"cancel",value:function(e){var t;this.state===Lc.STATUS_PROCEEDING&&((t=new Cc.OutgoingRequest(xc.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq})).setHeader("from",this.request.getHeader("from")),t.setHeader("via",this.request.getHeader("via")),t.setHeader("to",this.request.getHeader("to")),e&&t.setHeader("reason",e),this.transport.send(t))}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(100<=r&&r<=199)switch(this.state){case Lc.STATUS_CALLING:this.stateChanged(Lc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case Lc.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(200<=r&&r<=299)switch(this.state){case Lc.STATUS_CALLING:case Lc.STATUS_PROCEEDING:this.stateChanged(Lc.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},Rc.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case Lc.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(300<=r&&r<=699)switch(this.state){case Lc.STATUS_CALLING:case Lc.STATUS_PROCEEDING:this.stateChanged(Lc.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case Lc.STATUS_COMPLETED:this.sendACK(e)}}}])})(),Mc=(()=>{function s(e,t,r,n){u(this,s),(o=a(this,s)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o}return f(s,Ac),c(s,[{key:"C",get:function(){return Lc}},{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Pc.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}}])})(),Vc=(()=>{function o(e,t,r){var n;return u(this,o),(n=a(this,o)).type=Lc.NON_INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=Lc.STATUS_TRYING,e.newTransaction(n),n}return f(o,Ac),c(o,[{key:"C",get:function(){return Lc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){Uc.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Uc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100===e)switch(this.state){case Lc.STATUS_TRYING:this.stateChanged(Lc.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case Lc.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else if(200<=e&&e<=699)switch(this.state){case Lc.STATUS_TRYING:case Lc.STATUS_PROCEEDING:this.stateChanged(Lc.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){o.timer_J()},Rc.TIMER_J),this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}}}])})(),Bc=(()=>{function o(e,t,r){var n;return u(this,o),(n=a(this,o)).type=Lc.INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=Lc.STATUS_PROCEEDING,e.newTransaction(n),n.resendProvisionalTimer=null,r.reply(100),n}return f(o,Ac),c(o,[{key:"C",get:function(){return Lc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){kc.debug("Timer H expired for transaction ".concat(this.id)),this.state===Lc.STATUS_COMPLETED&&kc.debug("ACK not received, dialog will be terminated"),this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){kc.debug("Timer L expired for transaction ".concat(this.id)),this.state===Lc.STATUS_ACCEPTED&&(this.stateChanged(Lc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,kc.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(Lc.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,r,n){var o=this;if(100<=e&&e<=199&&this.state===Lc.STATUS_PROCEEDING&&(this.transport.send(t)||this.onTransportError(),this.last_response=t),100<e&&e<=199&&this.state===Lc.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){o.resend_provisional()},Rc.PROVISIONAL_RESPONSE_INTERVAL));else if(200<=e&&e<=299)switch(this.state){case Lc.STATUS_PROCEEDING:this.stateChanged(Lc.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){o.timer_L()},Rc.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case Lc.STATUS_ACCEPTED:this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else 300<=e&&e<=699&&this.state===Lc.STATUS_PROCEEDING&&(null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(Lc.STATUS_COMPLETED),this.H=setTimeout(function(){o.timer_H()},Rc.TIMER_H),r&&r()):(this.onTransportError(),n&&n()))}}])})(),Fc={C:Lc,NonInviteClientTransaction:jc,InviteClientTransaction:Dc,AckClientTransaction:Mc,NonInviteServerTransaction:Vc,InviteServerTransaction:Bc,checkTransaction:function(e,t){var r,n=e._transactions;switch(t.method){case xc.INVITE:if(r=n.ist[t.via_branch])return r.state===Lc.STATUS_PROCEEDING&&r.transport.send(r.last_response),!0;break;case xc.ACK:if(!(r=n.ist[t.via_branch]))return!1;if(r.state===Lc.STATUS_ACCEPTED)return!1;if(r.state===Lc.STATUS_COMPLETED)return r.state=Lc.STATUS_CONFIRMED,r.I=setTimeout(function(){r.timer_I()},Rc.TIMER_I),!0;break;case xc.CANCEL:return(r=n.ist[t.via_branch])?(t.reply_sl(200),r.state!==Lc.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(r=n.nist[t.via_branch]){switch(r.state){case Lc.STATUS_TRYING:break;case Lc.STATUS_PROCEEDING:case Lc.STATUS_COMPLETED:r.transport.send(r.last_response)}return!0}}}},qc=i,Hc=Tc,Gc=Fc,zc=new Yl("RequestSender"),Kc={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},Yc=c(function e(t,r,n){for(var o in u(this,e),this._ua=t,this._eventHandlers=n,this._method=r.method,this._request=r,this._auth=null,this._challenged=!1,this._staled=!1,Kc)!Object.prototype.hasOwnProperty.call(Kc,o)||this._eventHandlers[o]||(this._eventHandlers[o]=Kc[o]);t.status!==t.C.STATUS_USER_CLOSED||this._method===qc.BYE&&this._method===qc.ACK||this._eventHandlers.onTransportError()},[{key:"send",value:function(){var t=this,e={onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onReceiveResponse:function(e){t._receiveResponse(e)}};switch(this._method){case"INVITE":this.clientTransaction=new Gc.InviteClientTransaction(this._ua,this._ua.transport,this._request,e);break;case"ACK":this.clientTransaction=new Gc.AckClientTransaction(this._ua,this._ua.transport,this._request,e);break;default:this.clientTransaction=new Gc.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,e)}this._ua._configuration.authorization_jwt&&this._request.setHeader("Authorization",this._ua._configuration.authorization_jwt),this.clientTransaction.send()}},{key:"_receiveResponse",value:function(e){var t,r=e.status_code;401!==r&&407!==r||null===this._ua.configuration.password&&null===this._ua.configuration.ha1?this._eventHandlers.onReceiveResponse(e):(r=401===e.status_code?(t=e.parseHeader("www-authenticate"),"authorization"):(t=e.parseHeader("proxy-authenticate"),"proxy-authorization"),t?(!this._challenged||!this._staled&&!0===t.stale)&&(this._auth||(this._auth=new Hc({username:this._ua.configuration.authorization_user,password:this._ua.configuration.password,realm:this._ua.configuration.realm,ha1:this._ua.configuration.ha1})),this._auth.authenticate(this._request,t))?(this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),t.stale&&(this._staled=!0),this._request=this._request.clone(),this._request.cseq+=1,this._request.setHeader("cseq","".concat(this._request.cseq," ").concat(this._method)),this._request.setHeader(r,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send()):this._eventHandlers.onReceiveResponse(e):(zc.debug("".concat(e.status_code," with wrong or missing challenge, cannot authenticate")),this._eventHandlers.onReceiveResponse(e)))}}]),Wc=Yl,$c=B(),Jc=i,Xc=_c,Qc=Yc,Zc=new Wc("Registrator"),ep=c(function e(t,r){u(this,e),this._reg_id=1,this._ua=t,this._transport=r,this._registrar=t.configuration.registrar_server,this._expires=t.configuration.register_expires,this._call_id=$c.createRandomToken(22),this._cseq=0,this._to_uri=t.configuration.uri,this._registrationTimer=null,this._registering=!1,this._registered=!1,this._contact=this._ua.contact.toString(),this._contact+=";+sip.ice",this._extraHeaders=[],this._extraContactParams="",this._sipInstance='"<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance),this._ua.configuration.use_trtc&&(this._contact+=";trtc")},[{key:"registered",get:function(){return this._registered}},{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){var r;Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t],this._extraContactParams+=";".concat(t),r)&&(this._extraContactParams+="=".concat(r))}}},{key:"register",value:function(){var e,n=this;this._registering?Zc.debug("Register request in progress..."):((e=this._extraHeaders.slice()).push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),e.push("Expires: ".concat(this._expires)),this._ua.configuration.use_trtc&&e.push("X-TRTC: 1"),e=new Xc.OutgoingRequest(Jc.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),e=new Qc(this._ua,e,{onRequestTimeout:function(){n._registrationFailure(null,Jc.causes.REQUEST_TIMEOUT)},onTransportError:function(){n._registrationFailure(null,Jc.causes.CONNECTION_ERROR)},onAuthenticated:function(){n._cseq+=1},onReceiveResponse:function(e){if(e.cseq===n._cseq)switch(null!==n._registrationTimer&&(clearTimeout(n._registrationTimer),n._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):var t;(n._registering=!1,e.hasHeader("Contact"))?(t=(t=(r=e.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[])).find(function(e){return n._sipInstance===e.getParam("+sip.instance")&&n._reg_id===parseInt(e.getParam("reg-id"))}))||r.find(function(e){return e.uri.user===n._ua.contact.uri.user}))?(r=(r=!(r=t.getParam("expires"))&&e.hasHeader("expires")?e.getHeader("expires"):r)||n._expires,r=64<(r=(r=Number(r))<10?10:r)?1e3*r/2+Math.floor(1e3*(r/2-32)*Math.random()):1e3*r-5e3,n._registrationTimer=setTimeout(function(){n._registrationTimer=null,0===n._ua.listeners("registrationExpiring").length?n.register():n._ua.emit("registrationExpiring")},r),t.hasParam("temp-gruu")&&(n._ua.contact.temp_gruu=t.getParam("temp-gruu").replace(/"/g,"")),t.hasParam("pub-gruu")&&(n._ua.contact.pub_gruu=t.getParam("pub-gruu").replace(/"/g,"")),n._registered||(n._registered=!0,n._ua.registered({response:e}))):Zc.debug("no Contact header pointing to us, response ignored"):Zc.debug("no Contact header in response to REGISTER, response ignored");break;case/^423$/.test(e.status_code):e.hasHeader("min-expires")?(n._expires=Number(e.getHeader("min-expires")),n._expires<10&&(n._expires=10),n.register()):(Zc.debug("423 response received for REGISTER without Min-Expires"),n._registrationFailure(e,Jc.causes.SIP_FAILURE_CODE));break;default:var r=$c.sipErrorCause(e.status_code);n._registrationFailure(e,r)}}}),this._registering=!0,e.send())}},{key:"unregister",value:function(){var e,r=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this._registered?(this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),e=this._extraHeaders.slice(),t.all?e.push("Contact: *".concat(this._extraContactParams)):e.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),e.push("Expires: 0"),t=new Xc.OutgoingRequest(Jc.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),new Qc(this._ua,t,{onRequestTimeout:function(){r._unregistered(null,Jc.causes.REQUEST_TIMEOUT)},onTransportError:function(){r._unregistered(null,Jc.causes.CONNECTION_ERROR)},onAuthenticated:function(){r._cseq+=1},onReceiveResponse:function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):r._unregistered(e);break;default:var t=$c.sipErrorCause(e.status_code);r._unregistered(e,t)}}}).send()):Zc.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})}}]),tp=r(go),rp=i,np=Fc,op=Yc,ip={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}},sp=Yl,ap=_c,up=i,lp=Fc,cp=c(function e(t,r,n){for(var o in u(this,e),this._dialog=t,this._ua=t._ua,this._request=r,this._eventHandlers=n,this._reattempt=!1,this._reattemptTimer=null,ip)!Object.prototype.hasOwnProperty.call(ip,o)||this._eventHandlers[o]||(this._eventHandlers[o]=ip[o])},[{key:"request",get:function(){return this._request}},{key:"send",value:function(){var e,t=this,r=new op(this._ua,this._request,{onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onAuthenticated:function(e){t._eventHandlers.onAuthenticated(e)},onReceiveResponse:function(e){t._receiveResponse(e)}});r.send(),(this._request.method===rp.INVITE||this._request.method===rp.UPDATE&&this._request.body)&&r.clientTransaction.state!==np.C.STATUS_TERMINATED&&(this._dialog.uac_pending_reply=!0,e=function(){r.clientTransaction.state!==np.C.STATUS_ACCEPTED&&r.clientTransaction.state!==np.C.STATUS_COMPLETED&&r.clientTransaction.state!==np.C.STATUS_TERMINATED||(r.clientTransaction.removeListener("stateChanged",e),t._dialog.uac_pending_reply=!1)},r.clientTransaction.on("stateChanged",e))}},{key:"_receiveResponse",value:function(e){var t=this;408===e.status_code||481===e.status_code?this._eventHandlers.onDialogError(e):e.method!==rp.INVITE||491!==e.status_code||this._reattempt?200<=e.status_code&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):300<=e.status_code&&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))}}]),pp=B(),dp=new sp("Dialog"),hp={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},fp=c(function e(t,r,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:hp.STATUS_CONFIRMED;if(u(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!r.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};r instanceof ap.IncomingResponse&&(o=r.status_code<200?hp.STATUS_EARLY:hp.STATUS_CONFIRMED);t=r.parseHeader("contact");"UAS"===n?(this._id={call_id:r.call_id,local_tag:r.to_tag,remote_tag:r.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._remote_seqnum=r.cseq,this._local_uri=r.parseHeader("to").uri,this._remote_uri=r.parseHeader("from").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===n&&(this._id={call_id:r.call_id,local_tag:r.from_tag,remote_tag:r.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._local_seqnum=r.cseq,this._local_uri=r.parseHeader("from").uri,this._remote_uri=r.parseHeader("to").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),dp.debug("new ".concat(n," dialog created with status ").concat(this._state===hp.STATUS_EARLY?"EARLY":"CONFIRMED"))},[{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}},{key:"isTerminated",value:function(){return this._status===hp.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=hp.STATUS_CONFIRMED,dp.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){dp.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=hp.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=pp.cloneArray(r.extraHeaders),o=pp.cloneObject(r.eventHandlers),r=r.body||null,e=this._createRequest(e,n,r);return o.onAuthenticated=function(){t._local_seqnum+=1},new cp(this,e,o).send(),e}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===up.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===up.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,r){t=pp.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var n=e===up.CANCEL||e===up.ACK?this._local_seqnum:this._local_seqnum+=1;return new ap.OutgoingRequest(e,this._remote_target,this._ua,{cseq:n,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,r)}},{key:"_checkInDialogRequest",value:function(e){var t,r=this;if(this._remote_seqnum)if(e.cseq<this._remote_seqnum){if(e.method!==up.ACK)return e.reply(500),!1;if(null===this._ack_seqnum||e.cseq!==this._ack_seqnum)return!1}else e.cseq>this._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===up.INVITE||e.method===up.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply)return t=1+(10*Math.random()|0),e.reply(500,null,["Retry-After:".concat(t)]),!1;this._uas_pending_reply=!0;var n=function(){e.server_transaction.state!==lp.C.STATUS_ACCEPTED&&e.server_transaction.state!==lp.C.STATUS_COMPLETED&&e.server_transaction.state!==lp.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),r._uas_pending_reply=!1)};e.server_transaction.on("stateChanged",n)}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===lp.C.STATUS_ACCEPTED&&(r._remote_target=e.parseHeader("contact").uri)})}else e.method===up.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===lp.C.STATUS_COMPLETED&&(r._remote_target=e.parseHeader("contact").uri)});return!0}}],[{key:"C",get:function(){return hp}}]),mp={exports:{}},gp=W.EventEmitter,yp=Yl,_p=i,vp=L,bp=B(),Sp=new yp("RTCSession:DTMF"),Tp={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500},wp=(mp.exports=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._session=e,t._direction=null,t._tone=null,t._duration=null,t._request=null,t}return f(r,gp),c(r,[{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}},{key:"send",value:function(e){var t=this,r=1<arguments.length&&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 vp.InvalidStateError(this._session.status);var n=bp.cloneArray(r.extraHeaders);if(this.eventHandlers=bp.cloneObject(r.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=r.duration,n.push("Content-Type: application/dtmf-relay");e="Signal=".concat(this._tone,"\r\n");e+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(_p.INFO,{extraHeaders:n,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:e})}},{key:"init_incoming",value:function(e){var t,r=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this._direction="incoming",(this._request=e).reply(200),e.body&&(1<=(t=e.body.split("\n")).length&&r.test(t[0])&&(this._tone=t[0].replace(r,"$2")),2<=t.length)&&n.test(t[1])&&(this._duration=parseInt(t[1].replace(n,"$2"),10)),this._duration||(this._duration=Tp.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):Sp.debug("invalid INFO DTMF received, discarded")}}])})(),mp.exports.C=Tp,W.EventEmitter),Ep=i,Ap=L,Op=B(),xp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._session=e,t._direction=null,t._contentType=null,t._body=null,t}return f(r,wp),c(r,[{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&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 Ap.InvalidStateError(this._session.status);this._contentType=e,this._body=t;n=Op.cloneArray(n.extraHeaders);n.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(Ep.INFO,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){r.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){r.emit("failed",{originator:"remote",response:e})},onTransportError:function(){r._session.onTransportError()},onRequestTimeout:function(){r._session.onRequestTimeout()},onDialogError:function(){r._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",(this.request=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})}}])})(),Cp=i,Rp=new Yl("RTCSession:ReferNotifier"),Np="refer",Ip="message/sipfrag;version=2.0",Pp=300,Up=c(function e(t,r,n){u(this,e),this._session=t,this._id=r,this._expires=n||Pp,this._active=!0,this.notify(100)},[{key:"notify",value:function(e,t){var r;Rp.debug("notify()"),!1!==this._active&&(t=t||Cp.REASON_PHRASE[e]||"",r=200<=e?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(Cp.NOTIFY,{extraHeaders:["Event: ".concat(Np,";id=").concat(this._id),"Subscription-State: ".concat(r),"Content-Type: ".concat(Ip)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),kp=W.EventEmitter,Lp=Yl,jp=i,Dp=M(),Mp=B(),Vp=new Lp("RTCSession:ReferSubscriber"),Bp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._id=null,t._session=e,t}return f(r,kp),c(r,[{key:"id",get:function(){return this._id}},{key:"sendRefer",value:function(e){var t,r=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=(Vp.debug("sendRefer()"),Mp.cloneArray(n.extraHeaders)),s=Mp.cloneObject(n.eventHandlers);for(t in s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);var i=null,n=(n.replaces&&(i=n.replaces._request.call_id,i=(i+=";to-tag=".concat(n.replaces._to_tag))+";from-tag=".concat(n.replaces._from_tag),i=encodeURIComponent(i)),"Refer-To: <".concat(e).concat(i?"?Replaces=".concat(i):"",">")),i=(o.push(n),o.some(function(e){return e.toLowerCase().startsWith("referred-by:")})||(e="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">"),o.push(e)),o.push("Contact: ".concat(this._session.contact)),this._session.sendRequest(jp.REFER,{extraHeaders:o,eventHandlers:{onSuccessResponse:function(e){r._requestSucceeded(e)},onErrorResponse:function(e){r._requestFailed(e,jp.causes.REJECTED)},onTransportError:function(){r._requestFailed(null,jp.causes.CONNECTION_ERROR)},onRequestTimeout:function(){r._requestFailed(null,jp.causes.REQUEST_TIMEOUT)},onDialogError:function(){r._requestFailed(null,jp.causes.DIALOG_ERROR)}}}));this._id=i.cseq}},{key:"receiveNotify",value:function(e){if(Vp.debug("receiveNotify()"),e.body){var t=Dp.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 Vp.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){Vp.debug("REFER succeeded"),Vp.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){Vp.debug("REFER failed"),Vp.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}}])})(),Fp=W.EventEmitter,qp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r)).audio=e.audio,t.video=e.video,t._mediaStream=e.mediaStream,t._player=null,t}return f(r,Fp),c(r,[{key:"mediaStream",get:function(){return this._mediaStream}},{key:"getMediaStream",value:function(){return this._mediaStream}},{key:"getAudioTrack",value:function(){if(this._mediaStream){var e=this._mediaStream.getAudioTracks();if(0<e.length)return e[0]}return null}},{key:"play",value:function(){}}])})(),Hp=qp,Gp=B(),zp=(()=>{function t(e){return u(this,t),(e=a(this,t,[e])).type="local",e}return f(t,Hp),c(t,[{key:"initialize",value:function(){var t=this;return navigator.mediaDevices.getUserMedia({audio:this.audio,video:this.video}).then(function(e){return t._mediaStream=e,t}).catch(function(e){throw e})}},{key:"close",value:function(){this._mediaStream&&Gp.closeMediaStream(this._mediaStream)}}])})(),Kp=qp,Yp=(()=>{function r(e){var t;return u(this,r),(t=a(this,r,[e]))._mediaStream=e.mediaStream,t.type="remote",t}return f(r,Kp),c(r)})(),Wp="object"===("undefined"==typeof globalThis?"undefined":S(globalThis))?globalThis:"object"===("undefined"==typeof self?"undefined":S(self))?self:"object"===("undefined"==typeof window?"undefined":S(window))?window:"object"===S(t)?t:{},$p={},Jp=Object.freeze({__proto__:null,OTLPTraceExporter:class extends rr{constructor(e={}){super(Da(e,Sa,"v1/traces",{"Content-Type":"application/json"}))}}}),Xp=r(Jp);class Qp{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Vn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let e=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=vu.now(),this._performanceOffset=e-(this._performanceStartTime+vu.timeOrigin),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let e of t.links)this.addLink(e);this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(e,t){var r,n;return null==t||this._isSpanEnded()||(0===e.length?Jn.warn("Invalid attribute key: "+e):hu(t)?(r=this._spanLimits.attributeCountLimit,n=!Object.prototype.hasOwnProperty.call(this.attributes,e),void 0!==r&&this._attributesCount>=r&&n?this._droppedAttributesCount++:(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++)):Jn.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,o){if(!this._isSpanEnded()){var s=this._spanLimits.eventCountLimit;if(0===s)Jn.warn("No events allowed."),this._droppedEventsCount++;else{void 0!==s&&this.events.length>=s&&(0===this._droppedEventsCount&&Jn.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Cu(t)&&(Cu(o)||(o=t),t=void 0);var i=pu(t),a=this._spanLimits.attributePerEventCountLimit,u={};let r=0,n=0;for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let e=i[t];void 0!==a&&n>=a?r++:(u[t]=this._truncateToSize(e),n++)}this.events.push({name:e,attributes:u,time:this._getTime(o),droppedAttributesCount:r})}}return this}addLink(t){if(!this._isSpanEnded()){let e=this._spanLimits.linkCountLimit;if(0===e)this._droppedLinksCount++;else{void 0!==e&&this.links.length>=e&&(0===this._droppedLinksCount&&Jn.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);var o=this._spanLimits.attributePerLinkCountLimit,s=pu(t.attributes),i={};let r=0,n=0;for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)){let e=s[t];void 0!==o&&n>=o?r++:(i[t]=this._truncateToSize(e),n++)}t={context:t.context};0<n&&(t.attributes=i),0<r&&(t.droppedAttributesCount=r),this.links.push(t)}}return this}addLinks(e){for(var t of e)this.addLink(t);return this}setStatus(e){var t;return this._isSpanEnded()||e.code!==Vn.UNSET&&this.status.code!==Vn.OK&&(t={code:e.code},e.code===Vn.ERROR&&("string"==typeof e.message?t.message=e.message:null!=e.message&&Jn.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t),this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?Jn.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=((e,t)=>{let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(--r,n+=Su),[r,n]})(this.startTime,this.endTime),this._duration[0]<0&&(Jn.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),0<this._droppedEventsCount&&Jn.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),0<this._droppedLinksCount&&Jn.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){return"number"==typeof e&&e<=vu.now()?wu(e+this._performanceOffset):"number"==typeof e?Tu(e):e instanceof Date?Tu(e.getTime()):xu(e)?e:this._startTimeProvided?Tu(Date.now()):(e=vu.now()-this._performanceStartTime,Ru(this.startTime,Tu(e)))}isRecording(){return!1===this._ended}recordException(e,t){var r={};"string"==typeof e?r[wo]=e:e&&(e.code?r[Eo]=e.code.toString():e.name&&(r[Eo]=e.name),e.message&&(r[wo]=e.message),e.stack)&&(r["exception.stacktrace"]=e.stack),r[Eo]||r[wo]?this.addEvent("exception",r,t):Jn.warn("Failed to record an exception "+e)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){var e;return this._ended&&(e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),Jn.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)),this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(Jn.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}}(e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Zp=Zp||{});class td{shouldSample(){return{decision:Zp.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class rd{shouldSample(){return{decision:Zp.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class nd{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(gu(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new rd),this._remoteParentSampled=e.remoteParentSampled??new rd,this._remoteParentNotSampled=e.remoteParentNotSampled??new td,this._localParentSampled=e.localParentSampled??new rd,this._localParentNotSampled=e.localParentNotSampled??new td}shouldSample(e,t,r,n,o,s){var i=fo.getSpanContext(e);return(i&&Un(i)?i.isRemote?i.traceFlags&an.SAMPLED?this._remoteParentSampled:this._remoteParentNotSampled:i.traceFlags&an.SAMPLED?this._localParentSampled:this._localParentNotSampled:this._root).shouldSample(e,t,r,n,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class od{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(e,t){return{decision:In(t)&&this._accumulate(t)<this._upperBound?Zp.RECORD_AND_SAMPLED:Zp.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return"number"!=typeof e||isNaN(e)?0:1<=e?1:e<=0?0:e}_accumulate(n){let e=0;for(let r=0;r<32;r+=8){let t=0;for(let e=0;e<8;e++){var o=n.charCodeAt(r+e);t=t<<4|(o<58?o-48:o<71?o-55:o-87)}e=(e^t)>>>0}return e}}function id(){return{sampler:sd(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function sd(){var e=ed.ParentBasedAlwaysOn;switch(e){case ed.AlwaysOn:return new rd;case ed.AlwaysOff:return new td;case ed.ParentBasedAlwaysOn:return new nd({root:new rd});case ed.ParentBasedAlwaysOff:return new nd({root:new td});case ed.TraceIdRatio:return new od(ad());case ed.ParentBasedTraceIdRatio:return new nd({root:new od(ad())});default:return Jn.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${ed.ParentBasedAlwaysOn}".`),new nd({root:new rd})}}function ad(){return Jn.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1}(e=>{e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(ed=ed||{});let ud=1/0;class ld{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize="number"==typeof t?.maxExportBatchSize?t.maxExportBatchSize:512,this._maxQueueSize="number"==typeof t?.maxQueueSize?t.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof t?.scheduledDelayMillis?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof t?.exportTimeoutMillis?t.exportTimeoutMillis:3e4,this._shutdownOnce=new ul(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Jn.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||0!=(e.spanContext().traceFlags&an.SAMPLED)&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(0===this._droppedSpansCount&&Jn.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++):(0<this._droppedSpansCount&&(Jn.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[];for(let e=0,t=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);e<t;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise((t,o)=>{let s=setTimeout(()=>{o(new Error("Timeout"))},this._exportTimeoutMillis);$n.with(au($n.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);var e=()=>this._exporter.export(r,e=>{clearTimeout(s),e.code===Nu.SUCCESS?t():o(e.error??new Error("BatchSpanProcessor: span export failed"))});let n=null;for(let t=0,e=r.length;t<e;t++){let e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(n??=[]).push(e.resource.waitForAsyncAttributes())}null===n?e():Promise.all(n).then(e,e=>{gu(e),o(e)})})})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,0<this._finishedSpans.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,gu(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class cd extends ld{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch(e=>{gu(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{gu(e)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}}let pd=new Uint8Array(16),dd=new Uint8Array(8),hd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function fd(t){for(let e=0;e<t.length;e++)t[e]=256*Math.random()>>>0;for(let e=0;e<t.length;e++)if(0<t[e])return;t[t.length-1]=1}function md(t){let r="";for(let e=0;e<t.length;e++)r+=hd[t[e]];return r}class gd{generateTraceId(){return fd(pd),md(pd)}generateSpanId(){return fd(dd),md(dd)}}let yd="otel.span.parent.origin",_d="otel.span.sampling_result";class vd{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){var r=(()=>{switch(t){case Zp.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Zp.RECORD:return"RECORD_ONLY";case Zp.NOT_RECORD:return"DROP"}})();if(this.startedSpans.add(1,{[yd]:bd(e),[_d]:r}),t===Zp.NOT_RECORD)return()=>{};let n={[_d]:r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}function bd(e){return e?e.isRemote?"remote":"local":"none"}class Sd{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){i=t,o={sampler:sd()},s=id(),(o=Object.assign({},s,o,i)).generalLimits=Object.assign({},s.generalLimits,i.generalLimits||{}),o.spanLimits=Object.assign({},s.spanLimits,i.spanLimits||{});var o,s=o,i=(this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=t.idGenerator||new gd,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e,s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace","2.7.1"):sn());this._tracerMetrics=new vd(i)}startSpan(e,t={},r=$n.active()){t.root&&(r=fo.deleteSpan(r));var n=fo.getSpan(r);if(uu(r))return Jn.debug("Instrumentation suppressed, returning Noop Span"),fo.wrapSpanContext(bn);var n=n?.spanContext(),o=this._idGenerator.generateSpanId();let s,i,a;n&&fo.isSpanContextValid(n)?(i=n.traceId,a=n.traceState,s=n):i=this._idGenerator.generateTraceId();var u=t.kind??Mn.INTERNAL,l=(t.links??[]).map(e=>({context:e.context,attributes:pu(e.attributes)})),c=pu(t.attributes),p=this._sampler.shouldSample(r,i,e,u,c,l),n=this._tracerMetrics.startSpan(n,p.decision),o=(a=p.traceState??a,{traceId:i,spanId:o,traceFlags:p.decision===Dn.RECORD_AND_SAMPLED?an.SAMPLED:an.NONE,traceState:a});return p.decision===Dn.NOT_RECORD?(Jn.debug("Recording is off, propagating context in a non-recording span"),fo.wrapSpanContext(o)):(c=pu(Object.assign(c,p.attributes)),new Qp({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:o,name:e,kind:u,links:l,parentSpanContext:s,attributes:c,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:n}))}startActiveSpan(e,t,r,n){let o,s,i;if(!(arguments.length<2))return i=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),t=s??$n.active(),r=this.startSpan(e,o,t),n=fo.setSpan(t,r),$n.with(n,i,void 0,r)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Td{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(var t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{gu(e||new Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(var r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(var t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(var t of this._spanProcessors)t.onEnd(e)}shutdown(){let r=[];for(var e of this._spanProcessors)r.push(e.shutdown());return new Promise((e,t)=>{Promise.all(r).then(()=>{e()},t)})}}(e=>{e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(wd=wd||{});class Ed{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=tl(t,e.shift(),0,r);return t})([{},id(),(t=e,(r=Object.assign({},t.spanLimits)).attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??128,r.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??ud,Object.assign({},t,{spanLimits:r}))]),r=(this._resource=t.resource??gl(),this._config=Object.assign({},t,{resource:this._resource}),[]);e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new Td(r)}getTracer(e,t,r){var n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._tracers.has(n)||this._tracers.set(n,new Sd({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(n)}forceFlush(){let o=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(t=>{let r,n=setTimeout(()=>{t(new Error(`Span processor did not completed within timeout period of ${o} ms`)),r=wd.timeout},o);e.forceFlush().then(()=>{clearTimeout(n),r!==wd.timeout&&(r=wd.resolved,t(r))}).catch(e=>{clearTimeout(n),r=wd.error,t(e)})}));return new Promise((t,r)=>{Promise.all(e).then(e=>{e=e.filter(e=>e!==wd.resolved);0<e.length?r(e):t()}).catch(e=>r([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class Ad{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Ou(e.startTime),duration:Ou(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});if(e)return e({code:Nu.SUCCESS})}}class Od{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Nu.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:Nu.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}class xd{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new ul(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(t){if(!this._shutdownOnce.isCalled&&0!=(t.spanContext().traceFlags&an.SAMPLED)){let e=this._doExport(t).catch(e=>gu(e));this._pendingExports.add(e),e.finally(()=>this._pendingExports.delete(e))}}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();e=await ll._export(this._exporter,[e]);if(e.code!==Nu.SUCCESS)throw e.error??new Error(`SimpleSpanProcessor: span export failed (status ${e})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}class Cd{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}var Rd,Nd=r(Object.freeze({__proto__:null,BasicTracerProvider:Ed,BatchSpanProcessor:cd,RandomIdGenerator:gd,ConsoleSpanExporter:Ad,InMemorySpanExporter:Od,SimpleSpanProcessor:xd,NoopSpanProcessor:Cd,AlwaysOffSampler:td,AlwaysOnSampler:rd,ParentBasedSampler:nd,TraceIdRatioBasedSampler:od,get SamplingDecision(){return Zp}}));class Id{_enabled=!1;_currentContext=Dr;_bindFunction(t=Dr,r){function e(...e){return n.with(t,()=>r.apply(this,e))}let n=this;return Object.defineProperty(e,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),e}active(){return this._currentContext}bind(e,t){return void 0===e&&(e=this.active()),"function"==typeof t?this._bindFunction(e,t):t}disable(){return this._currentContext=Dr,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=Dr),this}with(e,t,r,...n){var o=this._currentContext;this._currentContext=e||Dr;try{return t.call(r,...n)}finally{this._currentContext=o}}}(e=>{e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(Rd=Rd||{});let Pd;function Ud(e,t){return t in e}function kd(e,t,r,n=!0){if(Ud(r,t)&&"number"==typeof r[t]&&(!n||0!==r[t]))return e.addEvent(t,r[t])}function Ld(e){return e.slice().sort((e,t)=>{e=e[Rd.FETCH_START],t=t[Rd.FETCH_START];return t<e?1:e<t?-1:0})}function jd(){return"undefined"!=typeof location?location.origin:void 0}function Dd(e){var t;return"function"==typeof URL?new URL(e,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0):((t=Pd=Pd||document.createElement("a")).href=e,t)}var Md=Object.freeze({__proto__:null,WebTracerProvider:class extends Ed{constructor(e={}){super(e)}register(e={}){fo.setGlobalTracerProvider(this),null!==(t=e.propagator)&&(void 0!==t?co.setGlobalPropagator(t):co.setGlobalPropagator(new Iu({propagators:[new qu,new cu]})));var t,r=e.contextManager;if(null!==r){if(void 0===r){let e=new Id;return void(e.enable(),$n.setGlobalContextManager(e))}r.enable(),$n.setGlobalContextManager(r)}}},StackContextManager:Id,get PerformanceTimingNames(){return Rd},addSpanNetworkEvent:kd,addSpanNetworkEvents:function(r,n,e=!1,t,o){if(void 0===t&&(t=0!==n[Rd.START_TIME]),e||(kd(r,Rd.FETCH_START,n,t),kd(r,Rd.DOMAIN_LOOKUP_START,n,t),kd(r,Rd.DOMAIN_LOOKUP_END,n,t),kd(r,Rd.CONNECT_START,n,t),kd(r,Rd.SECURE_CONNECTION_START,n,t),kd(r,Rd.CONNECT_END,n,t),kd(r,Rd.REQUEST_START,n,t),kd(r,Rd.RESPONSE_START,n,t),kd(r,Rd.RESPONSE_END,n,t)),!o){let e=n[Rd.ENCODED_BODY_SIZE],t=(void 0!==e&&r.setAttribute("http.response_content_length",e),n[Rd.DECODED_BODY_SIZE]);void 0!==t&&e!==t&&r.setAttribute("http.response_content_length_uncompressed",t)}},getElementXPath:function e(t,r){if(t.nodeType===Node.DOCUMENT_NODE)return"/";var n=((t,r)=>{let e=t.nodeType,n=(r=>{if(!r.parentNode)return 0;let n=[r.nodeType],e=(r.nodeType===Node.CDATA_SECTION_NODE&&n.push(Node.TEXT_NODE),Array.from(r.parentNode.childNodes));return 1<=(e=e.filter(e=>{var t=e.localName;return 0<=n.indexOf(e.nodeType)&&t===r.localName})).length?e.indexOf(r)+1:0})(t),o="";if(e===Node.ELEMENT_NODE){let e=t.getAttribute("id");if(r&&e)return`//*[@id="${e}"]`;o=t.localName}else if(e===Node.TEXT_NODE||e===Node.CDATA_SECTION_NODE)o="text()";else{if(e!==Node.COMMENT_NODE)return"";o="comment()"}return o&&1<n?`/${o}[${n}]`:"/"+o})(t,r);if(r&&0<n.indexOf("@id"))return n;let o="";return t.parentNode&&(o+=e(t.parentNode,r)),o+=n},getResource:function(e,u,n,t,o=new WeakSet,r){var s=Dd(e),e=((n,e,t,r,o)=>{let s=Au(u),i=Au(e),a=t.filter(e=>{var t=Au(Eu(e[Rd.FETCH_START])),r=Au(Eu(e[Rd.RESPONSE_END]));return e.initiatorType.toLowerCase()===(o||"xmlhttprequest")&&e.name===n&&t>=s&&r<=i});return a=0<a.length?a.filter(e=>!r.has(e)):a})(e=s.toString(),n,t,o,r);if(0===e.length)return{mainRequest:void 0};if(1!==e.length){o=Ld(e);if(s.origin!==jd()&&1<o.length){let e=o[0],t=((o,e,t)=>{var s=Au(t),i=Au(Eu(e));let a,u=o[1],r=o.length;for(let n=1;n<r;n++){let e=o[n],t=Au(Eu(e[Rd.FETCH_START])),r=s-Au(Eu(e[Rd.RESPONSE_END]));t>=i&&(!a||r<a)&&(a=r,u=e)}return u})(o,e[Rd.RESPONSE_END],n),r=e[Rd.RESPONSE_END];return t[Rd.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}}return{mainRequest:e[0]}},hasKey:Ud,normalizeUrl:function(e){return Dd(e).href},parseUrl:Dd,shouldPropagateTraceHeaders:function(t,e){let r=e||[];return("string"==typeof r||r instanceof RegExp)&&(r=[r]),Dd(t).origin===jd()||r.some(e=>"string"==typeof e?t===e:!!t.match(e))},sortResources:Ld,AlwaysOffSampler:td,AlwaysOnSampler:rd,BasicTracerProvider:Ed,BatchSpanProcessor:cd,ConsoleSpanExporter:Ad,InMemorySpanExporter:Od,NoopSpanProcessor:Cd,ParentBasedSampler:nd,RandomIdGenerator:gd,get SamplingDecision(){return Zp},SimpleSpanProcessor:xd,TraceIdRatioBasedSampler:od}),Vd=r(Md),Bd=Xp.OTLPTraceExporter,Fd=Nd.BatchSpanProcessor,qd=Vd.WebTracerProvider,Hd=Al,Gd=n,zd="tccc",Kd="https://otlp.tccc.qcloud.com/v1/traces",Yd=function(e){var t=new Bd({url:e.url||Kd,headers:{"X-Tps-TenantID":e.id||zd}}),t=new qd({spanProcessors:[new Fd(t,{})],resource:Hd.defaultResource().merge(Hd.resourceFromAttributes({"tps.tenant.id":e.id||zd,"service.name":"JsSIP","service.version":Gd.version}))});return t.register(),t.getTracer("JsSIP")},Wd={provider:Yd({id:zd,url:Kd}),attributes:{}},$d=($p.setConfig=function(e){Wd.provider=Yd(e)},$p.setAttributes=function(e){Object.assign(Wd.attributes,e)},$p.trace=function(e){return Yd(e)},W.EventEmitter),Jd=Ol.exports,Xd=Wl,Qd=Yl,Zd=tp,eh=i,th=L,rh=Fc,nh=B(),oh=Ec,ih=_c,sh=fp,ah=Yc,uh=mp.exports,lh=xp,ch=Up,ph=Bp,dh=V(),hh=zp,fh=Yp,mh=Wp,gh=$p,yh=Zd.trace,_h=Zd.context,vh=new Qd("RTCSession"),bh={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9},Sh=["audio","video"],Th=(()=>{function i(e){u(this,i),vh.debug("new"),(t=a(this,i))._id=null,t._ua=e,t._status=bh.STATUS_NULL,t._dialog=null,t._earlyDialogs={},t._contact=null,t._from_tag=null,t._to_tag=null,t._use_trtc=t._ua.configuration.use_trtc,t._trtc_already_join=!1,t._is_mini_program=nh.isMiniProgram(),t._connection=null,t._connectionPromiseQueue=Promise.resolve(),t._request=null,t._is_canceled=!1,t._cancel_reason="",t._is_confirmed=!1,t._late_sdp=!1,t._rtcOfferConstraints=null,t._rtcAnswerConstraints=null,t._localStream=null,t._remoteStream={},t._remoteMediaStream={},t._localTRTCClient=null,t._localUserId=null,t._trtcLocalStream=null,t._trtcLocalStreamLocallyGenerated=!1,t._trtcLocalStreamConfig={},t._trtcRemoteStream={},t._rtcReady=!0,t._iceReady=!1,t._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},t._direction=null,t._local_identity=null,t._remote_identity=null,t._start_time=null,t._end_time=null,t._tones=null,t._audioMuted=!1,t._videoMuted=!1,t._localHold=!1,t._remoteHold=!1,t._sessionTimers={enabled:t._ua.configuration.session_timers,refreshMethod:t._ua.configuration.session_timers_refresh_method,defaultExpires:eh.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},t._referSubscribers={},t._data={};var t,e=Number(t._ua.configuration.log_level),e=1<e?e+1:e,r=null==(r=t._ua.configuration.uri.host)?void 0:r.includes("tencentcloud.com");return t.tracer=gh.trace({id:r?"tcccsg":"tccc",url:r?"https://otlp.connect.tencentcloud.com/v1/traces":"https://otlp.tccc.qcloud.com/v1/traces"}),Jd.Logger.setLogLevel(e),t._ua.configuration.log_report?Jd.Logger.enableUploadLog():Jd.Logger.disableUploadLog(),t}return f(i,$d),c(i,[{key:"C",get:function(){return bh}},{key:"causes",get:function(){return eh.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}},{key:"localStreams",get:function(){return this._use_trtc?[this._trtcLocalStream]:[this._localStream]}},{key:"remoteStreams",get:function(){return this._use_trtc?Object.values(this._trtcRemoteStream):Object.values(this._remoteStream)}},{key:"isInProgress",value:function(){switch(this._status){case bh.STATUS_NULL:case bh.STATUS_INVITE_SENT:case bh.STATUS_1XX_RECEIVED:case bh.STATUS_INVITE_RECEIVED:case bh.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case bh.STATUS_ANSWERED:case bh.STATUS_WAITING_FOR_ACK:case bh.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case bh.STATUS_CANCELED:case bh.STATUS_TERMINATED:return!0;default:return!1}}},{key:"isMuted",value:function(){return{audio:this._audioMuted,video:this._videoMuted}}},{key:"isOnHold",value:function(){return{local:this._localHold,remote:this._remoteHold}}},{key:"connect",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,o=(vh.debug("connect options:".concat(JSON.stringify(r))),e),s=nh.cloneObject(r.eventHandlers),i=nh.cloneArray(r.extraHeaders),a=nh.cloneObject(r.mediaConstraints,{audio:!0,video:!0}),u=r.mediaStream||null,l=nh.cloneObject(r.pcConfig,{iceServers:[]}),c=r.rtcConstraints||null,p=r.rtcOfferConstraints||null;if(this._rtcOfferConstraints=p,this._rtcAnswerConstraints=r.rtcAnswerConstraints||null,this._trtcLocalStreamConfig=r.streamConfig||{},this._data=r.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==bh.STATUS_NULL)throw new th.InvalidStateError(this._status);if(!mh.RTCPeerConnection&&!nh.isMiniProgram())throw new th.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));for(t in this._sessionTimers.enabled&&nh.isDecimal(r.sessionTimersExpires)&&(r.sessionTimersExpires>=eh.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=r.sessionTimersExpires:this._sessionTimers.defaultExpires=eh.SESSION_EXPIRES),s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);this._from_tag=nh.newTag();var o=r.anonymous||!1,h={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:o,outbound:!0}),o?(h.from_display_name="Anonymous",h.from_uri=new dh("sip","anonymous","anonymous.invalid"),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),i.push("Privacy: id")):r.fromUserName&&(h.from_uri=new dh("sip",r.fromUserName,this._ua.configuration.uri.host),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(h.from_display_name=r.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._use_trtc&&i.push("X-TRTC: 1"),this._request=new ih.InitialOutgoingInviteRequest(e,this._ua,h,i),this._id=this._request.call_id+this._from_tag,this._use_trtc||this._createRTCConnection(l,c),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._use_trtc?this._sendTRTCInitialRequest():this._sendInitialRequest(a,p,u)}},{key:"init_incoming",value:function(e,t){var r,n=this,o=(vh.debug("init_incoming()"),e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0);e.body&&"application/sdp"!==o?e.reply(415):(this._status=bh.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")&&(r=1e3*e.getHeader("expires")),e.to_tag=nh.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=bh.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),n._failed("local",null,eh.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),r&&(this._timers.expiresTimer=setTimeout(function(){n._status===bh.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),n._failed("system",null,eh.causes.EXPIRES))},r)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==bh.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 i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(vh.debug("answer()"),this._request),t=nh.cloneArray(e.extraHeaders),r=nh.cloneObject(e.mediaConstraints),n=e.mediaStream||null,o=nh.cloneObject(e.pcConfig,{iceServers:[]}),s=e.rtcConstraints||null,u=e.rtcAnswerConstraints||null,l=nh.cloneObject(e.rtcOfferConstraints),c=!1,h=!1,d=!1,f=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=e.rtcOfferConstraints||null,this._trtcLocalStreamConfig=e.streamConfig||{},this._data=e.data||this._data,"incoming"!==this._direction)throw new th.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==bh.STATUS_WAITING_FOR_ANSWER)throw new th.InvalidStateError(this._status);if(this._sessionTimers.enabled&&nh.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=eh.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=e.sessionTimersExpires:this._sessionTimers.defaultExpires=eh.SESSION_EXPIRES),this._status=bh.STATUS_ANSWERED,this._createDialog(a,"UAS")){if(clearTimeout(this._timers.userNoAnswerTimer),t.unshift("Contact: ".concat(this._contact)),this._use_trtc){var m=a.getHeader("X-TRTC-SDKAPPID"),g=a.getHeader("X-TRTC-USERID"),y=parseInt(a.getHeader("X-TRTC-ROOMID"),10),_=a.getHeader("X-TRTC-STRROOMID"),v=a.getHeader("X-TRTC-USERSIG"),b=a.getHeader("X-TRTC-PRIVATEMAPKEY"),e=a.getHeader("X-TCCC-IVR"),S=a.getHeader("X-TRTC-PROXY");if(!this._is_mini_program&&m&&g&&(y||_)&&v)return void Promise.resolve().then(function(){return i._connecting(a),i._joinTRTCRoom({sdkAppId:m,userId:g,roomId:y,strRoomId:_,privateMapKey:b,userSig:v,proxy:S},function(e){i.terminate({status_code:480,cause:eh.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),i._failed("system",e.toString(),eh.causes.WEBRTC_ERROR)})}).then(function(e){if(i._status===bh.STATUS_TERMINATED)throw new Error("terminated");vh.debug("TRTC success"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=bh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,eh.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t,r,n,o,s;if(i._status!==bh.STATUS_TERMINATED)throw r=t=eh.causes.WEBRTC_ERROR,n=e.name,(o=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(n))&&(t=eh.causes.USER_DENIED_MEDIA_ACCESS,vh.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e)),s=nh.isFunction(e.getCode)?e.getCode():"0","RtcError"===e.name&&vh.error("TRTC error",e.toString(),{code:s,name:n}),!o&&e.message&&(r=e.message),vh.debug("TRTC error then terminate",{code:s,name:n}),a.reply(480,r),i._failed("local",e.toString(),t),e});if(e||this._is_mini_program)return(new Promise.resolve).then(function(e){if(i._status===bh.STATUS_TERMINATED)throw new Error("terminated");vh.debug("processing pure signal mode"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=bh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,eh.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t;if(i._status!==bh.STATUS_TERMINATED)throw vh.error("pure signal mode error then terminate",e.toString()),t=eh.causes.WEBRTC_ERROR,a.reply(480,t),i._failed("local",e.toString(),t),e});throw vh.error("missing TRTC config"),a.reply(500),this._failed("system",null,eh.causes.INTERNAL_ERROR),new Error("missing config")}e=a.parseSDP();Array.isArray(e.media)||(e.media=[e.media]);var T,w=p(e.media);try{for(w.s();!(T=w.n()).done;){var E=T.value;"audio"===E.type&&(c=!0,E.direction&&"sendrecv"!==E.direction||(d=!0)),"video"===E.type&&(h=!0,E.direction&&"sendrecv"!==E.direction||(f=!0))}}catch(i){w.e(i)}finally{w.f()}if(n&&!1===r.audio){var A,O=p(n.getAudioTracks());try{for(O.s();!(A=O.n()).done;){var x=A.value;n.removeTrack(x)}}catch(i){O.e(i)}finally{O.f()}}if(n&&!1===r.video){var C,R=p(n.getVideoTracks());try{for(R.s();!(C=R.n()).done;){var N=C.value;n.removeTrack(N)}}catch(i){R.e(i)}finally{R.f()}}n||void 0!==r.audio||(r.audio=d),n||void 0!==r.video||(r.video=f),n||c||l.offerToReceiveAudio||(r.audio=!1),n||h||l.offerToReceiveVideo||(r.video=!1),this._createRTCConnection(o,s),Promise.resolve().then(function(){return n||(r.audio||r.video?new hh(r).initialize().catch(function(e){if(i._status===bh.STATUS_TERMINATED)throw new Error("terminated");var t=eh.causes.USER_DENIED_MEDIA_ACCESS;throw a.reply(480,t),i._failed("local",null,eh.causes.USER_DENIED_MEDIA_ACCESS),vh.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e),new Error("getUserMedia() failed")}):void 0)}).then(function(t){if(i._status===bh.STATUS_TERMINATED)throw new Error("terminated");(i._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){i._connection.addTrack(e,t.mediaStream)})}).then(function(){var e,t;if(!i._late_sdp)return e={originator:"remote",type:"offer",sdp:a.body},vh.debug('emit "sdp"'),i.emit("sdp",e),t=new RTCSessionDescription({type:"offer",sdp:e.sdp}),i._connectionPromiseQueue=i._connectionPromiseQueue.then(function(){return i._connection.setRemoteDescription(t)}).catch(function(e){throw a.reply(488),i._failed("system",null,eh.causes.WEBRTC_ERROR),vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),i.emit("peerconnection:setremotedescriptionfailed",e),new Error("peerconnection.setRemoteDescription() failed")}),i._connectionPromiseQueue}).then(function(){if(i._status===bh.STATUS_TERMINATED)throw new Error("terminated");return i._connecting(a),(i._late_sdp?i._createLocalDescription("offer",i._rtcOfferConstraints):i._createLocalDescription("answer",u)).catch(function(){throw a.reply(500),new Error("_createLocalDescription() failed")})}).then(function(e){if(i._status===bh.STATUS_TERMINATED)throw new Error("terminated");i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=bh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,eh.causes.CONNECTION_ERROR)})}).catch(function(e){i._status!==bh.STATUS_TERMINATED&&vh.warn(e)})}else a.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};vh.debug("terminate()");var r,n,o=e.cause||eh.causes.BYE,s=nh.cloneArray(e.extraHeaders),i=e.body,a=e.status_code,u=e.reason_phrase;if(this._status===bh.STATUS_TERMINATED)throw new th.InvalidStateError(this._status);switch(this._status){case bh.STATUS_NULL:case bh.STATUS_INVITE_SENT:case bh.STATUS_1XX_RECEIVED:if(vh.debug("canceling session"),a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&(u=u||eh.REASON_PHRASE[a]||"",r="SIP ;cause=".concat(a,' ;text="').concat(u,'"')),this._status===bh.STATUS_NULL||this._status===bh.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=r):this._status===bh.STATUS_1XX_RECEIVED&&this._request.cancel(r),this._status=bh.STATUS_CANCELED,this._failed("local",null,eh.causes.CANCELED);break;case bh.STATUS_WAITING_FOR_ANSWER:case bh.STATUS_ANSWERED:if(vh.debug("rejecting session"),(a=a||480)<300||700<=a)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,u,s,i),this._failed("local",null,eh.causes.REJECTED);break;case bh.STATUS_WAITING_FOR_ACK:case bh.STATUS_CONFIRMED:if(vh.debug("terminating session"),u=e.reason_phrase||eh.REASON_PHRASE[a]||"",a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&s.push("Reason: SIP ;cause=".concat(a,'; text="').concat(u,'"')),this._status===bh.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==rh.C.STATUS_TERMINATED?(n=this._dialog,this.receiveRequest=function(e){e.method===eh.ACK&&(t.sendRequest(eh.BYE,{extraHeaders:s,body:i}),n.terminate())},this._request.server_transaction.on("stateChanged",function(){t._request.server_transaction.state===rh.C.STATUS_TERMINATED&&(t.sendRequest(eh.BYE,{extraHeaders:s,body:i}),n.terminate())}),this._ended("local",null,o),this._dialog=n,this._ua.newDialog(n)):(this.sendRequest(eh.BYE,{extraHeaders:s,body:i}),this._ended("local",null,o))}}},{key:"sendDTMF",value:function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=(vh.debug("sendDTMF() | tones: %s",e),0),i=o.duration||null,a=o.interToneGap||null,t=o.transportType||eh.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==bh.STATUS_CONFIRMED&&this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_1XX_RECEIVED)throw new th.InvalidStateError(this._status);if(t!==eh.DTMF_TRANSPORT.INFO&&t!==eh.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(t));if(!(e="number"==typeof e?e.toString():e)||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(i&&!nh.isDecimal(i))throw new TypeError("Invalid tone duration: ".concat(i));if(i=i?i<uh.C.MIN_DURATION?(vh.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(uh.C.MIN_DURATION," milliseconds")),uh.C.MIN_DURATION):i>uh.C.MAX_DURATION?(vh.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(uh.C.MAX_DURATION," milliseconds")),uh.C.MAX_DURATION):Math.abs(i):uh.C.DEFAULT_DURATION,o.duration=i,a&&!nh.isDecimal(a))throw new TypeError("Invalid interToneGap: ".concat(a));a=a?a<uh.C.MIN_INTER_TONE_GAP?(vh.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(uh.C.MIN_INTER_TONE_GAP," milliseconds")),uh.C.MIN_INTER_TONE_GAP):Math.abs(a):uh.C.DEFAULT_INTER_TONE_GAP,t!==eh.DTMF_TRANSPORT.RFC2833?this._tones?this._tones+=e:(this._tones=e,function e(){var t,r,n=this;this._status===bh.STATUS_TERMINATED||!this._tones||s>=this._tones.length?this._tones=null:(t=this._tones[s],s+=1,r=","===t?2e3:(r=new uh(this),o.eventHandlers={onFailed:function(){n._tones=null}},r.send(t,o),i+a),setTimeout(e.bind(this),r))}.call(this)):(t=this._getDTMFRTPSender())&&(e=t.toneBuffer+e,t.insertDTMF(e,i,a))}},{key:"sendInfo",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(vh.debug("sendInfo()"),this._status!==bh.STATUS_CONFIRMED&&this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_1XX_RECEIVED)throw new th.InvalidStateError(this._status);new lh(this).send(e,t,r)}},{key:"mute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1},t=(vh.debug("mute()"),!1),r=!1;!1===this._audioMuted&&e.audio&&(this._audioMuted=t=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(this._videoMuted=r=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==r||this._onmute({audio:t,video:r})}},{key:"unmute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0},t=(vh.debug("unmute()"),!1),r=!1;!0===this._audioMuted&&e.audio&&(this._audioMuted=!(t=!0))===this._localHold&&this._toggleMuteAudio(!1),!0===this._videoMuted&&e.video&&(this._videoMuted=!(r=!0))===this._localHold&&this._toggleMuteVideo(!1),!0!==t&&!0!==r||this._onunmute({audio:t,video:r})}},{key:"switchMicrophones",value:function(e){if(vh.debug("switchMicrophones(%s)",e),!this._is_confirmed||!this._trtcLocalStream)throw new th.InvalidStateError(this._status);if(this._trtcLocalStream)return this._trtcLocalStream.switchDevice("audio",e);throw new th.NotSupportedError("WebRTC mode not support switchMicrophones")}},{key:"switchSpeaker",value:function(t){var r=this;if(vh.debug("switchSpeaker(%s)",t,this._trtcRemoteStream),!this._is_confirmed)throw new th.InvalidStateError(this._status);if(this._trtcLocalStream){var e,n=[];for(e in this._trtcRemoteStream)(e=>{Object.prototype.hasOwnProperty.call(r._trtcRemoteStream,e)&&(vh.error("stream",e),n.push(function(){return r._trtcRemoteStream[e].setAudioOutput(t)}))})(e);return Promise.all(n)}throw new th.NotSupportedError("WebRTC mode not support switchSpeaker")}},{key:"setAudioVolume",value:function(e){if(vh.debug("setAudioVolume(%d)",e),!this._is_confirmed)throw new th.InvalidStateError(this._status);if(this._trtcLocalStream)for(var t in this._trtcLocalStream.setAudioVolume(e),this._trtcRemoteStream)Object.prototype.hasOwnProperty.call(this._trtcRemoteStream,t)&&this._trtcRemoteStream[t].setAudioVolume(e);throw new th.NotSupportedError("WebRTC mode not support setAudioVolume")}},{key:"enableAudioVolumeEvaluation",value:function(e,t){if(vh.debug("enableAudioVolumeEvaluation(%d)",e),this._localTRTCClient)return this._localTRTCClient.enableAudioVolumeEvaluation(e,t);throw new th.InvalidStateError(this._status)}},{key:"hold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(vh.debug("hold()"),this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:eh.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(vh.debug("unhold()"),this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:eh.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e,t=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(vh.debug("renegotiate()"),r.rtcOfferConstraints||null);return!(this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_CONFIRMED||!this._isReadyToReOffer()||(e={succeeded:function(){n&&n()},failed:function(){t.terminate({cause:eh.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}},this._setLocalMediaStatus(),r.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}):this._sendReinvite({eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}),0))}},{key:"refer",value:function(e,t){var r,n,o=this,s=(vh.debug("refer()"),e);if(this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_CONFIRMED)return!1;if(e=this._ua.normalizeTarget(e))return(r=new ph(this)).sendRefer(e,t),n=r.id,(this._referSubscribers[n]=r).on("requestFailed",function(){delete o._referSubscribers[n]}),r.on("accepted",function(){delete o._referSubscribers[n]}),r.on("failed",function(){delete o._referSubscribers[n]}),r;throw new TypeError("Invalid target: ".concat(s))}},{key:"sendRequest",value:function(e,t){return vh.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(vh.debug("receiveRequest()"),e.method===eh.CANCEL)this._status!==bh.STATUS_WAITING_FOR_ANSWER&&this._status!==bh.STATUS_ANSWERED||(this._status=bh.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,eh.causes.CANCELED));else switch(e.method){case eh.ACK:if(this._status===bh.STATUS_WAITING_FOR_ACK)if(this._status=bh.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:eh.causes.MISSING_SDP,status_code:400});break}var r={originator:"remote",type:"answer",sdp:e.body},n=(vh.debug('emit "sdp"'),this.emit("sdp",r),new RTCSessionDescription({type:"answer",sdp:r.sdp}));this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(n)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:eh.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case eh.BYE:this._status===bh.STATUS_CONFIRMED||this._status===bh.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,eh.causes.BYE)):this._status===bh.STATUS_INVITE_RECEIVED||this._status===bh.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,eh.causes.BYE)):e.reply(403,"Wrong Status");break;case eh.INVITE:this._status===bh.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case eh.INFO:this._status===bh.STATUS_1XX_RECEIVED||this._status===bh.STATUS_WAITING_FOR_ANSWER||this._status===bh.STATUS_ANSWERED||this._status===bh.STATUS_WAITING_FOR_ACK||this._status===bh.STATUS_CONFIRMED?(r=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0)&&r.match(/^application\/dtmf-relay/i)?new uh(this).init_incoming(e):void 0!==r?new lh(this).init_incoming(e):e.reply(415):e.reply(403,"Wrong Status");break;case eh.UPDATE:this._status===bh.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case eh.REFER:this._status===bh.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case eh.NOTIFY:this._status===bh.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){vh.warn("onTransportError()"),this._status!==bh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:eh.causes.CONNECTION_ERROR,cause:eh.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){vh.warn("onRequestTimeout()"),this._status!==bh.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:eh.causes.REQUEST_TIMEOUT,cause:eh.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){vh.warn("onDialogError()"),this._status!==bh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:eh.causes.DIALOG_ERROR,cause:eh.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){vh.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){vh.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||(vh.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(vh.debug("_isReadyToReOffer() | session not established yet"),!1):(vh.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){var e=this;if(vh.debug("close()"),this._localStream&&this._localStream.close(),this._trtcLocalStream&&this._trtcLocalStreamLocallyGenerated&&(vh.debug("close() | closing trtcLocalStream"),Promise.resolve().then(function(){if(e._localTRTCClient)return e._localTRTCClient.unpublish(e._trtcLocalStream)}).then(function(){return!e._localTRTCClient||e._localTRTCClient.leave()}).then(function(){e._trtcLocalStream.close()}).catch(function(e){vh.warn("TRTC leave room failed [error:%o]",e)}).then(function(){vh.debug("TRTC destroy"),e._localTRTCClient&&e._localTRTCClient.destroy()})),this._status!==bh.STATUS_TERMINATED){if(this._status=bh.STATUS_TERMINATED,this._connection){for(var t in this._remoteStream)this.emit("removestream",t);try{this._connection.close()}catch(e){vh.warn("close() | error closing the RTCPeerConnection: %o",e)}}for(var r in this._timers)Object.prototype.hasOwnProperty.call(this._timers,r)&&clearTimeout(this._timers[r]);for(var n in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,n)&&(this._earlyDialogs[n].terminate(),delete this._earlyDialogs[n]);for(var o in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,o)&&delete this._referSubscribers[o];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(t,r){var n=oh.T1;this._timers.invite2xxTimer=setTimeout(function e(){this._status===bh.STATUS_WAITING_FOR_ACK&&(t.reply(200,null,["Contact: ".concat(this._contact)],r),n<oh.T2&&(n*=2)>oh.T2&&(n=oh.T2),this._timers.invite2xxTimer=setTimeout(e.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===bh.STATUS_WAITING_FOR_ACK&&(vh.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(eh.BYE),e._ended("remote",null,eh.causes.NO_ACK))},oh.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var r=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===r._connection.iceConnectionState&&r.terminate({cause:eh.causes.RTP_TIMEOUT,status_code:408,reason_phrase:eh.causes.RTP_TIMEOUT})}),this._connection.addEventListener("track",function(e){var t,e=e.streams[0];r._remoteStream[e.id]||(t=new fh({mediaStream:e}),r._remoteStream[e.id]=t,vh.debug('emit "addstream" '.concat(e.id)),r.emit("addstream",{stream:t}))}),vh.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(i,t){var a=this;if(vh.debug("createLocalDescription(%s, %o)",i,t),"offer"!==i&&"answer"!==i)throw new Error('createLocalDescription() | invalid type "'.concat(i,'"'));var u=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===i?u.createOffer(t).catch(function(e){return vh.warn('emit "peerconnection:createofferfailed" [error:%o]',e),a.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):u.createAnswer(t).catch(function(e){return vh.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),a.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return u.setLocalDescription(e).catch(function(e){return a._rtcReady=!0,vh.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),a.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){var e=t&&t.iceRestart;return"complete"===u.iceGatheringState&&!e||"gathering"===u.iceGatheringState&&a._iceReady?(a._rtcReady=!0,e={originator:"local",type:i,sdp:u.localDescription.sdp},vh.debug('emit "sdp"'),a.emit("sdp",e),Promise.resolve(e.sdp)):new Promise(function(t){function r(){u.removeEventListener("icecandidate",n),u.removeEventListener("icegatheringstatechange",o),s=!0,a._rtcReady=!0,a._iceReady=!0;var e={originator:"local",type:i,sdp:u.localDescription.sdp};vh.debug('emit "sdp"'),a.emit("sdp",e),t(e.sdp)}var n,o,s=!1;a._iceReady=!1;u.addEventListener("icecandidate",n=function(e){e=e.candidate;e?a.emit("icecandidate",{candidate:e,ready:r}):s||r()}),u.addEventListener("icegatheringstatechange",o=function(){"complete"!==u.iceGatheringState||s||r()})})})}},{key:"_createDialog",value:function(e,t,r){var n="UAS"===t?e.to_tag:e.from_tag,o="UAS"===t?e.from_tag:e.to_tag,n=e.call_id+n+o,o=this._earlyDialogs[n];return r?!!o||((o=new sh(this,e,t,sh.C.STATUS_EARLY)).error?(vh.debug(o.error),this._failed("remote",e,eh.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[n]=o,!0)):(this._from_tag=e.from_tag,this._to_tag=e.to_tag,o?(o.update(e,t),this._dialog=o,delete this._earlyDialogs[n],!0):(r=new sh(this,e,t)).error?(vh.debug(r.error),this._failed("remote",e,eh.causes.INTERNAL_ERROR),!1):(this._dialog=r,!0))}},{key:"_receiveReinvite",value:function(n){var t=this,e=(vh.debug("receiveReinvite()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),o={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s=!0,e.status_code||403),r=e.reason_phrase||"",e=nh.cloneArray(e.extraHeaders);if(this._status!==bh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},s=!1;function r(e){var t=this,r=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,r),this._late_sdp&&(e=this._mangleOffer(e)),n.reply(200,null,r,e,function(){t._status=bh.STATUS_WAITING_FOR_ACK,t._setInvite2xxTimer(n,e),t._setACKTimer()}),"function"==typeof o.callback&&o.callback()}this.emit("reinvite",o),s||(this._late_sdp=!1,n.body?"application/sdp"!==e?(vh.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==bh.STATUS_TERMINATED&&r.call(t,e)}).catch(function(e){vh.warn(e)}):(this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){r.call(t,e)}).catch(function(){n.reply(500)})))}},{key:"_receiveUpdate",value:function(n){var t=this,e=(vh.debug("receiveUpdate()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),r={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(o=!0,e.status_code||403),r=e.reason_phrase||"",e=nh.cloneArray(e.extraHeaders);if(this._status!==bh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},o=!1;function s(e){var t=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,t),n.reply(200,null,t,e),"function"==typeof r.callback&&r.callback()}this.emit("update",r),o||(n.body?"application/sdp"!==e?(vh.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==bh.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){vh.warn(e)}):s.call(this,null))}},{key:"_processInDialogSdpOffer",value:function(t){var r=this;vh.debug("_processInDialogSdpOffer()");var e,n=t.parseSDP(),o=!1,s=p(n.media);try{for(s.s();!(e=s.n()).done;){var i=e.value;if(-1!==Sh.indexOf(i.type)){var a=i.direction||n.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){o=!1;break}o=!0}}}catch(t){s.e(t)}finally{s.f()}var u={originator:"remote",type:"offer",sdp:t.body},l=(vh.debug('emit "sdp"'),this.emit("sdp",u),new RTCSessionDescription({type:"offer",sdp:u.sdp}));return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(r._status===bh.STATUS_TERMINATED)throw new Error("terminated");return r._connection.setRemoteDescription(l).catch(function(e){throw t.reply(488),vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),r.emit("peerconnection:setremotedescriptionfailed",e),e})}).then(function(){if(r._status===bh.STATUS_TERMINATED)throw new Error("terminated");!0===r._remoteHold&&!1===o?(r._remoteHold=!1,r._onunhold("remote")):!1===r._remoteHold&&!0===o&&(r._remoteHold=!0,r._onhold("remote"))}).then(function(){if(r._status===bh.STATUS_TERMINATED)throw new Error("terminated");return r._createLocalDescription("answer",r._rtcAnswerConstraints).catch(function(e){throw t.reply(500),vh.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',e),e})}).catch(function(e){vh.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(o){var s,r=this;vh.debug("receiveRefer()"),o.refer_to?o.refer_to.uri.scheme!==eh.SIP?(vh.debug("Refer-To header field points to a non-SIP URI scheme"),o.reply(416)):(o.reply(202),s=new ch(this,o.cseq),vh.debug('emit "refer"'),this.emit("refer",{request:o,accept:function(e,t){!function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(e="function"==typeof e?e:null,this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_CONFIRMED)return!1;var r,n=new i(this._ua);n.on("progress",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("accepted",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("_failed",function(e){var t=e.message,e=e.cause;t?s.notify(t.status_code,t.reason_phrase):s.notify(487,e)}),o.refer_to.uri.hasHeader("replaces")&&(r=decodeURIComponent(o.refer_to.uri.getHeader("replaces")),t.extraHeaders=nh.cloneArray(t.extraHeaders),t.extraHeaders.push("Replaces: ".concat(r))),n.connect(o.refer_to.uri.toAor(),t,e)}.call(r,e,t)},reject:function(){!function(){s.notify(603)}.call(r)}})):(vh.debug("no Refer-To header field present in REFER"),o.reply(400))}},{key:"_receiveNotify",value:function(e){if(vh.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t;if(e.event.params&&e.event.params.id)t=e.event.params.id,t=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");t=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}t?(t.receiveNotify(e),e.reply(200)):e.reply(481,"Subscription does not exist")}else e.reply(489)}},{key:"_receiveReplaces",value:function(n){var t=this;vh.debug("receiveReplaces()"),this.emit("replaces",{request:n,accept:function(e){!function(e){var t=this;if(this._status!==bh.STATUS_WAITING_FOR_ACK&&this._status!==bh.STATUS_CONFIRMED)return!1;var r=new i(this._ua);r.on("confirmed",function(){t.terminate()}),r.init_incoming(n,e)}.call(t,e)},reject:function(){!function(){vh.debug("Replaced INVITE rejected by the user"),n.reply(486)}.call(t)}})}},{key:"_sendInitialRequest",value:function(e,r,t){var n=this,o=new ah(this._ua,this._request,{onRequestTimeout:function(){n.onRequestTimeout()},onTransportError:function(){n.onTransportError()},onAuthenticated:function(e){n._request=e},onReceiveResponse:function(e){n._receiveInviteResponse(e)}});Promise.resolve().then(function(){return t||(e.audio||e.video?new hh(e).initialize().catch(function(e){if(n._status===bh.STATUS_TERMINATED)throw new Error("terminated");throw n._failed("local",null,eh.causes.USER_DENIED_MEDIA_ACCESS),vh.warn('emit "getusermediafailed" [error:%o]',e),n.emit("getusermediafailed",e),e}):void 0)}).then(function(t){if(n._status===bh.STATUS_TERMINATED)throw new Error("terminated");return(n._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){n._connection.addTrack(e,t.mediaStream)}),n._connecting(n._request),n._createLocalDescription("offer",r).catch(function(e){throw n._failed("local",null,eh.causes.WEBRTC_ERROR),e})}).then(function(e){if(n._is_canceled||n._status===bh.STATUS_TERMINATED)throw new Error("terminated");n._request.body=e,n._status=bh.STATUS_INVITE_SENT,vh.debug('emit "sending" [request:%o]',n._request),n.emit("sending",{request:n._request}),o.send()}).catch(function(e){n._status!==bh.STATUS_TERMINATED&&vh.warn(e)})}},{key:"_sendTRTCInitialRequest",value:function(){var t=this,e=new ah(this._ua,this._request,{onRequestTimeout:function(){t.onRequestTimeout()},onTransportError:function(){t.onTransportError()},onAuthenticated:function(e){t._request=e},onReceiveResponse:function(e){t._receiveInviteResponse(e)}});Promise.resolve().then(function(){if(t._status===bh.STATUS_TERMINATED)throw new Error("terminated");vh.debug("connecting"),t._connecting(t._request),t._status=bh.STATUS_INVITE_SENT,vh.debug('emit "sending" [request:%o]',t._request),t.emit("sending",{request:t._request}),e.send()}).catch(function(e){t._status!==bh.STATUS_TERMINATED&&vh.warn(e)})}},{key:"_inviteToTRTCRoom",value:function(o,e){var s=this;this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return s._joinTRTCRoom(e,function(e){s._acceptAndTerminate(o),s._failed("system",e.toString(),eh.causes.WEBRTC_ERROR)})}).then(function(){s._rtcReady=!0,"incoming"===s._direction&&(s._handleSessionTimersInIncomingResponse(o),s._accepted("remote",o),s.sendRequest(eh.ACK),s._confirmed("local",null))}).catch(function(e){var t,r,n;if(s._status!==bh.STATUS_TERMINATED)throw r=t=eh.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=eh.causes.USER_DENIED_MEDIA_ACCESS,vh.warn('emit "getusermediafailed" [error:%o]',e),s.emit("getusermediafailed",e)),"RtcError"===e.name&&vh.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),s._acceptAndTerminate(o,480,r),s._failed("local",o,t),e}).then(function(){vh.debug("trtc done")})}},{key:"_joinTRTCRoom",value:function(e,r){var n,t,o,s,i,a,u,l,c,p,h=this;if(!this._trtc_already_join)return this._trtc_already_join=!0,n=this.tracer.startSpan("trtc",void 0),t=e.sdkAppId,i=e.userSig,a=e.privateMapKey,l=e.proxy,c={sdkAppId:t,userId:o=e.userId,roomId:s=e.roomId,strRoomId:u=e.strRoomId,direction:this._direction,uri:this._ua.configuration.uri.toString(),proxy:l},vh.debug("TRTC start",c),n.setAttributes(c),p=Jd.createClient({mode:"rtc",sdkAppId:Number(t),userId:o,userSig:i,useStringRoomId:!s}),l&&p.setProxyServer({websocketProxy:"wss://".concat(l)}),this._trtcLocalStream=Jd.createStream(y({userId:o,audio:!this._trtcLocalStreamConfig.screenAudio,video:!1},this._trtcLocalStreamConfig)),this._localTRTCClient=p,this._localUserId=o,this._ua.configuration.trtc_proxy_server&&p.setProxyServer(this._ua.configuration.trtc_proxy_server),this._ua.configuration.trtc_turn_server&&p.setTurnServer(this._ua.configuration.trtc_turn_server),p.on("stream-added",function(e){vh.debug("TRTC stream-added, id:%s",e.stream.getId()),h.emit("stream-added",e),p.subscribe(e.stream,{audio:!0,video:Boolean(h._trtcLocalStream.video)}).catch(function(e){h._status!==bh.STATUS_TERMINATED&&(vh.error("TRTC subscribe stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-subscribed",function(e){var t=e.stream;vh.debug("TRTC stream-subscribed, id:%o",t.getId()),h._trtcRemoteStream[t.getId()]=t,h.emit("addstream",e),h.emit("stream-subscribed",e),0<h.listenerCount("stream-subscribed")?vh.debug("stream-subscribe listener count greater than 0"):t.play(h._getStreamPlayElement(o)).then(function(){vh.debug("TRTC play stream success, id:%o",t.getId())}).catch(function(e){h._status!==bh.STATUS_TERMINATED&&(vh.error("TRTC play stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-removed",function(e){var t=e.stream;delete h._trtcRemoteStream[t.getId()],h.emit("stream-removed",e),h.emit("removestream",e)}),p.on("stream-updated",function(e){var t=e.stream;h._trtcRemoteStream[t.getId()]=t,h.emit("stream-updated",e)}),p.on("error",function(e){var t;h._status!==bh.STATUS_TERMINATED&&(t=e.getCode(),vh.error("TRTC errorCode: %o",t),h._failed("local",e.toString(),eh.causes.WEBRTC_ERROR))}),p.on("audio-volume",function(e){e&&Array.isArray(e.result)&&(e=e.result.map(function(e){return y(y({},e),{},{originator:e.userId===h._localUserId?"local":"remote"})}),h.emit("audiovolume",{result:e}))}),p.on("network-quality",function(e){h.emit("networkquality",e)}),Promise.resolve().then(function(){var t=h.tracer.startSpan("trtc/join",{attributes:c},yh.setSpan(_h.active(),n));return Promise.all([t,h._trtcLocalStream.initialize().then(function(){h._trtcLocalStreamLocallyGenerated=!0}),h._localTRTCClient.join({roomId:s||u,privateMapKey:a}).then(function(){vh.debug("TRTC join success"),t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)})])}).then(function(){var t;if(vh.debug("TRTC join and initialize success"),h._status!==bh.STATUS_TERMINATED)return 0<h.listenerCount("audiovolume")&&h._trtcLocalStream.play(h._getStreamPlayElement(o)),vh.debug("TRTC join success then publish"),t=h.tracer.startSpan("trtc/publish",{attributes:c},yh.setSpan(_h.active(),n)),h._localTRTCClient.publish(h._trtcLocalStream).then(function(){t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)});vh.debug("TRTC join success after terminate");try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()}).catch(function(){h._localTRTCClient.destroy()})}catch(t){vh.debug("trtc initial or join success then close error, message: ".concat(t.message))}}).then(function(){vh.debug("TRTC publish success"),n.end()}).catch(function(e){vh.warn("trtc join failed, status: ".concat(h._status,", error message: ").concat(e.toString()));var t=nh.isFunction(e.getCode)?e.getCode():"0";n.recordException(e),n.setAttributes({errorName:e.name,errorCode:t,errorMessage:e.toString()}),n.end();try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()})}catch(e){vh.debug("trtc join failed then close or destroy error, error: ".concat(e.message))}if(h._status!==bh.STATUS_TERMINATED)throw e});vh.debug("ignore duplicate join trtc room")}},{key:"_pureSignalingRoom",value:function(){}},{key:"_getStreamPlayElement",value:function(e){var e="".concat(e,"-rtc-session-audio"),t=document.getElementById(e);return vh.debug("get audio container",t),t||(vh.debug("create audio container"),(t=document.createElement("div")).setAttribute("id",e),t.setAttribute("style","width:0;height:0;overflow:hidden"),document.body.appendChild(t),vh.debug("create audio container id:%o",e)),t}},{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;vh.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(t){var e,r,n,o,s,i,a,u,l,c,p,h,d,f,m,g,y,_=this;if(vh.debug("receiveInviteResponse()"),this._dialog&&200<=t.status_code&&t.status_code<=299)return this._dialog.id.call_id===t.call_id&&this._dialog.id.local_tag===t.from_tag&&this._dialog.id.remote_tag===t.to_tag?void this.sendRequest(eh.ACK):void 0!==(e=new sh(this,t,"UAC")).error?void vh.debug(e.error):(this.sendRequest(eh.ACK),void this.sendRequest(eh.BYE));if(this._is_canceled)100<=t.status_code&&t.status_code<200?this._request.cancel(this._cancel_reason):200<=t.status_code&&t.status_code<299&&this._acceptAndTerminate(t);else if(this._status===bh.STATUS_INVITE_SENT||this._status===bh.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(t.status_code):this._status=bh.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(t.status_code):t.to_tag?t.hasHeader("contact")&&!this._createDialog(t,"UAC",!0)||(this._status=bh.STATUS_1XX_RECEIVED,!this._is_mini_program&&this._use_trtc?(this._progress("remote",t),i=t.getHeader("X-TRTC-SDKAPPID"),f=t.getHeader("X-TRTC-USERID"),g=parseInt(t.getHeader("X-TRTC-ROOMID"),10),v=t.getHeader("X-TRTC-STRROOMID"),r=t.getHeader("X-TRTC-USERSIG"),n=t.getHeader("X-TRTC-PRIVATEMAPKEY"),o=t.getHeader("X-TCCC-IVR"),s=t.getHeader("X-TRTC-PROXY"),vh.debug("".concat(t.status_code," with trtc params"),{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,isIVRCall:o,proxy:s}),i&&f&&(g||v)&&r?this._inviteToTRTCRoom(t,{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,proxy:s}):this._is_mini_program||o?vh.debug("pure signal mode, no trtc params in 1xx response"):(this._acceptAndTerminate(t,400,eh.causes.MISSING_SDP),this._failed("remote",t,eh.causes.BAD_MEDIA_DESCRIPTION))):t.body?(i={originator:"remote",type:"answer",sdp:t.body},vh.debug('emit "sdp"'),this.emit("sdp",i),a=new RTCSessionDescription({type:"answer",sdp:i.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return _._connection.setRemoteDescription(a)}).then(function(){return _._progress("remote",t)}).catch(function(e){vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})):this._progress("remote",t)):vh.debug("1xx response received without to tag");break;case/^2[0-9]{2}$/.test(t.status_code):(this._status=bh.STATUS_CONFIRMED,t.body||this._use_trtc)?this._createDialog(t,"UAC")&&(this._use_trtc?(this._handleSessionTimersInIncomingResponse(t),this._accepted("remote",t),this.sendRequest(eh.ACK),this._confirmed("local",null),u=t.getHeader("X-TRTC-SDKAPPID"),l=t.getHeader("X-TRTC-USERID"),c=parseInt(t.getHeader("X-TRTC-ROOMID"),10),p=t.getHeader("X-TRTC-STRROOMID"),h=t.getHeader("X-TRTC-USERSIG"),d=t.getHeader("X-TRTC-PRIVATEMAPKEY"),f=t.getHeader("X-TCCC-IVR"),m=t.getHeader("X-TRTC-PROXY"),vh.debug("".concat(t.status_code," with trtc params"),{sdkAppId:u,userId:l,roomId:c,strRoomId:p,userSig:h,privateMapKey:d,isIVRCall:f,proxy:m}),u&&l&&(c||p)&&h?Promise.resolve().then(function(){return _._joinTRTCRoom({sdkAppId:u,userId:l,roomId:c,strRoomId:p,privateMapKey:d,userSig:h,proxy:m},function(e){_.terminate({status_code:480,cause:eh.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),_._failed("system",e.toString(),eh.causes.WEBRTC_ERROR)})}).catch(function(e){var t,r,n;_._status!==bh.STATUS_TERMINATED&&(r=t=eh.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=eh.causes.USER_DENIED_MEDIA_ACCESS,vh.warn('emit "getusermediafailed" [error:%o]',e),_.emit("getusermediafailed",e)),"RtcError"===e.name&&vh.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),_.terminate({status_code:480,cause:t,reason_phrase:r}))}):this._is_mini_program||f?vh.debug("pure signal mode, no trtc params in 200OK"):vh.debug("missing trtc params in 200OK")):(g={originator:"remote",type:"answer",sdp:t.body},vh.debug('emit "sdp"'),this.emit("sdp",g),y=new RTCSessionDescription({type:"answer",sdp:g.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===_._connection.signalingState)return _._connection.createOffer(_._rtcOfferConstraints).then(function(e){return _._connection.setLocalDescription(e)}).catch(function(e){_._acceptAndTerminate(t,500,e.toString()),_._failed("local",t,eh.causes.WEBRTC_ERROR)})}).then(function(){_._connection.setRemoteDescription(y).then(function(){_._handleSessionTimersInIncomingResponse(t),_._accepted("remote",t),_.sendRequest(eh.ACK),_._confirmed("local",null)}).catch(function(e){_._acceptAndTerminate(t,488,"Not Acceptable Here"),_._failed("remote",t,eh.causes.BAD_MEDIA_DESCRIPTION),vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})}))):(this._acceptAndTerminate(t,400,eh.causes.MISSING_SDP),this._failed("remote",t,eh.causes.BAD_MEDIA_DESCRIPTION));break;default:var v=nh.sipErrorCause(t.status_code);this._failed("remote",t,v)}}},{key:"_sendReinvite",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(vh.debug("sendReinvite()"),nh.cloneArray(e.extraHeaders)),o=nh.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=!1;function i(e){o.failed&&o.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 r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};vh.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(eh.INVITE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){(function(e){var t,r,n=this;this._status===bh.STATUS_TERMINATED||(this.sendRequest(eh.ACK),s)||(this._handleSessionTimersInIncomingResponse(e),e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},vh.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){i.call(n),vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):i.call(this))}).call(r,e),s=!0},onErrorResponse:function(e){i.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){i()})}},{key:"_sendUpdate",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(vh.debug("sendUpdate()"),nh.cloneArray(e.extraHeaders)),o=nh.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=e.sdpOffer||!1,i=!1;function a(e){var t,r,n=this;this._status===bh.STATUS_TERMINATED||i||(this._handleSessionTimersInIncomingResponse(e),s?e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},vh.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){u.call(n),vh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):u.call(this):o.succeeded&&o.succeeded(e))}function u(e){o.failed&&o.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")),s?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};vh.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(eh.UPDATE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){a.call(r,e),i=!0},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){u.call(r)})):this.sendRequest(eh.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){a.call(r,e)},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,r){vh.debug("acceptAndTerminate()");var n=[];t&&(r=r||eh.REASON_PHRASE[t]||"",n.push("Reason: SIP ;cause=".concat(t,'; text="').concat(r,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(eh.ACK),this.sendRequest(eh.BYE,{extraHeaders:n})),this._status=bh.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=Xd.parse(e),this._localHold&&!this._remoteHold){vh.debug("mangleOffer() | me on hold, mangling offer");var t,r=p(e.media);try{for(r.s();!(t=r.n()).done;){var n=t.value;-1!==Sh.indexOf(n.type)&&(!n.direction||"sendrecv"===n.direction?n.direction="sendonly":"recvonly"===n.direction&&(n.direction="inactive"))}}catch(e){r.e(e)}finally{r.f()}}else if(this._localHold&&this._remoteHold){vh.debug("mangleOffer() | both on hold, mangling offer");var o,s=p(e.media);try{for(s.s();!(o=s.n()).done;){var i=o.value;-1!==Sh.indexOf(i.type)&&(i.direction="inactive")}}catch(e){s.e(e)}finally{s.f()}}else if(this._remoteHold){vh.debug("mangleOffer() | remote on hold, mangling offer");var a,u=p(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==Sh.indexOf(l.type)&&(!l.direction||"sendrecv"===l.direction?l.direction="recvonly":"recvonly"===l.direction&&(l.direction="inactive"))}}catch(e){u.e(e)}finally{u.f()}}return Xd.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(t=e=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=eh.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(e)),this._sessionTimers.refresher="uas"===e,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=eh.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uac"),this._sessionTimers.refresher="uac"===e,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!==bh.STATUS_TERMINATED&&e._isReadyToReOffer()&&(vh.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===eh.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==bh.STATUS_TERMINATED&&(vh.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:eh.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteAudio():this._trtcLocalStream.unmuteAudio();throw new th.InvalidStateError(this._status)}var t,r=p(this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteVideo():this._trtcLocalStream.unmuteVideo();throw new th.InvalidStateError(this._status)}var t,r=p(this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){vh.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){vh.debug("session connecting"),vh.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){vh.debug("session progress"),vh.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){vh.debug("session accepted"),this._start_time=new Date,vh.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){vh.debug("session confirmed"),this._is_confirmed=!0,vh.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,r){vh.debug("session ended"),this._end_time=new Date,this._close(),vh.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:r})}},{key:"_failed",value:function(e,t,r){vh.debug("session failed"),vh.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:r}),this._close(),vh.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:r})}},{key:"_onhold",value:function(e){vh.debug("session onhold"),this._setLocalMediaStatus(),vh.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){vh.debug("session onunhold"),this._setLocalMediaStatus(),vh.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,e=e.video;vh.debug("session onmute"),this._setLocalMediaStatus(),vh.debug('emit "muted"'),this.emit("muted",{audio:t,video:e})}},{key:"_onunmute",value:function(e){var t=e.audio,e=e.video;vh.debug("session onunmute"),this._setLocalMediaStatus(),vh.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:e})}}],[{key:"C",get:function(){return bh}}])})(),wh=W.EventEmitter,Eh=Yl,Ah=i,Oh=_c,xh=B(),Ch=Yc,Rh=L,Nh=V(),Ih=new Eh("Message"),Ph=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return f(r,wh),c(r,[{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:"send",value:function(e,t){var r=this,n=2<arguments.length&&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 s,o=xh.cloneArray(n.extraHeaders),i=xh.cloneObject(n.eventHandlers),a=n.contentType||"text/plain",u={};for(s in n.fromUserName&&(u.from_uri=new Nh("sip",n.fromUserName,this._ua.configuration.uri.host),o.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),n.fromDisplayName&&(u.from_display_name=n.fromDisplayName),i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(a)),this._request=new Oh.OutgoingRequest(Ah.MESSAGE,e,this._ua,u,o),t&&(this._request.body=t);n=new Ch(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newMessage("local",this._request),n.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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=xh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Rh.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,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=xh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Rh.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{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=xh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Ah.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Ah.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,r){Ih.debug("MESSAGE failed"),this._close(),Ih.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Ih.debug("MESSAGE succeeded"),this._close(),Ih.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),Uh=W.EventEmitter,kh=Yl,Lh=i,jh=_c,Dh=B(),Mh=Yc,Vh=L,Bh=new kh("Options"),Fh=(()=>{function r(e){var t;return u(this,r),(t=a(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return f(r,Uh),c(r,[{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:"send",value:function(e,t){var r=this,n=2<arguments.length&&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 s,o=Dh.cloneArray(n.extraHeaders),i=Dh.cloneObject(n.eventHandlers),n=n.contentType||"application/sdp";for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(n)),this._request=new jh.OutgoingRequest(Lh.OPTIONS,e,this._ua,null,o),t&&(this._request.body=t);n=new Mh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newOptions("local",this._request),n.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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=Dh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Vh.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,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=Dh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Vh.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{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=Dh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Lh.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Lh.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,r){Bh.debug("OPTIONS failed"),this._close(),Bh.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Bh.debug("OPTIONS succeeded"),this._close(),Bh.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),qh={},Hh=Yl,Gh=B(),zh=M(),Kh=new Hh("Socket"),Yh=(qh.isSocket=function(t){if(Array.isArray(t))return!1;if(void 0===t)return Kh.warn("undefined JsSIP.Socket instance"),!1;try{if(!Gh.isString(t.url))throw Kh.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!Gh.isString(t.via_transport))throw Kh.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===zh.parse(t.sip_uri,"SIP_URI"))throw Kh.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(e){if(!Gh.isFunction(t[e]))throw Kh.warn("missing or invalid JsSIP.Socket method: ".concat(e)),new Error("Missing or invalid JsSIP.Socket method: ".concat(e))})}catch(t){return!1}return!0},qh),Wh=i,$h=new Yl("Transport"),Jh={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:Wh.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:Wh.CONNECTION_RECOVERY_MAX_INTERVAL}},Xh=c(function e(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Jh.recovery_options;u(this,e),$h.debug("new()"),this.status=Jh.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=r,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(e){$h.warn("cannot use TextDecoder: ".concat(e))}if(void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");(t=t instanceof Array?t:[t]).forEach(function(e){if(!Yh.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:Jh.SOCKET_STATUS_READY})},this),this._getSocket()},[{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}},{key:"connect",value:function(){$h.debug("connect()"),this.isConnected()?$h.debug("Transport is already connected"):this.isConnecting()?$h.debug("Transport is connecting"):(this.close_requested=!1,this.status=Jh.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(){$h.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=Jh.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){return $h.debug("send()"),this.isConnected()?(e=e.toString(),$h.debug("sending message:\n\n".concat(e,"\n")),this.socket.send(e)):($h.warn("unable to send message, transport is not connected"),!1)}},{key:"isConnected",value:function(){return this.status===Jh.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===Jh.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this,t=(this.recover_attempts+=1,Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1));t<this.recovery_options.min_interval?t=this.recovery_options.min_interval:t>this.recovery_options.max_interval&&(t=this.recovery_options.max_interval),$h.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,t=[];this.sockets.forEach(function(e){e.status!==Jh.SOCKET_STATUS_ERROR&&(0===t.length?t.push(e):e.weight>t[0].weight?t=[e]:e.weight===t[0].weight&&t.push(e))}),0===t.length?(this.sockets.forEach(function(e){e.status=Jh.SOCKET_STATUS_READY}),this._getSocket()):(e=Math.floor(Math.random()*t.length),this.socket=t[e].socket)}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=Jh.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,r){this.status=Jh.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:r}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=Jh.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(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(e){return void $h.debug("received binary message failed to be converted into string, message discarded")}$h.debug("received binary message:\n\n".concat(e,"\n"))}else $h.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else $h.debug("received message with CRLF Keep Alive response")}}]),Qh={},Zh=Yl,ef=M(),tf=_c,rf=new Zh("Parser");function nf(e,t){var r,n=t,o=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===o;){if(-1===(r=e.indexOf("\r\n",n)))return r;!e.substring(r+2,r+4).match(/(^\r\n)/)&&e.charAt(r+2).match(/(^\s+)/)?n=r+2:o=r}return o}function of(e,t,r,n){var o,s=t.indexOf(":",r),i=t.substring(r,s).trim(),a=t.substring(s+1,n).trim();switch(i.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(o=e.parseHeader("Via"))&&(e.via=o,e.via_branch=o.branch):o=0;break;case"from":case"f":e.setHeader("from",a),(o=e.parseHeader("from"))&&(e.from=o,e.from_tag=o.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),(o=e.parseHeader("to"))&&(e.to=o,e.to_tag=o.getParam("tag"));break;case"record-route":if(-1===(o=ef.parse(a,"Record_Route")))o=void 0;else{var u,l=p(o);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.addHeader("record-route",a.substring(c.possition,c.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=c.parsed}}catch(e){l.e(e)}finally{l.f()}}break;case"call-id":case"i":e.setHeader("call-id",a),(o=e.parseHeader("call-id"))&&(e.call_id=a);break;case"contact":case"m":if(-1===(o=ef.parse(a,"Contact")))o=void 0;else{var h,d=p(o);try{for(d.s();!(h=d.n()).done;){var f=h.value;e.addHeader("contact",a.substring(f.possition,f.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=f.parsed}}catch(e){d.e(e)}finally{d.f()}}break;case"content-length":case"l":e.setHeader("content-length",a),o=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),o=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),(o=e.parseHeader("cseq"))&&(e.cseq=o.value),e instanceof tf.IncomingResponse&&(e.method=o.method);break;case"max-forwards":e.setHeader("max-forwards",a),o=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),o=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),o=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",a),(o=e.parseHeader("session-expires"))&&(e.session_expires=o.expires,e.session_expires_refresher=o.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",a),(o=e.parseHeader("refer-to"))&&(e.refer_to=o);break;case"replaces":e.setHeader("replaces",a),(o=e.parseHeader("replaces"))&&(e.replaces=o);break;case"event":case"o":e.setHeader("event",a),(o=e.parseHeader("event"))&&(e.event=o);break;default:e.addHeader(i,a),o=0}return void 0!==o||{error:'error parsing header "'.concat(i,'"')}}Qh.parseMessage=function(e,t){var r,n,o=e.indexOf("\r\n");if(-1!==o){var s=e.substring(0,o),i=ef.parse(s,"Request_Response");if(-1!==i){i.status_code?((r=new tf.IncomingResponse).status_code=i.status_code,r.reason_phrase=i.reason_phrase):((r=new tf.IncomingRequest(t)).method=i.method,r.ruri=i.uri),r.data=e;for(var a=o+2;;){if(-2===(o=nf(e,a))){n=a+2;break}if(-1===o)return void rf.warn("parseMessage() | malformed message");if(!0!==(i=of(r,e,a,o)))return void rf.warn("parseMessage() |",i.error);a=o+2}return r.hasHeader("content-length")?(t=r.getHeader("content-length"),r.body=e.substr(n,t)):r.body=e.substring(n),r}rf.warn('parseMessage() | error parsing first line of SIP message: "'.concat(s,'"'))}else rf.warn("parseMessage() | no CRLF found, not a SIP message")};var sf,af,uf,lf=Yl,cf=i,pf=_c,df=B(),hf=new lf("sanityCheck"),ff=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var r=t[e];if(!sf.hasHeader(r))return hf.debug("missing mandatory header field : ".concat(r,", dropping the response")),!1}}],mf=[function(){if("sip"!==sf.s("to").uri.scheme)return yf(416),!1},function(){if(!sf.to_tag&&sf.call_id.substr(0,5)===af.configuration.jssip_id)return yf(482),!1},function(){if(df.str_utf8_length(sf.body)<sf.getHeader("content-length"))return yf(400),!1},function(){var e,t=sf.from_tag,r=sf.call_id,n=sf.cseq;if(!sf.to_tag)if(sf.method===cf.INVITE){if(af._transactions.ist[sf.via_branch])return!1;for(var o in af._transactions.ist)if(Object.prototype.hasOwnProperty.call(af._transactions.ist,o)&&(e=af._transactions.ist[o]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return yf(482),!1}else{if(af._transactions.nist[sf.via_branch])return!1;for(var s in af._transactions.nist)if(Object.prototype.hasOwnProperty.call(af._transactions.nist,s)&&(e=af._transactions.nist[s]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return yf(482),!1}}],gf=[function(){if(1<sf.getHeaders("via").length)return hf.debug("more than one Via header field present in the response, dropping the response"),!1},function(){if(df.str_utf8_length(sf.body)<sf.getHeader("content-length"))return hf.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function yf(e){var t,r=sf.getHeaders("via"),n="SIP/2.0 ".concat(e," ").concat(cf.REASON_PHRASE[e],"\r\n"),o=p(r);try{for(o.s();!(t=o.n()).done;)n+="Via: ".concat(t.value,"\r\n")}catch(e){o.e(e)}finally{o.f()}r=sf.getHeader("To"),sf.to_tag||(r+=";tag=".concat(df.newTag())),n=(n=(n=(n+="To: ".concat(r,"\r\n"))+"From: ".concat(sf.getHeader("From"),"\r\n"))+"Call-ID: ".concat(sf.call_id,"\r\n"))+"CSeq: ".concat(sf.cseq," ").concat(sf.method,"\r\n"),uf.send(n+="\r\n")}var _f={},vf=B(),bf=i,Sf=M(),Tf=V(),wf=qh,Ef=L,Af=Yl,Of=(_f.settings={authorization_user:null,password:null,realm:null,ha1:null,authorization_jwt:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,session_timers_refresh_method:bf.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:bf.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:bf.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(vf.createRandomToken(12),".invalid"),log_level:bf.LOG_LEVEL.TRACE,log_report:!0,log_proxy:null,use_trtc:!0,trtc_proxy_server:null,trtc_turn_server:null},{mandatory:{sockets:function(e){var t=[];if(wf.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var r,n=p(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;Object.prototype.hasOwnProperty.call(o,"socket")&&wf.isSocket(o.socket)?t.push(o):wf.isSocket(o)&&t.push({socket:o})}}catch(e){n.e(e)}finally{n.f()}}return t},uri:function(e){/^sip:/i.test(e)||(e="".concat(bf.SIP,":").concat(e));e=Tf.parse(e);return e&&e.user?e:void 0}},optional:{authorization_user:function(e){return-1===Sf.parse('"'.concat(e,'"'),"quoted_string")?void 0:e},authorization_jwt:function(e){if("string"==typeof e)return e},user_agent:function(e){if("string"==typeof e)return e},connection_recovery_max_interval:function(e){if(vf.isDecimal(e)){e=Number(e);if(0<e)return e}},connection_recovery_min_interval:function(e){if(vf.isDecimal(e)){e=Number(e);if(0<e)return e}},contact_uri:function(e){if("string"==typeof e){e=Sf.parse(e,"SIP_URI");if(-1!==e)return e}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===Sf.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(vf.isDecimal(e)){e=Number(e);if(0<e)return e}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===bf.INVITE||e===bf.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(vf.isDecimal(e)){e=Number(e);if(0<e)return e}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(bf.SIP,":").concat(e));e=Tf.parse(e);return!e||e.user?void 0:e},use_preloaded_route:function(e){if("boolean"==typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var r,n=p(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;"string"==typeof o&&t.push(o)}}catch(e){n.e(e)}finally{n.f()}return t}},log_level:function(e){return vf.isDecimal(e)&&-1!==Object.values(bf.LOG_LEVEL).indexOf(Number(e))?(Af.setLogLevel(Number(e)),e):(Af.setLogLevel(bf.LOG_LEVEL.TRACE),bf.LOG_LEVEL.TRACE)},log_report:function(e){return"boolean"==typeof e?(Af.setLogReport(e),e):(Af.setLogReport(!0),!0)},log_proxy:function(e){return Af.setLogProxy(e),e},use_trtc:function(e){if("boolean"==typeof e)return e},trtc_proxy_server:function(e){return e},trtc_turn_server:function(e){return e}}}),xf=(_f.load=function(e,t){for(var r in Of.mandatory){if(!t.hasOwnProperty(r))throw new Ef.ConfigurationError(r);var n=t[r],o=Of.mandatory[r](n);if(void 0===o)throw new Ef.ConfigurationError(r,n);e[r]=o}for(var s in Of.optional)if(t.hasOwnProperty(s)){var i=t[s];if(vf.isEmpty(i))continue;var a=Of.optional[s](i);if(void 0===a)throw new Ef.ConfigurationError(s,i);e[s]=a}},W.EventEmitter),Cf=Yl,Rf=i,Nf=ep,If=Th,Pf=Ph,Uf=Fh,kf=Fc,Lf=Xh,jf=B(),Df=L,Mf=V(),Vf=Qh,Bf=_c,Ff=function(e,t,r){sf=e,af=t,uf=r;for(var n=0,o=ff;n<o.length;n++)if(!1===(0,o[n])())return!1;if(sf instanceof pf.IncomingRequest){for(var s=0,i=mf;s<i.length;s++)if(!1===(0,i[s])())return!1}else if(sf instanceof pf.IncomingResponse)for(var a=0,u=gf;a<u.length;a++)if(!1===(0,u[a])())return!1;return!0},qf=_f,Hf=n,Gf=new Cf("UA"),zf={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},Kf=(()=>{function r(e){var t;if(u(this,r),Gf.debug("".concat(Hf.version," new() [configuration:%o]"),e),(t=a(this,r))._cache={credentials:{}},t._configuration=Object.assign({},qf.settings),t._dynConfiguration={},t._dialogs={},t._applicants={},t._sessions={},t._transport=null,t._contact=null,t._status=zf.STATUS_INIT,t._error=null,t._transactions={nist:{},nict:{},ist:{},ict:{}},t._data={},t._closeTimer=null,void 0===e)throw new TypeError("Not enough arguments");try{t._loadConfig(e)}catch(e){throw t._status=zf.STATUS_NOT_READY,t._error=zf.CONFIGURATION_ERROR,e}return t._registrator=new Nf(t),t}return f(r,xf),c(r,[{key:"C",get:function(){return zf}},{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}},{key:"start",value:function(){Gf.debug("start()",{}),this._status===zf.STATUS_INIT?this._transport.connect():this._status===zf.STATUS_USER_CLOSED?(Gf.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=zf.STATUS_INIT,this._transport.connect()):this._status===zf.STATUS_READY?Gf.debug("UA is in READY status, not restarted"):Gf.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){Gf.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){Gf.debug("unregister()"),this._dynConfiguration.register=!1,this._registrator.unregister(e)}},{key:"registrator",value:function(){return this._registrator}},{key:"isRegistered",value:function(){return this._registrator.registered}},{key:"isConnected",value:function(){return this._transport.isConnected()}},{key:"call",value:function(e,t){Gf.debug("call()");var r=new If(this);return r.connect(e,t),r}},{key:"sendMessage",value:function(e,t,r){Gf.debug("sendMessage()");var n=new Pf(this);return n.send(e,t,r),n}},{key:"sendOptions",value:function(e,t,r){Gf.debug("sendOptions()");var n=new Uf(this);return n.send(e,t,r),n}},{key:"terminateSessions",value:function(e){for(var t in Gf.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if(Gf.debug("stop()"),this._dynConfiguration={},this._status!==zf.STATUS_USER_CLOSED){this._registrator.close();var t,r,n=Object.keys(this._sessions).length;for(t in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,t)){Gf.debug("closing session ".concat(t));try{this._sessions[t].terminate()}catch(e){}}for(r in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,r))try{this._applicants[r].close()}catch(e){}this._status=zf.STATUS_USER_CLOSED,0===Object.keys(this._transactions.nict).length+Object.keys(this._transactions.nist).length+Object.keys(this._transactions.ict).length+Object.keys(this._transactions.ist).length&&0===n?this._transport.disconnect():this._closeTimer=setTimeout(function(){e._closeTimer=null,e._transport.disconnect()},2e3)}else Gf.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return jf.normalizeTarget(e,this._configuration.hostport_params)}},{key:"get",value:function(e){switch(e){case"authorization_user":return this._configuration.authorization_user;case"realm":return this._configuration.realm;case"ha1":return this._configuration.ha1;case"authorization_jwt":return this._configuration.authorization_jwt;default:return void Gf.warn('get() | cannot get "%s" parameter in runtime',e)}}},{key:"set",value:function(e,t){switch(e){case"authorization_user":this._configuration.authorization_user=String(t);break;case"password":this._configuration.password=String(t);break;case"realm":this._configuration.realm=String(t);break;case"ha1":this._configuration.ha1=String(t),this._configuration.password=null;break;case"authorization_jwt":this._configuration.authorization_jwt=String(t);break;case"display_name":this._configuration.display_name=t;break;case"log_level":jf.isDecimal(t)&&-1!==Object.values(Rf.LOG_LEVEL).indexOf(Number(t))&&Cf.setLogLevel(t);break;case"log_report":Cf.setLogReport(Boolean(t));break;case"log_proxy":Cf.setLogProxy(t);break;case"trtc_proxy_server":case"trtc_turn_server":this._configuration[e]=t;break;default:return Gf.warn('set() | cannot set "%s" parameter in runtime',e),!1}return!0}},{key:"newTransaction",value:function(e){this._transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})}},{key:"destroyTransaction",value:function(e){delete this._transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})}},{key:"newDialog",value:function(e){this._dialogs[e.id]=e}},{key:"destroyDialog",value:function(e){delete this._dialogs[e.id]}},{key:"newMessage",value:function(e,t){this._applicants[e]=e,this.emit("newMessage",t)}},{key:"newOptions",value:function(e,t){this._applicants[e]=e,this.emit("newOptions",t)}},{key:"destroyMessage",value:function(e){delete this._applicants[e]}},{key:"newRTCSession",value:function(e,t){this._sessions[e.id]=e,this.emit("newRTCSession",t)}},{key:"destroyRTCSession",value:function(e){delete this._sessions[e.id]}},{key:"registered",value:function(e){this.emit("registered",e)}},{key:"unregistered",value:function(e){this.emit("unregistered",e)}},{key:"registrationFailed",value:function(e){this.emit("registrationFailed",e)}},{key:"receiveRequest",value:function(e){var t,r,n,o=e.method;if(e.ruri.user!==this._configuration.uri.user&&e.ruri.user!==this._contact.uri.user)Gf.debug("Request-URI does not point to us"),e.method!==Rf.ACK&&e.reply_sl(404);else if(e.ruri.scheme!==Rf.SIPS){if(!kf.checkTransaction(this,e)){if(o===Rf.INVITE?new kf.InviteServerTransaction(this,this._transport,e):o!==Rf.ACK&&o!==Rf.CANCEL&&new kf.NonInviteServerTransaction(this,this._transport,e),o===Rf.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new Uf(this).init_incoming(e)}else if(o===Rf.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new Pf(this).init_incoming(e)}else if(o===Rf.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);if(e.to_tag)(t=this._findDialog(e.call_id,e.from_tag,e.to_tag))?t.receiveRequest(e):o===Rf.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):(Gf.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):o!==Rf.ACK&&e.reply(481);else switch(o){case Rf.INVITE:window.RTCPeerConnection?e.hasHeader("replaces")?(n=e.replaces,(t=this._findDialog(n.call_id,n.from_tag,n.to_tag))?(r=t.owner).isEnded()?e.reply(603):r.receiveRequest(e):e.reply(481)):(r=new If(this)).init_incoming(e):(Gf.warn("INVITE received but WebRTC is not supported"),e.reply(488));break;case Rf.BYE:e.reply(481);break;case Rf.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):Gf.debug("received CANCEL request for a non existent session");break;case Rf.ACK:break;case Rf.NOTIFY:this.emit("sipEvent",{event:e.event,request:e}),e.reply(200);break;default:e.reply(405)}}}else e.reply_sl(416)}},{key:"_findSession",value:function(e){var t=e.call_id,r=this._sessions[t+e.from_tag],t=this._sessions[t+e.to_tag];return r||t||null}},{key:"_findDialog",value:function(e,t,r){var n=this._dialogs[e+t+r];return n||this._dialogs[e+r+t]||null}},{key:"_loadConfig",value:function(e){try{qf.load(this._configuration,e),Cf.setAttributes({uri:this._configuration.uri.toString()})}catch(r){throw Gf.error("config load: %o",e,r),r}0===this._configuration.display_name&&(this._configuration.display_name="0"),this._configuration.instance_id||(this._configuration.instance_id=jf.newUUID()),this._configuration.jssip_id=jf.createRandomToken(5);var t,r=this._configuration.uri.clone();r.user=null,this._configuration.hostport_params=r.toString().replace(/^sip:/i,"");try{this._transport=new Lf(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=Yf.bind(this),this._transport.onconnect=Wf.bind(this),this._transport.ondisconnect=$f.bind(this),this._transport.ondata=Jf.bind(this)}catch(e){throw Gf.warn(e),new Df.ConfigurationError("sockets",this._configuration.sockets)}delete this._configuration.sockets,this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user),this._configuration.registrar_server||((t=this._configuration.uri.clone()).user=null,t.clearParams(),t.clearHeaders(),this._configuration.registrar_server=t),this._configuration.no_answer_timeout*=1e3,this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new Mf("sip",jf.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"});var n,o,s=this._configuration.use_trtc,i=(this._contact={pub_gruu:null,temp_gruu:null,uri:this._configuration.contact_uri,toString:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,e=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!e||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),s&&(r+=";trtc"),r+">"}},["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","log_level","log_report","log_proxy","use_trtc","trtc_proxy_server","trtc_turn_server"]);for(n in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,n)&&(-1!==i.indexOf(n)?Object.defineProperty(this._configuration,n,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,n,{writable:!1,configurable:!1}));for(o in Gf.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(qf.settings,o))switch(o){case"uri":case"registrar_server":Gf.debug("- ".concat(o,": ").concat(this._configuration[o]));break;case"password":case"ha1":case"authorization_jwt":Gf.debug("- ".concat(o,": NOT SHOWN"));break;default:Gf.debug("- ".concat(o,": ").concat(JSON.stringify(this._configuration[o])))}}}],[{key:"C",get:function(){return zf}}])})();function Yf(e){this.emit("connecting",e)}function Wf(e){this._status!==zf.STATUS_USER_CLOSED&&(this._status=zf.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register)&&this._registrator.register()}function $f(e){for(var t=0,r=["nict","ict","nist","ist"];t<r.length;t++){var n,o=r[t];for(n in this._transactions[o])Object.prototype.hasOwnProperty.call(this._transactions[o],n)&&this._transactions[o][n].onTransportError()}this.emit("disconnected",e),this._registrator.onTransportClosed(),this._status!==zf.STATUS_USER_CLOSED&&(this._status=zf.STATUS_NOT_READY,this._error=zf.NETWORK_ERROR)}function Jf(e){var t,r=e.transport,n=e.message;if((n=Vf.parseMessage(n,this))&&!(this._status===zf.STATUS_USER_CLOSED&&n instanceof Bf.IncomingRequest)&&Ff(n,this,r))if(n instanceof Bf.IncomingRequest)n.transport=r,this.receiveRequest(n);else if(n instanceof Bf.IncomingResponse)switch(n.method){case Rf.INVITE:(t=this._transactions.ict[n.via_branch])&&t.receiveResponse(n);break;case Rf.ACK:break;default:(t=this._transactions.nict[n.via_branch])&&t.receiveResponse(n)}}var Xf=Yl,Qf=M(),Zf=new Xf("WebSocketInterface"),em=c(function e(t){u(this,e),Zf.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var r=Qf.parse(t,"absoluteURI");if(-1===r)throw Zf.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==r.scheme&&"ws"!==r.scheme)throw Zf.warn("invalid WebSocket URI scheme: ".concat(r.scheme)),new TypeError("Invalid argument: ".concat(t));this._sip_uri="sip:".concat(r.host).concat(r.port?":".concat(r.port):"",";transport=ws"),this._via_transport=r.scheme.toUpperCase()},[{key:"via_transport",get:function(){return this._via_transport},set:function(e){this._via_transport=e.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}},{key:"connect",value:function(){if(Zf.debug("connect()"),this.isConnected())Zf.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())Zf.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),Zf.debug("connecting to WebSocket ".concat(this._url));try{this._ws=new WebSocket(this._url,"sip"),this._ws.binaryType="arraybuffer",this._ws.onopen=this._onOpen.bind(this),this._ws.onclose=this._onClose.bind(this),this._ws.onmessage=this._onMessage.bind(this),this._ws.onerror=this._onError.bind(this)}catch(e){this._onError(e)}}}},{key:"disconnect",value:function(){Zf.debug("disconnect()"),this._ws&&(this._ws.onopen=function(){},this._ws.onclose=function(){},this._ws.onmessage=function(){},this._ws.onerror=function(){},this._ws.close(),this._ws=null)}},{key:"send",value:function(e){return Zf.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(Zf.warn("unable to send message, WebSocket is not open"),!1)}},{key:"isConnected",value:function(){return this._ws&&this._ws.readyState===this._ws.OPEN}},{key:"isConnecting",value:function(){return this._ws&&this._ws.readyState===this._ws.CONNECTING}},{key:"_onOpen",value:function(){Zf.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,r=e.code,e=e.reason;Zf.debug("WebSocket ".concat(this._url," closed")),!1===t&&Zf.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,r,e)}},{key:"_onMessage",value:function(e){e=e.data;Zf.debug("received WebSocket message"),this.ondata(e)}},{key:"_onError",value:function(e){Zf.warn("WebSocket ".concat(this._url," error: "),e)}}]),tm=Yl;M(),new tm("WxWebsocketInterface");var rm,nm,om={exports:{}};function im(){if(nm)return rm;nm=1;var o=1e3,s=60*o,i=60*s,a=24*i,u=7*a,l=365.25*a;function c(e,t,r,n){t=1.5*r<=t;return Math.round(e/r)+" "+n+(t?"s":"")}return rm=function(e,t){t=t||{};var r=typeof e;if(!("string"==r&&0<e.length)){if("number"==r&&isFinite(e))return t.long?(r=e,t=Math.abs(r),a<=t?c(r,t,a,"day"):i<=t?c(r,t,i,"hour"):s<=t?c(r,t,s,"minute"):o<=t?c(r,t,o,"second"):r+" ms"):(t=e,r=Math.abs(t),a<=r?Math.round(t/a)+"d":i<=r?Math.round(t/i)+"h":s<=r?Math.round(t/s)+"m":o<=r?Math.round(t/o)+"s":t+"ms");throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}r=e;if(!(100<(r=String(r)).length)){r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(r){var n=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"weeks":case"week":case"w":return n*u;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}}var sm=function(t){function a(e){let r,t,n,o=null;function i(...s){if(i.enabled){let n=i,e=Number(new Date),t=e-(r||e),o=(n.diff=t,n.prev=r,n.curr=e,r=e,s[0]=a.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O"),0);s[0]=s[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;r=a.formatters[r];if("function"==typeof r){let e=s[o];t=r.call(n,e),s.splice(o,1),o--}return t}),a.formatArgs.call(n,s),(n.log||a.log).apply(n,s)}}return i.namespace=e,i.useColors=a.useColors(),i.color=a.selectColor(e),i.extend=s,i.destroy=a.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(t!==a.namespaces&&(t=a.namespaces,n=a.enabled(e)),n),set:e=>{o=e}}),"function"==typeof a.init&&a.init(i),i}function s(e,t){t=a(this.namespace+(void 0===t?":":t)+e);return t.log=this.log,t}function n(e,t){let r=0,n=0,o=-1,s=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,s=r):r++,n++;else{if(-1===o)return;n=o+1,s++,r=s}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return((a.debug=a).default=a).coerce=function(e){return e instanceof Error?e.stack||e.message:e},a.disable=function(){var e=[...a.names,...a.skips.map(e=>"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){a.save(e),a.namespaces=e,a.names=[],a.skips=[];var t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let e of t)"-"===e[0]?a.skips.push(e.slice(1)):a.names.push(e)},a.enabled=function(e){for(var t of a.skips)if(n(e,t))return!1;for(var r of a.names)if(n(e,r))return!0;return!1},a.humanize=im(),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(t){let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return a.colors[Math.abs(r)%a.colors.length]},a.enable(a.load()),a},am=(((t,r)=>{r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e)&&(r=t)}),e.splice(r,0,n)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}return e=!e&&"env"in _t?_t.env.DEBUG:e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&31<=parseInt(e[1],10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=(()=>{try{return localStorage}catch(e){}})(),r.destroy=(()=>{let e=!1;return()=>{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`."))}})(),r.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"],r.log=console.debug||console.log||(()=>{}),t.exports=sm(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})(om,om.exports),{}),um=Ol.exports,lm=(am.getMicrophones=um.getMicrophones,am.getSpeakers=um.getSpeakers,am.getDevices=um.getDevices,n),cm=i,pm=L,dm=B(),hm=Kf,fm=V(),mm=D(),gm=M(),ym=em,_m=am,vm=Yl,bm=(om.exports(lm.title)("version %s",lm.version),{C:cm,Exceptions:pm,Utils:dm,UA:hm,URI:fm,NameAddrHeader:mm,WebSocketInterface:ym,Grammar:gm,Devices:_m,Logger:vm,debug:om.exports,get name(){return lm.title},get version(){return lm.version}});export{bm as default};