1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_tovtKVe.js","assets/jsx-runtime-Dt5Dsy05.js","assets/preload-helper-D7HrI6pR.js"])))=>i.map(i=>d[i]); 2var lt=Object.defineProperty;var ft=(r,e,t)=>e in r?lt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var g=(r,e,t)=>ft(r,typeof e!="symbol"?e+"":e,t);import{_ as dt}from"./preload-helper-D7HrI6pR.js";import{b as pt,c as mt}from"./jsx-runtime-Dt5Dsy05.js";var Se=function(r,e){return Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Se(r,e)};function pe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Se(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var b=function(){return b=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},b.apply(this,arguments)};function yt(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function N(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function c(p){try{f(n.next(p))}catch(_){o(_)}}function a(p){try{f(n.throw(p))}catch(_){o(_)}}function f(p){p.done?s(p.value):i(p.value).then(c,a)}f((n=n.apply(r,e||[])).next())})}function k(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=c(0),o.throw=c(1),o.return=c(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(f){return function(p){return a([f,p])}}function a(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){t.label=f[1];break}if(f[0]===6&&t.label<s[1]){t.label=s[1],s=f;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(f);break}s[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(p){f=[6,p],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function De(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return r.concat(s||Array.prototype.slice.call(e))}function Ae(r,e,t){e.split&&(e=e.split("."));for(var n=0,i=e.length,s=r,o,c;n<i&&(c=""+e[n++],!(c==="__proto__"||c==="constructor"||c==="prototype"));)s=s[c]=n===i?t:typeof(o=s[c])==typeof e?o:e[n]*0!==0||~(""+e[n]).indexOf(".")?{}:[]}var vt=function(r,e){return Object.keys(r).filter(function(t){return e(t,r[t])}).reduce(function(t,n){return t[n]=r[n],t},{})},W=function(r){pe(e,r);function e(t,n){var i=r.call(this,"".concat(t," ").concat(n))||this;return i.field=t,i}return e}(Error);function me(r){return typeof r=="string"}function Be(r){return r!=null}function Ue(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()==="object"}var ye="is not a string",Ce="is not an object",je="is nil";function gt(r){var e=".userId/anonymousId/previousId/groupId",t=function(i){var s,o,c;return(c=(o=(s=i.userId)!==null&&s!==void 0?s:i.anonymousId)!==null&&o!==void 0?o:i.groupId)!==null&&c!==void 0?c:i.previousId},n=t(r);if(Be(n)){if(!me(n))throw new W(e,ye)}else throw new W(e,je)}function _t(r){if(!Be(r))throw new W("Event",je);if(typeof r!="object")throw new W("Event",Ce)}function bt(r){if(!me(r.type))throw new W(".type",ye)}function Et(r){if(!me(r.event))throw new W(".event",ye)}function wt(r){if(!Ue(r.properties))throw new W(".properties",Ce)}function xt(r){if(!Ue(r.traits))throw new W(".traits",Ce)}function St(r){if(!me(r.messageId))throw new W(".messageId",ye)}function At(r){_t(r),bt(r),St(r),r.type==="track"&&(Et(r),wt(r)),["group","identify"].includes(r.type)&&xt(r)}var Tt=function(){function r(e){var t,n;this.settings=e,this.createMessageId=e.createMessageId,this.onEventMethodCall=(t=e.onEventMethodCall)!==null&&t!==void 0?t:function(){},this.onFinishedEvent=(n=e.onFinishedEvent)!==null&&n!==void 0?n:function(){}}return r}(),Ft=function(){function r(e){this.settings=new Tt(e)}return r.prototype.track=function(e,t,n,i){return this.settings.onEventMethodCall({type:"track",options:n}),this.normalize(b(b({},this.baseEvent()),{event:e,type:"track",properties:t??{},options:b({},n),integrations:b({},i)}))},r.prototype.page=function(e,t,n,i,s){var o;this.settings.onEventMethodCall({type:"page",options:i});var c={type:"page",properties:b({},n),options:b({},i),integrations:b({},s)};return e!==null&&(c.category=e,c.properties=(o=c.properties)!==null&&o!==void 0?o:{},c.properties.category=e),t!==null&&(c.name=t),this.normalize(b(b({},this.baseEvent()),c))},r.prototype.screen=function(e,t,n,i,s){this.settings.onEventMethodCall({type:"screen",options:i});var o={type:"screen",properties:b({},n),options:b({},i),integrations:b({},s)};return e!==null&&(o.category=e),t!==null&&(o.name=t),this.normalize(b(b({},this.baseEvent()),o))},r.prototype.identify=function(e,t,n,i){return this.settings.onEventMethodCall({type:"identify",options:n}),this.normalize(b(b({},this.baseEvent()),{type:"identify",userId:e,traits:t??{},options:b({},n),integrations:i}))},r.prototype.group=function(e,t,n,i){return this.settings.onEventMethodCall({type:"group",options:n}),this.normalize(b(b({},this.baseEvent()),{type:"group",traits:t??{},options:b({},n),integrations:b({},i),groupId:e}))},r.prototype.alias=function(e,t,n,i){this.settings.onEventMethodCall({type:"alias",options:n});var s={userId:e,type:"alias",options:b({},n),integrations:b({},i)};return t!==null&&(s.previousId=t),e===void 0?this.normalize(b(b({},s),this.baseEvent())):this.normalize(b(b({},this.baseEvent()),s))},r.prototype.baseEvent=function(){return{integrations:{},options:{}}},r.prototype.context=function(e){var t,n=["userId","anonymousId","timestamp","messageId"];delete e.integrations;var i=Object.keys(e),s=(t=e.context)!==null&&t!==void 0?t:{},o={};
2return i.forEach(function(c){c!=="context"&&(n.includes(c)?Ae(o,c,e[c]):Ae(s,c,e[c]))}),[s,o]},r.prototype.normalize=function(e){var t,n,i=Object.keys((t=e.integrations)!==null&&t!==void 0?t:{}).reduce(function(I,x){var F,R;return b(b({},I),(F={},F[x]=!!(!((R=e.integrations)===null||R===void 0)&&R[x]),F))},{});e.options=vt(e.options||{},function(I,x){return x!==void 0});var s=b(b({},i),(n=e.options)===null||n===void 0?void 0:n.integrations),o=e.options?this.context(e.options):[],c=o[0],a=o[1],f=e.options,p=yt(e,["options"]),_=b(b(b(b({timestamp:new Date},p),{context:c,integrations:s}),a),{messageId:f.messageId||this.settings.createMessageId()});return this.settings.onFinishedEvent(_),At(_),_},r}();function Le(r,e){return new Promise(function(t,n){var i=setTimeout(function(){n(Error("Promise timed out"))},e);r.then(function(s){return clearTimeout(i),t(s)}).catch(n)})}function qe(r){return new Promise(function(e){return setTimeout(e,r)})}function It(r,e,t){var n=function(){try{return Promise.resolve(e(r))}catch(i){return Promise.reject(i)}};return qe(t).then(function(){return Le(n(),1e3)}).catch(function(i){r==null||r.log("warn","Callback Error",{error:i}),r==null||r.stats.increment("callback_error")}).then(function(){return r})}var Ct=function(){var r,e,t=!1,n=new Promise(function(i,s){r=function(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];t=!0,i.apply(void 0,o)},e=function(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];t=!0,s.apply(void 0,o)}});return{resolve:r,reject:e,promise:n,isSettled:function(){return t}}},ie=function(){function r(e){var t;this.callbacks={},this.warned=!1,this.maxListeners=(t=e==null?void 0:e.maxListeners)!==null&&t!==void 0?t:10}return r.prototype.warnIfPossibleMemoryLeak=function(e){this.warned||this.maxListeners&&this.callbacks[e].length>this.maxListeners&&(console.warn("Event Emitter: Possible memory leak detected; ".concat(String(e)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0)},r.prototype.on=function(e,t){return this.callbacks[e]?(this.callbacks[e].push(t),this.warnIfPossibleMemoryLeak(e)):this.callbacks[e]=[t],this},r.prototype.once=function(e,t){var n=this,i=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];n.off(e,i),t.apply(n,s)};return this.on(e,i),this},r.prototype.off=function(e,t){var n,i=(n=this.callbacks[e])!==null&&n!==void 0?n:[],s=i.filter(function(o){return o!==t});return this.callbacks[e]=s,this},r.prototype.emit=function(e){for(var t=this,n,i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];var o=(n=this.callbacks[e])!==null&&n!==void 0?n:[];return o.forEach(function(c){c.apply(t,i)}),this},r}();function Re(r){var e=Math.random()+1,t=r.minTimeout,n=t===void 0?500:t,i=r.factor,s=i===void 0?2:i,o=r.attempt,c=r.maxTimeout,a=c===void 0?1/0:c;return Math.min(e*n*Math.pow(s,o),a)}var ze="onRemoveFromFuture",Rt=function(r){pe(e,r);function e(t,n,i){var s=r.call(this)||this;return s.future=[],s.maxAttempts=t,s.queue=n,s.seen=i??{},s}return e.prototype.push=function(){for(var t=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var s=n.map(function(o){var c=t.updateAttempts(o);return c>t.maxAttempts||t.includes(o)?!1:(t.queue.push(o),!0)});return this.queue=this.queue.sort(function(o,c){return t.getAttempts(o)-t.getAttempts(c)}),s},e.prototype.pushWithBackoff=function(t,n){var i=this;if(n===void 0&&(n=0),n==0&&this.getAttempts(t)===0)return this.push(t)[0];var s=this.updateAttempts(t);if(s>this.maxAttempts||this.includes(t))return!1;var o=Re({attempt:s-1});return n>0&&o<n&&(o=n),setTimeout(function(){i.queue.push(t),i.future=i.future.filter(function(c){return c.id!==t.id}),i.emit(ze)},o),this.future.push(t),!0},e.prototype.getAttempts=function(t){var n;return(n=this.seen[t.id])!==null&&n!==void 0?n:0},e.prototype.updateAttempts=function(t){return this.seen[t.id]=this.getAttempts(t)+1,this.getAttempts(t)},e.prototype.includes=function(t){return this.queue.includes(t)||this.future.includes(t)||!!this.queue.find(function(n){return n.id===t.id})||!!this.future.find(function(n){return n.id===t.id})},e.prototype.pop=function(){return this.queue.shift()}
2,Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),e}(ie),G=256,ce=[],ae;for(;G--;)ce[G]=(G+256).toString(16).substring(1);function ve(){var r=0,e,t="";if(!ae||G+16>256){for(ae=Array(r=256);r--;)ae[r]=256*Math.random()|0;r=G=0}for(;r<16;r++)e=ae[G+r],r==6?t+=ce[e&15|64]:r==8?t+=ce[e&63|128]:t+=ce[e],r&1&&r>1&&r<11&&(t+="-");return G++,t}var Pt=function(){function r(){this._logs=[]}return r.prototype.log=function(e,t,n){var i=new Date;this._logs.push({level:e,message:t,time:i,extras:n})},Object.defineProperty(r.prototype,"logs",{get:function(){return this._logs},enumerable:!1,configurable:!0}),r.prototype.flush=function(){if(this.logs.length>1){var e=this._logs.reduce(function(t,n){var i,s,o,c=b(b({},n),{json:JSON.stringify(n.extras,null," "),extras:n.extras});delete c.time;var a=(o=(s=n.time)===null||s===void 0?void 0:s.toISOString())!==null&&o!==void 0?o:"";return t[a]&&(a="".concat(a,"-").concat(Math.random())),b(b({},t),(i={},i[a]=c,i))},{});console.table?console.table(e):console.log(e)}else this.logs.forEach(function(t){var n=t.level,i=t.message,s=t.extras;n==="info"||n==="debug"?console.log(i,s??""):console[n](i,s??"")});this._logs=[]},r}(),Ot=function(r){var e={gauge:"g",counter:"c"};return e[r]},Dt=function(){function r(){this.metrics=[]}return r.prototype.increment=function(e,t,n){t===void 0&&(t=1),this.metrics.push({metric:e,value:t,tags:n??[],type:"counter",timestamp:Date.now()})},r.prototype.gauge=function(e,t,n){this.metrics.push({metric:e,value:t,tags:n??[],type:"gauge",timestamp:Date.now()})},r.prototype.flush=function(){var e=this.metrics.map(function(t){return b(b({},t),{tags:t.tags.join(",")})});console.table?console.table(e):console.log(e),this.metrics=[]},r.prototype.serialize=function(){return this.metrics.map(function(e){return{m:e.metric,v:e.value,t:e.tags,k:Ot(e.type),e:e.timestamp}})},r}(),Kt=function(r){pe(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.gauge=function(){},e.prototype.increment=function(){},e.prototype.flush=function(){},e.prototype.serialize=function(){return[]},e}(Dt),he=function(){function r(e){var t,n,i;this.retry=(t=e.retry)!==null&&t!==void 0?t:!0,this.type=(n=e.type)!==null&&n!==void 0?n:"plugin Error",this.reason=(i=e.reason)!==null&&i!==void 0?i:""}return r}(),le=function(){function r(e,t,n,i){t===void 0&&(t=ve()),n===void 0&&(n=new Kt),i===void 0&&(i=new Pt),this.attempts=0,this.event=e,this._id=t,this.logger=i,this.stats=n}return r.system=function(){},r.prototype.isSame=function(e){return e.id===this.id},r.prototype.cancel=function(e){throw e||new he({reason:"Context Cancel"})},r.prototype.log=function(e,t,n){this.logger.log(e,t,n)},Object.defineProperty(r.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),r.prototype.updateEvent=function(e,t){var n;if(e.split(".")[0]==="integrations"){var i=e.split(".")[1];if(((n=this.event.integrations)===null||n===void 0?void 0:n[i])===!1)return this.event}return Ae(this.event,e,t),this.event},r.prototype.failedDelivery=function(){return this._failedDelivery},r.prototype.setFailedDelivery=function(e){this._failedDelivery=e},r.prototype.logs=function(){return this.logger.logs},r.prototype.flush=function(){this.logger.flush(),this.stats.flush()},r.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},r}();function Nt(r,e){var t={};return r.forEach(function(n){var i,s=void 0;{var o=n[e];
2s=typeof o!="string"?JSON.stringify(o):o}s!==void 0&&(t[s]=De(De([],(i=t[s])!==null&&i!==void 0?i:[],!0),[n],!1))}),t}var kt=function(r){return typeof r=="object"&&r!==null&&"then"in r&&typeof r.then=="function"},Wt=function(){var r,e,t=0;return{done:function(){return r},run:function(n){var i=n();return kt(i)&&(++t===1&&(r=new Promise(function(s){return e=s})),i.finally(function(){return--t===0&&e()})),i}}};function Mt(r){return N(this,void 0,void 0,function(){var e;return k(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,r()];case 1:return[2,t.sent()];case 2:return e=t.sent(),[2,Promise.reject(e)];case 3:return[2]}})})}function ue(r,e){r.log("debug","plugin",{plugin:e.name});var t=new Date().getTime(),n=e[r.event.type];if(n===void 0)return Promise.resolve(r);var i=Mt(function(){return n.apply(e,[r])}).then(function(s){var o=new Date().getTime()-t;return s.stats.gauge("plugin_time",o,["plugin:".concat(e.name)]),s}).catch(function(s){if(s instanceof he&&s.type==="middleware_cancellation")throw s;return s instanceof he?(r.log("warn",s.type,{plugin:e.name,error:s}),s):(r.log("error","plugin Error",{plugin:e.name,error:s}),r.stats.increment("plugin_error",1,["plugin:".concat(e.name)]),s)});return i}function Ht(r,e){return ue(r,e).then(function(t){if(t instanceof le)return t;r.log("debug","Context canceled"),r.stats.increment("context_canceled"),r.cancel(t)})}var Jt=function(r){pe(e,r);function e(t){var n=r.call(this)||this;return n.criticalTasks=Wt(),n.plugins=[],n.failedInitializations=[],n.flushing=!1,n.queue=t,n.queue.on(ze,function(){n.scheduleFlush(0)}),n}return e.prototype.register=function(t,n,i){return N(this,void 0,void 0,function(){var s,o,c=this;return k(this,function(a){switch(a.label){case 0:return this.plugins.push(n),s=function(f){c.failedInitializations.push(n.name),c.emit("initialization_failure",n),console.warn(n.name,f),t.log("warn","Failed to load destination",{plugin:n.name,error:f}),c.plugins=c.plugins.filter(function(p){return p!==n})},n.type==="destination"&&n.name!=="Segment.io"?(n.load(t,i).catch(s),[3,4]):[3,1];case 1:return a.trys.push([1,3,,4]),[4,n.load(t,i)];case 2:return a.sent(),[3,4];case 3:return o=a.sent(),s(o),[3,4];case 4:return[2]}})})},e.prototype.deregister=function(t,n,i){return N(this,void 0,void 0,function(){var s;return k(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),n.unload?[4,Promise.resolve(n.unload(t,i))]:[3,2];case 1:o.sent(),o.label=2;case 2:return this.plugins=this.plugins.filter(function(c){return c.name!==n.name}),[3,4];case 3:return s=o.sent(),t.log("warn","Failed to unload destination",{plugin:n.name,error:s}),[3,4];case 4:return[2]}})})},e.prototype.dispatch=function(t){return N(this,void 0,void 0,function(){var n;return k(this,function(i){return t.log("debug","Dispatching"),t.stats.increment("message_dispatched"),this.queue.push(t),n=this.subscribeToDelivery(t),this.scheduleFlush(0),[2,n]})})},e.prototype.subscribeToDelivery=function(t){return N(this,void 0,void 0,function(){var n=this;return k(this,function(i){return[2,new Promise(function(s){var o=function(c,a){c.isSame(t)&&(n.off("flush",o),s(c))};n.on("flush",o)})]})})},e.prototype.dispatchSingle=function(t){return N(this,void 0,void 0,function(){var n=this;return k(this,function(i){return t.log("debug","Dispatching"),t.stats.increment("message_dispatched"),this.queue.updateAttempts(t),t.attempts=1,[2,this.deliver(t).catch(function(s){var o=n.enqueuRetry(s,t);return o?n.subscribeToDelivery(t):(t.setFailedDelivery({reason:s}),t)})]})})},e.prototype.isEmpty=function(){return this.queue.length===0},e.prototype.scheduleFlush=function(t){var n=this;t===void 0&&(t=500),!this.flushing&&(this.flushing=!0,setTimeout(function(){n.flush().then(function(){setTimeout(function(){n.flushing=!1,n.queue.length&&n.scheduleFlush(0)},0)})},t))},e.prototype.deliver=function(t){return N(this,void 0,void 0,function(){var n,i,s,o;return k(this,function(c){switch(c.label){case 0:return[4,this.criticalTasks.done()];case 1:c.sent(),n=Date.now(),c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.flushOne(t)];
2case 3:return t=c.sent(),i=Date.now()-n,this.emit("delivery_success",t),t.stats.gauge("delivered",i),t.log("debug","Delivered",t.event),[2,t];case 4:throw s=c.sent(),o=s,t.log("error","Failed to deliver",o),this.emit("delivery_failure",t,o),t.stats.increment("delivery_failed"),s;case 5:return[2]}})})},e.prototype.enqueuRetry=function(t,n){var i=!(t instanceof he)||t.retry;return i?this.queue.pushWithBackoff(n):!1},e.prototype.flush=function(){return N(this,void 0,void 0,function(){var t,n,i;return k(this,function(s){switch(s.label){case 0:if(this.queue.length===0)return[2,[]];if(t=this.queue.pop(),!t)return[2,[]];t.attempts=this.queue.getAttempts(t),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.deliver(t)];case 2:return t=s.sent(),this.emit("flush",t,!0),[3,4];case 3:return n=s.sent(),i=this.enqueuRetry(n,t),i||(t.setFailedDelivery({reason:n}),this.emit("flush",t,!1)),[2,[]];case 4:return[2,[t]]}})})},e.prototype.isReady=function(){return!0},e.prototype.availableExtensions=function(t){var n=this.plugins.filter(function(x){var F,R,H;if(x.type!=="destination"&&x.name!=="Segment.io")return!0;var J=void 0;return(F=x.alternativeNames)===null||F===void 0||F.forEach(function($){t[$]!==void 0&&(J=t[$])}),(H=(R=t[x.name])!==null&&R!==void 0?R:J)!==null&&H!==void 0?H:(x.name==="Segment.io"?!0:t.All)!==!1}),i=Nt(n,"type"),s=i.before,o=s===void 0?[]:s,c=i.enrichment,a=c===void 0?[]:c,f=i.destination,p=f===void 0?[]:f,_=i.after,I=_===void 0?[]:_;return{before:o,enrichment:a,destinations:p,after:I}},e.prototype.flushOne=function(t){var n,i;return N(this,void 0,void 0,function(){var s,o,c,a,f,p,F,_,I,x,F,R,H,J,$;return k(this,function(A){switch(A.label){case 0:if(!this.isReady())throw new Error("Not ready");t.attempts>1&&this.emit("delivery_retry",t),s=this.availableExtensions((n=t.event.integrations)!==null&&n!==void 0?n:{}),o=s.before,c=s.enrichment,a=0,f=o,A.label=1;case 1:return a<f.length?(p=f[a],[4,Ht(t,p)]):[3,4];case 2:F=A.sent(),F instanceof le&&(t=F),this.emit("message_enriched",t,p),A.label=3;case 3:return a++,[3,1];case 4:_=0,I=c,A.label=5;case 5:return _<I.length?(x=I[_],[4,ue(t,x)]):[3,8];case 6:F=A.sent(),F instanceof le&&(t=F),this.emit("message_enriched",t,x),A.label=7;case 7:return _++,[3,5];case 8:return R=this.availableExtensions((i=t.event.integrations)!==null&&i!==void 0?i:{}),H=R.destinations,J=R.after,[4,new Promise(function(B,D){setTimeout(function(){var u=H.map(function(m){return ue(t,m)});Promise.all(u).then(B).catch(D)},0)})];case 9:return A.sent(),t.stats.increment("message_delivered"),this.emit("message_delivered",t),$=J.map(function(B){return ue(t,B)}),[4,Promise.all($)];case 10:return A.sent(),[2,t]}})})},e}(ie),$t=function(r,e){var t=Date.now()-r;return Math.max((e??300)-t,0)};function Bt(r,e,t,n){return N(this,void 0,void 0,function(){var i,s;return k(this,function(o){switch(o.label){case 0:return t.emit("dispatch_start",r),i=Date.now(),e.isEmpty()?[4,e.dispatchSingle(r)]:[3,2];case 1:return s=o.sent(),[3,4];case 2:return[4,e.dispatch(r)];case 3:s=o.sent(),o.label=4;case 4:return n!=null&&n.callback?[4,It(s,n.callback,$t(i,n.timeout))]:[3,6];case 5:s=o.sent(),o.label=6;case 6:return n!=null&&n.debug&&s.flush(),[2,s]}})})}function Ut(r){for(var e=r.constructor.prototype,t=0,n=Object.getOwnPropertyNames(e);t<n.length;t++){var i=n[t];if(i!=="constructor"){var s=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);s&&typeof s.value=="function"&&(r[i]=r[i].bind(r))}}return r}const jt=r=>{if(!r.writeKey)throw new W("writeKey","writeKey is missing.")},Ve="2.3.0",Lt=r=>r.replace(/\/$/,""),qt=(r,e)=>Lt(new URL(e||"",r).href),Ke=32,Ne=480;class zt{constructor(e){g(this,"id",ve());g(this,"items",[]);g(this,"sizeInBytes",0);g(this,"maxEventCount");this.maxEventCount=Math.max(1,e)}tryAdd(e){if(this.length===this.maxEventCount)return{success:!1,message:`Event limit of ${this.maxEventCount} has been exceeded.`};const t=this.calculateSize(e.context);return t>Ke*1024?{success:!1,message:`Event exceeds maximum event size of ${Ke} KB`}:this.sizeInBytes+t>Ne*1024?{success:!1,message:`Event has caused batch size to exceed ${Ne} KB`}:(this.items.push(e),this.sizeInBytes+=t,{success:!0})}get length(){return this.items.length}calculateSize(e){return encodeURI(JSON.stringify(e.event)).split(/%..|i/).length}getEvents(){return this.items.map(({context:t})=>t.event)}getContexts(){return this.items.map(e=>e.context)}
2resolveEvents(){this.items.forEach(({resolver:e,context:t})=>e(t))}}const ge=crypto,Ge=r=>r instanceof CryptoKey,ee=new TextEncoder,Te=new TextDecoder;function Vt(...r){const e=r.reduce((i,{length:s})=>i+s,0),t=new Uint8Array(e);let n=0;for(const i of r)t.set(i,n),n+=i.length;return t}const Gt=r=>{let e=r;typeof e=="string"&&(e=ee.encode(e));const t=32768,n=[];for(let i=0;i<e.length;i+=t)n.push(String.fromCharCode.apply(null,e.subarray(i,i+t)));return btoa(n.join(""))},Ee=r=>Gt(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xt=r=>{const e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t},Pe=r=>{let e=r;e instanceof Uint8Array&&(e=Te.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Xt(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class C extends Error{constructor(e,t){var n;super(e,t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}}C.code="ERR_JOSE_GENERIC";class Yt extends C{constructor(e,t,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:t}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=n,this.reason=i,this.payload=t}}Yt.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Qt extends C{constructor(e,t,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:t}}),this.code="ERR_JWT_EXPIRED",this.claim=n,this.reason=i,this.payload=t}}Qt.code="ERR_JWT_EXPIRED";class Zt extends C{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}Zt.code="ERR_JOSE_ALG_NOT_ALLOWED";class M extends C{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}M.code="ERR_JOSE_NOT_SUPPORTED";class er extends C{constructor(e="decryption operation failed",t){super(e,t),this.code="ERR_JWE_DECRYPTION_FAILED"}}er.code="ERR_JWE_DECRYPTION_FAILED";class tr extends C{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}tr.code="ERR_JWE_INVALID";class Q extends C{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}Q.code="ERR_JWS_INVALID";class Xe extends C{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}Xe.code="ERR_JWT_INVALID";class rr extends C{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}rr.code="ERR_JWK_INVALID";class nr extends C{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}nr.code="ERR_JWKS_INVALID";class ir extends C{constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_NO_MATCHING_KEY"}}ir.code="ERR_JWKS_NO_MATCHING_KEY";class sr extends C{constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}sr.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class or extends C{constructor(e="request timed out",t){super(e,t),this.code="ERR_JWKS_TIMEOUT"}}or.code="ERR_JWKS_TIMEOUT";class ar extends C{constructor(e="signature verification failed",t){super(e,t),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}ar.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function K(r,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${r}`)}function re(r,e){return r.name===e}function we(r){return parseInt(r.name.slice(4),10)}function cr(r){switch(r){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function ur(r,e){if(e.length&&!e.some(t=>r.usages.includes(t))){let t="CryptoKey does not support this operation, its usages must include ";if(e.length>2){const n=e.pop();t+=`one of ${e.join(", ")}, or ${n}.`}else e.length===2?t+=`one of ${e[0]} or ${e[1]}.`:t+=`${e[0]}.`;throw new TypeError(t)}}function hr(r,e,...t){switch(e){case"HS256":case"HS384":case"HS512":{if(!re(r.algorithm,"HMAC"))throw K("HMAC");const n=parseInt(e.slice(2),10);if(we(r.algorithm.hash)!==n)throw K(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!re(r.algorithm,"RSASSA-PKCS1-v1_5"))throw K("RSASSA-PKCS1-v1_5");const n=parseInt(e.slice(2),10);if(we(r.algorithm.hash)!==n)throw K(`SHA-${n}`,"algorithm.hash");break}
vendor: 4,653 bytes, line 2
2case"PS256":case"PS384":case"PS512":{if(!re(r.algorithm,"RSA-PSS"))throw K("RSA-PSS");const n=parseInt(e.slice(2),10);if(we(r.algorithm.hash)!==n)throw K(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(r.algorithm.name!=="Ed25519"&&r.algorithm.name!=="Ed448")throw K("Ed25519 or Ed448");break}case"Ed25519":{if(!re(r.algorithm,"Ed25519"))throw K("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!re(r.algorithm,"ECDSA"))throw K("ECDSA");const n=cr(e);if(r.algorithm.namedCurve!==n)throw K(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}ur(r,t)}function Ye(r,e,...t){var n;if(t=t.filter(Boolean),t.length>2){const i=t.pop();r+=`one of type ${t.join(", ")}, or ${i}.`}else t.length===2?r+=`one of type ${t[0]} or ${t[1]}.`:r+=`of type ${t[0]}.`;return e==null?r+=` Received ${e}`:typeof e=="function"&&e.name?r+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&(n=e.constructor)!=null&&n.name&&(r+=` Received an instance of ${e.constructor.name}`),r}const ke=(r,...e)=>Ye("Key must be ",r,...e);function Qe(r,e,...t){return Ye(`Key for the ${r} algorithm must be `,e,...t)}const Ze=r=>Ge(r)?!0:(r==null?void 0:r[Symbol.toStringTag])==="KeyObject",fe=["CryptoKey"],lr=(...r)=>{const e=r.filter(Boolean);if(e.length===0||e.length===1)return!0;let t;for(const n of e){const i=Object.keys(n);if(!t||t.size===0){t=new Set(i);continue}for(const s of i){if(t.has(s))return!1;t.add(s)}}return!0};function fr(r){return typeof r=="object"&&r!==null}function et(r){if(!fr(r)||Object.prototype.toString.call(r)!=="[object Object]")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}const dr=(r,e)=>{if(r.startsWith("RS")||r.startsWith("PS")){const{modulusLength:t}=e.algorithm;if(typeof t!="number"||t<2048)throw new TypeError(`${r} requires key modulusLength to be 2048 bits or larger`)}};function se(r){return et(r)&&typeof r.kty=="string"}function pr(r){return r.kty!=="oct"&&typeof r.d=="string"}function mr(r){return r.kty!=="oct"&&typeof r.d>"u"}function yr(r){return se(r)&&r.kty==="oct"&&typeof r.k=="string"}function vr(r){let e,t;switch(r.kty){case"RSA":{switch(r.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${r.alg.slice(-3)}`},t=r.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.alg.slice(-3)}`},t=r.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(r.alg.slice(-3),10)||1}`},t=r.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new M('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(r.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},t=r.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},t=r.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},t=r.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:r.crv},t=r.d?["deriveBits"]:[];break;default:throw new M('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(r.alg){case"Ed25519":e={name:"Ed25519"},t=r.d?["sign"]:["verify"];break;case"EdDSA":e={name:r.crv},t=r.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:r.crv},t=r.d?["deriveBits"]:[];break;default:throw new M('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new M('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:t}}const gr=async r=>{if(!r.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:e,keyUsages:t}=vr(r),n=[e,r.ext??!1,r.key_ops??t],i={...r};return delete i.alg,delete i.use,ge.subtle.importKey("jwk",i,...n)},tt=r=>Pe(r);let X,Y;const rt=r=>(r==null?void 0:r[Symbol.toStringTag])==="KeyObject",de=async(r,e,t,n,i=!1)=>{let s=r.get(e);if(s!=null&&s[n])return s[n];const o=await gr({...t,alg:n});return i&&Object.freeze(e),s?s[n]=o:r.set(e,{[n]:o}),o},_r=(r,e)=>{if(rt(r)){let t=r.export({format:"jwk"});return delete t.d,delete t.dp,delete t.dq,delete t.p,delete t.q,delete t.qi,t.k?tt(t.k):(Y||(Y=new WeakMap),de(Y,r,t,e))}return se(r)?r.k?Pe(r.k):(Y||(Y=new WeakMap),de(Y,r,r,e,!0)):r},br=(r,e)=>{if(rt(r)){let t=r.export({format:"jwk"});return t.k?tt(t.k):(X||(X=new WeakMap),de(X,r,t,e))}return se(r)?r.k?Pe(r.k):(X||(X=new WeakMap),de(X,r,r,e,!0)):r}
2,Er={normalizePublicKey:_r,normalizePrivateKey:br},q=(r,e,t=0)=>{t===0&&(e.unshift(e.length),e.unshift(6));const n=r.indexOf(e[0],t);if(n===-1)return!1;const i=r.subarray(n,n+e.length);return i.length!==e.length?!1:i.every((s,o)=>s===e[o])||q(r,e,n+1)},We=r=>{switch(!0){case q(r,[42,134,72,206,61,3,1,7]):return"P-256";case q(r,[43,129,4,0,34]):return"P-384";case q(r,[43,129,4,0,35]):return"P-521";case q(r,[43,101,110]):return"X25519";case q(r,[43,101,111]):return"X448";case q(r,[43,101,112]):return"Ed25519";case q(r,[43,101,113]):return"Ed448";default:throw new M("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},wr=async(r,e,t,n,i)=>{let s,o;const c=new Uint8Array(atob(t.replace(r,"")).split("").map(a=>a.charCodeAt(0)));switch(n){case"PS256":case"PS384":case"PS512":s={name:"RSA-PSS",hash:`SHA-${n.slice(-3)}`},o=["sign"];break;case"RS256":case"RS384":case"RS512":s={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${n.slice(-3)}`},o=["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s={name:"RSA-OAEP",hash:`SHA-${parseInt(n.slice(-3),10)||1}`},o=["decrypt","unwrapKey"];break;case"ES256":s={name:"ECDSA",namedCurve:"P-256"},o=["sign"];break;case"ES384":s={name:"ECDSA",namedCurve:"P-384"},o=["sign"];break;case"ES512":s={name:"ECDSA",namedCurve:"P-521"},o=["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const a=We(c);s=a.startsWith("P-")?{name:"ECDH",namedCurve:a}:{name:a},o=["deriveBits"];break}
2case"Ed25519":s={name:"Ed25519"},o=["sign"];break;case"EdDSA":s={name:We(c)},o=["sign"];break;default:throw new M('Invalid or unsupported "alg" (Algorithm) value')}return ge.subtle.importKey(e,c,s,!1,o)},xr=(r,e,t)=>wr(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",r,e);async function Sr(r,e,t){if(typeof r!="string"||r.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return xr(r,e)}const Z=r=>r==null?void 0:r[Symbol.toStringTag],Fe=(r,e,t)=>{var n,i;if(e.use!==void 0&&e.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(e.key_ops!==void 0&&((i=(n=e.key_ops).includes)==null?void 0:i.call(n,t))!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${t}`);if(e.alg!==void 0&&e.alg!==r)throw new TypeError(`Invalid key for this operation, when present its alg must be ${r}`);return!0},Ar=(r,e,t,n)=>{if(!(e instanceof Uint8Array)){if(n&&se(e)){if(yr(e)&&Fe(r,e,t))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ze(e))throw new TypeError(Qe(r,e,...fe,"Uint8Array",n?"JSON Web Key":null));if(e.type!=="secret")throw new TypeError(`${Z(e)} instances for symmetric algorithms must be of type "secret"`)}},Tr=(r,e,t,n)=>{if(n&&se(e))switch(t){case"sign":if(pr(e)&&Fe(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(mr(e)&&Fe(r,e,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Ze(e))throw new TypeError(Qe(r,e,...fe,n?"JSON Web Key":null));if(e.type==="secret")throw new TypeError(`${Z(e)} instances for asymmetric algorithms must not be of type "secret"`);if(t==="sign"&&e.type==="public")throw new TypeError(`${Z(e)} instances for asymmetric algorithm signing must be of type "private"`);if(t==="decrypt"&&e.type==="public")throw new TypeError(`${Z(e)} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&t==="verify"&&e.type==="private")throw new TypeError(`${Z(e)} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&t==="encrypt"&&e.type==="private")throw new TypeError(`${Z(e)} instances for asymmetric algorithm encryption must be of type "public"`)};function nt(r,e,t,n){e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?Ar(e,t,n,r):Tr(e,t,n,r)}nt.bind(void 0,!1);const Fr=nt.bind(void 0,!0);function Ir(r,e,t,n,i){if(i.crit!==void 0&&(n==null?void 0:n.crit)===void 0)throw new r('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(o=>typeof o!="string"||o.length===0))throw new r('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;t!==void 0?s=new Map([...Object.entries(t),...e.entries()]):s=e;for(const o of n.crit){if(!s.has(o))throw new M(`Extension Header Parameter "${o}" is not recognized`);if(i[o]===void 0)throw new r(`Extension Header Parameter "${o}" is missing`);if(s.get(o)&&n[o]===void 0)throw new r(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(n.crit)}function Cr(r,e){const t=`SHA-${r.slice(-3)}`;switch(r){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:r.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:e.name};default:throw new M(`alg ${r} is not supported either by JOSE or your javascript runtime`)}}async function Rr(r,e,t){if(e=await Er.normalizePrivateKey(e,r),Ge(e))return hr(e,r,t),e;if(e instanceof Uint8Array){if(!r.startsWith("HS"))throw new TypeError(ke(e,...fe));return ge.subtle.importKey("raw",e,{hash:`SHA-${r.slice(-3)}`,name:"HMAC"},!1,[t])}throw new TypeError(ke(e,...fe,"Uint8Array","JSON Web Key"))}const z=r=>Math.floor(r.getTime()/1e3),it=60,st=it*60,Oe=st*24,Pr=Oe*7,Or=Oe*365.25,Dr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,xe=r=>{const e=Dr.exec(r);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");const t=parseFloat(e[2]),n=e[3].toLowerCase();let i;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":i=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":i=Math.round(t*it);break;case"hour":case"hours":case"hr":case"hrs":case"h":i=Math.round(t*st);break;case"day":case"days":case"d":i=Math.round(t*Oe);break;case"week":case"weeks":case"w":i=Math.round(t*Pr);break;default:i=Math.round(t*Or);break}return e[1]==="-"||e[4]==="ago"?-i:i},Kr=async(r,e,t)=>{const n=await Rr(r,e,"sign");dr(r,n);const i=await ge.subtle.sign(Cr(r,n.algorithm),n,t);return new Uint8Array(i)};class Nr{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Q("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!lr(this._protectedHeader,this._unprotectedHeader))throw new Q("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader},i=Ir(Q,new Map([["b64",!0]]),t==null?void 0:t.crit,this._protectedHeader,n);let s=!0;if(i.has("b64")&&(s=this._protectedHeader.b64,typeof s!="boolean"))throw new Q('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:o}=n;
2if(typeof o!="string"||!o)throw new Q('JWS "alg" (Algorithm) Header Parameter missing or invalid');Fr(o,e,"sign");let c=this._payload;s&&(c=ee.encode(Ee(c)));let a;this._protectedHeader?a=ee.encode(Ee(JSON.stringify(this._protectedHeader))):a=ee.encode("");const f=Vt(a,ee.encode("."),c),p=await Kr(o,e,f),_={signature:Ee(p),payload:""};return s&&(_.payload=Te.decode(c)),this._unprotectedHeader&&(_.header=this._unprotectedHeader),this._protectedHeader&&(_.protected=Te.decode(a)),_}}class kr{constructor(e){this._flattened=new Nr(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const n=await this._flattened.sign(e,t);if(n.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}}function V(r,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${r} input`);return e}class Wr{constructor(e={}){if(!et(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e=="number"?this._payload={...this._payload,nbf:V("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:V("setNotBefore",z(e))}:this._payload={...this._payload,nbf:z(new Date)+xe(e)},this}setExpirationTime(e){return typeof e=="number"?this._payload={...this._payload,exp:V("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:V("setExpirationTime",z(e))}:this._payload={...this._payload,exp:z(new Date)+xe(e)},this}setIssuedAt(e){return typeof e>"u"?this._payload={...this._payload,iat:z(new Date)}:e instanceof Date?this._payload={...this._payload,iat:V("setIssuedAt",z(e))}:typeof e=="string"?this._payload={...this._payload,iat:V("setIssuedAt",z(new Date)+xe(e))}:this._payload={...this._payload,iat:V("setIssuedAt",e)},this}}class Mr extends Wr{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){var i;const n=new kr(ee.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray((i=this._protectedHeader)==null?void 0:i.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new Xe("JWTs MUST NOT use unencoded payload");return n.sign(e,t)}}const Hr=r=>!!(r&&typeof r=="object"&&"access_token"in r&&"expires_in"in r&&typeof r.access_token=="string"&&typeof r.expires_in=="number"),Jr=r=>typeof r.text=="function";function $r(r){const e={};if(!r)return{};if(Br(r)){for(const[t,n]of r.entries())e[t.toLowerCase()]=n;return e}for(const[t,n]of Object.entries(r))e[t.toLowerCase()]=n;return e}function Br(r){return typeof r=="object"&&r!==null&&"entries"in Object(r)&&typeof Object(r).entries=="function"}class Ur{constructor(e){g(this,"alg","RS256");g(this,"grantType","client_credentials");g(this,"clientAssertionType","urn:ietf:params:oauth:client-assertion-type:jwt-bearer");g(this,"clientId");g(this,"clientKey");g(this,"keyId");g(this,"scope");g(this,"authServer");g(this,"httpClient");g(this,"maxRetries");g(this,"clockSkewInSeconds",0);g(this,"accessToken");g(this,"tokenEmitter",new ie);g(this,"retryCount");g(this,"pollerTimer");this.keyId=e.keyId,this.clientId=e.clientId,this.clientKey=e.clientKey,this.authServer=e.authServer??"https://oauth2.segment.io",this.scope=e.scope??"tracking_api:write",this.httpClient=e.httpClient,this.maxRetries=e.maxRetries,this.tokenEmitter.on("access_token",t=>{"token"in t&&(this.accessToken=t.token)}),this.retryCount=0}stopPoller(){clearTimeout(this.pollerTimer)}async pollerLoop(){let e=25,t;try{t=await this.requestAccessToken()}catch(i){return this.handleTransientError({error:i})}if(!Jr(t))return this.handleInvalidCustomResponse();const n=$r(t.headers);if(n.date&&this.updateClockSkew(Date.parse(n.date)),t.status===200)try{const i=await t.text(),s=JSON.parse(i);if(!Hr(s))throw new Error("Response did not contain a valid access_token and expires_in");return s.expires_at=Math.round(Date.now()/1e3)+s.expires_in,this.tokenEmitter.emit("access_token",{token:s}),this.retryCount=0,e=s.expires_in/2*1e3,this.queueNextPoll(e)}catch(i){return this.handleTransientError({error:i,forceEmitError:!0})}else return t.status===429?await this.handleRateLimited(t,n,e):[400,401,415].includes(t.status)?this.handleUnrecoverableErrors(t):this.handleTransientError({error:new Error(`[${t.status}] ${t.statusText}`)})}handleTransientError({error:e,forceEmitError:t}){this.incrementRetries({error:e,forceEmitError:t});const n=Re({attempt:this.retryCount,minTimeout:25,maxTimeout:1e3});this.queueNextPoll(n)}handleInvalidCustomResponse(){this.tokenEmitter.emit("access_token",{error:new Error("HTTPClient does not implement response.text method")})}async handleRateLimited(e,t,n){if(this.incrementRetries({error:new Error(`[${e.status}] ${e.statusText}`)}),t["x-ratelimit-reset"]){const i=parseInt(t["x-ratelimit-reset"],10);isFinite(i)?n=i-Date.now()+this.clockSkewInSeconds*1e3:n=5*1e3,await qe(n),n=0}this.queueNextPoll(n)}handleUnrecoverableErrors(e){this.retryCount=0,this.tokenEmitter.emit("access_token",{error:new Error(`[${e.status}] ${e.statusText}`)}),this.stopPoller()}updateClockSkew(e){this.clockSkewInSeconds=(Date.now()-e)/1e3}incrementRetries({error:e,forceEmitError:t}){this.retryCount++,(t||this.retryCount%this.maxRetries===0)&&(this.retryCount=0,this.tokenEmitter.emit("access_token",{error:e}))}queueNextPoll(e){this.pollerTimer=setTimeout(()=>this.pollerLoop(),e),this.pollerTimer.unref&&this.pollerTimer.unref()}async requestAccessToken(){const i=ve(),s=Math.round(Date.now()/1e3)-this.clockSkewInSeconds,o={iss:this.clientId,sub:this.clientId,aud:this.authServer,iat:s-5,exp:s+55,jti:i},c=await Sr(this.clientKey,"RS256"),a=await new Mr(o).setProtectedHeader({alg:this.alg,kid:this.keyId,typ:"JWT"}).sign(c),f=`grant_type=${this.grantType}&client_assertion_type=${this.clientAssertionType}&client_assertion=${a}&scope=${this.scope}`,_={method:"POST",url:`${this.authServer}/token`,body:f,headers:{"Content-Type":"application/x-www-form-urlencoded"},httpRequestTimeout:1e4};
2return this.httpClient.makeRequest(_)}async getAccessToken(){return this.isValidToken(this.accessToken)?this.accessToken:(this.stopPoller(),this.pollerLoop().catch(()=>{}),new Promise((e,t)=>{this.tokenEmitter.once("access_token",n=>{"token"in n?e(n.token):t(n.error)})}))}clearToken(){this.accessToken=void 0}isValidToken(e){return typeof e<"u"&&e!==null&&e.expires_in<Date.now()/1e3}}function jr(r){return new Promise(e=>setTimeout(e,r))}function ne(){}class Lr{constructor({host:e,path:t,maxRetries:n,flushAt:i,flushInterval:s,writeKey:o,httpRequestTimeout:c,httpClient:a,disable:f,oauthSettings:p},_){g(this,"pendingFlushTimeout");g(this,"_batch");g(this,"_flushInterval");g(this,"_flushAt");g(this,"_maxRetries");g(this,"_url");g(this,"_flushPendingItemsCount");g(this,"_httpRequestTimeout");g(this,"_emitter");g(this,"_disable");g(this,"_httpClient");g(this,"_writeKey");g(this,"_tokenManager");this._emitter=_,this._maxRetries=n,this._flushAt=Math.max(i,1),this._flushInterval=s,this._url=qt(e??"https://api.segment.io",t??"/v1/batch"),this._httpRequestTimeout=c??1e4,this._disable=!!f,this._httpClient=a,this._writeKey=o,p&&(this._tokenManager=new Ur({...p,httpClient:p.httpClient??a,maxRetries:p.maxRetries??n}))}createBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout);const e=new zt(this._flushAt);return this._batch=e,this.pendingFlushTimeout=setTimeout(()=>{e===this._batch&&(this._batch=void 0),this.pendingFlushTimeout=void 0,e.length&&this.send(e).catch(ne)},this._flushInterval),e}clearBatch(){this.pendingFlushTimeout&&clearTimeout(this.pendingFlushTimeout),this._batch=void 0}flush(e){if(!e){this._tokenManager&&this._tokenManager.stopPoller();return}if(this._flushPendingItemsCount=e,!this._batch)return;this._batch.length===e&&(this.send(this._batch).catch(ne).finally(()=>{this._tokenManager&&this._tokenManager.stopPoller()}),this.clearBatch())}enqueue(e){const t=this._batch??this.createBatch(),{promise:n,resolve:i}=Ct(),s={context:e,resolver:i};if(t.tryAdd(s).success){const f=t.length===this._flushPendingItemsCount;return(t.length===this._flushAt||f)&&(this.send(t).catch(ne),this.clearBatch()),n}t.length&&(this.send(t).catch(ne),this.clearBatch());const c=this.createBatch(),a=c.tryAdd(s);return a.success?(c.length===this._flushPendingItemsCount&&(this.send(c).catch(ne),this.clearBatch()),n):(e.setFailedDelivery({reason:new Error(a.message)}),Promise.resolve(e))}async send(e){this._flushPendingItemsCount&&(this._flushPendingItemsCount-=e.length);const t=e.getEvents(),n=this._maxRetries+1;let i=0;for(;i<n;){i++;let s,o;try{if(this._disable)return e.resolveEvents();let c;if(this._tokenManager){const _=await this._tokenManager.getAccessToken();_&&_.access_token&&(c=`Bearer ${_.access_token}`)}const a={"Content-Type":"application/json","User-Agent":"analytics-node-next/latest",...c?{Authorization:c}:{}},f={url:this._url,method:"POST",headers:a,body:JSON.stringify({batch:t,writeKey:this._writeKey,sentAt:new Date}),httpRequestTimeout:this._httpRequestTimeout};this._emitter.emit("http_request",{body:f.body,method:f.method,url:f.url,headers:f.headers});const p=await this._httpClient.makeRequest(f);if(p.status>=200&&p.status<300){e.resolveEvents();return}else if(this._tokenManager&&(p.status===400||p.status===401||p.status===403))this._tokenManager.clearToken(),o=new Error(`[${p.status}] ${p.statusText}`);else if(p.status===400){Me(e,new Error(`[${p.status}] ${p.statusText}`));return}else if(p.status===429){if(p.headers&&"x-ratelimit-reset"in p.headers){const _=parseInt(p.headers["x-ratelimit-reset"],10);isFinite(_)&&(s=_-Date.now())}o=new Error(`[${p.status}] ${p.statusText}`)}else o=new Error(`[${p.status}] ${p.statusText}`)}catch(c){o=c}if(i===n){Me(e,o);return}await jr(s||Re({attempt:i,minTimeout:25,maxTimeout:1e3}))}}}
2function Me(r,e){r.getContexts().forEach(t=>t.setFailedDelivery({reason:e})),r.resolveEvents()}var He={};const ot=()=>typeof process=="object"&&process&&typeof He=="object"&&He&&typeof process.version=="string"?"node":typeof window=="object"?"browser":typeof WebSocketPair<"u"?"cloudflare-worker":typeof EdgeRuntime=="string"?"vercel-edge":typeof WorkerGlobalScope<"u"&&typeof importScripts=="function"?"web-worker":"unknown";function qr(r){r.updateEvent("context.library.name","@segment/analytics-node"),r.updateEvent("context.library.version",Ve);const e=ot();e==="node"&&r.updateEvent("_metadata.nodeVersion",process.version),r.updateEvent("_metadata.jsRuntime",e)}function zr(r){function e(t){return qr(t),r.enqueue(t)}return{name:"Segment.io",type:"destination",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),alias:e,group:e,identify:e,page:e,screen:e,track:e}}const Vr=(r,e)=>{const t=new Lr(r,e);return{publisher:t,plugin:zr(t)}},Gr=()=>`node-next-${Date.now()}-${ve()}`;class Xr extends Ft{constructor(){super({createMessageId:Gr,onFinishedEvent:e=>{gt(e)}})}}class Ie extends le{static system(){return new this({type:"track",event:"system"})}}const Yr=r=>e=>{const t=e.failedDelivery();return r(t?t.reason:void 0,e)},Qr=async(r,e,t,n)=>{try{const i=new Ie(r),s=await Bt(i,e,t,{...n?{callback:Yr(n)}:{}}),o=s.failedDelivery();o?t.emit("error",{code:"delivery_failure",reason:o.reason,ctx:s}):t.emit(r.type,s)}catch(i){t.emit("error",{code:"unknown",reason:i})}};class Zr extends ie{}class en extends Rt{constructor(){super(1,[])}getAttempts(e){return e.attempts??0}updateAttempts(e){return e.attempts=this.getAttempts(e)+1,this.getAttempts(e)}}class tn extends Jt{constructor(){super(new en)}}class rn{constructor(){g(this,"onabort",null);g(this,"aborted",!1);g(this,"eventEmitter",new ie)}toString(){return"[object AbortSignal]"}get[Symbol.toStringTag](){return"AbortSignal"}removeEventListener(...e){this.eventEmitter.off(...e)}addEventListener(...e){this.eventEmitter.on(...e)}dispatchEvent(e){const t={type:e,target:this},n=`on${e}`;typeof this[n]=="function"&&this[n](t),this.eventEmitter.emit(e,t)}}class nn{constructor(){g(this,"signal",new rn)}abort(){this.signal.aborted||(this.signal.aborted=!0,this.signal.dispatchEvent("abort"))}toString(){return"[object AbortController]"}get[Symbol.toStringTag](){return"AbortController"}}const sn=r=>{var n;if(ot()==="cloudflare-worker")return[];const e=new(globalThis.AbortController||nn),t=setTimeout(()=>{e.abort()},r);return(n=t==null?void 0:t.unref)==null||n.call(t),[e.signal,t]},on=async(...r)=>{if(globalThis.fetch)return globalThis.fetch(...r);if(typeof EdgeRuntime!="string")return(await dt(async()=>{const{default:e}=await import("./index-_tovtKVe.js");return{default:e}},__vite__mapDeps([0,1,2]))).default(...r);throw new Error("Invariant: an edge runtime that does not support fetch should not exist")};class Je{constructor(e){g(this,"_fetch");this._fetch=e??on}async makeRequest(e){const[t,n]=sn(e.httpRequestTimeout),i={url:e.url,method:e.method,headers:e.headers,body:e.body,signal:t};return this._fetch(e.url,i).finally(()=>clearTimeout(n))}}class an extends Zr{constructor(t){super();g(this,"_eventFactory");g(this,"_isClosed",!1);g(this,"_pendingEvents",0);g(this,"_closeAndFlushDefaultTimeout");g(this,"_publisher");g(this,"_isFlushing",!1);g(this,"_queue");g(this,"ready");jt(t),this._eventFactory=new Xr,this._queue=new tn;const n=t.flushInterval??1e4;this._closeAndFlushDefaultTimeout=n*1.25;const{plugin:i,publisher:s}=Vr({writeKey:t.writeKey,host:t.host,path:t.path,maxRetries:t.maxRetries??3,flushAt:t.flushAt??t.maxEventsInBatch??15,httpRequestTimeout:t.httpRequestTimeout,disable:t.disable,flushInterval:n,httpClient:typeof t.httpClient=="function"?new Je(t.httpClient):t.httpClient??new Je,oauthSettings:t.oauthSettings},this);this._publisher=s,this.ready=this.register(i).then(()=>{}),this.emit("initialize",t),Ut(this)}get VERSION(){return Ve}closeAndFlush({timeout:t=this._closeAndFlushDefaultTimeout}={}){return this.flush({timeout:t,close:!0})}async flush({timeout:t,close:n=!1}={}){if(this._isFlushing){console.warn("Overlapping flush calls detected. Please wait for the previous flush to finish before calling .flush again");return}else this._isFlushing=!0;
2n&&(this._isClosed=!0),this._publisher.flush(this._pendingEvents);const i=new Promise(s=>{this._pendingEvents?this.once("drained",()=>{s()}):s()}).finally(()=>{this._isFlushing=!1});return t?Le(i,t).catch(()=>{}):i}_dispatch(t,n){if(this._isClosed){this.emit("call_after_close",t);return}this._pendingEvents++,Qr(t,this._queue,this,n).catch(i=>i).finally(()=>{this._pendingEvents--,this._pendingEvents||this.emit("drained")})}alias({userId:t,previousId:n,context:i,timestamp:s,integrations:o,messageId:c},a){const f=this._eventFactory.alias(t,n,{context:i,integrations:o,timestamp:s,messageId:c});this._dispatch(f,a)}group({timestamp:t,groupId:n,userId:i,anonymousId:s,traits:o={},context:c,integrations:a,messageId:f},p){const _=this._eventFactory.group(n,o,{context:c,anonymousId:s,userId:i,timestamp:t,integrations:a,messageId:f});this._dispatch(_,p)}identify({userId:t,anonymousId:n,traits:i={},context:s,timestamp:o,integrations:c,messageId:a},f){const p=this._eventFactory.identify(t,i,{context:s,anonymousId:n,userId:t,timestamp:o,integrations:c,messageId:a});this._dispatch(p,f)}page({userId:t,anonymousId:n,category:i,name:s,properties:o,context:c,timestamp:a,integrations:f,messageId:p},_){const I=this._eventFactory.page(i??null,s??null,o,{context:c,anonymousId:n,userId:t,timestamp:a,integrations:f,messageId:p});this._dispatch(I,_)}screen({userId:t,anonymousId:n,category:i,name:s,properties:o,context:c,timestamp:a,integrations:f,messageId:p},_){const I=this._eventFactory.screen(i??null,s??null,o,{context:c,anonymousId:n,userId:t,timestamp:a,integrations:f,messageId:p});this._dispatch(I,_)}track({userId:t,anonymousId:n,event:i,properties:s,context:o,timestamp:c,integrations:a,messageId:f},p){const _=this._eventFactory.track(i,s,{context:o,userId:t,anonymousId:n,timestamp:c,integrations:a,messageId:f});this._dispatch(_,p)}register(...t){return this._queue.criticalTasks.run(async()=>{const n=Ie.system(),i=t.map(s=>this._queue.register(n,s,this));await Promise.all(i),this.emit("register",t.map(s=>s.name))})}async deregister(...t){const n=Ie.system(),i=t.map(s=>{const o=this._queue.plugins.find(c=>c.name===s);if(o)return this._queue.deregister(n,o,this);n.log("warn",`plugin ${s} not found`)});await Promise.all(i),this.emit("deregister",t)}}var at={exports:{}};const cn={},un=Object.freeze(Object.defineProperty({__proto__:null,default:cn},Symbol.toStringTag,{value:"Module"})),$e=pt(un);/** 3 * [js-sha256]{@link https://github.com/emn178/js-sha256} 4 * 5 * @version 0.11.1 6 * @author Chen, Yi-Cyuan [[email protected]] 7 * @copyright Chen, Yi-Cyuan 2014-2025 8 * @license MIT 9 */(function(r){(function(){var e="input is invalid type",t=typeof window=="object",n=t?window:{};n.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",s=!n.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";s?n=mt:i&&(n=self);var o=!n.JS_SHA256_NO_COMMON_JS&&!0&&r.exports,c=!n.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",a="0123456789abcdef".split(""),f=[-2147483648,8388608,32768,128],p=[24,16,8,0],_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],I=["hex","array","digest","arrayBuffer"],x=[];(n.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(u){return Object.prototype.toString.call(u)==="[object Array]"}),c&&(n.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(u){return typeof u=="object"&&u.buffer&&u.buffer.constructor===ArrayBuffer});var F=function(u,m){return function(y){return new A(m,!0).update(y)[u]()}},R=function(u){var m=F("hex",u);s&&(m=H(m,u)),m.create=function(){return new A(u)},m.update=function(v){return m.create().update(v)};for(var y=0;y<I.length;++y){var d=I[y];m[d]=F(d,u)}return m},H=function(u,m){var y=$e,d=$e.Buffer,v=m?"sha224":"sha256",l;d.from&&!n.JS_SHA256_NO_BUFFER_FROM?l=d.from:l=function(h){return new d(h)};var E=function(h){if(typeof h=="string")return y.createHash(v).update(h,"utf8").digest("hex");
vendor: 6,226 bytes, line 9
9if(h==null)throw new Error(e);return h.constructor===ArrayBuffer&&(h=new Uint8Array(h)),Array.isArray(h)||ArrayBuffer.isView(h)||h.constructor===d?y.createHash(v).update(l(h)).digest("hex"):u(h)};return E},J=function(u,m){return function(y,d){return new B(y,m,!0).update(d)[u]()}},$=function(u){var m=J("hex",u);m.create=function(v){return new B(v,u)},m.update=function(v,l){return m.create(v).update(l)};for(var y=0;y<I.length;++y){var d=I[y];m[d]=J(d,u)}return m};function A(u,m){m?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=u}A.prototype.update=function(u){if(!this.finalized){var m,y=typeof u;if(y!=="string"){if(y==="object"){if(u===null)throw new Error(e);if(c&&u.constructor===ArrayBuffer)u=new Uint8Array(u);else if(!Array.isArray(u)&&(!c||!ArrayBuffer.isView(u)))throw new Error(e)}else throw new Error(e);m=!0}for(var d,v=0,l,E=u.length,h=this.blocks;v<E;){if(this.hashed&&(this.hashed=!1,h[0]=this.block,this.block=h[16]=h[1]=h[2]=h[3]=h[4]=h[5]=h[6]=h[7]=h[8]=h[9]=h[10]=h[11]=h[12]=h[13]=h[14]=h[15]=0),m)for(l=this.start;v<E&&l<64;++v)h[l>>>2]|=u[v]<<p[l++&3];else for(l=this.start;v<E&&l<64;++v)d=u.charCodeAt(v),d<128?h[l>>>2]|=d<<p[l++&3]:d<2048?(h[l>>>2]|=(192|d>>>6)<<p[l++&3],h[l>>>2]|=(128|d&63)<<p[l++&3]):d<55296||d>=57344?(h[l>>>2]|=(224|d>>>12)<<p[l++&3],h[l>>>2]|=(128|d>>>6&63)<<p[l++&3],h[l>>>2]|=(128|d&63)<<p[l++&3]):(d=65536+((d&1023)<<10|u.charCodeAt(++v)&1023),h[l>>>2]|=(240|d>>>18)<<p[l++&3],h[l>>>2]|=(128|d>>>12&63)<<p[l++&3],h[l>>>2]|=(128|d>>>6&63)<<p[l++&3],h[l>>>2]|=(128|d&63)<<p[l++&3]);this.lastByteIndex=l,this.bytes+=l-this.start,l>=64?(this.block=h[16],this.start=l-64,this.hash(),this.hashed=!0):this.start=l}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},A.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var u=this.blocks,m=this.lastByteIndex;u[16]=this.block,u[m>>>2]|=f[m&3],this.block=u[16],m>=56&&(this.hashed||this.hash(),u[0]=this.block,u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),u[14]=this.hBytes<<3|this.bytes>>>29,u[15]=this.bytes<<3,this.hash()}},A.prototype.hash=function(){var u=this.h0,m=this.h1,y=this.h2,d=this.h3,v=this.h4,l=this.h5,E=this.h6,h=this.h7,w=this.blocks,T,P,O,U,S,j,L,te,_e,be,oe;for(T=16;T<64;++T)S=w[T-15],P=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,S=w[T-2],O=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,w[T]=w[T-16]+P+w[T-7]+O<<0;for(oe=m&y,T=0;T<64;T+=4)this.first?(this.is224?(te=300032,S=w[0]-1413257819,h=S-150054599<<0,d=S+24177077<<0):(te=704751109,S=w[0]-210244248,h=S-1521486534<<0,d=S+143694565<<0),this.first=!1):(P=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),O=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),te=u&m,U=te^u&y^oe,L=v&l^~v&E,S=h+O+L+_[T]+w[T],j=P+U,h=d+S<<0,d=S+j<<0),P=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),O=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),_e=d&u,U=_e^d&m^te,L=h&v^~h&l,S=E+O+L+_[T+1]+w[T+1],j=P+U,E=y+S<<0,y=S+j<<0,P=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),O=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7),be=y&d,U=be^y&u^_e,L=E&h^~E&v,S=l+O+L+_[T+2]+w[T+2],j=P+U,l=m+S<<0,m=S+j<<0,P=(m>>>2|m<<30)^(m>>>13|m<<19)^(m>>>22|m<<10),O=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),oe=m&y,U=oe^m&d^be,L=l&E^~l&h,S=v+O+L+_[T+3]+w[T+3],j=P+U,v=u+S<<0,u=S+j<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+u<<0,this.h1=this.h1+m<<0,this.h2=this.h2+y<<0,this.h3=this.h3+d<<0,this.h4=this.h4+v<<0,this.h5=this.h5+l<<0,this.h6=this.h6+E<<0,this.h7=this.h7+h<<0},A.prototype.hex=function(){this.finalize();var u=this.h0,m=this.h1,y=this.h2,d=this.h3,v=this.h4,l=this.h5,E=this.h6,h=this.h7,w=a[u>>>28&15]+a[u>>>24&15]+a[u>>>20&15]+a[u>>>16&15]+a[u>>>12&15]+a[u>>>8&15]+a[u>>>4&15]+a[u&15]+a[m>>>28&15]+a[m>>>24&15]+a[m>>>20&15]+a[m>>>16&15]+a[m>>>12&15]+a[m>>>8&15]+a[m>>>4&15]+a[m&15]+a[y>>>28&15]+a[y>>>24&15]+a[y>>>20&15]+a[y>>>16&15]+a[y>>>12&15]+a[y>>>8&15]+a[y>>>4&15]+a[y&15]+a[d>>>28&15]+a[d>>>24&15]+a[d>>>20&15]+a[d>>>16&15]+a[d>>>12&15]+a[d>>>8&15]+a[d>>>4&15]+a[d&15]+a[v>>>28&15]+a[v>>>24&15]+a[v>>>20&15]+a[v>>>16&15]+a[v>>>12&15]+a[v>>>8&15]+a[v>>>4&15]+a[v&15]+a[l>>>28&15]+a[l>>>24&15]+a[l>>>20&15]+a[l>>>16&15]+a[l>>>12&15]+a[l>>>8&15]+a[l>>>4&15]+a[l&15]+a[E>>>28&15]+a[E>>>24&15]+a[E>>>20&15]+a[E>>>16&15]+a[E>>>12&15]+a[E>>>8&15]+a[E>>>4&15]+a[E&15];return this.is224||(w+=a[h>>>28&15]+a[h>>>24&15]+a[h>>>20&15]+a[h>>>16&15]+a[h>>>12&15]+a[h>>>8&15]+a[h>>>4&15]+a[h&15]),w},A.prototype.toString=A.prototype.hex,A.prototype.digest=function(){this.finalize();var u=this.h0,m=this.h1,y=this.h2,d=this.h3,v=this.h4,l=this.h5,E=this.h6,h=this.h7,w=[u>>>24&255,u>>>16&255,u>>>8&255,u&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255];return this.is224||w.push(h>>>24&255,h>>>16&255,h>>>8&255,h&255),w},A.prototype.array=A.prototype.digest,A.prototype.arrayBuffer=function(){this.finalize();var u=new ArrayBuffer(this.is224?28:32),m=new DataView(u);return m.setUint32(0,this.h0),m.setUint32(4,this.h1),m.setUint32(8,this.h2),m.setUint32(12,this.h3),m.setUint32(16,this.h4),m.setUint32(20,this.h5),m.setUint32(24,this.h6),this.is224||m.setUint32(28,this.h7),u};function B(u,m,y){var d,v=typeof u;if(v==="string"){var l=[],E=u.length,h=0,w;for(d=0;d<E;++d)w=u.charCodeAt(d),w<128?l[h++]=w:w<2048?(l[h++]=192|w>>>6,l[h++]=128|w&63):w<55296||w>=57344?(l[h++]=224|w>>>12,l[h++]=128|w>>>6&63,l[h++]=128|w&63):(w=65536+((w&1023)<<10|u.charCodeAt(++d)&1023),l[h++]=240|w>>>18,l[h++]=128|w>>>12&63,l[h++]=128|w>>>6&63,l[h++]=128|w&63);u=l}else if(v==="object"){if(u===null)throw new Error(e);
9if(c&&u.constructor===ArrayBuffer)u=new Uint8Array(u);else if(!Array.isArray(u)&&(!c||!ArrayBuffer.isView(u)))throw new Error(e)}else throw new Error(e);u.length>64&&(u=new A(m,!0).update(u).array());var T=[],P=[];for(d=0;d<64;++d){var O=u[d]||0;T[d]=92^O,P[d]=54^O}A.call(this,m,y),this.update(P),this.oKeyPad=T,this.inner=!0,this.sharedMemory=y}B.prototype=new A,B.prototype.finalize=function(){if(A.prototype.finalize.call(this),this.inner){this.inner=!1;var u=this.array();A.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(u),A.prototype.finalize.call(this)}};var D=R();D.sha256=D,D.sha224=R(!0),D.sha256.hmac=$(),D.sha224.hmac=$(!0),o?r.exports=D:(n.sha256=D.sha256,n.sha224=D.sha224)})()})(at);var ct=at.exports,ut=(r=>(r.aiFeatureEnabled="AI Feature Enabled",r.aiFeatureDisabled="AI Feature Disabled",r.encryptionKeysMissing="Encryption Keys Missing",r.inviteMember="Invite Sent",r.inviteAccepted="Invite Accepted",r.inviteNotPermitted="Invite Not Permitted",r.inviteResent="Invite Resent",r.inviteRevoked="Invite Revoked",r.onboardingAppDownloadClicked="Onboarding App Download Clicked",r.onboardingAppDownloadSkipped="Onboarding App Download Skipped",r.runInInsomniaClicked="Run in Insomnia Clicked",r.runInInsomniaDownloadLinkClicked="Run in Insomnia Download Link Clicked",r.runInInsomniaLoginClicked="Run in Insomnia Login Clicked",r.trialCreated="Trial Created",r.upgradeToPaid="Upgrade To Paid",r))(ut||{});const ht=new an({writeKey:globalThis.ENV.SEGMENT_WRITE_KEY||"",disable:!1}),dn=({event:r,userId:e="anonymous",properties:t={}})=>{ht.track({userId:e==="anonymous"?e:ct.sha256(e),event:r,properties:{...t,platform:"web"}})},pn=({event:r=ut.upgradeToPaid,userId:e="anonymous",old_plan:t,new_plan:n,source:i})=>{ht.track({userId:e==="anonymous"?e:ct.sha256(e),event:r,properties:{source:i||"unknown",old_plan:t==="free"?"essentials":t,new_plan:n==="free"?"essentials":n}})};export{ut as S,pn as a,dn as t,cn as z}; 10//# sourceMappingURL=analytics.client-DEP2HFEl.js.map
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.