@digital-realty/app-shell 16.0.8 → 16.0.9-IXUAT-11211.562867

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/dist/bootstrap.js CHANGED
@@ -1,4 +1,4 @@
1
- var wo=Object.defineProperty;var Oo=(e,t,r)=>t in e?wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var c=(e,t,r)=>Oo(e,typeof t!="symbol"?t+"":t,r);import{__decorate as _n}from"tslib";import{LitElement as pn,html as lt}from"lit";import{property as fn}from"lit/decorators.js";import{ApplicationInsights as Co,DistributedTracingModes as yo}from"@microsoft/applicationinsights-web";import{authedUser as mn}from"@digital-realty/ix-account-switcher";import{UserManager as Po}from"oidc-client-ts";import"@digital-realty/ix-app-logic/views/splash-screen.js";import{makeObservable as Mo,action as vo,observable as Io,toJS as No}from"mobx";function P(){var e;const t=(e=window.gpConfig)==null?void 0:e["app-shell"];if(!t)throw new Error("App-shell config not loaded. Ensure config.json is fetched before app bootstrap.");return t}const{PortalInterxion:Lo,PortalGlobalPortal:xo,PortalServiceFabric:Uo,PortalMarketplacePortal:Do}=P(),gn={strict:"strictly_necessary",performance:"performance",targeting:"targeting"},En={accept:"accept_all",reject:"reject_all",custom:"customize",no:"no_sell",bypass:"gpc_bypass"},Kt="globalportalappshell",Rt="user-authentication",Qt="redirect-url",Tn="ui-cookie-policy",Sn="date-format",Ie="Global Portal",Ne="Service Fabric",Le="Marketplace Portal",xe="EMEA Customer Portal",Ue="x-auth",[bt,An,Rn,bn]=["CREATE","UPDATE","READ","APPROVE"],[De,Jt,wn,On,ke,Cn,ko,yn,Be,Bo,Pn,Mn,Ge,Fe,$e,Go,vn,Fo,In,Ve,He,ze,Nn,je,Ln,xn,qe,Un]=["Cloud Connect","Cross Connect","Custom Roles","Customer Care","Customer Equipment Connection (CEC)","Customer Support","DCIM-enabled location data","Default System Roles","External User","Facility Access","Internal Roles","Internal User","Internet Exchange","Intra-Customer Connectivity (ICC)","IP Bandwidth","OSP Access","Permanent Badge","PoP/POE Room Access","Remote Hands","Remote Hands Package","Service Exchange Cloud Router","Service Exchange Port","Shipping & Receiving","Space & Power","Trouble Ticket","Visitor Access","User","ESG Reporting"],Dn=[In,Cn,Ln,Nn,xn,vn,On],kn=[Jt,De,ke,Ge,Fe,$e,Ve,He,ze,je],Bn=[Jt,De,ke,Ge,Fe,$e,Ve,He,ze,je],Gn={LocationChanged:"location-changed",VaadinRouterLocationChanged:"vaadin-router-location-changed",CreateUserClicked:"create-user-clicked",NavigateToConnectivityByPanel:"navigate-inventory-by-panel",NavigateToConnectivityByPort:"navigate-inventory-by-port"},We={SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges",ShowLastLoginPopup:"showLastLoginPopup"}},[Fn,$n,Vn]=["Security","DCIM","Planned Site Maintenance"],Hn=[Fn,$n,Vn],zn=[{label:Ie,href:xo,selected:!0},{label:Le,href:Do},{label:xe,href:Lo},{label:Ne,href:Uo,target:"_blank"}];var $o=Object.freeze({__proto__:null,APPROVE:bn,ApplicationEvents:Gn,ApplicationName:Kt,ApplicationStorage:We,CLOUD_CONNECT:De,CPAppName:Tn,CREATE:bt,CROSS_CONNECT:Jt,CUSTOMER_CARE:On,CUSTOMER_EQUIPMENT_CONNECTION_CEC:ke,CUSTOMER_SUPPORT:Cn,CUSTOM_ROLES:wn,CookieName:gn,CookieUserAction:En,DCIM:$n,DCIM_ENABLED_LOCATION_DATA:ko,DEFAULT_SYSTEM_ROLES:yn,DateFormatKey:Sn,EMEA_PORTAL:xe,ESG_REPORTING:Un,EXTERNAL_USER:Be,FACILITY_ACCESS:Bo,GLOBAL_PORTAL:Ie,INTERNAL_ROLES:Pn,INTERNAL_USER:Mn,INTERNET_EXCHANGE:Ge,INTRA_CUSTOMER_CONNECTIVITY_ICC:Fe,INVENTORY_ORDER_PERMISSIONS:kn,IP_BANDWIDTH:$e,IntraportalNavItems:zn,IxUserStorageKey:Rt,MARKETPLACE_PORTAL:Le,ORDER_MANAGEMENT_PERMISSIONS:Bn,OSP_ACCESS:Go,PERMANENT_BADGE:vn,PLANNED_MAINTENANCE:Vn,POP_ROOM_ACCESS:Fo,READ:Rn,REMOTE_HANDS:In,REMOTE_HANDS_PACKAGE:Ve,REPORTS_AND_MAINTENANCE_NAV_PERMISSIONS:Hn,RedirectUrlKey:Qt,SECURITY:Fn,SERVICE_EXCHANGE_CLOUD_ROUTER:He,SERVICE_EXCHANGE_PORT:ze,SERVICE_FABRIC:Ne,SERVICE_MANAGEMENT_NAV_PERMISSIONS:Dn,SHIPPING_RECEIVING:Nn,SPACE_AND_POWER:je,TROUBLE_TICKET:Ln,UPDATE:An,USER:qe,VISITOR_ACCESS:xn,xAuth:Ue});const Zt={appInsights:"_appInsights",otel:"_otel"},Vo=()=>{const{ApplicationInsightsInstrumentationKey:e,ApplicationInsightsCorrelationHeaderExcludedDomains:t}=P(),r=new Co({config:{instrumentationKey:e,enableCorsCorrelation:!0,enableRequestHeaderTracking:!0,enableResponseHeaderTracking:!0,enableAutoRouteTracking:!0,autoTrackPageVisitTime:!0,enableAjaxErrorStatusText:!0,enableAjaxPerfTracking:!0,enableUnhandledPromiseRejectionTracking:!0,isCookieUseDisabled:!0,distributedTracingMode:yo.AI_AND_W3C,correlationHeaderExcludedDomains:t.split(",").map(n=>n.trim())}});return r.loadAppInsights(),r.trackPageView(),r.addTelemetryInitializer(n=>{n.tags["ai.cloud.role"]=Kt}),r},te=(e,t,r)=>(...n)=>{const[s,...i]=n;typeof s=="string"&&s.startsWith("[mobx]")&&t===4?r.trackException({exception:{message:i[0].message,stack:i[0].stack,name:s},severityLevel:4}):r.trackTrace({severityLevel:t,message:s},i),e.apply(console,[s,...i])},Ho=e=>{console.log=te(console.log,2,e),console.info=te(console.info,2,e),console.warn=te(console.warn,3,e),console.error=te(console.error,4,e),window.console=console},zo=()=>{const{ApplicationInsightsInstrumentationKey:e}=P();if(!e)return;const t=Vo();window[Zt.appInsights]=t,window.dispatchEvent(new Event("appInsightsInitialized")),Ho(t)},Z="1.9.1",jn=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function jo(e){const t=new Set([e]),r=new Set,n=e.match(jn);if(!n)return()=>!1;const s={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(s.prerelease!=null)return function(u){return u===e};function i(a){return r.add(a),!1}function o(a){return t.add(a),!0}return function(u){if(t.has(u))return!0;if(r.has(u))return!1;const l=u.match(jn);if(!l)return i(u);const h={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return h.prerelease!=null||s.major!==h.major?i(u):s.major===0?s.minor===h.minor&&s.patch<=h.patch?o(u):i(u):s.minor<=h.minor?o(u):i(u)}}const qo=jo(Z),Wo=Z.split(".")[0],wt=Symbol.for(`opentelemetry.js.api.${Wo}`),Ot=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function Ct(e,t,r,n=!1){var s;const i=Ot[wt]=(s=Ot[wt])!==null&&s!==void 0?s:{version:Z};if(!n&&i[e]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(o.stack||o.message),!1}if(i.version!==Z){const o=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Z}`);return r.error(o.stack||o.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Z}.`),!0}function tt(e){var t,r;const n=(t=Ot[wt])===null||t===void 0?void 0:t.version;if(!(!n||!qo(n)))return(r=Ot[wt])===null||r===void 0?void 0:r[e]}function yt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Z}.`);const r=Ot[wt];r&&delete r[e]}class Xo{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return Pt("debug",this._namespace,t)}error(...t){return Pt("error",this._namespace,t)}info(...t){return Pt("info",this._namespace,t)}warn(...t){return Pt("warn",this._namespace,t)}verbose(...t){return Pt("verbose",this._namespace,t)}}function Pt(e,t,r){const n=tt("diag");if(n)return n[e](t,...r)}var b;(function(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"})(b||(b={}));function Yo(e,t){e<b.NONE?e=b.NONE:e>b.ALL&&(e=b.ALL),t=t||{};function r(n,s){const i=t[n];return typeof i=="function"&&e>=s?i.bind(t):function(){}}return{error:r("error",b.ERROR),warn:r("warn",b.WARN),info:r("info",b.INFO),debug:r("debug",b.DEBUG),verbose:r("verbose",b.VERBOSE)}}const Ko="diag";class x{static instance(){return this._instance||(this._instance=new x),this._instance}constructor(){function t(s){return function(...i){const o=tt("diag");if(o)return o[s](...i)}}const r=this,n=(s,i={logLevel:b.INFO})=>{var o,a,u;if(s===r){const d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=d.stack)!==null&&o!==void 0?o:d.message),!1}typeof i=="number"&&(i={logLevel:i});const l=tt("diag"),h=Yo((a=i.logLevel)!==null&&a!==void 0?a:b.INFO,s);if(l&&!i.suppressOverrideMessage){const d=(u=new Error().stack)!==null&&u!==void 0?u:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),h.warn(`Current logger will overwrite one already registered from ${d}`)}return Ct("diag",h,r,!0)};r.setLogger=n,r.disable=()=>{yt(Ko,r)},r.createComponentLogger=s=>new Xo(s),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}class mt{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){const r=this._entries.get(t);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,r){const n=new mt(this._entries);return n._entries.set(t,r),n}removeEntry(t){const r=new mt(this._entries);return r._entries.delete(t),r}removeEntries(...t){const r=new mt(this._entries);for(const n of t)r._entries.delete(n);return r}clear(){return new mt}}const Qo=Symbol("BaggageEntryMetadata"),Jo=x.instance();function Zo(e={}){return new mt(new Map(Object.entries(e)))}function ta(e){return typeof e!="string"&&(Jo.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:Qo,toString(){return e}}}function Xe(e){return Symbol.for(e)}class be{constructor(t){const r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,s)=>{const i=new be(r._currentContext);return i._currentContext.set(n,s),i},r.deleteValue=n=>{const s=new be(r._currentContext);return s._currentContext.delete(n),s}}}const et=new be;if(typeof console<"u"){const e=["error","warn","info","debug","trace","log"];for(const t of e);}class ea{constructor(){}createGauge(t,r){return la}createHistogram(t,r){return ha}createCounter(t,r){return ua}createUpDownCounter(t,r){return da}createObservableGauge(t,r){return pa}createObservableCounter(t,r){return _a}createObservableUpDownCounter(t,r){return fa}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}}class ee{}class ra extends ee{add(t,r){}}class na extends ee{add(t,r){}}class sa extends ee{record(t,r){}}class ia extends ee{record(t,r){}}class Ye{addCallback(t){}removeCallback(t){}}class oa extends Ye{}class aa extends Ye{}class ca extends Ye{}const qn=new ea,ua=new ra,la=new sa,ha=new ia,da=new na,_a=new oa,pa=new aa,fa=new ca;function Mt(){return qn}var X;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(X||(X={}));const ma={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},ga={set(e,t,r){e!=null&&(e[t]=r)}};class Ea{active(){return et}with(t,r,n,...s){return r.call(n,...s)}bind(t,r){return r}enable(){return this}disable(){return this}}const Ke="context",Ta=new Ea;class gt{constructor(){}static getInstance(){return this._instance||(this._instance=new gt),this._instance}setGlobalContextManager(t){return Ct(Ke,t,x.instance())}active(){return this._getContextManager().active()}with(t,r,n,...s){return this._getContextManager().with(t,r,n,...s)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return tt(Ke)||Ta}disable(){this._getContextManager().disable(),yt(Ke,x.instance())}}var z;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(z||(z={}));const Wn="0000000000000000",Xn="00000000000000000000000000000000",Yn={traceId:Xn,spanId:Wn,traceFlags:z.NONE};class vt{constructor(t=Yn){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}}const Qe=Xe("OpenTelemetry Context Key SPAN");function Je(e){return e.getValue(Qe)||void 0}function Sa(){return Je(gt.getInstance().active())}function Ze(e,t){return e.setValue(Qe,t)}function Aa(e){return e.deleteValue(Qe)}function Ra(e,t){return Ze(e,new vt(t))}function Kn(e){var t;return(t=Je(e))===null||t===void 0?void 0:t.spanContext()}const re=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Qn(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(re[e.charCodeAt(n)]|0)+(re[e.charCodeAt(n+1)]|0)+(re[e.charCodeAt(n+2)]|0)+(re[e.charCodeAt(n+3)]|0);return r===t}function Jn(e){return Qn(e,32)&&e!==Xn}function ba(e){return Qn(e,16)&&e!==Wn}function ne(e){return Jn(e.traceId)&&ba(e.spanId)}function wa(e){return new vt(e)}const tr=gt.getInstance();class Zn{startSpan(t,r,n=tr.active()){if(!!(r!=null&&r.root))return new vt;const i=n&&Kn(n);return Oa(i)&&ne(i)?new vt(i):new vt}startActiveSpan(t,r,n,s){let i,o,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,o=n,a=s);const u=o!=null?o:tr.active(),l=this.startSpan(t,i,u),h=Ze(u,l);return tr.with(h,a,void 0,l)}}function Oa(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}const Ca=new Zn;class ya{constructor(t,r,n,s){this._provider=t,this.name=r,this.version=n,this.options=s}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,s){const i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;const t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ca}}class Pa{getTracer(t,r,n){return new Zn}}const Ma=new Pa;class ts{getTracer(t,r,n){var s;return(s=this.getDelegateTracer(t,r,n))!==null&&s!==void 0?s:new ya(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Ma}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getTracer(t,r,n)}}var se;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(se||(se={}));var It;(function(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"})(It||(It={}));var j;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(j||(j={}));const R=gt.getInstance(),f=x.instance();class va{getMeter(t,r,n){return qn}}const Ia=new va,er="metrics";class sn{constructor(){}static getInstance(){return this._instance||(this._instance=new sn),this._instance}setGlobalMeterProvider(t){return Ct(er,t,x.instance())}getMeterProvider(){return tt(er)||Ia}getMeter(t,r,n){return this.getMeterProvider().getMeter(t,r,n)}disable(){yt(er,x.instance())}}const rr=sn.getInstance();class Na{inject(t,r){}extract(t,r){return t}fields(){return[]}}const nr=Xe("OpenTelemetry Baggage Key");function es(e){return e.getValue(nr)||void 0}function La(){return es(gt.getInstance().active())}function xa(e,t){return e.setValue(nr,t)}function Ua(e){return e.deleteValue(nr)}const sr="propagation",Da=new Na;class on{constructor(){this.createBaggage=Zo,this.getBaggage=es,this.getActiveBaggage=La,this.setBaggage=xa,this.deleteBaggage=Ua}static getInstance(){return this._instance||(this._instance=new on),this._instance}setGlobalPropagator(t){return Ct(sr,t,x.instance())}inject(t,r,n=ga){return this._getGlobalPropagator().inject(t,r,n)}extract(t,r,n=ma){return this._getGlobalPropagator().extract(t,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){yt(sr,x.instance())}_getGlobalPropagator(){return tt(sr)||Da}}const U=on.getInstance(),ir="trace";class an{constructor(){this._proxyTracerProvider=new ts,this.wrapSpanContext=wa,this.isSpanContextValid=ne,this.deleteSpan=Aa,this.getSpan=Je,this.getActiveSpan=Sa,this.getSpanContext=Kn,this.setSpan=Ze,this.setSpanContext=Ra}static getInstance(){return this._instance||(this._instance=new an),this._instance}setGlobalTracerProvider(t){const r=Ct(ir,this._proxyTracerProvider,x.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return tt(ir)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){yt(ir,x.instance()),this._proxyTracerProvider=new ts}}const w=an.getInstance(),rs=Xe("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function ns(e){return e.setValue(rs,!0)}function or(e){return e.getValue(rs)===!0}const ka="=",ss=";",is=",",ar="baggage",os=180,as=4096,cs=8192;function Ba(e){return e.reduce((t,r)=>{const n=`${t}${t!==""?is:""}${r}`;return n.length>cs?t:n},"")}function Ga(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=ss+r.metadata.toString()),n})}function Fa(e){if(!e)return;const t=e.indexOf(ss),r=t===-1?e:e.substring(0,t),n=r.indexOf(ka);if(n<=0)return;const s=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!s||!i)return;let o,a;try{o=decodeURIComponent(s),a=decodeURIComponent(i)}catch(l){return}let u;if(t!==-1&&t<e.length-1){const l=e.substring(t+1);u=ta(l)}return{key:o,value:a,metadata:u}}function us(e,t,r,n){let s=0;for(;s<e.length&&r<os;){const i=e.indexOf(is,s),o=i===-1?e.length:i,a=o-s;if(a<=as){const u=Fa(e.substring(s,o));if(u){const l=(r===0?0:1)+a;if(n+l>cs)break;t[u.key]=u.metadata?{value:u.value,metadata:u.metadata}:{value:u.value},r++,n+=l}}if(i===-1)break;s=i+1}return[r,n]}class $a{inject(t,r,n){const s=U.getBaggage(t);if(!s||or(t))return;const i=Ga(s).filter(a=>a.length<=as).slice(0,os),o=Ba(i);o.length>0&&n.set(r,ar,o)}extract(t,r,n){const s=n.get(r,ar);if(!s)return t;const i={};let o=0,a=0;if(Array.isArray(s))for(let u=0;u<s.length;u++)[o,a]=us(s[u],i,o,a);else[o]=us(s,i,o,a);return o===0?t:U.setBaggage(t,U.createBaggage(i))}fields(){return[ar]}}function Nt(e){const t={};if(typeof e!="object"||e==null)return t;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!Va(r)){f.warn(`Invalid attribute key: ${r}`);continue}const n=e[r];if(!ls(n)){f.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function Va(e){return typeof e=="string"&&e!==""}function ls(e){return e==null?!0:Array.isArray(e)?Ha(e):hs(typeof e)}function Ha(e){let t;for(const r of e){if(r==null)continue;const n=typeof r;if(n!==t){if(!t){if(hs(n)){t=n;continue}return!1}return!1}}return!0}function hs(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function za(){return e=>{f.error(ja(e))}}function ja(e){return typeof e=="string"?e:JSON.stringify(qa(e))}function qa(e){const t={};let r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;const s=r[n];s&&(t[n]=String(s))}),r=Object.getPrototypeOf(r);return t}let Wa=za();function Y(e){try{Wa(e)}catch(t){}}function $_(e){}const Xa="2.10.0",Lt="error.type",cr="exception.message",Ya="exception.stacktrace",ur="exception.type",ds="http.request.method",_s="http.request.method_original",ps="http.response.status_code",fs="server.address",ms="server.port",Ka="service.instance.id",gs="service.name",lr="telemetry.sdk.language",Qa="webjs",hr="telemetry.sdk.name",dr="telemetry.sdk.version",xt="url.full",Ja="user_agent.original",Za="process.runtime.name",_r={[hr]:"opentelemetry",[Za]:"browser",[lr]:Qa,[dr]:Xa},O=performance,tc=9,ec=6,rc=Math.pow(10,ec),Ut=Math.pow(10,tc);function N(e){const t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*rc);return[r,n]}function G(e){const t=N(O.timeOrigin),r=N(typeof e=="number"?e:O.now());return Ts(t,r)}function Dt(e){if(fr(e))return e;if(typeof e=="number")return e<O.timeOrigin/2?G(e):N(e);if(e instanceof Date)return N(e.getTime());throw TypeError("Invalid input type")}function pr(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=Ut),[r,n]}function q(e){return e[0]*Ut+e[1]}function ie(e){return e[0]*1e6+e[1]/1e3}function nc(e){return e[0]*1e3+e[1]/1e6}function sc(e){return e[0]+e[1]/Ut}function fr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Es(e){return fr(e)||typeof e=="number"||e instanceof Date}function Ts(e,t){const r=[e[0]+t[0],e[1]+t[1]];return r[1]>=Ut&&(r[1]-=Ut,r[0]+=1),r}var D;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(D||(D={}));class ic{constructor(t={}){c(this,"_propagators");c(this,"_fields");var n;this._propagators=(n=t.propagators)!=null?n:[];const r=new Set;for(const s of this._propagators){const i=typeof s.fields=="function"?s.fields():[];for(const o of i)r.add(o)}this._fields=Array.from(r)}inject(t,r,n){for(const s of this._propagators)try{s.inject(t,r,n)}catch(i){f.warn(`Failed to inject with ${s.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((s,i)=>{try{return i.extract(s,r,n)}catch(o){f.warn(`Failed to extract with ${i.constructor.name}. Err: ${o.message}`)}return s},t)}fields(){return this._fields.slice()}}const mr="[_0-9a-z-*/]",oc=`[a-z]${mr}{0,255}`,ac=`[a-z0-9]${mr}{0,240}@[a-z]${mr}{0,13}`,cc=new RegExp(`^(?:${oc}|${ac})$`),uc=/^[ -~]{0,255}[!-~]$/,lc=/,|=/;function Ss(e){return cc.test(e)}function As(e){return uc.test(e)&&!lc.test(e)}const hc=32,Rs=512,bs=",",ws="=";class cn{constructor(t){c(this,"_length");c(this,"_rawTraceState");c(this,"_internalState");this._rawTraceState=typeof t=="string"?t:"",this._length=this._rawTraceState.length}set(t,r){if(!Ss(t)||!As(r))return this;const n=this._getState(),s=n.get(t);let i=this._length;if(typeof s=="string"?i+=r.length-s.length:i+=t.length+r.length+(n.size>0?2:1),i>Rs)return this;const o=new Map(n);return o.delete(t),o.set(t,r),this._fromState(o,i)}unset(t){const r=this._getState(),n=r.get(t);if(typeof n!="string")return this;let s=this._length-(t.length+n.length+1);r.size>1&&(s=s-1);const i=new Map(r);return i.delete(t),this._fromState(i,s)}get(t){return this._getState().get(t)}serialize(){let t="",r=0;for(const n of this._getState())r>0&&(t=bs+t),t=`${n[0]}${ws}${n[1]}`+t,r++;return t}_getState(){if(this._internalState)return this._internalState;const t=this._rawTraceState.split(bs),r=new Map;let n=0;for(const s of t){const i=s.trim(),o=i.indexOf(ws);if(o===-1)continue;const a=i.slice(0,o),u=i.slice(o+1);if(!Ss(a)||!As(u))continue;const l=n+i.length+(r.size>0?1:0);if(!(l>Rs)&&(r.set(a,u),n=l,r.size>=hc))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(t,r){const n=Object.create(cn.prototype);return n._internalState=t,n._length=r,n}}const oe="traceparent",gr="tracestate",dc="00",_c="(?!ff)[\\da-f]{2}",pc="(?![0]{32})[\\da-f]{32}",fc="(?![0]{16})[\\da-f]{16}",mc="[\\da-f]{2}",gc=new RegExp(`^\\s?(${_c})-(${pc})-(${fc})-(${mc})(-.*)?\\s?$`);function Ec(e){const t=gc.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}class Tc{inject(t,r,n){const s=w.getSpanContext(t);if(!s||or(t)||!ne(s))return;const i=`${dc}-${s.traceId}-${s.spanId}-0${Number(s.traceFlags||z.NONE).toString(16)}`;n.set(r,oe,i),s.traceState&&n.set(r,gr,s.traceState.serialize())}extract(t,r,n){const s=n.get(r,oe);if(!s)return t;const i=Array.isArray(s)?s[0]:s;if(typeof i!="string")return t;const o=Ec(i);if(!o)return t;o.isRemote=!0;const a=n.get(r,gr);if(a){const u=Array.isArray(a)?a.join(","):a;o.traceState=new cn(typeof u=="string"?u:void 0)}return w.setSpanContext(t,o)}fields(){return[oe,gr]}}var Os;(function(e){e.HTTP="http"})(Os||(Os={}));const Sc="[object Object]",Ac="[object Null]",Rc="[object Undefined]",bc=Function.prototype,Cs=bc.toString,wc=Cs.call(Object),Oc=Object.getPrototypeOf,ys=Object.prototype,Ps=ys.hasOwnProperty,rt=Symbol?Symbol.toStringTag:void 0,Ms=ys.toString;function vs(e){if(!Cc(e)||yc(e)!==Sc)return!1;const t=Oc(e);if(t===null)return!0;const r=Ps.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Cs.call(r)===wc}function Cc(e){return e!=null&&typeof e=="object"}function yc(e){return e==null?e===void 0?Rc:Ac:rt&&rt in Object(e)?Pc(e):Mc(e)}function Pc(e){const t=Ps.call(e,rt),r=e[rt];let n=!1;try{e[rt]=void 0,n=!0}catch(i){}const s=Ms.call(e);return n&&(t?e[rt]=r:delete e[rt]),s}function Mc(e){return Ms.call(e)}const vc=20;function Ic(...e){let t=e.shift();const r=new WeakMap;for(;e.length>0;)t=Is(t,e.shift(),0,r);return t}function Er(e){return ae(e)?e.slice():e}function Is(e,t,r=0,n){let s;if(!(r>vc)){if(r++,ce(e)||ce(t)||Ls(t))s=Er(t);else if(ae(e)){if(s=e.slice(),ae(t))for(let i=0,o=t.length;i<o;i++)s.push(Er(t[i]));else if(kt(t)){const i=Object.keys(t);for(let o=0,a=i.length;o<a;o++){const u=i[o];u==="__proto__"||u==="constructor"||u==="prototype"||(s[u]=Er(t[u]))}}}else if(kt(e))if(kt(t)){if(!Nc(e,t))return t;s=Object.assign({},e);const i=Object.keys(t);for(let o=0,a=i.length;o<a;o++){const u=i[o];if(u==="__proto__"||u==="constructor"||u==="prototype")continue;const l=t[u];if(ce(l))typeof l>"u"?delete s[u]:s[u]=l;else{const h=s[u],d=l;if(Ns(e,u,n)||Ns(t,u,n))delete s[u];else{if(kt(h)&&kt(d)){const p=n.get(h)||[],_=n.get(d)||[];p.push({obj:e,key:u}),_.push({obj:t,key:u}),n.set(h,p),n.set(d,_)}s[u]=Is(s[u],l,r,n)}}}}else s=t;return s}}function Ns(e,t,r){const n=r.get(e[t])||[];for(let s=0,i=n.length;s<i;s++){const o=n[s];if(o.key===t&&o.obj===e)return!0}return!1}function ae(e){return Array.isArray(e)}function Ls(e){return typeof e=="function"}function kt(e){return!ce(e)&&!ae(e)&&!Ls(e)&&typeof e=="object"}function ce(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function Nc(e,t){return!(!vs(e)||!vs(t))}function xs(e,t){return typeof t=="string"?e===t:!!e.match(t)}function Us(e,t){if(!t)return!1;for(const r of t)if(xs(e,r))return!0;return!1}class Lc{constructor(){c(this,"_promise");c(this,"_resolve");c(this,"_reject");this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}}class xc{constructor(t,r){c(this,"_isCalled",!1);c(this,"_deferred",new Lc);c(this,"_callback");c(this,"_that");this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}b.ALL,b.VERBOSE,b.DEBUG,b.INFO,b.WARN,b.ERROR,b.NONE;function Uc(e,t){return new Promise(r=>{R.with(ns(R.active()),()=>{e.export(t,r)})})}const Dc={_export:Uc};let ue;function kc(){if(ue===void 0)try{const e=globalThis.process.argv0;ue=e?`unknown_service:${e}`:"unknown_service"}catch(e){ue="unknown_service"}return ue}const Bt=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";class we{constructor(t,r){c(this,"_rawAttributes");c(this,"_asyncAttributesPending",!1);c(this,"_schemaUrl");c(this,"_memoizedAttributes");var s;const n=(s=t.attributes)!=null?s:{};this._rawAttributes=Object.entries(n).map(([i,o])=>(Bt(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=Bs(this._rawAttributes),this._schemaUrl=Bc(r==null?void 0:r.schemaUrl)}static FromAttributeList(t,r){const n=new we({},r);return n._rawAttributes=Bs(t),n._asyncAttributesPending=t.filter(([s,i])=>Bt(i)).length>0,n}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,Bt(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){var r;if(this.asyncAttributesPending&&f.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[n,s]of this._rawAttributes){if(Bt(s)){f.debug(`Unsettled resource attribute ${n} skipped`);continue}s!=null&&((r=t[n])!=null||(t[n]=s))}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;const r=Gc(this,t),n=r?{schemaUrl:r}:void 0;return we.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}}function Ds(e,t){return we.FromAttributeList(Object.entries(e),t)}function ks(){return Ds({[gs]:kc(),[lr]:_r[lr],[hr]:_r[hr],[dr]:_r[dr]})}function Bs(e){return e.map(([t,r])=>Bt(r)?[t,r.catch(n=>{f.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function Bc(e){if(typeof e=="string"||e===void 0)return e;f.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function Gc(e,t){const r=e==null?void 0:e.schemaUrl,n=t==null?void 0:t.schemaUrl,s=r===void 0||r==="",i=n===void 0||n==="";if(s)return n;if(i||r===n)return r;f.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}const Fc="exception",Tr=Symbol.for("nodejs.util.inspect.custom");function Sr(e){var r;const t={};for(const[n,s]of e.getRawAttributes())typeof(s==null?void 0:s.then)!="function"&&s!=null&&((r=t[n])!=null||(t[n]=s));return t}function Ar(e,t,r,n,s){if(typeof r=="number"&&r<0){const o=`[${e}]`;return n!=null&&n.stylize?n.stylize(o,"special"):o}if(typeof s!="function"||!n)return t;const i={...n,depth:n.depth==null?n.depth:n.depth-1};return`${e} ${s(t,i)}`}class $c{constructor(t){c(this,"_spanContext");c(this,"kind");c(this,"parentSpanContext");c(this,"attributes",{});c(this,"links",[]);c(this,"events",[]);c(this,"startTime");c(this,"resource");c(this,"instrumentationScope");c(this,"_droppedAttributesCount",0);c(this,"_droppedEventsCount",0);c(this,"_droppedLinksCount",0);c(this,"_attributesCount",0);c(this,"name");c(this,"status",{code:j.UNSET});c(this,"endTime",[0,0]);c(this,"_ended",!1);c(this,"_duration",[-1,-1]);c(this,"_spanProcessor");c(this,"_spanLimits");c(this,"_attributeValueLengthLimit");c(this,"_recordEndMetrics");c(this,"_performanceStartTime");c(this,"_performanceOffset");c(this,"_startTimeProvided");var n,s;const r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=O.now(),this._performanceOffset=r-(this._performanceStartTime+O.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=(n=this._spanLimits.attributeValueLengthLimit)!=null?n:0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(const i of t.links)this.addLink(i);this.startTime=this._getTime((s=t.startTime)!=null?s:r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return f.warn(`Invalid attribute key: ${t}`),this;if(!ls(r))return f.warn(`Invalid attribute value set for key: ${t}`),this;const{attributeCountLimit:n}=this._spanLimits,s=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&s?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),s&&this._attributesCount++,this)}setAttributes(t){for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;const{eventCountLimit:s}=this._spanLimits;if(s===0)return f.warn("No events allowed."),this._droppedEventsCount++,this;s!==void 0&&this.events.length>=s&&(this._droppedEventsCount===0&&f.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Es(r)&&(Es(n)||(n=r),r=void 0);const i=Nt(r),{attributePerEventCountLimit:o}=this._spanLimits,a={};let u=0,l=0;for(const h in i){if(!Object.prototype.hasOwnProperty.call(i,h))continue;const d=i[h];if(o!==void 0&&l>=o){u++;continue}a[h]=this._truncateToSize(d),l++}return this.events.push({name:t,attributes:a,time:this._getTime(n),droppedAttributesCount:u}),this}addLink(t){if(this._isSpanEnded())return this;const{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&f.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:n}=this._spanLimits,s=Nt(t.attributes),i={};let o=0,a=0;for(const l in s){if(!Object.prototype.hasOwnProperty.call(s,l))continue;const h=s[l];if(n!==void 0&&a>=n){o++;continue}i[l]=this._truncateToSize(h),a++}const u={context:t.context};return a>0&&(u.attributes=i),o>0&&(u.droppedAttributesCount=o),this.links.push(u),this}addLinks(t){for(const r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===j.UNSET)return this;if(this.status.code===j.OK)return this;const r={code:t.code};return t.code===j.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&f.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){var r;if(this._isSpanEnded()){f.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=pr(this.startTime,this.endTime),this._duration[0]<0&&(f.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]),this._droppedEventsCount>0&&f.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&f.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(r=this._recordEndMetrics)==null||r.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=O.now())return G(t+this._performanceOffset);if(typeof t=="number")return N(t);if(t instanceof Date)return N(t.getTime());if(fr(t))return t;if(this._startTimeProvided)return N(Date.now());const r=O.now()-this._performanceStartTime;return Ts(this.startTime,N(r))}isRecording(){return this._ended===!1}recordException(t,r){const n={};typeof t=="string"?n[cr]=t:t&&(t.code?n[ur]=t.code.toString():t.name&&(n[ur]=t.name),t.message&&(n[cr]=t.message),t.stack&&(n[Ya]=t.stack)),n[ur]||n[cr]?this.addEvent(Fc,n,r):f.warn(`Failed to record an exception ${t}`)}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(){if(this._ended){const t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);f.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){const r=this._attributeValueLengthLimit;return r<=0?(f.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}[Tr](t,r,n){const s={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Sr(this.resource)}};return Ar("SpanImpl",s,t,r,n)}}var F;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(F||(F={}));const Vc="otel.component.name",Hc="otel.component.type",zc="otel.span.parent.origin",Gs="otel.span.sampling_result",jc="otel.sdk.processor.span.processed",qc="otel.sdk.processor.span.queue.capacity",Wc="otel.sdk.processor.span.queue.size",Xc="otel.sdk.span.live",Yc="otel.sdk.span.started",Kc="batching_span_processor";class Qc{constructor(t){c(this,"startedSpans");c(this,"liveSpans");this.startedSpans=t.createCounter(Yc,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(Xc,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){const n=Zc(r);if(this.startedSpans.add(1,{[zc]:Jc(t),[Gs]:n}),r===F.NOT_RECORD)return()=>{};const s={[Gs]:n};return this.liveSpans.add(1,s),()=>{this.liveSpans.add(-1,s)}}}function Jc(e){return e?e.isRemote?"remote":"local":"none"}function Zc(e){switch(e){case F.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case F.RECORD:return"RECORD_ONLY";case F.NOT_RECORD:return"DROP"}}const tu="2.10.0";class eu{constructor(t,r){c(this,"_sampler");c(this,"_spanLimits");c(this,"_idGenerator");c(this,"instrumentationScope");c(this,"_resource");c(this,"_spanProcessor");c(this,"_tracerMetrics");this.instrumentationScope=t,this._sampler=r.sampler,this._spanLimits=r.spanLimits,this._resource=r.resource,this._idGenerator=r.idGenerator,this._spanProcessor=r.spanProcessor;const n=r.meterProvider.getMeter("@opentelemetry/sdk-trace",tu);this._tracerMetrics=new Qc(n)}startSpan(t,r={},n=R.active()){var y,At,ut;r.root&&(n=w.deleteSpan(n));const s=w.getSpan(n);if(or(n))return f.debug("Instrumentation suppressed, returning Noop Span"),w.wrapSpanContext(Yn);const i=s==null?void 0:s.spanContext(),o=this._idGenerator.generateSpanId();let a,u,l;!i||!w.isSpanContextValid(i)?u=this._idGenerator.generateTraceId():(u=i.traceId,l=i.traceState,a=i);const h=(y=r.kind)!=null?y:It.INTERNAL,d=((At=r.links)!=null?At:[]).map(Yt=>({context:Yt.context,attributes:Nt(Yt.attributes)})),p=Nt(r.attributes),_=this._sampler.shouldSample(n,u,t,h,p,d),E=this._tracerMetrics.startSpan(i,_.decision);l=(ut=_.traceState)!=null?ut:l;const m=_.decision===se.RECORD_AND_SAMPLED?z.SAMPLED:z.NONE,T={traceId:u,spanId:o,traceFlags:m,traceState:l};if(_.decision===se.NOT_RECORD)return f.debug("Recording is off, propagating context in a non-recording span"),w.wrapSpanContext(T);const A=Nt(Object.assign(p,_.attributes));return new $c({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:T,name:t,kind:h,links:d,parentSpanContext:a,attributes:A,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:E})}startActiveSpan(t,r,n,s){let i,o,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,o=n,a=s);const u=o!=null?o:R.active(),l=this.startSpan(t,i,u),h=w.setSpan(u,l);return R.with(h,a,void 0,l)}[Tr](t,r,n){const s={instrumentationScope:this.instrumentationScope,resource:{attributes:Sr(this._resource)},spanLimits:this._spanLimits};return Ar("Tracer",s,t,r,n)}}class ru{constructor(t){c(this,"_spanProcessors");this._spanProcessors=t}forceFlush(){const t=[];for(const r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{Y(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(const n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(const r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(const r of this._spanProcessors)r.onEnd(t)}shutdown(){const t=[];for(const r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}}class le{shouldSample(){return{decision:F.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class nt{shouldSample(){return{decision:F.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class ht{constructor(t){c(this,"_root");c(this,"_remoteParentSampled");c(this,"_remoteParentNotSampled");c(this,"_localParentSampled");c(this,"_localParentNotSampled");var r,n,s,i;this._root=t.root,this._root||(Y(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new nt),this._remoteParentSampled=(r=t.remoteParentSampled)!=null?r:new nt,this._remoteParentNotSampled=(n=t.remoteParentNotSampled)!=null?n:new le,this._localParentSampled=(s=t.localParentSampled)!=null?s:new nt,this._localParentNotSampled=(i=t.localParentNotSampled)!=null?i:new le}shouldSample(t,r,n,s,i,o){const a=w.getSpanContext(t);return!a||!ne(a)?this._root.shouldSample(t,r,n,s,i,o):a.isRemote?a.traceFlags&z.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,s,i,o):this._remoteParentNotSampled.shouldSample(t,r,n,s,i,o):a.traceFlags&z.SAMPLED?this._localParentSampled.shouldSample(t,r,n,s,i,o):this._localParentNotSampled.shouldSample(t,r,n,s,i,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}const Fs=new Map;class nu{constructor(t,r,n){c(this,"processedSpans");c(this,"queueSize");c(this,"queueSizeCallback");c(this,"standardAttrs");c(this,"droppedAttrs");var i;const s=(i=Fs.get(t))!=null?i:0;if(Fs.set(t,s+1),this.standardAttrs={[Hc]:t,[Vc]:`${t}/${s}`},this.droppedAttrs={...this.standardAttrs,[Lt]:"queue_full"},this.processedSpans=r.createCounter(jc,{unit:"{span}",description:"The number of spans for which the processing has finished, either successful or failed."}),n){const{capacity:o,getQueueSize:a}=n;r.createUpDownCounter(qc,{unit:"{span}",description:"The maximum number of spans the queue of a given instance of an SDK span processor can hold."}).add(o,this.standardAttrs),this.queueSize=r.createObservableUpDownCounter(Wc,{unit:"{span}",description:"The number of spans in the queue of a given instance of an SDK span processor."}),this.queueSizeCallback=l=>l.observe(a(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(t){this.processedSpans.add(t,this.droppedAttrs)}finishSpans(t,r){if(!r){this.processedSpans.add(t,this.standardAttrs);return}const n={...this.standardAttrs,[Lt]:r.name};this.processedSpans.add(t,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}class su{constructor(t){c(this,"_maxExportBatchSize");c(this,"_maxQueueSize");c(this,"_scheduledDelayMillis");c(this,"_exportTimeoutMillis");c(this,"_exporter");c(this,"_metrics");c(this,"_isExporting",!1);c(this,"_finishedSpans",[]);c(this,"_timer");c(this,"_shutdownOnce");c(this,"_droppedSpansCount",0);var n,s,i,o;this._exporter=t.exporter,this._maxExportBatchSize=(n=t.maxExportBatchSize)!=null?n:512,this._maxQueueSize=(s=t.maxQueueSize)!=null?s:2048,this._scheduledDelayMillis=(i=t.scheduledDelayMillis)!=null?i:5e3,this._exportTimeoutMillis=(o=t.exportTimeoutMillis)!=null?o:3e4,this._shutdownOnce=new xc(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(f.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);const r=t.selfObsMeterProvider?t.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):Mt();this._metrics=new nu(Kc,r,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&z.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&f.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(f.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{const n=[],s=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,o=s;i<o;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{const n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);R.with(ns(R.active()),()=>{let s;this._finishedSpans.length<=this._maxExportBatchSize?(s=this._finishedSpans,this._finishedSpans=[]):s=this._finishedSpans.splice(0,this._maxExportBatchSize);const i=()=>this._exporter.export(s,a=>{var u;clearTimeout(n),this._metrics.finishSpans(s.length,a.error),a.code===D.SUCCESS?t():r((u=a.error)!=null?u:new Error("BatchSpanProcessor: span export failed"))});let o=null;for(let a=0,u=s.length;a<u;a++){const l=s[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(o!=null||(o=[]),o.push(l.resource.waitForAsyncAttributes()))}o===null?i():Promise.all(o).then(i,a=>{Y(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;const t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,Y(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}let iu=class extends su{constructor(r){super(r);c(this,"_visibilityChangeListener");c(this,"_pageHideListener");this.onInit(r)}onInit(r){r.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(n=>{Y(n)})},this._pageHideListener=()=>{this.forceFlush().catch(n=>{Y(n)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}};const ou=16,au=8,$s=new Uint8Array(ou),Vs=new Uint8Array(au),cu=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Hs(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function zs(e){let t="";for(let r=0;r<e.length;r++)t+=cu[e[r]];return t}class uu{generateTraceId(){return Hs($s),zs($s)}generateSpanId(){return Hs(Vs),zs(Vs)}}var st;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(st||(st={}));class lu{constructor(t={}){c(this,"_resource");c(this,"_activeSpanProcessor");c(this,"_forceFlushTimeoutMillis");c(this,"_tracerOptions");c(this,"_tracers",new Map);var n,s,i,o,a,u,l,h,d,p,_,E,m,T,A,M,y;this._forceFlushTimeoutMillis=(n=t.forceFlushTimeoutMillis)!=null?n:3e4,this._resource=(s=t.resource)!=null?s:ks();const r=(i=t.spanProcessors)!=null?i:[];this._activeSpanProcessor=new ru(r),this._tracerOptions={resource:this._resource,sampler:(o=t.sampler)!=null?o:new ht({root:new nt}),spanLimits:{attributeCountLimit:(u=(a=t.spanLimits)==null?void 0:a.attributeCountLimit)!=null?u:128,attributeValueLengthLimit:(h=(l=t.spanLimits)==null?void 0:l.attributeValueLengthLimit)!=null?h:1/0,eventCountLimit:(p=(d=t.spanLimits)==null?void 0:d.eventCountLimit)!=null?p:128,linkCountLimit:(E=(_=t.spanLimits)==null?void 0:_.linkCountLimit)!=null?E:128,attributePerEventCountLimit:(T=(m=t.spanLimits)==null?void 0:m.attributePerEventCountLimit)!=null?T:128,attributePerLinkCountLimit:(M=(A=t.spanLimits)==null?void 0:A.attributePerLinkCountLimit)!=null?M:128},idGenerator:t.idGenerator||new uu,spanProcessor:this._activeSpanProcessor,meterProvider:(y=t.meterProvider)!=null?y:{getMeter(){return Mt()}}}}getTracer(t,r,n){const s=`${t}@${r||""}:${(n==null?void 0:n.schemaUrl)||""}`;return this._tracers.has(s)||this._tracers.set(s,new eu({name:t,version:r,schemaUrl:n==null?void 0:n.schemaUrl},this._tracerOptions)),this._tracers.get(s)}forceFlush(){const t=this._forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(s=>{let i;const o=setTimeout(()=>{s(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=st.timeout},t);n.forceFlush().then(()=>{clearTimeout(o),i!==st.timeout&&(i=st.resolved,s(i))}).catch(a=>{clearTimeout(o),i=st.error,s(a)})}));return new Promise((n,s)=>{Promise.all(r).then(i=>{const o=i.filter(a=>a!==st.resolved);o.length>0?s(o):n()}).catch(i=>s([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Tr](t,r,n){const s=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:Sr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:s.map(o=>{var a,u;return(u=(a=o.constructor)==null?void 0:a.name)!=null?u:"SpanProcessor"})};return Ar("TracerProvider",i,t,r,n)}}class Rr{constructor(t=0){c(this,"_ratio");c(this,"_upperBound");this._ratio=this._normalize(t),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:Jn(r)&&this._accumulate(r)<this._upperBound?F.RECORD_AND_SAMPLED:F.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<32;n+=8){let s=0;for(let i=0;i<8;i++){const o=t.charCodeAt(n+i),a=o<58?o-48:o<71?o-55:o-87;s=s<<4|a}r=(r^s)>>>0}return r}}var $;(function(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"})($||($={}));const js=1;function hu(){return{sampler:du(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function du(){const e=$.ParentBasedAlwaysOn;switch(e){case $.AlwaysOn:return new nt;case $.AlwaysOff:return new le;case $.ParentBasedAlwaysOn:return new ht({root:new nt});case $.ParentBasedAlwaysOff:return new ht({root:new le});case $.TraceIdRatio:return new Rr(qs());case $.ParentBasedTraceIdRatio:return new ht({root:new Rr(qs())});default:return f.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${$.ParentBasedAlwaysOn}".`),new ht({root:new nt})}}function qs(){return f.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${js}.`),js}const _u=128,pu=1/0;function fu(e){var r,n,s,i,o,a,u,l,h,d,p,_;const t=Object.assign({},e.spanLimits);return t.attributeCountLimit=(a=(o=(i=(s=(r=e.spanLimits)==null?void 0:r.attributeCountLimit)!=null?s:(n=e.generalLimits)==null?void 0:n.attributeCountLimit)!=null?i:void 0)!=null?o:void 0)!=null?a:_u,t.attributeValueLengthLimit=(_=(p=(d=(h=(u=e.spanLimits)==null?void 0:u.attributeValueLengthLimit)!=null?h:(l=e.generalLimits)==null?void 0:l.attributeValueLengthLimit)!=null?d:void 0)!=null?p:void 0)!=null?_:pu,Object.assign({},e,{spanLimits:t})}class mu extends lu{constructor(t={}){const r=Ic({},hu(),fu(t));delete r.generalLimits,super(r)}}class gu extends iu{constructor(t,r){r||(r={});const n=[["maxExportBatchSize","OTEL_BSP_MAX_EXPORT_BATCH_SIZE"],["maxQueueSize","OTEL_BSP_MAX_QUEUE_SIZE"],["scheduledDelayMillis","OTEL_BSP_SCHEDULE_DELAY"],["exportTimeoutMillis","OTEL_BSP_EXPORT_TIMEOUT"]];for(const[s,i]of n)r[s];super({exporter:t,...r})}}class Eu{constructor(){c(this,"_enabled",!1);c(this,"_currentContext",et)}_bindFunction(t=et,r){const n=this,s=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(s,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),s}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=et,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=et,this)}with(t,r,n,...s){const i=this._currentContext;this._currentContext=t||et;try{return r.call(n,...s)}finally{this._currentContext=i}}}function Tu(e){if(e!==null){if(e===void 0){const t=new Eu;t.enable(),R.setGlobalContextManager(t);return}e.enable(),R.setGlobalContextManager(e)}}function Su(e){if(e!==null){if(e===void 0){U.setGlobalPropagator(new ic({propagators:[new Tc,new $a]}));return}U.setGlobalPropagator(e)}}class Au extends mu{constructor(t={}){super(t)}register(t={}){w.setGlobalTracerProvider(this),Su(t.propagator),Tu(t.contextManager)}}var S;(function(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"})(S||(S={}));const Ru="http.response_content_length",bu="http.response_content_length_uncompressed";let br;function wu(){return br||(br=document.createElement("a")),br}function dt(e,t){return t in e}function C(e,t,r,n=!0){if(dt(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function _t(e,t,r=!1,n,s){if(n===void 0&&(n=t[S.START_TIME]!==0),r||(C(e,S.FETCH_START,t,n),C(e,S.DOMAIN_LOOKUP_START,t,n),C(e,S.DOMAIN_LOOKUP_END,t,n),C(e,S.CONNECT_START,t,n),C(e,S.SECURE_CONNECTION_START,t,n),C(e,S.CONNECT_END,t,n),C(e,S.REQUEST_START,t,n),C(e,S.RESPONSE_START,t,n),C(e,S.RESPONSE_END,t,n)),!s){const i=t[S.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(Ru,i);const o=t[S.DECODED_BODY_SIZE];o!==void 0&&i!==o&&e.setAttribute(bu,o)}}function Ou(e){return e.slice().sort((t,r)=>{const n=t[S.FETCH_START],s=r[S.FETCH_START];return n>s?1:n<s?-1:0})}function Ws(){return typeof location<"u"?location.origin:void 0}function Xs(e,t,r,n,s=new WeakSet,i){const o=K(e);e=o.toString();const a=yu(e,t,r,n,s,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};const u=Ou(a);if(o.origin!==Ws()&&u.length>1){let l=u[0],h=Cu(u,l[S.RESPONSE_END],r);const d=l[S.RESPONSE_END];return h[S.FETCH_START]<d&&(h=l,l=void 0),{corsPreFlightRequest:l,mainRequest:h}}else return{mainRequest:a[0]}}function Cu(e,t,r){const n=q(r),s=q(Dt(t));let i=e[1],o;const a=e.length;for(let u=1;u<a;u++){const l=e[u],h=q(Dt(l[S.FETCH_START])),d=q(Dt(l[S.RESPONSE_END])),p=n-d;h>=s&&(!o||p<o)&&(o=p,i=l)}return i}function yu(e,t,r,n,s,i){const o=q(t),a=q(r);let u=n.filter(l=>{const h=q(Dt(l[S.FETCH_START])),d=q(Dt(l[S.RESPONSE_END]));return l.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&l.name===e&&h>=o&&d<=a});return u.length>0&&(u=u.filter(l=>!s.has(l))),u}function K(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);const t=wu();return t.href=e,t}function Ys(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),K(e).origin===Ws()?!0:r.some(s=>xs(e,s))}var k;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(k||(k={}));var g;(function(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"})(g||(g={}));var V;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(V||(V={}));function Ks(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function Pu(e){var t,r;return`${e.name}:${(t=e.version)!=null?t:""}:${(r=e.schemaUrl)!=null?r:""}`}class Oe extends Error{constructor(t){super(t),Object.setPrototypeOf(this,Oe.prototype)}}function Gt(e,t){let r;const n=new Promise(function(i,o){r=setTimeout(function(){o(new Oe("Operation timed out."))},t)});return Promise.race([e,n]).then(s=>(clearTimeout(r),s),s=>{throw clearTimeout(r),s})}function Mu(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function vu(e,t){let r=0,n=e.length-1,s=e.length;for(;n>=r;){const i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(s=i,n=i-1)}return s}function Iu(e,t){return e.toLowerCase()===t.toLowerCase()}var it;(function(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"})(it||(it={}));class Nu{constructor(){c(this,"kind",it.DROP)}createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,s){}}function Lu(e){const t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}class wr{constructor(t,r,n=!0,s=Lu(r)){c(this,"startTime");c(this,"_boundaries");c(this,"_recordMinMax");c(this,"_current");this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=s}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);const r=vu(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}}class Qs{constructor(t,r){c(this,"kind",it.HISTOGRAM);c(this,"_boundaries");c(this,"_recordMinMax");this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new wr(t,this._boundaries,this._recordMinMax)}merge(t,r){const n=t.toPointValue(),s=r.toPointValue(),i=n.buckets.counts,o=s.buckets.counts,a=new Array(i.length);for(let h=0;h<i.length;h++)a[h]=i[h]+o[h];let u=1/0,l=-1/0;return this._recordMinMax&&(n.hasMinMax&&s.hasMinMax?(u=Math.min(n.min,s.min),l=Math.max(n.max,s.max)):n.hasMinMax?(u=n.min,l=n.max):s.hasMinMax&&(u=s.min,l=s.max)),new wr(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+s.count,sum:n.sum+s.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||s.hasMinMax),min:u,max:l})}diff(t,r){const n=t.toPointValue(),s=r.toPointValue(),i=n.buckets.counts,o=s.buckets.counts,a=new Array(i.length);for(let u=0;u<i.length;u++)a[u]=o[u]-i[u];return new wr(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:s.count-n.count,sum:s.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.HISTOGRAM,dataPoints:n.map(([i,o])=>{const a=o.toPointValue(),u=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:o.startTime,endTime:s,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:u?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}}class Ce{constructor(t=new un,r=0,n=0,s=0){c(this,"backing");c(this,"indexBase");c(this,"indexStart");c(this,"indexEnd");this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=s}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){const r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();const r=1+this.indexEnd-this.indexStart,n=1<<t;let s=0,i=0;for(let o=this.indexStart;o<=this.indexEnd;){let a=o%n;a<0&&(a+=n);for(let u=a;u<n&&s<r;u++)this._relocateBucket(i,s),s++,o++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new Ce(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){const t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}}class un{constructor(t=[0]){c(this,"_counts");this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){const s=new Array(t).fill(0);s.splice(n,this._counts.length-r,...this._counts.slice(r)),s.splice(0,r,...this._counts.slice(0,r)),this._counts=s}reverse(t,r){const n=Math.floor((t+r)/2)-t;for(let s=0;s<n;s++){const i=this._counts[t+s];this._counts[t+s]=this._counts[r-s-1],this._counts[r-s-1]=i}}emptyBucket(t){const r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new un([...this._counts])}}const xu=52,Uu=2146435072,Du=1048575,Or=1023,Js=-Or+1,Zs=Or,Cr=Math.pow(2,-1022);function ti(e){const t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&Uu)>>20)-Or}function ei(e){const t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);const r=t.getUint32(0),n=t.getUint32(4);return(r&Du)*Math.pow(2,32)+n}function yr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function ku(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}class Ft extends Error{}class Bu{constructor(t){c(this,"_shift");this._shift=-t}mapToIndex(t){if(t<Cr)return this._minNormalLowerBoundaryIndex();const r=ti(t),n=this._rightShift(ei(t)-1,xu);return r+n>>this._shift}lowerBoundary(t){const r=this._minNormalLowerBoundaryIndex();if(t<r)throw new Ft(`underflow: ${t} is < minimum lower boundary: ${r}`);const n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new Ft(`overflow: ${t} is > maximum lower boundary: ${n}`);return yr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=Js>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return Zs>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}}class Gu{constructor(t){c(this,"_scale");c(this,"_scaleFactor");c(this,"_inverseFactor");this._scale=t,this._scaleFactor=yr(Math.LOG2E,t),this._inverseFactor=yr(Math.LN2,-t)}mapToIndex(t){if(t<=Cr)return this._minNormalLowerBoundaryIndex()-1;if(ei(t)===0)return(ti(t)<<this._scale)-1;const r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){const r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new Ft(`overflow: ${t} is > maximum lower boundary: ${r}`)}const n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return Cr;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new Ft(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Js<<this._scale}_maxNormalLowerBoundaryIndex(){return(Zs+1<<this._scale)-1}}const ri=-10,ni=20,Fu=Array.from({length:31},(e,t)=>t>10?new Gu(t-10):new Bu(t-10));function si(e){if(e>ni||e<ri)throw new Ft(`expected scale >= ${ri} && <= ${ni}, got: ${e}`);return Fu[e+10]}class Et{constructor(t,r){c(this,"low");c(this,"high");this.low=t,this.high=r}static combine(t,r){return new Et(Math.min(t.low,r.low),Math.max(t.high,r.high))}}const $u=20,Vu=160,Pr=2;class ln{constructor(t,r=Vu,n=!0,s=0,i=0,o=0,a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,l=new Ce,h=new Ce,d=si($u)){c(this,"startTime");c(this,"_maxSize");c(this,"_recordMinMax");c(this,"_sum");c(this,"_count");c(this,"_zeroCount");c(this,"_min");c(this,"_max");c(this,"_positive");c(this,"_negative");c(this,"_mapping");this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=s,this._count=i,this._zeroCount=o,this._min=a,this._max=u,this._positive=l,this._negative=h,this._mapping=d,this._maxSize<Pr&&(f.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${Pr}`),this._maxSize=Pr)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;const r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;const r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new ln(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let s=this._mapping.mapToIndex(r),i=!1,o=0,a=0;if(t.length===0?(t.indexStart=s,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):s<t.indexStart&&t.indexEnd-s>=this._maxSize?(i=!0,a=s,o=t.indexEnd):s>t.indexEnd&&s-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,o=s),i){const u=this._changeScale(o,a);this._downscale(u),s=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,s,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){const i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){const i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let s=r-t.indexBase;s<0&&(s+=t.backing.length),t.incrementBucket(s,n)}_grow(t,r){const n=t.backing.length,s=t.indexBase-t.indexStart,i=n-s;let o=ku(r);o>this._maxSize&&(o=this._maxSize);const a=o-s;t.backing.growTo(o,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);const r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=si(r)}_minScale(t){const r=Math.min(this.scale,t.scale),n=Et.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),s=Et.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(s.high,s.low))}_highLowAtScale(t,r,n){if(t.length===0)return new Et(0,-1);const s=r-n;return new Et(t.indexStart>>s,t.indexEnd>>s)}_mergeBuckets(t,r,n,s){const i=n.offset,o=r.scale-s;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>o,n.at(a))}_diffBuckets(t,r,n,s){const i=n.offset,o=r.scale-s;for(let a=0;a<n.length;a++){let l=(i+a>>o)-t.indexBase;l<0&&(l+=t.backing.length),t.decrementBucket(l,n.at(a))}t.trim()}}class Hu{constructor(t,r){c(this,"kind",it.EXPONENTIAL_HISTOGRAM);c(this,"_maxSize");c(this,"_recordMinMax");this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new ln(t,this._maxSize,this._recordMinMax)}merge(t,r){const n=r.clone();return n.merge(t),n}diff(t,r){const n=r.clone();return n.diff(t),n}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,o])=>{const a=o.toPointValue(),u=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:o.startTime,endTime:s,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:u?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}}class Mr{constructor(t,r=0,n=[0,0]){c(this,"startTime");c(this,"_current");c(this,"sampleTime");this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=N(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}}class zu{constructor(){c(this,"kind",it.LAST_VALUE)}createAccumulation(t){return new Mr(t)}merge(t,r){const n=ie(r.sampleTime)>=ie(t.sampleTime)?r:t;return new Mr(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){const n=ie(r.sampleTime)>=ie(t.sampleTime)?r:t;return new Mr(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.GAUGE,dataPoints:n.map(([i,o])=>({attributes:i,startTime:o.startTime,endTime:s,value:o.toPointValue()}))}}}class $t{constructor(t,r,n=0,s=!1){c(this,"startTime");c(this,"monotonic");c(this,"_current");c(this,"reset");this.startTime=t,this.monotonic=r,this._current=n,this.reset=s}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}}class ii{constructor(t){c(this,"kind",it.SUM);c(this,"monotonic");this.monotonic=t}createAccumulation(t){return new $t(t,this.monotonic)}merge(t,r){const n=t.toPointValue(),s=r.toPointValue();return r.reset?new $t(r.startTime,this.monotonic,s,r.reset):new $t(t.startTime,this.monotonic,n+s)}diff(t,r){const n=t.toPointValue(),s=r.toPointValue();return this.monotonic&&n>s?new $t(r.startTime,this.monotonic,s,!0):new $t(r.startTime,this.monotonic,s-n)}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.SUM,dataPoints:n.map(([i,o])=>({attributes:i,startTime:o.startTime,endTime:s,value:o.toPointValue()})),isMonotonic:this.monotonic}}}const Pe=class Pe{createAggregator(t){return Pe.DEFAULT_INSTANCE}};c(Pe,"DEFAULT_INSTANCE",new Nu);let vr=Pe;const Tt=class Tt{createAggregator(t){switch(t.type){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.HISTOGRAM:return Tt.MONOTONIC_INSTANCE;default:return Tt.NON_MONOTONIC_INSTANCE}}};c(Tt,"MONOTONIC_INSTANCE",new ii(!0)),c(Tt,"NON_MONOTONIC_INSTANCE",new ii(!1));let Ir=Tt;const Me=class Me{createAggregator(t){return Me.DEFAULT_INSTANCE}};c(Me,"DEFAULT_INSTANCE",new zu);let Nr=Me;const ve=class ve{createAggregator(t){return ve.DEFAULT_INSTANCE}};c(ve,"DEFAULT_INSTANCE",new Qs([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));let Lr=ve;class oi{constructor(t,r=!0){c(this,"_boundaries");c(this,"_recordMinMax");if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,o)=>i-o);const n=t.lastIndexOf(-1/0);let s=t.indexOf(1/0);s===-1&&(s=void 0),this._boundaries=t.slice(n+1,s),this._recordMinMax=r}createAggregator(t){return new Qs(this._boundaries,this._recordMinMax)}}class ju{constructor(t=160,r=!0){c(this,"_maxSize");c(this,"_recordMinMax");this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new Hu(this._maxSize,this._recordMinMax)}}class qu{_resolve(t){switch(t.type){case g.COUNTER:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return ci;case g.GAUGE:case g.OBSERVABLE_GAUGE:return ui;case g.HISTOGRAM:return t.advice.explicitBucketBoundaries?new oi(t.advice.explicitBucketBoundaries):li}return f.warn(`Unable to recognize instrument type: ${t.type}`),ai}createAggregator(t){return this._resolve(t).createAggregator(t)}}const ai=new vr,ci=new Ir,ui=new Nr,li=new Lr,Wu=new qu;var B;(function(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"})(B||(B={}));function hi(e){var t,r,n,s;switch(e.type){case B.DEFAULT:return Wu;case B.DROP:return ai;case B.SUM:return ci;case B.LAST_VALUE:return ui;case B.EXPONENTIAL_HISTOGRAM:{const i=e;return new ju((t=i.options)==null?void 0:t.maxSize,(r=i.options)==null?void 0:r.recordMinMax)}case B.EXPLICIT_BUCKET_HISTOGRAM:{const i=e;return i.options==null?li:new oi((n=i.options)==null?void 0:n.boundaries,(s=i.options)==null?void 0:s.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}const Xu=e=>({type:B.DEFAULT}),Yu=e=>k.CUMULATIVE,Ku="otel.component.name",Qu="otel.component.type",Ju="periodic_metric_reader",Zu="otel.sdk.metric_reader.collection.duration",tl="error.type",di=new Map;class _i{constructor(t,r){c(this,"collectionDuration");c(this,"standardAttrs");var s;const n=(s=di.get(t))!=null?s:0;di.set(t,n+1),this.standardAttrs={[Qu]:t,[Ku]:`${t}/${n}`},this.collectionDuration=r.createHistogram(Zu,{unit:"s",description:"The duration of the collect operation of the metric reader.",advice:{explicitBucketBoundaries:[]}})}recordCollection(t,r){const n=r?{...this.standardAttrs,[tl]:r}:this.standardAttrs;this.collectionDuration.record(t,n)}}const el="2.10.0";class pi{constructor(t){c(this,"_shutdown",!1);c(this,"_metricProducers");c(this,"_sdkMetricProducer");c(this,"_selfObsMetrics");c(this,"_aggregationTemporalitySelector");c(this,"_aggregationSelector");c(this,"_cardinalitySelector");c(this,"_otelComponentType");var r,n,s,i;this._aggregationSelector=(r=t==null?void 0:t.aggregationSelector)!=null?r:Xu,this._aggregationTemporalitySelector=(n=t==null?void 0:t.aggregationTemporalitySelector)!=null?n:Yu,this._metricProducers=(s=t==null?void 0:t.metricProducers)!=null?s:[],this._cardinalitySelector=t==null?void 0:t.cardinalitySelector,this._otelComponentType=(i=t==null?void 0:t.otelComponentType)!=null?i:this.constructor.name,this._selfObsMetrics=new _i(this._otelComponentType,Mt())}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}_setSelfObsMeterProvider(t){const r=t.getMeter("@opentelemetry/sdk-metrics",el);this._selfObsMetrics=new _i(this._otelComponentType,r)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){var h;if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");const r=G(),[n,...s]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t==null?void 0:t.timeoutMillis}),...this._metricProducers.map(d=>d.collect({timeoutMillis:t==null?void 0:t.timeoutMillis}))]),i=G(),o=n.errors.concat(s.flatMap(d=>d.errors)),a=sc(pr(r,i));this._selfObsMetrics.recordCollection(a,o.length>0?(h=o[0].name)!=null?h:"collect_error":void 0);const u=n.resourceMetrics.resource,l=n.resourceMetrics.scopeMetrics.concat(s.flatMap(d=>d.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:u,scopeMetrics:l},errors:o}}async shutdown(t){if(this._shutdown){f.error("Cannot call shutdown twice.");return}(t==null?void 0:t.timeoutMillis)==null?await this.onShutdown():await Gt(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){f.warn("Cannot forceFlush on already shutdown MetricReader.");return}if((t==null?void 0:t.timeoutMillis)==null){await this.onForceFlush();return}await Gt(this.onForceFlush(),t.timeoutMillis)}}function rl(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("maxExportBatchSize must be a positive integer");const r=[];let n=0,s=[];function i(){s.length>0&&(r.push({resource:e.resource,scopeMetrics:s}),s=[],n=0)}for(const o of e.scopeMetrics){let a=null;for(const u of o.metrics){const l=u.dataPoints;if(l.length===0){a||(a={scope:o.scope,metrics:[]},s.push(a)),a.metrics.push(u);continue}let h=0;for(;h<l.length;){const d=t-n,p=Math.min(d,l.length-h);a||(a={scope:o.scope,metrics:[]},s.push(a));const _={...u,dataPoints:l.slice(h,h+p)};a.metrics.push(_),h+=p,n+=p,n===t&&(i(),a=null)}}}return i(),r}class nl extends pi{constructor(r){var l,h;const{exporter:n,exportIntervalMillis:s=6e4,metricProducers:i,cardinalityLimits:o,maxExportBatchSize:a}=r;let{exportTimeoutMillis:u=3e4}=r;super({aggregationSelector:(l=n.selectAggregation)==null?void 0:l.bind(n),aggregationTemporalitySelector:(h=n.selectAggregationTemporality)==null?void 0:h.bind(n),otelComponentType:Ju,metricProducers:i,cardinalitySelector:d=>{var _,E,m,T,A,M,y;const p={default:2e3,...o};switch(d){case g.COUNTER:return(_=p.counter)!=null?_:p.default;case g.GAUGE:return(E=p.gauge)!=null?E:p.default;case g.HISTOGRAM:return(m=p.histogram)!=null?m:p.default;case g.OBSERVABLE_COUNTER:return(T=p.observableCounter)!=null?T:p.default;case g.OBSERVABLE_UP_DOWN_COUNTER:return(A=p.observableUpDownCounter)!=null?A:p.default;case g.OBSERVABLE_GAUGE:return(M=p.observableGauge)!=null?M:p.default;case g.UP_DOWN_COUNTER:return(y=p.upDownCounter)!=null?y:p.default;default:return p.default}}});c(this,"_interval");c(this,"_exporter");c(this,"_exportInterval");c(this,"_exportTimeout");c(this,"_maxExportBatchSize");c(this,"_ongoingExportPromise",null);if(s<=0)throw Error("exportIntervalMillis must be greater than 0");if(u<=0)throw Error("exportTimeoutMillis must be greater than 0");if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error("maxExportBatchSize must be a positive integer");if(s<u){if("exportIntervalMillis"in r&&"exportTimeoutMillis"in r)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");f.info(`Timeout of ${u} exceeds the interval of ${s}. Clamping timeout to interval duration.`),u=s}this._exportInterval=s,this._exportTimeout=u,this._exporter=n,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(r){Y(r)}}async _doRun(){if(this._ongoingExportPromise){f.debug("PeriodicExportingMetricReader: export already in progress, skipping");return}const r=async()=>{var a,u;const{resourceMetrics:n,errors:s}=await this.collect({timeoutMillis:this._exportTimeout});if(s.length>0&&f.error("PeriodicExportingMetricReader: metrics collection errors",...s),n.resource.asyncAttributesPending)try{await((u=(a=n.resource).waitForAsyncAttributes)==null?void 0:u.call(a))}catch(l){f.debug("Error while resolving async portion of resource: ",l),Y(l)}if(n.scopeMetrics.length===0)return;const i=this._maxExportBatchSize?rl(n,this._maxExportBatchSize):[n];let o=null;for(const l of i)try{const h=await Gt(Dc._export(this._exporter,l),this._exportTimeout);h.code!==D.SUCCESS&&(o=new Error(`PeriodicExportingMetricReader: metrics export failed (error ${h.error})`))}catch(h){if(h instanceof Oe){f.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else f.error("PeriodicExportingMetricReader: metrics export threw error",h),o=h instanceof Error?h:new Error(String(h))}if(o)throw o};this._ongoingExportPromise=r();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){f.debug("PeriodicExportingMetricReader: export already in progress, awaiting ongoing export");try{await this._ongoingExportPromise}catch(r){}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}class sl{constructor(){c(this,"_registeredViews",[])}addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(s=>this._matchInstrument(s.instrumentSelector,t)&&this._matchMeter(s.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}}function Q(e,t,r){var n,s,i,o;return cl(e)||f.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(n=r==null?void 0:r.description)!=null?n:"",unit:(s=r==null?void 0:r.unit)!=null?s:"",valueType:(i=r==null?void 0:r.valueType)!=null?i:X.DOUBLE,advice:(o=r==null?void 0:r.advice)!=null?o:{}}}function il(e,t){var r,n;return{name:(r=e.name)!=null?r:t.name,description:(n=e.description)!=null?n:t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function ol(e,t){return Iu(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}const al=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function cl(e){return al.test(e)}class he{constructor(t,r){c(this,"_writableMetricStorage");c(this,"_descriptor");this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n){if(typeof t!="number"){f.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===X.INT&&!Number.isInteger(t)&&(f.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,Date.now())}}class ul extends he{add(t,r,n){this._record(t,r,n)}}class ll extends he{add(t,r,n){if(t<0){f.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}}class hl extends he{record(t,r,n){this._record(t,r,n)}}class dl extends he{record(t,r,n){if(t<0){f.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}}class de{constructor(t,r,n){c(this,"_metricStorages");c(this,"_descriptor");c(this,"_observableRegistry");this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}}class _l extends de{}class pl extends de{}class fl extends de{}function xr(e){return e instanceof de}class ml{constructor(t){c(this,"_meterSharedState");this._meterSharedState=t}createGauge(t,r){const n=Q(t,g.GAUGE,r),s=this._meterSharedState.registerMetricStorage(n);return new hl(s,n)}createHistogram(t,r){const n=Q(t,g.HISTOGRAM,r),s=this._meterSharedState.registerMetricStorage(n);return new dl(s,n)}createCounter(t,r){const n=Q(t,g.COUNTER,r),s=this._meterSharedState.registerMetricStorage(n);return new ll(s,n)}createUpDownCounter(t,r){const n=Q(t,g.UP_DOWN_COUNTER,r),s=this._meterSharedState.registerMetricStorage(n);return new ul(s,n)}createObservableGauge(t,r){const n=Q(t,g.OBSERVABLE_GAUGE,r),s=this._meterSharedState.registerAsyncMetricStorage(n);return new pl(n,s,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){const n=Q(t,g.OBSERVABLE_COUNTER,r),s=this._meterSharedState.registerAsyncMetricStorage(n);return new _l(n,s,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){const n=Q(t,g.OBSERVABLE_UP_DOWN_COUNTER,r),s=this._meterSharedState.registerAsyncMetricStorage(n);return new fl(n,s,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}}class fi{constructor(t){c(this,"_instrumentDescriptor");this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=Q(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}class gl{constructor(t){c(this,"_valueMap",new Map);c(this,"_keyMap",new Map);c(this,"_hash");this._hash=t}get(t,r){return r!=null||(r=this._hash(t)),this._valueMap.get(r)}getOrDefault(t,r){const n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);const s=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,s),s}set(t,r,n){n!=null||(n=this._hash(t)),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r!=null||(r=this._hash(t)),this._valueMap.has(r)}*keys(){const t=this._keyMap.entries();let r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){const t=this._valueMap.entries();let r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}}class ot extends gl{constructor(){super(Ks)}}class mi{constructor(t,r){c(this,"_activeCollectionStorage",new ot);c(this,"_cumulativeMemoStorage",new ot);c(this,"_cardinalityLimit");c(this,"_overflowAttributes",{"otel.metric.overflow":!0});c(this,"_overflowHashCode");c(this,"_aggregator");this._aggregator=t,this._cardinalityLimit=(r!=null?r:2e3)-1,this._overflowHashCode=Ks(this._overflowAttributes)}record(t,r,n){let s=this._activeCollectionStorage.get(r);if(!s){const i=N(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){const o=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i));o==null||o.record(t);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(r,s)}s==null||s.record(t)}batchCumulate(t,r){for(const[n,s,i]of t.entries()){let o=n,a=i;const u=this._aggregator.createAccumulation(r);u==null||u.record(s);let l=u;if(this._cumulativeMemoStorage.has(o,a)){const h=this._cumulativeMemoStorage.get(o,a);l=this._aggregator.diff(h,u)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(o=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(o,a))){const h=this._cumulativeMemoStorage.get(o,a);l=this._aggregator.diff(h,u)}if(this._activeCollectionStorage.has(o,a)){const h=this._activeCollectionStorage.get(o,a);l=this._aggregator.merge(h,l)}this._cumulativeMemoStorage.set(o,u,a),this._activeCollectionStorage.set(o,l,a)}}collect(){const t=this._activeCollectionStorage;return this._activeCollectionStorage=new ot,t}}class St{constructor(t,r){c(this,"_aggregator");c(this,"_unreportedAccumulations",new Map);c(this,"_reportHistory",new Map);this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,s){this._stashAccumulations(n);const i=this._getMergedUnreportedAccumulations(t);let o=i,a;if(this._reportHistory.has(t)){const l=this._reportHistory.get(t),h=l.collectionTime;a=l.aggregationTemporality,a===k.CUMULATIVE?o=St.merge(l.accumulations,i,this._aggregator):o=St.calibrateStartTime(l.accumulations,i,h)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:o,collectionTime:s,aggregationTemporality:a});const u=El(o);if(u.length!==0)return this._aggregator.toMetricData(r,a,u,s)}_stashAccumulations(t){const r=this._unreportedAccumulations.keys();for(const n of r){let s=this._unreportedAccumulations.get(n);s===void 0&&(s=[],this._unreportedAccumulations.set(n,s)),s.push(t)}}_getMergedUnreportedAccumulations(t){let r=new ot;const n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(const s of n)r=St.merge(r,s,this._aggregator);return r}static merge(t,r,n){const s=t,i=r.entries();let o=i.next();for(;o.done!==!0;){const[a,u,l]=o.value;if(t.has(a,l)){const h=t.get(a,l),d=n.merge(h,u);s.set(a,d,l)}else s.set(a,u,l);o=i.next()}return s}static calibrateStartTime(t,r,n){for(const[s,i]of t.keys()){const o=r.get(s,i);o==null||o.setStartTime(n)}return r}}function El(e){return Array.from(e.entries())}class Tl extends fi{constructor(r,n,s,i,o){super(r);c(this,"_aggregationCardinalityLimit");c(this,"_deltaMetricStorage");c(this,"_temporalMetricStorage");c(this,"_attributesProcessor");this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new mi(n,this._aggregationCardinalityLimit),this._temporalMetricStorage=new St(n,i),this._attributesProcessor=s}record(r,n){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(r,n);return}const s=new ot;for(const[i,o]of r.entries())s.set(this._attributesProcessor.process(i),o);this._deltaMetricStorage.batchCumulate(s,n)}collect(r,n){const s=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,s,n)}}function gi(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
1
+ var wo=Object.defineProperty;var Oo=(e,t,r)=>t in e?wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var c=(e,t,r)=>Oo(e,typeof t!="symbol"?t+"":t,r);import{__decorate as _n}from"tslib";import{LitElement as pn,html as lt}from"lit";import{property as fn}from"lit/decorators.js";import{ApplicationInsights as Co,DistributedTracingModes as yo}from"@microsoft/applicationinsights-web";import{authedUser as mn}from"@digital-realty/ix-account-switcher";import{UserManager as Po}from"oidc-client-ts";import"@digital-realty/ix-app-logic/views/splash-screen.js";import{makeObservable as Mo,action as vo,observable as Io,toJS as No}from"mobx";function P(){var e;const t=(e=window.gpConfig)==null?void 0:e["app-shell"];if(!t)throw new Error("App-shell config not loaded. Ensure config.json is fetched before app bootstrap.");return t}const{PortalInterxion:Lo,PortalGlobalPortal:xo,PortalServiceFabric:Uo,PortalMarketplacePortal:Do}=P(),gn={strict:"strictly_necessary",performance:"performance",targeting:"targeting"},En={accept:"accept_all",reject:"reject_all",custom:"customize",no:"no_sell",bypass:"gpc_bypass"},Kt="globalportalappshell",Rt="user-authentication",Qt="redirect-url",Tn="ui-cookie-policy",Sn="date-format",Ie="Global Portal",Ne="Service Fabric",Le="Marketplace Portal",xe="EMEA Customer Portal",Ue="x-auth",[bt,An,Rn,bn]=["CREATE","UPDATE","READ","APPROVE"],[De,Jt,wn,On,ke,Cn,ko,yn,Be,Bo,Pn,Mn,Ge,Fe,$e,Go,vn,Fo,In,Ve,He,ze,Nn,je,Ln,xn,qe,Un]=["Cloud Connect","Cross Connect","Custom Roles","Customer Care","Customer Equipment Connection (CEC)","Customer Support","DCIM-enabled location data","Default System Roles","External User","Facility Access","Internal Roles","Internal User","Internet Exchange","Intra-Customer Connectivity (ICC)","IP Bandwidth","OSP Access","Permanent Badge","PoP/POE Room Access","Remote Hands","Remote Hands Package","Service Exchange Cloud Router","Service Exchange Port","Shipping & Receiving","Space & Power","Trouble Ticket","Visitor Access","User","ESG Reporting"],Dn=[In,Cn,Ln,Nn,xn,vn,On],kn=[Jt,De,ke,Ge,Fe,$e,Ve,He,ze,je],Bn=[Jt,De,ke,Ge,Fe,$e,Ve,He,ze,je],Gn={LocationChanged:"location-changed",VaadinRouterLocationChanged:"vaadin-router-location-changed",CreateUserClicked:"create-user-clicked",NavigateToConnectivityByPanel:"navigate-inventory-by-panel",NavigateToConnectivityByPort:"navigate-inventory-by-port"},We={SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges",ShowLastLoginPopup:"showLastLoginPopup"}},[Fn,$n,Vn]=["Security","DCIM","Planned Site Maintenance"],Hn=[Fn,$n,Vn],zn=[{label:Ie,href:xo,selected:!0},{label:Le,href:Do},{label:xe,href:Lo},{label:Ne,href:Uo,target:"_blank"}];var $o=Object.freeze({__proto__:null,APPROVE:bn,ApplicationEvents:Gn,ApplicationName:Kt,ApplicationStorage:We,CLOUD_CONNECT:De,CPAppName:Tn,CREATE:bt,CROSS_CONNECT:Jt,CUSTOMER_CARE:On,CUSTOMER_EQUIPMENT_CONNECTION_CEC:ke,CUSTOMER_SUPPORT:Cn,CUSTOM_ROLES:wn,CookieName:gn,CookieUserAction:En,DCIM:$n,DCIM_ENABLED_LOCATION_DATA:ko,DEFAULT_SYSTEM_ROLES:yn,DateFormatKey:Sn,EED_REPORTING:Un,EMEA_PORTAL:xe,EXTERNAL_USER:Be,FACILITY_ACCESS:Bo,GLOBAL_PORTAL:Ie,INTERNAL_ROLES:Pn,INTERNAL_USER:Mn,INTERNET_EXCHANGE:Ge,INTRA_CUSTOMER_CONNECTIVITY_ICC:Fe,INVENTORY_ORDER_PERMISSIONS:kn,IP_BANDWIDTH:$e,IntraportalNavItems:zn,IxUserStorageKey:Rt,MARKETPLACE_PORTAL:Le,ORDER_MANAGEMENT_PERMISSIONS:Bn,OSP_ACCESS:Go,PERMANENT_BADGE:vn,PLANNED_MAINTENANCE:Vn,POP_ROOM_ACCESS:Fo,READ:Rn,REMOTE_HANDS:In,REMOTE_HANDS_PACKAGE:Ve,REPORTS_AND_MAINTENANCE_NAV_PERMISSIONS:Hn,RedirectUrlKey:Qt,SECURITY:Fn,SERVICE_EXCHANGE_CLOUD_ROUTER:He,SERVICE_EXCHANGE_PORT:ze,SERVICE_FABRIC:Ne,SERVICE_MANAGEMENT_NAV_PERMISSIONS:Dn,SHIPPING_RECEIVING:Nn,SPACE_AND_POWER:je,TROUBLE_TICKET:Ln,UPDATE:An,USER:qe,VISITOR_ACCESS:xn,xAuth:Ue});const Zt={appInsights:"_appInsights",otel:"_otel"},Vo=()=>{const{ApplicationInsightsInstrumentationKey:e,ApplicationInsightsCorrelationHeaderExcludedDomains:t}=P(),r=new Co({config:{instrumentationKey:e,enableCorsCorrelation:!0,enableRequestHeaderTracking:!0,enableResponseHeaderTracking:!0,enableAutoRouteTracking:!0,autoTrackPageVisitTime:!0,enableAjaxErrorStatusText:!0,enableAjaxPerfTracking:!0,enableUnhandledPromiseRejectionTracking:!0,isCookieUseDisabled:!0,distributedTracingMode:yo.AI_AND_W3C,correlationHeaderExcludedDomains:t.split(",").map(n=>n.trim())}});return r.loadAppInsights(),r.trackPageView(),r.addTelemetryInitializer(n=>{n.tags["ai.cloud.role"]=Kt}),r},te=(e,t,r)=>(...n)=>{const[s,...i]=n;typeof s=="string"&&s.startsWith("[mobx]")&&t===4?r.trackException({exception:{message:i[0].message,stack:i[0].stack,name:s},severityLevel:4}):r.trackTrace({severityLevel:t,message:s},i),e.apply(console,[s,...i])},Ho=e=>{console.log=te(console.log,2,e),console.info=te(console.info,2,e),console.warn=te(console.warn,3,e),console.error=te(console.error,4,e),window.console=console},zo=()=>{const{ApplicationInsightsInstrumentationKey:e}=P();if(!e)return;const t=Vo();window[Zt.appInsights]=t,window.dispatchEvent(new Event("appInsightsInitialized")),Ho(t)},Z="1.9.1",jn=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function jo(e){const t=new Set([e]),r=new Set,n=e.match(jn);if(!n)return()=>!1;const s={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(s.prerelease!=null)return function(u){return u===e};function i(a){return r.add(a),!1}function o(a){return t.add(a),!0}return function(u){if(t.has(u))return!0;if(r.has(u))return!1;const l=u.match(jn);if(!l)return i(u);const h={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return h.prerelease!=null||s.major!==h.major?i(u):s.major===0?s.minor===h.minor&&s.patch<=h.patch?o(u):i(u):s.minor<=h.minor?o(u):i(u)}}const qo=jo(Z),Wo=Z.split(".")[0],wt=Symbol.for(`opentelemetry.js.api.${Wo}`),Ot=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function Ct(e,t,r,n=!1){var s;const i=Ot[wt]=(s=Ot[wt])!==null&&s!==void 0?s:{version:Z};if(!n&&i[e]){const o=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(o.stack||o.message),!1}if(i.version!==Z){const o=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Z}`);return r.error(o.stack||o.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Z}.`),!0}function tt(e){var t,r;const n=(t=Ot[wt])===null||t===void 0?void 0:t.version;if(!(!n||!qo(n)))return(r=Ot[wt])===null||r===void 0?void 0:r[e]}function yt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Z}.`);const r=Ot[wt];r&&delete r[e]}class Xo{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return Pt("debug",this._namespace,t)}error(...t){return Pt("error",this._namespace,t)}info(...t){return Pt("info",this._namespace,t)}warn(...t){return Pt("warn",this._namespace,t)}verbose(...t){return Pt("verbose",this._namespace,t)}}function Pt(e,t,r){const n=tt("diag");if(n)return n[e](t,...r)}var b;(function(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"})(b||(b={}));function Yo(e,t){e<b.NONE?e=b.NONE:e>b.ALL&&(e=b.ALL),t=t||{};function r(n,s){const i=t[n];return typeof i=="function"&&e>=s?i.bind(t):function(){}}return{error:r("error",b.ERROR),warn:r("warn",b.WARN),info:r("info",b.INFO),debug:r("debug",b.DEBUG),verbose:r("verbose",b.VERBOSE)}}const Ko="diag";class x{static instance(){return this._instance||(this._instance=new x),this._instance}constructor(){function t(s){return function(...i){const o=tt("diag");if(o)return o[s](...i)}}const r=this,n=(s,i={logLevel:b.INFO})=>{var o,a,u;if(s===r){const d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=d.stack)!==null&&o!==void 0?o:d.message),!1}typeof i=="number"&&(i={logLevel:i});const l=tt("diag"),h=Yo((a=i.logLevel)!==null&&a!==void 0?a:b.INFO,s);if(l&&!i.suppressOverrideMessage){const d=(u=new Error().stack)!==null&&u!==void 0?u:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),h.warn(`Current logger will overwrite one already registered from ${d}`)}return Ct("diag",h,r,!0)};r.setLogger=n,r.disable=()=>{yt(Ko,r)},r.createComponentLogger=s=>new Xo(s),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}class mt{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){const r=this._entries.get(t);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,r){const n=new mt(this._entries);return n._entries.set(t,r),n}removeEntry(t){const r=new mt(this._entries);return r._entries.delete(t),r}removeEntries(...t){const r=new mt(this._entries);for(const n of t)r._entries.delete(n);return r}clear(){return new mt}}const Qo=Symbol("BaggageEntryMetadata"),Jo=x.instance();function Zo(e={}){return new mt(new Map(Object.entries(e)))}function ta(e){return typeof e!="string"&&(Jo.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:Qo,toString(){return e}}}function Xe(e){return Symbol.for(e)}class be{constructor(t){const r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,s)=>{const i=new be(r._currentContext);return i._currentContext.set(n,s),i},r.deleteValue=n=>{const s=new be(r._currentContext);return s._currentContext.delete(n),s}}}const et=new be;if(typeof console<"u"){const e=["error","warn","info","debug","trace","log"];for(const t of e);}class ea{constructor(){}createGauge(t,r){return la}createHistogram(t,r){return ha}createCounter(t,r){return ua}createUpDownCounter(t,r){return da}createObservableGauge(t,r){return pa}createObservableCounter(t,r){return _a}createObservableUpDownCounter(t,r){return fa}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}}class ee{}class ra extends ee{add(t,r){}}class na extends ee{add(t,r){}}class sa extends ee{record(t,r){}}class ia extends ee{record(t,r){}}class Ye{addCallback(t){}removeCallback(t){}}class oa extends Ye{}class aa extends Ye{}class ca extends Ye{}const qn=new ea,ua=new ra,la=new sa,ha=new ia,da=new na,_a=new oa,pa=new aa,fa=new ca;function Mt(){return qn}var X;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(X||(X={}));const ma={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},ga={set(e,t,r){e!=null&&(e[t]=r)}};class Ea{active(){return et}with(t,r,n,...s){return r.call(n,...s)}bind(t,r){return r}enable(){return this}disable(){return this}}const Ke="context",Ta=new Ea;class gt{constructor(){}static getInstance(){return this._instance||(this._instance=new gt),this._instance}setGlobalContextManager(t){return Ct(Ke,t,x.instance())}active(){return this._getContextManager().active()}with(t,r,n,...s){return this._getContextManager().with(t,r,n,...s)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return tt(Ke)||Ta}disable(){this._getContextManager().disable(),yt(Ke,x.instance())}}var z;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(z||(z={}));const Wn="0000000000000000",Xn="00000000000000000000000000000000",Yn={traceId:Xn,spanId:Wn,traceFlags:z.NONE};class vt{constructor(t=Yn){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}}const Qe=Xe("OpenTelemetry Context Key SPAN");function Je(e){return e.getValue(Qe)||void 0}function Sa(){return Je(gt.getInstance().active())}function Ze(e,t){return e.setValue(Qe,t)}function Aa(e){return e.deleteValue(Qe)}function Ra(e,t){return Ze(e,new vt(t))}function Kn(e){var t;return(t=Je(e))===null||t===void 0?void 0:t.spanContext()}const re=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Qn(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(re[e.charCodeAt(n)]|0)+(re[e.charCodeAt(n+1)]|0)+(re[e.charCodeAt(n+2)]|0)+(re[e.charCodeAt(n+3)]|0);return r===t}function Jn(e){return Qn(e,32)&&e!==Xn}function ba(e){return Qn(e,16)&&e!==Wn}function ne(e){return Jn(e.traceId)&&ba(e.spanId)}function wa(e){return new vt(e)}const tr=gt.getInstance();class Zn{startSpan(t,r,n=tr.active()){if(!!(r!=null&&r.root))return new vt;const i=n&&Kn(n);return Oa(i)&&ne(i)?new vt(i):new vt}startActiveSpan(t,r,n,s){let i,o,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,o=n,a=s);const u=o!=null?o:tr.active(),l=this.startSpan(t,i,u),h=Ze(u,l);return tr.with(h,a,void 0,l)}}function Oa(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}const Ca=new Zn;class ya{constructor(t,r,n,s){this._provider=t,this.name=r,this.version=n,this.options=s}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,s){const i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;const t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ca}}class Pa{getTracer(t,r,n){return new Zn}}const Ma=new Pa;class ts{getTracer(t,r,n){var s;return(s=this.getDelegateTracer(t,r,n))!==null&&s!==void 0?s:new ya(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Ma}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getTracer(t,r,n)}}var se;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(se||(se={}));var It;(function(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"})(It||(It={}));var j;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(j||(j={}));const R=gt.getInstance(),f=x.instance();class va{getMeter(t,r,n){return qn}}const Ia=new va,er="metrics";class sn{constructor(){}static getInstance(){return this._instance||(this._instance=new sn),this._instance}setGlobalMeterProvider(t){return Ct(er,t,x.instance())}getMeterProvider(){return tt(er)||Ia}getMeter(t,r,n){return this.getMeterProvider().getMeter(t,r,n)}disable(){yt(er,x.instance())}}const rr=sn.getInstance();class Na{inject(t,r){}extract(t,r){return t}fields(){return[]}}const nr=Xe("OpenTelemetry Baggage Key");function es(e){return e.getValue(nr)||void 0}function La(){return es(gt.getInstance().active())}function xa(e,t){return e.setValue(nr,t)}function Ua(e){return e.deleteValue(nr)}const sr="propagation",Da=new Na;class on{constructor(){this.createBaggage=Zo,this.getBaggage=es,this.getActiveBaggage=La,this.setBaggage=xa,this.deleteBaggage=Ua}static getInstance(){return this._instance||(this._instance=new on),this._instance}setGlobalPropagator(t){return Ct(sr,t,x.instance())}inject(t,r,n=ga){return this._getGlobalPropagator().inject(t,r,n)}extract(t,r,n=ma){return this._getGlobalPropagator().extract(t,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){yt(sr,x.instance())}_getGlobalPropagator(){return tt(sr)||Da}}const U=on.getInstance(),ir="trace";class an{constructor(){this._proxyTracerProvider=new ts,this.wrapSpanContext=wa,this.isSpanContextValid=ne,this.deleteSpan=Aa,this.getSpan=Je,this.getActiveSpan=Sa,this.getSpanContext=Kn,this.setSpan=Ze,this.setSpanContext=Ra}static getInstance(){return this._instance||(this._instance=new an),this._instance}setGlobalTracerProvider(t){const r=Ct(ir,this._proxyTracerProvider,x.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return tt(ir)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){yt(ir,x.instance()),this._proxyTracerProvider=new ts}}const w=an.getInstance(),rs=Xe("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function ns(e){return e.setValue(rs,!0)}function or(e){return e.getValue(rs)===!0}const ka="=",ss=";",is=",",ar="baggage",os=180,as=4096,cs=8192;function Ba(e){return e.reduce((t,r)=>{const n=`${t}${t!==""?is:""}${r}`;return n.length>cs?t:n},"")}function Ga(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=ss+r.metadata.toString()),n})}function Fa(e){if(!e)return;const t=e.indexOf(ss),r=t===-1?e:e.substring(0,t),n=r.indexOf(ka);if(n<=0)return;const s=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!s||!i)return;let o,a;try{o=decodeURIComponent(s),a=decodeURIComponent(i)}catch(l){return}let u;if(t!==-1&&t<e.length-1){const l=e.substring(t+1);u=ta(l)}return{key:o,value:a,metadata:u}}function us(e,t,r,n){let s=0;for(;s<e.length&&r<os;){const i=e.indexOf(is,s),o=i===-1?e.length:i,a=o-s;if(a<=as){const u=Fa(e.substring(s,o));if(u){const l=(r===0?0:1)+a;if(n+l>cs)break;t[u.key]=u.metadata?{value:u.value,metadata:u.metadata}:{value:u.value},r++,n+=l}}if(i===-1)break;s=i+1}return[r,n]}class $a{inject(t,r,n){const s=U.getBaggage(t);if(!s||or(t))return;const i=Ga(s).filter(a=>a.length<=as).slice(0,os),o=Ba(i);o.length>0&&n.set(r,ar,o)}extract(t,r,n){const s=n.get(r,ar);if(!s)return t;const i={};let o=0,a=0;if(Array.isArray(s))for(let u=0;u<s.length;u++)[o,a]=us(s[u],i,o,a);else[o]=us(s,i,o,a);return o===0?t:U.setBaggage(t,U.createBaggage(i))}fields(){return[ar]}}function Nt(e){const t={};if(typeof e!="object"||e==null)return t;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!Va(r)){f.warn(`Invalid attribute key: ${r}`);continue}const n=e[r];if(!ls(n)){f.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function Va(e){return typeof e=="string"&&e!==""}function ls(e){return e==null?!0:Array.isArray(e)?Ha(e):hs(typeof e)}function Ha(e){let t;for(const r of e){if(r==null)continue;const n=typeof r;if(n!==t){if(!t){if(hs(n)){t=n;continue}return!1}return!1}}return!0}function hs(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function za(){return e=>{f.error(ja(e))}}function ja(e){return typeof e=="string"?e:JSON.stringify(qa(e))}function qa(e){const t={};let r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;const s=r[n];s&&(t[n]=String(s))}),r=Object.getPrototypeOf(r);return t}let Wa=za();function Y(e){try{Wa(e)}catch(t){}}function $_(e){}const Xa="2.10.0",Lt="error.type",cr="exception.message",Ya="exception.stacktrace",ur="exception.type",ds="http.request.method",_s="http.request.method_original",ps="http.response.status_code",fs="server.address",ms="server.port",Ka="service.instance.id",gs="service.name",lr="telemetry.sdk.language",Qa="webjs",hr="telemetry.sdk.name",dr="telemetry.sdk.version",xt="url.full",Ja="user_agent.original",Za="process.runtime.name",_r={[hr]:"opentelemetry",[Za]:"browser",[lr]:Qa,[dr]:Xa},O=performance,tc=9,ec=6,rc=Math.pow(10,ec),Ut=Math.pow(10,tc);function N(e){const t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*rc);return[r,n]}function G(e){const t=N(O.timeOrigin),r=N(typeof e=="number"?e:O.now());return Ts(t,r)}function Dt(e){if(fr(e))return e;if(typeof e=="number")return e<O.timeOrigin/2?G(e):N(e);if(e instanceof Date)return N(e.getTime());throw TypeError("Invalid input type")}function pr(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=Ut),[r,n]}function q(e){return e[0]*Ut+e[1]}function ie(e){return e[0]*1e6+e[1]/1e3}function nc(e){return e[0]*1e3+e[1]/1e6}function sc(e){return e[0]+e[1]/Ut}function fr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Es(e){return fr(e)||typeof e=="number"||e instanceof Date}function Ts(e,t){const r=[e[0]+t[0],e[1]+t[1]];return r[1]>=Ut&&(r[1]-=Ut,r[0]+=1),r}var D;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(D||(D={}));class ic{constructor(t={}){c(this,"_propagators");c(this,"_fields");var n;this._propagators=(n=t.propagators)!=null?n:[];const r=new Set;for(const s of this._propagators){const i=typeof s.fields=="function"?s.fields():[];for(const o of i)r.add(o)}this._fields=Array.from(r)}inject(t,r,n){for(const s of this._propagators)try{s.inject(t,r,n)}catch(i){f.warn(`Failed to inject with ${s.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((s,i)=>{try{return i.extract(s,r,n)}catch(o){f.warn(`Failed to extract with ${i.constructor.name}. Err: ${o.message}`)}return s},t)}fields(){return this._fields.slice()}}const mr="[_0-9a-z-*/]",oc=`[a-z]${mr}{0,255}`,ac=`[a-z0-9]${mr}{0,240}@[a-z]${mr}{0,13}`,cc=new RegExp(`^(?:${oc}|${ac})$`),uc=/^[ -~]{0,255}[!-~]$/,lc=/,|=/;function Ss(e){return cc.test(e)}function As(e){return uc.test(e)&&!lc.test(e)}const hc=32,Rs=512,bs=",",ws="=";class cn{constructor(t){c(this,"_length");c(this,"_rawTraceState");c(this,"_internalState");this._rawTraceState=typeof t=="string"?t:"",this._length=this._rawTraceState.length}set(t,r){if(!Ss(t)||!As(r))return this;const n=this._getState(),s=n.get(t);let i=this._length;if(typeof s=="string"?i+=r.length-s.length:i+=t.length+r.length+(n.size>0?2:1),i>Rs)return this;const o=new Map(n);return o.delete(t),o.set(t,r),this._fromState(o,i)}unset(t){const r=this._getState(),n=r.get(t);if(typeof n!="string")return this;let s=this._length-(t.length+n.length+1);r.size>1&&(s=s-1);const i=new Map(r);return i.delete(t),this._fromState(i,s)}get(t){return this._getState().get(t)}serialize(){let t="",r=0;for(const n of this._getState())r>0&&(t=bs+t),t=`${n[0]}${ws}${n[1]}`+t,r++;return t}_getState(){if(this._internalState)return this._internalState;const t=this._rawTraceState.split(bs),r=new Map;let n=0;for(const s of t){const i=s.trim(),o=i.indexOf(ws);if(o===-1)continue;const a=i.slice(0,o),u=i.slice(o+1);if(!Ss(a)||!As(u))continue;const l=n+i.length+(r.size>0?1:0);if(!(l>Rs)&&(r.set(a,u),n=l,r.size>=hc))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(t,r){const n=Object.create(cn.prototype);return n._internalState=t,n._length=r,n}}const oe="traceparent",gr="tracestate",dc="00",_c="(?!ff)[\\da-f]{2}",pc="(?![0]{32})[\\da-f]{32}",fc="(?![0]{16})[\\da-f]{16}",mc="[\\da-f]{2}",gc=new RegExp(`^\\s?(${_c})-(${pc})-(${fc})-(${mc})(-.*)?\\s?$`);function Ec(e){const t=gc.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}class Tc{inject(t,r,n){const s=w.getSpanContext(t);if(!s||or(t)||!ne(s))return;const i=`${dc}-${s.traceId}-${s.spanId}-0${Number(s.traceFlags||z.NONE).toString(16)}`;n.set(r,oe,i),s.traceState&&n.set(r,gr,s.traceState.serialize())}extract(t,r,n){const s=n.get(r,oe);if(!s)return t;const i=Array.isArray(s)?s[0]:s;if(typeof i!="string")return t;const o=Ec(i);if(!o)return t;o.isRemote=!0;const a=n.get(r,gr);if(a){const u=Array.isArray(a)?a.join(","):a;o.traceState=new cn(typeof u=="string"?u:void 0)}return w.setSpanContext(t,o)}fields(){return[oe,gr]}}var Os;(function(e){e.HTTP="http"})(Os||(Os={}));const Sc="[object Object]",Ac="[object Null]",Rc="[object Undefined]",bc=Function.prototype,Cs=bc.toString,wc=Cs.call(Object),Oc=Object.getPrototypeOf,ys=Object.prototype,Ps=ys.hasOwnProperty,rt=Symbol?Symbol.toStringTag:void 0,Ms=ys.toString;function vs(e){if(!Cc(e)||yc(e)!==Sc)return!1;const t=Oc(e);if(t===null)return!0;const r=Ps.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Cs.call(r)===wc}function Cc(e){return e!=null&&typeof e=="object"}function yc(e){return e==null?e===void 0?Rc:Ac:rt&&rt in Object(e)?Pc(e):Mc(e)}function Pc(e){const t=Ps.call(e,rt),r=e[rt];let n=!1;try{e[rt]=void 0,n=!0}catch(i){}const s=Ms.call(e);return n&&(t?e[rt]=r:delete e[rt]),s}function Mc(e){return Ms.call(e)}const vc=20;function Ic(...e){let t=e.shift();const r=new WeakMap;for(;e.length>0;)t=Is(t,e.shift(),0,r);return t}function Er(e){return ae(e)?e.slice():e}function Is(e,t,r=0,n){let s;if(!(r>vc)){if(r++,ce(e)||ce(t)||Ls(t))s=Er(t);else if(ae(e)){if(s=e.slice(),ae(t))for(let i=0,o=t.length;i<o;i++)s.push(Er(t[i]));else if(kt(t)){const i=Object.keys(t);for(let o=0,a=i.length;o<a;o++){const u=i[o];u==="__proto__"||u==="constructor"||u==="prototype"||(s[u]=Er(t[u]))}}}else if(kt(e))if(kt(t)){if(!Nc(e,t))return t;s=Object.assign({},e);const i=Object.keys(t);for(let o=0,a=i.length;o<a;o++){const u=i[o];if(u==="__proto__"||u==="constructor"||u==="prototype")continue;const l=t[u];if(ce(l))typeof l>"u"?delete s[u]:s[u]=l;else{const h=s[u],d=l;if(Ns(e,u,n)||Ns(t,u,n))delete s[u];else{if(kt(h)&&kt(d)){const p=n.get(h)||[],_=n.get(d)||[];p.push({obj:e,key:u}),_.push({obj:t,key:u}),n.set(h,p),n.set(d,_)}s[u]=Is(s[u],l,r,n)}}}}else s=t;return s}}function Ns(e,t,r){const n=r.get(e[t])||[];for(let s=0,i=n.length;s<i;s++){const o=n[s];if(o.key===t&&o.obj===e)return!0}return!1}function ae(e){return Array.isArray(e)}function Ls(e){return typeof e=="function"}function kt(e){return!ce(e)&&!ae(e)&&!Ls(e)&&typeof e=="object"}function ce(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function Nc(e,t){return!(!vs(e)||!vs(t))}function xs(e,t){return typeof t=="string"?e===t:!!e.match(t)}function Us(e,t){if(!t)return!1;for(const r of t)if(xs(e,r))return!0;return!1}class Lc{constructor(){c(this,"_promise");c(this,"_resolve");c(this,"_reject");this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}}class xc{constructor(t,r){c(this,"_isCalled",!1);c(this,"_deferred",new Lc);c(this,"_callback");c(this,"_that");this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}b.ALL,b.VERBOSE,b.DEBUG,b.INFO,b.WARN,b.ERROR,b.NONE;function Uc(e,t){return new Promise(r=>{R.with(ns(R.active()),()=>{e.export(t,r)})})}const Dc={_export:Uc};let ue;function kc(){if(ue===void 0)try{const e=globalThis.process.argv0;ue=e?`unknown_service:${e}`:"unknown_service"}catch(e){ue="unknown_service"}return ue}const Bt=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";class we{constructor(t,r){c(this,"_rawAttributes");c(this,"_asyncAttributesPending",!1);c(this,"_schemaUrl");c(this,"_memoizedAttributes");var s;const n=(s=t.attributes)!=null?s:{};this._rawAttributes=Object.entries(n).map(([i,o])=>(Bt(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=Bs(this._rawAttributes),this._schemaUrl=Bc(r==null?void 0:r.schemaUrl)}static FromAttributeList(t,r){const n=new we({},r);return n._rawAttributes=Bs(t),n._asyncAttributesPending=t.filter(([s,i])=>Bt(i)).length>0,n}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,Bt(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){var r;if(this.asyncAttributesPending&&f.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[n,s]of this._rawAttributes){if(Bt(s)){f.debug(`Unsettled resource attribute ${n} skipped`);continue}s!=null&&((r=t[n])!=null||(t[n]=s))}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;const r=Gc(this,t),n=r?{schemaUrl:r}:void 0;return we.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}}function Ds(e,t){return we.FromAttributeList(Object.entries(e),t)}function ks(){return Ds({[gs]:kc(),[lr]:_r[lr],[hr]:_r[hr],[dr]:_r[dr]})}function Bs(e){return e.map(([t,r])=>Bt(r)?[t,r.catch(n=>{f.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function Bc(e){if(typeof e=="string"||e===void 0)return e;f.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function Gc(e,t){const r=e==null?void 0:e.schemaUrl,n=t==null?void 0:t.schemaUrl,s=r===void 0||r==="",i=n===void 0||n==="";if(s)return n;if(i||r===n)return r;f.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}const Fc="exception",Tr=Symbol.for("nodejs.util.inspect.custom");function Sr(e){var r;const t={};for(const[n,s]of e.getRawAttributes())typeof(s==null?void 0:s.then)!="function"&&s!=null&&((r=t[n])!=null||(t[n]=s));return t}function Ar(e,t,r,n,s){if(typeof r=="number"&&r<0){const o=`[${e}]`;return n!=null&&n.stylize?n.stylize(o,"special"):o}if(typeof s!="function"||!n)return t;const i={...n,depth:n.depth==null?n.depth:n.depth-1};return`${e} ${s(t,i)}`}class $c{constructor(t){c(this,"_spanContext");c(this,"kind");c(this,"parentSpanContext");c(this,"attributes",{});c(this,"links",[]);c(this,"events",[]);c(this,"startTime");c(this,"resource");c(this,"instrumentationScope");c(this,"_droppedAttributesCount",0);c(this,"_droppedEventsCount",0);c(this,"_droppedLinksCount",0);c(this,"_attributesCount",0);c(this,"name");c(this,"status",{code:j.UNSET});c(this,"endTime",[0,0]);c(this,"_ended",!1);c(this,"_duration",[-1,-1]);c(this,"_spanProcessor");c(this,"_spanLimits");c(this,"_attributeValueLengthLimit");c(this,"_recordEndMetrics");c(this,"_performanceStartTime");c(this,"_performanceOffset");c(this,"_startTimeProvided");var n,s;const r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=O.now(),this._performanceOffset=r-(this._performanceStartTime+O.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=(n=this._spanLimits.attributeValueLengthLimit)!=null?n:0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(const i of t.links)this.addLink(i);this.startTime=this._getTime((s=t.startTime)!=null?s:r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return f.warn(`Invalid attribute key: ${t}`),this;if(!ls(r))return f.warn(`Invalid attribute value set for key: ${t}`),this;const{attributeCountLimit:n}=this._spanLimits,s=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&s?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),s&&this._attributesCount++,this)}setAttributes(t){for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;const{eventCountLimit:s}=this._spanLimits;if(s===0)return f.warn("No events allowed."),this._droppedEventsCount++,this;s!==void 0&&this.events.length>=s&&(this._droppedEventsCount===0&&f.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Es(r)&&(Es(n)||(n=r),r=void 0);const i=Nt(r),{attributePerEventCountLimit:o}=this._spanLimits,a={};let u=0,l=0;for(const h in i){if(!Object.prototype.hasOwnProperty.call(i,h))continue;const d=i[h];if(o!==void 0&&l>=o){u++;continue}a[h]=this._truncateToSize(d),l++}return this.events.push({name:t,attributes:a,time:this._getTime(n),droppedAttributesCount:u}),this}addLink(t){if(this._isSpanEnded())return this;const{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&f.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);const{attributePerLinkCountLimit:n}=this._spanLimits,s=Nt(t.attributes),i={};let o=0,a=0;for(const l in s){if(!Object.prototype.hasOwnProperty.call(s,l))continue;const h=s[l];if(n!==void 0&&a>=n){o++;continue}i[l]=this._truncateToSize(h),a++}const u={context:t.context};return a>0&&(u.attributes=i),o>0&&(u.droppedAttributesCount=o),this.links.push(u),this}addLinks(t){for(const r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===j.UNSET)return this;if(this.status.code===j.OK)return this;const r={code:t.code};return t.code===j.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&f.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){var r;if(this._isSpanEnded()){f.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=pr(this.startTime,this.endTime),this._duration[0]<0&&(f.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]),this._droppedEventsCount>0&&f.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&f.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(r=this._recordEndMetrics)==null||r.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=O.now())return G(t+this._performanceOffset);if(typeof t=="number")return N(t);if(t instanceof Date)return N(t.getTime());if(fr(t))return t;if(this._startTimeProvided)return N(Date.now());const r=O.now()-this._performanceStartTime;return Ts(this.startTime,N(r))}isRecording(){return this._ended===!1}recordException(t,r){const n={};typeof t=="string"?n[cr]=t:t&&(t.code?n[ur]=t.code.toString():t.name&&(n[ur]=t.name),t.message&&(n[cr]=t.message),t.stack&&(n[Ya]=t.stack)),n[ur]||n[cr]?this.addEvent(Fc,n,r):f.warn(`Failed to record an exception ${t}`)}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(){if(this._ended){const t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);f.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){const r=this._attributeValueLengthLimit;return r<=0?(f.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}[Tr](t,r,n){const s={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Sr(this.resource)}};return Ar("SpanImpl",s,t,r,n)}}var F;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(F||(F={}));const Vc="otel.component.name",Hc="otel.component.type",zc="otel.span.parent.origin",Gs="otel.span.sampling_result",jc="otel.sdk.processor.span.processed",qc="otel.sdk.processor.span.queue.capacity",Wc="otel.sdk.processor.span.queue.size",Xc="otel.sdk.span.live",Yc="otel.sdk.span.started",Kc="batching_span_processor";class Qc{constructor(t){c(this,"startedSpans");c(this,"liveSpans");this.startedSpans=t.createCounter(Yc,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(Xc,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){const n=Zc(r);if(this.startedSpans.add(1,{[zc]:Jc(t),[Gs]:n}),r===F.NOT_RECORD)return()=>{};const s={[Gs]:n};return this.liveSpans.add(1,s),()=>{this.liveSpans.add(-1,s)}}}function Jc(e){return e?e.isRemote?"remote":"local":"none"}function Zc(e){switch(e){case F.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case F.RECORD:return"RECORD_ONLY";case F.NOT_RECORD:return"DROP"}}const tu="2.10.0";class eu{constructor(t,r){c(this,"_sampler");c(this,"_spanLimits");c(this,"_idGenerator");c(this,"instrumentationScope");c(this,"_resource");c(this,"_spanProcessor");c(this,"_tracerMetrics");this.instrumentationScope=t,this._sampler=r.sampler,this._spanLimits=r.spanLimits,this._resource=r.resource,this._idGenerator=r.idGenerator,this._spanProcessor=r.spanProcessor;const n=r.meterProvider.getMeter("@opentelemetry/sdk-trace",tu);this._tracerMetrics=new Qc(n)}startSpan(t,r={},n=R.active()){var y,At,ut;r.root&&(n=w.deleteSpan(n));const s=w.getSpan(n);if(or(n))return f.debug("Instrumentation suppressed, returning Noop Span"),w.wrapSpanContext(Yn);const i=s==null?void 0:s.spanContext(),o=this._idGenerator.generateSpanId();let a,u,l;!i||!w.isSpanContextValid(i)?u=this._idGenerator.generateTraceId():(u=i.traceId,l=i.traceState,a=i);const h=(y=r.kind)!=null?y:It.INTERNAL,d=((At=r.links)!=null?At:[]).map(Yt=>({context:Yt.context,attributes:Nt(Yt.attributes)})),p=Nt(r.attributes),_=this._sampler.shouldSample(n,u,t,h,p,d),E=this._tracerMetrics.startSpan(i,_.decision);l=(ut=_.traceState)!=null?ut:l;const m=_.decision===se.RECORD_AND_SAMPLED?z.SAMPLED:z.NONE,T={traceId:u,spanId:o,traceFlags:m,traceState:l};if(_.decision===se.NOT_RECORD)return f.debug("Recording is off, propagating context in a non-recording span"),w.wrapSpanContext(T);const A=Nt(Object.assign(p,_.attributes));return new $c({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:T,name:t,kind:h,links:d,parentSpanContext:a,attributes:A,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:E})}startActiveSpan(t,r,n,s){let i,o,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,o=n,a=s);const u=o!=null?o:R.active(),l=this.startSpan(t,i,u),h=w.setSpan(u,l);return R.with(h,a,void 0,l)}[Tr](t,r,n){const s={instrumentationScope:this.instrumentationScope,resource:{attributes:Sr(this._resource)},spanLimits:this._spanLimits};return Ar("Tracer",s,t,r,n)}}class ru{constructor(t){c(this,"_spanProcessors");this._spanProcessors=t}forceFlush(){const t=[];for(const r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{Y(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(const n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(const r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(const r of this._spanProcessors)r.onEnd(t)}shutdown(){const t=[];for(const r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}}class le{shouldSample(){return{decision:F.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class nt{shouldSample(){return{decision:F.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class ht{constructor(t){c(this,"_root");c(this,"_remoteParentSampled");c(this,"_remoteParentNotSampled");c(this,"_localParentSampled");c(this,"_localParentNotSampled");var r,n,s,i;this._root=t.root,this._root||(Y(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new nt),this._remoteParentSampled=(r=t.remoteParentSampled)!=null?r:new nt,this._remoteParentNotSampled=(n=t.remoteParentNotSampled)!=null?n:new le,this._localParentSampled=(s=t.localParentSampled)!=null?s:new nt,this._localParentNotSampled=(i=t.localParentNotSampled)!=null?i:new le}shouldSample(t,r,n,s,i,o){const a=w.getSpanContext(t);return!a||!ne(a)?this._root.shouldSample(t,r,n,s,i,o):a.isRemote?a.traceFlags&z.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,s,i,o):this._remoteParentNotSampled.shouldSample(t,r,n,s,i,o):a.traceFlags&z.SAMPLED?this._localParentSampled.shouldSample(t,r,n,s,i,o):this._localParentNotSampled.shouldSample(t,r,n,s,i,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}const Fs=new Map;class nu{constructor(t,r,n){c(this,"processedSpans");c(this,"queueSize");c(this,"queueSizeCallback");c(this,"standardAttrs");c(this,"droppedAttrs");var i;const s=(i=Fs.get(t))!=null?i:0;if(Fs.set(t,s+1),this.standardAttrs={[Hc]:t,[Vc]:`${t}/${s}`},this.droppedAttrs={...this.standardAttrs,[Lt]:"queue_full"},this.processedSpans=r.createCounter(jc,{unit:"{span}",description:"The number of spans for which the processing has finished, either successful or failed."}),n){const{capacity:o,getQueueSize:a}=n;r.createUpDownCounter(qc,{unit:"{span}",description:"The maximum number of spans the queue of a given instance of an SDK span processor can hold."}).add(o,this.standardAttrs),this.queueSize=r.createObservableUpDownCounter(Wc,{unit:"{span}",description:"The number of spans in the queue of a given instance of an SDK span processor."}),this.queueSizeCallback=l=>l.observe(a(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(t){this.processedSpans.add(t,this.droppedAttrs)}finishSpans(t,r){if(!r){this.processedSpans.add(t,this.standardAttrs);return}const n={...this.standardAttrs,[Lt]:r.name};this.processedSpans.add(t,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}class su{constructor(t){c(this,"_maxExportBatchSize");c(this,"_maxQueueSize");c(this,"_scheduledDelayMillis");c(this,"_exportTimeoutMillis");c(this,"_exporter");c(this,"_metrics");c(this,"_isExporting",!1);c(this,"_finishedSpans",[]);c(this,"_timer");c(this,"_shutdownOnce");c(this,"_droppedSpansCount",0);var n,s,i,o;this._exporter=t.exporter,this._maxExportBatchSize=(n=t.maxExportBatchSize)!=null?n:512,this._maxQueueSize=(s=t.maxQueueSize)!=null?s:2048,this._scheduledDelayMillis=(i=t.scheduledDelayMillis)!=null?i:5e3,this._exportTimeoutMillis=(o=t.exportTimeoutMillis)!=null?o:3e4,this._shutdownOnce=new xc(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(f.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);const r=t.selfObsMeterProvider?t.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):Mt();this._metrics=new nu(Kc,r,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&z.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&f.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(f.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{const n=[],s=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,o=s;i<o;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{const n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);R.with(ns(R.active()),()=>{let s;this._finishedSpans.length<=this._maxExportBatchSize?(s=this._finishedSpans,this._finishedSpans=[]):s=this._finishedSpans.splice(0,this._maxExportBatchSize);const i=()=>this._exporter.export(s,a=>{var u;clearTimeout(n),this._metrics.finishSpans(s.length,a.error),a.code===D.SUCCESS?t():r((u=a.error)!=null?u:new Error("BatchSpanProcessor: span export failed"))});let o=null;for(let a=0,u=s.length;a<u;a++){const l=s[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(o!=null||(o=[]),o.push(l.resource.waitForAsyncAttributes()))}o===null?i():Promise.all(o).then(i,a=>{Y(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;const t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,Y(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}let iu=class extends su{constructor(r){super(r);c(this,"_visibilityChangeListener");c(this,"_pageHideListener");this.onInit(r)}onInit(r){r.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(n=>{Y(n)})},this._pageHideListener=()=>{this.forceFlush().catch(n=>{Y(n)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){typeof document<"u"&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}};const ou=16,au=8,$s=new Uint8Array(ou),Vs=new Uint8Array(au),cu=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Hs(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function zs(e){let t="";for(let r=0;r<e.length;r++)t+=cu[e[r]];return t}class uu{generateTraceId(){return Hs($s),zs($s)}generateSpanId(){return Hs(Vs),zs(Vs)}}var st;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(st||(st={}));class lu{constructor(t={}){c(this,"_resource");c(this,"_activeSpanProcessor");c(this,"_forceFlushTimeoutMillis");c(this,"_tracerOptions");c(this,"_tracers",new Map);var n,s,i,o,a,u,l,h,d,p,_,E,m,T,A,M,y;this._forceFlushTimeoutMillis=(n=t.forceFlushTimeoutMillis)!=null?n:3e4,this._resource=(s=t.resource)!=null?s:ks();const r=(i=t.spanProcessors)!=null?i:[];this._activeSpanProcessor=new ru(r),this._tracerOptions={resource:this._resource,sampler:(o=t.sampler)!=null?o:new ht({root:new nt}),spanLimits:{attributeCountLimit:(u=(a=t.spanLimits)==null?void 0:a.attributeCountLimit)!=null?u:128,attributeValueLengthLimit:(h=(l=t.spanLimits)==null?void 0:l.attributeValueLengthLimit)!=null?h:1/0,eventCountLimit:(p=(d=t.spanLimits)==null?void 0:d.eventCountLimit)!=null?p:128,linkCountLimit:(E=(_=t.spanLimits)==null?void 0:_.linkCountLimit)!=null?E:128,attributePerEventCountLimit:(T=(m=t.spanLimits)==null?void 0:m.attributePerEventCountLimit)!=null?T:128,attributePerLinkCountLimit:(M=(A=t.spanLimits)==null?void 0:A.attributePerLinkCountLimit)!=null?M:128},idGenerator:t.idGenerator||new uu,spanProcessor:this._activeSpanProcessor,meterProvider:(y=t.meterProvider)!=null?y:{getMeter(){return Mt()}}}}getTracer(t,r,n){const s=`${t}@${r||""}:${(n==null?void 0:n.schemaUrl)||""}`;return this._tracers.has(s)||this._tracers.set(s,new eu({name:t,version:r,schemaUrl:n==null?void 0:n.schemaUrl},this._tracerOptions)),this._tracers.get(s)}forceFlush(){const t=this._forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(s=>{let i;const o=setTimeout(()=>{s(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=st.timeout},t);n.forceFlush().then(()=>{clearTimeout(o),i!==st.timeout&&(i=st.resolved,s(i))}).catch(a=>{clearTimeout(o),i=st.error,s(a)})}));return new Promise((n,s)=>{Promise.all(r).then(i=>{const o=i.filter(a=>a!==st.resolved);o.length>0?s(o):n()}).catch(i=>s([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Tr](t,r,n){const s=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:Sr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:s.map(o=>{var a,u;return(u=(a=o.constructor)==null?void 0:a.name)!=null?u:"SpanProcessor"})};return Ar("TracerProvider",i,t,r,n)}}class Rr{constructor(t=0){c(this,"_ratio");c(this,"_upperBound");this._ratio=this._normalize(t),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:Jn(r)&&this._accumulate(r)<this._upperBound?F.RECORD_AND_SAMPLED:F.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<32;n+=8){let s=0;for(let i=0;i<8;i++){const o=t.charCodeAt(n+i),a=o<58?o-48:o<71?o-55:o-87;s=s<<4|a}r=(r^s)>>>0}return r}}var $;(function(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"})($||($={}));const js=1;function hu(){return{sampler:du(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function du(){const e=$.ParentBasedAlwaysOn;switch(e){case $.AlwaysOn:return new nt;case $.AlwaysOff:return new le;case $.ParentBasedAlwaysOn:return new ht({root:new nt});case $.ParentBasedAlwaysOff:return new ht({root:new le});case $.TraceIdRatio:return new Rr(qs());case $.ParentBasedTraceIdRatio:return new ht({root:new Rr(qs())});default:return f.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${$.ParentBasedAlwaysOn}".`),new ht({root:new nt})}}function qs(){return f.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${js}.`),js}const _u=128,pu=1/0;function fu(e){var r,n,s,i,o,a,u,l,h,d,p,_;const t=Object.assign({},e.spanLimits);return t.attributeCountLimit=(a=(o=(i=(s=(r=e.spanLimits)==null?void 0:r.attributeCountLimit)!=null?s:(n=e.generalLimits)==null?void 0:n.attributeCountLimit)!=null?i:void 0)!=null?o:void 0)!=null?a:_u,t.attributeValueLengthLimit=(_=(p=(d=(h=(u=e.spanLimits)==null?void 0:u.attributeValueLengthLimit)!=null?h:(l=e.generalLimits)==null?void 0:l.attributeValueLengthLimit)!=null?d:void 0)!=null?p:void 0)!=null?_:pu,Object.assign({},e,{spanLimits:t})}class mu extends lu{constructor(t={}){const r=Ic({},hu(),fu(t));delete r.generalLimits,super(r)}}class gu extends iu{constructor(t,r){r||(r={});const n=[["maxExportBatchSize","OTEL_BSP_MAX_EXPORT_BATCH_SIZE"],["maxQueueSize","OTEL_BSP_MAX_QUEUE_SIZE"],["scheduledDelayMillis","OTEL_BSP_SCHEDULE_DELAY"],["exportTimeoutMillis","OTEL_BSP_EXPORT_TIMEOUT"]];for(const[s,i]of n)r[s];super({exporter:t,...r})}}class Eu{constructor(){c(this,"_enabled",!1);c(this,"_currentContext",et)}_bindFunction(t=et,r){const n=this,s=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(s,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),s}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=et,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=et,this)}with(t,r,n,...s){const i=this._currentContext;this._currentContext=t||et;try{return r.call(n,...s)}finally{this._currentContext=i}}}function Tu(e){if(e!==null){if(e===void 0){const t=new Eu;t.enable(),R.setGlobalContextManager(t);return}e.enable(),R.setGlobalContextManager(e)}}function Su(e){if(e!==null){if(e===void 0){U.setGlobalPropagator(new ic({propagators:[new Tc,new $a]}));return}U.setGlobalPropagator(e)}}class Au extends mu{constructor(t={}){super(t)}register(t={}){w.setGlobalTracerProvider(this),Su(t.propagator),Tu(t.contextManager)}}var S;(function(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"})(S||(S={}));const Ru="http.response_content_length",bu="http.response_content_length_uncompressed";let br;function wu(){return br||(br=document.createElement("a")),br}function dt(e,t){return t in e}function C(e,t,r,n=!0){if(dt(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function _t(e,t,r=!1,n,s){if(n===void 0&&(n=t[S.START_TIME]!==0),r||(C(e,S.FETCH_START,t,n),C(e,S.DOMAIN_LOOKUP_START,t,n),C(e,S.DOMAIN_LOOKUP_END,t,n),C(e,S.CONNECT_START,t,n),C(e,S.SECURE_CONNECTION_START,t,n),C(e,S.CONNECT_END,t,n),C(e,S.REQUEST_START,t,n),C(e,S.RESPONSE_START,t,n),C(e,S.RESPONSE_END,t,n)),!s){const i=t[S.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(Ru,i);const o=t[S.DECODED_BODY_SIZE];o!==void 0&&i!==o&&e.setAttribute(bu,o)}}function Ou(e){return e.slice().sort((t,r)=>{const n=t[S.FETCH_START],s=r[S.FETCH_START];return n>s?1:n<s?-1:0})}function Ws(){return typeof location<"u"?location.origin:void 0}function Xs(e,t,r,n,s=new WeakSet,i){const o=K(e);e=o.toString();const a=yu(e,t,r,n,s,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};const u=Ou(a);if(o.origin!==Ws()&&u.length>1){let l=u[0],h=Cu(u,l[S.RESPONSE_END],r);const d=l[S.RESPONSE_END];return h[S.FETCH_START]<d&&(h=l,l=void 0),{corsPreFlightRequest:l,mainRequest:h}}else return{mainRequest:a[0]}}function Cu(e,t,r){const n=q(r),s=q(Dt(t));let i=e[1],o;const a=e.length;for(let u=1;u<a;u++){const l=e[u],h=q(Dt(l[S.FETCH_START])),d=q(Dt(l[S.RESPONSE_END])),p=n-d;h>=s&&(!o||p<o)&&(o=p,i=l)}return i}function yu(e,t,r,n,s,i){const o=q(t),a=q(r);let u=n.filter(l=>{const h=q(Dt(l[S.FETCH_START])),d=q(Dt(l[S.RESPONSE_END]));return l.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&l.name===e&&h>=o&&d<=a});return u.length>0&&(u=u.filter(l=>!s.has(l))),u}function K(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);const t=wu();return t.href=e,t}function Ys(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),K(e).origin===Ws()?!0:r.some(s=>xs(e,s))}var k;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(k||(k={}));var g;(function(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"})(g||(g={}));var V;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(V||(V={}));function Ks(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function Pu(e){var t,r;return`${e.name}:${(t=e.version)!=null?t:""}:${(r=e.schemaUrl)!=null?r:""}`}class Oe extends Error{constructor(t){super(t),Object.setPrototypeOf(this,Oe.prototype)}}function Gt(e,t){let r;const n=new Promise(function(i,o){r=setTimeout(function(){o(new Oe("Operation timed out."))},t)});return Promise.race([e,n]).then(s=>(clearTimeout(r),s),s=>{throw clearTimeout(r),s})}function Mu(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function vu(e,t){let r=0,n=e.length-1,s=e.length;for(;n>=r;){const i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(s=i,n=i-1)}return s}function Iu(e,t){return e.toLowerCase()===t.toLowerCase()}var it;(function(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"})(it||(it={}));class Nu{constructor(){c(this,"kind",it.DROP)}createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,s){}}function Lu(e){const t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}class wr{constructor(t,r,n=!0,s=Lu(r)){c(this,"startTime");c(this,"_boundaries");c(this,"_recordMinMax");c(this,"_current");this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=s}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);const r=vu(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}}class Qs{constructor(t,r){c(this,"kind",it.HISTOGRAM);c(this,"_boundaries");c(this,"_recordMinMax");this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new wr(t,this._boundaries,this._recordMinMax)}merge(t,r){const n=t.toPointValue(),s=r.toPointValue(),i=n.buckets.counts,o=s.buckets.counts,a=new Array(i.length);for(let h=0;h<i.length;h++)a[h]=i[h]+o[h];let u=1/0,l=-1/0;return this._recordMinMax&&(n.hasMinMax&&s.hasMinMax?(u=Math.min(n.min,s.min),l=Math.max(n.max,s.max)):n.hasMinMax?(u=n.min,l=n.max):s.hasMinMax&&(u=s.min,l=s.max)),new wr(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+s.count,sum:n.sum+s.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||s.hasMinMax),min:u,max:l})}diff(t,r){const n=t.toPointValue(),s=r.toPointValue(),i=n.buckets.counts,o=s.buckets.counts,a=new Array(i.length);for(let u=0;u<i.length;u++)a[u]=o[u]-i[u];return new wr(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:s.count-n.count,sum:s.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.HISTOGRAM,dataPoints:n.map(([i,o])=>{const a=o.toPointValue(),u=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:o.startTime,endTime:s,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:u?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}}class Ce{constructor(t=new un,r=0,n=0,s=0){c(this,"backing");c(this,"indexBase");c(this,"indexStart");c(this,"indexEnd");this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=s}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){const r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();const r=1+this.indexEnd-this.indexStart,n=1<<t;let s=0,i=0;for(let o=this.indexStart;o<=this.indexEnd;){let a=o%n;a<0&&(a+=n);for(let u=a;u<n&&s<r;u++)this._relocateBucket(i,s),s++,o++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new Ce(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){const t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}}class un{constructor(t=[0]){c(this,"_counts");this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){const s=new Array(t).fill(0);s.splice(n,this._counts.length-r,...this._counts.slice(r)),s.splice(0,r,...this._counts.slice(0,r)),this._counts=s}reverse(t,r){const n=Math.floor((t+r)/2)-t;for(let s=0;s<n;s++){const i=this._counts[t+s];this._counts[t+s]=this._counts[r-s-1],this._counts[r-s-1]=i}}emptyBucket(t){const r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new un([...this._counts])}}const xu=52,Uu=2146435072,Du=1048575,Or=1023,Js=-Or+1,Zs=Or,Cr=Math.pow(2,-1022);function ti(e){const t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&Uu)>>20)-Or}function ei(e){const t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);const r=t.getUint32(0),n=t.getUint32(4);return(r&Du)*Math.pow(2,32)+n}function yr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function ku(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}class Ft extends Error{}class Bu{constructor(t){c(this,"_shift");this._shift=-t}mapToIndex(t){if(t<Cr)return this._minNormalLowerBoundaryIndex();const r=ti(t),n=this._rightShift(ei(t)-1,xu);return r+n>>this._shift}lowerBoundary(t){const r=this._minNormalLowerBoundaryIndex();if(t<r)throw new Ft(`underflow: ${t} is < minimum lower boundary: ${r}`);const n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new Ft(`overflow: ${t} is > maximum lower boundary: ${n}`);return yr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=Js>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return Zs>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}}class Gu{constructor(t){c(this,"_scale");c(this,"_scaleFactor");c(this,"_inverseFactor");this._scale=t,this._scaleFactor=yr(Math.LOG2E,t),this._inverseFactor=yr(Math.LN2,-t)}mapToIndex(t){if(t<=Cr)return this._minNormalLowerBoundaryIndex()-1;if(ei(t)===0)return(ti(t)<<this._scale)-1;const r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){const r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new Ft(`overflow: ${t} is > maximum lower boundary: ${r}`)}const n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return Cr;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new Ft(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Js<<this._scale}_maxNormalLowerBoundaryIndex(){return(Zs+1<<this._scale)-1}}const ri=-10,ni=20,Fu=Array.from({length:31},(e,t)=>t>10?new Gu(t-10):new Bu(t-10));function si(e){if(e>ni||e<ri)throw new Ft(`expected scale >= ${ri} && <= ${ni}, got: ${e}`);return Fu[e+10]}class Et{constructor(t,r){c(this,"low");c(this,"high");this.low=t,this.high=r}static combine(t,r){return new Et(Math.min(t.low,r.low),Math.max(t.high,r.high))}}const $u=20,Vu=160,Pr=2;class ln{constructor(t,r=Vu,n=!0,s=0,i=0,o=0,a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,l=new Ce,h=new Ce,d=si($u)){c(this,"startTime");c(this,"_maxSize");c(this,"_recordMinMax");c(this,"_sum");c(this,"_count");c(this,"_zeroCount");c(this,"_min");c(this,"_max");c(this,"_positive");c(this,"_negative");c(this,"_mapping");this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=s,this._count=i,this._zeroCount=o,this._min=a,this._max=u,this._positive=l,this._negative=h,this._mapping=d,this._maxSize<Pr&&(f.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${Pr}`),this._maxSize=Pr)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;const r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;const r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new ln(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let s=this._mapping.mapToIndex(r),i=!1,o=0,a=0;if(t.length===0?(t.indexStart=s,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):s<t.indexStart&&t.indexEnd-s>=this._maxSize?(i=!0,a=s,o=t.indexEnd):s>t.indexEnd&&s-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,o=s),i){const u=this._changeScale(o,a);this._downscale(u),s=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,s,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){const i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){const i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let s=r-t.indexBase;s<0&&(s+=t.backing.length),t.incrementBucket(s,n)}_grow(t,r){const n=t.backing.length,s=t.indexBase-t.indexStart,i=n-s;let o=ku(r);o>this._maxSize&&(o=this._maxSize);const a=o-s;t.backing.growTo(o,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);const r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=si(r)}_minScale(t){const r=Math.min(this.scale,t.scale),n=Et.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),s=Et.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(s.high,s.low))}_highLowAtScale(t,r,n){if(t.length===0)return new Et(0,-1);const s=r-n;return new Et(t.indexStart>>s,t.indexEnd>>s)}_mergeBuckets(t,r,n,s){const i=n.offset,o=r.scale-s;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>o,n.at(a))}_diffBuckets(t,r,n,s){const i=n.offset,o=r.scale-s;for(let a=0;a<n.length;a++){let l=(i+a>>o)-t.indexBase;l<0&&(l+=t.backing.length),t.decrementBucket(l,n.at(a))}t.trim()}}class Hu{constructor(t,r){c(this,"kind",it.EXPONENTIAL_HISTOGRAM);c(this,"_maxSize");c(this,"_recordMinMax");this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new ln(t,this._maxSize,this._recordMinMax)}merge(t,r){const n=r.clone();return n.merge(t),n}diff(t,r){const n=r.clone();return n.diff(t),n}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,o])=>{const a=o.toPointValue(),u=t.type===g.GAUGE||t.type===g.UP_DOWN_COUNTER||t.type===g.OBSERVABLE_GAUGE||t.type===g.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:o.startTime,endTime:s,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:u?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}}class Mr{constructor(t,r=0,n=[0,0]){c(this,"startTime");c(this,"_current");c(this,"sampleTime");this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=N(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}}class zu{constructor(){c(this,"kind",it.LAST_VALUE)}createAccumulation(t){return new Mr(t)}merge(t,r){const n=ie(r.sampleTime)>=ie(t.sampleTime)?r:t;return new Mr(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){const n=ie(r.sampleTime)>=ie(t.sampleTime)?r:t;return new Mr(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.GAUGE,dataPoints:n.map(([i,o])=>({attributes:i,startTime:o.startTime,endTime:s,value:o.toPointValue()}))}}}class $t{constructor(t,r,n=0,s=!1){c(this,"startTime");c(this,"monotonic");c(this,"_current");c(this,"reset");this.startTime=t,this.monotonic=r,this._current=n,this.reset=s}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}}class ii{constructor(t){c(this,"kind",it.SUM);c(this,"monotonic");this.monotonic=t}createAccumulation(t){return new $t(t,this.monotonic)}merge(t,r){const n=t.toPointValue(),s=r.toPointValue();return r.reset?new $t(r.startTime,this.monotonic,s,r.reset):new $t(t.startTime,this.monotonic,n+s)}diff(t,r){const n=t.toPointValue(),s=r.toPointValue();return this.monotonic&&n>s?new $t(r.startTime,this.monotonic,s,!0):new $t(r.startTime,this.monotonic,s-n)}toMetricData(t,r,n,s){return{descriptor:t,aggregationTemporality:r,dataPointType:V.SUM,dataPoints:n.map(([i,o])=>({attributes:i,startTime:o.startTime,endTime:s,value:o.toPointValue()})),isMonotonic:this.monotonic}}}const Pe=class Pe{createAggregator(t){return Pe.DEFAULT_INSTANCE}};c(Pe,"DEFAULT_INSTANCE",new Nu);let vr=Pe;const Tt=class Tt{createAggregator(t){switch(t.type){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.HISTOGRAM:return Tt.MONOTONIC_INSTANCE;default:return Tt.NON_MONOTONIC_INSTANCE}}};c(Tt,"MONOTONIC_INSTANCE",new ii(!0)),c(Tt,"NON_MONOTONIC_INSTANCE",new ii(!1));let Ir=Tt;const Me=class Me{createAggregator(t){return Me.DEFAULT_INSTANCE}};c(Me,"DEFAULT_INSTANCE",new zu);let Nr=Me;const ve=class ve{createAggregator(t){return ve.DEFAULT_INSTANCE}};c(ve,"DEFAULT_INSTANCE",new Qs([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));let Lr=ve;class oi{constructor(t,r=!0){c(this,"_boundaries");c(this,"_recordMinMax");if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,o)=>i-o);const n=t.lastIndexOf(-1/0);let s=t.indexOf(1/0);s===-1&&(s=void 0),this._boundaries=t.slice(n+1,s),this._recordMinMax=r}createAggregator(t){return new Qs(this._boundaries,this._recordMinMax)}}class ju{constructor(t=160,r=!0){c(this,"_maxSize");c(this,"_recordMinMax");this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new Hu(this._maxSize,this._recordMinMax)}}class qu{_resolve(t){switch(t.type){case g.COUNTER:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return ci;case g.GAUGE:case g.OBSERVABLE_GAUGE:return ui;case g.HISTOGRAM:return t.advice.explicitBucketBoundaries?new oi(t.advice.explicitBucketBoundaries):li}return f.warn(`Unable to recognize instrument type: ${t.type}`),ai}createAggregator(t){return this._resolve(t).createAggregator(t)}}const ai=new vr,ci=new Ir,ui=new Nr,li=new Lr,Wu=new qu;var B;(function(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"})(B||(B={}));function hi(e){var t,r,n,s;switch(e.type){case B.DEFAULT:return Wu;case B.DROP:return ai;case B.SUM:return ci;case B.LAST_VALUE:return ui;case B.EXPONENTIAL_HISTOGRAM:{const i=e;return new ju((t=i.options)==null?void 0:t.maxSize,(r=i.options)==null?void 0:r.recordMinMax)}case B.EXPLICIT_BUCKET_HISTOGRAM:{const i=e;return i.options==null?li:new oi((n=i.options)==null?void 0:n.boundaries,(s=i.options)==null?void 0:s.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}const Xu=e=>({type:B.DEFAULT}),Yu=e=>k.CUMULATIVE,Ku="otel.component.name",Qu="otel.component.type",Ju="periodic_metric_reader",Zu="otel.sdk.metric_reader.collection.duration",tl="error.type",di=new Map;class _i{constructor(t,r){c(this,"collectionDuration");c(this,"standardAttrs");var s;const n=(s=di.get(t))!=null?s:0;di.set(t,n+1),this.standardAttrs={[Qu]:t,[Ku]:`${t}/${n}`},this.collectionDuration=r.createHistogram(Zu,{unit:"s",description:"The duration of the collect operation of the metric reader.",advice:{explicitBucketBoundaries:[]}})}recordCollection(t,r){const n=r?{...this.standardAttrs,[tl]:r}:this.standardAttrs;this.collectionDuration.record(t,n)}}const el="2.10.0";class pi{constructor(t){c(this,"_shutdown",!1);c(this,"_metricProducers");c(this,"_sdkMetricProducer");c(this,"_selfObsMetrics");c(this,"_aggregationTemporalitySelector");c(this,"_aggregationSelector");c(this,"_cardinalitySelector");c(this,"_otelComponentType");var r,n,s,i;this._aggregationSelector=(r=t==null?void 0:t.aggregationSelector)!=null?r:Xu,this._aggregationTemporalitySelector=(n=t==null?void 0:t.aggregationTemporalitySelector)!=null?n:Yu,this._metricProducers=(s=t==null?void 0:t.metricProducers)!=null?s:[],this._cardinalitySelector=t==null?void 0:t.cardinalitySelector,this._otelComponentType=(i=t==null?void 0:t.otelComponentType)!=null?i:this.constructor.name,this._selfObsMetrics=new _i(this._otelComponentType,Mt())}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}_setSelfObsMeterProvider(t){const r=t.getMeter("@opentelemetry/sdk-metrics",el);this._selfObsMetrics=new _i(this._otelComponentType,r)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){var h;if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");const r=G(),[n,...s]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t==null?void 0:t.timeoutMillis}),...this._metricProducers.map(d=>d.collect({timeoutMillis:t==null?void 0:t.timeoutMillis}))]),i=G(),o=n.errors.concat(s.flatMap(d=>d.errors)),a=sc(pr(r,i));this._selfObsMetrics.recordCollection(a,o.length>0?(h=o[0].name)!=null?h:"collect_error":void 0);const u=n.resourceMetrics.resource,l=n.resourceMetrics.scopeMetrics.concat(s.flatMap(d=>d.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:u,scopeMetrics:l},errors:o}}async shutdown(t){if(this._shutdown){f.error("Cannot call shutdown twice.");return}(t==null?void 0:t.timeoutMillis)==null?await this.onShutdown():await Gt(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){f.warn("Cannot forceFlush on already shutdown MetricReader.");return}if((t==null?void 0:t.timeoutMillis)==null){await this.onForceFlush();return}await Gt(this.onForceFlush(),t.timeoutMillis)}}function rl(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("maxExportBatchSize must be a positive integer");const r=[];let n=0,s=[];function i(){s.length>0&&(r.push({resource:e.resource,scopeMetrics:s}),s=[],n=0)}for(const o of e.scopeMetrics){let a=null;for(const u of o.metrics){const l=u.dataPoints;if(l.length===0){a||(a={scope:o.scope,metrics:[]},s.push(a)),a.metrics.push(u);continue}let h=0;for(;h<l.length;){const d=t-n,p=Math.min(d,l.length-h);a||(a={scope:o.scope,metrics:[]},s.push(a));const _={...u,dataPoints:l.slice(h,h+p)};a.metrics.push(_),h+=p,n+=p,n===t&&(i(),a=null)}}}return i(),r}class nl extends pi{constructor(r){var l,h;const{exporter:n,exportIntervalMillis:s=6e4,metricProducers:i,cardinalityLimits:o,maxExportBatchSize:a}=r;let{exportTimeoutMillis:u=3e4}=r;super({aggregationSelector:(l=n.selectAggregation)==null?void 0:l.bind(n),aggregationTemporalitySelector:(h=n.selectAggregationTemporality)==null?void 0:h.bind(n),otelComponentType:Ju,metricProducers:i,cardinalitySelector:d=>{var _,E,m,T,A,M,y;const p={default:2e3,...o};switch(d){case g.COUNTER:return(_=p.counter)!=null?_:p.default;case g.GAUGE:return(E=p.gauge)!=null?E:p.default;case g.HISTOGRAM:return(m=p.histogram)!=null?m:p.default;case g.OBSERVABLE_COUNTER:return(T=p.observableCounter)!=null?T:p.default;case g.OBSERVABLE_UP_DOWN_COUNTER:return(A=p.observableUpDownCounter)!=null?A:p.default;case g.OBSERVABLE_GAUGE:return(M=p.observableGauge)!=null?M:p.default;case g.UP_DOWN_COUNTER:return(y=p.upDownCounter)!=null?y:p.default;default:return p.default}}});c(this,"_interval");c(this,"_exporter");c(this,"_exportInterval");c(this,"_exportTimeout");c(this,"_maxExportBatchSize");c(this,"_ongoingExportPromise",null);if(s<=0)throw Error("exportIntervalMillis must be greater than 0");if(u<=0)throw Error("exportTimeoutMillis must be greater than 0");if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error("maxExportBatchSize must be a positive integer");if(s<u){if("exportIntervalMillis"in r&&"exportTimeoutMillis"in r)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");f.info(`Timeout of ${u} exceeds the interval of ${s}. Clamping timeout to interval duration.`),u=s}this._exportInterval=s,this._exportTimeout=u,this._exporter=n,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(r){Y(r)}}async _doRun(){if(this._ongoingExportPromise){f.debug("PeriodicExportingMetricReader: export already in progress, skipping");return}const r=async()=>{var a,u;const{resourceMetrics:n,errors:s}=await this.collect({timeoutMillis:this._exportTimeout});if(s.length>0&&f.error("PeriodicExportingMetricReader: metrics collection errors",...s),n.resource.asyncAttributesPending)try{await((u=(a=n.resource).waitForAsyncAttributes)==null?void 0:u.call(a))}catch(l){f.debug("Error while resolving async portion of resource: ",l),Y(l)}if(n.scopeMetrics.length===0)return;const i=this._maxExportBatchSize?rl(n,this._maxExportBatchSize):[n];let o=null;for(const l of i)try{const h=await Gt(Dc._export(this._exporter,l),this._exportTimeout);h.code!==D.SUCCESS&&(o=new Error(`PeriodicExportingMetricReader: metrics export failed (error ${h.error})`))}catch(h){if(h instanceof Oe){f.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else f.error("PeriodicExportingMetricReader: metrics export threw error",h),o=h instanceof Error?h:new Error(String(h))}if(o)throw o};this._ongoingExportPromise=r();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){f.debug("PeriodicExportingMetricReader: export already in progress, awaiting ongoing export");try{await this._ongoingExportPromise}catch(r){}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}class sl{constructor(){c(this,"_registeredViews",[])}addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(s=>this._matchInstrument(s.instrumentSelector,t)&&this._matchMeter(s.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}}function Q(e,t,r){var n,s,i,o;return cl(e)||f.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(n=r==null?void 0:r.description)!=null?n:"",unit:(s=r==null?void 0:r.unit)!=null?s:"",valueType:(i=r==null?void 0:r.valueType)!=null?i:X.DOUBLE,advice:(o=r==null?void 0:r.advice)!=null?o:{}}}function il(e,t){var r,n;return{name:(r=e.name)!=null?r:t.name,description:(n=e.description)!=null?n:t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function ol(e,t){return Iu(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}const al=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function cl(e){return al.test(e)}class he{constructor(t,r){c(this,"_writableMetricStorage");c(this,"_descriptor");this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n){if(typeof t!="number"){f.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===X.INT&&!Number.isInteger(t)&&(f.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,Date.now())}}class ul extends he{add(t,r,n){this._record(t,r,n)}}class ll extends he{add(t,r,n){if(t<0){f.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}}class hl extends he{record(t,r,n){this._record(t,r,n)}}class dl extends he{record(t,r,n){if(t<0){f.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}}class de{constructor(t,r,n){c(this,"_metricStorages");c(this,"_descriptor");c(this,"_observableRegistry");this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}}class _l extends de{}class pl extends de{}class fl extends de{}function xr(e){return e instanceof de}class ml{constructor(t){c(this,"_meterSharedState");this._meterSharedState=t}createGauge(t,r){const n=Q(t,g.GAUGE,r),s=this._meterSharedState.registerMetricStorage(n);return new hl(s,n)}createHistogram(t,r){const n=Q(t,g.HISTOGRAM,r),s=this._meterSharedState.registerMetricStorage(n);return new dl(s,n)}createCounter(t,r){const n=Q(t,g.COUNTER,r),s=this._meterSharedState.registerMetricStorage(n);return new ll(s,n)}createUpDownCounter(t,r){const n=Q(t,g.UP_DOWN_COUNTER,r),s=this._meterSharedState.registerMetricStorage(n);return new ul(s,n)}createObservableGauge(t,r){const n=Q(t,g.OBSERVABLE_GAUGE,r),s=this._meterSharedState.registerAsyncMetricStorage(n);return new pl(n,s,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){const n=Q(t,g.OBSERVABLE_COUNTER,r),s=this._meterSharedState.registerAsyncMetricStorage(n);return new _l(n,s,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){const n=Q(t,g.OBSERVABLE_UP_DOWN_COUNTER,r),s=this._meterSharedState.registerAsyncMetricStorage(n);return new fl(n,s,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}}class fi{constructor(t){c(this,"_instrumentDescriptor");this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=Q(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}class gl{constructor(t){c(this,"_valueMap",new Map);c(this,"_keyMap",new Map);c(this,"_hash");this._hash=t}get(t,r){return r!=null||(r=this._hash(t)),this._valueMap.get(r)}getOrDefault(t,r){const n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);const s=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,s),s}set(t,r,n){n!=null||(n=this._hash(t)),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r!=null||(r=this._hash(t)),this._valueMap.has(r)}*keys(){const t=this._keyMap.entries();let r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){const t=this._valueMap.entries();let r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}}class ot extends gl{constructor(){super(Ks)}}class mi{constructor(t,r){c(this,"_activeCollectionStorage",new ot);c(this,"_cumulativeMemoStorage",new ot);c(this,"_cardinalityLimit");c(this,"_overflowAttributes",{"otel.metric.overflow":!0});c(this,"_overflowHashCode");c(this,"_aggregator");this._aggregator=t,this._cardinalityLimit=(r!=null?r:2e3)-1,this._overflowHashCode=Ks(this._overflowAttributes)}record(t,r,n){let s=this._activeCollectionStorage.get(r);if(!s){const i=N(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){const o=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i));o==null||o.record(t);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(r,s)}s==null||s.record(t)}batchCumulate(t,r){for(const[n,s,i]of t.entries()){let o=n,a=i;const u=this._aggregator.createAccumulation(r);u==null||u.record(s);let l=u;if(this._cumulativeMemoStorage.has(o,a)){const h=this._cumulativeMemoStorage.get(o,a);l=this._aggregator.diff(h,u)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(o=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(o,a))){const h=this._cumulativeMemoStorage.get(o,a);l=this._aggregator.diff(h,u)}if(this._activeCollectionStorage.has(o,a)){const h=this._activeCollectionStorage.get(o,a);l=this._aggregator.merge(h,l)}this._cumulativeMemoStorage.set(o,u,a),this._activeCollectionStorage.set(o,l,a)}}collect(){const t=this._activeCollectionStorage;return this._activeCollectionStorage=new ot,t}}class St{constructor(t,r){c(this,"_aggregator");c(this,"_unreportedAccumulations",new Map);c(this,"_reportHistory",new Map);this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,s){this._stashAccumulations(n);const i=this._getMergedUnreportedAccumulations(t);let o=i,a;if(this._reportHistory.has(t)){const l=this._reportHistory.get(t),h=l.collectionTime;a=l.aggregationTemporality,a===k.CUMULATIVE?o=St.merge(l.accumulations,i,this._aggregator):o=St.calibrateStartTime(l.accumulations,i,h)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:o,collectionTime:s,aggregationTemporality:a});const u=El(o);if(u.length!==0)return this._aggregator.toMetricData(r,a,u,s)}_stashAccumulations(t){const r=this._unreportedAccumulations.keys();for(const n of r){let s=this._unreportedAccumulations.get(n);s===void 0&&(s=[],this._unreportedAccumulations.set(n,s)),s.push(t)}}_getMergedUnreportedAccumulations(t){let r=new ot;const n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(const s of n)r=St.merge(r,s,this._aggregator);return r}static merge(t,r,n){const s=t,i=r.entries();let o=i.next();for(;o.done!==!0;){const[a,u,l]=o.value;if(t.has(a,l)){const h=t.get(a,l),d=n.merge(h,u);s.set(a,d,l)}else s.set(a,u,l);o=i.next()}return s}static calibrateStartTime(t,r,n){for(const[s,i]of t.keys()){const o=r.get(s,i);o==null||o.setStartTime(n)}return r}}function El(e){return Array.from(e.entries())}class Tl extends fi{constructor(r,n,s,i,o){super(r);c(this,"_aggregationCardinalityLimit");c(this,"_deltaMetricStorage");c(this,"_temporalMetricStorage");c(this,"_attributesProcessor");this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new mi(n,this._aggregationCardinalityLimit),this._temporalMetricStorage=new St(n,i),this._attributesProcessor=s}record(r,n){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(r,n);return}const s=new ot;for(const[i,o]of r.entries())s.set(this._attributesProcessor.process(i),o);this._deltaMetricStorage.batchCumulate(s,n)}collect(r,n){const s=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,s,n)}}function gi(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
2
2
  `),e.type!==t.type&&(r+=` - Type '${e.type}' does not match '${t.type}'
3
3
  `),e.valueType!==t.valueType&&(r+=` - Value Type '${e.valueType}' does not match '${t.valueType}'
4
4
  `),e.description!==t.description&&(r+=` - Description '${e.description}' does not match '${t.description}'
@@ -10,4 +10,4 @@ var wo=Object.defineProperty;var Oo=(e,t,r)=>t in e?wo(e,t,{enumerable:!0,config
10
10
  To resolve the conflict:`,Ei(i,t))),n=s):f.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
11
11
  `,`Details:
12
12
  `,gi(i,t),`To resolve the conflict:
13
- `,Ei(i,t))}return n}}class wl{constructor(t){c(this,"_backingStorages");c(this,"hasAttributeProcessor");this._backingStorages=t,this.hasAttributeProcessor=t.some(r=>r.hasAttributeProcessor)}record(t,r,n,s){this.hasAttributeProcessor&&n===void 0&&(n=R.active());const i=this._backingStorages;for(let o=0;o<i.length;o++)i[o].record(t,r,n,s)}}class Ol{constructor(t,r){c(this,"_buffer",new ot);c(this,"_instrumentName");c(this,"_valueType");this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){f.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===X.INT&&!Number.isInteger(t)&&(f.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}}class Cl{constructor(){c(this,"_buffer",new Map)}observe(t,r,n={}){if(!xr(t))return;let s=this._buffer.get(t);if(s==null&&(s=new ot,this._buffer.set(t,s)),typeof r!="number"){f.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===X.INT&&!Number.isInteger(r)&&(f.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||s.set(n,r)}}class yl{constructor(){c(this,"_callbacks",[]);c(this,"_batchCallbacks",[])}addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){const n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){const n=new Set(r.filter(xr));if(n.size===0){f.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){const n=new Set(r.filter(xr)),s=this._findBatchCallback(t,n);s<0||this._batchCallbacks.splice(s,1)}async observe(t,r){const n=this._observeCallbacks(t,r),s=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...s])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:s})=>{const i=new Ol(s._descriptor.name,s._descriptor.valueType);let o=Promise.resolve(n(i));r!=null&&(o=Gt(o,r)),await o,s._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:s})=>{const i=new Cl;let o=Promise.resolve(n(i));r!=null&&(o=Gt(o,r)),await o,s.forEach(a=>{const u=i._buffer.get(a);u!=null&&a._metricStorages.forEach(l=>{l.record(u,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&Mu(n.instruments,r))}}class Pl extends fi{constructor(r,n,s,i,o){super(r);c(this,"_aggregationCardinalityLimit");c(this,"_deltaMetricStorage");c(this,"_temporalMetricStorage");c(this,"_attributesProcessor");c(this,"hasAttributeProcessor");this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new mi(n,this._aggregationCardinalityLimit),this._temporalMetricStorage=new St(n,i),this._attributesProcessor=s,this.hasAttributeProcessor=s!==void 0}record(r,n,s,i){this._attributesProcessor!==void 0&&(n=this._attributesProcessor.process(n,s!=null?s:R.active())),this._deltaMetricStorage.record(r,n,i)}collect(r,n){const s=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,s,n)}}class Ml{constructor(t,r){c(this,"metricStorageRegistry",new hn);c(this,"observableRegistry",new yl);c(this,"meter");c(this,"_meterProviderSharedState");c(this,"_instrumentationScope");this.meter=new ml(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){const r=this._registerMetricStorage(t,Pl);return r.length===1?r[0]:new wl(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Tl)}async collect(t,r,n){const s=await this.observableRegistry.observe(r,n==null?void 0:n.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;const o=[];return i.forEach(a=>{const u=a.collect(t,r);u!=null&&o.push(u)}),o.length===0?{errors:s}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:s}}_registerMetricStorage(t,r){let s=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{const o=il(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;const u=i.aggregation.createAggregator(o),l=new r(o,u,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(l),l});if(s.length===0){const o=this._meterProviderSharedState.selectAggregations(t.type).map(([a,u])=>{const l=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(l!=null)return l;const h=u.createAggregator(t),d=a.selectCardinalityLimit(t.type),p=new r(t,h,void 0,[a],d);return this.metricStorageRegistry.registerForCollector(a,p),p});s=s.concat(o)}return s}}class vl{constructor(t){c(this,"viewRegistry",new sl);c(this,"metricCollectors",[]);c(this,"meterSharedStates",new Map);c(this,"resource");this.resource=t}getMeterSharedState(t){const r=Pu(t);let n=this.meterSharedStates.get(r);return n==null&&(n=new Ml(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){const r=[];for(const n of this.metricCollectors)r.push([n,hi(n.selectAggregation(t))]);return r}}class Il{constructor(t,r){c(this,"_sharedState");c(this,"_metricReader");this._sharedState=t,this._metricReader=r}async collect(t){const r=N(Date.now()),n=[],s=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async o=>{const a=await o.collect(this,r,t);(a==null?void 0:a.scopeMetrics)!=null&&n.push(a.scopeMetrics),(a==null?void 0:a.errors)!=null&&s.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:s}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){var r,n,s;return(s=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,t))!=null?s:2e3}}const Nl=/[\^$\\.+?()[\]{}|]/g;class ye{constructor(t){c(this,"_matchAll");c(this,"_regexp");t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(ye.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(Nl,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}}class _e{constructor(t){c(this,"_matchAll");c(this,"_pattern");this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}}class Ll{process(t,r){return t}}class xl{constructor(t){c(this,"_processors");this._processors=t}process(t,r){let n=t;for(const s of this._processors)n=s.process(n,r);return n}}function Ul(){return kl}function Dl(e){return new xl(e)}const kl=new Ll;class Bl{constructor(t){c(this,"_nameFilter");c(this,"_type");c(this,"_unitFilter");var r;this._nameFilter=new ye((r=t==null?void 0:t.name)!=null?r:"*"),this._type=t==null?void 0:t.type,this._unitFilter=new _e(t==null?void 0:t.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}class Gl{constructor(t){c(this,"_nameFilter");c(this,"_versionFilter");c(this,"_schemaUrlFilter");this._nameFilter=new _e(t==null?void 0:t.name),this._versionFilter=new _e(t==null?void 0:t.version),this._schemaUrlFilter=new _e(t==null?void 0:t.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}function Fl(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function $l(e){if(Fl(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||ye.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}class Vl{constructor(t){c(this,"name");c(this,"description");c(this,"aggregation");c(this,"attributesProcessor");c(this,"instrumentSelector");c(this,"meterSelector");c(this,"aggregationCardinalityLimit");var r;$l(t),t.attributesProcessors!=null?this.attributesProcessor=Dl(t.attributesProcessors):this.attributesProcessor=Ul(),this.name=t.name,this.description=t.description,this.aggregation=hi((r=t.aggregation)!=null?r:{type:B.DEFAULT}),this.instrumentSelector=new Bl({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new Gl({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}}class Hl{constructor(t){c(this,"_sharedState");c(this,"_shutdown",!1);var r;if(this._sharedState=new vl((r=t==null?void 0:t.resource)!=null?r:ks()),(t==null?void 0:t.views)!=null&&t.views.length>0)for(const n of t.views)this._sharedState.viewRegistry.addView(new Vl(n));if((t==null?void 0:t.readers)!=null&&t.readers.length>0)for(const n of t.readers){const s=new Il(this._sharedState,n);n.setMetricProducer(s),this._sharedState.metricCollectors.push(s),t.sdkMetricsEnabled&&n instanceof pi&&n._setSelfObsMeterProvider(this)}}getMeter(t,r="",n={}){return this._shutdown?(f.warn("A shutdown MeterProvider cannot provide a Meter"),Mt()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){f.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){f.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}}class Ti{constructor(t){c(this,"_delegate");this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(t){this._delegate.setMetrics(t)}}class Si extends Error{constructor(r,n,s){super(r);c(this,"code");c(this,"name","OTLPExporterError");c(this,"data");this.data=s,this.code=n}}function zl(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function jl(e){if(e!=null)return async()=>e}function ql(e,t,r){var n,s,i,o,a,u;return{timeoutMillis:zl((s=(n=e.timeoutMillis)!=null?n:t.timeoutMillis)!=null?s:r.timeoutMillis),concurrencyLimit:(o=(i=e.concurrencyLimit)!=null?i:t.concurrencyLimit)!=null?o:r.concurrencyLimit,compression:(u=(a=e.compression)!=null?a:t.compression)!=null?u:r.compression}}function Wl(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class Xl{constructor(t){c(this,"_concurrencyLimit");c(this,"_sendingPromises",[]);this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);const r=()=>{const n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function Yl(e){return new Xl(e.concurrencyLimit)}function Kl(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Ql(){return{handleResponse(e){e==null||!Kl(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||f.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class Jl{constructor(t,r,n,s,i,o){c(this,"_metrics");c(this,"_diagLogger");c(this,"_transport");c(this,"_serializer");c(this,"_responseHandler");c(this,"_promiseQueue");c(this,"_timeout");this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=s,this._timeout=o,this._diagLogger=f.createComponentLogger({namespace:"OTLPExportDelegate"}),this._metrics=i}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:D.FAILED,error:new Error("Concurrent export limit reached")});return}const n=this._serializer.serializeRequest(t);if(n==null){r({code:D.FAILED,error:new Error("Nothing to send")});return}const s=this._metrics.startExport(t);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(i=>{var o;if(i.status==="success"){if(s(void 0),i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(a){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",a,i.data)}r({code:D.SUCCESS});return}else if(i.status==="failure"&&i.error){s(i.error),r({code:D.FAILED,error:i.error});return}else i.status==="retryable"?(s("export_max_retries"),r({code:D.FAILED,error:(o=i.error)!=null?o:new Si("Export failed with retryable status")})):(s("export_failed"),r({code:D.FAILED,error:new Si("Export failed with unknown error")}))},i=>{s(i),r({code:D.FAILED,error:i})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(t){this._metrics=t}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function Zl(e,t){return new Jl(e.transport,e.serializer,Ql(),e.promiseHandler,e.metrics,t.timeout)}function th(e,t,r,n){return Zl({transport:n,serializer:t,promiseHandler:Yl(e),metrics:r},{timeout:e.timeoutMillis})}const Ai="http.response.status_code",eh="otel.component.name",rh="otel.component.type",nh="server.address",sh="server.port",ih="error.type",oh="0.221.0",Ri=new Map;class ah{constructor(t){c(this,"inflight");c(this,"exported");c(this,"duration");c(this,"standardAttrs");c(this,"responseAttributesFromError");c(this,"helper");var l;const{componentType:r,metricsHelper:n,meterProvider:s,url:i,responseAttributesFromError:o}=t;this.responseAttributesFromError=o;const a=s?s.getMeter("@opentelemetry/otlp-exporter",oh):Mt(),u=(l=Ri.get(r))!=null?l:0;if(Ri.set(r,u+1),this.standardAttrs={[rh]:r,[eh]:`${r}/${u}`},i){let h=i;i.includes("://")||(h=`http://${i}`);try{const d=new URL(h);this.standardAttrs[nh]=d.hostname;let p;d.port?p=Number(d.port):d.protocol==="http:"?p=80:d.protocol==="https:"&&(p=443),typeof p=="number"&&(this.standardAttrs[sh]=p)}catch(d){}}this.helper=n,this.inflight=a.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=a.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=a.createHistogram("otel.sdk.exporter.operation.duration",{unit:"s",description:"The duration of exporting a batch of telemetry records.",advice:{explicitBucketBoundaries:[]}})}startExport(t){const r=this.helper.countItems(t),n=G();return this.inflight.add(r,this.standardAttrs),s=>{const i=G();this.inflight.add(-r,this.standardAttrs);const o=s?{...this.standardAttrs,[ih]:s instanceof Error?s.name:"export_failed"}:this.standardAttrs;this.exported.add(r,o);const a={...o,...this.responseAttributesFromError(s)},u=nc(pr(n,i))/1e3;this.duration.record(u,a)}}}const bi={name:"metric_data_point",countItems:e=>{let t=0;for(const r of e.scopeMetrics)for(const n of r.metrics)t+=n.dataPoints.length;return t}},ch={name:"span",countItems:e=>e.length};var wi;(function(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"})(wi||(wi={}));class Oi{emit(t){}enabled(){return!1}}const uh=new Oi,pe=Symbol.for("io.opentelemetry.js.api.logs"),Vt=globalThis;function lh(e,t,r){return n=>n===e?t:r}const Ci=1;class hh{getLogger(t,r,n){return new Oi}}const yi=new hh;class dh{constructor(t,r,n,s){this._provider=t,this.name=r,this.version=n,this.options=s}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;const t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):uh}}class Pi{getLogger(t,r,n){var s;return(s=this._getDelegateLogger(t,r,n))!==null&&s!==void 0?s:new dh(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:yi}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getLogger(t,r,n)}}class dn{constructor(){this._proxyLoggerProvider=new Pi}static getInstance(){return this._instance||(this._instance=new dn),this._instance}setGlobalLoggerProvider(t){return Vt[pe]?this.getLoggerProvider():(Vt[pe]=lh(Ci,t,yi),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=Vt[pe])===null||t===void 0?void 0:t.call(Vt,Ci))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete Vt[pe],this._proxyLoggerProvider=new Pi}}const Mi=dn.getInstance();function vi(e,t){const r={attributes:J(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Ii(e,t){var n;const r={name:e.name,version:e.version};return e.attributes&&Object.keys(e.attributes).length>0&&(r.attributes=J(e.attributes,t),r.droppedAttributesCount=(n=e.droppedAttributesCount)!=null?n:0),r}function J(e,t){return Object.keys(e).map(r=>_h(r,e[r],t))}function _h(e,t,r){return{key:e,value:Ur(t,r)}}function Ur(e,t){const r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=Ur(e[s],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){const n=Object.keys(e),s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]={key:n[i],value:Ur(e[n[i]],t)};return{kvlistValue:{values:s}}}return{}}function ph(e){const t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function fh(e){return ph(e).toString()}const mh=typeof BigInt<"u"?fh:q;function Ni(e){return e}const Li={encodeHrTime:mh,encodeSpanContext:Ni,encodeOptionalSpanContext:Ni,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var fe;(function(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"})(fe||(fe={}));function gh(e,t){const r=vi(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:Eh(e.scopeMetrics,t)}}function Eh(e,t){return Array.from(e.map(r=>({scope:Ii(r.scope,t),metrics:r.metrics.map(n=>Th(n,t)),schemaUrl:r.scope.schemaUrl})))}function Th(e,t){const r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=bh(e.aggregationTemporality);switch(e.dataPointType){case V.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:xi(e,t)};break;case V.GAUGE:r.gauge={dataPoints:xi(e,t)};break;case V.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ah(e,t)};break;case V.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Rh(e,t)};break}return r}function Sh(e,t,r){const n={attributes:J(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case X.INT:n.asInt=e.value;break;case X.DOUBLE:n.asDouble=e.value;break}return n}function xi(e,t){return e.dataPoints.map(r=>Sh(r,e.descriptor.valueType,t))}function Ah(e,t){return e.dataPoints.map(r=>{const n=r.value;return{attributes:J(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Rh(e,t){return e.dataPoints.map(r=>{const n=r.value;return{attributes:J(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function bh(e){switch(e){case k.DELTA:return fe.AGGREGATION_TEMPORALITY_DELTA;case k.CUMULATIVE:return fe.AGGREGATION_TEMPORALITY_CUMULATIVE}}function wh(e,t){return{resourceMetrics:e.map(r=>gh(r,t))}}const Oh={serializeRequest:e=>{const t=wh([e],Li);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return f.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}},Ch=256,yh=512;function Ui(e,t){let r=e&255|Ch;return t&&(r|=yh),r}function Ph(e,t){var i,o,a,u;const r=e.spanContext(),n=e.status,s=(i=e.parentSpanContext)!=null&&i.spanId?t.encodeSpanContext((o=e.parentSpanContext)==null?void 0:o.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:s,traceState:(a=r.traceState)==null?void 0:a.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:J(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(l=>vh(l,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(l=>Mh(l,t)),droppedLinksCount:e.droppedLinksCount,flags:Ui(r.traceFlags,(u=e.parentSpanContext)==null?void 0:u.isRemote)}}function Mh(e,t){var r;return{attributes:e.attributes?J(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(r=e.context.traceState)==null?void 0:r.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ui(e.context.traceFlags,e.context.isRemote)}}function vh(e,t){return{attributes:e.attributes?J(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ih(e,t){return{resourceSpans:Lh(e,t)}}function Nh(e){const t=new Map;for(const r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));const s=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let i=n.get(s);i||(i=[],n.set(s,i)),i.push(r)}return t}function Lh(e,t){const r=Nh(e),n=[],s=r.entries();let i=s.next();for(;!i.done;){const[o,a]=i.value,u=[],l=a.values();let h=l.next();for(;!h.done;){const _=h.value;if(_.length>0){const E=_.map(m=>Ph(m,t));u.push({scope:Ii(_[0].instrumentationScope,t),spans:E,schemaUrl:_[0].instrumentationScope.schemaUrl})}h=l.next()}const d=vi(o,t),p={resource:d,scopeSpans:u,schemaUrl:d.schemaUrl};n.push(p),i=s.next()}return n}const xh={serializeRequest:e=>{const t=Ih(e,Li);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return f.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}},Dr=5,Uh=1e3,Dh=5e3,kh=1.5,Di=.2;function Bh(){return Math.random()*(2*Di)-Di}class Gh{constructor(t){c(this,"_transport");this._transport=t}retry(t,r,n){return new Promise((s,i)=>{setTimeout(()=>{this._transport.send(t,r).then(s,i)},n)})}async send(t,r){var a;let n=Dr,s=Uh;const i=Date.now()+r;let o=await this._transport.send(t,r);for(;o.status==="retryable"&&n>0;){n--;const u=Math.max(Math.min(s*(1+Bh()),Dh),0);s=s*kh;const l=(a=o.retryInMillis)!=null?a:u,h=i-Date.now();if(l>h)return f.info(`Export retry time ${Math.round(l)}ms exceeds remaining timeout ${Math.round(h)}ms, not retrying further.`),o;f.verbose(`Scheduling export retry in ${Math.round(l)}ms`),o=await this.retry(t,h,l)}return o.status==="success"?f.verbose(`Export succeeded after ${Dr-n} retry attempts.`):o.status==="retryable"?f.info(`Export failed after maximum retry attempts (${Dr}).`):f.info(`Export failed with non-retryable error: ${o.error}`),o}shutdown(){return this._transport.shutdown()}}function Fh(e){return new Gh(e.transport)}function $h(e){return e===429||e===502||e===503||e===504}function Vh(e){if(e==null)return;const t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;const r=new Date(e).getTime()-Date.now();return r>=0?r:0}const Hh=60*1024,zh=9;let kr=0,me=0;class jh{constructor(t){c(this,"_parameters");this._parameters=t}async send(t,r){const n=new AbortController,s=setTimeout(()=>n.abort(),r);let i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);const o=t.byteLength,a=kr+o>Hh,u=me>=zh,l=!a&&!u;if(l)kr+=o,me++;else{const h=a?"size limit":"count limit";f.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${me} pending (${h})`)}try{const h=new URL(this._parameters.url),d=await i(h.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:l,mode:globalThis.location?globalThis.location.origin===h.origin?"same-origin":"cors":"no-cors"});if(d.status>=200&&d.status<=299)return f.debug(`export response success (status: ${d.status})`),{status:"success"};if($h(d.status)){f.warn(`export response retryable (status: ${d.status})`);const p=d.headers.get("Retry-After");return{status:"retryable",retryInMillis:Vh(p)}}return f.error(`export response failure (status: ${d.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${d.status}`)}}catch(h){return Wh(h)?(f.warn(`export request retryable (network error: ${h})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:h})}):(f.error(`export request failure (error: ${h})`),{status:"failure",error:new Error("Fetch request errored",{cause:h})})}finally{clearTimeout(s),l&&(kr-=o,me--)}}shutdown(){}}function qh(e){return new jh(e)}function Wh(e){return e instanceof TypeError&&!e.cause}function Xh(e,t,r){return th(e,t,r,Fh({transport:qh(e)}))}function Yh(e){const t={};return Object.entries(e!=null?e:{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):f.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function Kh(e,t,r){return async()=>{const n={...await r()},s={};return t!=null&&Object.assign(s,await t()),e!=null&&Object.assign(s,Yh(await e())),Object.assign(s,n)}}function Qh(e){var t;if(e!=null)try{const r=(t=globalThis.location)==null?void 0:t.href;return new URL(e,r).href}catch(r){throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Jh(e,t,r){var n,s;return{...ql(e,t,r),headers:Kh(e.headers,t.headers,r.headers),url:(s=(n=Qh(e.url))!=null?n:t.url)!=null?s:r.url}}function Zh(e,t){return{...Wl(),headers:async()=>e,url:"http://localhost:4318/"+t}}function td(e){return typeof e.headers=="function"?e.headers:jl(e.headers)}function ed(e,t,r){return Jh({url:e.url,timeoutMillis:e.timeoutMillis,headers:td(e),concurrencyLimit:e.concurrencyLimit},{},Zh(r,t))}function ki(e,t,r,n){return new ah({componentType:e,metricsHelper:t,url:r,meterProvider:n,responseAttributesFromError:s=>{if(!s)return{[Ai]:200};if(!(s instanceof Error))return{};if(s.message.startsWith("Fetch request failed with non-retryable status ")){const i=s.message.substring(47);return{[Ai]:Number(i)}}return{}}})}function Bi(e,t,r,n,s,i,o){const a=ed(e,i,o);return Xh(a,t,ki(r,n,a.url,e.selfObsMeterProvider))}const rd="otlp_http_span_exporter";class nd extends Ti{constructor(t={}){super(Bi(t,xh,rd,ch,t.selfObsMeterProvider,"v1/traces",{"Content-Type":"application/json"}))}}var ge;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(ge||(ge={}));const Br=()=>k.CUMULATIVE,Gi=e=>{switch(e){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.GAUGE:case g.HISTOGRAM:case g.OBSERVABLE_GAUGE:return k.DELTA;case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return k.CUMULATIVE}},Fi=e=>{switch(e){case g.COUNTER:case g.HISTOGRAM:return k.DELTA;case g.GAUGE:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_GAUGE:return k.CUMULATIVE}};function sd(){const e="cumulative".toLowerCase();return e==="cumulative"?Br:e==="delta"?Gi:e==="lowmemory"?Fi:(f.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Br)}function id(e){return e!=null?e===ge.DELTA?Gi:e===ge.LOWMEMORY?Fi:Br:sd()}const od=Object.freeze({type:B.DEFAULT});function ad(e){var t;return(t=e==null?void 0:e.aggregationPreference)!=null?t:(()=>od)}class cd extends Ti{constructor(r,n){super(r);c(this,"_aggregationTemporalitySelector");c(this,"_aggregationSelector");this._aggregationSelector=ad(n),this._aggregationTemporalitySelector=id(n==null?void 0:n.temporalityPreference)}selectAggregation(r){return this._aggregationSelector(r)}selectAggregationTemporality(r){return this._aggregationTemporalitySelector(r)}}const $i="otlp_http_metric_exporter";class ud extends cd{constructor(r){super(Bi(r!=null?r:{},Oh,$i,bi,r==null?void 0:r.selfObsMeterProvider,"v1/metrics",{"Content-Type":"application/json"}),r);c(this,"_url");this._url=r==null?void 0:r.url}setSelfObsMeterProvider(r){this.setMetrics(ki($i,bi,this._url,r))}}function ld(e,t,r,n){for(let s=0,i=e.length;s<i;s++){const o=e[s];t&&o.setTracerProvider(t),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function hd(e){e.forEach(t=>t.disable())}function dd(e){var i,o;const t=e.tracerProvider||w.getTracerProvider(),r=e.meterProvider||rr.getMeterProvider(),n=e.loggerProvider||Mi.getLoggerProvider(),s=(o=(i=e.instrumentations)==null?void 0:i.flat())!=null?o:[];return ld(s,t,r,n),()=>{hd(s)}}let v=console.error.bind(console);function Ht(e,t,r){const n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}const Vi=(e,t,r)=>{if(!e||!e[t]){v("no original function "+String(t)+" to wrap");return}if(!r){v("no wrapper function"),v(new Error().stack);return}const n=e[t];if(typeof n!="function"||typeof r!="function"){v("original object and wrapper must be functions");return}const s=r(n,t);return Ht(s,"__original",n),Ht(s,"__unwrap",()=>{e[t]===s&&Ht(e,t,n)}),Ht(s,"__wrapped",!0),Ht(e,t,s),s},_d=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{v("must provide one or more modules to patch"),v(new Error().stack);return}if(!(t&&Array.isArray(t))){v("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(s=>{Vi(n,s,r)})})},Hi=(e,t)=>{if(!e||!e[t]){v("no function to unwrap."),v(new Error().stack);return}const r=e[t];if(!r.__unwrap)v("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},pd=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{v("must provide one or more modules to patch"),v(new Error().stack);return}if(!(t&&Array.isArray(t))){v("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{Hi(r,n)})})};class fd{constructor(t,r,n){c(this,"_config",{});c(this,"_tracer");c(this,"_meter");c(this,"_logger");c(this,"_diag");c(this,"instrumentationName");c(this,"instrumentationVersion");c(this,"_wrap",Vi);c(this,"_unwrap",Hi);c(this,"_massWrap",_d);c(this,"_massUnwrap",pd);this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=f.createComponentLogger({namespace:t}),this._tracer=w.getTracer(t,r),this._meter=rr.getMeter(t,r),this._logger=Mi.getLogger(t,r),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var r;const t=(r=this.init())!=null?r:[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,s){if(t)try{t(n,s)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}}class Gr extends fd{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}}function zt(e,t,r){let n,s;try{s=e()}catch(i){n=i}finally{return t(n,s),s}}var jt;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(jt||(jt={}));const md="0.66.0",gd="@opentelemetry/instrumentation-document-load";var Ee;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(Ee||(Ee={}));const Ed=()=>{var r;const e={},t=(r=O.getEntriesByType)==null?void 0:r.call(O,"navigation")[0];if(t)Object.values(S).forEach(s=>{if(dt(t,s)){const i=t[s];typeof i=="number"&&(e[s]=i)}});else{const s=O.timing;s&&Object.values(S).forEach(o=>{if(dt(s,o)){const a=s[o];typeof a=="number"&&(e[o]=a)}})}return e},zi={"first-paint":Ee.FIRST_PAINT,"first-contentful-paint":Ee.FIRST_CONTENTFUL_PAINT},Td=e=>{var r;const t=(r=O.getEntriesByType)==null?void 0:r.call(O,"paint");t&&t.forEach(({name:n,startTime:s})=>{dt(zi,n)&&e.addEvent(zi[n],s)})};class Sd extends Gr{constructor(r={}){super(gd,md,r);c(this,"component","document-load");c(this,"version","1");c(this,"moduleName",this.component)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(r){var s;const n=(s=O.getEntriesByType)==null?void 0:s.call(O,"resource");n&&n.forEach(i=>{this._initResourceSpan(i,r)})}_collectPerformance(){const r=Array.from(document.getElementsByTagName("meta")).find(i=>i.getAttribute("name")===oe),n=Ed(),s=r&&r.content||"";R.with(U.extract(et,{traceparent:s}),()=>{var o;const i=this._startSpan(jt.DOCUMENT_LOAD,S.FETCH_START,n);i&&(R.with(w.setSpan(R.active(),i),()=>{const a=this._startSpan(jt.DOCUMENT_FETCH,S.FETCH_START,n);a&&(a.setAttribute(xt,location.href),R.with(w.setSpan(R.active(),a),()=>{var u;_t(a,n,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(a,(u=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:u.documentFetch),this._endSpan(a,S.RESPONSE_END,n)}))}),i.setAttribute(xt,location.href),i.setAttribute(Ja,navigator.userAgent),this._addResourcesSpans(i),this.getConfig().ignoreNetworkEvents||(C(i,S.FETCH_START,n),C(i,S.UNLOAD_EVENT_START,n),C(i,S.UNLOAD_EVENT_END,n),C(i,S.DOM_INTERACTIVE,n),C(i,S.DOM_CONTENT_LOADED_EVENT_START,n),C(i,S.DOM_CONTENT_LOADED_EVENT_END,n),C(i,S.DOM_COMPLETE,n),C(i,S.LOAD_EVENT_START,n),C(i,S.LOAD_EVENT_END,n)),this.getConfig().ignorePerformancePaintEvents||Td(i),this._addCustomAttributesOnSpan(i,(o=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:o.documentLoad),this._endSpan(i,S.LOAD_EVENT_END,n))})}_endSpan(r,n,s){r&&(dt(s,n)?r.end(s[n]):r.end())}_initResourceSpan(r,n){var i;const s=this._startSpan(jt.RESOURCE_FETCH,S.FETCH_START,r,n);s&&(s.setAttribute(xt,r.name),_t(s,r,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnResourceSpan(s,r,(i=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:i.resourceFetch),this._endSpan(s,S.RESPONSE_END,r))}_startSpan(r,n,s,i){if(dt(s,n)&&typeof s[n]=="number")return this.tracer.startSpan(r,{startTime:s[n]},i?w.setSpan(R.active(),i):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(r,n){n&&zt(()=>n(r),s=>{s&&this._diag.error("addCustomAttributesOnSpan",s)})}_addCustomAttributesOnResourceSpan(r,n,s){s&&zt(()=>s(r,n),i=>{i&&this._diag.error("addCustomAttributesOnResourceSpan",i)})}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}}const Ad="http.request.body.size",ji=f.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Rd(...e){if(e[0]instanceof URL||typeof e[0]=="string"){const t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){const{body:r,length:n}=bd(t.body);return t.body=r,n}else return Promise.resolve(Od(t.body))}else{const t=e[0];return t!=null&&t.body?t.clone().text().then(r=>Fr(r)):Promise.resolve()}}function bd(e){if(!e.pipeThrough)return ji.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r;const n=new Promise(i=>{r=i}),s=new TransformStream({start(){},async transform(i,o){const a=await i;t+=a.byteLength,o.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(s),length:n}}function wd(e){return typeof Document<"u"&&e instanceof Document}function Od(e){if(wd(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return Fr(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return yd(e);if(e instanceof URLSearchParams)return Fr(e.toString());if(e.byteLength!==void 0)return e.byteLength;ji.warn("unknown body type")}const Cd=new TextEncoder;function Fr(e){return Cd.encode(e).byteLength}function yd(e){let t=0;for(const[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function Pd(e){const t=vd(),r=e.toUpperCase();return r in t?r:"_OTHER"}const Md={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let $r;function vd(){return $r===void 0&&($r=Md),$r}const Id={"https:":"443","http:":"80"};function Nd(e){const t=Number(e.port||Id[e.protocol]);if(t&&!isNaN(t))return t}const qi="0.221.0",Ld=300,Wi=typeof PerformanceObserver<"u";class xd extends Gr{constructor(r={}){super("@opentelemetry/instrumentation-fetch",qi,r);c(this,"component","fetch");c(this,"version",qi);c(this,"moduleName",this.component);c(this,"_usedResources",new WeakSet);c(this,"_tasksCount",0)}init(){}_addChildSpan(r,n){const s=this.tracer.startSpan("CORS Preflight",{startTime:n[S.FETCH_START]},w.setSpan(R.active(),r));_t(s,n,this.getConfig().ignoreNetworkEvents,void 0,!0),s.end(n[S.RESPONSE_END])}_addFinalSpanAttributes(r,n){const s=K(n.url);r.setAttribute(ps,n.status),r.setAttribute(fs,s.hostname);const i=Nd(s);i&&r.setAttribute(ms,i)}_addHeaders(r,n){if(!Ys(n,this.getConfig().propagateTraceHeaderCorsUrls)){const s={};U.inject(R.active(),s),Object.keys(s).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(r instanceof Request)U.inject(R.active(),r.headers,{set:(s,i,o)=>s.set(i,typeof o=="string"?o:String(o))});else{const s=new Headers(r.headers);U.inject(R.active(),s,{set:(i,o,a)=>i.set(o,typeof a=="string"?a:String(a))}),r.headers=s}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(r,n={}){if(Us(r,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}const s={},i=n.method,o=Pd(n.method||"GET"),a=o;return s[ds]=o,o!==i&&(s[_s]=i),s[xt]=r,this.tracer.startSpan(a,{kind:It.CLIENT,attributes:s})}_findResourceAndAddNetworkEvents(r,n,s){let i=n.entries;if(!i.length){if(!performance.getEntriesByType)return;i=performance.getEntriesByType("resource")}const o=Xs(n.spanUrl,n.startTime,s,i,this._usedResources,"fetch");if(o.mainRequest){const a=o.mainRequest;this._markResourceAsUsed(a);const u=o.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u)),_t(r,a,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_markResourceAsUsed(r){this._usedResources.add(r)}_endSpan(r,n,s){const i=N(Date.now()),o=G();this._addFinalSpanAttributes(r,s),s.status>=400&&(r.setStatus({code:j.ERROR}),r.setAttribute(Lt,String(s.status))),setTimeout(()=>{var a;(a=n.observer)==null||a.disconnect(),this._findResourceAndAddNetworkEvents(r,n,o),this._tasksCount--,this._clearResources(),r.end(i)},Ld)}_patchConstructor(){return r=>{const n=this;return function(...i){if(!n._isEnabled)return r.apply(this,i);const o=this,a=K(i[0]instanceof Request?i[0].url:String(i[0])).href;let u;i[0]instanceof Request?u=i[1]!=null?new Request(i[0],i[1]):i[0]:u=i[1]||{};const l=n._createSpan(a,u);if(!l)return r.apply(this,i);const h=n._prepareSpanData(a);n.getConfig().measureRequestSize&&Rd(...i).then(m=>{m&&l.setAttribute(Ad,m)}).catch(m=>{n._diag.warn("getFetchBodyLength",m)});function d(m,T){n._applyAttributesAfterFetch(m,u,T),n._endSpan(m,h,{status:T.status||0,statusText:T.message,url:a})}function p(m,T){n._applyAttributesAfterFetch(m,u,T),T.status>=200&&T.status<400?n._endSpan(m,h,T):n._endSpan(m,h,{status:T.status,statusText:T.statusText,url:a})}function _(m,T){try{const M=T.clone().body;if(M){const y=M.getReader(),At=()=>{y.read().then(({done:ut})=>{ut?p(m,T):At()},ut=>{d(m,ut)})};At()}else p(m,T)}catch(A){n._diag.error("Failed to read fetch response body",A),n._endSpan(m,h,{status:0,url:a})}return T}function E(m,T){try{d(m,T)}catch(A){n._diag.error("Failed to end span on fetch error",A),n._endSpan(m,h,{status:T.status||0,url:a})}throw T}return R.with(w.setSpan(R.active(),l),()=>(n._callRequestHook(l,u),n._addHeaders(u,a),n._tasksCount++,r.apply(o,u instanceof Request?[u]:[a,u]).then(_.bind(o,l),E.bind(o,l))))}}}_applyAttributesAfterFetch(r,n,s){const i=this.getConfig().applyCustomAttributesOnSpan;i&&zt(()=>i(r,n,s),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)})}_callRequestHook(r,n){const s=this.getConfig().requestHook;s&&zt(()=>s(r,n),i=>{i&&this._diag.error("requestHook",i)})}_prepareSpanData(r){const n=G(),s=[];if(typeof PerformanceObserver!="function")return{entries:s,startTime:n,spanUrl:r};const i=new PerformanceObserver(o=>{o.getEntries().forEach(u=>{u.initiatorType==="fetch"&&u.name===r&&s.push(u)})});return i.observe({entryTypes:["resource"]}),{entries:s,observer:i,startTime:n,spanUrl:r}}enable(){if(!Wi){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug("fetch constructor already patched"),this._isEnabled=!0;return}try{this._wrap(globalThis,"fetch",this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(r){this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.",r)}}}disable(){Wi&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}const Ud="http.request.body.size";var W;(function(e){e.METHOD_OPEN="open",e.METHOD_SEND="send",e.EVENT_ABORT="abort",e.EVENT_ERROR="error",e.EVENT_LOAD="loaded",e.EVENT_TIMEOUT="timeout"})(W||(W={}));const Dd=f.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function kd(e){return typeof Document<"u"&&e instanceof Document}function Bd(e){if(kd(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return Xi(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Fd(e);if(e instanceof URLSearchParams)return Xi(e.toString());if(e.byteLength!==void 0)return e.byteLength;Dd.warn("unknown body type")}const Gd=new TextEncoder;function Xi(e){return Gd.encode(e).byteLength}function Fd(e){let t=0;for(const[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function $d(e){const t=Hd(),r=e.toUpperCase();return r in t?r:"_OTHER"}const Vd={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let Vr;function Hd(){return Vr===void 0&&(Vr=Vd),Vr}const zd={"https:":"443","http:":"80"};function jd(e){const t=Number(e.port||zd[e.protocol]);if(t&&!isNaN(t))return t}const Yi="0.221.0",qd=300;class Wd extends Gr{constructor(r={}){super("@opentelemetry/instrumentation-xml-http-request",Yi,r);c(this,"component","xml-http-request");c(this,"version",Yi);c(this,"moduleName",this.component);c(this,"_tasksCount",0);c(this,"_xhrMem",new WeakMap);c(this,"_usedResources",new WeakSet)}init(){}_addHeaders(r,n){const s=K(n).href;if(!Ys(s,this.getConfig().propagateTraceHeaderCorsUrls)){const o={};U.inject(R.active(),o),Object.keys(o).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}const i={};U.inject(R.active(),i),Object.keys(i).forEach(o=>{r.setRequestHeader(o,String(i[o]))})}_addChildSpan(r,n){R.with(w.setSpan(R.active(),r),()=>{const s=this.tracer.startSpan("CORS Preflight",{startTime:n[S.FETCH_START]});_t(s,n,this.getConfig().ignoreNetworkEvents,void 0,!0),s.end(n[S.RESPONSE_END])})}_addFinalSpanAttributes(r,n){n.status&&r.setAttribute(ps,n.status)}_applyAttributesAfterXHR(r,n){const s=this.getConfig().applyCustomAttributesOnSpan;typeof s=="function"&&zt(()=>s(r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)})}_addResourceObserver(r,n){const s=this._xhrMem.get(r);!s||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(s.createdResources={observer:new PerformanceObserver(i=>{const o=i.getEntries(),a=K(n);o.forEach(u=>{u.initiatorType==="xmlhttprequest"&&u.name===a.href&&s.createdResources&&s.createdResources.entries.push(u)})}),entries:[]},s.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(O.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(r,n,s,i,o){if(!s||!i||!o||!r.createdResources)return;let a=r.createdResources.entries;(!a||!a.length)&&(a=O.getEntriesByType("resource"));const u=Xs(K(s).href,i,o,a,this._usedResources);if(u.mainRequest){const l=u.mainRequest;this._markResourceAsUsed(l);const h=u.corsPreFlightRequest;h&&(this._addChildSpan(n,h),this._markResourceAsUsed(h)),_t(n,l,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_cleanPreviousSpanInformation(r){const n=this._xhrMem.get(r);if(n){const s=n.callbackToRemoveEvents;s&&s(),this._xhrMem.delete(r)}}_createSpan(r,n,s){const i=K(n);if(Us(i.href,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}const o={},a=s,u=$d(s),l=u;o[ds]=u,u!==a&&(o[_s]=a),o[xt]=i.toString(),o[fs]=i.hostname;const h=jd(i);h&&(o[ms]=h);const d=this.tracer.startSpan(l,{kind:It.CLIENT,attributes:o});return d.addEvent(W.METHOD_OPEN),this._cleanPreviousSpanInformation(r),this._xhrMem.set(r,{span:d,spanUrl:n}),d}_markResourceAsUsed(r){this._usedResources.add(r)}_patchOpen(){return r=>{const n=this;return function(...i){if(!n._isEnabled)return r.apply(this,i);const o=i[0],a=i[1];return n._createSpan(this,a,o),r.apply(this,i)}}}_patchSend(){const r=this;function n(h,d,p,_){const E=d.callbackToRemoveEvents;typeof E=="function"&&E();const{span:m,spanUrl:T,sendStartTime:A}=d;m&&(r._findResourceAndAddNetworkEvents(d,m,T,A,p),m.addEvent(h,_),r._addFinalSpanAttributes(m,d),m.end(_),r._tasksCount--),r._clearResources()}function s(h,d,p,_){const E=r._xhrMem.get(d);if(!E)return;if(E.status=d.status,E.statusText=d.statusText,r._xhrMem.delete(d),E.span){const A=E.span;r._applyAttributesAfterXHR(A,d),p?_&&(A.setStatus({code:j.ERROR,message:_}),A.setAttribute(Lt,_)):E.status&&E.status>=400&&(A.setStatus({code:j.ERROR}),A.setAttribute(Lt,String(E.status)))}const m=G(),T=Date.now();setTimeout(()=>{n(h,E,m,T)},qd)}function i(){s(W.EVENT_ERROR,this,!0,"error")}function o(){s(W.EVENT_ABORT,this,!1)}function a(){s(W.EVENT_TIMEOUT,this,!0,"timeout")}function u(){this.status<299?s(W.EVENT_LOAD,this,!1):s(W.EVENT_ERROR,this,!1)}function l(h){h.removeEventListener("abort",o),h.removeEventListener("error",i),h.removeEventListener("load",u),h.removeEventListener("timeout",a);const d=r._xhrMem.get(h);d&&(d.callbackToRemoveEvents=void 0)}return h=>function(...p){if(!r._isEnabled)return h.apply(this,p);const _=r._xhrMem.get(this);if(!_)return h.apply(this,p);const E=_.span,m=_.spanUrl;if(E&&m){if(r.getConfig().measureRequestSize&&(p!=null&&p[0])){const T=p[0],A=Bd(T);A!==void 0&&E.setAttribute(Ud,A)}R.with(w.setSpan(R.active(),E),()=>{r._tasksCount++,_.sendStartTime=G(),E.addEvent(W.METHOD_SEND),this.addEventListener("abort",o),this.addEventListener("error",i),this.addEventListener("load",u),this.addEventListener("timeout",a),_.callbackToRemoveEvents=()=>{l(this),_.createdResources&&_.createdResources.observer.disconnect()},r._addHeaders(this,m),r._addResourceObserver(this,m)})}return h.apply(this,p)}}enable(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug("reactivating existing patch on",this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug("applying patch to",this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(r){this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.warn("Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.",r)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}let Ki=-1;const pt=()=>Ki,ft=e=>{addEventListener("pageshow",t=>{t.persisted&&(Ki=t.timeStamp,e(t))},!0)},I=(e,t,r,n)=>{let s,i;return o=>{t.value>=0&&(o||n)&&(i=t.value-(s!=null?s:0),(i||s===void 0)&&(s=t.value,t.delta=i,t.rating=((a,u)=>a>u[1]?"poor":a>u[0]?"needs-improvement":"good")(t.value,r),e(t)))}},Hr=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},zr=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},qt=()=>{var e,t;return(t=(e=zr())==null?void 0:e.activationStart)!=null?t:0};let at=-1;const Qi=new Set,Ji=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,jr=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of Qi)t();isFinite(at)||(at=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",jr,!0))}},Wt=(e=!1)=>{var t;if(e&&(at=1/0),at<0){const r=qt(),n=document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").find(s=>s.name==="hidden"&&s.startTime>=r))==null?void 0:t.startTime;at=n!=null?n:Ji(),addEventListener("visibilitychange",jr,!0),addEventListener("prerenderingchange",jr,!0),ft(()=>{setTimeout(()=>{at=Ji()})})}return{get firstHiddenTime(){return at},onHidden(r){Qi.add(r)}}},L=(e,t=-1,r,n=0,s,i,o)=>{const a=zr(),u=(a==null?void 0:a.navigationId)||0;let l="navigate";return r?l=r:pt()>=0?l="back-forward-cache":a&&(document.prerendering||qt()>0?l="prerender":document.wasDiscarded?l="restore":a.type&&(l=a.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:l,navigationId:n||u,navigationInteractionId:s,navigationURL:i||(a==null?void 0:a.name),navigationStartTime:o||0}},Zi=new WeakMap;function Te(e,t){let r=Zi.get(t);return r||(r=new WeakMap,Zi.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Xd{constructor(){c(this,"t");c(this,"i",0);c(this,"o",[])}h(t){var s;if(t.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),(s=this.t)==null||s.call(this,t)}}const ct=(e,t,r={})=>{try{const n=e.filter(s=>PerformanceObserver.supportedEntryTypes.includes(s));if(n.length>0){const s=new PerformanceObserver(i=>{queueMicrotask(()=>{const o=i.getEntries();n.length>1&&o.sort((a,u)=>a.startTime+a.duration-(u.startTime+u.duration)),t(o)})});for(const i of n)s.observe({type:i,buffered:!0,...r});return s}}catch(n){}},Xt=e=>{var t,r,n;return((t=globalThis.PerformanceObserver)==null?void 0:t.supportedEntryTypes.includes("soft-navigation"))&&typeof((n=(r=globalThis.PerformanceSoftNavigation)==null?void 0:r.prototype)==null?void 0:n.getLargestInteractionContentfulPaint)=="function"&&e&&e.reportSoftNavs},to=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const r=e.keys().next().value;r!==void 0&&e.delete(r)}},eo=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Yd{constructor(){c(this,"l")}}const Se=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},qr=[1800,3e3],ro=(e,t={})=>{const r=Xt(t);Se(()=>{const n=Te(t,Yd),s=Wt();let i,o=L("FCP");const a=ct(["paint"],u=>{for(const l of u)l.name==="first-contentful-paint"&&(a.disconnect(),l.startTime<s.firstHiddenTime&&(o.value=Math.max(l.startTime-qt(),0),o.entries.push(l),o.navigationId=l.navigationId||o.navigationId,i(!0)))});a&&(i=I(e,o,qr,t.reportAllChanges),ft(u=>{o=L("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,pt()),i=I(e,o,qr,t.reportAllChanges),Hr(()=>{o.value=performance.now()-u.timeStamp,i(!0)})})),r&&ct(["soft-navigation"],u=>{u.forEach(l=>{n.l&&l.navigationId&&to(n.l,l);const h=Math.max((l.presentationTime||l.paintTime||0)-l.startTime,0);o=L("FCP",h,"soft-navigation",l.navigationId,l.interactionId,l.name,l.startTime),i=I(e,o,qr,t.reportAllChanges),i(!0)})},t)})},no=[.1,.25],Kd=(e,t={})=>{const r=Wt();ro(eo(()=>{let n,s=L("CLS",0);const i=Te(t,Xd),o=(p,_,E,m,T)=>{s=L("CLS",0,p,_,E,m,T),i.i=0,n=I(e,s,no,t.reportAllChanges)},a=(p=!1)=>{i.i>s.value&&(s.value=i.i,s.entries=i.o),n(p)},u=p=>{a(!0),o("soft-navigation",p.navigationId,p.interactionId,p.name,p.startTime)},l=p=>{for(const _ of p)_.entryType!=="soft-navigation"?i.h(_):u(_);a()},h=["layout-shift"];Xt(t)&&h.push("soft-navigation");const d=ct(h,l);d&&(n=I(e,s,no,t.reportAllChanges),r.onHidden(()=>{l(d.takeRecords()),n(!0)}),ft(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,pt()),Hr(n)}),setTimeout(n))}))};let so=0,Wr=1/0,Ae=0;const Qd=e=>{for(const t of e)t.interactionId&&(Wr=Math.min(Wr,t.interactionId),Ae=Math.max(Ae,t.interactionId),so=Ae?(Ae-Wr)/7+1:0)};let Xr;const io=()=>{var e;return Xr?so:(e=performance.interactionCount)!=null?e:0},Jd=()=>{"interactionCount"in performance||Xr||(Xr=ct(["event"],Qd,{durationThreshold:0}))};let oo=0;class Zd{constructor(){c(this,"u",[]);c(this,"v",new Map);c(this,"m");c(this,"p")}T(){oo=io(),this.u.length=0,this.v.clear()}M(t){const r=io()-oo,n=Math.min(this.u.length-1,Math.floor(r/50));return!r||n!==-1||t!=="soft-navigation"&&t!=="back-forward-cache"?this.u[n]:{_:8,id:-1,entries:[]}}h(t){var s,i;if((s=this.m)==null||s.call(this,t),!t.interactionId&&t.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.v.get(t.interactionId);if(n||this.u.length<10||t.duration>r._){if(n?t.duration>n._?(n.entries=[t],n._=t.duration):t.duration===n._&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],_:t.duration},this.v.set(n.id,n),this.u.push(n)),this.u.sort((o,a)=>a._-o._),this.u.length>10){const o=this.u.splice(10);for(const a of o)this.v.delete(a.id)}(i=this.p)==null||i.call(this,n)}}}const ao=e=>{const t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{const s=eo(e);let i=-1;const o=()=>{n(i),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),i=r(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},co=[200,500],t_=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Wt();Se(()=>{var p;Jd();let n,s=L("INP");const i=Te(t,Zd),o=(_,E,m,T,A)=>{i.T(),s=L("INP",-1,_,E,m,T,A),n=I(e,s,co,t.reportAllChanges)},a=()=>{const _=i.M(s.navigationType);_&&_._!==s.value&&(s.value=_._,s.entries=_.entries,n())},u=_=>{a(),n(!0),o("soft-navigation",_.navigationId,_.interactionId,_.name,_.startTime)},l=(_,E=!1)=>{ao(()=>{for(const m of _)m.entryType!=="soft-navigation"?i.h(m):u(m);a(),E&&n(!0)})},h=["event","first-input"];Xt(t)&&h.push("soft-navigation");const d=ct(h,l,{...t,durationThreshold:(p=t.durationThreshold)!=null?p:40});n=I(e,s,co,t.reportAllChanges),d&&(r.onHidden(()=>{l(d.takeRecords(),!0)}),ft(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,pt())}))})};class e_{constructor(){c(this,"m");c(this,"l")}h(t){var r;(r=this.m)==null||r.call(this,t)}}const Yr=[2500,4e3],r_=(e,t={})=>{let r=!1;const n=Xt(t);Se(()=>{let s,i=Wt(),o=L("LCP");const a=Te(t,e_),u=(_,E,m,T,A)=>{o=L("LCP",-1,_,E,m,T,A),s=I(e,o,Yr,t.reportAllChanges),r=!1,_==="soft-navigation"&&(i=Wt(!0))},l=_=>{var m;a.l&&_.navigationId&&to(a.l,_),r||s(!0),u("soft-navigation",_.navigationId,_.interactionId,_.name,_.startTime);const E=(m=_.getLargestInteractionContentfulPaint)==null?void 0:m.call(_);E&&h([E])},h=_=>{var E;t.reportAllChanges||n||(_=_.slice(-1));for(const m of _){if(!m)continue;if(m.entryType==="soft-navigation"){l(m);continue}let T=0,A=[],M=m.startTime;if(m.entryType==="largest-contentful-paint")T=Math.max(m.startTime-qt(),0),a.h(m),A=[m];else if(m.entryType==="interaction-contentful-paint"){const y=m;if(!o.navigationId||"interactionId"in y&&y.interactionId!=o.navigationInteractionId)continue;M=((E=y.largestContentfulPaint)==null?void 0:E.renderTime)||0,T=Math.max(M-m.startTime,0),y.largestContentfulPaint&&(a.h(y.largestContentfulPaint),A=[y.largestContentfulPaint])}M<i.firstHiddenTime&&(o.value=T,o.entries=A,s())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");const p=ct(d,h);if(p){s=I(e,o,Yr,t.reportAllChanges);const _=["keydown","click","visibilitychange"],E=m=>{if(m.isTrusted&&!r){const T=o.id;ao(()=>{if(!r){if(!n){p.disconnect();for(const A of _)removeEventListener(A,E,{capture:!0})}T===o.id&&(r=!0,s(!0))}})}};for(const m of _)addEventListener(m,E,{capture:!0});ft(m=>{u("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,pt()),s=I(e,o,Yr,t.reportAllChanges),Hr(()=>{o.value=performance.now()-m.timeStamp,r=!0,s(!0)})})}})},Kr=[800,1800],Qr=e=>{document.prerendering?Se(()=>Qr(e)):document.readyState!=="complete"?addEventListener("load",()=>Qr(e),!0):setTimeout(e)},n_=(e,t={})=>{const r=Xt(t);let n=L("TTFB"),s=I(e,n,Kr,t.reportAllChanges);Qr(()=>{const i=zr();if(i){const o=i.responseStart;n.value=Math.max(o-qt(),0),n.entries=[i],s(!0),ft(()=>{n=L("TTFB",0,"back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,pt()),s=I(e,n,Kr,t.reportAllChanges),s(!0)}),r&&ct(["soft-navigation"],a=>{a.forEach(u=>{u.navigationId&&(n=L("TTFB",0,"soft-navigation",u.navigationId,u.interactionId,u.name,u.startTime),n.entries=[u],s=I(e,n,Kr,t.reportAllChanges),s(!0))})},t)}})},s_=3e4,i_=[{register:r_,name:"web_vitals.lcp",unit:"ms",boundaries:[100,250,500,1e3,1500,2e3,2500,3e3,4e3,6e3,8e3,12e3]},{register:t_,name:"web_vitals.inp",unit:"ms",boundaries:[8,16,40,75,100,150,200,300,500,750,1e3]},{register:Kd,name:"web_vitals.cls",unit:"1",boundaries:[.01,.025,.05,.075,.1,.15,.25,.5,1]},{register:ro,name:"web_vitals.fcp",unit:"ms",boundaries:[100,250,500,900,1200,1500,1800,2200,3e3,4e3,6e3]},{register:n_,name:"web_vitals.ttfb",unit:"ms",boundaries:[50,100,200,400,600,800,1200,1800,2500,4e3]}],uo=()=>{var e;return`/${(e=window.location.pathname.split("/")[1])!=null?e:""}`},lo={login_redirect:{name:"app_shell.login_redirect",description:"Time from navigation start until the shell redirects to the login service",boundaries:[50,100,200,400,700,1e3,1500,2500,4e3,6e3]},app_ready:{name:"app_shell.app_ready",description:"Time from navigation start until the splash screen is replaced by the app",boundaries:[500,1e3,1500,2e3,3e3,4e3,6e3,8e3,12e3,2e4]}},ho=new Map,_o=e=>{var t;(t=ho.get(e))==null||t.record(performance.now(),{"page.route":uo()})},o_=e=>{i_.forEach(({register:t,name:r,unit:n,boundaries:s})=>{const i=e.createHistogram(r,{unit:n,advice:{explicitBucketBoundaries:s}});t(o=>{i.record(o.value,{"web_vital.rating":o.rating,"web_vital.navigation_type":o.navigationType,"page.route":uo()})})})},a_=()=>{const{GPv2UIOtelEndpoint:e,OtelTracesSamplerRatio:t}=P();if(typeof e!="string"||e.trim()==="")return;const r=e.trim().replace(/\/+$/,""),n=crypto.randomUUID(),s=Ds({[gs]:Kt,"deployment.environment":window.location.hostname,[Ka]:n}),i=new Au({resource:s,sampler:new ht({root:new Rr(t!=null?t:1)}),spanProcessors:[new gu(new nd({url:`${r}/v1/traces`}))]});i.register();const o=new Hl({resource:s,readers:[new nl({exporter:new ud({url:`${r}/v1/metrics`}),exportIntervalMillis:s_})]});rr.setGlobalMeterProvider(o);const a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=[new RegExp(`^${a}(/|$)`,"i"),/^https?:\/\/([a-z0-9-]+\.)*dc\.services\.visualstudio\.com(\/|$)/i,/^https?:\/\/([a-z0-9-]+\.)*(google-analytics|googletagmanager)\.com(\/|$)/i];dd({tracerProvider:i,meterProvider:o,instrumentations:[new Sd,new xd({ignoreUrls:u}),new Wd({ignoreUrls:u})]});const l=o.getMeter("app-shell");o_(l),Object.keys(lo).forEach(h=>{const{name:d,description:p,boundaries:_}=lo[h];ho.set(h,l.createHistogram(d,{unit:"ms",description:p,advice:{explicitBucketBoundaries:_}}))}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&(i.forceFlush().catch(()=>{}),o.forceFlush().catch(()=>{}))}),window[Zt.otel]=Object.freeze({tracerProvider:i,meterProvider:o,serviceInstanceId:n})},po=async e=>{const t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")};function c_(){const{location:e}=window,t=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`,{LoginAuthority:r,GlobalPortalClientId:n,GlobalPortalUIScopes:s,GlobalPlanBShellPostLogoutRedirectUrl:i}=P();return{authority:r,client_id:n,redirect_uri:`${t}/auth-callback`,response_type:"code",scope:s,post_logout_redirect_uri:i,monitorSession:!1}}const Re=new Po(c_()),u_=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(window.atob(t).split("").map(n=>`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(r)},fo=()=>{localStorage.removeItem(Rt)},H=()=>{const e=localStorage.getItem(Rt);return e?JSON.parse(e):null},Jr=()=>{var e;const t=localStorage.getItem(Ue);return t?(e=JSON.parse(t))==null?void 0:e.email:null},mo=async()=>{const e=H();if(!e)return null;const t=(e.profile.given_name||"")+(e.profile.family_name||"")+e.profile.sub;return await po(t)},Zr=()=>{const e=H();return e?e.id_token:null},tn=(e,t)=>{const r={...t,...e},n=u_(e.access_token);return r.profile.sub=n.sub,r.profile.account_number=n.account_number,r.expires_at=n.exp,r.is_federated=n.is_federated,n.previous_login_date&&(r.profile.previous_login_date=n.previous_login_date),mn.setAccount({accountNumber:n.account_number,email:n.email,name:n.name,givenName:n.given_name,familyName:n.family_name,authTime:n.exp,accessToken:e.access_token,idToken:e.id_token}),localStorage.setItem(Rt,JSON.stringify(r)),r},go=e=>{tn(e,null)},Eo=()=>{const e=H();return e?e.access_token:null},To=()=>{const e=H();return e&&e.is_federated!==null&&e.is_federated!==void 0?String(e.is_federated).toLowerCase()==="true":!1},So=()=>{const e=H();return e!=null&&e.expires_at?e.expires_at>Date.now()/1e3:!1},Ao=()=>{var e;const t=H();return((e=t==null?void 0:t.profile)==null?void 0:e.previous_login_date)||null};var l_=Object.freeze({__proto__:null,clearUser:fo,getAccessToken:Eo,getHashedUserId:mo,getIdToken:Zr,getPreviousLoginDate:Ao,getUser:H,getUserEmail:Jr,hasActiveAccessToken:So,isFederatedUser:To,saveUser:go,updateUser:tn,userManager:Re});const h_=["authenticate","auth-callback","logout"],d_=e=>e.expires_at&&new Date(e.expires_at*1e3),__=e=>e.expires_at&&new Date(e.expires_at*1e3+P().TokenValidForOfflineUsePostExpiryInHours*60*60*1e3),Ro=()=>{if(!P().IsLoginEnabled)return!1;const e=H();if(!Zr())return!0;if(!e.expires_at)return!1;const t=new Date;return navigator.onLine?t>d_(e):t>__(e)},p_=()=>{const e=window.location.pathname.split("/");return h_.includes(e[e.length-1])},f_=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="authenticate"?(P().IsLoginEnabled?Re.signinRedirect():window.location.href="/",!0):!1},m_=()=>{let e="/";const t=localStorage.getItem(Qt);t&&(localStorage.removeItem(Qt),e=t),sessionStorage.setItem(We.SessionStorage.ShowLastLoginPopup,"true"),window.location.href=e},g_=e=>{if(!e.id_token)throw new Error("Missing property:id_token");return e},en=e=>{const t=p_();(!t||e)&&(t||localStorage.setItem(Qt,window.location.href),window.location.href="/authenticate")},E_=async e=>{const t=`${e.profile.sub}-${e.profile.customer_id}`,r=await po(t);return{...e,profile:{...e.profile,hashed_identifier:r}}},T_=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="auth-callback"?(Re.signinRedirectCallback().then(g_).then(E_).then(go).then(m_).catch(en),!0):!1};class S_ extends pn{render(){return lt` <ix-splash-screen></ix-splash-screen> `}}window.customElements.define("splash-screen",S_);class A_{constructor(){this.permissions=[],this.loading=!1,this.getPermissions=async()=>{var t;const r=(t=mn)==null?void 0:t.access_token;if(!r)return[];const{ApiBaseUrl:n}=P(),s=await fetch(`${n}/usermanagement/my-permissions?exclude_parents=false&exclude_siblings=true`,{headers:{Authorization:`Bearer ${r}`}});return s.ok?s.json():[]},Mo(this,{permissions:Io,setPermissions:vo})}setPermissions(t){this.permissions=t}tryLoadPermissions(){try{this.loading||(this.loading=!0,this.getPermissions().then(t=>{this.setPermissions(t),this.loading=!1}).catch(()=>{this.loading=!1}))}catch(t){this.loading=!1}}clearPermissions(){this.setPermissions([])}hasExternalUserCreate(){return this.hasPermission(Be,bt)||this.hasPermission(qe,bt)}hasConnectivityCreate(){return this.hasPermission(Jt,bt)}hasPrivilegeLevel(t,r){const n=[bn,bt,An,Rn],s=n.findIndex(o=>o===t),i=n.findIndex(o=>o===r);return s>=i}hasPermission(t,r){return No(this.permissions).some(n=>n.permission_name===t&&this.hasPrivilegeLevel(r,n.privilege))}}const rn=new A_,bo=async()=>{const{getAccessToken:e}=await Promise.resolve().then(function(){return l_}),t=new Headers;return t.append("Authorization",`Bearer ${e()}`),t},R_=async()=>{const{ApiBaseUrl:e}=P(),{ORDER_MANAGEMENT_PERMISSIONS:t}=await Promise.resolve().then(function(){return $o}),r=`${e}/inventory/locations?embed=permissions&page_size=1000`;let n=[],s=1;for(;;){const o=await bo(),a=await fetch(`${r}&cursor=${s}`,{headers:o});if(!a.ok)return Promise.reject();const u=await a.json();if(n.push(...u.items),u.self===u.last)break;s++}n=n.filter(o=>o.permissions.some(a=>t.includes(a.name)));const i=new Map;for(const o of n)i.has(o.account_number)?i.get(o.account_number).push(o.site_id):i.set(o.account_number,[o.site_id]);return i},b_=async e=>{const{ApiBaseUrl:t}=P(),r=new URLSearchParams;r.append("process","Cross_connect");const n=[...e.keys()],s=[...new Set([...e.values()].flat())];r.append("account_number",n.join(",")),r.append("site",s.join(","));const i=await bo(),o=await fetch(`${t}/site-navigations/site-configurations?${r}`,{headers:i});return o.ok?await o.json():Promise.reject()},w_=async()=>{try{const e=await R_();return e.size===0?!1:(await b_(e)).some(t=>{var r;return t.portal==="GlobalPortal"&&!!((r=e.get(t.account_number))!=null&&r.includes(t.site))})}catch(e){return console.error("Failed to determine portal-managed inventory:",e),!1}},{ApiBaseUrl:O_}=P(),C_=new URL(O_).origin;function y_(e){return e.origin===C_}const P_=["type","title","detail","instance","code","correlation_id","timestamp","account_number"];function M_(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.status=="number"&&P_.every(r=>typeof t[r]=="string"&&t[r]!=="")}function v_(){const e=globalThis.fetch;globalThis.fetch=async function(...t){var r;const[n]=t,s=n instanceof Request?n.url:String(n),i=await e.apply(this,t);try{y_(new URL(s,(r=globalThis.location)==null?void 0:r.href))&&i.status>=400&&i.clone().json().then(o=>{var a;M_(o)&&((a=globalThis[Zt.appInsights])==null||a.trackEvent({name:"internal_api_error",properties:{url:s,body:o}}))}).catch(o=>console.warn(`[fetch] couldn't read body ${s}`,o))}catch(o){console.error("Failed to fetch:",o)}return i}}const I_="SUPERUSER";class nn extends pn{_isSuperUser(t){return t.some(r=>{var n;return(n=r.provenance)==null?void 0:n.includes(I_)})}constructor(){super(),this._currentView="splash",this.appLoaded=!1,this._onPopState=()=>{P().IsLoginEnabled&&Ro()&&en()};try{zo(),v_()}catch(r){console.error("Telemetry initialization failed:",r)}try{a_()}catch(r){console.error("OpenTelemetry initialization failed:",r)}const t=window.location.pathname;if(t==="/session-expired"){this._currentView="session-expired",this._loadView("session-expired");return}if(t==="/logout"){this._currentView="logout",this._loadView("logout");return}if(f_()||T_()){this._currentView="splash";return}if(Ro()){this._currentView="splash",_o("login_redirect"),en();return}this._currentView="app",this._loadApp()}async _loadView(t){t==="session-expired"?await import("@digital-realty/ix-app-logic/views/session-expiry.js"):t==="logout"&&await import("./logout-BZJ5_qly.js")}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._onPopState)}_getAccountNumber(){var t,r,n;return(n=new URLSearchParams(window.location.search).get("selected_account_number"))!=null?n:(r=(t=H())==null?void 0:t.profile)==null?void 0:r.account_number}_redirectTo(t){window.location.href=t}_isESGAccessOnly(t,r){const n=t.filter(s=>s.account_number===r);return n.length===1&&n[0].permission_name==="ESG Reporting"}async _applyGomFF(t){var r;const n=Jr(),s=structuredClone(window.gpConfig);if(!n||!s)return;const i=this._isSuperUser(t),o=!!((r=s["app-shell"])!=null&&r.IsInventoryManagementEnabled),a=await w_()&&(i||o);s["app-shell"].IsInventoryManagementEnabled=a,s["ui-launchpad"].IsInventoryManagementEnabled=a,window.gpConfig=Object.freeze(s)}_applyMfeOverrides(t,r){const n={};for(const s of Object.keys(t))n[s]={...t[s],enabled:r.includes(s)};return n}async _loadApp(){var t;const{authedUser:r}=await import("@digital-realty/ix-account-switcher");await r.hydrateStore();const[n,s]=await Promise.allSettled([fetch("./registered-apps.json").then(l=>l.json()),rn.getPermissions()]);if(n.status==="rejected"){console.error("Failed to load registered apps:",n.reason);return}if(s.status==="rejected"){console.error("Failed to load permissions:",s.reason);return}const{registeredApps:i}=n.value,o=s.value,a=(t=this._getAccountNumber())!=null?t:"";if(!a){const{LoginAuthority:l}=P();this._redirectTo(`${l}/Account/NoAccess`);return}const u=this._isESGAccessOnly(o,a)?this._applyMfeOverrides(i,["ui-esg"]):i;await this._applyGomFF(o),window.registeredApps=Object.freeze(u),rn.setPermissions(o),await import("./app-DYtFGbuV.js"),this.appLoaded=!0,_o("app_ready")}render(){switch(this._currentView){case"session-expired":return lt`<ix-session-expiry></ix-session-expiry>`;case"logout":return lt`<ixp-logout></ixp-logout>`;case"app":return this.appLoaded?lt`<global-portal-app appTitle="DLR" showDrawer></global-portal-app>`:lt`<splash-screen></splash-screen>`;default:return lt`<splash-screen></splash-screen>`}}}_n([fn({type:String})],nn.prototype,"_currentView",void 0),_n([fn({type:Boolean})],nn.prototype,"appLoaded",void 0),window.customElements.define("gp-bootstrap",nn);export{Gn as A,Ue as B,wn as C,Sn as D,Un as E,Tn as F,Ie as G,kn as I,Le as M,Bn as O,Hn as R,Dn as S,qe as U,Zr as a,mo as b,fo as c,Jr as d,Eo as e,H as f,P as g,tn as h,Ao as i,To as j,We as k,Mn as l,Be as m,yn as n,Pn as o,rn as p,xe as q,zn as r,Ne as s,Zt as t,Re as u,Kt as v,gn as w,So as x,En as y,Rt as z};
13
+ `,Ei(i,t))}return n}}class wl{constructor(t){c(this,"_backingStorages");c(this,"hasAttributeProcessor");this._backingStorages=t,this.hasAttributeProcessor=t.some(r=>r.hasAttributeProcessor)}record(t,r,n,s){this.hasAttributeProcessor&&n===void 0&&(n=R.active());const i=this._backingStorages;for(let o=0;o<i.length;o++)i[o].record(t,r,n,s)}}class Ol{constructor(t,r){c(this,"_buffer",new ot);c(this,"_instrumentName");c(this,"_valueType");this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){f.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===X.INT&&!Number.isInteger(t)&&(f.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}}class Cl{constructor(){c(this,"_buffer",new Map)}observe(t,r,n={}){if(!xr(t))return;let s=this._buffer.get(t);if(s==null&&(s=new ot,this._buffer.set(t,s)),typeof r!="number"){f.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===X.INT&&!Number.isInteger(r)&&(f.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||s.set(n,r)}}class yl{constructor(){c(this,"_callbacks",[]);c(this,"_batchCallbacks",[])}addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){const n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){const n=new Set(r.filter(xr));if(n.size===0){f.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){const n=new Set(r.filter(xr)),s=this._findBatchCallback(t,n);s<0||this._batchCallbacks.splice(s,1)}async observe(t,r){const n=this._observeCallbacks(t,r),s=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...s])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:s})=>{const i=new Ol(s._descriptor.name,s._descriptor.valueType);let o=Promise.resolve(n(i));r!=null&&(o=Gt(o,r)),await o,s._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:s})=>{const i=new Cl;let o=Promise.resolve(n(i));r!=null&&(o=Gt(o,r)),await o,s.forEach(a=>{const u=i._buffer.get(a);u!=null&&a._metricStorages.forEach(l=>{l.record(u,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&Mu(n.instruments,r))}}class Pl extends fi{constructor(r,n,s,i,o){super(r);c(this,"_aggregationCardinalityLimit");c(this,"_deltaMetricStorage");c(this,"_temporalMetricStorage");c(this,"_attributesProcessor");c(this,"hasAttributeProcessor");this._aggregationCardinalityLimit=o,this._deltaMetricStorage=new mi(n,this._aggregationCardinalityLimit),this._temporalMetricStorage=new St(n,i),this._attributesProcessor=s,this.hasAttributeProcessor=s!==void 0}record(r,n,s,i){this._attributesProcessor!==void 0&&(n=this._attributesProcessor.process(n,s!=null?s:R.active())),this._deltaMetricStorage.record(r,n,i)}collect(r,n){const s=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,s,n)}}class Ml{constructor(t,r){c(this,"metricStorageRegistry",new hn);c(this,"observableRegistry",new yl);c(this,"meter");c(this,"_meterProviderSharedState");c(this,"_instrumentationScope");this.meter=new ml(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){const r=this._registerMetricStorage(t,Pl);return r.length===1?r[0]:new wl(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Tl)}async collect(t,r,n){const s=await this.observableRegistry.observe(r,n==null?void 0:n.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;const o=[];return i.forEach(a=>{const u=a.collect(t,r);u!=null&&o.push(u)}),o.length===0?{errors:s}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:s}}_registerMetricStorage(t,r){let s=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{const o=il(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;const u=i.aggregation.createAggregator(o),l=new r(o,u,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(l),l});if(s.length===0){const o=this._meterProviderSharedState.selectAggregations(t.type).map(([a,u])=>{const l=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(l!=null)return l;const h=u.createAggregator(t),d=a.selectCardinalityLimit(t.type),p=new r(t,h,void 0,[a],d);return this.metricStorageRegistry.registerForCollector(a,p),p});s=s.concat(o)}return s}}class vl{constructor(t){c(this,"viewRegistry",new sl);c(this,"metricCollectors",[]);c(this,"meterSharedStates",new Map);c(this,"resource");this.resource=t}getMeterSharedState(t){const r=Pu(t);let n=this.meterSharedStates.get(r);return n==null&&(n=new Ml(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){const r=[];for(const n of this.metricCollectors)r.push([n,hi(n.selectAggregation(t))]);return r}}class Il{constructor(t,r){c(this,"_sharedState");c(this,"_metricReader");this._sharedState=t,this._metricReader=r}async collect(t){const r=N(Date.now()),n=[],s=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async o=>{const a=await o.collect(this,r,t);(a==null?void 0:a.scopeMetrics)!=null&&n.push(a.scopeMetrics),(a==null?void 0:a.errors)!=null&&s.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:s}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){var r,n,s;return(s=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,t))!=null?s:2e3}}const Nl=/[\^$\\.+?()[\]{}|]/g;class ye{constructor(t){c(this,"_matchAll");c(this,"_regexp");t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(ye.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(Nl,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}}class _e{constructor(t){c(this,"_matchAll");c(this,"_pattern");this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}}class Ll{process(t,r){return t}}class xl{constructor(t){c(this,"_processors");this._processors=t}process(t,r){let n=t;for(const s of this._processors)n=s.process(n,r);return n}}function Ul(){return kl}function Dl(e){return new xl(e)}const kl=new Ll;class Bl{constructor(t){c(this,"_nameFilter");c(this,"_type");c(this,"_unitFilter");var r;this._nameFilter=new ye((r=t==null?void 0:t.name)!=null?r:"*"),this._type=t==null?void 0:t.type,this._unitFilter=new _e(t==null?void 0:t.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}class Gl{constructor(t){c(this,"_nameFilter");c(this,"_versionFilter");c(this,"_schemaUrlFilter");this._nameFilter=new _e(t==null?void 0:t.name),this._versionFilter=new _e(t==null?void 0:t.version),this._schemaUrlFilter=new _e(t==null?void 0:t.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}function Fl(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function $l(e){if(Fl(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||ye.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}class Vl{constructor(t){c(this,"name");c(this,"description");c(this,"aggregation");c(this,"attributesProcessor");c(this,"instrumentSelector");c(this,"meterSelector");c(this,"aggregationCardinalityLimit");var r;$l(t),t.attributesProcessors!=null?this.attributesProcessor=Dl(t.attributesProcessors):this.attributesProcessor=Ul(),this.name=t.name,this.description=t.description,this.aggregation=hi((r=t.aggregation)!=null?r:{type:B.DEFAULT}),this.instrumentSelector=new Bl({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new Gl({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}}class Hl{constructor(t){c(this,"_sharedState");c(this,"_shutdown",!1);var r;if(this._sharedState=new vl((r=t==null?void 0:t.resource)!=null?r:ks()),(t==null?void 0:t.views)!=null&&t.views.length>0)for(const n of t.views)this._sharedState.viewRegistry.addView(new Vl(n));if((t==null?void 0:t.readers)!=null&&t.readers.length>0)for(const n of t.readers){const s=new Il(this._sharedState,n);n.setMetricProducer(s),this._sharedState.metricCollectors.push(s),t.sdkMetricsEnabled&&n instanceof pi&&n._setSelfObsMeterProvider(this)}}getMeter(t,r="",n={}){return this._shutdown?(f.warn("A shutdown MeterProvider cannot provide a Meter"),Mt()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){f.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){f.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}}class Ti{constructor(t){c(this,"_delegate");this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(t){this._delegate.setMetrics(t)}}class Si extends Error{constructor(r,n,s){super(r);c(this,"code");c(this,"name","OTLPExporterError");c(this,"data");this.data=s,this.code=n}}function zl(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function jl(e){if(e!=null)return async()=>e}function ql(e,t,r){var n,s,i,o,a,u;return{timeoutMillis:zl((s=(n=e.timeoutMillis)!=null?n:t.timeoutMillis)!=null?s:r.timeoutMillis),concurrencyLimit:(o=(i=e.concurrencyLimit)!=null?i:t.concurrencyLimit)!=null?o:r.concurrencyLimit,compression:(u=(a=e.compression)!=null?a:t.compression)!=null?u:r.compression}}function Wl(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}class Xl{constructor(t){c(this,"_concurrencyLimit");c(this,"_sendingPromises",[]);this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);const r=()=>{const n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function Yl(e){return new Xl(e.concurrencyLimit)}function Kl(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Ql(){return{handleResponse(e){e==null||!Kl(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||f.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class Jl{constructor(t,r,n,s,i,o){c(this,"_metrics");c(this,"_diagLogger");c(this,"_transport");c(this,"_serializer");c(this,"_responseHandler");c(this,"_promiseQueue");c(this,"_timeout");this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=s,this._timeout=o,this._diagLogger=f.createComponentLogger({namespace:"OTLPExportDelegate"}),this._metrics=i}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:D.FAILED,error:new Error("Concurrent export limit reached")});return}const n=this._serializer.serializeRequest(t);if(n==null){r({code:D.FAILED,error:new Error("Nothing to send")});return}const s=this._metrics.startExport(t);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(i=>{var o;if(i.status==="success"){if(s(void 0),i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(a){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",a,i.data)}r({code:D.SUCCESS});return}else if(i.status==="failure"&&i.error){s(i.error),r({code:D.FAILED,error:i.error});return}else i.status==="retryable"?(s("export_max_retries"),r({code:D.FAILED,error:(o=i.error)!=null?o:new Si("Export failed with retryable status")})):(s("export_failed"),r({code:D.FAILED,error:new Si("Export failed with unknown error")}))},i=>{s(i),r({code:D.FAILED,error:i})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(t){this._metrics=t}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function Zl(e,t){return new Jl(e.transport,e.serializer,Ql(),e.promiseHandler,e.metrics,t.timeout)}function th(e,t,r,n){return Zl({transport:n,serializer:t,promiseHandler:Yl(e),metrics:r},{timeout:e.timeoutMillis})}const Ai="http.response.status_code",eh="otel.component.name",rh="otel.component.type",nh="server.address",sh="server.port",ih="error.type",oh="0.221.0",Ri=new Map;class ah{constructor(t){c(this,"inflight");c(this,"exported");c(this,"duration");c(this,"standardAttrs");c(this,"responseAttributesFromError");c(this,"helper");var l;const{componentType:r,metricsHelper:n,meterProvider:s,url:i,responseAttributesFromError:o}=t;this.responseAttributesFromError=o;const a=s?s.getMeter("@opentelemetry/otlp-exporter",oh):Mt(),u=(l=Ri.get(r))!=null?l:0;if(Ri.set(r,u+1),this.standardAttrs={[rh]:r,[eh]:`${r}/${u}`},i){let h=i;i.includes("://")||(h=`http://${i}`);try{const d=new URL(h);this.standardAttrs[nh]=d.hostname;let p;d.port?p=Number(d.port):d.protocol==="http:"?p=80:d.protocol==="https:"&&(p=443),typeof p=="number"&&(this.standardAttrs[sh]=p)}catch(d){}}this.helper=n,this.inflight=a.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=a.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=a.createHistogram("otel.sdk.exporter.operation.duration",{unit:"s",description:"The duration of exporting a batch of telemetry records.",advice:{explicitBucketBoundaries:[]}})}startExport(t){const r=this.helper.countItems(t),n=G();return this.inflight.add(r,this.standardAttrs),s=>{const i=G();this.inflight.add(-r,this.standardAttrs);const o=s?{...this.standardAttrs,[ih]:s instanceof Error?s.name:"export_failed"}:this.standardAttrs;this.exported.add(r,o);const a={...o,...this.responseAttributesFromError(s)},u=nc(pr(n,i))/1e3;this.duration.record(u,a)}}}const bi={name:"metric_data_point",countItems:e=>{let t=0;for(const r of e.scopeMetrics)for(const n of r.metrics)t+=n.dataPoints.length;return t}},ch={name:"span",countItems:e=>e.length};var wi;(function(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"})(wi||(wi={}));class Oi{emit(t){}enabled(){return!1}}const uh=new Oi,pe=Symbol.for("io.opentelemetry.js.api.logs"),Vt=globalThis;function lh(e,t,r){return n=>n===e?t:r}const Ci=1;class hh{getLogger(t,r,n){return new Oi}}const yi=new hh;class dh{constructor(t,r,n,s){this._provider=t,this.name=r,this.version=n,this.options=s}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;const t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):uh}}class Pi{getLogger(t,r,n){var s;return(s=this._getDelegateLogger(t,r,n))!==null&&s!==void 0?s:new dh(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:yi}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getLogger(t,r,n)}}class dn{constructor(){this._proxyLoggerProvider=new Pi}static getInstance(){return this._instance||(this._instance=new dn),this._instance}setGlobalLoggerProvider(t){return Vt[pe]?this.getLoggerProvider():(Vt[pe]=lh(Ci,t,yi),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=Vt[pe])===null||t===void 0?void 0:t.call(Vt,Ci))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete Vt[pe],this._proxyLoggerProvider=new Pi}}const Mi=dn.getInstance();function vi(e,t){const r={attributes:J(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Ii(e,t){var n;const r={name:e.name,version:e.version};return e.attributes&&Object.keys(e.attributes).length>0&&(r.attributes=J(e.attributes,t),r.droppedAttributesCount=(n=e.droppedAttributesCount)!=null?n:0),r}function J(e,t){return Object.keys(e).map(r=>_h(r,e[r],t))}function _h(e,t,r){return{key:e,value:Ur(t,r)}}function Ur(e,t){const r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=Ur(e[s],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){const n=Object.keys(e),s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]={key:n[i],value:Ur(e[n[i]],t)};return{kvlistValue:{values:s}}}return{}}function ph(e){const t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function fh(e){return ph(e).toString()}const mh=typeof BigInt<"u"?fh:q;function Ni(e){return e}const Li={encodeHrTime:mh,encodeSpanContext:Ni,encodeOptionalSpanContext:Ni,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var fe;(function(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"})(fe||(fe={}));function gh(e,t){const r=vi(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:Eh(e.scopeMetrics,t)}}function Eh(e,t){return Array.from(e.map(r=>({scope:Ii(r.scope,t),metrics:r.metrics.map(n=>Th(n,t)),schemaUrl:r.scope.schemaUrl})))}function Th(e,t){const r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=bh(e.aggregationTemporality);switch(e.dataPointType){case V.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:xi(e,t)};break;case V.GAUGE:r.gauge={dataPoints:xi(e,t)};break;case V.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ah(e,t)};break;case V.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Rh(e,t)};break}return r}function Sh(e,t,r){const n={attributes:J(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case X.INT:n.asInt=e.value;break;case X.DOUBLE:n.asDouble=e.value;break}return n}function xi(e,t){return e.dataPoints.map(r=>Sh(r,e.descriptor.valueType,t))}function Ah(e,t){return e.dataPoints.map(r=>{const n=r.value;return{attributes:J(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Rh(e,t){return e.dataPoints.map(r=>{const n=r.value;return{attributes:J(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function bh(e){switch(e){case k.DELTA:return fe.AGGREGATION_TEMPORALITY_DELTA;case k.CUMULATIVE:return fe.AGGREGATION_TEMPORALITY_CUMULATIVE}}function wh(e,t){return{resourceMetrics:e.map(r=>gh(r,t))}}const Oh={serializeRequest:e=>{const t=wh([e],Li);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return f.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}},Ch=256,yh=512;function Ui(e,t){let r=e&255|Ch;return t&&(r|=yh),r}function Ph(e,t){var i,o,a,u;const r=e.spanContext(),n=e.status,s=(i=e.parentSpanContext)!=null&&i.spanId?t.encodeSpanContext((o=e.parentSpanContext)==null?void 0:o.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:s,traceState:(a=r.traceState)==null?void 0:a.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:J(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(l=>vh(l,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(l=>Mh(l,t)),droppedLinksCount:e.droppedLinksCount,flags:Ui(r.traceFlags,(u=e.parentSpanContext)==null?void 0:u.isRemote)}}function Mh(e,t){var r;return{attributes:e.attributes?J(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(r=e.context.traceState)==null?void 0:r.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ui(e.context.traceFlags,e.context.isRemote)}}function vh(e,t){return{attributes:e.attributes?J(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ih(e,t){return{resourceSpans:Lh(e,t)}}function Nh(e){const t=new Map;for(const r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));const s=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`;let i=n.get(s);i||(i=[],n.set(s,i)),i.push(r)}return t}function Lh(e,t){const r=Nh(e),n=[],s=r.entries();let i=s.next();for(;!i.done;){const[o,a]=i.value,u=[],l=a.values();let h=l.next();for(;!h.done;){const _=h.value;if(_.length>0){const E=_.map(m=>Ph(m,t));u.push({scope:Ii(_[0].instrumentationScope,t),spans:E,schemaUrl:_[0].instrumentationScope.schemaUrl})}h=l.next()}const d=vi(o,t),p={resource:d,scopeSpans:u,schemaUrl:d.schemaUrl};n.push(p),i=s.next()}return n}const xh={serializeRequest:e=>{const t=Ih(e,Li);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};const t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(r){return f.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}},Dr=5,Uh=1e3,Dh=5e3,kh=1.5,Di=.2;function Bh(){return Math.random()*(2*Di)-Di}class Gh{constructor(t){c(this,"_transport");this._transport=t}retry(t,r,n){return new Promise((s,i)=>{setTimeout(()=>{this._transport.send(t,r).then(s,i)},n)})}async send(t,r){var a;let n=Dr,s=Uh;const i=Date.now()+r;let o=await this._transport.send(t,r);for(;o.status==="retryable"&&n>0;){n--;const u=Math.max(Math.min(s*(1+Bh()),Dh),0);s=s*kh;const l=(a=o.retryInMillis)!=null?a:u,h=i-Date.now();if(l>h)return f.info(`Export retry time ${Math.round(l)}ms exceeds remaining timeout ${Math.round(h)}ms, not retrying further.`),o;f.verbose(`Scheduling export retry in ${Math.round(l)}ms`),o=await this.retry(t,h,l)}return o.status==="success"?f.verbose(`Export succeeded after ${Dr-n} retry attempts.`):o.status==="retryable"?f.info(`Export failed after maximum retry attempts (${Dr}).`):f.info(`Export failed with non-retryable error: ${o.error}`),o}shutdown(){return this._transport.shutdown()}}function Fh(e){return new Gh(e.transport)}function $h(e){return e===429||e===502||e===503||e===504}function Vh(e){if(e==null)return;const t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;const r=new Date(e).getTime()-Date.now();return r>=0?r:0}const Hh=60*1024,zh=9;let kr=0,me=0;class jh{constructor(t){c(this,"_parameters");this._parameters=t}async send(t,r){const n=new AbortController,s=setTimeout(()=>n.abort(),r);let i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);const o=t.byteLength,a=kr+o>Hh,u=me>=zh,l=!a&&!u;if(l)kr+=o,me++;else{const h=a?"size limit":"count limit";f.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${me} pending (${h})`)}try{const h=new URL(this._parameters.url),d=await i(h.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:l,mode:globalThis.location?globalThis.location.origin===h.origin?"same-origin":"cors":"no-cors"});if(d.status>=200&&d.status<=299)return f.debug(`export response success (status: ${d.status})`),{status:"success"};if($h(d.status)){f.warn(`export response retryable (status: ${d.status})`);const p=d.headers.get("Retry-After");return{status:"retryable",retryInMillis:Vh(p)}}return f.error(`export response failure (status: ${d.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${d.status}`)}}catch(h){return Wh(h)?(f.warn(`export request retryable (network error: ${h})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:h})}):(f.error(`export request failure (error: ${h})`),{status:"failure",error:new Error("Fetch request errored",{cause:h})})}finally{clearTimeout(s),l&&(kr-=o,me--)}}shutdown(){}}function qh(e){return new jh(e)}function Wh(e){return e instanceof TypeError&&!e.cause}function Xh(e,t,r){return th(e,t,r,Fh({transport:qh(e)}))}function Yh(e){const t={};return Object.entries(e!=null?e:{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):f.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function Kh(e,t,r){return async()=>{const n={...await r()},s={};return t!=null&&Object.assign(s,await t()),e!=null&&Object.assign(s,Yh(await e())),Object.assign(s,n)}}function Qh(e){var t;if(e!=null)try{const r=(t=globalThis.location)==null?void 0:t.href;return new URL(e,r).href}catch(r){throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Jh(e,t,r){var n,s;return{...ql(e,t,r),headers:Kh(e.headers,t.headers,r.headers),url:(s=(n=Qh(e.url))!=null?n:t.url)!=null?s:r.url}}function Zh(e,t){return{...Wl(),headers:async()=>e,url:"http://localhost:4318/"+t}}function td(e){return typeof e.headers=="function"?e.headers:jl(e.headers)}function ed(e,t,r){return Jh({url:e.url,timeoutMillis:e.timeoutMillis,headers:td(e),concurrencyLimit:e.concurrencyLimit},{},Zh(r,t))}function ki(e,t,r,n){return new ah({componentType:e,metricsHelper:t,url:r,meterProvider:n,responseAttributesFromError:s=>{if(!s)return{[Ai]:200};if(!(s instanceof Error))return{};if(s.message.startsWith("Fetch request failed with non-retryable status ")){const i=s.message.substring(47);return{[Ai]:Number(i)}}return{}}})}function Bi(e,t,r,n,s,i,o){const a=ed(e,i,o);return Xh(a,t,ki(r,n,a.url,e.selfObsMeterProvider))}const rd="otlp_http_span_exporter";class nd extends Ti{constructor(t={}){super(Bi(t,xh,rd,ch,t.selfObsMeterProvider,"v1/traces",{"Content-Type":"application/json"}))}}var ge;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(ge||(ge={}));const Br=()=>k.CUMULATIVE,Gi=e=>{switch(e){case g.COUNTER:case g.OBSERVABLE_COUNTER:case g.GAUGE:case g.HISTOGRAM:case g.OBSERVABLE_GAUGE:return k.DELTA;case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:return k.CUMULATIVE}},Fi=e=>{switch(e){case g.COUNTER:case g.HISTOGRAM:return k.DELTA;case g.GAUGE:case g.UP_DOWN_COUNTER:case g.OBSERVABLE_UP_DOWN_COUNTER:case g.OBSERVABLE_COUNTER:case g.OBSERVABLE_GAUGE:return k.CUMULATIVE}};function sd(){const e="cumulative".toLowerCase();return e==="cumulative"?Br:e==="delta"?Gi:e==="lowmemory"?Fi:(f.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Br)}function id(e){return e!=null?e===ge.DELTA?Gi:e===ge.LOWMEMORY?Fi:Br:sd()}const od=Object.freeze({type:B.DEFAULT});function ad(e){var t;return(t=e==null?void 0:e.aggregationPreference)!=null?t:(()=>od)}class cd extends Ti{constructor(r,n){super(r);c(this,"_aggregationTemporalitySelector");c(this,"_aggregationSelector");this._aggregationSelector=ad(n),this._aggregationTemporalitySelector=id(n==null?void 0:n.temporalityPreference)}selectAggregation(r){return this._aggregationSelector(r)}selectAggregationTemporality(r){return this._aggregationTemporalitySelector(r)}}const $i="otlp_http_metric_exporter";class ud extends cd{constructor(r){super(Bi(r!=null?r:{},Oh,$i,bi,r==null?void 0:r.selfObsMeterProvider,"v1/metrics",{"Content-Type":"application/json"}),r);c(this,"_url");this._url=r==null?void 0:r.url}setSelfObsMeterProvider(r){this.setMetrics(ki($i,bi,this._url,r))}}function ld(e,t,r,n){for(let s=0,i=e.length;s<i;s++){const o=e[s];t&&o.setTracerProvider(t),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function hd(e){e.forEach(t=>t.disable())}function dd(e){var i,o;const t=e.tracerProvider||w.getTracerProvider(),r=e.meterProvider||rr.getMeterProvider(),n=e.loggerProvider||Mi.getLoggerProvider(),s=(o=(i=e.instrumentations)==null?void 0:i.flat())!=null?o:[];return ld(s,t,r,n),()=>{hd(s)}}let v=console.error.bind(console);function Ht(e,t,r){const n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}const Vi=(e,t,r)=>{if(!e||!e[t]){v("no original function "+String(t)+" to wrap");return}if(!r){v("no wrapper function"),v(new Error().stack);return}const n=e[t];if(typeof n!="function"||typeof r!="function"){v("original object and wrapper must be functions");return}const s=r(n,t);return Ht(s,"__original",n),Ht(s,"__unwrap",()=>{e[t]===s&&Ht(e,t,n)}),Ht(s,"__wrapped",!0),Ht(e,t,s),s},_d=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{v("must provide one or more modules to patch"),v(new Error().stack);return}if(!(t&&Array.isArray(t))){v("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(s=>{Vi(n,s,r)})})},Hi=(e,t)=>{if(!e||!e[t]){v("no function to unwrap."),v(new Error().stack);return}const r=e[t];if(!r.__unwrap)v("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},pd=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{v("must provide one or more modules to patch"),v(new Error().stack);return}if(!(t&&Array.isArray(t))){v("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{Hi(r,n)})})};class fd{constructor(t,r,n){c(this,"_config",{});c(this,"_tracer");c(this,"_meter");c(this,"_logger");c(this,"_diag");c(this,"instrumentationName");c(this,"instrumentationVersion");c(this,"_wrap",Vi);c(this,"_unwrap",Hi);c(this,"_massWrap",_d);c(this,"_massUnwrap",pd);this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=f.createComponentLogger({namespace:t}),this._tracer=w.getTracer(t,r),this._meter=rr.getMeter(t,r),this._logger=Mi.getLogger(t,r),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var r;const t=(r=this.init())!=null?r:[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,s){if(t)try{t(n,s)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}}class Gr extends fd{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}}function zt(e,t,r){let n,s;try{s=e()}catch(i){n=i}finally{return t(n,s),s}}var jt;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(jt||(jt={}));const md="0.66.0",gd="@opentelemetry/instrumentation-document-load";var Ee;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(Ee||(Ee={}));const Ed=()=>{var r;const e={},t=(r=O.getEntriesByType)==null?void 0:r.call(O,"navigation")[0];if(t)Object.values(S).forEach(s=>{if(dt(t,s)){const i=t[s];typeof i=="number"&&(e[s]=i)}});else{const s=O.timing;s&&Object.values(S).forEach(o=>{if(dt(s,o)){const a=s[o];typeof a=="number"&&(e[o]=a)}})}return e},zi={"first-paint":Ee.FIRST_PAINT,"first-contentful-paint":Ee.FIRST_CONTENTFUL_PAINT},Td=e=>{var r;const t=(r=O.getEntriesByType)==null?void 0:r.call(O,"paint");t&&t.forEach(({name:n,startTime:s})=>{dt(zi,n)&&e.addEvent(zi[n],s)})};class Sd extends Gr{constructor(r={}){super(gd,md,r);c(this,"component","document-load");c(this,"version","1");c(this,"moduleName",this.component)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(r){var s;const n=(s=O.getEntriesByType)==null?void 0:s.call(O,"resource");n&&n.forEach(i=>{this._initResourceSpan(i,r)})}_collectPerformance(){const r=Array.from(document.getElementsByTagName("meta")).find(i=>i.getAttribute("name")===oe),n=Ed(),s=r&&r.content||"";R.with(U.extract(et,{traceparent:s}),()=>{var o;const i=this._startSpan(jt.DOCUMENT_LOAD,S.FETCH_START,n);i&&(R.with(w.setSpan(R.active(),i),()=>{const a=this._startSpan(jt.DOCUMENT_FETCH,S.FETCH_START,n);a&&(a.setAttribute(xt,location.href),R.with(w.setSpan(R.active(),a),()=>{var u;_t(a,n,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(a,(u=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:u.documentFetch),this._endSpan(a,S.RESPONSE_END,n)}))}),i.setAttribute(xt,location.href),i.setAttribute(Ja,navigator.userAgent),this._addResourcesSpans(i),this.getConfig().ignoreNetworkEvents||(C(i,S.FETCH_START,n),C(i,S.UNLOAD_EVENT_START,n),C(i,S.UNLOAD_EVENT_END,n),C(i,S.DOM_INTERACTIVE,n),C(i,S.DOM_CONTENT_LOADED_EVENT_START,n),C(i,S.DOM_CONTENT_LOADED_EVENT_END,n),C(i,S.DOM_COMPLETE,n),C(i,S.LOAD_EVENT_START,n),C(i,S.LOAD_EVENT_END,n)),this.getConfig().ignorePerformancePaintEvents||Td(i),this._addCustomAttributesOnSpan(i,(o=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:o.documentLoad),this._endSpan(i,S.LOAD_EVENT_END,n))})}_endSpan(r,n,s){r&&(dt(s,n)?r.end(s[n]):r.end())}_initResourceSpan(r,n){var i;const s=this._startSpan(jt.RESOURCE_FETCH,S.FETCH_START,r,n);s&&(s.setAttribute(xt,r.name),_t(s,r,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnResourceSpan(s,r,(i=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:i.resourceFetch),this._endSpan(s,S.RESPONSE_END,r))}_startSpan(r,n,s,i){if(dt(s,n)&&typeof s[n]=="number")return this.tracer.startSpan(r,{startTime:s[n]},i?w.setSpan(R.active(),i):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(r,n){n&&zt(()=>n(r),s=>{s&&this._diag.error("addCustomAttributesOnSpan",s)})}_addCustomAttributesOnResourceSpan(r,n,s){s&&zt(()=>s(r,n),i=>{i&&this._diag.error("addCustomAttributesOnResourceSpan",i)})}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}}const Ad="http.request.body.size",ji=f.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Rd(...e){if(e[0]instanceof URL||typeof e[0]=="string"){const t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){const{body:r,length:n}=bd(t.body);return t.body=r,n}else return Promise.resolve(Od(t.body))}else{const t=e[0];return t!=null&&t.body?t.clone().text().then(r=>Fr(r)):Promise.resolve()}}function bd(e){if(!e.pipeThrough)return ji.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r;const n=new Promise(i=>{r=i}),s=new TransformStream({start(){},async transform(i,o){const a=await i;t+=a.byteLength,o.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(s),length:n}}function wd(e){return typeof Document<"u"&&e instanceof Document}function Od(e){if(wd(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return Fr(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return yd(e);if(e instanceof URLSearchParams)return Fr(e.toString());if(e.byteLength!==void 0)return e.byteLength;ji.warn("unknown body type")}const Cd=new TextEncoder;function Fr(e){return Cd.encode(e).byteLength}function yd(e){let t=0;for(const[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function Pd(e){const t=vd(),r=e.toUpperCase();return r in t?r:"_OTHER"}const Md={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let $r;function vd(){return $r===void 0&&($r=Md),$r}const Id={"https:":"443","http:":"80"};function Nd(e){const t=Number(e.port||Id[e.protocol]);if(t&&!isNaN(t))return t}const qi="0.221.0",Ld=300,Wi=typeof PerformanceObserver<"u";class xd extends Gr{constructor(r={}){super("@opentelemetry/instrumentation-fetch",qi,r);c(this,"component","fetch");c(this,"version",qi);c(this,"moduleName",this.component);c(this,"_usedResources",new WeakSet);c(this,"_tasksCount",0)}init(){}_addChildSpan(r,n){const s=this.tracer.startSpan("CORS Preflight",{startTime:n[S.FETCH_START]},w.setSpan(R.active(),r));_t(s,n,this.getConfig().ignoreNetworkEvents,void 0,!0),s.end(n[S.RESPONSE_END])}_addFinalSpanAttributes(r,n){const s=K(n.url);r.setAttribute(ps,n.status),r.setAttribute(fs,s.hostname);const i=Nd(s);i&&r.setAttribute(ms,i)}_addHeaders(r,n){if(!Ys(n,this.getConfig().propagateTraceHeaderCorsUrls)){const s={};U.inject(R.active(),s),Object.keys(s).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(r instanceof Request)U.inject(R.active(),r.headers,{set:(s,i,o)=>s.set(i,typeof o=="string"?o:String(o))});else{const s=new Headers(r.headers);U.inject(R.active(),s,{set:(i,o,a)=>i.set(o,typeof a=="string"?a:String(a))}),r.headers=s}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(r,n={}){if(Us(r,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}const s={},i=n.method,o=Pd(n.method||"GET"),a=o;return s[ds]=o,o!==i&&(s[_s]=i),s[xt]=r,this.tracer.startSpan(a,{kind:It.CLIENT,attributes:s})}_findResourceAndAddNetworkEvents(r,n,s){let i=n.entries;if(!i.length){if(!performance.getEntriesByType)return;i=performance.getEntriesByType("resource")}const o=Xs(n.spanUrl,n.startTime,s,i,this._usedResources,"fetch");if(o.mainRequest){const a=o.mainRequest;this._markResourceAsUsed(a);const u=o.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u)),_t(r,a,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_markResourceAsUsed(r){this._usedResources.add(r)}_endSpan(r,n,s){const i=N(Date.now()),o=G();this._addFinalSpanAttributes(r,s),s.status>=400&&(r.setStatus({code:j.ERROR}),r.setAttribute(Lt,String(s.status))),setTimeout(()=>{var a;(a=n.observer)==null||a.disconnect(),this._findResourceAndAddNetworkEvents(r,n,o),this._tasksCount--,this._clearResources(),r.end(i)},Ld)}_patchConstructor(){return r=>{const n=this;return function(...i){if(!n._isEnabled)return r.apply(this,i);const o=this,a=K(i[0]instanceof Request?i[0].url:String(i[0])).href;let u;i[0]instanceof Request?u=i[1]!=null?new Request(i[0],i[1]):i[0]:u=i[1]||{};const l=n._createSpan(a,u);if(!l)return r.apply(this,i);const h=n._prepareSpanData(a);n.getConfig().measureRequestSize&&Rd(...i).then(m=>{m&&l.setAttribute(Ad,m)}).catch(m=>{n._diag.warn("getFetchBodyLength",m)});function d(m,T){n._applyAttributesAfterFetch(m,u,T),n._endSpan(m,h,{status:T.status||0,statusText:T.message,url:a})}function p(m,T){n._applyAttributesAfterFetch(m,u,T),T.status>=200&&T.status<400?n._endSpan(m,h,T):n._endSpan(m,h,{status:T.status,statusText:T.statusText,url:a})}function _(m,T){try{const M=T.clone().body;if(M){const y=M.getReader(),At=()=>{y.read().then(({done:ut})=>{ut?p(m,T):At()},ut=>{d(m,ut)})};At()}else p(m,T)}catch(A){n._diag.error("Failed to read fetch response body",A),n._endSpan(m,h,{status:0,url:a})}return T}function E(m,T){try{d(m,T)}catch(A){n._diag.error("Failed to end span on fetch error",A),n._endSpan(m,h,{status:T.status||0,url:a})}throw T}return R.with(w.setSpan(R.active(),l),()=>(n._callRequestHook(l,u),n._addHeaders(u,a),n._tasksCount++,r.apply(o,u instanceof Request?[u]:[a,u]).then(_.bind(o,l),E.bind(o,l))))}}}_applyAttributesAfterFetch(r,n,s){const i=this.getConfig().applyCustomAttributesOnSpan;i&&zt(()=>i(r,n,s),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)})}_callRequestHook(r,n){const s=this.getConfig().requestHook;s&&zt(()=>s(r,n),i=>{i&&this._diag.error("requestHook",i)})}_prepareSpanData(r){const n=G(),s=[];if(typeof PerformanceObserver!="function")return{entries:s,startTime:n,spanUrl:r};const i=new PerformanceObserver(o=>{o.getEntries().forEach(u=>{u.initiatorType==="fetch"&&u.name===r&&s.push(u)})});return i.observe({entryTypes:["resource"]}),{entries:s,observer:i,startTime:n,spanUrl:r}}enable(){if(!Wi){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug("fetch constructor already patched"),this._isEnabled=!0;return}try{this._wrap(globalThis,"fetch",this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(r){this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.",r)}}}disable(){Wi&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}const Ud="http.request.body.size";var W;(function(e){e.METHOD_OPEN="open",e.METHOD_SEND="send",e.EVENT_ABORT="abort",e.EVENT_ERROR="error",e.EVENT_LOAD="loaded",e.EVENT_TIMEOUT="timeout"})(W||(W={}));const Dd=f.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function kd(e){return typeof Document<"u"&&e instanceof Document}function Bd(e){if(kd(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return Xi(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Fd(e);if(e instanceof URLSearchParams)return Xi(e.toString());if(e.byteLength!==void 0)return e.byteLength;Dd.warn("unknown body type")}const Gd=new TextEncoder;function Xi(e){return Gd.encode(e).byteLength}function Fd(e){let t=0;for(const[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function $d(e){const t=Hd(),r=e.toUpperCase();return r in t?r:"_OTHER"}const Vd={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0};let Vr;function Hd(){return Vr===void 0&&(Vr=Vd),Vr}const zd={"https:":"443","http:":"80"};function jd(e){const t=Number(e.port||zd[e.protocol]);if(t&&!isNaN(t))return t}const Yi="0.221.0",qd=300;class Wd extends Gr{constructor(r={}){super("@opentelemetry/instrumentation-xml-http-request",Yi,r);c(this,"component","xml-http-request");c(this,"version",Yi);c(this,"moduleName",this.component);c(this,"_tasksCount",0);c(this,"_xhrMem",new WeakMap);c(this,"_usedResources",new WeakSet)}init(){}_addHeaders(r,n){const s=K(n).href;if(!Ys(s,this.getConfig().propagateTraceHeaderCorsUrls)){const o={};U.inject(R.active(),o),Object.keys(o).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}const i={};U.inject(R.active(),i),Object.keys(i).forEach(o=>{r.setRequestHeader(o,String(i[o]))})}_addChildSpan(r,n){R.with(w.setSpan(R.active(),r),()=>{const s=this.tracer.startSpan("CORS Preflight",{startTime:n[S.FETCH_START]});_t(s,n,this.getConfig().ignoreNetworkEvents,void 0,!0),s.end(n[S.RESPONSE_END])})}_addFinalSpanAttributes(r,n){n.status&&r.setAttribute(ps,n.status)}_applyAttributesAfterXHR(r,n){const s=this.getConfig().applyCustomAttributesOnSpan;typeof s=="function"&&zt(()=>s(r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)})}_addResourceObserver(r,n){const s=this._xhrMem.get(r);!s||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(s.createdResources={observer:new PerformanceObserver(i=>{const o=i.getEntries(),a=K(n);o.forEach(u=>{u.initiatorType==="xmlhttprequest"&&u.name===a.href&&s.createdResources&&s.createdResources.entries.push(u)})}),entries:[]},s.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(O.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(r,n,s,i,o){if(!s||!i||!o||!r.createdResources)return;let a=r.createdResources.entries;(!a||!a.length)&&(a=O.getEntriesByType("resource"));const u=Xs(K(s).href,i,o,a,this._usedResources);if(u.mainRequest){const l=u.mainRequest;this._markResourceAsUsed(l);const h=u.corsPreFlightRequest;h&&(this._addChildSpan(n,h),this._markResourceAsUsed(h)),_t(n,l,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_cleanPreviousSpanInformation(r){const n=this._xhrMem.get(r);if(n){const s=n.callbackToRemoveEvents;s&&s(),this._xhrMem.delete(r)}}_createSpan(r,n,s){const i=K(n);if(Us(i.href,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}const o={},a=s,u=$d(s),l=u;o[ds]=u,u!==a&&(o[_s]=a),o[xt]=i.toString(),o[fs]=i.hostname;const h=jd(i);h&&(o[ms]=h);const d=this.tracer.startSpan(l,{kind:It.CLIENT,attributes:o});return d.addEvent(W.METHOD_OPEN),this._cleanPreviousSpanInformation(r),this._xhrMem.set(r,{span:d,spanUrl:n}),d}_markResourceAsUsed(r){this._usedResources.add(r)}_patchOpen(){return r=>{const n=this;return function(...i){if(!n._isEnabled)return r.apply(this,i);const o=i[0],a=i[1];return n._createSpan(this,a,o),r.apply(this,i)}}}_patchSend(){const r=this;function n(h,d,p,_){const E=d.callbackToRemoveEvents;typeof E=="function"&&E();const{span:m,spanUrl:T,sendStartTime:A}=d;m&&(r._findResourceAndAddNetworkEvents(d,m,T,A,p),m.addEvent(h,_),r._addFinalSpanAttributes(m,d),m.end(_),r._tasksCount--),r._clearResources()}function s(h,d,p,_){const E=r._xhrMem.get(d);if(!E)return;if(E.status=d.status,E.statusText=d.statusText,r._xhrMem.delete(d),E.span){const A=E.span;r._applyAttributesAfterXHR(A,d),p?_&&(A.setStatus({code:j.ERROR,message:_}),A.setAttribute(Lt,_)):E.status&&E.status>=400&&(A.setStatus({code:j.ERROR}),A.setAttribute(Lt,String(E.status)))}const m=G(),T=Date.now();setTimeout(()=>{n(h,E,m,T)},qd)}function i(){s(W.EVENT_ERROR,this,!0,"error")}function o(){s(W.EVENT_ABORT,this,!1)}function a(){s(W.EVENT_TIMEOUT,this,!0,"timeout")}function u(){this.status<299?s(W.EVENT_LOAD,this,!1):s(W.EVENT_ERROR,this,!1)}function l(h){h.removeEventListener("abort",o),h.removeEventListener("error",i),h.removeEventListener("load",u),h.removeEventListener("timeout",a);const d=r._xhrMem.get(h);d&&(d.callbackToRemoveEvents=void 0)}return h=>function(...p){if(!r._isEnabled)return h.apply(this,p);const _=r._xhrMem.get(this);if(!_)return h.apply(this,p);const E=_.span,m=_.spanUrl;if(E&&m){if(r.getConfig().measureRequestSize&&(p!=null&&p[0])){const T=p[0],A=Bd(T);A!==void 0&&E.setAttribute(Ud,A)}R.with(w.setSpan(R.active(),E),()=>{r._tasksCount++,_.sendStartTime=G(),E.addEvent(W.METHOD_SEND),this.addEventListener("abort",o),this.addEventListener("error",i),this.addEventListener("load",u),this.addEventListener("timeout",a),_.callbackToRemoveEvents=()=>{l(this),_.createdResources&&_.createdResources.observer.disconnect()},r._addHeaders(this,m),r._addResourceObserver(this,m)})}return h.apply(this,p)}}enable(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug("reactivating existing patch on",this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug("applying patch to",this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(r){this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.warn("Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.",r)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}let Ki=-1;const pt=()=>Ki,ft=e=>{addEventListener("pageshow",t=>{t.persisted&&(Ki=t.timeStamp,e(t))},!0)},I=(e,t,r,n)=>{let s,i;return o=>{t.value>=0&&(o||n)&&(i=t.value-(s!=null?s:0),(i||s===void 0)&&(s=t.value,t.delta=i,t.rating=((a,u)=>a>u[1]?"poor":a>u[0]?"needs-improvement":"good")(t.value,r),e(t)))}},Hr=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},zr=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},qt=()=>{var e,t;return(t=(e=zr())==null?void 0:e.activationStart)!=null?t:0};let at=-1;const Qi=new Set,Ji=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,jr=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of Qi)t();isFinite(at)||(at=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",jr,!0))}},Wt=(e=!1)=>{var t;if(e&&(at=1/0),at<0){const r=qt(),n=document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").find(s=>s.name==="hidden"&&s.startTime>=r))==null?void 0:t.startTime;at=n!=null?n:Ji(),addEventListener("visibilitychange",jr,!0),addEventListener("prerenderingchange",jr,!0),ft(()=>{setTimeout(()=>{at=Ji()})})}return{get firstHiddenTime(){return at},onHidden(r){Qi.add(r)}}},L=(e,t=-1,r,n=0,s,i,o)=>{const a=zr(),u=(a==null?void 0:a.navigationId)||0;let l="navigate";return r?l=r:pt()>=0?l="back-forward-cache":a&&(document.prerendering||qt()>0?l="prerender":document.wasDiscarded?l="restore":a.type&&(l=a.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:l,navigationId:n||u,navigationInteractionId:s,navigationURL:i||(a==null?void 0:a.name),navigationStartTime:o||0}},Zi=new WeakMap;function Te(e,t){let r=Zi.get(t);return r||(r=new WeakMap,Zi.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Xd{constructor(){c(this,"t");c(this,"i",0);c(this,"o",[])}h(t){var s;if(t.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),(s=this.t)==null||s.call(this,t)}}const ct=(e,t,r={})=>{try{const n=e.filter(s=>PerformanceObserver.supportedEntryTypes.includes(s));if(n.length>0){const s=new PerformanceObserver(i=>{queueMicrotask(()=>{const o=i.getEntries();n.length>1&&o.sort((a,u)=>a.startTime+a.duration-(u.startTime+u.duration)),t(o)})});for(const i of n)s.observe({type:i,buffered:!0,...r});return s}}catch(n){}},Xt=e=>{var t,r,n;return((t=globalThis.PerformanceObserver)==null?void 0:t.supportedEntryTypes.includes("soft-navigation"))&&typeof((n=(r=globalThis.PerformanceSoftNavigation)==null?void 0:r.prototype)==null?void 0:n.getLargestInteractionContentfulPaint)=="function"&&e&&e.reportSoftNavs},to=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const r=e.keys().next().value;r!==void 0&&e.delete(r)}},eo=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Yd{constructor(){c(this,"l")}}const Se=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},qr=[1800,3e3],ro=(e,t={})=>{const r=Xt(t);Se(()=>{const n=Te(t,Yd),s=Wt();let i,o=L("FCP");const a=ct(["paint"],u=>{for(const l of u)l.name==="first-contentful-paint"&&(a.disconnect(),l.startTime<s.firstHiddenTime&&(o.value=Math.max(l.startTime-qt(),0),o.entries.push(l),o.navigationId=l.navigationId||o.navigationId,i(!0)))});a&&(i=I(e,o,qr,t.reportAllChanges),ft(u=>{o=L("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,pt()),i=I(e,o,qr,t.reportAllChanges),Hr(()=>{o.value=performance.now()-u.timeStamp,i(!0)})})),r&&ct(["soft-navigation"],u=>{u.forEach(l=>{n.l&&l.navigationId&&to(n.l,l);const h=Math.max((l.presentationTime||l.paintTime||0)-l.startTime,0);o=L("FCP",h,"soft-navigation",l.navigationId,l.interactionId,l.name,l.startTime),i=I(e,o,qr,t.reportAllChanges),i(!0)})},t)})},no=[.1,.25],Kd=(e,t={})=>{const r=Wt();ro(eo(()=>{let n,s=L("CLS",0);const i=Te(t,Xd),o=(p,_,E,m,T)=>{s=L("CLS",0,p,_,E,m,T),i.i=0,n=I(e,s,no,t.reportAllChanges)},a=(p=!1)=>{i.i>s.value&&(s.value=i.i,s.entries=i.o),n(p)},u=p=>{a(!0),o("soft-navigation",p.navigationId,p.interactionId,p.name,p.startTime)},l=p=>{for(const _ of p)_.entryType!=="soft-navigation"?i.h(_):u(_);a()},h=["layout-shift"];Xt(t)&&h.push("soft-navigation");const d=ct(h,l);d&&(n=I(e,s,no,t.reportAllChanges),r.onHidden(()=>{l(d.takeRecords()),n(!0)}),ft(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,pt()),Hr(n)}),setTimeout(n))}))};let so=0,Wr=1/0,Ae=0;const Qd=e=>{for(const t of e)t.interactionId&&(Wr=Math.min(Wr,t.interactionId),Ae=Math.max(Ae,t.interactionId),so=Ae?(Ae-Wr)/7+1:0)};let Xr;const io=()=>{var e;return Xr?so:(e=performance.interactionCount)!=null?e:0},Jd=()=>{"interactionCount"in performance||Xr||(Xr=ct(["event"],Qd,{durationThreshold:0}))};let oo=0;class Zd{constructor(){c(this,"u",[]);c(this,"v",new Map);c(this,"m");c(this,"p")}T(){oo=io(),this.u.length=0,this.v.clear()}M(t){const r=io()-oo,n=Math.min(this.u.length-1,Math.floor(r/50));return!r||n!==-1||t!=="soft-navigation"&&t!=="back-forward-cache"?this.u[n]:{_:8,id:-1,entries:[]}}h(t){var s,i;if((s=this.m)==null||s.call(this,t),!t.interactionId&&t.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.v.get(t.interactionId);if(n||this.u.length<10||t.duration>r._){if(n?t.duration>n._?(n.entries=[t],n._=t.duration):t.duration===n._&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],_:t.duration},this.v.set(n.id,n),this.u.push(n)),this.u.sort((o,a)=>a._-o._),this.u.length>10){const o=this.u.splice(10);for(const a of o)this.v.delete(a.id)}(i=this.p)==null||i.call(this,n)}}}const ao=e=>{const t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{const s=eo(e);let i=-1;const o=()=>{n(i),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),i=r(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},co=[200,500],t_=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Wt();Se(()=>{var p;Jd();let n,s=L("INP");const i=Te(t,Zd),o=(_,E,m,T,A)=>{i.T(),s=L("INP",-1,_,E,m,T,A),n=I(e,s,co,t.reportAllChanges)},a=()=>{const _=i.M(s.navigationType);_&&_._!==s.value&&(s.value=_._,s.entries=_.entries,n())},u=_=>{a(),n(!0),o("soft-navigation",_.navigationId,_.interactionId,_.name,_.startTime)},l=(_,E=!1)=>{ao(()=>{for(const m of _)m.entryType!=="soft-navigation"?i.h(m):u(m);a(),E&&n(!0)})},h=["event","first-input"];Xt(t)&&h.push("soft-navigation");const d=ct(h,l,{...t,durationThreshold:(p=t.durationThreshold)!=null?p:40});n=I(e,s,co,t.reportAllChanges),d&&(r.onHidden(()=>{l(d.takeRecords(),!0)}),ft(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,pt())}))})};class e_{constructor(){c(this,"m");c(this,"l")}h(t){var r;(r=this.m)==null||r.call(this,t)}}const Yr=[2500,4e3],r_=(e,t={})=>{let r=!1;const n=Xt(t);Se(()=>{let s,i=Wt(),o=L("LCP");const a=Te(t,e_),u=(_,E,m,T,A)=>{o=L("LCP",-1,_,E,m,T,A),s=I(e,o,Yr,t.reportAllChanges),r=!1,_==="soft-navigation"&&(i=Wt(!0))},l=_=>{var m;a.l&&_.navigationId&&to(a.l,_),r||s(!0),u("soft-navigation",_.navigationId,_.interactionId,_.name,_.startTime);const E=(m=_.getLargestInteractionContentfulPaint)==null?void 0:m.call(_);E&&h([E])},h=_=>{var E;t.reportAllChanges||n||(_=_.slice(-1));for(const m of _){if(!m)continue;if(m.entryType==="soft-navigation"){l(m);continue}let T=0,A=[],M=m.startTime;if(m.entryType==="largest-contentful-paint")T=Math.max(m.startTime-qt(),0),a.h(m),A=[m];else if(m.entryType==="interaction-contentful-paint"){const y=m;if(!o.navigationId||"interactionId"in y&&y.interactionId!=o.navigationInteractionId)continue;M=((E=y.largestContentfulPaint)==null?void 0:E.renderTime)||0,T=Math.max(M-m.startTime,0),y.largestContentfulPaint&&(a.h(y.largestContentfulPaint),A=[y.largestContentfulPaint])}M<i.firstHiddenTime&&(o.value=T,o.entries=A,s())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");const p=ct(d,h);if(p){s=I(e,o,Yr,t.reportAllChanges);const _=["keydown","click","visibilitychange"],E=m=>{if(m.isTrusted&&!r){const T=o.id;ao(()=>{if(!r){if(!n){p.disconnect();for(const A of _)removeEventListener(A,E,{capture:!0})}T===o.id&&(r=!0,s(!0))}})}};for(const m of _)addEventListener(m,E,{capture:!0});ft(m=>{u("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,pt()),s=I(e,o,Yr,t.reportAllChanges),Hr(()=>{o.value=performance.now()-m.timeStamp,r=!0,s(!0)})})}})},Kr=[800,1800],Qr=e=>{document.prerendering?Se(()=>Qr(e)):document.readyState!=="complete"?addEventListener("load",()=>Qr(e),!0):setTimeout(e)},n_=(e,t={})=>{const r=Xt(t);let n=L("TTFB"),s=I(e,n,Kr,t.reportAllChanges);Qr(()=>{const i=zr();if(i){const o=i.responseStart;n.value=Math.max(o-qt(),0),n.entries=[i],s(!0),ft(()=>{n=L("TTFB",0,"back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,pt()),s=I(e,n,Kr,t.reportAllChanges),s(!0)}),r&&ct(["soft-navigation"],a=>{a.forEach(u=>{u.navigationId&&(n=L("TTFB",0,"soft-navigation",u.navigationId,u.interactionId,u.name,u.startTime),n.entries=[u],s=I(e,n,Kr,t.reportAllChanges),s(!0))})},t)}})},s_=3e4,i_=[{register:r_,name:"web_vitals.lcp",unit:"ms",boundaries:[100,250,500,1e3,1500,2e3,2500,3e3,4e3,6e3,8e3,12e3]},{register:t_,name:"web_vitals.inp",unit:"ms",boundaries:[8,16,40,75,100,150,200,300,500,750,1e3]},{register:Kd,name:"web_vitals.cls",unit:"1",boundaries:[.01,.025,.05,.075,.1,.15,.25,.5,1]},{register:ro,name:"web_vitals.fcp",unit:"ms",boundaries:[100,250,500,900,1200,1500,1800,2200,3e3,4e3,6e3]},{register:n_,name:"web_vitals.ttfb",unit:"ms",boundaries:[50,100,200,400,600,800,1200,1800,2500,4e3]}],uo=()=>{var e;return`/${(e=window.location.pathname.split("/")[1])!=null?e:""}`},lo={login_redirect:{name:"app_shell.login_redirect",description:"Time from navigation start until the shell redirects to the login service",boundaries:[50,100,200,400,700,1e3,1500,2500,4e3,6e3]},app_ready:{name:"app_shell.app_ready",description:"Time from navigation start until the splash screen is replaced by the app",boundaries:[500,1e3,1500,2e3,3e3,4e3,6e3,8e3,12e3,2e4]}},ho=new Map,_o=e=>{var t;(t=ho.get(e))==null||t.record(performance.now(),{"page.route":uo()})},o_=e=>{i_.forEach(({register:t,name:r,unit:n,boundaries:s})=>{const i=e.createHistogram(r,{unit:n,advice:{explicitBucketBoundaries:s}});t(o=>{i.record(o.value,{"web_vital.rating":o.rating,"web_vital.navigation_type":o.navigationType,"page.route":uo()})})})},a_=()=>{const{GPv2UIOtelEndpoint:e,OtelTracesSamplerRatio:t}=P();if(typeof e!="string"||e.trim()==="")return;const r=e.trim().replace(/\/+$/,""),n=crypto.randomUUID(),s=Ds({[gs]:Kt,"deployment.environment":window.location.hostname,[Ka]:n}),i=new Au({resource:s,sampler:new ht({root:new Rr(t!=null?t:1)}),spanProcessors:[new gu(new nd({url:`${r}/v1/traces`}))]});i.register();const o=new Hl({resource:s,readers:[new nl({exporter:new ud({url:`${r}/v1/metrics`}),exportIntervalMillis:s_})]});rr.setGlobalMeterProvider(o);const a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=[new RegExp(`^${a}(/|$)`,"i"),/^https?:\/\/([a-z0-9-]+\.)*dc\.services\.visualstudio\.com(\/|$)/i,/^https?:\/\/([a-z0-9-]+\.)*(google-analytics|googletagmanager)\.com(\/|$)/i];dd({tracerProvider:i,meterProvider:o,instrumentations:[new Sd,new xd({ignoreUrls:u}),new Wd({ignoreUrls:u})]});const l=o.getMeter("app-shell");o_(l),Object.keys(lo).forEach(h=>{const{name:d,description:p,boundaries:_}=lo[h];ho.set(h,l.createHistogram(d,{unit:"ms",description:p,advice:{explicitBucketBoundaries:_}}))}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&(i.forceFlush().catch(()=>{}),o.forceFlush().catch(()=>{}))}),window[Zt.otel]=Object.freeze({tracerProvider:i,meterProvider:o,serviceInstanceId:n})},po=async e=>{const t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")};function c_(){const{location:e}=window,t=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`,{LoginAuthority:r,GlobalPortalClientId:n,GlobalPortalUIScopes:s,GlobalPlanBShellPostLogoutRedirectUrl:i}=P();return{authority:r,client_id:n,redirect_uri:`${t}/auth-callback`,response_type:"code",scope:s,post_logout_redirect_uri:i,monitorSession:!1}}const Re=new Po(c_()),u_=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(window.atob(t).split("").map(n=>`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(r)},fo=()=>{localStorage.removeItem(Rt)},H=()=>{const e=localStorage.getItem(Rt);return e?JSON.parse(e):null},Jr=()=>{var e;const t=localStorage.getItem(Ue);return t?(e=JSON.parse(t))==null?void 0:e.email:null},mo=async()=>{const e=H();if(!e)return null;const t=(e.profile.given_name||"")+(e.profile.family_name||"")+e.profile.sub;return await po(t)},Zr=()=>{const e=H();return e?e.id_token:null},tn=(e,t)=>{const r={...t,...e},n=u_(e.access_token);return r.profile.sub=n.sub,r.profile.account_number=n.account_number,r.expires_at=n.exp,r.is_federated=n.is_federated,n.previous_login_date&&(r.profile.previous_login_date=n.previous_login_date),mn.setAccount({accountNumber:n.account_number,email:n.email,name:n.name,givenName:n.given_name,familyName:n.family_name,authTime:n.exp,accessToken:e.access_token,idToken:e.id_token}),localStorage.setItem(Rt,JSON.stringify(r)),r},go=e=>{tn(e,null)},Eo=()=>{const e=H();return e?e.access_token:null},To=()=>{const e=H();return e&&e.is_federated!==null&&e.is_federated!==void 0?String(e.is_federated).toLowerCase()==="true":!1},So=()=>{const e=H();return e!=null&&e.expires_at?e.expires_at>Date.now()/1e3:!1},Ao=()=>{var e;const t=H();return((e=t==null?void 0:t.profile)==null?void 0:e.previous_login_date)||null};var l_=Object.freeze({__proto__:null,clearUser:fo,getAccessToken:Eo,getHashedUserId:mo,getIdToken:Zr,getPreviousLoginDate:Ao,getUser:H,getUserEmail:Jr,hasActiveAccessToken:So,isFederatedUser:To,saveUser:go,updateUser:tn,userManager:Re});const h_=["authenticate","auth-callback","logout"],d_=e=>e.expires_at&&new Date(e.expires_at*1e3),__=e=>e.expires_at&&new Date(e.expires_at*1e3+P().TokenValidForOfflineUsePostExpiryInHours*60*60*1e3),Ro=()=>{if(!P().IsLoginEnabled)return!1;const e=H();if(!Zr())return!0;if(!e.expires_at)return!1;const t=new Date;return navigator.onLine?t>d_(e):t>__(e)},p_=()=>{const e=window.location.pathname.split("/");return h_.includes(e[e.length-1])},f_=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="authenticate"?(P().IsLoginEnabled?Re.signinRedirect():window.location.href="/",!0):!1},m_=()=>{let e="/";const t=localStorage.getItem(Qt);t&&(localStorage.removeItem(Qt),e=t),sessionStorage.setItem(We.SessionStorage.ShowLastLoginPopup,"true"),window.location.href=e},g_=e=>{if(!e.id_token)throw new Error("Missing property:id_token");return e},en=e=>{const t=p_();(!t||e)&&(t||localStorage.setItem(Qt,window.location.href),window.location.href="/authenticate")},E_=async e=>{const t=`${e.profile.sub}-${e.profile.customer_id}`,r=await po(t);return{...e,profile:{...e.profile,hashed_identifier:r}}},T_=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="auth-callback"?(Re.signinRedirectCallback().then(g_).then(E_).then(go).then(m_).catch(en),!0):!1};class S_ extends pn{render(){return lt` <ix-splash-screen></ix-splash-screen> `}}window.customElements.define("splash-screen",S_);class A_{constructor(){this.permissions=[],this.loading=!1,this.getPermissions=async()=>{var t;const r=(t=mn)==null?void 0:t.access_token;if(!r)return[];const{ApiBaseUrl:n}=P(),s=await fetch(`${n}/usermanagement/my-permissions?exclude_parents=false&exclude_siblings=true`,{headers:{Authorization:`Bearer ${r}`}});return s.ok?s.json():[]},Mo(this,{permissions:Io,setPermissions:vo})}setPermissions(t){this.permissions=t}tryLoadPermissions(){try{this.loading||(this.loading=!0,this.getPermissions().then(t=>{this.setPermissions(t),this.loading=!1}).catch(()=>{this.loading=!1}))}catch(t){this.loading=!1}}clearPermissions(){this.setPermissions([])}hasExternalUserCreate(){return this.hasPermission(Be,bt)||this.hasPermission(qe,bt)}hasConnectivityCreate(){return this.hasPermission(Jt,bt)}hasPrivilegeLevel(t,r){const n=[bn,bt,An,Rn],s=n.findIndex(o=>o===t),i=n.findIndex(o=>o===r);return s>=i}hasPermission(t,r){return No(this.permissions).some(n=>n.permission_name===t&&this.hasPrivilegeLevel(r,n.privilege))}}const rn=new A_,bo=async()=>{const{getAccessToken:e}=await Promise.resolve().then(function(){return l_}),t=new Headers;return t.append("Authorization",`Bearer ${e()}`),t},R_=async()=>{const{ApiBaseUrl:e}=P(),{ORDER_MANAGEMENT_PERMISSIONS:t}=await Promise.resolve().then(function(){return $o}),r=`${e}/inventory/locations?embed=permissions&page_size=1000`;let n=[],s=1;for(;;){const o=await bo(),a=await fetch(`${r}&cursor=${s}`,{headers:o});if(!a.ok)return Promise.reject();const u=await a.json();if(n.push(...u.items),u.self===u.last)break;s++}n=n.filter(o=>o.permissions.some(a=>t.includes(a.name)));const i=new Map;for(const o of n)i.has(o.account_number)?i.get(o.account_number).push(o.site_id):i.set(o.account_number,[o.site_id]);return i},b_=async e=>{const{ApiBaseUrl:t}=P(),r=new URLSearchParams;r.append("process","Cross_connect");const n=[...e.keys()],s=[...new Set([...e.values()].flat())];r.append("account_number",n.join(",")),r.append("site",s.join(","));const i=await bo(),o=await fetch(`${t}/site-navigations/site-configurations?${r}`,{headers:i});return o.ok?await o.json():Promise.reject()},w_=async()=>{try{const e=await R_();return e.size===0?!1:(await b_(e)).some(t=>{var r;return t.portal==="GlobalPortal"&&!!((r=e.get(t.account_number))!=null&&r.includes(t.site))})}catch(e){return console.error("Failed to determine portal-managed inventory:",e),!1}},{ApiBaseUrl:O_}=P(),C_=new URL(O_).origin;function y_(e){return e.origin===C_}const P_=["type","title","detail","instance","code","correlation_id","timestamp","account_number"];function M_(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.status=="number"&&P_.every(r=>typeof t[r]=="string"&&t[r]!=="")}function v_(){const e=globalThis.fetch;globalThis.fetch=async function(...t){var r;const[n]=t,s=n instanceof Request?n.url:String(n),i=await e.apply(this,t);try{y_(new URL(s,(r=globalThis.location)==null?void 0:r.href))&&i.status>=400&&i.clone().json().then(o=>{var a;M_(o)&&((a=globalThis[Zt.appInsights])==null||a.trackEvent({name:"internal_api_error",properties:{url:s,body:o}}))}).catch(o=>console.warn(`[fetch] couldn't read body ${s}`,o))}catch(o){console.error("Failed to fetch:",o)}return i}}const I_="SUPERUSER";class nn extends pn{_isSuperUser(t){return t.some(r=>{var n;return(n=r.provenance)==null?void 0:n.includes(I_)})}constructor(){super(),this._currentView="splash",this.appLoaded=!1,this._onPopState=()=>{P().IsLoginEnabled&&Ro()&&en()};try{zo(),v_()}catch(r){console.error("Telemetry initialization failed:",r)}try{a_()}catch(r){console.error("OpenTelemetry initialization failed:",r)}const t=window.location.pathname;if(t==="/session-expired"){this._currentView="session-expired",this._loadView("session-expired");return}if(t==="/logout"){this._currentView="logout",this._loadView("logout");return}if(f_()||T_()){this._currentView="splash";return}if(Ro()){this._currentView="splash",_o("login_redirect"),en();return}this._currentView="app",this._loadApp()}async _loadView(t){t==="session-expired"?await import("@digital-realty/ix-app-logic/views/session-expiry.js"):t==="logout"&&await import("./logout-BZJ5_qly.js")}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._onPopState)}_getAccountNumber(){var t,r,n;return(n=new URLSearchParams(window.location.search).get("selected_account_number"))!=null?n:(r=(t=H())==null?void 0:t.profile)==null?void 0:r.account_number}_redirectTo(t){window.location.href=t}_isEEDAccessOnly(t,r){const n=t.filter(s=>s.account_number===r);return n.length===1&&n[0].permission_name==="ESG Reporting"}async _applyGomFF(t){var r;const n=Jr(),s=structuredClone(window.gpConfig);if(!n||!s)return;const i=this._isSuperUser(t),o=!!((r=s["app-shell"])!=null&&r.IsInventoryManagementEnabled),a=await w_()&&(i||o);s["app-shell"].IsInventoryManagementEnabled=a,s["ui-launchpad"].IsInventoryManagementEnabled=a,window.gpConfig=Object.freeze(s)}_applyMfeOverrides(t,r){const n={};for(const s of Object.keys(t))n[s]={...t[s],enabled:r.includes(s)};return n}async _loadApp(){var t;const{authedUser:r}=await import("@digital-realty/ix-account-switcher");await r.hydrateStore();const[n,s]=await Promise.allSettled([fetch("./registered-apps.json").then(l=>l.json()),rn.getPermissions()]);if(n.status==="rejected"){console.error("Failed to load registered apps:",n.reason);return}if(s.status==="rejected"){console.error("Failed to load permissions:",s.reason);return}const{registeredApps:i}=n.value,o=s.value,a=(t=this._getAccountNumber())!=null?t:"";if(!a){const{LoginAuthority:l}=P();this._redirectTo(`${l}/Account/NoAccess`);return}const u=this._isEEDAccessOnly(o,a)?this._applyMfeOverrides(i,["ui-esg"]):i;await this._applyGomFF(o),window.registeredApps=Object.freeze(u),rn.setPermissions(o),await import("./app-hjP5HfNA.js"),this.appLoaded=!0,_o("app_ready")}render(){switch(this._currentView){case"session-expired":return lt`<ix-session-expiry></ix-session-expiry>`;case"logout":return lt`<ixp-logout></ixp-logout>`;case"app":return this.appLoaded?lt`<global-portal-app appTitle="DLR" showDrawer></global-portal-app>`:lt`<splash-screen></splash-screen>`;default:return lt`<splash-screen></splash-screen>`}}}_n([fn({type:String})],nn.prototype,"_currentView",void 0),_n([fn({type:Boolean})],nn.prototype,"appLoaded",void 0),window.customElements.define("gp-bootstrap",nn);export{Gn as A,Ue as B,wn as C,Sn as D,Un as E,Tn as F,Ie as G,kn as I,Le as M,Bn as O,Hn as R,Dn as S,qe as U,Zr as a,mo as b,fo as c,Jr as d,Eo as e,H as f,P as g,tn as h,Ao as i,To as j,We as k,Mn as l,Be as m,yn as n,Pn as o,rn as p,xe as q,zn as r,Ne as s,Zt as t,Re as u,Kt as v,gn as w,So as x,En as y,Rt as z};