// @bun
var{defineProperty:i,getOwnPropertyNames:l,getOwnPropertyDescriptor:S}=Object,g=Object.prototype.hasOwnProperty;function p(e){return this[e]}var v=(e)=>{var r=(a??=new WeakMap).get(e),n;if(r)return r;if(r=i({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var t of l(e))if(!g.call(r,t))i(r,t,{get:p.bind(e,t),enumerable:!(n=S(e,t))||n.enumerable})}return a.set(e,r),r},a;var E=(e)=>e;function c(e,r){this[e]=E.bind(null,r)}var d=(e,r)=>{for(var n in r)i(e,n,{get:r[n],enumerable:!0,configurable:!0,set:c.bind(r,n)})};var y=(e,r)=>()=>(e&&(r=e(e=0)),r);function T(e,r,n){return{type:"telemetry",contextId:e,signal:u(r,n)}}function s(e,r,n){return{type:"error",contextId:e,signal:w(r,n)}}function h(e,r,n){return{type:"behavior",contextId:e,signal:m(r,n)}}function u(e,r){return{...e,windowStart:o(e.windowStart,r),windowEnd:o(e.windowEnd,r)}}function w(e,r){return{...e,occurredAt:o(e.occurredAt,r)}}function m(e,r){return{...e,windowStart:o(e.windowStart,r),windowEnd:o(e.windowEnd,r)}}function o(e,r){if(e instanceof Date)return e;let n=new Date(e);if(Number.isNaN(n.getTime()))return r();return n}export{T as telemetryToEnvelope,s as errorToEnvelope,h as behaviorToEnvelope};
