prismic 0.0.0-canary.2cfb4a8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ import{createRequire as e}from"node:module";import{access as t,mkdir as n,readFile as r,rename as i,rm as a,writeFile as o}from"node:fs/promises";import{createServer as s}from"node:http";import{homedir as c}from"node:os";import{fileURLToPath as l,pathToFileURL as u}from"node:url";import{relative as d}from"node:path";import*as f from"fs";import p from"fs";import m,{basename as h,dirname as g,normalize as ee,posix as _,relative as v,resolve as y,sep as b}from"path";import{fileURLToPath as x}from"url";import{createRequire as S}from"module";var C=Object.create,w=Object.defineProperty,T=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,D=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),te=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=E(t),a=0,o=i.length,s;a<o;a++)s=i[a],!O.call(e,s)&&s!==n&&w(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=T(t,s))||r.enumerable});return e},A=(e,t,n)=>(n=e==null?{}:C(D(e)),te(t||!e||!e.__esModule?w(n,`default`,{value:e,enumerable:!0}):n,e)),j=e(import.meta.url);function M(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function N(e){return(void 0)?.get(e)}function P(e){return(void 0)?.get(e)}function F(e,t){return(void 0)?.get(e)?.get(t)}function I(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function L(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??I(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??F(e.reference,c.lang)??(l?P(c.lang):null)??r.message??N(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function R(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},M())}}}function z(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function B(e){return e instanceof V}var V=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function H(e){return{kind:`validation`,type:`url`,reference:H,async:!1,expects:null,requirement(e){try{return new URL(e),!0}catch{return!1}},message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&L(this,`URL`,e,t),e}}}function U(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function W(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function G(e,t){return{kind:`schema`,type:`array`,reference:G,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return R(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else L(this,`type`,e,t);return e}}}function K(e){return{kind:`schema`,type:`boolean`,reference:K,expects:`boolean`,async:!1,message:e,get"~standard"(){return R(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:L(this,`type`,e,t),e}}}function q(e,t){return{kind:`schema`,type:`literal`,reference:q,expects:I(e),async:!1,literal:e,message:t,get"~standard"(){return R(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:L(this,`type`,e,t),e}}}function J(e,t){return{kind:`schema`,type:`object`,reference:J,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return R(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`)for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:W(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=U(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(L(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}else L(this,`type`,e,t);return e}}}function Y(e,t){return{kind:`schema`,type:`optional`,reference:Y,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return R(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=W(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function X(e,t,n){return{kind:`schema`,type:`record`,reference:X,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return R(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(z(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else L(this,`type`,e,t);return e}}}function Z(e){return{kind:`schema`,type:`string`,reference:Z,expects:`string`,async:!1,message:e,get"~standard"(){return R(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:L(this,`type`,e,t),e}}}function ne(){return{kind:`schema`,type:`unknown`,reference:ne,expects:`unknown`,async:!1,get"~standard"(){return R(this)},"~run"(e){return e.typed=!0,e}}}function re(e,t,n){let r=e[`~run`]({value:t},M(n));if(r.issues)throw new V(r.issues);return r.value}function ie(...e){return{...e[0],pipe:e,get"~standard"(){return R(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function ae(e,t,n){let r=e[`~run`]({value:t},M(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}async function oe(){let e=await fe();return e.hostname=`user-service.${e.hostname}`,Q(e)}function Q(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}const se=new URL(`.prismic`,Q(u(c()))),ce=`https://prismic.io`;async function le(e,t){let n={token:e,base:t?.base};await o(se,JSON.stringify(n,null,2))}async function ue(){let e=await de();if(!e)return!1;try{let t=await fe();t.hostname=`user-service.${t.hostname}`;let n=new URL(`profile`,t);return(await fetch(n,{headers:{Accept:`application/json`,Cookie:`SESSION=fake_session; prismic-auth=${e}`}})).ok?!0:(await ge(),!1)}catch{return!1}}async function de(){return(await he())?.token}async function fe(){try{let e=await he();return e?.base?new URL(e.base):new URL(ce)}catch{return new URL(ce)}}async function pe(e){let t=await fe(),n=t.origin;return new Promise((r,i)=>{let a=s((e,t)=>{if(e.method===`OPTIONS`){t.writeHead(204,{"Access-Control-Allow-Origin":n,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),t.end();return}if(e.method===`POST`){let i=``;e.on(`data`,e=>{i+=e.toString()}),e.on(`end`,async()=>{try{let{cookies:e,email:s}=JSON.parse(i),c=e.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!c){t.writeHead(400,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),t.end(JSON.stringify({error:`Invalid request`}));return}await le(c),t.writeHead(200,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),t.end(JSON.stringify({success:!0})),clearTimeout(o),a.close(),r({email:s})}catch{t.writeHead(400,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),t.end(JSON.stringify({error:`Invalid request`}))}});return}t.writeHead(404),t.end()}),o=setTimeout(()=>{a.close(),i(Error(`Login timed out. Please try again.`))},18e4),c=()=>{let n=a.address();if(!n||typeof n==`string`){clearTimeout(o),a.close(),i(Error(`Failed to start login server`));return}let r=me(t,n.port);e?.onReady?.(r)};a.on(`error`,e=>{e.code===`EADDRINUSE`&&a.listening===!1?a.listen(0,`0.0.0.0`,c):(clearTimeout(o),i(e))}),a.listen(5555,`0.0.0.0`,c)})}function me(e,t){let n=new URL(`/dashboard/cli/login`,e);return n.searchParams.set(`source`,`prismic-cli`),n.searchParams.set(`port`,t.toString()),n}async function he(){try{let e=await r(se,`utf-8`);return JSON.parse(e)}catch{return}}async function ge(){try{await t(se)}catch{return!0}return await he()?(await a(se),!0):!1}async function $(e,n={}){let{start:r=u(process.cwd()),stop:i}=n,a=Q(r);for(;;){let n=new URL(e,a);try{return await t(n),n}catch{}if(typeof i==`string`){let e=new URL(i,a);try{await t(e);return}catch{}}else if(i instanceof URL&&i.href===a.href)return;let r=new URL(`..`,a);if(r.href===a.href)return;a=r}}async function _e(e){try{return await t(e),!0}catch{return!1}}function ve(e){return JSON.stringify(e,null,2)}const ye=`prismic.config.json`,be=J({repositoryName:Z(),apiEndpoint:Y(ie(Z(),H())),localSliceMachineSimulatorURL:Y(ie(Z(),H())),libraries:Y(G(Z())),adapter:Y(Z()),labs:Y(J({legacySliceUpgrader:Y(K())}))});async function xe(e,t=u(process.cwd())){let n=await De(t);return n.ok?(await o(n.path,ve(e)),{ok:!0,config:e}):n}async function Se(e=u(process.cwd())){let t=await Ce(e);if(t.ok)return t.config.repositoryName}async function Ce(e=u(process.cwd())){let t=await Ee(e);if(!t.ok)return t;try{let e=await r(t.path,`utf8`),n=ae(be,JSON.parse(e));return n.success?{ok:!0,config:n.output}:{ok:!1,error:new we(n.issues)}}catch{return{ok:!1,error:new we}}}var we=class extends Error{issues;constructor(e=[]){super(`prismic.config.json is invalid.`),this.issues=e}};async function Te(e,t=u(process.cwd())){let n=await Ee(t);if(!n.ok)return n;let r=await Ce(t);if(!r.ok)return r;let i={...r.config,...e};return await o(n.path,ve(i)),{ok:!0,config:i}}async function Ee(e=u(process.cwd())){let t=await $(ye,{start:e,stop:`package.json`});return t?{ok:!0,path:t}:{ok:!1,error:new Oe}}async function De(e=u(process.cwd())){let t=await $(`package.json`,{start:e});return t?{ok:!0,path:new URL(ye,t)}:{ok:!1,error:new ke}}var Oe=class extends Error{message=`Could not find a prismic.config.json file.`},ke=class extends Error{message=`Could not find a package.json file.`};const Ae=/([\p{Ll}\d])(\p{Lu})/gu,je=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,Me=/(\d)\p{Ll}|(\p{L})\d/u,Ne=/[^\p{L}\d]+/giu,Pe=`$1\0$2`;function Fe(e){let t=e.trim();t=t.replace(Ae,Pe).replace(je,Pe),t=t.replace(Ne,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}function Ie(e){let t=Fe(e);for(let e=0;e<t.length;e++){let n=t[e],r=Me.exec(n);if(r){let i=r.index+(r[1]??r[2]).length;t.splice(e,1,n.slice(0,i),n.slice(i))}}return t}function Le(e,t){let[n,r,i]=He(e,t),a=Re(t?.locale),o=ze(t?.locale),s=t?.mergeAmbiguousCharacters?Be(a,o):Ve(a,o);return n+r.map(s).join(t?.delimiter??``)+i}function Re(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function ze(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function Be(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Ve(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function He(e,t={}){let n=t.split??(t.separateNumbers?Ie:Fe),r=t.prefixCharacters??``,i=t.suffixCharacters??``,a=0,o=e.length;for(;a<e.length;){let t=e.charAt(a);if(!r.includes(t))break;a++}for(;o>a;){let t=o-1,n=e.charAt(t);if(!i.includes(n))break;o=t}return[e.slice(0,a),n(e.slice(a,o)),e.slice(o)]}var Ue=S(import.meta.url);function We(e){let t=ee(e);return t.length>1&&t[t.length-1]===b&&(t=t.substring(0,t.length-1)),t}const Ge=/[\\/]/g;function Ke(e,t){return e.replace(Ge,t)}const qe=/^[a-z]:[\\/]$/i;function Je(e){return e===`/`||qe.test(e)}function Ye(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=y(e)),(r||a)&&(e=We(e)),e===`.`?``:Ke(e[e.length-1]===i?e:e+i,i)}function Xe(e,t){return t+e}function Ze(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:Ke(v(e,r),t.pathSeparator)+t.pathSeparator+n}}function Qe(e){return e}function $e(e,t,n){return t+e+n}function et(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?Ze(e,t):r?Xe:Qe}function tt(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function nt(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const rt=(e,t)=>{t.push(e||`.`)},it=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},at=()=>{};function ot(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?nt(e):tt(e):r&&r.length?it:rt:at}const st=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},ct=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},lt=(e,t,n,r)=>{n.files++},ut=(e,t)=>{t.push(e)},dt=()=>{};function ft(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?dt:n&&n.length?r?st:ct:r?lt:ut}const pt=e=>e,mt=()=>[``].slice(0,0);function ht(e){return e.group?mt:pt}const gt=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},_t=()=>{};function vt(e){return e.group?gt:_t}const yt=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue(),i.realpath(e,(o,s)=>{if(o)return r.dequeue(a?null:o,t);i.stat(s,(i,o)=>{if(i)return r.dequeue(a?null:i,t);if(o.isDirectory()&&St(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},bt=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue();try{let r=i.realpathSync(e),a=i.statSync(r);if(a.isDirectory()&&St(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function xt(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?bt:yt}function St(e,t,n){if(n.options.useRealPaths)return Ct(t,n);let r=g(e),i=1;for(;r!==n.root&&i<2;){let e=n.symlinks.get(r);e&&(e===t||e.startsWith(t)||t.startsWith(e))?i++:r=g(r)}return n.symlinks.set(e,t),i>1}function Ct(e,t){return t.visited.includes(e+t.options.pathSeparator)}const wt=e=>e.counts,Tt=e=>e.groups,Et=e=>e.paths,Dt=e=>e.paths.slice(0,e.options.maxFiles),Ot=(e,t,n)=>(Mt(t,n,e.counts,e.options.suppressErrors),null),kt=(e,t,n)=>(Mt(t,n,e.paths,e.options.suppressErrors),null),At=(e,t,n)=>(Mt(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),jt=(e,t,n)=>(Mt(t,n,e.groups,e.options.suppressErrors),null);function Mt(e,t,n,r){t(e&&!r?e:null,n)}function Nt(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?wt:Ot:r?t?Tt:jt:i?t?Dt:At:t?Et:kt}const Pt={withFileTypes:!0},Ft=(e,t,n,r,i)=>{if(e.queue.enqueue(),r<0)return e.queue.dequeue(null,e);let{fs:a}=e;e.visited.push(t),e.counts.directories++,a.readdir(t||`.`,Pt,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},It=(e,t,n,r,i)=>{let{fs:a}=e;if(r<0)return;e.visited.push(t),e.counts.directories++;let o=[];try{o=a.readdirSync(t||`.`,Pt)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function Lt(e){return e?It:Ft}var Rt=class{count=0;constructor(e){this.onQueueEmpty=e}enqueue(){return this.count++,this.count}dequeue(e,t){this.onQueueEmpty&&(--this.count<=0||e)&&(this.onQueueEmpty(e,t),e&&(t.controller.abort(),this.onQueueEmpty=void 0))}},zt=class{_files=0;_directories=0;set files(e){this._files=e}get files(){return this._files}set directories(e){this._directories=e}get directories(){return this._directories}get dirs(){return this._directories}},Bt=class{aborted=!1;abort(){this.aborted=!0}},Vt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=Nt(t,this.isSynchronous),this.root=Ye(e,t),this.state={root:Je(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new zt,options:t,queue:new Rt((e,t)=>this.callbackInvoker(t,e,n)),symlinks:new Map,visited:[``].slice(0,0),controller:new Bt,fs:t.fs||f},this.joinPath=et(this.root,t),this.pushDirectory=ot(this.root,t),this.pushFile=ft(t),this.getArray=ht(t),this.groupFiles=vt(t),this.resolveSymlink=xt(t,this.isSynchronous),this.walkDirectory=Lt(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,t,n)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:o,exclude:s,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&r.length>c)return;let p=this.getArray(this.state.paths);for(let c=0;c<e.length;++c){let l=e[c];if(l.isFile()||l.isSymbolicLink()&&!a&&!o){let e=this.joinPath(l.name,t);this.pushFile(e,p,this.state.counts,i)}else if(l.isDirectory()){let e=$e(l.name,t,this.state.options.pathSeparator);if(s&&s(l.name,e))continue;this.pushDirectory(e,r,i),this.walkDirectory(this.state,e,e,n-1,this.walk)}else if(this.resolveSymlink&&l.isSymbolicLink()){let e=Xe(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=Ye(r,this.state.options),s&&s(l.name,u?r:e+d))return;this.walkDirectory(this.state,r,u?r:e+d,n-1,this.walk)}else{r=u?r:e;let t=h(r),n=Ye(g(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,p)}};function Ht(e,t){return new Promise((n,r)=>{Ut(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function Ut(e,t,n){new Vt(e,t,n).start()}function Wt(e,t){return new Vt(e,t).start()}var Gt=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return Ht(this.root,this.options)}withCallback(e){Ut(this.root,this.options,e)}sync(){return Wt(this.root,this.options)}};let Kt=null;try{Ue.resolve(`picomatch`),Kt=Ue(`picomatch`)}catch{}var qt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:b,filters:[]};globFunction;constructor(e){this.options={...this.options,...e},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(e){return this.options.pathSeparator=e,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(e){return this.options.maxDepth=e,this}withMaxFiles(e){return this.options.maxFiles=e,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:e=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=e,this.withFullPaths()}withAbortSignal(e){return this.options.signal=e,this}normalize(){return this.options.normalizePath=!0,this}filter(e){return this.options.filters.push(e),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(e){return this.options.exclude=e,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(e){return new Gt(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}crawlWithOptions(e,t){return this.options={...this.options,...t},new Gt(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||Kt;if(!n)throw Error(`Please specify a glob function to use glob matching.`);var r=this.globCache[e.join(`\0`)];return r||(r=n(e,...t),this.globCache[e.join(`\0`)]=r),this.options.filters.push(e=>r(e)),this}},Jt=k(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),Yt=k((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Jt();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),Xt=k(((e,t)=>{let n=Yt(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:ee}=Jt(),_=e=>e===l||e===a,v=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let y=t||{},b=e.length-1,x=y.parts===!0||y.scanToEnd===!0,S=[],C=[],w=[],T=e,E=-1,D=0,O=0,k=!1,te=!1,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=0,z,B,V={value:``,depth:0,isGlob:!1},H=()=>E>=b,U=()=>T.charCodeAt(E+1),W=()=>(z=B,T.charCodeAt(++E));for(;E<b;){B=W();let e;if(B===a){P=V.backslashes=!0,B=W(),B===u&&(N=!0);continue}if(N===!0||B===u){for(R++;H()!==!0&&(B=W());){if(B===a){P=V.backslashes=!0,W();continue}if(B===u){R++;continue}if(N!==!0&&B===s&&(B=W())===s){if(k=V.isBrace=!0,A=V.isGlob=!0,L=!0,x===!0)continue;break}if(N!==!0&&B===o){if(k=V.isBrace=!0,A=V.isGlob=!0,L=!0,x===!0)continue;break}if(B===h&&(R--,R===0)){N=!1,k=V.isBrace=!0,L=!0;break}}if(x===!0)continue;break}if(B===l){if(S.push(E),C.push(V),V={value:``,depth:0,isGlob:!1},L===!0)continue;if(z===s&&E===D+1){D+=2;continue}O=E+1;continue}if(y.noext!==!0&&(B===p||B===i||B===r||B===m||B===c)&&U()===d){if(A=V.isGlob=!0,j=V.isExtglob=!0,L=!0,B===c&&E===D&&(I=!0),x===!0){for(;H()!==!0&&(B=W());){if(B===a){P=V.backslashes=!0,B=W();continue}if(B===g){A=V.isGlob=!0,L=!0;break}}continue}break}if(B===r){if(z===r&&(M=V.isGlobstar=!0),A=V.isGlob=!0,L=!0,x===!0)continue;break}if(B===m){if(A=V.isGlob=!0,L=!0,x===!0)continue;break}if(B===f){for(;H()!==!0&&(e=W());){if(e===a){P=V.backslashes=!0,W();continue}if(e===ee){te=V.isBracket=!0,A=V.isGlob=!0,L=!0;break}}if(x===!0)continue;break}if(y.nonegate!==!0&&B===c&&E===D){F=V.negated=!0,D++;continue}if(y.noparen!==!0&&B===d){if(A=V.isGlob=!0,x===!0){for(;H()!==!0&&(B=W());){if(B===d){P=V.backslashes=!0,B=W();continue}if(B===g){L=!0;break}}continue}break}if(A===!0){if(L=!0,x===!0)continue;break}}y.noext===!0&&(j=!1,A=!1);let G=T,K=``,q=``;D>0&&(K=T.slice(0,D),T=T.slice(D),O-=D),G&&A===!0&&O>0?(G=T.slice(0,O),q=T.slice(O)):A===!0?(G=``,q=T):G=T,G&&G!==``&&G!==`/`&&G!==T&&_(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),y.unescape===!0&&(q&&=n.removeBackslashes(q),G&&P===!0&&(G=n.removeBackslashes(G)));let J={prefix:K,input:e,start:D,base:G,glob:q,isBrace:k,isBracket:te,isGlob:A,isExtglob:j,isGlobstar:M,negated:F,negatedExtglob:I};if(y.tokens===!0&&(J.maxDepth=0,_(B)||C.push(V),J.tokens=C),y.parts===!0||y.tokens===!0){let t;for(let n=0;n<S.length;n++){let r=t?t+1:D,i=S[n],a=e.slice(r,i);y.tokens&&(n===0&&D!==0?(C[n].isPrefix=!0,C[n].value=K):C[n].value=a,v(C[n]),J.maxDepth+=C[n].depth),(n!==0||a!==``)&&w.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);w.push(n),y.tokens&&(C[C.length-1].value=n,v(C[C.length-1]),J.maxDepth+=C[C.length-1].depth)}J.slashes=S,J.parts=w}return J}})),Zt=k(((e,t)=>{let n=Jt(),r=Yt(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let f={...t},p=typeof f.maxLength==`number`?Math.min(i,f.maxLength):i,m=e.length;if(m>p)throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);let h={type:`bos`,value:``,output:f.prepend||``},g=[h],ee=f.capture?``:`?:`,_=n.globChars(f.windows),v=n.extglobChars(_),{DOT_LITERAL:y,PLUS_LITERAL:b,SLASH_LITERAL:x,ONE_CHAR:S,DOTS_SLASH:C,NO_DOT:w,NO_DOT_SLASH:T,NO_DOTS_SLASH:E,QMARK:D,QMARK_NO_DOT:O,STAR:k,START_ANCHOR:te}=_,A=e=>`(${ee}(?:(?!${te}${e.dot?C:y}).)*?)`,j=f.dot?``:w,M=f.dot?D:O,N=f.bash===!0?A(f):k;f.capture&&(N=`(${N})`),typeof f.noext==`boolean`&&(f.noextglob=f.noext);let P={input:e,index:-1,start:0,dot:f.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=r.removePrefix(e,P),m=e.length;let F=[],I=[],L=[],R=h,z,B=()=>P.index===m-1,V=P.peek=(t=1)=>e[P.index+t],H=P.advance=()=>e[++P.index]||``,U=()=>e.slice(P.index+1),W=(e=``,t=0)=>{P.consumed+=e,P.index+=t},G=e=>{P.output+=e.output==null?e.value:e.output,W(e.value)},K=()=>{let e=1;for(;V()===`!`&&(V(2)!==`(`||V(3)===`?`);)H(),P.start++,e++;return e%2==0?!1:(P.negated=!0,P.start++,!0)},q=e=>{P[e]++,L.push(e)},J=e=>{P[e]--,L.pop()},Y=e=>{if(R.type===`globstar`){let t=P.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||F.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(P.output=P.output.slice(0,-R.output.length),R.type=`star`,R.value=`*`,R.output=N,P.output+=R.output)}if(F.length&&e.type!==`paren`&&(F[F.length-1].inner+=e.value),(e.value||e.output)&&G(e),R&&R.type===`text`&&e.type===`text`){R.output=(R.output||R.value)+e.value,R.value+=e.value;return}e.prev=R,g.push(e),R=e},X=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=R,n.parens=P.parens,n.output=P.output;let r=(f.capture?`(`:``)+n.open;q(`parens`),Y({type:e,value:t,output:P.output?``:S}),Y({type:`paren`,extglob:!0,value:H(),output:r}),F.push(n)},Z=e=>{let n=e.close+(f.capture?`)`:``),r;if(e.type===`negate`){let i=N;e.inner&&e.inner.length>1&&e.inner.includes(`/`)&&(i=A(f)),(i!==N||B()||/^\)+$/.test(U()))&&(n=e.close=`)$))${i}`),e.inner.includes(`*`)&&(r=U())&&/^\.[^\\/.]+$/.test(r)&&(n=e.close=`)${d(r,{...t,fastpaths:!1}).output})${i})`),e.prev.type===`bos`&&(P.negatedExtglob=!0)}Y({type:`paren`,extglob:!0,value:z,output:n}),J(`parens`)};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?D.repeat(a.length):``):o===0?M+(a?D.repeat(a.length):``):D.repeat(r.length):i===`.`?y.repeat(r.length):i===`*`?t?t+i+(a?N:``):N:t?e:`\\${e}`);return n===!0&&(i=f.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&f.contains===!0?(P.output=e,P):(P.output=r.wrapOutput(i,P,t),P)}for(;!B();){if(z=H(),z===`\0`)continue;if(z===`\\`){let e=V();if(e===`/`&&f.bash!==!0||e===`.`||e===`;`)continue;if(!e){z+=`\\`,Y({type:`text`,value:z});continue}let t=/^\\+/.exec(U()),n=0;if(t&&t[0].length>2&&(n=t[0].length,P.index+=n,n%2!=0&&(z+=`\\`)),f.unescape===!0?z=H():z+=H(),P.brackets===0){Y({type:`text`,value:z});continue}}if(P.brackets>0&&(z!==`]`||R.value===`[`||R.value===`[^`)){if(f.posix!==!1&&z===`:`){let e=R.value.slice(1);if(e.includes(`[`)&&(R.posix=!0,e.includes(`:`))){let e=R.value.lastIndexOf(`[`),t=R.value.slice(0,e),n=a[R.value.slice(e+2)];if(n){R.value=t+n,P.backtrack=!0,H(),!h.output&&g.indexOf(R)===1&&(h.output=S);continue}}}(z===`[`&&V()!==`:`||z===`-`&&V()===`]`)&&(z=`\\${z}`),z===`]`&&(R.value===`[`||R.value===`[^`)&&(z=`\\${z}`),f.posix===!0&&z===`!`&&R.value===`[`&&(z=`^`),R.value+=z,G({value:z});continue}if(P.quotes===1&&z!==`"`){z=r.escapeRegex(z),R.value+=z,G({value:z});continue}if(z===`"`){P.quotes=P.quotes===1?0:1,f.keepQuotes===!0&&Y({type:`text`,value:z});continue}if(z===`(`){q(`parens`),Y({type:`paren`,value:z});continue}if(z===`)`){if(P.parens===0&&f.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=F[F.length-1];if(e&&P.parens===e.parens+1){Z(F.pop());continue}Y({type:`paren`,value:z,output:P.parens?`)`:`\\)`}),J(`parens`);continue}if(z===`[`){if(f.nobracket===!0||!U().includes(`]`)){if(f.nobracket!==!0&&f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));z=`\\${z}`}else q(`brackets`);Y({type:`bracket`,value:z});continue}if(z===`]`){if(f.nobracket===!0||R&&R.type===`bracket`&&R.value.length===1){Y({type:`text`,value:z,output:`\\${z}`});continue}if(P.brackets===0){if(f.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));Y({type:`text`,value:z,output:`\\${z}`});continue}J(`brackets`);let e=R.value.slice(1);if(R.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(z=`/${z}`),R.value+=z,G({value:z}),f.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(R.value);if(P.output=P.output.slice(0,-R.value.length),f.literalBrackets===!0){P.output+=t,R.value=t;continue}R.value=`(${ee}${t}|${R.value})`,P.output+=R.value;continue}if(z===`{`&&f.nobrace!==!0){q(`braces`);let e={type:`brace`,value:z,output:`(`,outputIndex:P.output.length,tokensIndex:P.tokens.length};I.push(e),Y(e);continue}if(z===`}`){let e=I[I.length-1];if(f.nobrace===!0||!e){Y({type:`text`,value:z,output:z});continue}let t=`)`;if(e.dots===!0){let e=g.slice(),n=[];for(let t=e.length-1;t>=0&&(g.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,f),P.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=P.output.slice(0,e.outputIndex),r=P.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,z=t=`\\}`,P.output=n;for(let e of r)P.output+=e.output||e.value}Y({type:`brace`,value:z,output:t}),J(`braces`),I.pop();continue}if(z===`|`){F.length>0&&F[F.length-1].conditions++,Y({type:`text`,value:z});continue}if(z===`,`){let e=z,t=I[I.length-1];t&&L[L.length-1]===`braces`&&(t.comma=!0,e=`|`),Y({type:`comma`,value:z,output:e});continue}if(z===`/`){if(R.type===`dot`&&P.index===P.start+1){P.start=P.index+1,P.consumed=``,P.output=``,g.pop(),R=h;continue}Y({type:`slash`,value:z,output:x});continue}if(z===`.`){if(P.braces>0&&R.type===`dot`){R.value===`.`&&(R.output=y);let e=I[I.length-1];R.type=`dots`,R.output+=z,R.value+=z,e.dots=!0;continue}if(P.braces+P.parens===0&&R.type!==`bos`&&R.type!==`slash`){Y({type:`text`,value:z,output:y});continue}Y({type:`dot`,value:z,output:y});continue}if(z===`?`){if(!(R&&R.value===`(`)&&f.noextglob!==!0&&V()===`(`&&V(2)!==`?`){X(`qmark`,z);continue}if(R&&R.type===`paren`){let e=V(),t=z;(R.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(U()))&&(t=`\\${z}`),Y({type:`text`,value:z,output:t});continue}if(f.dot!==!0&&(R.type===`slash`||R.type===`bos`)){Y({type:`qmark`,value:z,output:O});continue}Y({type:`qmark`,value:z,output:D});continue}if(z===`!`){if(f.noextglob!==!0&&V()===`(`&&(V(2)!==`?`||!/[!=<:]/.test(V(3)))){X(`negate`,z);continue}if(f.nonegate!==!0&&P.index===0){K();continue}}if(z===`+`){if(f.noextglob!==!0&&V()===`(`&&V(2)!==`?`){X(`plus`,z);continue}if(R&&R.value===`(`||f.regex===!1){Y({type:`plus`,value:z,output:b});continue}if(R&&(R.type===`bracket`||R.type===`paren`||R.type===`brace`)||P.parens>0){Y({type:`plus`,value:z});continue}Y({type:`plus`,value:b});continue}if(z===`@`){if(f.noextglob!==!0&&V()===`(`&&V(2)!==`?`){Y({type:`at`,extglob:!0,value:z,output:``});continue}Y({type:`text`,value:z});continue}if(z!==`*`){(z===`$`||z===`^`)&&(z=`\\${z}`);let e=o.exec(U());e&&(z+=e[0],P.index+=e[0].length),Y({type:`text`,value:z});continue}if(R&&(R.type===`globstar`||R.star===!0)){R.type=`star`,R.star=!0,R.value+=z,R.output=N,P.backtrack=!0,P.globstar=!0,W(z);continue}let t=U();if(f.noextglob!==!0&&/^\([^?]/.test(t)){X(`star`,z);continue}if(R.type===`star`){if(f.noglobstar===!0){W(z);continue}let n=R.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(f.bash===!0&&(!i||t[0]&&t[0]!==`/`)){Y({type:`star`,value:z,output:``});continue}let o=P.braces>0&&(n.type===`comma`||n.type===`brace`),s=F.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){Y({type:`star`,value:z,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[P.index+4];if(n&&n!==`/`)break;t=t.slice(3),W(`/**`,3)}if(n.type===`bos`&&B()){R.type=`globstar`,R.value+=z,R.output=A(f),P.output=R.output,P.globstar=!0,W(z);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&B()){P.output=P.output.slice(0,-(n.output+R.output).length),n.output=`(?:${n.output}`,R.type=`globstar`,R.output=A(f)+(f.strictSlashes?`)`:`|$)`),R.value+=z,P.globstar=!0,P.output+=n.output+R.output,W(z);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;P.output=P.output.slice(0,-(n.output+R.output).length),n.output=`(?:${n.output}`,R.type=`globstar`,R.output=`${A(f)}${x}|${x}${e})`,R.value+=z,P.output+=n.output+R.output,P.globstar=!0,W(z+H()),Y({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){R.type=`globstar`,R.value+=z,R.output=`(?:^|${x}|${A(f)}${x})`,P.output=R.output,P.globstar=!0,W(z+H()),Y({type:`slash`,value:`/`,output:``});continue}P.output=P.output.slice(0,-R.output.length),R.type=`globstar`,R.output=A(f),R.value+=z,P.output+=R.output,P.globstar=!0,W(z);continue}let n={type:`star`,value:z,output:N};if(f.bash===!0){n.output=`.*?`,(R.type===`bos`||R.type===`slash`)&&(n.output=j+n.output),Y(n);continue}if(R&&(R.type===`bracket`||R.type===`paren`)&&f.regex===!0){n.output=z,Y(n);continue}(P.index===P.start||R.type===`slash`||R.type===`dot`)&&(R.type===`dot`?(P.output+=T,R.output+=T):f.dot===!0?(P.output+=E,R.output+=E):(P.output+=j,R.output+=j),V()!==`*`&&(P.output+=S,R.output+=S)),Y(n)}for(;P.brackets>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));P.output=r.escapeLast(P.output,`[`),J(`brackets`)}for(;P.parens>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));P.output=r.escapeLast(P.output,`(`),J(`parens`)}for(;P.braces>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));P.output=r.escapeLast(P.output,`{`),J(`braces`)}if(f.strictSlashes!==!0&&(R.type===`star`||R.type===`bracket`)&&Y({type:`maybe_slash`,value:``,output:`${x}?`}),P.backtrack===!0){P.output=``;for(let e of P.tokens)P.output+=e.output==null?e.value:e.output,e.suffix&&(P.output+=e.suffix)}return P};d.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:ee}=n.globChars(a.windows),_=a.dot?m:p,v=a.dot?h:p,y=a.capture?``:`?:`,b={negated:!1,prefix:``},x=a.bash===!0?`.*?`:g;a.capture&&(x=`(${x})`);let S=e=>e.noglobstar===!0?x:`(${y}(?:(?!${ee}${e.dot?f:l}).)*?)`,C=e=>{switch(e){case`*`:return`${_}${d}${x}`;case`.*`:return`${l}${d}${x}`;case`*.*`:return`${_}${x}${l}${d}${x}`;case`*/*`:return`${_}${x}${u}${d}${v}${x}`;case`**`:return _+S(a);case`**/*`:return`(?:${_}${S(a)}${u})?${v}${d}${x}`;case`**/*.*`:return`(?:${_}${S(a)}${u})?${v}${x}${l}${d}${x}`;case`**/.*`:return`(?:${_}${S(a)}${u})?${l}${d}${x}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=C(t[1]);return n?n+l+t[2]:void 0}}},w=C(r.removePrefix(e,b));return w&&a.strictSlashes!==!0&&(w+=`${u}?`),w},t.exports=d})),Qt=k(((e,t)=>{let n=Xt(),r=Zt(),i=Yt(),a=Jt(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),$t=A(k(((e,t)=>{let n=Qt(),r=Yt();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i}))(),1);const en=Array.isArray,tn=process.platform===`win32`,nn=/^(\/?\.\.)+$/;function rn(e,t={}){let n=e.length,r=Array(n),i=Array(n),a=!t.noglobstar;for(let a=0;a<n;a++){let n=un(e[a]);r[a]=n;let o=n.length,s=Array(o);for(let e=0;e<o;e++)s[e]=(0,$t.default)(n[e],t);i[a]=s}return t=>{let n=t.split(`/`);if(n[0]===`..`&&nn.test(t))return!0;for(let t=0;t<e.length;t++){let e=r[t],o=i[t],s=n.length,c=Math.min(s,e.length),l=0;for(;l<c;){let t=e[l];if(t.includes(`/`))return!0;if(!o[l](n[l]))break;if(a&&t===`**`)return!0;l++}if(l===s)return!0}return!1}}const an=/^[A-Z]:\/$/i,on=tn?e=>an.test(e):e=>e===`/`;function sn(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=on(e)?e.length:e.length+1;return(e,n)=>e.slice(t,n?-1:void 0)||`.`}let r=t.slice(e.length+1);return r?(e,t)=>{if(e===`.`)return r;let n=`${r}/${e}`;return t?n.slice(0,-1):n}:(e,t)=>t&&e!==`.`?e.slice(0,-1):e}return n?t=>_.relative(e,t)||`.`:n=>_.relative(e,`${t}/${n}`)||`.`}function cn(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=_.relative(e,`${t}/${n}`);return n.endsWith(`/`)&&r!==``?`${r}/`:r||`.`}}const ln={parts:!0};function un(e){let t=$t.default.scan(e,ln);return t.parts?.length?t.parts:[e]}const dn=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,fn=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,pn=tn?e=>e.replace(fn,`\\$&`):e=>e.replace(dn,`\\$&`);function mn(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=$t.default.scan(e);return n.isGlob||n.negated}function hn(...e){console.log(`[tinyglobby ${new Date().toLocaleTimeString(`es`)}]`,...e)}const gn=/^(\/?\.\.)+/,_n=/\\(?=[()[\]{}!*+?@|])/g,vn=/\\/g;function yn(e,t,n,r,i){let a=e;e.endsWith(`/`)&&(a=e.slice(0,-1)),!a.endsWith(`*`)&&t&&(a+=`/**`);let o=pn(n);a=m.isAbsolute(a.replace(_n,``))?_.relative(o,a):_.normalize(a);let s=gn.exec(a),c=un(a);if(s?.[0]){let e=(s[0].length+1)/3,t=0,i=o.split(`/`);for(;t<e&&c[t+e]===i[i.length+t-e];)a=a.slice(0,(e-t-1)*3)+a.slice((e-t)*3+c[t+e].length+1)||`.`,t++;let l=_.join(n,s[0].slice(t*3));!l.startsWith(`.`)&&r.root.length>l.length&&(r.root=l,r.depthOffset=-e+t)}if(!i&&r.depthOffset>=0){r.commonPath??=c;let e=[],t=Math.min(r.commonPath.length,c.length);for(let n=0;n<t;n++){let t=c[n];if(t===`**`&&!c[n+1]){e.pop();break}if(t!==r.commonPath[n]||mn(t)||n===c.length-1)break;e.push(t)}r.depthOffset=e.length,r.commonPath=e,r.root=e.length>0?_.join(n,...e):n}return a}function bn({patterns:e=[`**/*`],ignore:t=[],expandDirectories:n=!0},r,i){typeof e==`string`&&(e=[e]),typeof t==`string`&&(t=[t]);let a=[],o=[];for(let e of t)e&&(e[0]!==`!`||e[1]===`(`)&&o.push(yn(e,n,r,i,!0));for(let t of e)t&&(t[0]!==`!`||t[1]===`(`?a.push(yn(t,n,r,i,!1)):(t[1]!==`!`||t[2]===`(`)&&o.push(yn(t.slice(1),n,r,i,!0)));return{match:a,ignore:o}}function xn(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];e[n]=t(r)}return e}function Sn(e){return e?e instanceof URL?x(e).replace(vn,`/`):m.resolve(e).replace(vn,`/`):process.cwd().replace(vn,`/`)}function Cn(e,t={}){let n=process.env.TINYGLOBBY_DEBUG?{...t,debug:!0}:t,r=Sn(n.cwd);if(n.debug&&hn(`globbing with:`,{patterns:e,options:n,cwd:r}),Array.isArray(e)&&e.length===0)return[{sync:()=>[],withPromise:async()=>[]},!1];let i={root:r,commonPath:null,depthOffset:0},a=bn({...n,patterns:e},r,i);n.debug&&hn(`internal processing patterns:`,a);let o={dot:n.dot,nobrace:n.braceExpansion===!1,nocase:n.caseSensitiveMatch===!1,noextglob:n.extglob===!1,noglobstar:n.globstar===!1,posix:!0},s=(0,$t.default)(a.match,{...o,ignore:a.ignore}),c=(0,$t.default)(a.ignore,o),l=rn(a.match,o),u=sn(r,i.root,n.absolute),d=n.absolute?u:sn(r,i.root,!0),f={filters:[n.debug?(e,t)=>{let n=u(e,t),r=s(n);return r&&hn(`matched ${n}`),r}:(e,t)=>s(u(e,t))],exclude:n.debug?(e,t)=>{let n=d(t,!0),r=n!==`.`&&!l(n)||c(n);return hn(r?`skipped ${t}`:`crawling ${t}`),r}:(e,t)=>{let n=d(t,!0);return n!==`.`&&!l(n)||c(n)},fs:n.fs?{readdir:n.fs.readdir||p.readdir,readdirSync:n.fs.readdirSync||p.readdirSync,realpath:n.fs.realpath||p.realpath,realpathSync:n.fs.realpathSync||p.realpathSync,stat:n.fs.stat||p.stat,statSync:n.fs.statSync||p.statSync}:void 0,pathSeparator:`/`,relativePaths:!0,resolveSymlinks:!0,signal:n.signal};n.deep!==void 0&&(f.maxDepth=Math.round(n.deep-i.depthOffset)),n.absolute&&(f.relativePaths=!1,f.resolvePaths=!0,f.includeBasePath=!0),n.followSymbolicLinks===!1&&(f.resolveSymlinks=!1,f.excludeSymlinks=!0),n.onlyDirectories?(f.excludeFiles=!0,f.includeDirs=!0):n.onlyFiles===!1&&(f.includeDirs=!0),i.root=i.root.replace(vn,``);let m=i.root;n.debug&&hn(`internal properties:`,i);let h=r!==m&&!n.absolute&&cn(r,i.root);return[new qt(f).crawl(m),h]}async function wn(e,t){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=en(e)||typeof e==`string`,r=n?t:e,[i,a]=Cn(n?e:e.patterns,r);return a?xn(await i.withPromise(),a):i.withPromise()}const Tn=/^(?:( )+|\t+)/,En=`space`;function Dn(e,t,n){return e&&t===En&&n===1}function On(e,t){let n=new Map,r=0,i,a;for(let o of e.split(/\n/g)){if(!o)continue;let e=o.match(Tn);if(e===null)r=0,i=``;else{let o=e[0].length,s=e[1]?En:`tab`;if(Dn(t,s,o))continue;s!==i&&(r=0),i=s;let c=1,l=0,u=o-r;if(r=o,u===0)c=0,l=1;else{let e=Math.abs(u);if(Dn(t,s,e))continue;a=kn(s,e)}let d=n.get(a);n.set(a,d===void 0?[1,0]:[d[0]+c,d[1]+l])}}return n}function kn(e,t){return(e===En?`s`:`t`)+String(t)}function An(e){return{type:e[0]===`s`?En:`tab`,amount:Number(e.slice(1))}}function jn(e){let t,n=0,r=0;for(let[i,[a,o]]of e)(a>n||a===n&&o>r)&&(n=a,r=o,t=i);return t}function Mn(e,t){return(e===En?` `:` `).repeat(t)}function Nn(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);let t=On(e,!0);t.size===0&&(t=On(e,!1));let n=jn(t),r,i=0,a=``;return n!==void 0&&({type:r,amount:i}=An(n),a=Mn(r,i)),{amount:i,type:r,indent:a}}async function Pn(e){let t=await $(`package.json`);if(!t)throw Error(`No package.json found`);let n=await r(t,`utf8`),i=Nn(n).indent||` `,a=JSON.parse(n);a.dependencies=Object.fromEntries(Object.entries({...a.dependencies,...e}).sort(([e],[t])=>e.localeCompare(t))),await o(t,JSON.stringify(a,null,i)+`
2
+ `)}async function Fn(e,t=`latest`){let n=new URL(`${e}/${t}`,`https://registry.npmjs.org/`),{version:r}=await(await fetch(n)).json();return r}function In(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ln(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?In(Object(n),!0).forEach(function(t){Rn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):In(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Rn(e,t,n){return t=zn(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zn(e){var t=Bn(e,`string`);return typeof t==`symbol`?t:String(t)}function Bn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Vn=Hn({});function Hn(e){return t.withOptions=t=>Hn(Ln(Ln({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Un(n[e],s):n[e];s+=t}}let c=s.split(`
3
+ `),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
4
+ `)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
5
+ `).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Un(e,t){if(typeof e!=`string`||!e.includes(`
6
+ `))return e;let n=t.slice(t.lastIndexOf(`
7
+ `)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}const Wn=Vn.withOptions({alignValues:!0});var Gn=class{async initProject(){await Pn(await this.getDependencies());let e=await this.#r();for(let t of e)await this.#i(t)}async createSlice(e,t){let{modelPath:n}=await this.#t(e,t),r=await this.#n(e.name,t),{componentPath:i}=await this.createSliceComponent(e,r),{indexPath:a}=await this.#i(t);return{modelPath:n,componentPath:i,indexPath:a}}async readSlice(e){return(await this.#e(e)).model}async updateSlice(e){let t=await this.#e(e.id),{modelPath:n}=await this.#t(e,t.library),{indexPath:r}=await this.#i(t.library);return{modelPath:n,indexPath:r}}async renameSlice(e){let t=await this.#e(e.id),n=await this.#n(e.name,t.library);await i(t.directory,n);let{modelPath:r}=await this.#t(e,t.library),{indexPath:a}=await this.#i(t.library);return{modelPath:r,indexPath:a}}async deleteSlice(e){let t=await this.#e(e);await a(t.directory,{recursive:!0});let{indexPath:n}=await this.#i(t.library);return{sliceDirectory:t.directory,indexPath:n}}async getSlices(e){let t=e?[e]:await this.#r(),n=[];for(let e of t){let t=new URL(`*/model.json`,e),i=Array.from(await wn(l(t),{absolute:!0}),e=>u(e)),a=await Promise.all(i.map(async t=>{let n=new URL(`.`,t),i=await r(t,`utf8`);return{library:e,directory:n,model:JSON.parse(i)}}));n.push(...a)}return n}async getDefaultSliceLibrary(){return(await this.#r())[0]}async createCustomType(e){let{modelPath:t}=await this.#a(e);return{modelPath:t}}async readCustomType(e){let t=await this.#o(e),n=await r(new URL(`index.json`,t),`utf8`);return JSON.parse(n)}async updateCustomType(e){let{modelPath:t}=await this.#a(e);return{modelPath:t}}async renameCustomType(e){await i(await this.#o(e.id),await this.#o(e.id));let{modelPath:t}=await this.#a(e);return{modelPath:t}}async deleteCustomType(e){let t=await this.#o(e);return await a(t,{recursive:!0}),{customTypeDirectory:t}}async getCustomTypes(){let e=await this.#s(),t=new URL(`*/index.json`,e),n=Array.from(await wn(l(t),{absolute:!0}),e=>u(e));return await Promise.all(n.map(async e=>{let t=new URL(`.`,e),n=await r(e,`utf8`);return{directory:t,model:JSON.parse(n)}}))}async getProjectRoot(){let e=await $(`package.json`);if(!e)throw Error(`No package.json found`);return new URL(`./`,e)}async checkIsTypeScriptProject(){let e=await this.getProjectRoot();return await _e(new URL(`tsconfig.json`,e))}async getJsFileExtension(){return await this.checkIsTypeScriptProject()?`ts`:`js`}async#e(e){let t=(await this.getSlices()).find(t=>t.model.id===e);if(!t)throw Error(`No slice found with ID: ${e}`);return t}async#t(e,t){let r=await this.#n(e.name,t);await n(r,{recursive:!0});let i=new URL(`model.json`,r);return await o(i,this.#c(e)),{modelPath:i}}async#n(e,t){let n=Le(e);return Q(new URL(n,t))}async#r(){let e=await this.getProjectRoot(),t=await Ce(),n=t.ok?t.config.libraries:void 0;return n?.length?n.map(t=>{let n=t.replace(/^\//,``);return Q(new URL(n,e))}):[await this.getDefaultSliceLibraryPath(e)]}async#i(e){let t=await this.getSlices(e),n=await this.generateSliceLibraryIndexContents(t),r=`index.${await this.getJsFileExtension()}`,i=new URL(r,e);return await o(i,n),{indexPath:i}}async generateSliceLibraryIndexContents(e){let t=e.map(e=>{let t=Le(e.model.name),n=d(l(e.library),l(e.directory));return`import ${t} from "${this.getSliceImportPath(n)}";`}),n=e.map(e=>{let t=Le(e.model.name);return`${e.model.id}: ${t}`});return Wn`
8
+ // Code generated by Prismic. DO NOT EDIT.
9
+
10
+ ${t.join(`
11
+ `)}
12
+
13
+ export const components = {
14
+ ${n.join(`,
15
+ `)}
16
+ };
17
+ `}async#a(e){let t=await this.#o(e.id);await n(t,{recursive:!0});let r=new URL(`index.json`,t);return await o(r,this.#c(e)),{modelPath:r}}async#o(e){let t=await this.#s(),n=e;return Q(new URL(n,t))}async#s(){let e=await this.getProjectRoot();return new URL(`customtypes/`,e)}#c(e){return ve(e)}};const Kn=J({dependencies:Y(X(Z(),Z())),devDependencies:Y(X(Z(),Z()))});async function qn(){switch(await Jn()){case`next`:{let{NextJsFramework:e}=await import(`./nextjs-D4viImqE.mjs`);return new e}case`nuxt`:{let{NuxtFramework:e}=await import(`./nuxt-CbBJIJw1.mjs`);return new e}case`sveltekit`:{let{SvelteKitFramework:e}=await import(`./sveltekit-BuNy6sKm.mjs`);return new e}default:return}}async function Jn(){let e=await $(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={},devDependencies:i={}}=re(Kn,JSON.parse(t)),a={...n,...i};if(`next`in a)return`next`;if(`nuxt`in a)return`nuxt`;if(`@sveltejs/kit`in a)return`sveltekit`}catch{}}export{k as A,J as C,ae as D,X as E,A as M,Z as O,q as S,re as T,ge as _,Le as a,K as b,Ce as c,_e as d,$ as f,de as g,fe as h,Fn as i,j,ne as k,Se as l,ue as m,qn as n,ke as o,pe as p,Wn as r,xe as s,Gn as t,Te as u,oe as v,Y as w,B as x,G as y};
package/dist/index.mjs ADDED
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,b as s,c,f as l,g as u,h as d,j as f,k as p,l as m,m as h,n as ee,o as te,p as ne,r as re,s as ie,v as ae,w as g,x as oe,y as se}from"./framework-AxGiKSX9.mjs";import*as ce from"node:util";import{parseArgs as _,promisify as le}from"node:util";import{readFile as ue,rm as de}from"node:fs/promises";import*as fe from"node:http";import*as v from"node:os";import{homedir as pe}from"node:os";import{exec as me,execFile as he,spawn as ge}from"node:child_process";import{dirname as _e,join as ve,posix as ye,sep as be}from"node:path";import{createHash as xe,randomUUID as Se}from"node:crypto";import{setTimeout as Ce}from"node:timers/promises";import{isMainThread as we,threadId as Te}from"worker_threads";import*as Ee from"node:diagnostics_channel";import{subscribe as y}from"node:diagnostics_channel";import{createReadStream as De,existsSync as Oe,readFile as ke,readFileSync as Ae,readdir as je}from"node:fs";import{createInterface as Me}from"node:readline";import{Worker as Ne}from"node:worker_threads";import*as Pe from"node:https";import{Readable as Fe}from"node:stream";import{createGzip as Ie}from"node:zlib";import*as b from"node:net";import*as Le from"node:tls";import{AsyncLocalStorage as Re}from"node:async_hooks";var ze=`prismic`,Be=`0.0.0-canary.2cfb4a8`;function Ve(e){me(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function He(e,t={}){let{credentials:n=`include`}=t,r=new Headers(t.headers);if(r.set(`Accept`,`application/json`),n===`include`){let e=await u();e&&r.set(`Cookie`,`SESSION=fake_session; prismic-auth=${e}`)}!r.has(`Content-Type`)&&t.body&&r.set(`Content-Type`,`application/json`),t.body instanceof FormData&&r.delete(`Content-Type`);let i=r.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,o=await fetch(e,{...t,body:i,headers:r}),s=await o.clone().json().catch(()=>o.clone().text());if(o.ok){if(!t?.schema)return{ok:!0,value:s};try{return{ok:!0,value:a(t.schema,s)}}catch(e){if(oe(e))return{ok:!1,value:s,error:e};throw e}}else if(o.status===401)return{ok:!1,value:s,error:new Ge(o)};else if(o.status===403)return{ok:!1,value:s,error:new We(o)};else return{ok:!1,value:s,error:new Ue(o)}}var Ue=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},We=class extends Ue{},Ge=class extends Ue{};const Ke=e({id:r(),type:i(`SharedSlice`),name:r(),description:g(r()),variations:se(e({id:r(),name:r(),description:g(r()),docURL:g(r()),version:g(r()),imageUrl:g(r()),primary:g(n(r(),p())),items:g(n(r(),p()))}))}),qe=e({id:r(),label:g(r()),repeatable:s(),status:s(),format:g(r()),json:n(r(),p())});async function Je(){let e=await d();return e.hostname=`customtypes.${e.hostname}`,e}async function Ye(e){let n=await u();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Je(),i=new URL(`customtypes`,r);try{let r=await fetch(i,{headers:{Authorization:`Bearer ${n}`,repository:e}});if(!r.ok)return r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`};let a=await r.json(),o=t(se(qe),a);return o.success?{ok:!0,value:o.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Xe(e){let n=await u();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Je(),i=new URL(`slices`,r);try{let r=await fetch(i,{headers:{Authorization:`Bearer ${n}`,repository:e}});if(!r.ok)return r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`};let a=await r.json(),o=t(se(Ke),a);return o.success?{ok:!0,value:o.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}const Ze=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let Qe=!1,$e=``,et=``;const tt={app:{name:ze,version:Be}},nt=[];async function rt(){try{if(Qe=await ct(),!Qe)return;$e=Se(),et=`Basic ${btoa(Ze+`:`)}`,process.on(`exit`,ot)}catch{Qe=!1}}function it(e){Qe&&nt.push({event:`Prismic CLI Start`,properties:{commandType:e,fullCommand:process.argv.join(` `)}})}function at(e,t,n){if(!Qe)return;let r={commandType:e,fullCommand:process.argv.join(` `),success:t};n!==void 0&&(r.error=(n instanceof Error?n.message:String(n)).slice(0,512)),nt.push({event:`Prismic CLI End`,properties:r})}function ot(){if(nt.length!==0){try{let e=Buffer.from(JSON.stringify({url:`https://api.segment.io/v1/track`,authorization:et,events:nt.map(e=>({anonymousId:$e,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:tt,timestamp:new Date().toISOString()}))})).toString(`base64`);ge(process.execPath,[`--input-type=module`,`-e`,st,e],{detached:!0,stdio:`ignore`}).unref()}catch{}nt.length=0}}const st=`
3
+ const {url, authorization, events} = JSON.parse(Buffer.from(process.argv[1], "base64"));
4
+ const h = {"Content-Type": "application/json", Authorization: authorization};
5
+ await Promise.allSettled(events.map(e => fetch(url, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})));
6
+ `;async function ct(){try{return!((await lt(ve(pe(),`.prismicrc`)))?.telemetry===!1||(await lt(ve(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function lt(e){try{let t=await ue(e,`utf8`);return JSON.parse(t)}catch{return}}const ut=5e3,dt=6e4;async function ft(){let{values:{help:e,repo:t=await m(),watch:n}}=_({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},watch:{type:`boolean`,short:`w`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Sync slices, page types, and custom types from Prismic to local files.
7
+
8
+ Remote models are the source of truth. Local files are created, updated,
9
+ or deleted to match.
10
+
11
+ USAGE
12
+ prismic sync [flags]
13
+
14
+ FLAGS
15
+ -r, --repo string Repository domain
16
+ -w, --watch Watch for changes and sync continuously
17
+ -h, --help Show help for command`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await h()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}let r=await ee();if(!r){console.error(`Could not detect a supported framework (Next.js, Nuxt, or SvelteKit).`),process.exitCode=1;return}console.info(`Syncing from repository: ${t}`),n?await pt(t,r):(await mt(t,r),await ht(t,r),console.info(`Sync complete`))}async function pt(e,t){let n=await Xe(e);if(!n.ok){console.error(`Failed to fetch remote slices: ${n.error}`),process.exitCode=1;return}let r=n.value,i=await Ye(e);if(!i.ok){console.error(`Failed to fetch remote custom types: ${i.error}`),process.exitCode=1;return}let a=i.value;await mt(e,t),await ht(e,t),console.info(re`
18
+ Initial sync completed!
19
+
20
+ Watching for changes (polling every ${ut/1e3}s),
21
+ Press Ctrl+C to stop
22
+ `);let o=vt(r),s=vt(a),c=0;for(process.on(`SIGINT`,gt),process.on(`SIGTERM`,gt),process.on(`SIGHUP`,gt),process.on(`SIGQUIT`,gt),process.platform===`win32`&&process.on(`SIGBREAK`,gt);;){await Ce(_t(c));try{let n=await Xe(e);if(!n.ok)continue;let r=vt(n.value),i=r!==o,a=await Ye(e);if(!a.ok)continue;let l=vt(a.value),u=l!==s;(i||u)&&(i&&(await mt(e,t),o=r),u&&(await ht(e,t),s=l)),c=0}catch(e){c++;let t=e instanceof Error?e.message:`Unknown error`,n=Math.min(ut*2**(c-1),dt);if(console.error(`Error checking for changes: ${t}. Retrying in ${n/1e3}s...`),c>=10)throw Error(`Too many consecutive errors (10), stopping watch.`)}}}async function mt(e,t){let n=await Xe(e);if(!n.ok){console.error(`Failed to fetch remote slices: ${n.error}`),process.exitCode=1;return}let r=n.value,i=await t.getSlices();for(let e of r)i.find(t=>t.model.id===e.id)&&await t.updateSlice(e);for(let e of i)r.some(t=>t.id===e.model.id)||await t.deleteSlice(e.model.id);let a=await t.getDefaultSliceLibrary();for(let e of r)i.some(t=>t.model.id===e.id)||await t.createSlice(e,a)}async function ht(e,t){let n=await Ye(e);if(!n.ok){console.error(`Failed to fetch remote custom types: ${n.error}`),process.exitCode=1;return}let r=n.value,i=await t.getCustomTypes();for(let e of r)i.find(t=>t.model.id===e.id)&&await t.updateCustomType(e);for(let e of i)r.some(t=>t.id===e.model.id)||await t.deleteCustomType(e.model.id);for(let e of r)i.some(t=>t.model.id===e.id)||await t.createCustomType(e)}function gt(){console.info(`Watch stopped. Goodbye!`),at(`sync`,!0),process.exit(0)}function _t(e){return e===0?ut:Math.min(ut*2**(e-1),dt)}function vt(e){return xe(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const yt=e({repositories:se(e({domain:r(),name:g(r())}))});async function bt(){let{values:e}=_({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}}});if(e.help){console.info(`Initialize a Prismic project by creating a prismic.config.json file.
23
+
24
+ Detects the project framework, installs dependencies, and syncs models
25
+ from Prismic. If a slicemachine.config.json exists, it will be migrated.
26
+
27
+ USAGE
28
+ prismic init [flags]
29
+
30
+ FLAGS
31
+ -r, --repo string Repository name
32
+ -h, --help Show help for command
33
+
34
+ EXAMPLES
35
+ prismic init --repo my-repo
36
+
37
+ LEARN MORE
38
+ Use \`prismic <command> --help\` for more information about a command.`);return}if((await c()).ok){console.error(`A prismic.config.json file already exists.`),process.exitCode=1;return}let t=await l(`slicemachine.config.json`,{stop:`package.json`}),n,r;if(t)try{let e=await ue(t,`utf8`),i=JSON.parse(e);n=i.repositoryName,r=i.libraries}catch{console.warn(`Could not read slicemachine.config.json, ignoring.`)}let i=e.repo??n;if(!i){console.error(`Missing required flag: --repo`),process.exitCode=1;return}if(!await h()){console.info(`Not logged in. Starting login...`);let{email:e}=await ne({onReady:e=>{console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),Ve(e)}});console.info(`Logged in as ${e}`)}let a=await He(new URL(`profile`,await ae()),{schema:yt});if(!a.ok){console.error(`Failed to fetch user profile.`),process.exitCode=1;return}if(!a.value.repositories.find(e=>e.domain===i)){console.error(`Repository "${i}" not found in your account. Check the name or create it with \`prismic repo create\`.`),process.exitCode=1;return}let o=await ee();if(!o){console.error(`Could not detect a supported framework (Next.js, Nuxt, or SvelteKit).`),process.exitCode=1;return}let s={repositoryName:i};r?.length&&(s.libraries=r);let u=await ie(s);if(!u.ok){u.error instanceof te?console.error(`Could not find a package.json file. Run this command from a project directory.`):console.error(`Failed to create config file.`),process.exitCode=1;return}t&&(await de(t),console.info(`Migrated slicemachine.config.json to prismic.config.json`)),await o.initProject(),await mt(i,o),await ht(i,o),console.info(`Initialized Prismic for repository "${i}". Run \`npm install\` to install new dependencies.`)}const x=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,S=globalThis,C=`10.42.0`;function w(){return xt(S),S}function xt(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||C,t[C]=t[C]||{}}function T(e,t,n=S){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[C]=r[C]||{};return i[e]||(i[e]=t())}const St=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Ct={};function E(e){if(!(`console`in S))return e();let t=S.console,n={},r=Object.keys(Ct);r.forEach(e=>{let r=Ct[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function wt(){jt().enabled=!0}function Tt(){jt().enabled=!1}function Et(){return jt().enabled}function Dt(...e){At(`log`,...e)}function Ot(...e){At(`warn`,...e)}function kt(...e){At(`error`,...e)}function At(e,...t){x&&Et()&&E(()=>{S.console[e](`Sentry Logger [${e}]:`,...t)})}function jt(){return x?T(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const D={enable:wt,disable:Tt,isEnabled:Et,log:Dt,warn:Ot,error:kt},Mt=/\(error: (.*)\)/,Nt=/captureMessage|captureException/;function Pt(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
39
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Mt.test(n)?n.replace(Mt,`$1`):n;if(!o.match(/\S*Error: /)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=50+r)break}}return It(i.slice(r))}}function Ft(e){return Array.isArray(e)?Pt(...e):e}function It(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Lt(t).function||``)&&t.pop(),t.reverse(),Nt.test(Lt(t).function||``)&&(t.pop(),Nt.test(Lt(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Lt(t).filename,function:e.function||`?`}))}function Lt(e){return e[e.length-1]||{}}const Rt=`<anonymous>`;function zt(e){try{return!e||typeof e!=`function`?Rt:e.name||Rt}catch{return Rt}}function Bt(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function Vt(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Ht={},Ut={};function Wt(e,t){Ht[e]=Ht[e]||[],Ht[e].push(t)}function Gt(e,t){if(!Ut[e]){Ut[e]=!0;try{t()}catch(t){x&&D.error(`Error while instrumenting ${e}`,t)}}}function Kt(e,t){let n=e&&Ht[e];if(n)for(let r of n)try{r(t)}catch(t){x&&D.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${zt(r)}\nError:`,t)}}let qt=null;function Jt(e){let t=`error`;Wt(t,e),Gt(t,Yt)}function Yt(){qt=S.onerror,S.onerror=function(e,t,n,r,i){return Kt(`error`,{column:r,error:i,line:n,msg:e,url:t}),qt?qt.apply(this,arguments):!1},S.onerror.__SENTRY_INSTRUMENTED__=!0}let Xt=null;function Zt(e){let t=`unhandledrejection`;Wt(t,e),Gt(t,Qt)}function Qt(){Xt=S.onunhandledrejection,S.onunhandledrejection=function(e){return Kt(`unhandledrejection`,e),Xt?Xt.apply(this,arguments):!0},S.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const $t=Object.prototype.toString;function O(e){switch($t.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return k(e,Error)}}function en(e,t){return $t.call(e)===`[object ${t}]`}function tn(e){return en(e,`ErrorEvent`)}function nn(e){return en(e,`String`)}function rn(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function an(e){return e===null||rn(e)||typeof e!=`object`&&typeof e!=`function`}function on(e){return en(e,`Object`)}function sn(e){return typeof Event<`u`&&k(e,Event)}function cn(e){return typeof Element<`u`&&k(e,Element)}function ln(e){return en(e,`RegExp`)}function un(e){return!!(e?.then&&typeof e.then==`function`)}function dn(e){return on(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function k(e,t){try{return e instanceof t}catch{return!1}}function fn(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const pn=S;function mn(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&i++<5&&(o=hn(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=n.parentNode;return r.reverse().join(` > `)}catch{return`<unknown>`}}function hn(e,t){let n=e,r=[];if(!n?.tagName)return``;if(pn.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let e=n.className;if(e&&nn(e)){let t=e.split(/\s+/);for(let e of t)r.push(`.${e}`)}}for(let e of[`aria-label`,`type`,`name`,`title`,`alt`]){let t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join(``)}function gn(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&vn(i,r);try{e[t]=i}catch{x&&D.log(`Failed to replace method "${t}" in object`,e)}}function _n(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{x&&D.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function vn(e,t){try{e.prototype=t.prototype=t.prototype||{},_n(e,`__sentry_original__`,t)}catch{}}function yn(e){return e.__sentry_original__}function bn(e){if(O(e))return{message:e.message,name:e.name,stack:e.stack,...Sn(e)};if(sn(e)){let t={type:e.type,target:xn(e.target),currentTarget:xn(e.currentTarget),...Sn(e)};return typeof CustomEvent<`u`&&k(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function xn(e){try{return cn(e)?mn(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Sn(e){if(typeof e==`object`&&e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Cn(e){let t=Object.keys(bn(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let A;function wn(e){if(A!==void 0)return A?A(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=S;return t in n&&typeof n[t]==`function`?(A=n[t],A(e)):(A=null,e())}function j(){return wn(()=>Math.random())}function Tn(){return wn(()=>Date.now())}function En(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Dn(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function On(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{fn(r)?n.push(Bt(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function M(e,t,n=!1){return nn(e)?ln(t)?t.test(e):nn(t)?n?e===t:e.includes(t):!1:!1}function kn(e,t=[],n=!1){return t.some(t=>M(e,t,n))}function An(){let e=S;return e.crypto||e.msCrypto}let jn;function Mn(){return j()*16}function N(e=An()){try{if(e?.randomUUID)return wn(()=>e.randomUUID()).replace(/-/g,``)}catch{}return jn||=`10000000100040008000100000000000`,jn.replace(/[018]/g,e=>(e^(Mn()&15)>>e/4).toString(16))}function Nn(e){return e.exception?.values?.[0]}function P(e){let{message:t,event_id:n}=e;if(t)return t;let r=Nn(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Pn(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function Fn(e,t){let n=Nn(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}const In=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function Ln(e){return parseInt(e||``,10)}function Rn(e){let t=e.match(In)||[],n=Ln(t[1]),r=Ln(t[2]),i=Ln(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function zn(e){if(Bn(e))return!0;try{_n(e,`__sentry_captured__`,!0)}catch{}return!1}function Bn(e){try{return e.__sentry_captured__}catch{}}const Vn=1e3;function Hn(){return Tn()/Vn}function Un(){let{performance:e}=S;if(!e?.now||!e.timeOrigin)return Hn;let t=e.timeOrigin;return()=>(t+wn(()=>e.now()))/Vn}let Wn;function Gn(){return(Wn??=Un())()}function Kn(e){let t=Gn(),n={sid:N(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Jn(n)};return e&&F(n,e),n}function F(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Gn(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:N()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function qn(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),F(e,n)}function Jn(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Yn(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Yn(r[e],t[e],n-1));return r}function I(){return N()}function Xn(){return N().substring(16)}const Zn=`_sentrySpan`;function Qn(e,t){t?_n(e,Zn,t):delete e[Zn]}function $n(e){return e[Zn]}var L=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:I(),sampleRand:j()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Qn(t,$n(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&F(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():on(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Qn(this,void 0),this._attachments=[],this.setPropagationContext({traceId:I(),sampleRand:j()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:Hn(),...e,message:e.message?En(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:$n(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Yn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||N();if(!this._client)return x&&D.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||N();if(!this._client)return x&&D.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||N();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(x&&D.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function er(){return T(`defaultCurrentScope`,()=>new L)}function tr(){return T(`defaultIsolationScope`,()=>new L)}var nr=class{constructor(e,t){let n;n=e||new L;let r;r=t||new L,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return un(n)?n.then(e=>(this._popScope(),e),e=>{throw this._popScope(),e}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function R(){let e=xt(w());return e.stack=e.stack||new nr(er(),tr())}function rr(e){return R().withScope(e)}function ir(e,t){let n=R();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function ar(e){return R().withScope(()=>e(R().getIsolationScope()))}function or(){return{withIsolationScope:ar,withScope:rr,withSetScope:ir,withSetIsolationScope:(e,t)=>ar(t),getCurrentScope:()=>R().getScope(),getIsolationScope:()=>R().getIsolationScope()}}function sr(e){let t=xt(w());t.acs=e}function z(e){let t=xt(e);return t.acs?t.acs:or()}function B(){return z(w()).getCurrentScope()}function V(){return z(w()).getIsolationScope()}function cr(){return T(`globalScope`,()=>new L)}function lr(...e){let t=z(w());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function ur(...e){let t=z(w());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function H(){return B().getClient()}function dr(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Xn()};return n&&(i.parent_span_id=n),i}const fr=`sentry.profile_id`,pr=`sentry.exclusive_time`;function mr(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function hr(e){let t=e;return{scope:t._sentryScope,isolationScope:mr(t._sentryIsolationScope)}}const gr=/^sentry-/;function _r(e){let t=yr(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(gr)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function vr(e){if(e)return xr(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function yr(e){if(!(!e||!nn(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=br(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):br(e)}function br(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function xr(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(x&&D.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Sr=/^o(\d+)\./,Cr=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function wr(e){return e===`http`||e===`https`}function U(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function Tr(e){let t=Cr.exec(e);if(!t){E(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return Er({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Er(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Dr(e){if(!x)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(D.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?wr(r)?t&&isNaN(parseInt(t,10))?(D.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(D.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(D.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Or(e){return e.match(Sr)?.[1]}function kr(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Or(n)),r}function Ar(e){let t=typeof e==`string`?Tr(e):Er(e);if(!(!t||!Dr(t)))return t}function jr(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}const Mr=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Nr(e){if(!e)return;let t=e.match(Mr);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Pr(e,t){let n=Nr(e),r=_r(t);if(!n?.traceId)return{traceId:I(),sampleRand:j()};let i=Lr(n,r);r&&(r.sample_rand=i.toString());let{traceId:a,parentSpanId:o,parentSampled:s}=n;return{traceId:a,parentSpanId:o,sampled:s,dsc:r||{},sampleRand:i}}function Fr(e=I(),t=Xn(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Ir(e=I(),t=Xn(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Lr(e,t){let n=jr(t?.sample_rand);if(n!==void 0)return n;let r=jr(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?j()*r:r+j()*(1-r):j()}function Rr(e,t){let n=kr(e);return t&&n&&t!==n?(D.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):e.getOptions().strictTraceContinuation&&(t&&!n||!t&&n)?(D.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}let zr=!1;function Br(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Kr(e).parent_span_id,a=hr(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Xn():t,trace_id:n}}function Vr(e){let{traceId:t,spanId:n}=e.spanContext();return Fr(t,n,Yr(e))}function Hr(e){let{traceId:t,spanId:n}=e.spanContext();return Ir(t,n,Yr(e))}function Ur(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function Wr(e){return typeof e==`number`?Gr(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Gr(e.getTime()):Gn()}function Gr(e){return e>9999999999?e/1e3:e}function Kr(e){if(Jr(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(qr(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0,start_timestamp:Wr(i),timestamp:Wr(o)||void 0,status:Xr(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Ur(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function qr(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Jr(e){return typeof e.getSpanJSON==`function`}function Yr(e){let{traceFlags:t}=e.spanContext();return t===1}function Xr(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function Zr(e){return e._sentryRootSpan||e}function Qr(){let e=z(w());return e.getActiveSpan?e.getActiveSpan():$n(B())}function $r(){zr||=(E(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let ei=!1;function ti(){if(ei)return;function e(){let e=Qr(),t=e&&Zr(e);if(t){let e=`internal_error`;x&&D.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,ei=!0,Jt(e),Zt(e)}function ni(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||H()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function ri(e){D.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ii(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(oi(n)){if(M(e.description,n))return x&&ri(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?M(e.description,n.name):!0,r=n.op?e.op&&M(e.op,n.op):!0;if(t&&r)return x&&ri(e),!0}return!1}function ai(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function oi(e){return typeof e==`string`||e instanceof RegExp}const si=`production`;function ci(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||si,release:n.release,public_key:r,trace_id:e,org_id:kr(t)};return t.emit(`createDsc`,i),i}function li(e,t){let n=t.getPropagationContext();return n.dsc||ci(n.traceId,e)}function ui(e){let t=H();if(!t)return{};let n=Zr(e),r=Kr(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n._frozenDsc;if(c)return s(c);let l=a?.get(`sentry.dsc`),u=l&&_r(l);if(u)return s(u);let d=ci(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),ni()&&(d.sampled=String(Yr(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??hr(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function W(e,t=100,n=1/0){try{return fi(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function di(e,t=3,n=100*1024){let r=W(e,t);return gi(r)>n?di(e,t-1,n):r}function fi(e,t,n=1/0,r=1/0,i=_i()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=pi(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return fi(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=bn(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=fi(e,t,c-1,r,i),d++}return o(t),u}function pi(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(typeof global<`u`&&t===global)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(fn(t))return Bt(t);if(dn(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${zt(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=mi(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function mi(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function hi(e){return~-encodeURI(e).split(/%..|./).length}function gi(e){return hi(JSON.stringify(e))}function _i(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function G(e,t=[]){return[e,t]}function vi(e,t){let[n,r]=e;return[n,[...r,t]]}function yi(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function bi(e,t){return yi(e,(e,n)=>t.includes(n))}function xi(e){let t=xt(S);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Si(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[xi(r),e]:r.push(typeof e==`string`?xi(e):e)}for(let e of n){let[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(W(n))}i(e)}}return typeof r==`string`?r:Ci(r)}function Ci(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function wi(e){let t=typeof e.data==`string`?xi(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Ti={session:`session`,sessions:`session`,attachment:`attachment`,transaction:`transaction`,event:`error`,client_report:`internal`,user_report:`default`,profile:`profile`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,feedback:`feedback`,span:`span`,raw_security:`security`,log:`log_item`,metric:`metric`,trace_metric:`metric`};function Ei(e){return Ti[e]}function Di(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Oi(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:U(r)},...i&&{trace:i}}}function ki(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function Ai(e,t,n,r){let i=Di(n);return G({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:U(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function ji(e,t,n,r){let i=Di(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;ki(e,n?.sdk);let o=Oi(e,i,r,t);return delete e.sdkProcessingMetadata,G(o,[[{type:a},e]])}const Mi=`__SENTRY_SUPPRESS_TRACING__`,Ni=(e,t)=>{let n=z(w());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=H(),o=_r(i);return a&&!Rr(a,o?.org_id)?Ii(t):lr(e=>{let n=Pr(r,i);return e.setPropagationContext(n),Qn(e,void 0),t()})};function Pi(e,t){let n=Li();return n.withActiveSpan?n.withActiveSpan(e,t):lr(n=>(Qn(n,e||void 0),t(n)))}function Fi(e){let t=Li();return t.suppressTracing?t.suppressTracing(e):lr(t=>{t.setSDKProcessingMetadata({[Mi]:!0});let n=e();return t.setSDKProcessingMetadata({[Mi]:void 0}),n})}function Ii(e){return lr(t=>(t.setPropagationContext({traceId:I(),sampleRand:j()}),x&&D.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),Pi(null,e)))}function Li(){return z(w())}function Ri(e){return new Bi(t=>{t(e)})}function zi(e){return new Bi((t,n)=>{n(e)})}var Bi=class e{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===0)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===1&&e[1](this._value),this._state===2&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===0){if(un(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}};function Vi(e,t,n,r=0){try{let i=Hi(t,n,e,r);return un(i)?i:Ri(i)}catch(e){return zi(e)}}function Hi(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return x&&a===null&&D.log(`Event processor "${i.id||`?`}" dropped event`),un(a)?a.then(e=>Hi(e,t,n,r+1)):Hi(a,t,n,r+1)}let K,Ui,Wi,q;function Gi(e){let t=S._sentryDebugIds,n=S._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(q&&r.length===Ui&&i.length===Wi)return q;Ui=r.length,Wi=i.length,q={},K||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=K?.[r];if(i&&q&&t)q[i[0]]=t,K&&(K[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&q&&K){q[i]=t,K[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),q}function Ki(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Xi(e,t),r&&$i(e,r),ea(e,n),Zi(e,i),Qi(e,a)}function qi(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;Ji(e,`extra`,n),Ji(e,`tags`,r),Ji(e,`attributes`,i),Ji(e,`user`,a),Ji(e,`contexts`,o),e.sdkProcessingMetadata=Yn(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function Ji(e,t,n){e[t]=Yn(e[t],n,1)}function Yi(e,t){let n=cr().getScopeData();return e&&qi(n,e.getScopeData()),t&&qi(n,t.getScopeData()),n}function Xi(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Zi(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Qi(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function $i(e,t){e.contexts={trace:Br(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ui(t),...e.sdkProcessingMetadata};let n=Kr(Zr(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function ea(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function ta(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||N(),timestamp:t.timestamp||Hn()},l=n.integrations||e.integrations.map(e=>e.name);na(c,e),aa(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&ra(c,e.stackParser);let u=sa(r,n.captureContext);n.mechanism&&Fn(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Yi(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Ki(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Ri(c):Vi(m,c,n)).then(e=>(e&&ia(e),typeof o==`number`&&o>0?oa(e,o,s):e))}function na(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||si,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=En(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=En(e.value,a)})}function ra(e,t){let n=Gi(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function ia(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function aa(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function oa(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:W(e.data,t,n)}}))},...e.user&&{user:W(e.user,t,n)},...e.contexts&&{contexts:W(e.contexts,t,n)},...e.extra&&{extra:W(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=W(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:W(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=W(e.contexts.flags,3,n)),r}function sa(e,t){if(!t)return e;let n=e?e.clone():new L;return n.update(t),n}function ca(e){if(e)return la(e)||da(e)?{captureContext:e}:e}function la(e){return e instanceof L||typeof e==`function`}const ua=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function da(e){return Object.keys(e).some(e=>ua.includes(e))}function fa(e,t){return B().captureException(e,ca(t))}function pa(e,t){V().setContext(e,t)}async function ma(e){let t=H();return t?t.flush(e):(x&&D.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function ha(){let e=H();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function ga(e){let t=V(),{user:n}=Yi(t,B()),{userAgent:r}=S.navigator||{},i=Kn({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&F(a,{status:`exited`}),_a(),t.setSession(i),i}function _a(){let e=V(),t=B().getSession()||e.getSession();t&&qn(t),va(),e.setSession()}function va(){let e=V(),t=H(),n=e.getSession();n&&t&&t.captureSession(n)}function ya(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function ba(e){return`${ya(e)}${e.projectId}/envelope/`}function xa(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function Sa(e,t,n){return t||`${ba(e)}?${xa(e,n)}`}const Ca=[];function wa(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function Ta(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return wa(r)}function Ea(e,t){let n={};return t.forEach(t=>{t&&Oa(e,t,n)}),n}function Da(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Oa(e,t,n){if(n[t.name]){x&&D.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Ca.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Ca.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}x&&D.log(`Integration installed: ${t.name}`)}function J(e){return e}function ka(e,t){return t?lr(t,()=>{let n=Qr(),r=n?Br(n):dr(t);return[n?ui(n):li(e,t),r]}):[void 0,void 0]}function Aa(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function ja(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=U(r)),G(i,[Aa(e)])}function Ma(e,t){let n=t??Na(e)??[];if(n.length===0)return;let r=e.getOptions(),i=ja(n,r._metadata,r.tunnel,e.getDsn());Pa().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Na(e){return Pa().get(e)}function Pa(){return T(`clientToLogBufferMap`,()=>new WeakMap)}function Fa(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Ia(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=U(r)),G(i,[Fa(e)])}function La(e,t){let n=t??Ra(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Ia(n,r._metadata,r.tunnel,e.getDsn());za().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Ra(e){return za().get(e)}function za(){return T(`clientToMetricBufferMap`,()=>new WeakMap)}function Ba(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const Va=Symbol.for(`SentryBufferFullError`);function Ha(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return zi(Va);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Ri(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Ba(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Ua(e,t=Tn()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function Wa(e,t){return e[t]||e.all||0}function Ga(e,t,n=Tn()){return Wa(e,t)>n}function Ka(e,{statusCode:t,headers:n},r=Tn()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Ua(o,r):t===429&&(i.all=r+60*1e3);return i}function qa(e,t,n=Ha(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(yi(i,(t,n)=>{let i=Ei(n);Ga(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=G(i[0],a),s=t=>{if(bi(o,[`client_report`])){x&&D.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}yi(o,(n,r)=>{e.recordDroppedEvent(t,Ei(r))})};return n.add(()=>t({body:Si(o)}).then(e=>e.statusCode===413?(x&&D.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(x&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&D.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Ka(r,e),e),e=>{throw s(`network_error`),x&&D.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===Va)return x&&D.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Ja(e,t,n){let r=[{type:`client_report`},{timestamp:n||Hn(),discarded_events:e}];return G(t?{dsn:t}:{},[r])}function Ya(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Xa(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[fr],exclusive_time:o?.[pr],measurements:e.measurements,is_segment:!0}}function Za(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[fr]:e.profile_id},...e.exclusive_time&&{[pr]:e.exclusive_time}}}},measurements:e.measurements}}const Qa=`Not capturing exception because it's already been captured.`,$a=`Discarded session because of missing or non-string release`,eo=Symbol.for(`SentryInternalError`),to=Symbol.for(`SentryDoNotSendEventError`);function no(e){return{message:e,[eo]:!0}}function ro(e){return{message:e,[to]:!0}}function io(e){return!!e&&typeof e==`object`&&eo in e}function ao(e){return!!e&&typeof e==`object`&&to in e}function oo(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=Ba(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var so=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Ha(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=Ar(e.dsn):x&&D.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Sa(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&oo(this,`afterCaptureLog`,`flushLogs`,ho,Ma),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&oo(this,`afterCaptureMetric`,`flushMetrics`,mo,La)}captureException(e,t,n){let r=N();if(zn(e))return x&&D.log(Qa),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:N(),...n},a=rn(e)?e:String(e),o=an(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=N();if(t?.originalException&&zn(t.originalException))return x&&D.log(Qa),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=co(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),F(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(!t)return!0;this.emit(`flush`);let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){Ma(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let t=this._integrations[e.name];Oa(this,e,this._integrations),t||Da(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=ji(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=vi(n,wi(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=si}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){x&&D.warn($a);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){x&&D.warn($a);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Ai(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;x&&D.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return x&&D.error(`Error while sending envelope:`,e),{}}return x&&D.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Ea(this,e),Da(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(F(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a?.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),ta(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:dr(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:li(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=B(),r=V()){return x&&fo(e)&&D.log(`Captured error event \`${Ya(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{x&&(ao(e)?D.log(e.message):io(e)?D.warn(e.message):D.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=po(e),s=fo(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:jr(a);if(s&&typeof l==`number`&&j()>l)return this.recordDroppedEvent(`sample_rate`,`error`),zi(ro(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=co(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),ro("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:lo(uo(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw ro(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw ao(e)||io(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),no(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===Va&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){x&&D.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){x&&D.log(`No outcomes to send`);return}if(!this._dsn){x&&D.log(`No dsn provided, will not send outcomes`);return}x&&D.log(`Sending outcomes:`,e);let t=Ja(e,this._options.tunnel&&U(this._dsn));this.sendEnvelope(t)}};function co(e){return e===`replay_event`?`replay`:e||`error`}function lo(e,t){let n=`${t} must return \`null\` or a valid event.`;if(un(e))return e.then(e=>{if(!on(e)&&e!==null)throw no(n);return e},e=>{throw no(`${t} rejected with ${e}`)});if(!on(e)&&e!==null)throw no(n);return e}function uo(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(fo(c)&&i)return i(c,r);if(po(c)){if(o||s){let t=Xa(c);if(s?.length&&ii(t,s))return null;if(o){let e=o(t);e?c=Yn(n,Za(e)):$r()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&ii(e,s)){ai(n,e);continue}if(o){let n=o(e);n?t.push(n):($r(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function fo(e){return e.type===void 0}function po(e){return e.type===`transaction`}function mo(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+go(e.attributes)}function ho(e){let t=0;return e.message&&(t+=e.message.length*2),t+go(e.attributes)}function go(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*_o(e[0]):an(e)?t+=_o(e):t+=100}),t}function _o(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function vo(e,t,n,r,i){let a={sent_at:new Date().toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=U(i)),t&&(a.trace=t),G(a,[yo(e)])}function yo(e){return[{type:`check_in`},e]}function bo(e){let t=e._metadata?.sdk,n=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...n&&{"user-agent":n},...e.transportOptions?.headers}}}function xo(e,t){return e(t.stack||``,1)}function So(e){return O(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Co(e){return So(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function wo(e,t){let n={type:t.name||t.constructor.name,value:Co(t)},r=xo(e,t);return r.length&&(n.stacktrace={frames:r}),n}function To(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function Eo(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message '${e.message}'`),t}else if(`message`in e&&typeof e.message==`string`)return e.message;let t=Cn(e);if(tn(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Do(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Do(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Oo(e,t,n,r){if(O(n))return[n,void 0];if(t.synthetic=!0,on(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:di(n,t)},a=To(n);if(a)return[a,i];let o=Eo(n),s=r?.syntheticException||Error(o);return s.message=o,[s,i]}let i=r?.syntheticException||Error(n);return i.message=`${n}`,[i,void 0]}function ko(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Oo(e,i,n,r),s={exception:{values:[wo(t,a)]}};return o&&(s.extra=o),Pn(s,void 0,void 0),Fn(s,i),{...s,event_id:r?.event_id}}function Ao(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=xo(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Fn(a,{synthetic:!0}))}if(rn(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return a.logentry={message:e,params:n},a}return a.message=t,a}var jo=class extends so{constructor(e){ti(),bo(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=ko(this,this._options.stackParser,e,t);return n.level=`error`,Ri(n)}eventFromMessage(e,t=`info`,n){return Ri(Ao(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Mo(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Mo(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:N();if(!this._isEnabled())return x&&D.warn(`SDK not enabled, will not capture check-in.`),r;let{release:i,environment:a,tunnel:o}=this.getOptions(),s={check_in_id:r,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};`duration`in e&&(s.duration=e.duration),t&&(s.monitor_config={schedule:t.schedule,checkin_margin:t.checkinMargin,max_runtime:t.maxRuntime,timezone:t.timezone,failure_issue_threshold:t.failureIssueThreshold,recovery_threshold:t.recoveryThreshold});let[c,l]=ka(this,n);l&&(s.contexts={trace:l});let u=vo(s,c,this.getSdkMetadata(),o,this.getDsn());return x&&D.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){x&&D.log(`Disposing client...`);for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Ha(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function Mo(e){let t=V().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const No=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),Po=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Fo(e,t){let n=String(e).toLowerCase();return No.has(n)?!1:Po.has(n)?!0:t?.strict?null:!!e}function Io(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function Lo(e){return e.split(/[?#]/,1)[0]}function Ro(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function zo(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:C})),i.version=C)}function Bo(e={}){let t=e.client||H();if(!ha()||!t)return{};let n=z(w());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||B(),i=e.span||Qr(),a=i?Vr(i):Vo(r),o=vr(i?ui(i):li(t,r));if(!Mr.test(a))return D.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Hr(i):Ho(r)),s}function Vo(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Fr(t,r,n)}function Ho(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ir(t,r,n)}const Uo=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Wo(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return x&&!r&&D.log(Uo,e),r;let i=kn(e,t);return n?.set(e,i),x&&!i&&D.log(Uo,e),i}function Go(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Ko(e){let t=e.headers||{},n=(typeof t[`x-forwarded-host`]==`string`?t[`x-forwarded-host`]:void 0)||(typeof t.host==`string`?t.host:void 0),r=(typeof t[`x-forwarded-proto`]==`string`?t[`x-forwarded-proto`]:void 0)||e.protocol||(e.socket?.encrypted?`https`:`http`),i=e.url||``,a=qo({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Jo(i),headers:Go(t),cookies:s,data:o}}function qo({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Jo(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Y(e,t){let n=H(),r=V();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:Hn(),...e},s=i?E(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let Yo;const Xo=new WeakMap,Zo=J((()=>({name:`FunctionToString`,setupOnce(){Yo=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=yn(this),n=Xo.has(H())&&t!==void 0?t:this;return Yo.apply(n,e)}}catch{}},setup(e){Xo.set(e,!0)}}))),Qo=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,`vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)`,`Can't find variable: _AutofillCallbackHandler`,/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],$o=J((e={})=>{let t;return{name:`EventFilters`,setup(n){t=es(e,n.getOptions())},processEvent(n,r,i){return t||=es(e,i.getOptions()),ts(n,t)?null:n}}});function es(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Qo],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function ts(e,t){if(e.type){if(e.type===`transaction`&&rs(e,t.ignoreTransactions))return x&&D.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${P(e)}`),!0}else{if(ns(e,t.ignoreErrors))return x&&D.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${P(e)}`),!0;if(cs(e))return x&&D.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${P(e)}`),!0;if(is(e,t.denyUrls))return x&&D.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${P(e)}.\nUrl: ${ss(e)}`),!0;if(!as(e,t.allowUrls))return x&&D.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${P(e)}.\nUrl: ${ss(e)}`),!0}return!1}function ns(e,t){return t?.length?Ya(e).some(e=>kn(e,t)):!1}function rs(e,t){if(!t?.length)return!1;let n=e.transaction;return n?kn(n,t):!1}function is(e,t){if(!t?.length)return!1;let n=ss(e);return n?kn(n,t):!1}function as(e,t){if(!t?.length)return!0;let n=ss(e);return n?kn(n,t):!0}function os(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function ss(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?os(t):null}catch{return x&&D.error(`Cannot extract url for event ${P(e)}`),null}}function cs(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function ls(e,t,n,r,i,a){if(!i.exception?.values||!a||!k(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=us(e,t,r,a.originalException,n,i.exception.values,o,0))}function us(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(k(r[i],Error)){fs(o,s,r);let a=e(t,r[i]),l=c.length;ps(a,i,l,s),c=us(e,t,n,r[i],i,[a,...c],a,l)}return ds(r)&&r.errors.forEach((a,l)=>{if(k(a,Error)){fs(o,s,r);let u=e(t,a),d=c.length;ps(u,`errors[${l}]`,d,s),c=us(e,t,n,a,i,[u,...c],u,d)}}),c}function ds(e){return Array.isArray(e.errors)}function fs(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...ds(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function ps(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const ms=J(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){ls(wo,i.getOptions().stackParser,n,t,e,r)}}}));function hs(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf(`=`,n);if(r===-1)break;let i=e.indexOf(`;`,n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(`;`,r-1)+1;continue}let a=e.slice(n,r).trim();if(t[a]===void 0){let n=e.slice(r+1,i).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));try{t[a]=n.indexOf(`%`)===-1?n:decodeURIComponent(n)}catch{t[a]=n}}n=i+1}return t}const gs=[`X-Client-IP`,`X-Forwarded-For`,`Fly-Client-IP`,`CF-Connecting-IP`,`Fastly-Client-Ip`,`True-Client-Ip`,`X-Real-IP`,`X-Cluster-Client-IP`,`X-Forwarded`,`Forwarded-For`,`Forwarded`,`X-Vercel-Forwarded-For`];function _s(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return gs.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?vs(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&ys(e))||null}function vs(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function ys(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}const bs={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},xs=J(((e={})=>{let t={...bs,...e.include};return{name:`RequestData`,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,s={...t,ip:t.ip??r.getOptions().sendDefaultPii};return a&&Ss(e,a,{ipAddress:o},s),e}}}));function Ss(e,t,n,r){if(e.request={...e.request,...Cs(t,r)},r.ip){let r=t.headers&&_s(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Cs(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||gs.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?hs(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function ws(e){let t=`console`;Wt(t,e),Gt(t,Ts)}function Ts(){`console`in S&&St.forEach(function(e){e in S.console&&gn(S.console,e,function(t){return Ct[e]=t,function(...t){Kt(`console`,{args:t,level:e}),Ct[e]?.apply(S.console,t)}})})}function Es(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Ds=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Os(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Ds.exec(t);return n?n.slice(1):[]}function ks(e){let t=Os(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const As=J((e={})=>{let t=new Set(e.levels||St);return{name:`Console`,setup(e){ws(({args:n,level:r})=>{H()!==e||!t.has(r)||js(r,n)})}}});function js(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Es(e),message:Ms(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Ms(e)}`:`Assertion failed`,n.data.arguments=e}else return;Y(n,{input:t,level:e})}function Ms(e){return`util`in S&&typeof S.util.format==`function`?S.util.format(...e):On(e,` `)}function Ns(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Ps(e,t=!1){return!(t||e&&!e.startsWith(`/`)&&!e.match(/^[A-Z]:/)&&!e.startsWith(`.`)&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes(`node_modules/`)}function Fs(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let a=i.match(r);if(a)return{filename:`<data:${a[2]}>`,function:a[1]};let o=i.match(n);if(o){let t,n,r,i,a;if(o[1]){r=o[1];let e=r.lastIndexOf(`.`);if(r[e-1]===`.`&&e--,e>0){t=r.slice(0,e),n=r.slice(e+1);let i=t.indexOf(`.Module`);i>0&&(r=r.slice(i+1),t=t.slice(0,i))}i=void 0}n&&(i=t,a=n),n===`<anonymous>`&&(a=void 0,r=void 0),r===void 0&&(a||=`?`,r=i?`${i}.${a}`:a);let s=Vt(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Rs(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Ls(o[3]),colno:Ls(o[4]),in_app:Ps(s||``,c)}}if(i.match(t))return{filename:i}}}function Is(e){return[90,Fs(e)]}function Ls(e){return parseInt(e||``,10)||void 0}function Rs(e){try{return decodeURI(e)}catch{return}}var zs=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}};const X=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var Bs=class extends jo{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||v.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};zo(n,`node-light`,[`node-core`]),D.log(`Initializing Sentry: process: ${process.pid}, thread: ${we?`main`:`worker-${Te}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Ma(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener))}async flush(e){return this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener),super.close(e)}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{X&&D.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const Vs=J((e={})=>({name:`ChildProcess`,setup(){Ee.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Hs(t.process,e)}),Ee.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Us(t.worker,e)})}}));function Hs(e,t){let n=!1,r;e.on(`spawn`,()=>{if(e.spawnfile===`/usr/bin/sw_vers`){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on(`exit`,e=>{n||(n=!0,e!==null&&e!==0&&Y({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Y({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Us(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Y({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):fa(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const Ws=le(ke),Gs=le(je),Ks=J(((e={})=>{let t,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function r(e){t===void 0&&(t=i());let n=qs(await t);return e.contexts={...e.contexts,app:{...n.app,...e.contexts?.app},os:{...n.os,...e.contexts?.os},device:{...n.device,...e.contexts?.device},culture:{...n.culture,...e.contexts?.culture},cloud_resource:{...n.cloud_resource,...e.contexts?.cloud_resource}},e}async function i(){let e={};if(n.os&&(e.os=await Js()),n.app&&(e.app=Xs()),n.device&&(e.device=Zs(n.device)),n.culture){let t=Ys();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=ic()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function qs(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory==`function`){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=v.freemem()),e}async function Js(){let e=v.platform();switch(e){case`darwin`:return tc();case`linux`:return rc();default:return{name:Qs[e]||e,version:v.release()}}}function Ys(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function Xs(){let e=process.memoryUsage().rss,t={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory==`function`){let e=process.availableMemory?.();e!=null&&(t.free_memory=e)}return t}function Zs(e){let t={},n;try{n=v.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=v.arch(),(e===!0||e.memory)&&(t.memory_size=v.totalmem(),t.free_memory=v.freemem()),e===!0||e.cpu){let e=v.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const Qs={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},$s=[{name:`fedora-release`,distros:[`Fedora`]},{name:`redhat-release`,distros:[`Red Hat Linux`,`Centos`]},{name:`redhat_version`,distros:[`Red Hat Linux`]},{name:`SuSE-release`,distros:[`SUSE Linux`]},{name:`lsb-release`,distros:[`Ubuntu Linux`,`Arch Linux`]},{name:`debian_version`,distros:[`Debian`]},{name:`debian_release`,distros:[`Debian`]},{name:`arch-release`,distros:[`Arch Linux`]},{name:`gentoo-release`,distros:[`Gentoo Linux`]},{name:`novell-release`,distros:[`SUSE Linux`]},{name:`alpine-release`,distros:[`Alpine Linux`]}],ec={alpine:e=>e,arch:e=>Z(/distrib_release=(.*)/,e),centos:e=>Z(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Z(/release (..)/,e),mint:e=>Z(/distrib_release=(.*)/,e),red:e=>Z(/release ([^ ]+)/,e),suse:e=>Z(/VERSION = (.*)\n/,e),ubuntu:e=>Z(/distrib_release=(.*)/,e)};function Z(e,t){let n=e.exec(t);return n?n[1]:void 0}async function tc(){let e={kernel_version:v.release(),name:`Mac OS X`,version:`10.${Number(v.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{he(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Z(/^ProductName:\s+(.*)$/m,t),e.version=Z(/^ProductVersion:\s+(.*)$/m,t),e.build=Z(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function nc(e){return e.split(` `)[0].toLowerCase()}async function rc(){let e={kernel_version:v.release(),name:`Linux`};try{let t=await Gs(`/etc`),n=$s.find(e=>t.includes(e.name));if(!n)return e;let r=(await Ws(ve(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(nc(e))>=0)||i[0],e.version=ec[nc(e.name)]?.(r)}catch{}return e}function ic(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}const ac=new zs(10),oc=new zs(20);function sc(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function cc(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function lc(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function uc(e,t){let n=ac.get(e);if(n===void 0)return!1;for(let e=t[0];e<=t[1];e++)if(n[e]===void 0)return!1;return!0}function dc(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=yc(r,t),a=[];for(;;){if(n===e.length-1){a.push(i);break}let r=e[n+1];if(typeof r!=`number`)break;r<=i[1]?i[1]=r+t:(a.push(i),i=yc(r,t)),n++}return a}function fc(e,t,n){return new Promise((r,i)=>{let a=De(e),o=Me({input:a});function s(){a.destroy(),r()}let c=0,l=0,u=t[l];if(u===void 0){s();return}let d=u[0],f=u[1];function p(t){oc.set(e,1),X&&D.error(`Failed to read file: ${e}. Error: ${t}`),o.close(),o.removeAllListeners(),s()}a.on(`error`,p),o.on(`error`,p),o.on(`close`,s),o.on(`line`,e=>{if(c++,!(c<d)&&(n[c]=Dn(e,0),c>=f)){if(l===t.length-1){o.close(),o.removeAllListeners();return}l++;let e=t[l];if(e===void 0){o.close(),o.removeAllListeners();return}d=e[0],f=e[1]}})})}async function pc(e,t){let n={};if(t>0&&e.exception?.values){for(let t of e.exception.values)if(t.stacktrace?.frames?.length)for(let e=t.stacktrace.frames.length-1;e>=0;e--){let r=t.stacktrace.frames[e],i=r?.filename;!r||typeof i!=`string`||typeof r.lineno!=`number`||cc(i)||lc(r)||(n[i]||(n[i]=[]),n[i].push(r.lineno))}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let e of r){if(oc.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=dc(r,t);if(a.every(t=>uc(e,t)))continue;let o=sc(ac,e,{});i.push(fc(e,a,o))}if(await Promise.all(i).catch(()=>{X&&D.log(`Failed to read one or more source files and resolve context lines`)}),t>0&&e.exception?.values)for(let n of e.exception.values)n.stacktrace?.frames&&n.stacktrace.frames.length>0&&mc(n.stacktrace.frames,t,ac);return e}function mc(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;gc(r.lineno,r,t,e)}}function hc(e){delete e.pre_context,delete e.context_line,delete e.post_context}function gc(e,t,n,r){if(t.lineno===void 0||r===void 0){X&&D.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=_c(e,n);i<e;i++){let e=r[i];if(e===void 0){hc(t),X&&D.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){hc(t),X&&D.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=vc(e,n);t.post_context=[];for(let n=e+1;n<=i;n++){let e=r[n];if(e===void 0)break;t.post_context.push(e)}}function _c(e,t){return Math.max(1,e-t)}function vc(e,t){return e+t}function yc(e,t){return[_c(e,t),vc(e,t)]}const bc=J(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return pc(e,t)}}})),xc=Rn(process.versions.node),Sc=xc.major;xc.minor;let Cc;async function wc(){if(Cc===void 0)try{Cc=!!(await import(`node:inspector`)).url()}catch{Cc=!1}return Cc}const Tc=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Ec(e,t,n){let r=0,i=5,a=0;return setInterval(()=>{a===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(--a,a===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function Dc(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Oc(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Dc(e)&&Dc(t)}function kc(...e){D.log(`[LocalVariables]`,...e)}const Ac=J(((e={})=>{function t(t,n){let r=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<r.length;t++){let i=r.length-t-1,a=n[t],o=r[i];if(!o||!a)break;a.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!Oc(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&Tc in n.originalException&&Array.isArray(n.originalException[Tc])){for(let r of e.exception?.values||[])t(r,n.originalException[Tc]);n.originalException[Tc]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Ne(new URL(`data:application/javascript;base64,LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQyLjAgKDA3YzkxOTApIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{kc(`Worker error`,e)}),t.once(`exit`,e=>{kc(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await wc()){D.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:D.isEnabled()};r().then(()=>{try{i(n)}catch(e){D.error(`Failed to start worker`,e)}},e=>{D.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function jc(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Mc(e,t){if(t!==void 0)return jc(e(t,1))}function Nc(e){let t=[],n=!1;function r(r){t=[],!n&&(n=!0,e(r))}t.push(r);function i(e){t.push(e)}function a(e){let n=t.pop()||r;try{n(e)}catch{r(e)}}return{add:i,next:a}}var Pc=class e{constructor(e){this._session=e}static async create(t){return t||new e(new(await(import(`node:inspector`))).Session)}configureAndConnect(e,t){this._session.connect(),this._session.on(`Debugger.paused`,t=>{e(t,()=>{this._session.post(`Debugger.resume`)})}),this._session.post(`Debugger.enable`),this._session.post(`Debugger.setPauseOnExceptions`,{state:t?`all`:`uncaught`})}setPauseOnExceptions(e){this._session.post(`Debugger.setPauseOnExceptions`,{state:e?`all`:`uncaught`})}getLocalVariables(e,t){this._getProperties(e,e=>{let{add:n,next:r}=Nc(t);for(let t of e)if(t.value?.objectId&&t.value.className===`Array`){let e=t.value.objectId;n(n=>this._unrollArray(e,t.name,n,r))}else if(t.value?.objectId&&t.value.className===`Object`){let e=t.value.objectId;n(n=>this._unrollObject(e,t.name,n,r))}else t.value&&n(e=>this._unrollOther(t,e,r));r({})})}_getProperties(e,t){this._session.post(`Runtime.getProperties`,{objectId:e,ownProperties:!0},(e,n)=>{t(e?[]:n.result)})}_unrollArray(e,t,n,r){this._getProperties(e,e=>{n[t]=e.filter(e=>e.name!==`length`&&!isNaN(parseInt(e.name,10))).sort((e,t)=>parseInt(e.name,10)-parseInt(t.name,10)).map(e=>e.value?.value),r(n)})}_unrollObject(e,t,n,r){this._getProperties(e,e=>{n[t]=e.map(e=>[e.name,e.value?.value]).reduce((e,[t,n])=>(e[t]=n,e),{}),r(n)})}_unrollOther(e,t,n){e.value&&(`value`in e.value?e.value.value===void 0||e.value.value===null?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:`description`in e.value&&e.value.type!==`function`?t[e.name]=`<${e.value.description}>`:e.value.type===`undefined`&&(t[e.name]=`<undefined>`)),n(t)}};const Fc=J(((e={},t)=>{let n=new zs(20),r,i=!1;function a(t){let r=jc(t.stacktrace?.frames);if(r===void 0)return;let i=n.remove(r);if(i===void 0)return;let a=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<a.length;t++){let n=a.length-t-1,r=i[t],o=a[n];if(!o||!r)break;r.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!Oc(o.function,r.function)||(o.vars=r.vars)}}function o(e){for(let t of e.exception?.values||[])a(t);return e}let s;async function c(){let a=H()?.getOptions();if(a?.includeLocalVariables){if(Sc<18){D.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await wc()){D.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Pc.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Mc(e,i.description);if(c==null){s();return}let{add:l,next:u}=Nc(e=>{n.set(c,e),s()});for(let e=0;e<Math.min(a.length,5);e++){let{scopeChain:t,functionName:n,this:r}=a[e],i=t.find(e=>e.type===`local`),s=r.className===`global`||!r.className?n:`${r.className}.${n}`;if(i?.object.objectId===void 0)l(t=>{t[e]={function:s},u(t)});else{let t=i.object.objectId;l(n=>o.getLocalVariables(t,t=>{n[e]={function:s,vars:t},u(n)}))}}u([])},c=e.captureAllExceptions!==!1;o.configureAndConnect((e,t)=>s(a.stackParser,e,t),c),c&&(r=Ec(e.maxExceptionsPerSecond||50,()=>{D.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{D.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){D.log("The `LocalVariables` integration failed to start.",e)}}}return{name:`LocalVariables`,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),Ic=(e={})=>xc.major<19?Fc(e):Ac(e);function Lc(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Rc;const zc=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Bc=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Wc()},e},getModules:Wc}));function Vc(){try{return f.cache?Object.keys(f.cache):[]}catch{return[]}}function Hc(){return{...zc,...Kc(),...Lc()?Uc():{}}}function Uc(){let e=f.main?.paths||[],t=Vc(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=_e(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=ve(t,`package.json`);if(r.add(t),!Oe(o))return a();try{let e=JSON.parse(Ae(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function Wc(){return Rc||=Hc(),Rc}function Gc(){try{let e=ve(process.cwd(),`package.json`);return JSON.parse(Ae(e,`utf8`))}catch{return{}}}function Kc(){let e=Gc();return{...e.dependencies,...e.devDependencies}}function qc(e){E(()=>{console.error(e)});let t=H();if(t===void 0){X&&D.warn(`No NodeClient was defined, we are exiting the process now.`),global.process.exit(1);return}let n=t.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:2e3;t.close(r).then(e=>{e||X&&D.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{X&&D.error(e)})}const Jc=J((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){we&&global.process.on(`uncaughtException`,Yc(e,t))}}});function Yc(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=qc;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e.tag!==`sentry_tracingErrorCallback`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(X&&D.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),qc(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,H()===e&&fa(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const Xc=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Zc=J(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Xc,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,tl(e,t))}}}));function Qc(e){if(typeof e!=`object`||!e)return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function $c(e,t){let n=e.name===void 0||M(t.name,e.name,!0),r=e.message===void 0||M(t.message,e.message);return n&&r}function el(e,t){let n=Qc(t);return e.some(e=>$c(e,n))}function tl(e,t){return function(n,r){if(H()!==e||el(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>Pi(a,e):e=>e())(()=>{fa(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),nl(n,t.mode)}}function nl(e,t){let n=`This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:`;t===`warn`?E(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(E(()=>{console.warn(n)}),qc(e))}const rl=J(()=>({name:`ProcessSession`,setupOnce(){ga(),process.on(`beforeExit`,()=>{V().getSession()?.status!==`ok`&&_a()})}})),il=`Spotlight`,al=J(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:il,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&D.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}ol(e,t)}}}));function ol(e,t){let n=sl(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){D.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Si(e);Fi(()=>{let e=fe.request({method:`POST`,path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":`application/x-sentry-envelope`}},e=>{e.statusCode&&e.statusCode>=200&&e.statusCode<400&&(r=0),e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`)});e.on(`error`,()=>{r++,D.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function sl(e){try{return new URL(`${e}`)}catch{D.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function cl(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:ce.getSystemErrorMap().has(e.errno)}const ll=J((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!cl(n.originalException))return t;let i=n.originalException,a={...i};!r.getOptions().sendDefaultPii&&e.includePaths!==!0&&(delete a.path,delete a.dest),t.contexts={...t.contexts,node_system_error:a};for(let e of t.exception?.values||[])e.value&&(i.path&&e.value.includes(i.path)&&(e.value=e.value.replace(`'${i.path}'`,``).trim()),i.dest&&e.value.includes(i.dest)&&(e.value=e.value.replace(`'${i.dest}'`,``).trim()));return t}}));function ul(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function dl(e=process.argv[1]?ks(process.argv[1]):process.cwd(),t=be===`\\`){let n=t?ul(e):e;return e=>{if(!e)return;let r=t?ul(e):e,{dir:i,base:a,ext:o}=ye.parse(r);(o===`.js`||o===`.mjs`||o===`.cjs`)&&(a=a.slice(0,o.length*-1));let s=decodeURIComponent(a);i||=`.`;let c=i.lastIndexOf(`/node_modules`);if(c>-1)return`${i.slice(c+14).replace(/\//g,`.`)}:${s}`;if(i.startsWith(n)){let e=i.slice(n.length+1).replace(/\//g,`.`);return e?`${e}:${s}`:s}return s}}function fl(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(S.SENTRY_RELEASE?.id)return S.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||n||r||e}const pl=Pt(Is(dl())),Q=Symbol(`AgentBaseInternalState`);var ml=class extends fe.Agent{constructor(e){super(e),this[Q]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`?t.split(`
40
+ `).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1):!1}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)};Promise.resolve().then(()=>this.connect(e,r)).then(i=>{if(i instanceof fe.Agent)return i.addRequest(e,r);this[Q].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[Q].currentSocket;if(this[Q].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Q].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[Q]&&(this[Q].defaultPort=e)}get protocol(){return this[Q].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[Q]&&(this[Q].protocol=e)}};function hl(...e){D.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function gl(e){return new Promise((t,n)=>{let r=0,i=[];function a(){let t=e.read();t?l(t):e.once(`readable`,a)}function o(){e.removeListener(`end`,s),e.removeListener(`error`,c),e.removeListener(`readable`,a)}function s(){o(),hl(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),hl(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
41
+ \r
42
+ `);if(l===-1){hl(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
43
+ `),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}hl(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}function _l(...e){D.log(`[https-proxy-agent]`,...e)}var vl=class extends ml{static __initStatic(){this.protocols=[`http`,`https`]}constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},_l(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?bl(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){_l("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=Le.connect({...this.connectOpts,servername:e&&b.isIP(e)?void 0:e})}else _l("Creating `net.Socket`: %o",this.connectOpts),r=b.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=b.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let s=gl(r);r.write(`${o}\r\n`);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,yl),t.secureEndpoint){_l(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return Le.connect({...bl(t,`host`,`path`,`port`),socket:r,servername:b.isIP(e)?void 0:e})}return r}r.destroy();let u=new b.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{_l(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};vl.__initStatic();function yl(e){e.resume()}function bl(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function xl(e){return new Fe({read(){this.push(e),this.push(null)}})}function Sl(e){let t;try{t=new URL(e.url)}catch{return E(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),qa(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Cl(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?Pe:fe,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new vl(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return qa(e,wl(e,e.httpModule??i,o))}function Cl(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function wl(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{Fi(()=>{let d=xl(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(Ie()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function Tl(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Fo(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?n??!0:t??n}function El(){let e=new Re;function t(){return e.getStore()||{scope:er(),isolationScope:tr()}}function n(n){let r=t().scope.clone(),i=t().isolationScope;return e.run({scope:r,isolationScope:i},()=>n(r))}function r(n,r){let i=t().isolationScope.clone();return e.run({scope:n,isolationScope:i},()=>r(n))}function i(n){let r=t().scope.clone(),i=t().isolationScope.clone();return e.run({scope:r,isolationScope:i},()=>n(i))}function a(n,r){let i=t().scope.clone();return e.run({scope:i,isolationScope:n},()=>r(n))}function o(e){return n(t=>(t.setSDKProcessingMetadata({__SENTRY_SUPPRESS_TRACING__:!0}),e()))}sr({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function Dl(e,t,n,r){let i=0,a=[];X&&D.log(r,`Patching request.on`);let o=new WeakMap,s=n===`small`?1e3:n===`medium`?1e4:1048576;try{e.on=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){X&&D.log(r,`Handling request.on("data") with maximum body size of ${s}b`);let n=new Proxy(l,{apply:(e,t,n)=>{try{let e=n[0],t=Buffer.from(e);i<s?(a.push(t),i+=t.byteLength):X&&D.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{X&&D.error(r,`Encountered error while storing body chunk.`)}return Reflect.apply(e,t,n)}});return o.set(l,n),Reflect.apply(e,t,[c,n,...u])}return Reflect.apply(e,t,n)}}),e.off=new Proxy(e.off,{apply:(e,t,n)=>{let[,r]=n,i=o.get(r);if(i){o.delete(r);let a=n.slice();return a[1]=i,Reflect.apply(e,t,a)}return Reflect.apply(e,t,n)}}),e.on(`end`,()=>{try{let e=Buffer.concat(a).toString(`utf-8`);if(e){let n=Buffer.byteLength(e,`utf-8`)>s?`${Buffer.from(e).subarray(0,s-3).toString(`utf-8`)}...`:e;t.setSDKProcessingMetadata({normalizedRequest:{data:n}})}}catch(e){X&&D.error(r,`Error building captured request body`,e)}})}catch(e){X&&D.error(r,`Error patching request to capture body`,e)}}function Ol(e,t){if(!e)return t;let n=yr(e),r=yr(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),xr(i)}const $=`@sentry/instrumentation-http`;function kl(e,t){let n=jl(e),r=t?.statusCode,i=Ns(r);Y({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Al(e,t){let n=Nl(e),{tracePropagationTargets:r,propagateTraceparent:i}=H()?.getOptions()||{},a=Wo(n,r,t)?Bo({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o&&!e.getHeader(`sentry-trace`))try{e.setHeader(`sentry-trace`,o),X&&D.log($,`Added sentry-trace header to outgoing request`)}catch(e){X&&D.error($,`Failed to add sentry-trace header to outgoing request:`,O(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),X&&D.log($,`Added traceparent header to outgoing request`)}catch(e){X&&D.error($,`Failed to add traceparent header to outgoing request:`,O(e)?e.message:`Unknown error`)}if(s){let t=Ol(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),X&&D.log($,`Added baggage header to outgoing request`)}catch(e){X&&D.error($,`Failed to add baggage header to outgoing request:`,O(e)?e.message:`Unknown error`)}}}function jl(e){try{let t=e.getHeader(`host`)||e.host,n=Io(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Ro(n),"http.method":e.method||`GET`};return n.search&&(r[`http.query`]=n.search),n.hash&&(r[`http.fragment`]=n.hash),r}catch{return{}}}function Ml(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Nl(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Pl=`Http`,Fl=new WeakSet,Il=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new zs(100),r=new WeakMap;return{name:Pl,setupOnce(){y(`http.server.request.start`,(e=>{Ll(e.server,t)})),y(`http.client.request.created`,(e=>{Rl(e.request,t,n,r)})),y(`http.client.response.finish`,(e=>{let n=e;zl(n.request,n.response,t,r)})),y(`http.client.request.error`,(e=>{zl(e.request,void 0,t,r)}))}}});function Ll(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Fl.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!B().getClient())return e.apply(r,i);X&&D.log(Pl,`Handling incoming request`);let a=V().clone(),o=i[1],s=Ko(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&Dl(o,a,n,Pl),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Lo(l)}`;return a.setTransactionName(u),ur(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Ni({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(B().getPropagationContext().propagationSpanId=Xn(),e.apply(r,i)))})}});Fl.add(i),e.emit=i}function Rl(e,t,n,r){let i=Bl(e,t);r.set(e,i),!i&&Al(e,n)}function zl(e,t,n,r){n.breadcrumbs&&((r.get(e)??Bl(e,n))||kl(e,t))}function Bl(e,t){if(B().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,Ml(e)):!1}const Vl=`sentry-trace`,Hl=`baggage`,Ul=/baggage: (.*)\r\n/;function Wl(e,t){let n=ql(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=H()?.getOptions()||{},a=Wo(n,r,t)?Bo({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(Array.isArray(e.headers)){let t=e.headers;o&&!t.includes(Vl)&&t.push(Vl,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Hl);if(s&&n===-1)t.push(Hl,s);else if(s){let e=t[n+1],r=Ol(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Vl}:`)&&(e.headers+=`${Vl}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Ul)?.[1];if(s&&!n)e.headers+=`${Hl}: ${s}\r\n`;else if(s){let t=Ol(n,s);t&&(e.headers=e.headers.replace(Ul,`baggage: ${t}\r\n`))}}}function Gl(e,t){let n=Kl(e),r=t.statusCode,i=Ns(r);Y({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Kl(e){try{let t=Io(ql(e.origin,e.path)),n={url:Ro(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=t.search),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function ql(e,t=`/`){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}}const Jl=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new zs(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){y(`undici:request:create`,(e=>{Yl(e.request,t,n,r)})),y(`undici:request:headers`,(e=>{let n=e;Xl(n.request,n.response,t,r)}))}}});function Yl(e,t,n,r){let i=Zl(e,t);r.set(e,i),!i&&Wl(e,n)}function Xl(e,t,n,r){n.breadcrumbs&&(r.get(e)||Gl(e,t))}function Zl(e,t){if(B().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(ql(e.origin,e.path)):!1}function Ql(){return[$o(),Zo(),ms(),xs(),ll(),As(),Il(),Jl(),Jc(),Zc(),bc(),Ic(),Ks(),Vs(),rl(),Bc()]}function $l(e={}){return eu(e,Ql)}function eu(e={},t){let n=tu(e,t);n.debug===!0&&(X?D.enable():E(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),El(),B().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===il)&&n.integrations.push(al({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),zo(n,`node-light`,[`node-core`]);let r=new Bs(n);return B().setClient(r),r.init(),D.log(`SDK initialized from ${Lc()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),iu(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function tu(e,t){let n=nu(e.release),r=Tl(e.spotlight),i=ru(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Sl,stackParser:Ft(e.stackParser||pl),release:n,tracesSampleRate:i,spotlight:r,debug:Fo(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:Ta({defaultIntegrations:s,integrations:o})}}function nu(e){if(e!==void 0)return e;let t=fl();if(t!==void 0)return t}function ru(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function iu(){if(Fo(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Pr(e,t);B().setPropagationContext(n)}}function au(){return!0}function ou(){try{if(!au())return;$l({dsn:`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`,release:Be,environment:`production`,defaultIntegrations:!1,integrations:[],maxValueLength:2500}),pa(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function su(e){try{if(!au())return;fa(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await ma()}catch{}}async function cu(){let{values:e}=_({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(e.help){console.info(`Log in to Prismic via browser.
44
+
45
+ USAGE
46
+ prismic login [flags]
47
+
48
+ FLAGS
49
+ -h, --help Show help for command
50
+
51
+ LEARN MORE
52
+ Use \`prismic <command> --help\` for more information about a command.`);return}let{email:t}=await ne({onReady:e=>{console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),lu(e)}});console.info(`Logged in to Prismic as ${t}`)}function lu(e){me(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function uu(){let{values:e}=_({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(e.help){console.info(`Log out of Prismic.
53
+
54
+ USAGE
55
+ prismic logout [flags]
56
+
57
+ FLAGS
58
+ -h, --help Show help for command
59
+
60
+ LEARN MORE
61
+ Use \`prismic <command> --help\` for more information about a command.`);return}await o()?console.info(`Logged out of Prismic`):(console.error(`Logout failed. You can log out manually by deleting the file.`),process.exitCode=1)}async function du(){let{values:{help:e}}=_({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(e){console.info(`Show the currently logged in user.
62
+
63
+ USAGE
64
+ prismic whoami [flags]
65
+
66
+ FLAGS
67
+ -h, --help Show help for command
68
+
69
+ LEARN MORE
70
+ Use \`prismic <command> --help\` for more information about a command.`);return}if(!await h()){pu();return}let t=await fu();if(!t.ok){t.error instanceof We?pu():console.error(`Failed to fetch user profile.`),process.exitCode=1;return}console.info(t.value.email)}async function fu(){return await He(new URL(`profile`,await ae()),{schema:e({email:r()})})}function pu(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const{positionals:mu,values:{version:hu}}=_({options:{help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`v`}},allowPositionals:!0,strict:!1});if(ou(),await rt(),hu)console.info(Be);else{let e=mu[0];it(e);try{switch(e){case`init`:await bt();break;case`sync`:await ft();break;case`login`:await cu();break;case`logout`:await uu();break;case`whoami`:await du();break;default:e&&(console.error(`Unknown command: ${e}`),process.exitCode=1),console.info(`Prismic CLI for managing repositories and configurations.
71
+
72
+ USAGE
73
+ prismic <command> [flags]
74
+
75
+ COMMANDS
76
+ init Initialize a Prismic project
77
+ sync Sync types and slices from Prismic
78
+ login Log in to Prismic
79
+ logout Log out of Prismic
80
+ whoami Show the currently logged in user
81
+
82
+ FLAGS
83
+ -v, --version Show CLI version
84
+ -h, --help Show help for command
85
+
86
+ LEARN MORE
87
+ Use \`prismic <command> --help\` for more information about a command.`)}at(e,process.exitCode!==1)}catch(t){throw await su(t),at(e,!1,t),process.exitCode=1,t}}export{};