PageSourceSearch

https://sokapal.ai/assets/index-CKvy-8q8.js

js sokapal.ai collected 2026-10-05 15:17:05 UTC 35,901 bytes, 1 lines download raw bytes

1import{_ as e}from"./vendor-i18n-DiTKF2NC.js";import{O as t,g as r,a as n,b as i,c as s,u as o,i as a,s as c}from"./index-Dirtnqiz.js";import{t as u,h as l,g as d,p,i as m}from"./vendor-otel-B3hnpEUX.js";import"./vendor-react-DbsVTsKS.js";import"./vendor-ui-B_XW8Pya.js";import"./vendor-charts-CG7l663-.js";import"./app-constants-D3ojol5R.js";import"./vendor-virtuoso-CT6D0QVj.js";import"./vendor-markdown-CiT-VfZw.js";const g={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,FATAL:5},h={[g.TRACE]:"TRACE",[g.DEBUG]:"DEBUG",[g.INFO]:"INFO",[g.WARN]:"WARN",[g.ERROR]:"ERROR",[g.FATAL]:"FATAL"};class f{constructor(e={}){this.serviceName=e.serviceName||t.service.name,this.environment=e.environment||t.environment,this.minLogLevel=e.minLogLevel??this.getDefaultLogLevel(),this.enableConsoleOutput=e.enableConsoleOutput??t.features.consoleLogging,this.enableOtelExport=e.enableOtelExport??t.features.logs,this.otelLogger=null,this.isInitialized=!1,this.logBuffer=[],this.maxBufferSize=e.maxBufferSize||100,this.defaultContext={service:this.serviceName,environment:this.environment,runtime:"browser",user_agent:navigator.userAgent}}async initialize(){if(!this.isInitialized)try{await new Promise(e=>setTimeout(e,100));const e=r();(null==e?void 0:e.isInitialized())&&this.enableOtelExport&&(this.otelLogger=n(),this.otelLogger&&e.loggerProvider),this.isInitialized=!0,this.flushBuffer()}catch(e){}}getDefaultLogLevel(){switch(this.environment){case"development":return g.DEBUG;case"staging":default:return g.INFO;case"production":return g.WARN}}createLogEntry(e,t,r={},n=null){const i=new Date,s=this.getCorrelationIds(),o={timestamp:i.toISOString(),timestamp_unix:i.getTime(),level:h[e],level_numeric:e,message:t,service:this.serviceName,environment:this.environment,...s,session_id:this.getSessionId(),page_url:window.location.href,page_title:document.title,referrer:document.referrer||null,...this.defaultContext,...r};return n&&(o.error={name:n.name,message:n.message,stack:n.stack,type:n.constructor.name},Object.keys(n).forEach(e=>{"name"!==e&&"message"!==e&&"stack"!==e&&(o.error[e]=n[e])})),o}getCorrelationIds(){try{const e=u.getActiveSpan();if(e){const t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}}catch(e){}return{trace_id:null,span_id:null,trace_flags:null}}getSessionId(){try{return sessionStorage.getItem("otel_session_id")||"unknown"}catch(e){return"unknown"}}log(e,t,r={},n=null){if(e<this.minLogLevel)return;const i=this.createLogEntry(e,t,r,n);this.enableConsoleOutput&&this.outputToConsole(i),this.enableOtelExport&&this.isInitialized&&this.otelLogger?this.sendToOtel(i):this.enableOtelExport&&!this.isInitialized&&this.bufferLog(i)}outputToConsole(e){const{level:t,message:r,timestamp:n,trace_id:i,span_id:s,error:o,...a}=e;i&&(i.slice(-8),null==s||s.slice(-8));let c;switch(t){case"TRACE":case"DEBUG":c="debug";break;case"INFO":c="info";break;case"WARN":c="warn";break;case"ERROR":case"FATAL":c="error";break;default:c="log"}if(Object.keys(a).length>0||o){const e={...a};o&&(e.error=o)}}sendToOtel(e){try{if(!this.otelLogger)return;const t={[g.TRACE]:1,[g.DEBUG]:5,[g.INFO]:9,[g.WARN]:13,[g.ERROR]:17,[g.FATAL]:21},r={};Object.entries(e).forEach(([e,t])=>{["timestamp","timestamp_unix","level","level_numeric","message","trace_id","span_id","trace_flags"].includes(e)||("object"==typeof t&&null!==t?r[e]=JSON.stringify(t):null!=t&&(r[e]=String(t)))});let n=l.active();const i=u.getActiveSpan();i&&(n=u.setSpan(n,i));const s={severityNumber:t[e.level_numeric]||9,severityText:e.level,body:e.message,attributes:r,timestamp:e.timestamp_unix,observedTimestamp:Date.now(),context:n};this.otelLogger.emit(s)}catch(t){}}bufferLog(e){this.logBuffer.push(e),this.logBuffer.length>this.maxBufferSize&&(this.logBuffer=this.logBuffer.slice(-this.maxBufferSize))}flushBuffer(){if(0!==this.logBuffer.length){for(const e of this.logBuffer)this.enableOtelExport&&this.otelLogger&&this.sendToOtel(e);this.logBuffer=[]}}trace(e,t={}){this.log(g.TRACE,e,t)}debug(e,t={}){this.log(g.DEBUG,e,t)}info(e,t={}){this.log(g.INFO,e,t)}warn(e,t={}){this.log(g.WARN,e,t)}
1error(e,t={},r=null){this.log(g.ERROR,e,t,r)}fatal(e,t={},r=null){this.log(g.FATAL,e,t,r)}child(e={}){const t=new f({serviceName:this.serviceName,environment:this.environment,minLogLevel:this.minLogLevel,enableConsoleOutput:this.enableConsoleOutput,enableOtelExport:this.enableOtelExport});return t.isInitialized=this.isInitialized,t.otelLogger=this.otelLogger,t.defaultContext={...this.defaultContext,...e},t}setLogLevel(e){this.minLogLevel=e}updateContext(e){this.defaultContext={...this.defaultContext,...e}}}const _=new f,v=(e={})=>_.initialize(e),w=(e,t)=>_.info(e,t),b=(e,t)=>_.warn(e,t),y=(e,t,r)=>_.error(e,t,r),T=Object.freeze(Object.defineProperty({__proto__:null,LogLevel:g,StructuredLogger:f,createChildLogger:e=>_.child(e),createLogger:(e={})=>new f(e),debug:(e,t)=>_.debug(e,t),default:_,error:y,fatal:(e,t,r)=>_.fatal(e,t,r),info:w,initializeLogger:v,logger:_,setLogLevel:e=>_.setLogLevel(e),trace:(e,t)=>_.trace(e,t),updateLoggerContext:e=>_.updateContext(e),warn:b},Symbol.toStringTag,{value:"Module"}));const E=new class{constructor(){this.originalFetch=null,this.originalXMLHttpRequest=null,this.isInitialized=!1,this.enabledEndpoints=new Set,this.disabledEndpoints=new Set}initialize(e={}){if(this.isInitialized)return;const{enabledEndpoints:t=[],disabledEndpoints:r=[],propagateHeaders:n=!0}=e;this.enabledEndpoints=new Set(t),this.disabledEndpoints=new Set(r),this.propagateHeaders=n;try{this.originalFetch=window.fetch,this.originalXMLHttpRequest=window.XMLHttpRequest,this.wrapFetch(),this.isInitialized=!0}catch(i){}}wrapFetch(){const e=this;window.fetch=async function(r,n={}){const s="string"==typeof r?r:r.url,o=n.method||"GET";if(!e.shouldTraceEndpoint(s))return e.originalFetch.call(this,r,n);const a=i();if(!a)return e.originalFetch.call(this,r,n);const c=`HTTP ${o.toUpperCase()}`,g=a.startSpan(c,{kind:d.CLIENT,attributes:{"http.method":o.toUpperCase(),"http.url":s,"http.scheme":e.getSchemeFromUrl(s),"http.host":e.getHostFromUrl(s),"http.target":e.getPathFromUrl(s),"component.name":"fetch","api.interceptor":"custom"}});try{const i=new Headers(n.headers);if(e.propagateHeaders){const e={};p.inject(l.active(),e),Object.entries(e).forEach(([e,t])=>{i.set(e,t)})}"development"===t.environment&&i.set("x-trace-debug","true");const a={...n,headers:i};if(n.body){const t=e.getBodySize(n.body);t>0&&g.setAttributes({"http.request_content_length":t})}return await l.with(u.setSpan(l.active(),g),async()=>{const t=Date.now();try{const n=await e.originalFetch.call(this,r,a),i=Date.now();if(g.setAttributes({"http.status_code":n.status,"http.status_text":n.statusText,"http.response_content_length":n.headers.get("content-length")||0,"http.duration_ms":i-t}),n.status>=400){g.setStatus({code:m.ERROR,message:`HTTP ${n.status} ${n.statusText}`});(n.status>=500?y:b)(`HTTP ${o.toUpperCase()} ${n.status} ${n.statusText}`,{"http.method":o.toUpperCase(),"http.url":s,"http.status_code":n.status,"http.status_text":n.statusText,"http.duration_ms":i-t,"error.type":"http_error","error.category":n.status>=500?"server_error":"client_error"})}else g.setStatus({code:m.OK});const c=n.headers.get("x-trace-id");return c&&g.setAttributes({"response.trace_id":c}),n}catch(n){throw g.recordException(n,{"error.type":"fetch_error","error.source":"network"}),g.setStatus({code:m.ERROR,message:n.message||"Fetch failed"}),y(`Network error during ${o.toUpperCase()} ${s}`,{"http.method":o.toUpperCase(),"http.url":s,"error.type":"network_error","error.message":n.message,"error.name":n.name},n),n}})}catch(h){throw g.recordException(h,{"error.type":"interceptor_error","error.source":"api_interceptor"}),g.setStatus({code:m.ERROR,message:h.message||"Request failed"}),y(`API interceptor error for ${o.toUpperCase()} ${s}`,{"http.method":o.toUpperCase(),"http.url":s,"error.type":"interceptor_error","error.message":h.message,"error.name":h.name},h),h}finally{g.end()}}}shouldTraceEndpoint(e){for(const t of this.disabledEndpoints)if(this.matchesPattern(e,t))return!1;if(0===this.enabledEndpoints.size)return!0;for(const t of this.enabledEndpoints)if(this.matchesPattern(e,t))return!0;return!1}
1matchesPattern(e,t){return t instanceof RegExp?t.test(e):"string"==typeof t&&e.includes(t)}getSchemeFromUrl(e){try{return new URL(e).protocol.replace(":","")}catch{return"unknown"}}getHostFromUrl(e){try{return new URL(e).host}catch{return"unknown"}}getPathFromUrl(e){try{const t=new URL(e);return t.pathname+t.search}catch{return"/"}}getBodySize(e){if(!e)return 0;try{return"string"==typeof e?new Blob([e]).size:e instanceof FormData?-1:e instanceof Blob?e.size:e instanceof ArrayBuffer?e.byteLength:new Blob([JSON.stringify(e)]).size}catch(t){return-1}}createTracedApiFunction(e,t,r={}){return async function(...n){const s=i();if(!s)return e.apply(this,n);const o=s.startSpan(t,{kind:d.CLIENT,attributes:{"operation.name":t,"component.name":"api_service","api.function":e.name||"anonymous",...r}});try{const t=await l.with(u.setSpan(l.active(),o),()=>e.apply(this,n));return o.setStatus({code:m.OK}),t}catch(a){throw o.recordException(a,{"error.type":"api_function_error","error.source":"wrapped_function"}),o.setStatus({code:m.ERROR,message:a.message||"API function failed"}),y(`API function error: ${t}`,{"operation.name":t,"api.function":e.name||"anonymous","error.type":"api_function_error","error.message":a.message,"error.name":a.name,...r},a),a}finally{o.end()}}}restore(){if(this.isInitialized)try{this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.isInitialized=!1}catch(e){}}};var S,L,O,R,x=-1,k=function(e){addEventListener("pageshow",function(t){t.persisted&&(x=t.timeStamp,e(t))},!0)},C=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},A=function(){var e=C();return e&&e.activationStart||0},P=function(e,t){var r=C(),n="navigate";return x>=0?n="back-forward-cache":r&&(document.prerendering||A()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},I=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},z=function(e,t,r,n){var i,s;return function(o){var a,c;t.value>=0&&(o||n)&&((s=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=s,t.rating=(a=t.value)>(c=r)[1]?"poor":a>c[0]?"needs-improvement":"good",e(t))}},F=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},N=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},D=function(e){var t=!1;return function(){t||(e(),t=!0)}},j=-1,U=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},H=function(e){"hidden"===document.visibilityState&&j>-1&&(j="visibilitychange"===e.type?e.timeStamp:0,V())},B=function(){addEventListener("visibilitychange",H,!0),addEventListener("prerenderingchange",H,!0)},V=function(){removeEventListener("visibilitychange",H,!0),removeEventListener("prerenderingchange",H,!0)},W=function(){return j<0&&(j=U(),B(),k(function(){setTimeout(function(){j=U(),B()},0)})),{get firstHiddenTime(){return j}}},M=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},G=[1800,3e3],$=function(e,t){t=t||{},M(function(){var r,n=W(),i=P("FCP"),s=I("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<n.firstHiddenTime&&(i.value=Math.max(e.startTime-A(),0),i.entries.push(e),r(!0)))})});s&&(r=z(e,i,G,t.reportAllChanges),k(function(n){i=P("FCP"),r=z(e,i,G,t.reportAllChanges),F(function(){i.value=performance.now()-n.timeStamp,r(!0)})}))})},q=[.1,.25],J=[2500,4e3],K={},X=function(e,t){t=t||{},M(function(){var r,n=W(),i=P("LCP"),s=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTime<n.firstHiddenTime&&(i.value=Math.max(e.startTime-A(),0),i.entries=[e],r())})},o=I("largest-contentful-paint",s);if(o){r=z(e,i,J,t.reportAllChanges);var a=D(function(){K[i.id]||(s(o.takeRecords()),o.disconnect(),K[i.id]=!0,r(!0))});["keydown","click"].forEach(function(e){addEventListener(e,function(){return function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=D(e),"hidden"===document.visibilityState?e():(r=t(e),N(e)),r}(a)},{once:!0,capture:!0})}),N(a),k(function(n){i=P("LCP"),r=z(e,i,J,t.reportAllChanges),F(function(){i.value=performance.now()-n.timeStamp,K[i.id]=!0,r(!0)})})}})},Q=[800,1800],Y=function e(t){document.prerendering?M(function(){return e(t)}):"complete"!==document.readyState?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Z=function(e,t){t=t||{};var r=P("TTFB"),n=z(e,r,Q,t.reportAllChanges);Y(function(){var i=C();i&&(r.value=Math.max(i.responseStart-A(),0),r.entries=[i],n(!0),k(function(){r=P("TTFB",0),(n=z(e,r,Q,t.reportAllChanges))(!0)}))})},ee={passive:!0,capture:!0},te=new Date,re=function(e,t){S||(S=t,L=e,O=new Date,se(removeEventListener),ne())},ne=function(){if(L>
1=0&&L<O-te){var e={entryType:"first-input",name:S.type,target:S.target,cancelable:S.cancelable,startTime:S.timeStamp,processingStart:S.timeStamp+L};R.forEach(function(t){t(e)}),R=[]}},ie=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?(r=t,n=e,i=function(){re(r,n),o()},s=function(){o()},o=function(){removeEventListener("pointerup",i,ee),removeEventListener("pointercancel",s,ee)},addEventListener("pointerup",i,ee),addEventListener("pointercancel",s,ee)):re(t,e)}var r,n,i,s,o},se=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach(function(t){return e(t,ie,ee)})},oe=[100,300];const ae=new class{constructor(){this.meter=null,this.tracer=null,this.isInitialized=!1,this.metrics=new Map,this.observers=new Map,this.webVitalsCollected=!1,this.pageLoadHistogram=null,this.interactionHistogram=null,this.resourceLoadHistogram=null,this.renderTimeHistogram=null,this.webVitalsGauges=new Map}async initialize(e={}){if(this.isInitialized)return;const{collectWebVitals:t=!0,collectResourceTiming:r=!0,collectUserTiming:n=!0,collectLongTasks:o=!0}=e;try{if(this.meter=s(),this.tracer=i(),!this.meter||!this.tracer)throw new Error("OpenTelemetry not properly initialized");this.initializeMetrics(),t&&this.initializeWebVitals(),r&&this.initializeResourceTimingObserver(),n&&this.initializeUserTimingObserver(),o&&this.initializeLongTaskObserver(),this.initializeNavigationObserver(),this.isInitialized=!0}catch(a){}}initializeMetrics(){this.pageLoadHistogram=this.meter.createHistogram("page_load_duration",{description:"Time taken for page to load completely",unit:"ms"}),this.interactionHistogram=this.meter.createHistogram("user_interaction_duration",{description:"Time taken for user interactions to complete",unit:"ms"}),this.resourceLoadHistogram=this.meter.createHistogram("resource_load_duration",{description:"Time taken for resources to load",unit:"ms"}),this.renderTimeHistogram=this.meter.createHistogram("component_render_duration",{description:"Time taken for React components to render",unit:"ms"}),this.webVitalsGauges.set("cls",this.meter.createGauge("web_vitals_cls",{description:"Cumulative Layout Shift score",unit:"score"})),this.webVitalsGauges.set("fid",this.meter.createGauge("web_vitals_fid",{description:"First Input Delay",unit:"ms"})),this.webVitalsGauges.set("fcp",this.meter.createGauge("web_vitals_fcp",{description:"First Contentful Paint",unit:"ms"})),this.webVitalsGauges.set("lcp",this.meter.createGauge("web_vitals_lcp",{description:"Largest Contentful Paint",unit:"ms"})),this.webVitalsGauges.set("ttfb",this.meter.createGauge("web_vitals_ttfb",{description:"Time to First Byte",unit:"ms"}))}initializeWebVitals(){try{e=e=>{this.recordWebVital("cls",e.value,{"metric.name":"CLS","metric.rating":this.getWebVitalRating("cls",e.value),"page.url":window.location.href})},t=t||{},$(D(function(){var r,n=P("CLS",0),i=0,s=[],o=function(e){e.forEach(function(e){if(!e.hadRecentInput){var t=s[0],r=s[s.length-1];i&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,s.push(e)):(i=e.value,s=[e])}}),i>n.value&&(n.value=i,n.entries=s,r())},a=I("layout-shift",o);a&&(r=z(e,n,q,t.reportAllChanges),N(function(){o(a.takeRecords()),r(!0)}),k(function(){i=0,n=P("CLS",0),r=z(e,n,q,t.reportAllChanges),F(function(){return r()})}),setTimeout(r,0))})),function(e,t){t=t||{},M(function(){var r,n=W(),i=P("FID"),s=function(e){e.startTime<n.firstHiddenTime&&(i.value=e.processingStart-e.startTime,i.entries.push(e),r(!0))},o=function(e){e.forEach(s)},a=I("first-input",o);r=z(e,i,oe,t.reportAllChanges),a&&(N(D(function(){o(a.takeRecords()),a.disconnect()})),k(function(){var n;i=P("FID"),r=z(e,i,oe,t.reportAllChanges),R=[],L=-1,S=null,se(addEventListener),n=s,R.push(n),ne()}))})}(e=>{this.recordWebVital("fid",e.value,{"metric.name":"FID","metric.rating":this.getWebVitalRating("fid",e.value),"page.url":window.location.href})}),$(e=>{this.recordWebVital("fcp",e.value,{"metric.name":"FCP","metric.rating":this.getWebVitalRating("fcp",e.value),"page.url":window.location.href})}),X(e=>{this.recordWebVital("lcp",e.value,{"metric.name":"LCP","metric.rating":this.getWebVitalRating("lcp",e.value),"page.url":window.location.href})}),Z(e=>{this.recordWebVital("ttfb",e.value,{"metric.name":"TTFB","metric.rating":this.getWebVitalRating("ttfb",e.value),"page.url":window.location.href})})}catch(r){}var e,t}recordWebVital(e,t,r={}){try{const n=this.webVitalsGauges.get(e);if(n&&n.record(t,r),this.tracer){const n=this.tracer.startSpan(`web_vital.${e}`,{kind:d.INTERNAL,attributes:{"web_vital.type":e,"web_vital.value":t,"web_vital.unit":"cls"===e?"score":"ms",...r}});n.setStatus({code:m.OK}),n.end()}}catch(n){}}getWebVitalRating(e,t){const r={cls:{good:.1,poor:.25},fid:{good:100,poor:300},fcp:{good:1800,poor:3e3},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}}[e];return r?t<=r.good?"good":t<=r.poor?"needs-improvement":"poor":"unknown"}initializeResourceTimingObserver(){try{if(!("PerformanceObserver"in window))return;const e=new PerformanceObserver(e=>{for(const t of e.getEntries())this.processResourceTiming(t)});e.observe({entryTypes:["resource"]}),this.observers.set("resource",e)}catch(e){}}processResourceTiming(e){try{const t=this.getResourceType(e.name,e.initiatorType),r=e.responseEnd-e.startTime;this.resourceLoadHistogram.record(r,{"resource.type":t,"resource.initiator":e.initiatorType,"resource.protocol":e.nextHopProtocol||"unknown","resource.cached":0===e.transferSize}),this.shouldCreateResourceSpan(e,r)&&this.createResourceSpan(e,r,t)}catch(t){}}getResourceType(e,t){var r;if("fetch"===t||"xmlhttprequest"===t)return"api";const n=null==(r=e.split(".").pop())?void 0:r.toLowerCase();return["js","mjs"].includes(n)?"script":["css"].includes(n)?"stylesheet":["png","jpg","jpeg","gif","webp","svg"].includes(n)?"image":["woff","woff2","ttf","otf"].includes(n)?"font":t||"other"}shouldCreateResourceSpan(e,t){return t>1e3||"fetch"===e.initiatorType||"xmlhttprequest"===e.initiatorType||0===e.responseEnd}createResourceSpan(e,t,r){try{const n=this.tracer.startSpan(`resource.${r}`,{kind:d.CLIENT,attributes:{"resource.url":e.name,"resource.type":r,"resource.initiator":e.initiatorType,"resource.size":e.transferSize||0,"resource.duration":t,"resource.dns_duration":e.domainLookupEnd-e.domainLookupStart,"resource.connect_duration":e.connectEnd-e.connectStart,"resource.request_duration":e.responseStart-e.requestStart,"resource.response_duration":e.responseEnd-e.responseStart}});e.responseEnd>0?n.setStatus({code:m.OK}):n.setStatus({code:m.ERROR,message:"Resource failed to load"}),n.end()}catch(n){}}initializeUserTimingObserver(){try{if(!("PerformanceObserver"in window))return;const e=new PerformanceObserver(e=>{for(const t of e.getEntries())this.processUserTiming(t)});e.observe({entryTypes:["mark","measure"]}),this.observers.set("usertiming",e)}catch(e){}}processUserTiming(e){try{const t={"timing.type":e.entryType,"timing.name":e.name,"timing.start_time":e.startTime,"timing.duration":e.duration,"page.url":window.location.href};if(this.meter){this.meter.createHistogram("user_timing_duration",{description:"User timing measurements",unit:"ms"}).record(e.duration,t)}if(this.tracer){const r=this.tracer.startSpan(`user_timing_${e.entryType}`,{kind:d.INTERNAL,startTime:performance.timeOrigin+e.startTime,attributes:t});r.setStatus({code:m.OK}),r.end(performance.timeOrigin+e.startTime+e.duration)}}catch(t){}}initializeLongTaskObserver(){try{if(!("PerformanceObserver"in window))return;const e=new PerformanceObserver(e=>{for(const t of e.getEntries())this.processLongTask(t)});e.observe({entryTypes:["longtask"]}),this.observers.set("longtask",e)}catch(e){}}processLongTask(e){var t,r,n,i;try{const s=e.duration;this.meter.createHistogram("long_task_duration",{description:"Duration of long tasks that block the main thread",unit:"ms"}).record(s,{"task.type":"longtask","task.attribution":(null==(r=null==(t=e.attribution)?void 0:t[0])?void 0:r.name)||"unknown"});const o=this.tracer.startSpan("performance.long_task",{kind:d.INTERNAL,attributes:{"task.duration":s,"task.start_time":e.startTime,"task.attribution":(null==(i=null==(n=e.attribution)?void 0:n[0])?void 0:i.name)||"unknown","performance.issue":!0}});o.setStatus({code:m.ERROR,message:`Long task blocked main thread for ${s}ms`}),o.end()}catch(s){}}initializeNavigationObserver(){try{const e=history.pushState,t=history.replaceState,r=(e,t)=>{this.recordNavigation(e,t)};history.pushState=function(...t){const n=e.apply(this,t);return r("pushState",t[2]||window.location.href),n},history.replaceState=function(...e){const n=t.apply(this,e);return r("replaceState",e[2]||window.location.href),n},window.addEventListener("popstate",()=>{r("popstate",window.location.href)})}catch(e){}}recordNavigation(e,t){try{this.meter.createCounter("spa_navigation",{description:"Single Page Application navigation events"}).add(1,{"navigation.method":e,"navigation.url":t,"page.title":document.title});const r=this.tracer.startSpan("spa.navigate",{kind:d.INTERNAL,attributes:{"navigation.method":e,"navigation.from":window.location.href,"navigation.to":t,"page.title":document.title}}
1);r.setStatus({code:m.OK}),r.end()}catch(r){}}async measureCustomTiming(e,t,r={}){const n=performance.now();try{const i=await t(),s=performance.now()-n;return this.meter.createHistogram("custom_timing_duration",{description:"Duration of custom performance measurements",unit:"ms"}).record(s,{"timing.name":e,"timing.success":!0,...r}),i}catch(i){const t=performance.now()-n;throw this.meter.createHistogram("custom_timing_duration",{description:"Duration of custom performance measurements",unit:"ms"}).record(t,{"timing.name":e,"timing.success":!1,"error.type":i.constructor.name,...r}),i}}cleanup(){try{for(const[e,t]of this.observers)t.disconnect();this.observers.clear(),this.isInitialized=!1}catch(e){}}};const ce=new class{constructor(){this.telemetryManager=r()}async runDiagnostics(){this.checkConfiguration(),await this.checkInfrastructureConnectivity(),this.checkServiceRegistration(),await this.generateTestData(),this.checkExportStatus()}checkConfiguration(){}async checkInfrastructureConnectivity(){const e=[{name:"Traces",url:t.endpoints.traces},{name:"Metrics",url:t.endpoints.metrics},{name:"Logs",url:t.endpoints.logs}];for(const t of e)try{const e=new URL(t.url),r=`${e.protocol}//${e.host}`,n=await fetch(r,{method:"GET",signal:AbortSignal.timeout(5e3)});n.ok||n.status}catch(r){t.url.includes("localhost")}}checkServiceRegistration(){var e;if(null==(e=this.telemetryManager)?void 0:e.isInitialized())try{const e=this.telemetryManager.tracerProvider;this.telemetryManager.meterProvider;if(null==e?void 0:e.resource){const t=e.resource.attributes;Object.entries(t).forEach(([e,t])=>{})}}catch(t){}}async generateTestData(){try{const e=i(),t=s();if(!e||!t)return;const r=e.startSpan("debug_test_operation",{attributes:{"debug.test":!0,"debug.timestamp":Date.now(),"debug.user_agent":navigator.userAgent}});r.addEvent("debug_test_started"),r.setAttributes({"debug.page_url":window.location.href,"debug.session_id":sessionStorage.getItem("otel_session_id")});const n=t.createCounter("debug_test_counter",{description:"Test counter for debugging"}),o=t.createHistogram("debug_test_histogram",{description:"Test histogram for debugging",unit:"ms"});n.add(1,{"debug.test":"counter"}),o.record(123.45,{"debug.test":"histogram"}),w("Debug test log message",{debug:{test:!0,timestamp:(new Date).toISOString(),trace_context:r.spanContext()}}),r.addEvent("debug_test_completed"),r.end()}catch(e){e("Debug test failed",{error:e.message})}}listActiveMetrics(){}listTracingCapabilities(){}async createUserJourneyTrace(){try{const e=i();if(!e)return;const t=e.startSpan("user_journey",{attributes:{"user.journey":"checkout_flow","session.id":"demo_session_123","user.type":"returning"}}),r=e.startSpan("page_load",{parent:t,attributes:{"page.route":"/checkout","page.title":"Checkout Page"}});await new Promise(e=>setTimeout(e,150)),r.addEvent("dom_content_loaded"),await new Promise(e=>setTimeout(e,50)),r.addEvent("page_fully_loaded"),r.end();const n=e.startSpan("user_interaction",{parent:t,attributes:{"interaction.type":"form_fill","form.name":"checkout_form"}});n.addEvent("form_field_focus",{field:"email"}),await new Promise(e=>setTimeout(e,100)),n.addEvent("form_validation",{status:"success"}),n.end();const s=e.startSpan("HTTP POST /api/orders",{parent:t,attributes:{"http.method":"POST","http.url":"/api/orders","http.route":"/api/orders","api.version":"v1"}});s.addEvent("request_sent"),await new Promise(e=>setTimeout(e,200)),s.setAttributes({"http.status_code":201,"order.id":"ORD-12345","order.total":99.99}),s.addEvent("response_received",{order_created:!0}),s.end();const o=e.startSpan("navigation",{parent:t,attributes:{"navigation.from":"/checkout","navigation.to":"/order-confirmation","navigation.type":"programmatic"}});await new Promise(e=>setTimeout(e,50)),o.end(),t.addEvent("journey_completed",{success:!0,total_duration_ms:Date.now()-t.startTime}),t.end()}catch(e){}}async forceFlushTraces(){try{const e=r();if(!(null==e?void 0:e.tracerProvider))return;await e.tracerProvider.forceFlush()}catch(e){}}async testManualSpanExport(){try{const n=i(),s=r();if(!n||!(null==s?void 0:s.tracerProvider))return;const o=n.startSpan("manual_export_test",{attributes:{"test.type":"manual_export","test.bypass_batch":!0}});o.addEvent("span_created_for_manual_export"),o.end();const{OTLPTraceExporter:a}=await e(async()=>{const{OTLPTraceExporter:e}=await import("./vendor-otel-B3hnpEUX.js").then(e=>e.j);return{OTLPTraceExporter:e}},[]),c=new a({url:t.endpoints.traces,headers:t.headers});s.tracerProvider.resource;c.export([o],e=>{e.code})}catch(n){}}testSpanStructure(){var e;try{const t=i();if(!t)return;const r=t.startSpan("structure_test",{attributes:{"test.type":"structure_inspection"}});r.addEvent("span_created"),r.end(),null==(e=r.resource)||e.attributes}catch(t){}}diagnoseTelemetryExports(){var e;try{const t=r();if(null==t?void 0:t.tracerProvider){t.tracerProvider._spanProcessors||(null==(e=t.tracerProvider.activeSpanProcessor)||e._spanProcessors)}if(null==t?void 0:t.loggerProvider){t.loggerProvider._logRecordProcessors}this.testNetworkConnectivity(),setTimeout(()=>{this.monitorNetworkExports(),setTimeout(()=>{this.createJaegerTestTrace(),setTimeout(()=>{this.createTestLogs()},1e3)},1e3)},2e3)}catch(t){}}createTestLogs(){try{const e=n();if(!e)return;[{severityText:"INFO",body:"Test info log from OpenTelemetry",attributes:{"test.type":"info_log","test.source":"debug_utility","user.action":"test_logging"}},{severityText:"WARN",body:"Test warning log from OpenTelemetry",attributes:{"test.type":"warn_log","test.source":"debug_utility","warning.category":"test_warning"}},{severityText:"ERROR",body:"Test error log from OpenTelemetry",attributes:{"test.type":"error_log","test.source":"debug_utility","error.test":!0}}
1].forEach((r,n)=>{e.emit({timestamp:Date.now(),severityNumber:"INFO"===r.severityText?9:"WARN"===r.severityText?13:17,severityText:r.severityText,body:r.body,attributes:{...r.attributes,timestamp_iso:(new Date).toISOString(),"service.name":t.service.name,"service.version":t.service.version}})})}catch(e){}}async testExporterDirectly(){try{const{OTLPTraceExporter:n}=await e(async()=>{const{OTLPTraceExporter:e}=await import("./vendor-otel-B3hnpEUX.js").then(e=>e.j);return{OTLPTraceExporter:e}},[]);new n({url:t.endpoints.traces,headers:t.headers});try{const e=await fetch(t.endpoints.traces,{method:"POST",headers:{"Content-Type":"application/json",...t.headers},body:JSON.stringify({resourceSpans:[{resource:{attributes:[{key:"service.name",value:{stringValue:"test"}}]},scopeSpans:[{spans:[{traceId:"12345678901234567890123456789012",spanId:"1234567890123456",name:"test-connectivity",kind:1,startTimeUnixNano:1e6*Date.now(),endTimeUnixNano:1e6*(Date.now()+100),status:{code:1}}]}]}]})});if(e.ok);else{await e.text()}}catch(r){}}catch(n){}}async testTraceExport(){try{const e=i();if(!e)return;const r=e.startSpan("trace_export_test",{attributes:{"test.type":"export_verification","test.timestamp":Date.now(),"test.immediate":!0}});r.addEvent("test_span_created"),r.setAttributes({"test.status":"active","export.endpoint":t.endpoints.traces}),r.addEvent("test_span_ending"),r.end(),setTimeout(async()=>{await this.forceFlushTraces()},1e3),setTimeout(()=>{},3e3)}catch(e){}}async testApiTracing(){try{const t="/api/test-trace-correlation";try{await fetch(t,{method:"GET",headers:{"X-Test-Trace":"true","Content-Type":"application/json"}})}catch(e){}}catch(e){}}createTestMetrics(){try{const e=s();if(!e)return;const t=e.createCounter("test_counter",{description:"Test counter metric"}),r=e.createHistogram("test_histogram",{description:"Test histogram metric",unit:"ms"}),n=e.createGauge("test_gauge",{description:"Test gauge metric"});t.add(1,{test:"counter",source:"debug"}),t.add(5,{test:"counter",source:"debug"}),r.record(100,{test:"histogram",source:"debug"}),r.record(250,{test:"histogram",source:"debug"}),r.record(75,{test:"histogram",source:"debug"}),n.record(42,{test:"gauge",source:"debug"})}catch(e){}}checkExportStatus(){}async createJaegerTestTrace(){const e=i();if(!e)return;const r=e.startSpan("jaeger_test_trace",{attributes:{"service.name":t.service.name,"test.type":"jaeger_verification","test.timestamp":(new Date).toISOString(),"test.user":"debug_user",component:"frontend"}}),n=e.startSpan("frontend_operation",{parent:r,attributes:{"operation.type":"user_interaction","operation.name":"test_button_click"}}),s=e.startSpan("api_call_simulation",{parent:r,attributes:{"http.method":"GET","http.url":"/api/test","http.status_code":200}});r.addEvent("test_trace_started",{"event.type":"debug","event.description":"This trace was created for Jaeger verification"}),n.addEvent("user_interaction_detected"),s.addEvent("api_response_received"),s.end(),n.end(),r.addEvent("test_trace_completed"),r.end()}monitorNetworkExports(){const e=window.fetch;window.fetch=function(...t){const r=t[0],n=t[1]||{};return"string"==typeof r&&r.includes("4318")&&(r.includes("/v1/traces")||r.includes("/v1/metrics")||r.includes("/v1/logs"),n.body),e.apply(this,t)}}};async function ue(r={}){const{userInfo:n={},apiEndpoints:i=[],enableWebVitals:s=!0}=r;try{if(!(await a()))throw new Error("Failed to initialize core telemetry");if(await v({enableConsoleOutput:t.features.consoleLogging,enableOtelExport:t.features.logs}),"undefined"!=typeof window){const{logger:t}=await e(async()=>{const{logger:e}=await Promise.resolve().then(()=>T);return{logger:e}},void 0);window.__otel_logger=t}return((e={})=>{E.initialize(e)})({enabledEndpoints:i.length>0?i:[/\/api\//,/localhost:\d+\//,/.*\.tabiri\./],disabledEndpoints:[/telemetry/,/health/,/favicon\.ico/],propagateHeaders:!0}),(t.features.webVitals||s)&&await((e={})=>ae.initialize(e))({collectWebVitals:!0,collectResourceTiming:!0,collectUserTiming:!0,collectLongTasks:!0}),n&&Object.keys(n).length>0&&o(n),window.addEventListener("error",e=>{try{const{error:t,filename:r,lineno:n,colno:i}=e;window.__otel_logger&&window.__otel_logger.error("Uncaught JavaScript error",{error_type:"uncaught_error",filename:r,lineno:n,colno:i,message:e.message,stack:null==t?void 0:t.stack},t)}catch(t){}}),window.addEventListener("unhandledrejection",e=>{var t;try{const r=e.reason;window.__otel_logger&&window.__otel_logger.error("Unhandled promise rejection",{error_type:"unhandled_rejection",promise:null==(t=e.promise)?void 0:t.toString(),reason:null==r?void 0:r.toString(),stack:null==r?void 0:r.stack},r instanceof Error?r:new Error(r))}catch(r){}}),function(){const e=async()=>{try{await c()}catch(e){}};window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&e()})}(),!0}catch(u){return!1}}function le(e,t={}){try{const r={"user.id":e.userId,"user.role":e.userRole,"user.subscription":e.subscription,"user.authenticated":!!e.userId,...t};o(r),window.__otel_logger&&window.__otel_logger.updateContext(r)}catch(r){}}function de(e,t={},r={}){try{const n={"route.name":e,"route.path":window.location.pathname,"route.search":window.location.search,"route.hash":window.location.hash,"page.title":document.title,"page.url":window.location.href,...Object.fromEntries(Object.entries(t).map(([e,t])=>[`route.param.${e}`,t])),...r};window.__otel_logger&&window.__otel_logger.updateContext(n)}catch(n){}}function pe(){var e;try{return{telemetryInitialized:(null==(e=window.__otel_telemetry_manager)?void 0:e.isInitialized())||!1,tracingEnabled:t.features.tracing,metricsEnabled:t.features.metrics,logsEnabled:t.features.logs,webVitalsEnabled:t.features.webVitals,environment:t.environment,serviceName:t.service.name,serviceVersion:t.service.version}}catch(r){return{error:r.message}}}function me(){t.environment}window.__otel_debug=()=>ce.runDiagnostics(),window.__otel_list_traces=()=>ce.listTracingCapabilities(),window.__otel_flush=()=>ce.forceFlushTraces(),window.__otel_test_export=()=>ce.testTraceExport(),window.__otel_test_manual_export=()=>ce.testManualSpanExport(),window.__otel_test_span_structure=()=>ce.testSpanStructure(),window.__otel_test_exporter_direct=()=>ce.testExporterDirectly(),window.__otel_test_jaeger=()=>ce.createJaegerTestTrace(),window.__otel_create_user_journey=()=>ce.createUserJourneyTrace(),window.__otel_test_api_trace=()=>ce.testApiTracing(),window.__otel_monitor_network=()=>ce.monitorNetworkExports(),window.__otel_list_metrics=()=>ce.listActiveMetrics(),window.__otel_create_test_metrics=()=>ce.createTestMetrics(),window.__otel_create_test_logs=()=>ce.createTestLogs(),window.__otel_diagnose=()=>ce.diagnoseTelemetryExports(),window.__otel_test_all=()=>{window.__otel_telemetry_manager,setTimeout(()=>{window.__otel_test_jaeger()},1e3),setTimeout(()=>{window.__otel_create_test_metrics()},2e3),setTimeout(()=>{window.__otel_create_test_logs()},3e3),setTimeout(()=>{window.__otel_test_manual_export()},4e3)},"undefined"!=typeof window&&"development"===t.environment&&(window.__otel_debug=me,window.__otel_status=pe);const ge={initializeObservability:ue,updateObservabilityUserContext:le,setObservabilityRouteContext:de,getObservabilityStatus:pe,debugObservability:me};export{t as OTEL_CONFIG,me as debugObservability,ge as default,pe as getObservabilityStatus,ue as initializeObservability,de as setObservabilityRouteContext,le as updateObservabilityUserContext};

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.