PageSourceSearch

https://dungeonsdeep.ai/_next/static/chunks/20w34a4nexehf.js

js dungeonsdeep.ai collected 2026-10-05 16:14:35 UTC 130,824 bytes, 8 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,514864,e=>{"use strict";var t=e.i(843476),r=e.i(271645);let i=(0,r.createContext)(void 0);e.s(["ThemeProvider",0,function({children:e}){return(0,r.useEffect)(()=>{document.documentElement.setAttribute("data-theme","blue"),localStorage.setItem("ui-theme","blue")},[]),(0,t.jsx)(i.Provider,{value:{theme:"blue",setTheme:e=>{}},children:e})},"useTheme",0,function(){let e=(0,r.useContext)(i);if(void 0===e)throw Error("useTheme must be used within a ThemeProvider");return e}])},460700,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(618566),s=e.i(531278),n=e.i(55260);let a=["/","/waitlist","/pricing"],o=["/auth/","/api/","/blog"];e.s(["WaitListGuard",0,function({children:e}){let c=(0,n.useAuth)(),l=(0,i.usePathname)(),u=(0,i.useRouter)(),h=!c.isLoading&&!!c.user&&!0===c.isOnWaitList&&!(a.includes(l)||o.some(e=>l.startsWith(e)));return((0,r.useEffect)(()=>{h&&u.replace("/waitlist")},[h,u]),h)?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-screen w-full bg-coal-950 gap-4",children:[(0,t.jsx)(s.Loader2,{className:"h-6 w-6 animate-spin text-bronze"}),(0,t.jsx)("p",{className:"text-bone-muted text-sm font-eb-garamond",children:"Checking the guest list..."})]}):(0,t.jsx)(t.Fragment,{children:e})}])},230896,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(618566),s=e.i(531278),n=e.i(55260);let a="/auth/username",o=["/auth/","/api/"];function c({isLoading:e,hasUser:t,needsUsername:r,pathname:i}){return!e&&t&&!0===r&&!o.some(e=>i.startsWith(e))}e.s(["USERNAME_PATH",0,a,"UsernameGuard",0,function({children:e}){let o=(0,n.useAuth)(),l=(0,i.usePathname)(),u=(0,i.useRouter)(),h=c({isLoading:o.isLoading,hasUser:!!o.user,needsUsername:o.needsUsername,pathname:l});return((0,r.useEffect)(()=>{h&&u.replace(a)},[h,u]),h)?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-screen w-full bg-coal-950 gap-4",children:[(0,t.jsx)(s.Loader2,{className:"h-6 w-6 animate-spin text-bronze"}),(0,t.jsx)("p",{className:"text-bone-muted text-sm font-eb-garamond",children:"Setting up your account..."})]}):(0,t.jsx)(t.Fragment,{children:e})},"shouldRedirectToUsername",0,c])},980321,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(55260),s=e.i(3435),n=e.i(418674);let a="pendingInviteToken";e.s(["PendingInviteRedeemer",0,function(){let e=(0,i.useAuth)(),o=(0,r.useRef)(!1),[c,l]=(0,r.useState)(null);return((0,r.useEffect)(()=>{if(e.isLoading||!e.isAuthenticated||!e.user||o.current)return;let t=null;try{t=window.sessionStorage.getItem(a)}catch{}t&&(0,n.isValidInviteTokenFormat)(t)&&(o.current=!0,(async()=>{try{let e=await (0,s.authFetch)("/api/invites/use",{method:"POST",headers:{"X-Invite-Token":t},body:"{}"});try{window.sessionStorage.removeItem(a)}catch{}let r=`/play?campaignId=${encodeURIComponent(e.campaignId)}`;try{window.history.replaceState({},"",r)}catch{}window.location.href=r}catch{try{window.sessionStorage.removeItem(a)}catch{}l(t)}})())},[e.isLoading,e.isAuthenticated,e.user]),c)?(0,t.jsxs)("div",{className:"fixed bottom-4 right-4 max-w-sm p-4 bg-amber-50 border border-amber-200 rounded shadow text-sm",children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:"Couldn't complete invite"}),(0,t.jsx)("p",{className:"mb-2",children:"Your account was created, but joining the campaign failed."}),(0,t.jsx)("a",{href:`/invite/${encodeURIComponent(c)}`,className:"underline",children:"Join campaign manually"})]}):null}])},64140,e=>{"use strict";let t,r,i;var s,n,a,o,c,l,u,h,d,m,p,_,g,f,b,S,w,y,v,E,T,A,x,C,O,L,M,R,P,N,U,I,k,B,D,F,j,G,$,V,z,H,W,K,X,Q,J,Y,q,Z,ee,et,er=e.i(271645),ei=e.i(55260);class es{}class en{addCallback(e){}removeCallback(e){}}let ea=new class{createGauge(e,t){return ec}createHistogram(e,t){return el}createCounter(e,t){return eo}createUpDownCounter(e,t){return eu}createObservableGauge(e,t){return ed}createObservableCounter(e,t){return eh}createObservableUpDownCounter(e,t){return em}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},eo=new class extends es{add(e,t){}},ec=new class extends es{record(e,t){}},el=new class extends es{record(e,t){}},eu=new class extends es{add(e,t){}},eh=new class extends en{},ed=new class extends en{},em=new class extends en{},ep=new class{getMeter(e,t,r){return ea}},e_="1.9.1",eg=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,ef=function(e){let t=new Set([e]),r=new Set,i=e.match(eg);if(!i)return()=>!1;let s={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(null!=s.prerelease)return function(t){return t===e};function n(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;
1if(r.has(e))return!1;let i=e.match(eg);if(!i)return n(e);let a={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(null!=a.prerelease||s.major!==a.major)return n(e);if(0===s.major)return s.minor===a.minor&&s.patch<=a.patch?(t.add(e),!0):n(e);return s.minor<=a.minor?(t.add(e),!0):n(e)}}(e_),eb=e_.split(".")[0],eS=Symbol.for(`opentelemetry.js.api.${eb}`),ew="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:e.g;function ey(e,t,r,i=!1){var s;let n=ew[eS]=null!=(s=ew[eS])?s:{version:e_};if(!i&&n[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(t.stack||t.message),!1}if(n.version!==e_){let t=Error(`@opentelemetry/api: Registration of version v${n.version} for ${e} does not match previously registered API v${e_}`);return r.error(t.stack||t.message),!1}return n[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${e_}.`),!0}function ev(e){var t,r;let i=null==(t=ew[eS])?void 0:t.version;if(i&&ef(i))return null==(r=ew[eS])?void 0:r[e]}function eE(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${e_}.`);let r=ew[eS];r&&delete r[e]}class eT{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return eA("debug",this._namespace,e)}error(...e){return eA("error",this._namespace,e)}info(...e){return eA("info",this._namespace,e)}warn(...e){return eA("warn",this._namespace,e)}verbose(...e){return eA("verbose",this._namespace,e)}}function eA(e,t,r){let i=ev("diag");if(i)return i[e](t,...r)}(s=M||(M={}))[s.NONE=0]="NONE",s[s.ERROR=30]="ERROR",s[s.WARN=50]="WARN",s[s.INFO=60]="INFO",s[s.DEBUG=70]="DEBUG",s[s.VERBOSE=80]="VERBOSE",s[s.ALL=9999]="ALL";class ex{static instance(){return this._instance||(this._instance=new ex),this._instance}constructor(){function e(e){return function(...t){let r=ev("diag");if(r)return r[e](...t)}}const t=this,r=(e,r={logLevel:M.INFO})=>{var i,s,n;if(e===t){let e=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!=(i=e.stack)?i:e.message),!1}"number"==typeof r&&(r={logLevel:r});let a=ev("diag"),o=function(e,t){function r(r,i){let s=t[r];return"function"==typeof s&&e>=i?s.bind(t):function(){}}return e<M.NONE?e=M.NONE:e>M.ALL&&(e=M.ALL),t=t||{},{error:r("error",M.ERROR),warn:r("warn",M.WARN),info:r("info",M.INFO),debug:r("debug",M.DEBUG),verbose:r("verbose",M.VERBOSE)}}(null!=(s=r.logLevel)?s:M.INFO,e);if(a&&!r.suppressOverrideMessage){let e=null!=(n=Error().stack)?n:"<failed to generate stacktrace>";a.warn(`Current logger will be overwritten from ${e}
1`),o.warn(`Current logger will overwrite one already registered from ${e}`)}return ey("diag",o,t,!0)};t.setLogger=r,t.disable=()=>{eE("diag",t)},t.createComponentLogger=e=>new eT(e),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}}let eC="metrics";class eO{static getInstance(){return this._instance||(this._instance=new eO),this._instance}setGlobalMeterProvider(e){return ey(eC,e,ex.instance())}getMeterProvider(){return ev(eC)||ep}getMeter(e,t,r){return this.getMeterProvider().getMeter(e,t,r)}disable(){eE(eC,ex.instance())}}let eL=eO.getInstance();var eM=e.i(771744);let eR=ex.instance(),eP="exception.message",eN="exception.type",eU="service.name",eI="telemetry.sdk.language",ek="webjs",eB="telemetry.sdk.name",eD="telemetry.sdk.version",eF={[eB]:"opentelemetry","process.runtime.name":"browser",[eI]:ek,[eD]:"2.7.1"},ej=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class eG{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){let r=new eG({},t);return r._rawAttributes=eV(e),r._asyncAttributesPending=e.filter(([e,t])=>ej(t)).length>0,r}constructor(e,t){const r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([e,t])=>(ej(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=eV(this._rawAttributes),this._schemaUrl=function(e){if("string"==typeof e||void 0===e)return e;eR.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,ej(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&eR.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,r]of this._rawAttributes){if(ej(r)){eR.debug(`Unsettled resource attribute ${t} skipped`);continue}null!=r&&(e[t]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;let i,s,n;if(null==e)return this;let a=(t=this,r=e,i=t?.schemaUrl,n=void 0===(s=r?.schemaUrl)||""===s,void 0===i||""===i?s:n||i===s?i:void eR.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',i,s));return eG.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],a?{schemaUrl:a}:void 0)}}function e$(e,t){return eG.FromAttributeList(Object.entries(e),t)}function eV(e){return e.map(([e,t])=>ej(t)?[e,t.catch(t=>{eR.debug("promise rejection for resource attribute: %s - %s",e,t)})]:[e,t])}var ez=e.i(773203);let eH={[eB]:"opentelemetry","process.runtime.name":"browser",[eI]:ek,[eD]:"2.5.1"},eW=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class eK{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){let r=new eK({},t);return r._rawAttributes=eX(e),r._asyncAttributesPending=e.filter(([e,t])=>eW(t)).length>0,r}constructor(e,t){const r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([e,t])=>(eW(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=eX(this._rawAttributes),this._schemaUrl=function(e){if("string"==typeof e||void 0===e)return e;eR.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,eW(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&eR.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};
1for(let[t,r]of this._rawAttributes){if(eW(r)){eR.debug(`Unsettled resource attribute ${t} skipped`);continue}null!=r&&(e[t]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;let i,s,n;if(null==e)return this;let a=(t=this,r=e,i=t?.schemaUrl,n=void 0===(s=r?.schemaUrl)||""===s,void 0===i||""===i?s:n||i===s?i:void eR.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',i,s));return eK.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],a?{schemaUrl:a}:void 0)}}function eX(e){return e.map(([e,t])=>eW(t)?[e,t.catch(t=>{eR.debug("promise rejection for resource attribute: %s - %s",e,t)})]:[e,t])}class eQ{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class eJ{_isCalled=!1;_deferred=new eQ;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}var eY=e.i(811275);function eq(e){return Symbol.for(e)}class eZ{constructor(e){const t=this;t._currentContext=e?new Map(e):new Map,t.getValue=e=>t._currentContext.get(e),t.setValue=(e,r)=>{let i=new eZ(t._currentContext);return i._currentContext.set(e,r),i},t.deleteValue=e=>{let r=new eZ(t._currentContext);return r._currentContext.delete(e),r}}}let e0=new eZ,e1="context",e2=new class{active(){return e0}with(e,t,r,...i){return t.call(r,...i)}bind(e,t){return t}enable(){return this}disable(){return this}};class e4{static getInstance(){return this._instance||(this._instance=new e4),this._instance}setGlobalContextManager(e){return ey(e1,e,ex.instance())}active(){return this._getContextManager().active()}with(e,t,r,...i){return this._getContextManager().with(e,t,r,...i)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return ev(e1)||e2}disable(){this._getContextManager().disable(),eE(e1,ex.instance())}}let e5=e4.getInstance();(n=R||(R={}))[n.NONE=0]="NONE",n[n.SAMPLED=1]="SAMPLED";let e3="0000000000000000",e6="00000000000000000000000000000000",e8={traceId:e6,spanId:e3,traceFlags:R.NONE};class e7{constructor(e=e8){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}let e9=eq("OpenTelemetry Context Key SPAN");function te(e){return e.getValue(e9)||void 0}function tt(){return te(e4.getInstance().active())}function tr(e,t){return e.setValue(e9,t)}function ti(e){return e.deleteValue(e9)}function ts(e,t){return tr(e,new e7(t))}function tn(e){var t;return null==(t=te(e))?void 0:t.spanContext()}let ta=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 to(e,t){if("string"!=typeof e||e.length!==t)return!1;let r=0;for(let t=0;t<e.length;t+=4)r+=(0|ta[e.charCodeAt(t)])+(0|ta[e.charCodeAt(t+1)])+(0|ta[e.charCodeAt(t+2)])+(0|ta[e.charCodeAt(t+3)]);return r===t}function tc(e){return to(e,32)&&e!==e6}function tl(e){var t;return tc(e.traceId)&&to(t=e.spanId,16)&&t!==e3}function tu(e){return new e7(e)}let th=e4.getInstance();class td{startSpan(e,t,r=th.active()){var i;if(null==t?void 0:t.root)return new e7;let s=r&&tn(r);return null!==(i=s)&&"object"==typeof i&&"spanId"in i&&"string"==typeof i.spanId&&"traceId"in i&&"string"==typeof i.traceId&&"traceFlags"in i&&"number"==typeof i.traceFlags&&tl(s)?new e7(s):new e7}startActiveSpan(e,t,r,i){let s,n,a;if(arguments.length<2)return;2==arguments.length?a=t:3==arguments.length?(s=t,a=r):(s=t,n=r,a=i);let o=null!=n?n:th.active(),c=this.startSpan(e,s,o),l=tr(o,c);return th.with(l,a,void 0,c)}}let tm=new td;
1class tp{constructor(e,t,r,i){this._provider=e,this.name=t,this.version=r,this.options=i}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,i){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):tm}}let t_=new class{getTracer(e,t,r){return new td}};class tg{getTracer(e,t,r){var i;return null!=(i=this.getDelegateTracer(e,t,r))?i:new tp(this,e,t,r)}getDelegate(){var e;return null!=(e=this._delegate)?e:t_}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var i;return null==(i=this._delegate)?void 0:i.getTracer(e,t,r)}}let tf="trace";class tb{constructor(){this._proxyTracerProvider=new tg,this.wrapSpanContext=tu,this.isSpanContextValid=tl,this.deleteSpan=ti,this.getSpan=te,this.getActiveSpan=tt,this.getSpanContext=tn,this.setSpan=tr,this.setSpanContext=ts}static getInstance(){return this._instance||(this._instance=new tb),this._instance}setGlobalTracerProvider(e){let t=ey(tf,this._proxyTracerProvider,ex.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return ev(tf)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){eE(tf,ex.instance()),this._proxyTracerProvider=new tg}}let tS=tb.getInstance(),tw=performance;function ty(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}function tv(e){var t,r,i;if(Array.isArray(t=e)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])return e;if("number"==typeof e)if(!(e<tw.timeOrigin))return ty(e);else{let t;return r=ty(tw.timeOrigin),i=ty("number"==typeof e?e:tw.now()),(t=[r[0]+i[0],r[1]+i[1]])[1]>=1e9&&(t[1]-=1e9,t[0]+=1),t}if(e instanceof Date)return ty(e.getTime());throw TypeError("Invalid input type")}class tE{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,r){const{timestamp:i,observedTimestamp:s,eventName:n,severityNumber:a,severityText:o,body:c,attributes:l={},context:u}=r,h=Date.now();if(this.hrTime=tv(i??h),this.hrTimeObserved=tv(s??h),u){const e=tS.getSpanContext(u);e&&tl(e)&&(this.spanContext=e)}this.severityNumber=a,this.severityText=o,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=n,this.setAttributes(l)}setAttribute(e,t){return this._isLogRecordReadonly()?this:0===e.length?(eR.warn(`Invalid attribute key: ${e}`),this):(!function e(t,r){return!!(null==t||"string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof Uint8Array)||"object"==typeof t&&!r.has(t)&&((r.add(t),Array.isArray(t))?t.every(t=>e(t,r)):(t.constructor===Object||void 0===t.constructor)&&Object.values(t).every(t=>e(t,r)))}(t,new WeakSet)?eR.warn(`Invalid attribute value set for key: ${e}`):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e))?1===this.droppedAttributesCount&&eR.warn("Dropping extra attributes."):this.attributes[e]=this._truncateToSize(t),this)}setAttributes(e){for(let[t,r]of Object.entries(e))this.setAttribute(t,r);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;
1if(t<=0)return eR.warn(`Attribute value limit must be positive, got ${t}`),e;if(null==e)return e;if("string"==typeof e)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if("object"==typeof e){let t={};for(let[r,i]of Object.entries(e))t[r]=this._truncateToSize(i);return t}return e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&eR.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class tT{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,r=e.context||e5.active(),i=e.severityNumber??eY.SeverityNumber.UNSPECIFIED;if(i!==eY.SeverityNumber.UNSPECIFIED&&i<t.minimumSeverity)return;if(t.traceBased){let e=tS.getSpanContext(r);if(e&&tl(e)&&(e.traceFlags&R.SAMPLED)!==R.SAMPLED)return}let s=new tE(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(s,r),s._makeReadonly()}}class tA{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}class tx extends Error{constructor(e){super(e),Object.setPrototypeOf(this,tx.prototype)}}function tC(e,t){let r;return Promise.race([e,new Promise(function(e,i){r=setTimeout(function(){i(new tx("Operation timed out."))},t)})]).then(e=>(clearTimeout(r),e),e=>{throw clearTimeout(r),e})}class tO{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>tC(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(r=>r.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}let tL={disabled:!1,minimumSeverity:eY.SeverityNumber.UNSPECIFIED,traceBased:!1},tM=()=>({...tL});class tR{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,r,i,s){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new tO(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new tA,this._loggerConfigurator=s??tM}getLoggerConfig(e){let t=`${e.name}@${e.version||""}:${e.schemaUrl||""}`,r=this._loggerConfigs.get(t);return r||(r=this._loggerConfigurator(e),this._loggerConfigs.set(t,r)),r}}class tP{_shutdownOnce;_sharedState;constructor(e={}){const t={resource:e.resource??function(){var e;return e={[eU]:function(){if(void 0===r)try{let e=globalThis.process.argv0;r=e?`unknown_service:${e}`:"unknown_service"}catch{r="unknown_service"}return r}(),[eI]:eH[eI],[eB]:eH[eB],[eD]:eH[eD]},eK.FromAttributeList(Object.entries(e),void 0)}(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??tM,processors:e.processors??[]};this._sharedState=new tR(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator),this._shutdownOnce=new eJ(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return eR.warn("A shutdown LoggerProvider cannot provide a Logger"),ez.NOOP_LOGGER;e||eR.warn("Logger requested without instrumentation scope name.");let i=e||"unknown",s=`${i}@${t||""}:${r?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new tT({name:i,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(eR.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(eR.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}function tN(e){try{var t;eR.error((t=e,"string"==typeof t?t:JSON.stringify(function(e){let t={},r=e;for(;null!==r;
1)Object.getOwnPropertyNames(r).forEach(e=>{if(t[e])return;let i=r[e];i&&(t[e]=String(i))}),r=Object.getPrototypeOf(r);return t}(t))))}catch{}}(a=P||(P={}))[a.SUCCESS=0]="SUCCESS",a[a.FAILED=1]="FAILED";let tU=eq("OpenTelemetry SDK Context Key SUPPRESS_TRACING");class tI{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new eJ(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(eR.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let r=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<i;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return(this._clearTimer(),0===this._finishedLogRecords.length)?Promise.resolve():tC(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis)}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,tN(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer&&this._timer.unref())}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let t=()=>{var t,r;return(t=this._exporter,r=e,new Promise(e=>{e5.with(e5.active().setValue(tU,!0),()=>{t.export(r,e)})})).then(e=>{e.code!==P.SUCCESS&&tN(e.error??Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(tN)},r=[];for(let t=0;t<e.length;t++){let i=e[t].resource;i.asyncAttributesPending&&"function"==typeof i.waitForAsyncAttributes&&r.push(i.waitForAsyncAttributes())}return 0===r.length?t():Promise.all(r).then(t,tN)}}class tk extends tI{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){"u">typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&"u">typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}}class tB{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}function tD(e,t){let r={attributes:tj(e.attributes,t),droppedAttributesCount:0},i=e.schemaUrl;return i&&""!==i&&(r.schemaUrl=i),r}function tF(e){return{name:e.name,version:e.version}}function tj(e,t){return Object.keys(e).map(r=>tG(r,e[r],t))}function tG(e,t,r){return{key:e,value:t$(t,r)}}function t$(e,t){let r=typeof e;if("string"===r)return{stringValue:e};if("number"===r)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if("boolean"===r)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let r=Array(e.length);for(let i=0;i<e.length;i++)r[i]=t$(e[i],t);return{arrayValue:{values:r}}}if("object"===r&&null!=e){let r=Object.keys(e),i=Array(r.length);for(let s=0;s<r.length;s++)i[s]={key:r[s],value:t$(e[r[s]],t)};return{kvlistValue:{values:i}}}return{}}var tV=e.i(467034);function tz(e){return e}let tH={encodeHrTime:"u">typeof BigInt?function(e){let t;return(t=BigInt(1e9),BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))).toString()}:function(e){return 1e9*e[0]+e[1]},encodeSpanContext:tz,encodeOptionalSpanContext:tz,encodeUint8Array:e=>{if(void 0!==tV.Buffer)return tV.Buffer.from(e).toString("base64");let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}}
1,tW={serializeRequest:e=>{var t,r;let i={resourceLogs:(t=e,r=tH,Array.from(function(e){let t=new Map;for(let r of e){let{resource:e,instrumentationScope:{name:i,version:s="",schemaUrl:n=""}}=r,a=t.get(e);a||(a=new Map,t.set(e,a));let o=`${i}@${s}:${n}`,c=a.get(o);c||(c=[],a.set(o,c)),c.push(r)}return t}(t),([e,t])=>{let i=tD(e,r);return{resource:i,scopeLogs:Array.from(t,([,e])=>({scope:tF(e[0].instrumentationScope),logRecords:e.map(e=>{var t,i,s,n;return t=e,{timeUnixNano:(i=r).encodeHrTime(t.hrTime),observedTimeUnixNano:i.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:t$(t.body,i),eventName:t.eventName,attributes:(s=t.attributes,n=i,Object.keys(s).map(e=>tG(e,s[e],n))),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:i.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:i.encodeOptionalSpanContext(t.spanContext?.spanId)}}),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}}))};return new TextEncoder().encode(JSON.stringify(i))},deserializeResponse:e=>0===e.length?{}:JSON.parse(new TextDecoder().decode(e))};class tK{_transport;constructor(e){this._transport=e}retry(e,t,r){return new Promise((i,s)=>{setTimeout(()=>{this._transport.send(e,t).then(i,s)},r)})}async send(e,t){let r=5,i=1e3,s=Date.now()+t,n=await this._transport.send(e,t);for(;"retryable"===n.status&&r>0;){r--;let t=Math.max(Math.min(i*(1+(.4*Math.random()-.2)),5e3),0);i*=1.5;let a=n.retryInMillis??t,o=s-Date.now();if(a>o)return eR.info(`Export retry time ${Math.round(a)}ms exceeds remaining timeout ${Math.round(o)}ms, not retrying further.`),n;eR.verbose(`Scheduling export retry in ${Math.round(a)}ms`),n=await this.retry(e,o,a)}return"success"===n.status?eR.verbose(`Export succeeded after ${5-r} retry attempts.`):"retryable"===n.status?eR.info("Export failed after maximum retry attempts (5)."):eR.info(`Export failed with non-retryable error: ${n.error}`),n}shutdown(){return this._transport.shutdown()}}function tX(e){return new tK(e.transport)}class tQ{_params;constructor(e){this._params=e}async send(e){let t=(await this._params.headers())["Content-Type"];return new Promise(r=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:t}))?(eR.debug("SendBeacon success"),r({status:"success"})):r({status:"failure",error:Error("SendBeacon failed")})})}shutdown(){}}class tJ{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error("Concurrency Limit reached");this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}class tY extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}class tq{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,r,i,s){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=i,this._timeout=s,this._diagLogger=eR.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,t){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit())return void t({code:P.FAILED,error:Error("Concurrent export limit reached")});let r=this._serializer.serializeRequest(e);null==r?t({code:P.FAILED,error:Error("Nothing to send")}):this._promiseQueue.pushPromise(this._transport.send(r,this._timeout).then(e=>{if("success"===e.status){if(null!=e.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",t,e.data)}t({code:P.SUCCESS});return}"failure"===e.status&&e.error?t({code:P.FAILED,error:e.error}):"retryable"===e.status?t({code:P.FAILED,error:e.error??new tY("Export failed with retryable status")}):t({code:P.FAILED,error:new tY("Export failed with unknown error")})},e=>t({code:P.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function tZ(e,t,r){var i,s;return i={transport:r,serializer:t,promiseHandler:new tJ(e.concurrencyLimit)},s={timeout:e.timeoutMillis},new tq(i.transport,i.serializer,{handleResponse(e){null!=e&&Object.prototype.hasOwnProperty.call(e,"partialSuccess")&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&eR.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}},i.promiseHandler,s.timeout)}class t0{_parameters;constructor(e){this._parameters=e}async send(e,t){var r,i;let s=new AbortController,n=setTimeout(()=>s.abort(),t),a=globalThis.fetch;"function"==typeof a.__original&&(a=a.__original);try{let t=!!globalThis.location,i=new URL(this._parameters.url),n=await a(i.href,{method:"POST",headers:await this._parameters.headers(),body:e,signal:s.signal,keepalive:t,mode:t?globalThis.location?.origin===i.origin?"same-origin":"cors":"no-cors"});if(n.status>=200&&n.status<=299)return eR.debug("response success"),{status:"success"};if(r=n.status,429===r||502===r||503===r||504===r){let e=n.headers.get("Retry-After"),t=function(e){if(null==e)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?1e3*t:-1;let r=new Date(e).getTime()-Date.now();return r>=0?r:0}(e);return{status:"retryable",retryInMillis:t}}return{status:"failure",error:Error("Fetch request failed with non-retryable status")}}catch(e){if((i=e)instanceof TypeError&&!i.cause)return{status:"retryable",error:Error("Fetch request encountered a network error",{cause:e})};return{status:"failure",error:Error("Fetch request errored",{cause:e})}}finally{clearTimeout(n)}}shutdown(){}}function t1(e,t){return tZ(e,t,tX({transport:new t0(e)}))}function t2(e,t){return tZ(e,t,tX({transport:new tQ({url:e.url,headers:e.headers})}))}
1function t4(e,t,r,i){var s,n,a,o,c,l;return(e.headers||"function"!=typeof navigator.sendBeacon?t1:t2)((s={url:e.url,timeoutMillis:e.timeoutMillis,headers:function(e){if("function"==typeof e.headers)return e.headers;var t=e.headers;return null!=t?async()=>t:void 0}(e),concurrencyLimit:e.concurrencyLimit},{...(n={},a={timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>i,url:"http://localhost:4318/"+r},{timeoutMillis:function(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}(s.timeoutMillis??n.timeoutMillis??a.timeoutMillis),concurrencyLimit:s.concurrencyLimit??n.concurrencyLimit??a.concurrencyLimit,compression:s.compression??n.compression??a.compression}),headers:(o=s.headers,c=n.headers,l=a.headers,async()=>{var e;let t,r={...await l()},i={};return null!=c&&Object.assign(i,await c()),null!=o&&Object.assign(i,(e=await o(),t={},Object.entries(e??{}).forEach(([e,r])=>{void 0!==r?t[e]=String(r):eR.warn(`Header "${e}" has invalid value (${r}) and will be ignored`)}),t)),Object.assign(i,r)}),url:function(e){if(null!=e)try{let t=globalThis.location?.href;return new URL(e,t).href}
1catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}(s.url)??n.url??a.url}),t)}class t5 extends tB{constructor(e={}){super(t4(e,tW,"v1/logs",{"Content-Type":"application/json"}))}}function t3(e){let t=Object.keys(e);return 0===t.length?"":JSON.stringify((t=t.sort()).map(t=>[t,e[t]]))}class t6 extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t6.prototype)}}function t8(e,t){let r;return Promise.race([e,new Promise(function(e,i){r=setTimeout(function(){i(new t6("Operation timed out."))},t)})]).then(e=>(clearTimeout(r),e),e=>{throw clearTimeout(r),e})}class t7{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(r=>this._matchInstrument(r.instrumentSelector,e)&&this._matchMeter(r.meterSelector,t))}_matchInstrument(e,t){return(void 0===e.getType()||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(void 0===t.version||e.getVersionFilter().match(t.version))&&(void 0===t.schemaUrl||e.getSchemaUrlFilter().match(t.schemaUrl))}}function t9(e,t,r){return re.test(e)||eR.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:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??N.DOUBLE,advice:r?.advice??{}}}(o=N||(N={}))[o.INT=0]="INT",o[o.DOUBLE=1]="DOUBLE";let re=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function rt(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}function rr(e){return 1e6*e[0]+e[1]/1e3}class ri{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},r=e5.active()){"number"!=typeof e?eR.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`):(this._descriptor.valueType!==N.INT||Number.isInteger(e)||(eR.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),Number.isInteger(e=Math.trunc(e))))&&this._writableMetricStorage.record(e,t,r,rt(Date.now()))}}class rs extends ri{add(e,t,r){this._record(e,t,r)}}class rn extends ri{add(e,t,r){e<0?eR.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`):this._record(e,t,r)}}class ra extends ri{record(e,t,r){this._record(e,t,r)}}class ro extends ri{record(e,t,r){e<0?eR.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`):this._record(e,t,r)}}class rc{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,r){this._descriptor=e,this._metricStorages=t,this._observableRegistry=r}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}}class rl extends rc{}class ru extends rc{}class rh extends rc{}function rd(e){return e instanceof rc}(c=U||(U={})).COUNTER="COUNTER",c.GAUGE="GAUGE",c.HISTOGRAM="HISTOGRAM",c.UP_DOWN_COUNTER="UP_DOWN_COUNTER",c.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",c.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",c.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER",(l=I||(I={}))[l.HISTOGRAM=0]="HISTOGRAM",l[l.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",l[l.GAUGE=2]="GAUGE",l[l.SUM=3]="SUM";class rm{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,t){let r=t9(e,U.GAUGE,t);return new ra(this._meterSharedState.registerMetricStorage(r),r)}createHistogram(e,t){let r=t9(e,U.HISTOGRAM,t);return new ro(this._meterSharedState.registerMetricStorage(r),r)}createCounter(e,t){let r=t9(e,U.COUNTER,t);return new rn(this._meterSharedState.registerMetricStorage(r),r)}createUpDownCounter(e,t){let r=t9(e,U.UP_DOWN_COUNTER,t);return new rs(this._meterSharedState.registerMetricStorage(r),r)}createObservableGauge(e,t){let r=t9(e,U.OBSERVABLE_GAUGE,t),i=this._meterSharedState.registerAsyncMetricStorage(r);return new ru(r,i,this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let r=t9(e,U.OBSERVABLE_COUNTER,t),i=this._meterSharedState.registerAsyncMetricStorage(r);return new rl(r,i,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let r=t9(e,U.OBSERVABLE_UP_DOWN_COUNTER,t),i=this._meterSharedState.registerAsyncMetricStorage(r);return new rh(r,i,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}class rp{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=t9(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}class r_{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let r=this._hash(e);if(this._valueMap.has(r))return this._valueMap.get(r);let i=t();return this._keyMap.has(r)||this._keyMap.set(r,e),this._valueMap.set(r,i),i}set(e,t,r){r??=this._hash(e),this._keyMap.has(r)||this._keyMap.set(r,e),this._valueMap.set(r,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;!0!==t.done;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;!0!==t.done;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}}class rg extends r_{constructor(){super(t3)}}class rf{_activeCollectionStorage=new rg;_cumulativeMemoStorage=new rg;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=t3(this._overflowAttributes)}record(e,t,r,i){let s=this._activeCollectionStorage.get(t);if(!s){if(this._activeCollectionStorage.size>=this._cardinalityLimit){let t=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i));t?.record(e);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,s)}s?.record(e)}batchCumulate(e,t){for(let[r,i,s]of e.entries()){let e=r,n=s,a=this._aggregator.createAccumulation(t);a?.record(i);let o=a;if(this._cumulativeMemoStorage.has(e,n)){let t=this._cumulativeMemoStorage.get(e,n);o=this._aggregator.diff(t,a)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,n=this._overflowHashCode,this._cumulativeMemoStorage.has(e,n))){let t=this._cumulativeMemoStorage.get(e,n);o=this._aggregator.diff(t,a)}if(this._activeCollectionStorage.has(e,n)){let t=this._activeCollectionStorage.get(e,n);o=this._aggregator.merge(t,o)}this._cumulativeMemoStorage.set(e,a,n),this._activeCollectionStorage.set(e,o,n)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new rg,e}}(u=k||(k={}))[u.DELTA=0]="DELTA",u[u.CUMULATIVE=1]="CUMULATIVE";class rb{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;
1constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(e,t,r,i){let s;this._stashAccumulations(r);let n=this._getMergedUnreportedAccumulations(e),a=n;if(this._reportHistory.has(e)){let t=this._reportHistory.get(e),r=t.collectionTime;a=(s=t.aggregationTemporality)===k.CUMULATIVE?rb.merge(t.accumulations,n,this._aggregator):rb.calibrateStartTime(t.accumulations,n,r)}else s=e.selectAggregationTemporality(t.type);this._reportHistory.set(e,{accumulations:a,collectionTime:i,aggregationTemporality:s});let o=Array.from(a.entries());if(0!==o.length)return this._aggregator.toMetricData(t,s,o,i)}_stashAccumulations(e){for(let t of this._unreportedAccumulations.keys()){let r=this._unreportedAccumulations.get(t);void 0===r&&(r=[],this._unreportedAccumulations.set(t,r)),r.push(e)}}_getMergedUnreportedAccumulations(e){let t=new rg,r=this._unreportedAccumulations.get(e);if(this._unreportedAccumulations.set(e,[]),void 0===r)return t;for(let e of r)t=rb.merge(t,e,this._aggregator);return t}static merge(e,t,r){let i=t.entries(),s=i.next();for(;!0!==s.done;){let[t,n,a]=s.value;if(e.has(t,a)){let i=e.get(t,a),s=r.merge(i,n);e.set(t,s,a)}else e.set(t,n,a);s=i.next()}return e}static calibrateStartTime(e,t,r){for(let[i,s]of e.keys()){let e=t.get(i,s);e?.setStartTime(r)}return t}}class rS extends rp{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,r,i,s){super(e),this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new rf(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new rb(t,i),this._attributesProcessor=r}record(e,t){let r=new rg;for(let[t,i]of e.entries())r.set(this._attributesProcessor.process(t),i);this._deltaMetricStorage.batchCumulate(r,t)}collect(e,t){let r=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,r,t)}}function rw(e,t){let r="";return e.unit!==t.unit&&(r+=`	- Unit '${e.unit}' does not match '${t.unit}'
2`),e.type!==t.type&&(r+=`	- Type '${e.type}' does not match '${t.type}'
3`),e.valueType!==t.valueType&&(r+=`	- Value Type '${e.valueType}' does not match '${t.valueType}'
4`),e.description!==t.description&&(r+=`	- Description '${e.description}' does not match '${t.description}'
5`),r}function ry(e,t){if(e.valueType!==t.valueType)return`	- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`;if(e.unit!==t.unit)return`	- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`;if(e.type!==t.type){let r;return r=JSON.stringify({name:t.name,type:t.type,unit:t.unit}),`	- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}if(e.description!==t.description){let r;return r=JSON.stringify({name:t.name,type:t.type,unit:t.unit}),`	- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
6    	- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
7    	- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}return""}class rv{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new rv}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let r=this._perCollectorRegistry.get(e);if(null!=r)for(let e of r.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let r=this._perCollectorRegistry.get(e);null==r&&(r=new Map,this._perCollectorRegistry.set(e,r)),this._registerStorage(t,r)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return void 0===t?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let r=this._perCollectorRegistry.get(e);if(void 0===r)return null;let i=r.get(t.name);return void 0===i?null:this._findOrUpdateCompatibleStorage(t,i)}_registerStorage(e,t){let r=e.getInstrumentDescriptor(),i=t.get(r.name);void 0===i?t.set(r.name,[e]):i.push(e)}_findOrUpdateCompatibleStorage(e,t){let r=null;for(let i of t){let t=i.getInstrumentDescriptor();!function(e,t){var r,i;return r=e.name,i=t.name,r.toLowerCase()===i.toLowerCase()&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}(t,e)?eR.warn("A view or instrument with the name ",e.name," has already been registered and is incompatible with another registered view.\n","Details:\n",rw(t,e),"To resolve the conflict:\n",ry(t,e)):(t.description!==e.description&&(e.description.length>t.description.length&&i.updateDescription(e.description),eR.warn("A view or instrument with the name ",e.name," has already been registered, but has a different description and is incompatible with another registered view.\n","Details:\n",rw(t,e),"The longer description will be used.\nTo resolve the conflict:",ry(t,e))),r
7=i)}return r}}class rE{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,r,i){let s=this._backingStorages;for(let n=0;n<s.length;n++)s[n].record(e,t,r,i)}}class rT{_buffer=new rg;_instrumentName;_valueType;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){"number"!=typeof e?eR.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`):(this._valueType!==N.INT||Number.isInteger(e)||(eR.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),Number.isInteger(e=Math.trunc(e))))&&this._buffer.set(t,e)}}class rA{_buffer=new Map;observe(e,t,r={}){if(!rd(e))return;let i=this._buffer.get(e);(null==i&&(i=new rg,this._buffer.set(e,i)),"number"!=typeof t)?eR.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`):(e._descriptor.valueType!==N.INT||Number.isInteger(t)||(eR.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),Number.isInteger(t=Math.trunc(t))))&&i.set(r,t)}}class rx{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let r=this._findCallback(e,t);r<0||this._callbacks.splice(r,1)}addBatchCallback(e,t){let r=new Set(t.filter(rd));0===r.size?eR.error("BatchObservableCallback is not associated with valid instruments",t):this._findBatchCallback(e,r)>=0||this._batchCallbacks.push({callback:e,instruments:r})}removeBatchCallback(e,t){let r=new Set(t.filter(rd)),i=this._findBatchCallback(e,r);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let r=this._observeCallbacks(e,t),i=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...r,...i])).filter(e=>"rejected"===e.status).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:r,instrument:i})=>{let s=new rT(i._descriptor.name,i._descriptor.valueType),n=Promise.resolve(r(s));
7null!=t&&(n=t8(n,t)),await n,i._metricStorages.forEach(t=>{t.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:r,instruments:i})=>{let s=new rA,n=Promise.resolve(r(s));null!=t&&(n=t8(n,t)),await n,i.forEach(t=>{let r=s._buffer.get(t);null!=r&&t._metricStorages.forEach(t=>{t.record(r,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(r=>r.callback===e&&r.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(r=>r.callback===e&&function(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}(r.instruments,t))}}class rC extends rp{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,r,i,s){super(e),this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new rf(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new rb(t,i),this._attributesProcessor=r}record(e,t,r,i){t=this._attributesProcessor.process(t,r),this._deltaMetricStorage.record(e,t,r,i)}collect(e,t){let r=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,r,t)}}class rO{_processors;constructor(e){this._processors=e}process(e,t){let r=e;for(let e of this._processors)r=e.process(r,t);return r}}let rL=new class{process(e,t){return e}};class rM{metricStorageRegistry=new rv;observableRegistry=new rx;meter;_meterProviderSharedState;_instrumentationScope;constructor(e,t){this.meter=new rm(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,rC);return 1===t.length?t[0]:new rE(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,rS)}async collect(e,t,r){let i=await this.observableRegistry.observe(t,r?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(0===s.length)return null;let n=[];return(s.forEach(r=>{let i=r.collect(e,t);null!=i&&n.push(i)}),0===n.length)?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:n},errors:i}}_registerMetricStorage(e,t){let r=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(r=>{let i={name:r.name??e.name,description:r.description??e.description,type:e.type,unit:e.unit,valueType:e.valueType,advice:e.advice},s=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(null!=s)return s;let n=r.aggregation.createAggregator(i),a=new t(i,n,r.attributesProcessor,this._meterProviderSharedState.metricCollectors,r.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(0===r.length){let i=this._meterProviderSharedState.selectAggregations(e.type).map(([r,i])=>{let s=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(r,e);if(null!=s)return s;let n=i.createAggregator(e),a=r.selectCardinalityLimit(e.type),o=new t(e,n,rL,[r],a);return this.metricStorageRegistry.registerForCollector(r,o),o});r=r.concat(i)}return r}}(h=B||(B={}))[h.DROP=0]="DROP",h[h.SUM=1]="SUM",h[h.LAST_VALUE=2]="LAST_VALUE",h[h.HISTOGRAM=3]="HISTOGRAM",h[h.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM";class rR{startTime;monotonic;_current;reset;constructor(e,t,r=0,i=!1){this.startTime=e,this.monotonic=t,this._current=r,this.reset=i}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}}class rP{kind=B.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new rR(e,this.monotonic)}merge(e,t){let r=e.toPointValue(),i=t.toPointValue();return t.reset?new rR(t.startTime,this.monotonic,i,t.reset):new rR(e.startTime,this.monotonic,r+i)}diff(e,t){let r=e.toPointValue(),i=t.toPointValue();return this.monotonic&&r>i?new rR(t.startTime,this.monotonic,i,!0):new rR(t.startTime,this.monotonic,i-r)}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:I.SUM,dataPoints:r.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:i,value:t.toPointValue()})),isMonotonic:this.monotonic}}}class rN{kind=B.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,r,i){}}class rU{startTime;_current;sampleTime;constructor(e,t=0,r=[0,0]){this.startTime=e,this._current=t,this.sampleTime=r}
7record(e){this._current=e,this.sampleTime=rt(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}}class rI{kind=B.LAST_VALUE;createAccumulation(e){return new rU(e)}merge(e,t){let r=rr(t.sampleTime)>=rr(e.sampleTime)?t:e;return new rU(e.startTime,r.toPointValue(),r.sampleTime)}diff(e,t){let r=rr(t.sampleTime)>=rr(e.sampleTime)?t:e;return new rU(t.startTime,r.toPointValue(),r.sampleTime)}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:I.GAUGE,dataPoints:r.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:i,value:t.toPointValue()}))}}}class rk{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,r=!0,i=function(e){let 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}}(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=r,this._current=i}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=function(e,t){let r=0,i=e.length-1,s=e.length;for(;i>=r;){let n=r+Math.trunc((i-r)/2);e[n]<t?r=n+1:(s=n,i=n-1)}return s}(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}}class rB{kind=B.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new rk(e,this._boundaries,this._recordMinMax)}merge(e,t){let r=e.toPointValue(),i=t.toPointValue(),s=r.buckets.counts,n=i.buckets.counts,a=Array(s.length);for(let e=0;e<s.length;e++)a[e]=s[e]+n[e];let o=1/0,c=-1/0;return this._recordMinMax&&(r.hasMinMax&&i.hasMinMax?(o=Math.min(r.min,i.min),c=Math.max(r.max,i.max)):r.hasMinMax?(o=r.min,c=r.max):i.hasMinMax&&(o=i.min,c=i.max)),new rk(e.startTime,r.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:r.buckets.boundaries,counts:a},count:r.count+i.count,sum:r.sum+i.sum,hasMinMax:this._recordMinMax&&(r.hasMinMax||i.hasMinMax),min:o,max:c})}diff(e,t){let r=e.toPointValue(),i=t.toPointValue(),s=r.buckets.counts,n=i.buckets.counts,a=Array(s.length);for(let e=0;e<s.length;e++)a[e]=n[e]-s[e];return new rk(t.startTime,r.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:r.buckets.boundaries,counts:a},count:i.count-r.count,sum:i.sum-r.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:I.HISTOGRAM,dataPoints:r.map(([t,r])=>{let s=r.toPointValue(),n=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:r.startTime,endTime:i,value:{min:s.hasMinMax?s.min:void 0,max:s.hasMinMax?s.max:void 0,sum:n?void 0:s.sum,buckets:s.buckets,count:s.count}}})}}}class rD{backing;indexBase;indexStart;indexEnd;constructor(e=new rF,t=0,r=0,i=0){this.backing=e,this.indexBase=t,this.indexStart=r,this.indexEnd=i}get offset(){return this.indexStart}get length(){return 0===this.backing.length||this.indexEnd===this.indexStart&&0===this.at(0)?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(0!==this.at(e)){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(0!==this.at(e)){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,r=1<<e,i=0,s=0;for(let e=this.indexStart;e<=this.indexEnd;){let n=e%r;n<0&&(n+=r);for(let a=n;a<r&&i<t;a++)this._relocateBucket(s,i),i++,e++;s++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new rD(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;0!==e&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}}class rF{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,r){let i=Array(e).fill(0);i.splice(r,this._counts.length-t,...this._counts.slice(t)),i.splice(0,t,...this._counts.slice(0,t)),this._counts=i}reverse(e,t){let r=Math.floor((e+t)/2)-e;for(let i=0;i<r;i++){let r=this._counts[e+i];this._counts[e+i]=this._counts[t-i-1],this._counts[t-i-1]=r}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}
7decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new rF([...this._counts])}}function rj(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((0x7ff00000&t.getUint32(0))>>20)-1023}function rG(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),(1048575&t.getUint32(0))*0x100000000+t.getUint32(4)}function r$(e,t){return 0===e||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}class rV extends Error{}class rz{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<22250738585072014e-324?this._minNormalLowerBoundaryIndex():rj(e)+this._rightShift(rG(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new rV(`underflow: ${e} is < minimum lower boundary: ${t}`);let r=this._maxNormalLowerBoundaryIndex();if(e>r)throw new rV(`overflow: ${e} is > maximum lower boundary: ${r}`);return r$(1,e<<this._shift)}get scale(){return 0===this._shift?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=-1022>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}}class rH{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=r$(Math.LOG2E,e),this._inverseFactor=r$(Math.LN2,-e)}mapToIndex(e){if(e<=22250738585072014e-324)return this._minNormalLowerBoundaryIndex()-1;if(0===rG(e))return(rj(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),r=this._maxNormalLowerBoundaryIndex();return t>=r?r:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new rV(`overflow: ${e} is > maximum lower boundary: ${t}`)}let r=this._minNormalLowerBoundaryIndex();if(e<=r){if(e===r)return 22250738585072014e-324;if(e===r-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new rV(`overflow: ${e} is < minimum lower boundary: ${r}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return -1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}let rW=Array.from({length:31},(e,t)=>t>10?new rH(t-10):new rz(t-10));function rK(e){if(e>20||e<-10)throw new rV(`expected scale >= -10 && <= 20, got: ${e}`);return rW[e+10]}class rX{static combine(e,t){return new rX(Math.min(e.low,t.low),Math.max(e.high,t.high))}low;high;constructor(e,t){this.low=e,this.high=t}}class rQ{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=160,r=!0,i=0,s=0,n=0,a=1/0,o=-1/0,c=new rD,l=new rD,u=rK(20)){this.startTime=e,this._maxSize=t,this._recordMinMax=r,this._sum=i,this._count=s,this._zeroCount=n,this._min=a,this._max=o,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<2&&(eR.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
8                changing to the minimum size of: 2`),this._maxSize=2)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}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(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,0===e){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){0===this._count?(this._min=e.min,this._max=e.max):0!==e.count&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new rQ(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(e,t,r){let i=this._mapping.mapToIndex(t),s=!1,n=0,a=0;if(0===e.length?(e.indexStart=i,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):i<e.indexStart&&e.indexEnd-i>=this._maxSize?(s=!0,a=i,n=e.indexEnd):i>e.indexEnd&&i-e.indexStart>=this._maxSize&&(s=!0,a=e.indexStart,n=i),s){let e=this._changeScale(n,a);this._downscale(e),i=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,i,r)}_incrementIndexBy(e,t,r){if(0===r)return;if(0===e.length&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let r=e.indexEnd-t;r>=e.backing.length&&this._grow(e,r+1),e.indexStart=t}else if(t>e.indexEnd){let r=t-e.indexStart;r>=e.backing.length&&this._grow(e,r+1),e.indexEnd=t}let i=t-e.indexBase;i<0&&(i+=e.backing.length),e.incrementBucket(i,r)}_grow(e,t){var r;let i=e.backing.length,s=e.indexBase-e.indexStart,n=(r=t,r--,r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,++r);n>this._maxSize&&(n=this._maxSize);let a=n-s;e.backing.growTo(n,i-s,a)}_changeScale(e,t){let r=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,r++;return r}_downscale(e){if(0===e)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=rK(t)}_minScale(e){let t=Math.min(this.scale,e.scale),r=rX.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),i=rX.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(r.high,r.low),t-this._changeScale(i.high,i.low))}_highLowAtScale(e,t,r){if(0===e.length)return new rX(0,-1);let i=t-r;return new rX(e.indexStart>>i,e.indexEnd>>i)}_mergeBuckets(e,t,r,i){let s=r.offset,n=t.scale-i;for(let t=0;t<r.length;t++)this._incrementIndexBy(e,s+t>>n,r.at(t))}_diffBuckets(e,t,r,i){let s=r.offset,n=t.scale-i;for(let t=0;t<r.length;t++){let i=(s+t>>n)-e.indexBase;i<0&&(i+=e.backing.length),e.decrementBucket(i,r.at(t))}e.trim()}}class rJ{kind=B.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new rQ(e,this._maxSize,this._recordMinMax)}merge(e,t){let r=t.clone();return r.merge(e),r}diff(e,t){let r=t.clone();return r.diff(e),r}toMetricData(e,t,r,i){return{descriptor:e,aggregationTemporality:t,dataPointType:I.EXPONENTIAL_HISTOGRAM,dataPoints:r.map(([t,r])=>{let s=r.toPointValue(),n=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:r.startTime,endTime:i,value:{min:s.hasMinMax?s.min:void 0,max:s.hasMinMax?s.max:void 0,sum:n?void 0:s.sum,positive:{offset:s.positive.offset,bucketCounts:s.positive.bu
8cketCounts},negative:{offset:s.negative.offset,bucketCounts:s.negative.bucketCounts},count:s.count,scale:s.scale,zeroCount:s.zeroCount}}})}}}class rY{static DEFAULT_INSTANCE=new rN;createAggregator(e){return rY.DEFAULT_INSTANCE}}class rq{static MONOTONIC_INSTANCE=new rP(!0);static NON_MONOTONIC_INSTANCE=new rP(!1);createAggregator(e){switch(e.type){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.HISTOGRAM:return rq.MONOTONIC_INSTANCE;default:return rq.NON_MONOTONIC_INSTANCE}}}class rZ{static DEFAULT_INSTANCE=new rI;createAggregator(e){return rZ.DEFAULT_INSTANCE}}class r0{static DEFAULT_INSTANCE=new rB([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(e){return r0.DEFAULT_INSTANCE}}class r1{_boundaries;_recordMinMax;constructor(e,t=!0){if(null==e)throw Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");const r=(e=(e=e.concat()).sort((e,t)=>e-t)).lastIndexOf(-1/0);let i=e.indexOf(1/0);-1===i&&(i=void 0),this._boundaries=e.slice(r+1,i),this._recordMinMax=t}createAggregator(e){return new rB(this._boundaries,this._recordMinMax)}}class r2{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new rJ(this._maxSize,this._recordMinMax)}}let r4=new rY,r5=new rq,r3=new rZ,r6=new r0;new r2;let r8=new class{_resolve(e){switch(e.type){case U.COUNTER:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return r5;case U.GAUGE:case U.OBSERVABLE_GAUGE:return r3;case U.HISTOGRAM:if(e.advice.explicitBucketBoundaries)return new r1(e.advice.explicitBucketBoundaries);return r6}return eR.warn(`Unable to recognize instrument type: ${e.type}`),r4}createAggregator(e){return this._resolve(e).createAggregator(e)}};function r7(e){switch(e.type){case D.DEFAULT:return r8;case D.DROP:return r4;case D.SUM:return r5;case D.LAST_VALUE:return r3;case D.EXPONENTIAL_HISTOGRAM:return new r2(e.options?.maxSize,e.options?.recordMinMax);case D.EXPLICIT_BUCKET_HISTOGRAM:if(null==e.options)return r6;return new r1(e.options?.boundaries,e.options?.recordMinMax);default:throw Error("Unsupported Aggregation")}}(d=D||(D={}))[d.DEFAULT=0]="DEFAULT",d[d.DROP=1]="DROP",d[d.SUM=2]="SUM",d[d.LAST_VALUE=3]="LAST_VALUE",d[d.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",d[d.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM";class r9{viewRegistry=new t7;metricCollectors=[];meterSharedStates=new Map;resource;constructor(e){this.resource=e}getMeterSharedState(e){let t=`${e.name}:${e.version??""}:${e.schemaUrl??""}`,r=this.meterSharedStates.get(t);return null==r&&(r=new rM(this,e),this.meterSharedStates.set(t,r)),r}selectAggregations(e){let t=[];for(let r of this.metricCollectors)t.push([r,r7(r.selectAggregation(e))]);return t}}class ie{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=rt(Date.now()),r=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async s=>{let n=await s.collect(this,t,e);n?.scopeMetrics!=null&&r.push(n.scopeMetrics),n?.errors!=null&&i.push(...n.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:r},errors:i}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}}let it=/[\^$\\.+?()[\]{}|]/g;class ir{_matchAll;_regexp;constructor(e){"*"===e?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(ir.escapePattern(e)))}match(e){return!!this._matchAll||this._regexp.test(e)}static escapePattern(e){return`^${e.replace(it,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}}class ii{_matchAll;_pattern;constructor(e){this._matchAll=void 0===e,this._pattern=e}match(e){return!!this._matchAll||e===this._pattern}}class is{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new ir(e?.name??"*"),this._type=e?.type,this._unitFilter=new ii(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}
8getUnitFilter(){return this._unitFilter}}class ia{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new ii(e?.name),this._versionFilter=new ii(e?.version),this._schemaUrlFilter=new ii(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}class io{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){!function(e){if(null==e.instrumentName&&null==e.instrumentType&&null==e.instrumentUnit&&null==e.meterName&&null==e.meterVersion&&null==e.meterSchemaUrl)throw Error("Cannot create view with no selector arguments supplied");if(null!=e.name&&(e?.instrumentName==null||ir.hasWildcard(e.instrumentName)))throw Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}(e),null!=e.attributesProcessors?this.attributesProcessor=function(e){return new rO(e)}(e.attributesProcessors):this.attributesProcessor=rL,this.name=e.name,this.description=e.description,this.aggregation=r7(e.aggregation??{type:D.DEFAULT}),this.instrumentSelector=new is({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new ia({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}}class ic{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new r9(e?.resource??e$({[eU]:function(){if(void 0===t)try{let e=globalThis.process.argv0;t=e?`unknown_service:${e}`:"unknown_service"}catch{t="unknown_service"}return t}(),[eI]:eF[eI],[eB]:eF[eB],[eD]:eF[eD]})),e?.views!=null&&e.views.length>0)for(const t of e.views)this._sharedState.viewRegistry.addView(new io(t));if(e?.readers!=null&&e.readers.length>0)for(const t of e.readers){const e=new ie(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,t="",r={}){return this._shutdown?(eR.warn("A shutdown MeterProvider cannot provide a Meter"),ea):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:r.schemaUrl}).meter}async shutdown(e){this._shutdown?eR.warn("shutdown may only be called once per MeterProvider"):(this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e))))}async forceFlush(e){this._shutdown?eR.warn("invalid attempt to force flush after MeterProvider shutdown"):await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}}let il=eq("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function iu(e){try{var t;eR.error((t=e,"string"==typeof t?t:JSON.stringify(function(e){let t={},r=e;for(;null!==r;)Object.getOwnPropertyNames(r).forEach(e=>{if(t[e])return;let i=r[e];i&&(t[e]=String(i))}),r=Object.getPrototypeOf(r);return t}(t))))}catch{}}(m=F||(F={}))[m.SUCCESS=0]="SUCCESS",m[m.FAILED=1]="FAILED";let ih=e=>({type:D.DEFAULT}),id=e=>k.CUMULATIVE;class im{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(e){this._aggregationSelector=e?.aggregationSelector??ih,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??id,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector}setMetricProducer(e){if(this._sdkMetricProducer)throw Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=e,this.onInitialized()}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(void 0===this._sdkMetricProducer)throw Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw Error("MetricReader is shutdown");let[t,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=t.errors.concat(r.flatMap(e=>e.errors));return{resourceMetrics:{resource:t.resourceMetrics.resource,scopeMetrics:t.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:i}}async shutdown(e){this._shutdown?eR.error("Cannot call shutdown twice."):(e?.timeoutMillis==null?await this.onShutdown():await t8(this.onShutdown(),e.timeoutMillis),this._shutdown=!0)}async forceFlush(e){this._shutdown?eR.warn("Cannot forceFlush on already shutdown MetricReader."):e?.timeoutMillis==null?await this.onForceFlush():await t8(this.onForceFlush(),e.timeoutMillis)}}class ip extends im{_interval;_exporter;_exportInterval;_exportTimeout;constructor(e){const{exporter:t,exportIntervalMillis:r=6e4,metricProducers:i,cardinalityLimits:s}=e;let{exportTimeoutMillis:n=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),metricProducers:i,cardinalitySelector:e=>{let t={default:2e3,...s};switch(e){case U.COUNTER:return t.counter??t.default;case U.GAUGE:return t.gauge??t.default;case U.HISTOGRAM:return t.histogram??t.default;case U.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case U.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case U.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case U.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),r<=0)throw Error("exportIntervalMillis must be greater than 0");if(n<=0)throw Error("exportTimeoutMillis must be greater than 0");if(r<n)if("exportIntervalMillis"in e&&"exportTimeoutMillis"in e)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");else eR.info(`Timeout of ${n} exceeds the interval of ${r}. Clamping timeout to interval duration.`),n=r;this._exportInterval=r,this._exportTimeout=n,this._exporter=t}async _runOnce(){try{await t8(this._doRun(),this._exportTimeout)}catch(e){if(e instanceof t6)return void eR.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);iu(e)}}async _doRun(){var e,t;let{resourceMetrics:r,errors:i}=await this.collect({timeoutMillis:this._exportTimeout});if(i.length>0&&eR.error("PeriodicExportingMetricReader: metrics collection errors",...i),r.resource.asyncAttributesPending)try{await r.resource.waitForAsyncAttributes?.()}catch(e){eR.debug("Error while resolving async portion of resource: ",e),iu(e)}
8if(0===r.scopeMetrics.length)return;let s=await (e=this._exporter,t=r,new Promise(r=>{e5.with(e5.active().setValue(il,!0),()=>{e.export(t,r)})}));if(s.code!==F.SUCCESS)throw Error(`PeriodicExportingMetricReader: metrics export failed (error ${s.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),"number"!=typeof this._interval&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}(p=j||(j={}))[p.DELTA=0]="DELTA",p[p.CUMULATIVE=1]="CUMULATIVE",(_=G||(G={})).COUNTER="COUNTER",_.GAUGE="GAUGE",_.HISTOGRAM="HISTOGRAM",_.UP_DOWN_COUNTER="UP_DOWN_COUNTER",_.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",_.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",_.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER",(g=$||($={}))[g.HISTOGRAM=0]="HISTOGRAM",g[g.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",g[g.GAUGE=2]="GAUGE",g[g.SUM=3]="SUM",(f=V||(V={}))[f.DEFAULT=0]="DEFAULT",f[f.DROP=1]="DROP",f[f.SUM=2]="SUM",f[f.LAST_VALUE=3]="LAST_VALUE",f[f.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",f[f.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM",(b=z||(z={}))[b.DELTA=0]="DELTA",b[b.CUMULATIVE=1]="CUMULATIVE",b[b.LOWMEMORY=2]="LOWMEMORY";let i_=()=>j.CUMULATIVE,ig=e=>{switch(e){case G.COUNTER:case G.OBSERVABLE_COUNTER:case G.GAUGE:case G.HISTOGRAM:case G.OBSERVABLE_GAUGE:return j.DELTA;case G.UP_DOWN_COUNTER:case G.OBSERVABLE_UP_DOWN_COUNTER:return j.CUMULATIVE}},ib=e=>{switch(e){case G.COUNTER:case G.HISTOGRAM:return j.DELTA;case G.GAUGE:case G.UP_DOWN_COUNTER:case G.OBSERVABLE_UP_DOWN_COUNTER:case G.OBSERVABLE_COUNTER:case G.OBSERVABLE_GAUGE:return j.CUMULATIVE}},iS=Object.freeze({type:V.DEFAULT});class iw extends tB{_aggregationTemporalitySelector;_aggregationSelector;constructor(e,t){super(e),this._aggregationSelector=function(e){return e?.aggregationPreference??(()=>iS)}(t),this._aggregationTemporalitySelector=function(e){let t;return null!=e?e===z.DELTA?ig:e===z.LOWMEMORY?ib:i_:"cumulative"===(t=((void 0)??"cumulative").toLowerCase())?i_:"delta"===t?ig:"lowmemory"===t?ib:(eR.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),i_)}(t?.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}}function iy(e,t){return e.dataPoints.map(r=>(function(e,t,r){let i={attributes:tj(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case N.INT:i.asInt=e.value;break;case N.DOUBLE:i.asDouble=e.value}return i})(r,e.descriptor.valueType,t))}(S=H||(H={}))[S.DELTA=0]="DELTA",S[S.CUMULATIVE=1]="CUMULATIVE",(w=W||(W={})).COUNTER="COUNTER",w.GAUGE="GAUGE",w.HISTOGRAM="HISTOGRAM",w.UP_DOWN_COUNTER="UP_DOWN_COUNTER",w.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",w.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",w.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER",(y=K||(K={}))[y.HISTOGRAM=0]="HISTOGRAM",y[y.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",y[y.GAUGE=2]="GAUGE",y[y.SUM=3]="SUM",(v=X||(X={}))[v.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",v[v.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",v[v.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE";let iv={serializeRequest:e=>{let t={resourceMetrics:[e].map(e=>{var t,r;let i;return{resource:i=tD(e.resource,tH),schemaUrl:i.schemaUrl,scopeMetrics:(t=e.scopeMetrics,r=tH,Array.from(t.map(e=>({scope:tF(e.scope),metrics:e.metrics.map(e=>(function(e,t){var r,i,s,n;let a={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},o=function(e){switch(e){case H.DELTA:return X.AGGREGATION_TEMPORALITY_DELTA;case H.CUMULATIVE:return X.AGGREGATION_TEMPORALITY_CUMULATIVE}}(e.aggregationTemporality);switch(e.dataPointType){case K.SUM:a.sum={aggregationTemporality:o,isMonotonic:e.isMonotonic,dataPoints:iy(e,t)};break;case K.GAUGE:a.gauge={dataPoints:iy(e,t)};break;case K.HISTOGRAM:a.histogram={aggregationTemporality:o,dataPoints:(r=e,i=t,r.dataPoints.map(e=>{let t=e.value;return{attributes:tj(e.attributes,i),bucketCounts:t.buckets.counts,explicitBounds:t.buckets.boundaries,count:t.count,sum:t.sum,min:t.min,max:t.max,startTimeUnixNano:i.encodeHrTime(e.startTime),timeUnixNano:i.encodeHrTime(e.endTime)}}))};break;case K.EXPONENTIAL_HISTOGRAM:a.exponentialHistogram={aggregationTemporality:o,dataPoints:(s=e,n=t,s.dataPoints.map(e=>{let t=e.value;return{attributes:tj(e.attributes,n),count:t.count,min:t.min,max:t.max,sum:t.sum,positive:{offset:t.positive.offset,bucketCounts:t.positive.bu
8cketCounts},negative:{offset:t.negative.offset,bucketCounts:t.negative.bucketCounts},scale:t.scale,zeroCount:t.zeroCount,startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)}}))}}return a})(e,r)),schemaUrl:e.scope.schemaUrl}))))}})};return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>0===e.length?{}:JSON.parse(new TextDecoder().decode(e))};class iE extends iw{constructor(e){super(t4(e??{},iv,"v1/metrics",{"Content-Type":"application/json"}),e)}}let iT=Function.prototype.toString,iA=iT.call(Object),ix=Object.getPrototypeOf,iC=Object.prototype,iO=iC.hasOwnProperty,iL=Symbol?Symbol.toStringTag:void 0,iM=iC.toString;function iR(e){var t,r,i;if(null==(t=e)||"object"!=typeof t||"[object Object]"!==(null==(r=e)?void 0===r?"[object Undefined]":"[object Null]":iL&&iL in Object(r)?function(e){let t=iO.call(e,iL),r=e[iL],i=!1;try{e[iL]=void 0,i=!0}catch{}let s=iM.call(e);return i&&(t?e[iL]=r:delete e[iL]),s}(r):(i=r,iM.call(i))))return!1;let s=ix(e);if(null===s)return!0;let n=iO.call(s,"constructor")&&s.constructor;return"function"==typeof n&&n instanceof n&&iT.call(n)===iA}function iP(e){return iU(e)?e.slice():e}function iN(e,t,r){let i=r.get(e[t])||[];for(let r=0,s=i.length;r<s;r++){let s=i[r];if(s.key===t&&s.obj===e)return!0}return!1}function iU(e){return Array.isArray(e)}function iI(e){return"function"==typeof e}function ik(e){return!iB(e)&&!iU(e)&&!iI(e)&&"object"==typeof e}function iB(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}let iD={[eB]:"opentelemetry","process.runtime.name":"browser",[eI]:ek,[eD]:"2.6.1"},iF=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class ij{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){let r=new ij({},t);return r._rawAttributes=iG(e),r._asyncAttributesPending=e.filter(([e,t])=>iF(t)).length>0,r}constructor(e,t){const r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([e,t])=>(iF(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=iG(this._rawAttributes),this._schemaUrl=function(e){if("string"==typeof e||void 0===e)return e;eR.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,iF(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&eR.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,r]of this._rawAttributes){if(iF(r)){eR.debug(`Unsettled resource attribute ${t} skipped`);continue}null!=r&&(e[t]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;let i,s,n;if(null==e)return this;let a=(t=this,r=e,i=t?.schemaUrl,n=void 0===(s=r?.schemaUrl)||""===s,void 0===i||""===i?s:n||i===s?i:void eR.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',i,s));return ij.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],a?{schemaUrl:a}:void 0)}}function iG(e){return e.map(([e,t])=>iF(t)?[e,t.catch(t=>{eR.debug("promise rejection for resource attribute: %s - %s",e,t)})]:[e,t])}function i$(e){let t={};if("object"!=typeof e||null==e)return t;for(let i in e){var r;if(!Object.prototype.hasOwnProperty.call(e,i))continue;if("string"!=typeof(r=i)||""===r){eR.warn(`Invalid attribute key: ${i}`);continue}let s=e[i];if(!iV(s)){eR.warn(`Invalid attribute value set for key: ${i}`);continue}Array.isArray(s)?t[i]=s.slice():t[i]=s}return t}function iV(e){return null==e||(Array.isArray(e)?function(e){let t;for(let r of e){if(null==r)continue;let e=typeof r;if(e!==t){if(!t&&iz(e)){t=e;continue}return!1}}return!0}(e):iz(typeof e))}function iz(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}
8(E=Q||(Q={}))[E.INTERNAL=0]="INTERNAL",E[E.SERVER=1]="SERVER",E[E.CLIENT=2]="CLIENT",E[E.PRODUCER=3]="PRODUCER",E[E.CONSUMER=4]="CONSUMER",(T=J||(J={}))[T.NOT_RECORD=0]="NOT_RECORD",T[T.RECORD=1]="RECORD",T[T.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED";let iH=eq("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function iW(e){return!0===e.getValue(iH)}(A=Y||(Y={}))[A.UNSET=0]="UNSET",A[A.OK=1]="OK",A[A.ERROR=2]="ERROR";let iK=performance;function iX(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}function iQ(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function iJ(e){return iQ(e)||"number"==typeof e||e instanceof Date}function iY(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=1e9&&(r[1]-=1e9,r[0]+=1),r}class iq{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Y.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){const t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=iK.now(),this._performanceOffset=t-(this._performanceStartTime+iK.timeOrigin),this._startTimeProvided=null!=e.startTime,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(const t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,null!=e.attributes&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(null==t||this._isSpanEnded())return this;if(0===e.length)return eR.warn(`Invalid attribute key: ${e}`),this;if(!iV(t))return eR.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,e);return void 0!==r&&this._attributesCount>=r&&i?this._droppedAttributesCount++:(this.attributes[e]=this._truncateToSize(t),i&&this._attributesCount++),this}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,r){if(this._isSpanEnded())return this;let{eventCountLimit:i}=this._spanLimits;if(0===i)return eR.warn("No events allowed."),this._droppedEventsCount++,this;void 0!==i&&this.events.length>=i&&(0===this._droppedEventsCount&&eR.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),iJ(t)&&(iJ(r)||(r=t),t=void 0);let s=i$(t),{attributePerEventCountLimit:n}=this._spanLimits,a={},o=0,c=0;for(let e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;let t=s[e];if(void 0!==n&&c>=n){o++;continue}a[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:o}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(0===t)return this._droppedLinksCount++,this;void 0!==t&&this.links.length>=t&&(0===this._droppedLinksCount&&eR.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,i=i$(e.attributes),s={},n=0,a=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(void 0!==r&&a>=r){n++;continue}s[e]=this._truncateToSize(t),a++}let o={context:e.context};return a>0&&(o.attributes=s),n>0&&(o.droppedAttributesCount=n),this.links.push(o),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Y.UNSET||this.status.code===Y.OK)return this;let t={code:e.code};return e.code===Y.ERROR&&("string"==typeof e.message?t.message=e.message:null!=e.message&&eR.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t,r;let i,s;this._isSpanEnded()?eR.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=(t=this.startTime,i=(r=this.endTime)[0]-t[0],(s=r[1]-t[1])<0&&(i-=1,s+=1e9),[i,s]),this._duration[0]<0&&(eR.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&&eR.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&eR.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){if("number"==typeof e&&e<=iK.now()){var t;return t=e+this._performanceOffset,iY(iX(iK.timeOrigin),iX("number"==typeof t?t:iK.now()))}if("number"==typeof e)return iX(e);if(e instanceof Date)return iX(e.getTime());if(iQ(e))return e;if(this._startTimeProvided)return iX(Date.now());let r=iK.now()-this._performanceStartTime;return iY(this.startTime,iX(r))}isRecording(){return!1===this._ended}recordException(e,t){let r={};"string"==typeof e?r[eP]=e:e&&(e.code?r[eN]=e.code.toString():e.name&&(r[eN]=e.name),e.message&&(r[eP]=e.message),e.stack&&(r["exception.stacktrace"]=e.stack)),r[eN]||r[eP]?this.addEvent("exception",r,t):eR.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);eR.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(eR.warn(`Attribute value limit must be positive, got ${t}`),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}}function iZ(e){}(x=q||(q={}))[x.NOT_RECORD=0]="NOT_RECORD",x[x.RECORD=1]="RECORD",x[x.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED";class i0{shouldSample(){return{decision:q.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class i1{shouldSample(){return{decision:q.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}function i2(e){try{var t;eR.error((t=e,"string"==typeof t?t:JSON.stringify(function(e){let t={},r=e;for(;null!==r;
8)Object.getOwnPropertyNames(r).forEach(e=>{if(t[e])return;let i=r[e];i&&(t[e]=String(i))}),r=Object.getPrototypeOf(r);return t}(t))))}catch{}}class i4{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(i2(Error("ParentBasedSampler must have a root sampler configured")),this._root=new i1),this._remoteParentSampled=e.remoteParentSampled??new i1,this._remoteParentNotSampled=e.remoteParentNotSampled??new i0,this._localParentSampled=e.localParentSampled??new i1,this._localParentNotSampled=e.localParentNotSampled??new i0}shouldSample(e,t,r,i,s,n){let a=tS.getSpanContext(e);return a&&tl(a)?a.isRemote?a.traceFlags&R.SAMPLED?this._remoteParentSampled.shouldSample(e,t,r,i,s,n):this._remoteParentNotSampled.shouldSample(e,t,r,i,s,n):a.traceFlags&R.SAMPLED?this._localParentSampled.shouldSample(e,t,r,i,s,n):this._localParentNotSampled.shouldSample(e,t,r,i,s,n):this._root.shouldSample(e,t,r,i,s,n)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class i5{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(0xffffffff*this._ratio)}shouldSample(e,t){return{decision:tc(t)&&this._accumulate(t)<this._upperBound?q.RECORD_AND_SAMPLED:q.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return"number"!=typeof e||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let r=0;r<e.length/8;r++){let i=8*r;t=(t^parseInt(e.slice(i,i+8),16))>>>0}return t}}function i3(){return{sampler:i6(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:iZ("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:iZ("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:iZ("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:iZ("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:iZ("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:iZ("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:iZ("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:iZ("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}function i6(){let e=(void 0)??Z.ParentBasedAlwaysOn;switch(e){case Z.AlwaysOn:return new i1;case Z.AlwaysOff:return new i0;case Z.ParentBasedAlwaysOn:return new i4({root:new i1});case Z.ParentBasedAlwaysOff:return new i4({root:new i0});case Z.TraceIdRatio:return new i5(i8());case Z.ParentBasedTraceIdRatio:return new i4({root:new i5(i8())});default:return eR.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Z.ParentBasedAlwaysOn}".`),new i4({root:new i1})}}function i8(){let e=iZ("OTEL_TRACES_SAMPLER_ARG");return null==e?(eR.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1):e<0||e>1?(eR.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to 1.`),1):e}(C=Z||(Z={})).AlwaysOff="always_off",C.AlwaysOn="always_on",C.ParentBasedAlwaysOff="parentbased_always_off",C.ParentBasedAlwaysOn="parentbased_always_on",C.ParentBasedTraceIdRatio="parentbased_traceidratio",C.TraceIdRatio="traceidratio";let i7=1/0,i9=new Uint8Array(16),se=new Uint8Array(8),st=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sr(e){for(let t=0;t<e.length;t++)e[t]=256*Math.random()>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function si(e){let t="";for(let r=0;r<e.length;r++)t+=st[e[r]];return t}class ss{generateTraceId(){return sr(i9),si(i9)}generateSpanId(){return sr(se),si(se)}}let sn="otel.span.sampling_result";class sa{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){var r;let i=function(e){switch(e){case q.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case q.RECORD:return"RECORD_ONLY";case q.NOT_RECORD:return"DROP"}}(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":(r=e)?r.isRemote?"remote":"local":"none",[sn]:i}),t===q.NOT_RECORD)return()=>{};let s={[sn]:i};return this.liveSpans.add(1,s),()=>{this.liveSpans.add(-1,s)}}}class so{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;
8constructor(e,t,r,i){const s=function(e){let t={sampler:i6()},r=i3(),i=Object.assign({},r,t,e);return i.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),i.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),i}(t);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=t.idGenerator||new ss,this._resource=r,this._spanProcessor=i,this.instrumentationScope=e;const n=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace","2.6.1"):ea;this._tracerMetrics=new sa(n)}startSpan(e,t={},r=e5.active()){let i,s,n;t.root&&(r=tS.deleteSpan(r));let a=tS.getSpan(r);if(iW(r))return eR.debug("Instrumentation suppressed, returning Noop Span"),tS.wrapSpanContext(e8);let o=a?.spanContext(),c=this._idGenerator.generateSpanId();o&&tS.isSpanContextValid(o)?(s=o.traceId,n=o.traceState,i=o):s=this._idGenerator.generateTraceId();let l=t.kind??Q.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:i$(e.attributes)})),h=i$(t.attributes),d=this._sampler.shouldSample(r,s,e,l,h,u),m=this._tracerMetrics.startSpan(o,d.decision);n=d.traceState??n;let p={traceId:s,spanId:c,traceFlags:d.decision===J.RECORD_AND_SAMPLED?R.SAMPLED:R.NONE,traceState:n};if(d.decision===J.NOT_RECORD)return eR.debug("Recording is off, propagating context in a non-recording span"),tS.wrapSpanContext(p);let _=i$(Object.assign(h,d.attributes));return new iq({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:p,name:e,kind:l,links:u,parentSpanContext:i,attributes:_,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,t,r,i){let s,n,a;if(arguments.length<2)return;2==arguments.length?a=t:3==arguments.length?(s=t,a=r):(s=t,n=r,a=i);let o=n??e5.active(),c=this.startSpan(e,s,o),l=tS.setSpan(o,c);return e5.with(l,a,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class sc{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{i2(e||Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(let r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,r)=>{Promise.all(e).then(()=>{t()},r)})}}(O=ee||(ee={}))[O.resolved=0]="resolved",O[O.timeout=1]="timeout",O[O.error=2]="error",O[O.unresolved=3]="unresolved";class sl{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){const t=function(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=function e(t,r,i=0,s){let n;if(!(i>20)){if(i++,iB(t)||iB(r)||iI(r))n=iP(r);else if(iU(t)){if(n=t.slice(),iU(r))for(let e=0,t=r.length;e<t;e++)n.push(iP(r[e]));else if(ik(r)){let e=Object.keys(r);for(let t=0,i=e.length;t<i;t++){let i=e[t];n[i]=iP(r[i])}}}else if(ik(t))if(ik(r)){var a,o;if(a=t,o=r,!(iR(a)&&iR(o)))return r;n=Object.assign({},t);let c=Object.keys(r);for(let a=0,o=c.length;a<o;a++){let o=c[a],l=r[o];if(iB(l))void 0===l?delete n[o]:n[o]=l;else{let a=n[o];if(iN(t,o,s)||iN(r,o,s))delete n[o];else{if(ik(a)&&ik(l)){let e=s.get(a)||[],i=s.get(l)||[];e.push({obj:t,key:o}),i.push({obj:r,key:o}),s.set(a,e),s.set(l,i)}n[o]=e(n[o],l,i,s)}}}}else n=r;return n}}(t,e.shift(),0,r);return t}({},i3(),function(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??iZ("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??iZ("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??iZ("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??iZ("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??i7,Object.assign({},e,{spanLimits:t})}(e));this._resource=t.resource??function(){var e;return e={[eU]:function(){if(void 0===i)try{let e=globalThis.process.argv0;i=e?`unknown_service:${e}`:"unknown_service"}catch{i="unknown_service"}return i}(),[eI]:iD[eI],[eB]:iD[eB],[eD]:iD[eD]},ij.FromAttributeList(Object.entries(e),void 0)}(),this._config=Object.assign({},t,{resource:this._resource});const r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new sc(r)}getTracer(e,t,r){let i=`${e}@${t||""}:${r?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new so({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(i)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(r=>{let i,s=setTimeout(()=>
8{r(Error(`Span processor did not completed within timeout period of ${e} ms`)),i=ee.timeout},e);t.forceFlush().then(()=>{clearTimeout(s),i!==ee.timeout&&r(i=ee.resolved)}).catch(e=>{clearTimeout(s),i=ee.error,r(e)})}));return new Promise((e,r)=>{Promise.all(t).then(t=>{let i=t.filter(e=>e!==ee.resolved);i.length>0?r(i):e()}).catch(e=>r([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class su{_enabled=!1;_currentContext=e0;_bindFunction(e=e0,t){let r=this,i=function(...i){return r.with(e,()=>t.apply(this,i))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}active(){return this._currentContext}bind(e,t){return(void 0===e&&(e=this.active()),"function"==typeof t)?this._bindFunction(e,t):t}disable(){return this._currentContext=e0,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=e0),this}with(e,t,r,...i){let s=this._currentContext;this._currentContext=e||e0;try{return t.call(r,...i)}finally{this._currentContext=s}}}let sh={get(e,t){if(null!=e)return e[t]},keys:e=>null==e?[]:Object.keys(e)},sd={set(e,t,r){null!=e&&(e[t]=r)}},sm=eq("OpenTelemetry Baggage Key");function sp(e){return e.getValue(sm)||void 0}function s_(){return sp(e4.getInstance().active())}function sg(e,t){return e.setValue(sm,t)}function sf(e){return e.deleteValue(sm)}class sb{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,t){let r=new sb(this._entries);return r._entries.set(e,t),r}removeEntry(e){let t=new sb(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new sb(this._entries);for(let r of e)t._entries.delete(r);return t}clear(){return new sb}}let sS=Symbol("BaggageEntryMetadata"),sw=ex.instance();function sy(e={}){return new sb(new Map(Object.entries(e)))}let sv="propagation",sE=new class{inject(e,t){}extract(e,t){return e}fields(){return[]}};class sT{constructor(){this.createBaggage=sy,this.getBaggage=sp,this.getActiveBaggage=s_,this.setBaggage=sg,this.deleteBaggage=sf}static getInstance(){return this._instance||(this._instance=new sT),this._instance}setGlobalPropagator(e){return ey(sv,e,ex.instance())}inject(e,t,r=sd){return this._getGlobalPropagator().inject(e,t,r)}extract(e,t,r=sh){return this._getGlobalPropagator().extract(e,t,r)}fields(){return this._getGlobalPropagator().fields()}disable(){eE(sv,ex.instance())}_getGlobalPropagator(){return ev(sv)||sE}}let sA=sT.getInstance();class sx{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(e=>"function"==typeof e.fields?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,r){for(let i of this._propagators)try{i.inject(e,t,r)}catch(e){eR.warn(`Failed to inject with ${i.constructor.name}. Err: ${e.message}`)}}extract(e,t,r){return this._propagators.reduce((e,i)=>{try{return i.extract(e,t,r)}catch(e){eR.warn(`Failed to extract with ${i.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}let sC="baggage";class sO{inject(e,t,r){let i=sA.getBaggage(e);if(!i||iW(e))return;let s=i.getAllEntries().map(([e,t])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return void 0!==t.metadata&&(r+=";"+t.metadata.toString()),r}).filter(e=>e.length<=4096).slice(0,180).reduce((e,t)=>{let r=`${e}${""!==e?",":""}${t}`;return r.length>8192?e:r},"");s.length>0&&r.set(t,sC,s)}extract(e,t,r){let i=r.get(t,sC),s=Array.isArray(i)?i.join(","):i;if(!s)return e;let n={};return 0===s.length||(s.split(",").forEach(e=>{let t=function(e){let t,r,i;if(!e)return;let s=e.indexOf(";"),n=-1===s?e:e.substring(0,s),a=n.indexOf("=");if(a<=0)return;let o=n.substring(0,a).trim(),c=n.substring(a+1).trim();if(o&&c){try{t=decodeURIComponent(o),r=decodeURIComponent(c)}catch{return}if(-1!==s&&s<e.length-1){var l;"string"!=typeof(l=e.substring(s+1))&&(sw.error(`Cannot create baggage metadata from unknown type: ${typeof l}`),l=""),i={__TYPE__:sS,toString:()=>l}}return{key:t,value:r,metadata:i}}}(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),n[t.key]=e}}),0===Object.entries(n).length)?e:sA.setBaggage(e,sA.createBaggage(n))}fields(){return[sC]}}let sL="[_0-9a-z-*/]",sM=`[a-z]${sL}{0,255}`,sR=`[a-z0-9]${sL}{0,240}@[a-z]${sL}{0,13}`,sP=RegExp(`^(?:${sM}|${sR})$`),sN=/^[ -~]{0,255}[!-~]$/,sU=/,|=/;class sI{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,t){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>
8(e.push(t+"="+this.get(t)),e),[]).join(",")}_parse(e){!(e.length>512)&&(this._internalState=e.split(",").reverse().reduce((e,t)=>{let r=t.trim(),i=r.indexOf("=");if(-1!==i){let s=r.slice(0,i),n=r.slice(i+1,t.length);sP.test(s)&&sN.test(n)&&!sU.test(n)&&e.set(s,n)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new sI;return e._internalState=new Map(this._internalState),e}}let sk="traceparent",sB="tracestate",sD=RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class sF{inject(e,t,r){let i=tS.getSpanContext(e);if(!i||iW(e)||!tl(i))return;let s=`00-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||R.NONE).toString(16)}`;r.set(t,sk,s),i.traceState&&r.set(t,sB,i.traceState.serialize())}extract(e,t,r){let i,s=r.get(t,sk);if(!s)return e;let n=Array.isArray(s)?s[0]:s;if("string"!=typeof n)return e;let a=(i=sD.exec(n))&&("00"!==i[1]||!i[5])?{traceId:i[2],spanId:i[3],traceFlags:parseInt(i[4],16)}:null;if(!a)return e;a.isRemote=!0;let o=r.get(t,sB);if(o){let e=Array.isArray(o)?o.join(","):o;a.traceState=new sI("string"==typeof e?e:void 0)}return tS.setSpanContext(e,a)}fields(){return[sk,sB]}}class sj extends sl{constructor(e={}){super(e)}register(e={}){tS.setGlobalTracerProvider(this),function(e){if(null!==e){if(void 0===e)return sA.setGlobalPropagator(new sx({propagators:[new sF,new sO]}));sA.setGlobalPropagator(e)}}(e.propagator),function(e){if(null!==e){if(void 0===e){let e=new su;e.enable(),e5.setGlobalContextManager(e);return}e.enable(),e5.setGlobalContextManager(e)}}(e.contextManager)}}class sG{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class s${_isCalled=!1;_deferred=new sG;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}(L=et||(et={}))[L.SUCCESS=0]="SUCCESS",L[L.FAILED=1]="FAILED";class sV{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize="number"==typeof t?.maxExportBatchSize?t.maxExportBatchSize:iZ("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize="number"==typeof t?.maxQueueSize?t.maxQueueSize:iZ("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis="number"==typeof t?.scheduledDelayMillis?t.scheduledDelayMillis:iZ("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis="number"==typeof t?.exportTimeoutMillis?t.exportTimeoutMillis:iZ("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new s$(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(eR.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&R.SAMPLED)!=0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){0===this._droppedSpansCount&&eR.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(eR.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>
8{let r=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0;e<i;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return(this._clearTimer(),0===this._finishedSpans.length)?Promise.resolve():new Promise((e,t)=>{let r=setTimeout(()=>{t(Error("Timeout"))},this._exportTimeoutMillis);e5.with(e5.active().setValue(iH,!0),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(i,i=>{clearTimeout(r),i.code===et.SUCCESS?e():t(i.error??Error("BatchSpanProcessor: span export failed"))}),n=null;for(let e=0,t=i.length;e<t;e++){let t=i[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(n??=[]).push(t.resource.waitForAsyncAttributes())}null===n?s():Promise.all(n).then(s,e=>{i2(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,i2(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer&&this._timer.unref())}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class sz extends sV{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&"u">typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch(e=>{i2(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{i2(e)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"u">typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}function sH(e,t){let r=255&e|256;return t&&(r|=512),r}let sW={serializeRequest:e=>{let t={resourceSpans:function(e,t){let r=function(e){let t=new Map;for(let r of e){let e=t.get(r.resource);e||(e=new Map,t.set(r.resource,e));let i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,s=e.get(i);s||(s=[],e.set(i,s)),s.push(r)}return t}(e),i=[],s=r.entries(),n=s.next();for(;!n.done;){let[e,r]=n.value,a=[],o=r.values(),c=o.next();for(;!c.done;){let e=c.value;if(e.length>0){let r=e.map(e=>(function(e,t){let r=e.spanContext(),i=e.status,s=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:s,traceState:r.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:tj(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>{var r,i;return r=e,i=t,{attributes:r.attributes?tj(r.attributes,i):[],name:r.name,timeUnixNano:i.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}),droppedEventsCount:e.droppedEventsCount,status:{code:i.code,message:i.message},links:e.links.map(e=>{var r,i;return r=e,i=t,{attributes:r.attributes?tj(r.attributes,i):[],spanId:i.encodeSpanContext(r.context.spanId),traceId:i.encodeSpanContext(r.context.traceId),traceState:r.context.traceState?.serialize(),droppedAttributesCount:r.droppedAttributesCount||0,flags:sH(r.context.traceFlags,r.context.
8isRemote)}}),droppedLinksCount:e.droppedLinksCount,flags:sH(r.traceFlags,e.parentSpanContext?.isRemote)}})(e,t));a.push({scope:tF(e[0].instrumentationScope),spans:r,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=o.next()}let l=tD(e,t),u={resource:l,scopeSpans:a,schemaUrl:l.schemaUrl};i.push(u),n=s.next()}return i}(e,tH)};return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>0===e.length?{}:JSON.parse(new TextDecoder().decode(e))};class sK extends tB{constructor(e={}){super(t4(e,sW,"v1/traces",{"Content-Type":"application/json"}))}}let sX=!1,sQ=()=>void 0;async function sJ(){let e=sQ();return e?{Authorization:`Bearer ${e}`}:{}}var sY=e.i(942066);let sq=!1,sZ=0,s0=0;function s1(e){return(0===s0||e-sZ>1e4)&&(sZ=e,s0=0),(s0+=1)>50}e.s(["ClientTelemetryInit",0,function(){let e=(0,ei.useAuth)(),t=e?.tokens?.accessToken,r=(0,er.useRef)(t);return r.current=t,(0,er.useEffect)(()=>{t&&(!function(e){if(sQ=e,sX)return;sX=!0;let t=e$({[eU]:"necropolis-web-browser"}),r={headers:sJ},i=new tP({resource:t,processors:[new tk(new t5({url:"/api/telemetry/v1/logs",...r}))]});eM.logs.setGlobalLoggerProvider(i);let s=new ic({resource:t,readers:[new ip({exporter:new iE({url:"/api/telemetry/v1/metrics",...r})})]});eL.setGlobalMeterProvider(s);let n=new sj({resource:t,spanProcessors:[new sz(new sK({url:"/api/telemetry/v1/traces",...r}))]});n.register();let a=()=>{i.forceFlush().catch(()=>{}),s.forceFlush().catch(()=>{}),n.forceFlush().catch(()=>{})};window.addEventListener("pagehide",a),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&a()})}(()=>r.current),sq||(sq=!0,window.addEventListener("error",e=>{if(e.error instanceof Error&&(0,sY.alreadyLogged)(e.error)||s1(Date.now()))return;let t={"browser.error.source":"window.onerror","browser.error.filename":e.filename,"browser.error.lineno":e.lineno,"browser.error.colno":e.colno};e.error instanceof Error?sY.browserLog.error(e.message||e.error.message,e.error,t):sY.browserLog.error(e.message||"Uncaught error",t)}),window.addEventListener("unhandledrejection",e=>{let t=e.reason;if(s1(Date.now()))return;let r={"browser.error.source":"unhandledrejection"};t instanceof Error?sY.browserLog.error("Unhandled promise rejection",t,r):sY.browserLog.error("Unhandled promise rejection",{...r,"rejection.reason":String(t)})})))},[t]),null}],64140)},900569,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(279667),s=e.i(250241);let n={fps:0,frameMs:0,worstMs:0,minFps:1/0,heapMb:null};e.s(["FpsCounter",0,function(){var e;let{allowed:a}=(0,s.useWebDebug)(),o=a||!1,[c,l]=(0,r.useState)(!1),[u,h]=(0,r.useState)(n),[d,m]=(0,r.useState)([]),p=(0,r.useRef)(0),_=(0,r.useRef)(0),g=(0,r.useRef)(0),f=(0,r.useRef)(0),b=(0,r.useRef)(1/0),S=(0,r.useRef)(!0),w=(0,r.useRef)(null),y=(0,r.useCallback)(()=>{let e=performance.now(),t=e-g.current;g.current=e,p.current++,S.current?S.current=!1:t>f.current&&(f.current=t);let r=e-_.current;if(r>=500){let t,i=p.current,s=Math.round(1e3*i/r),n=f.current;s<b.current&&(b.current=s),h({fps:s,frameMs:i>0?r/i:0,worstMs:n,minFps:b.current,heapMb:(t=performance.memory)?Math.round(t.usedJSHeapSize/1024/1024):null}),m(e=>[...e,s].slice(-30)),p.current=0,f.current=0,_.current=e}w.current=requestAnimationFrame(y)},[]);if((0,r.useEffect)(()=>{if(!c)return;let e=performance.now();return p.current=0,_.current=e,g.current=e,f.current=0,b.current=1/0,S.current=!0,h(n),m([]),w.current=requestAnimationFrame(y),()=>{null!==w.current&&(cancelAnimationFrame(w.current),w.current=null)}},[c,y]),(0,r.useEffect)(()=>{if(!o)return;let e=()=>l(e=>!e),t=t=>{"F9"!==t.key||t.metaKey||t.ctrlKey||t.altKey||(0,i.isInTextInput)()||(t.preventDefault(),e())};return window.addEventListener("keydown",t),window.addEventListener("perf:toggle-fps",e),()=>{window.removeEventListener("keydown",t),window.removeEventListener("perf:toggle-fps",e)}},[o]),!o||!c)return null;let v=Number.isFinite(u.minFps)?u.minFps:u.fps;return(0,t.jsxs)("div",{"data-testid":"fps-monitor",className:"fixed top-1 left-1 z-10000 pointer-events-none rounded bg-black/80 px-2 py-1 font-mono text-[11px] leading-snug tabular-nums text-white/70",children:[(0,t.jsxs)("div",{className:(e=u.fps)<45?"text-red-500":e<55?"text-yellow-400":"text-green-400",children:["FPS ",u.fps,(0,t.jsxs)("span",{className:"text-white/40",children:[" / ",60]})]}),(0,t.jsxs)("div",{children:[u.frameMs.toFixed(1),"ms avg",(0,t.jsx)("span",{className:"text-white/40",children:" · "}),u.worstMs.toFixed(1),"ms worst"]}),(0,t.jsxs)("div",{children:["min ",v,null!==u.heapMb&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-white/40",children:" · "}
8),"heap ",u.heapMb,"MB"]})]}),(0,t.jsx)("div",{className:"mt-1 flex h-6 w-30 items-end gap-px","aria-hidden":"true",children:d.map((e,r)=>(0,t.jsx)("div",{className:`flex-1 ${e<45?"bg-red-500":e<55?"bg-yellow-400":"bg-green-400"}`,style:{height:`${Math.max(4,Math.min(100,e/60*100))}%`}},r))}),(0,t.jsx)("div",{className:"mt-0.5 text-white/35",children:"F9 to hide"})]})}])},501356,e=>{"use strict";var t=e.i(271645),r=e.i(55260),i=e.i(383978),s=e.i(50941),n=e.i(920185),a=e.i(90582),o=e.i(374421);async function c(e,t){if(!t)return!1;let r=(0,o.loadVisitorId)();if(!r)return!0;try{let i=await fetch("/api/attribution",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},keepalive:!0,body:JSON.stringify({userId:e,visitorId:r})});if(404===i.status)return!0;if(!i.ok)return!1;let s=await Promise.resolve(i.json()).catch(()=>null);return s?.stitched!==!1}catch{return!1}}async function l(e,t){let r=(0,s.loadUtmCookie)(),i=(0,o.loadVisitorId)(),c=(0,n.loadRdtCid)(),l=(0,a.loadGa4ClientId)(),u={};r?.first&&(u.first_touch=r.first),r?.last&&(u.last_touch=r.last);let h=r?(0,s.lastPaidAttributionTouch)(r):void 0;if(h&&(u.last_paid_touch=h),c&&(u.rdt_cid=c),l&&(u.ga4_client_id=l),!t)return!1;try{let n=await fetch("/api/attribution",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},keepalive:!0,body:JSON.stringify({userId:e,attribution:u,...i?{visitorId:i}:{}})});if(404===n.status)return!0;if(!n.ok)return!1;let a=await n.json(),o=!0===a.deviceCaptured,c=!1!==a.stitched;return o&&r&&(0,s.clearUtmCookie)(),o&&c}catch{return!1}}e.s(["SignupAttributionInit",0,function(){let e=(0,r.useAuth)(),s=(0,t.useRef)(null),n=e.user?.id,a=e.user?.loginCount,o=e.tokens?.accessToken,u=e.user?.roles?.includes("Anonymous")??!1;return(0,t.useEffect)(()=>{let t;if(e.isLoading||!n||void 0===a||!o||s.current===n||u)return;let r="new"===(0,i.getUserType)(a)?()=>l(n,o):()=>c(n,o),h=!1,d=async e=>{let i=await r();if(!h){if(i){s.current=n;return}e<2&&(t=window.setTimeout(()=>void d(e+1),1e3*(e+1)))}};return d(0),()=>{h=!0,void 0!==t&&window.clearTimeout(t)}},[o,e.isLoading,u,a,n]),null}],501356)},283798,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=(e,t,r,i,s,n,a,o)=>{let c=document.documentElement,l=["light","dark"];function u(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,i=r&&n?s.map(e=>n[e]||e):s;r?(c.classList.remove(...i),c.classList.add(n&&n[t]?n[t]:t)):c.setAttribute(e,t)}),r=t,o&&l.includes(r)&&(c.style.colorScheme=r)}if(i)u(i);else try{let e=localStorage.getItem(t)||r,i=a&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;u(i)}catch(e){}},s=r.createContext(void 0),n={setTheme:e=>{},themes:[]};r.memo(({forcedTheme:e,storageKey:t,attribute:s,enableSystem:n,enableColorScheme:a,defaultTheme:o,value:c,themes:l,nonce:u,scriptProps:h})=>{let d=JSON.stringify([s,t,o,e,l,c,n,a]).slice(1,-1);return r.createElement("script",{...h,suppressHydrationWarning:!0,nonce:"u"<typeof window?u:"",dangerouslySetInnerHTML:{__html:`(${i.toString()})(${d})`}})});var a=e.i(846696);e.s(["Toaster",0,({...e})=>{var i;let{theme:o="system"}=null!=(i=r.useContext(s))?i:n;return(0,t.jsx)(a.Toaster,{theme:o,className:"toaster group",style:{"--width":"360px"},...e})}],283798)},945185,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(836191),s=e.i(666904),n=e.i(77982),a=e.i(634066),o=e.i(270756),c=e.i(531278);e.s(["PasswordPromptDialog",0,()=>{let[e,l]=(0,r.useState)(""),[u,h]=(0,r.useState)(!1),[d,m]=(0,r.useState)(!1),[p,_]=(0,r.useState)(!0),g=async t=>{t.preventDefault(),m(!0),h(!1);try{let t=await fetch("/api/access",{body:JSON.stringify({password:e}),headers:{"Content-Type":"application/json"},method:"POST"});m(!1),200===t.status?(_(!1),window.location.reload()):h(!0)}catch(e){console.error("Error submitting password:",e),m(!1),h(!0)}};return(0,t.jsx)(i.Dialog,{open:p,onOpenChange:_,children:(0,t.jsxs)(i.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(i.DialogHeader,{children:[(0,t.jsx)(i.DialogTitle,{children:"Dungeons Deep - Beta Access"}),(0,t.jsxs)(i.DialogDescription,{children:["Please enter the password to access the application. If you are a game tester, please visit"," ",(0,t.jsx)("a",{href:"https://dungeonsdeep.ai/",className:"text-primary underline hover:text-primary/80",children:"dungeonsdeep.ai"})," ","and create a new account."]})]}),(0,t.jsxs)("form",{onSubmit:g,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(a.Label,{htmlFor:"password",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(o.Lock,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,t.jsx)(n.Input,{id:"password",type:"password",placeholder:"Enter password",value:e,onCh
8ange:e=>l(e.target.value),className:`pl-10 ${u?"border-red-500":""}`,required:!0,disabled:d})]})]}),u&&(0,t.jsx)("p",{className:"text-sm text-red-600",children:"Incorrect password. Please try again."}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(s.Button,{type:"submit",disabled:d,children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Submit"})})]})]})})}])},890189,e=>{"use strict";var t=e.i(271645),r=e.i(50941),i=e.i(374421);e.s(["UtmPersistence",0,function(){return(0,t.useEffect)(()=>{let e=(0,r.captureUtmParams)();(0,r.saveUtmCookie)(e),e||"/auth/link"!==window.location.pathname||(0,r.restoreUtmToUrl)(),(0,i.ensureVisitorId)()},[]),null}])},234896,e=>{"use strict";var t=e.i(271645),r=e.i(920185);e.s(["ClickIdPersistence",0,function(){return(0,t.useEffect)(()=>{(0,r.captureAndPersistRdtCid)()},[]),null}])},928330,e=>{"use strict";e.i(247167);var t,r=e.i(843476),i=e.i(271645),s=e.i(604570),n=(0,i.createContext)({get client(){return t},bootstrap:void 0});function a(e){var r,s,a=e.children,o=e.client,c=e.apiKey,l=e.options,u=(0,i.useRef)(null),h=(0,i.useMemo)(function(){if(o)return c&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),l&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),o;var e=t;return c||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),e},[o,c,JSON.stringify(l)]);return(0,i.useEffect)(function(){if(!o&&c){var e=t,r=u.current;r?(c!==r.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),l&&!function e(t,r,i){if(void 0===i&&(i=new WeakMap),t===r)return!0;if("object"!=typeof t||null===t||"object"!=typeof r||null===r)return!1;if(i.has(t)&&i.get(t)===r)return!0;i.set(t,r);var s=Object.keys(t),n=Object.keys(r);if(s.length!==n.length)return!1;for(var a=0;a<s.length;a++){var o=s[a];if(!n.includes(o)||!e(t[o],r[o],i))return!1}return!0}(l,r.options)&&e.set_config(l)):(e.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),e.init(c,l)),u.current={apiKey:c,options:null!=l?l:{}}}},[o,c,JSON.stringify(l)]),i.default.createElement(n.Provider,{value:{client:h,bootstrap:null!=(r=null==l?void 0:l.bootstrap)?r:null==(s=null==o?void 0:o.config)?void 0:s.bootstrap}},a)}var o=function(e){return"function"==typeof e},c=function(e,t){return(c=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};"function"==typeof SuppressedError&&SuppressedError;var l={componentStack:null,exceptionEvent:null,error:null};!function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=r}function r(t){var r=e.call(this,t)||this;return r.state=l,r}c(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r.prototype.componentDidCatch=function(e,t){var r,i=this.props.additionalProperties;o(i)?r=i(e):"object"==typeof i&&(r=i);var s=this.context.client.captureException(e,r),n=t.componentStack;this.setState({error:e,componentStack:null!=n?n:null,exceptionEvent:s})},r.prototype.render=function(){var e=this.props,t=e.children,r=e.fallback,s=this.state;if(null==s.componentStack)return o(t)?t():t;var n=o(r)?i.default.createElement(r,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):r;return i.default.isValidElement(n)?n:(console.warn("[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."),i.default.createElement(i.default.Fragment,null))},r.contextType=n}(i.default.Component),t=s.default,e.s(["PostHogProvider",0,function({children:e}){return(0,i.useEffect)(()=>{s.default.init("phc_raniQ4NMZusgEpH57hoxWbUmyBjrFwWUEVDDgfPXGc4y",{api_host:"https://us.i.posthog.com",defaults:"2026-01-30",session_recording:{recordBody:!0,recordHeaders:!0}})},[]),(0,r.jsx)(a,{client:s.default,children:e})}],928330)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.