prismic 1.5.0-pr.112.eb5c985 → 1.5.0-pr.114.350ecf5
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.
- package/dist/index.mjs +38 -38
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{$ as e,A as t,B as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as ee,S as te,U as ne,V as re,W as ie,X as ae,Y as oe,Z as se,_ as ce,a as le,at as ue,b as de,ct as fe,d as pe,et as g,f as me,g as he,h as ge,i as _,it as _e,k as v,l as ve,m as ye,nt as y,o as be,ot as b,p as x,q as S,r as xe,rt as Se,s as Ce,t as we,tt as Te,u as C,ut as Ee,v as De,x as Oe,z as ke}from"./string-DDYinfcX.mjs";import*as Ae from"node:util";import{parseArgs as je,promisify as Me}from"node:util";import{readFile as Ne,rm as Pe,writeFile as Fe}from"node:fs/promises";import{fileURLToPath as Ie,pathToFileURL as Le}from"node:url";import{createHash as Re,randomUUID as ze}from"node:crypto";import{dirname as Be,join as Ve,posix as He,sep as Ue}from"node:path";import{exec as We,execFile as Ge,spawn as Ke}from"node:child_process";import{Readable as qe}from"node:stream";import{createInterface as Je}from"node:readline";import*as Ye from"node:http";import{createServer as Xe}from"node:http";import*as w from"node:os";import{homedir as Ze}from"node:os";import{setTimeout as Qe}from"node:timers/promises";import{isMainThread as $e,threadId as et}from"worker_threads";import*as tt from"node:diagnostics_channel";import{subscribe as nt}from"node:diagnostics_channel";import{createReadStream as rt,existsSync as it,readFile as at,readFileSync as ot,readdir as st}from"node:fs";import{Worker as ct}from"node:worker_threads";import*as lt from"node:https";import{createGzip as ut}from"node:zlib";import*as dt from"node:net";import*as ft from"node:tls";import{AsyncLocalStorage as pt}from"node:async_hooks";var mt=`prismic`,ht=`1.5.0-pr.
|
|
2
|
+
import{$ as e,A as t,B as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as ee,S as te,U as ne,V as re,W as ie,X as ae,Y as oe,Z as se,_ as ce,a as le,at as ue,b as de,ct as fe,d as pe,et as g,f as me,g as he,h as ge,i as _,it as _e,k as v,l as ve,m as ye,nt as y,o as be,ot as b,p as x,q as S,r as xe,rt as Se,s as Ce,t as we,tt as Te,u as C,ut as Ee,v as De,x as Oe,z as ke}from"./string-DDYinfcX.mjs";import*as Ae from"node:util";import{parseArgs as je,promisify as Me}from"node:util";import{readFile as Ne,rm as Pe,writeFile as Fe}from"node:fs/promises";import{fileURLToPath as Ie,pathToFileURL as Le}from"node:url";import{createHash as Re,randomUUID as ze}from"node:crypto";import{dirname as Be,join as Ve,posix as He,sep as Ue}from"node:path";import{exec as We,execFile as Ge,spawn as Ke}from"node:child_process";import{Readable as qe}from"node:stream";import{createInterface as Je}from"node:readline";import*as Ye from"node:http";import{createServer as Xe}from"node:http";import*as w from"node:os";import{homedir as Ze}from"node:os";import{setTimeout as Qe}from"node:timers/promises";import{isMainThread as $e,threadId as et}from"worker_threads";import*as tt from"node:diagnostics_channel";import{subscribe as nt}from"node:diagnostics_channel";import{createReadStream as rt,existsSync as it,readFile as at,readFileSync as ot,readdir as st}from"node:fs";import{Worker as ct}from"node:worker_threads";import*as lt from"node:https";import{createGzip as ut}from"node:zlib";import*as dt from"node:net";import*as ft from"node:tls";import{AsyncLocalStorage as pt}from"node:async_hooks";var mt=`prismic`,ht=`1.5.0-pr.114.350ecf5`;async function gt(e,t){let{host:n}=t,r=_t(n),i=new URL(`refreshtoken`,r);return i.searchParams.set(`token`,e),await l(i,{schema:y()})}function _t(e){return new URL(`https://auth.${e}/`)}const vt=new URL(`.prismic`,d(Le(Ze()))),yt=ae({token:g(y().check(Se(1))),host:g(y().check(Se(1))),latestKnownVersion:g(y()),lastUpdateCheckAt:g(h()),base:g(y()),cookies:g(y())});async function T(){let e=await St();if(await be()&&e?.cookies){for(let t of e.cookies.split(`; `))if(t.startsWith(`prismic-auth=`))return t.replace(/^prismic-auth=/,``)}return e?.token}async function E(){if(x.PRISMIC_HOST)return x.PRISMIC_HOST;let e=await St();if(await be()&&e?.base)try{return new URL(e.base).host||me}catch{}return e?.host||me}async function bt(){let e=await T();if(!e)return;let t=await E(),n=await gt(e,{host:t});return await Ct({token:n,host:t}),n}async function xt(){if(!await t(vt))return!0;try{return await Pe(vt,{force:!0}),!0}catch{return!1}}async function St(){try{let e=await Ne(vt,`utf-8`);return _e(yt,JSON.parse(e))}catch{return}}async function Ct(e){let t={...await St(),...e};await be()&&(t.host&&(t.base=`https://${t.host}/`),t.token&&(t.cookies=`prismic-auth=${t.token}; Path=/; SameSite=none; SESSION=fake_session; Path=/; SameSite=none`)),await Fe(vt,v(t))}async function wt(e){let t=await E(),n=`https://${t}`;return new Promise((r,i)=>{let a=Xe((e,i)=>{if(e.method===`OPTIONS`){i.writeHead(204,{"Access-Control-Allow-Origin":n,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),i.end();return}if(e.method===`POST`){let s=``;e.on(`data`,e=>{s+=e.toString()}),e.on(`end`,async()=>{try{let{cookies:e,email:c}=JSON.parse(s),l=e.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!l){i.writeHead(400,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}));return}await Ct({token:l,host:t}),i.writeHead(200,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify({success:!0})),clearTimeout(o),a.close(),r({email:c})}catch{i.writeHead(400,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}))}});return}i.writeHead(404),i.end()}),o=setTimeout(()=>{a.close(),i(Error(`Login timed out. Please try again.`))},18e4),s=async()=>{let n=a.address();if(!n||typeof n==`string`){clearTimeout(o),a.close(),i(Error(`Failed to start login server`));return}let r=await Tt(t,n.port);e?.onReady?.(r)};a.on(`error`,e=>{e.code===`EADDRINUSE`&&a.listening===!1?a.listen(0,`0.0.0.0`,s):(clearTimeout(o),i(e))}),a.listen(5555,`0.0.0.0`,s)})}async function Tt(e,t){let n=new URL(`dashboard/cli/login`,`https://${e}/`);return n.searchParams.set(`source`,`prismic-cli`),n.searchParams.set(`port`,t.toString()),n}function D(e,t){return async function(){let{positionals:n={},options:r={}}=e,i=e.name.split(` `).length,a=process.argv.slice(1+i),o=Object.keys(n).length>0,s=je({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(Et(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new k(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new k(`Missing required option: --${e}`);await t(s)}}function Et(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[we(t)];o.push(``),o.push(`USAGE`);let s=` ${e.name}`;if(a.length>0&&(s+=` `+a.map(e=>`<${e}>`).join(` `)),s+=` [options]`,o.push(s),a.length>0){o.push(``),o.push(`ARGUMENTS`);let e=Math.max(...a.map(e=>`<${e}>`.length));for(let t in r){let n=`<${t}>`.padEnd(e),i=r[t],a=i.description+(i.required?` (required)`:``);o.push(` ${n} ${a}`)}}o.push(``),o.push(`OPTIONS`);let c=[];if(i){let e=Object.keys(i);for(let t of e){let e=i[t],n=`${e.short?`-${e.short}, `:` `}--${t}${e.type===`string`?` string`:``}`,r=e.description+(e.required?` (required)`:``);c.push({left:n,description:r})}}c.push({left:`-h, --help`,description:`Show help for command`});let l=Math.max(...c.map(e=>e.left.length));for(let e of c){let t=e.left.padEnd(l);o.push(` ${t} ${e.description}`)}if(n)for(let e in n){let t=we(n[e]);o.push(``),o.push(e);for(let e of t.split(`
|
|
3
3
|
`))o.push(e?` ${e}`:``)}o.push(``),o.push(`LEARN MORE`);let u=e.name.split(` `)[0];return o.push(` Use \`${u} <command> --help\` for more information about a command.`),o.join(`
|
|
4
4
|
`)}function O(e){let{name:t,description:n,commands:r}=e,i=t.split(` `).length;return async function(){let{positionals:[a]}=je({args:process.argv.slice(1+i),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1}),o=a?e.commands[a]:void 0;if(o){await o.handler();return}if(a)throw new k(`Unknown command: ${a}`);console.info(Dt({name:t,description:n,commands:r}))}}function Dt(e){let{name:t,description:n,commands:r}=e,i=[n];i.push(``),i.push(`USAGE`),i.push(` ${t} <command> [options]`),i.push(``),i.push(`COMMANDS`);let a=Object.keys(r),o=Math.max(...a.map(e=>e.length));for(let e of a){let t=e.padEnd(o),n=r[e].description;i.push(` ${t} ${n}`)}return i.push(``),i.push(`OPTIONS`),i.push(` -h, --help Show help for command`),i.push(``),i.push(`LEARN MORE`),i.push(` Use \`${t} <command> --help\` for more information about a command.`),i.join(`
|
|
5
5
|
`)}var k=class extends Error{name=`CommandError`},Ot=D({name:`prismic type add-tab`,description:`Add a tab to a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the content type`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{to:i,"with-slice-zone":o,repo:s=await C()}=t,c=await _(),l=await T(),u=await E(),d=(await m({repo:s,token:l,host:u})).find(e=>e.label===i);if(!d)throw new k(`Type not found: ${i}`);if(r in d.json)throw new k(`Tab "${r}" already exists in "${i}".`);d.json[r]=o?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{};try{await n(d,{repo:s,host:u,token:l})}catch(e){throw e instanceof a?new k(`Failed to add tab: ${await e.text()}`):e}try{await c.updateCustomType(d)}catch{await c.createCustomType(d)}await c.generateTypes(),console.info(`Added tab "${r}" to "${i}"`)}),kt=D({name:`prismic type create`,description:`Create a new content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{format:{type:`string`,short:`f`,description:`Type format: "custom" (default) or "page"`},single:{type:`boolean`,short:`s`,description:`Allow only one document of this type`},id:{type:`string`,description:`Custom ID for the content type`},repo:{type:`string`,short:`r`,description:`Repository domain`}},sections:{FORMATS:`
|
|
@@ -8,7 +8,7 @@ import{$ as e,A as t,B as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L a
|
|
|
8
8
|
page A page type with a URL (e.g. homepage, blog post, landing
|
|
9
9
|
page). Includes a slice zone and SEO & Metadata tab by
|
|
10
10
|
default, and configures a route in prismic.config.json.
|
|
11
|
-
`}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:i=!1,id:o=fe(n),repo:c=await C()}=t;if(r!==`custom`&&r!==`page`)throw new k(`Invalid format: "${r}". Use "custom" or "page".`);let l={id:o,label:n,repeatable:!i,status:!0,format:r,json:r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}}},u=await _(),d=await T(),f=await E();try{await s(l,{repo:c,host:f,token:d})}catch(e){throw e instanceof a?new k(`Failed to create type: ${await e.text()}`):e}await u.createCustomType(l),await u.generateTypes(),console.info(`Created type "${n}" (id: "${o}", format: "${r}")`)}),At=D({name:`prismic type edit`,description:`Edit a content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{repo:i=await C()}=t;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new k(`Invalid format: "${t.format}". Use "custom" or "page".`);let o=await _(),s=await T(),c=await E(),l=(await m({repo:i,token:s,host:c})).find(e=>e.label===r);if(!l)throw new k(`Type not found: ${r}`);`name`in t&&(l.label=t.name),`format`in t&&(l.format=t.format);try{await n(l,{repo:i,host:c,token:s})}catch(e){throw e instanceof a?new k(`Failed to update type: ${await e.text()}`):e}try{await o.updateCustomType(l)}catch{await o.createCustomType(l)}await o.generateTypes(),console.info(`Type updated: "${l.label}" (id: ${l.id})`)}),jt=D({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{
|
|
11
|
+
`}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:i=!1,id:o=fe(n),repo:c=await C()}=t;if(r!==`custom`&&r!==`page`)throw new k(`Invalid format: "${r}". Use "custom" or "page".`);let l={id:o,label:n,repeatable:!i,status:!0,format:r,json:r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}}},u=await _(),d=await T(),f=await E();try{await s(l,{repo:c,host:f,token:d})}catch(e){throw e instanceof a?new k(`Failed to create type: ${await e.text()}`):e}await u.createCustomType(l),await u.generateTypes(),console.info(`Created type "${n}" (id: "${o}", format: "${r}")`)}),At=D({name:`prismic type edit`,description:`Edit a content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{repo:i=await C()}=t;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new k(`Invalid format: "${t.format}". Use "custom" or "page".`);let o=await _(),s=await T(),c=await E(),l=(await m({repo:i,token:s,host:c})).find(e=>e.label===r);if(!l)throw new k(`Type not found: ${r}`);`name`in t&&(l.label=t.name),`format`in t&&(l.format=t.format);try{await n(l,{repo:i,host:c,token:s})}catch(e){throw e instanceof a?new k(`Failed to update type: ${await e.text()}`):e}try{await o.updateCustomType(l)}catch{await o.createCustomType(l)}await o.generateTypes(),console.info(`Type updated: "${l.label}" (id: ${l.id})`)}),jt=D({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{"from-type":{type:`string`,required:!0,description:`Name of the content type`},name:{type:`string`,short:`n`,description:`New name for the tab`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},"without-slice-zone":{type:`boolean`,description:`Remove the slice zone from the tab`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{"from-type":i,repo:o=await C()}=t,s=await _(),c=await T(),l=await E(),u=(await m({repo:o,token:c,host:l})).find(e=>e.label===i);if(!u)throw new k(`Type not found: ${i}`);if(!(r in u.json))throw new k(`Tab "${r}" not found in "${i}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new k(`Cannot use --with-slice-zone and --without-slice-zone together.`);if(`with-slice-zone`in t){let e=u.json[r];if(Object.values(e).some(e=>e.type===`Slices`))throw new k(`Tab "${r}" already has a slice zone.`);e.slices={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}if(`without-slice-zone`in t){let e=u.json[r],t=Object.entries(e).find(([,e])=>e.type===`Slices`);if(!t)throw new k(`Tab "${r}" does not have a slice zone.`);let[n,i]=t,a=i.type===`Slices`?i.config?.choices??{}:{};if(Object.keys(a).length>0)throw new k(`Cannot remove slice zone from "${r}": disconnect all slices first.`);delete e[n]}if(`name`in t){if(t.name in u.json)throw new k(`Tab "${t.name}" already exists in "${i}".`);let e={};for(let[n,i]of Object.entries(u.json))e[n===r?t.name:n]=i;u.json=e}try{await n(u,{repo:o,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to update tab: ${await e.text()}`):e}try{await s.updateCustomType(u)}catch{await s.createCustomType(u)}await s.generateTypes(),console.info(`Tab updated: "${r}" in "${i}"`)}),Mt=D({name:`prismic type list`,description:`List all content types.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await C()}=e,r=await m({repo:n,token:await T(),host:await E()});if(t){console.info(v(r));return}if(r.length===0){console.info(`No types found.`);return}for(let e of r){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id}, format: ${e.format})`)}}),Nt=D({name:`prismic type remove`,description:`Remove a content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await _(),o=await T(),s=await E(),c=(await m({repo:r,token:o,host:s})).find(e=>e.label===n);if(!c)throw new k(`Type not found: ${n}`);try{await ee(c.id,{repo:r,host:s,token:o})}catch(e){throw e instanceof a?new k(`Failed to remove type: ${await e.text()}`):e}try{await i.deleteCustomType(c.id)}catch{}await i.generateTypes(),console.info(`Type removed: "${n}" (id: ${c.id})`)}),Pt=D({name:`prismic type remove-tab`,description:`Remove a tab from a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the content type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{from:i,repo:o=await C()}=t,s=await _(),c=await T(),l=await E(),u=(await m({repo:o,token:c,host:l})).find(e=>e.label===i);if(!u)throw new k(`Type not found: ${i}`);if(!(r in u.json))throw new k(`Tab "${r}" not found in "${i}".`);if(Object.keys(u.json).length<=1)throw new k(`Cannot remove the last tab from "${i}".`);delete u.json[r];try{await n(u,{repo:o,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to remove tab: ${await e.text()}`):e}try{await s.updateCustomType(u)}catch{await s.createCustomType(u)}await s.generateTypes(),console.info(`Removed tab "${r}" from "${i}"`)}),Ft=D({name:`prismic type view`,description:`View details of a content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:i=await C()}=t,a=(await m({repo:i,token:await T(),host:await E()})).find(e=>e.label===n);if(!a)throw new k(`Type not found: ${n}`);if(r){console.info(v(a));return}console.info(`ID: ${a.id}`),console.info(`Name: ${a.label||`(no name)`}`),console.info(`Format: ${a.format}`),console.info(`Repeatable: ${a.repeatable}`);for(let[e,t]of Object.entries(a.json)){console.info(``),console.info(`${e}:`);let n=Object.entries(t);if(n.length===0)console.info(` (no fields)`);else for(let[e,t]of n){let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;console.info(` ${[e,t.type,r,i].filter(Boolean).join(` `)}`)}}}),It=O({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:kt,description:`Create a new content type`},edit:{handler:At,description:`Edit a content type`},remove:{handler:Nt,description:`Remove a content type`},list:{handler:Mt,description:`List content types`},view:{handler:Ft,description:`View a content type`},"add-tab":{handler:Ot,description:`Add a tab to a content type`},"edit-tab":{handler:jt,description:`Edit a tab of a content type`},"remove-tab":{handler:Pt,description:`Remove a tab from a content type`}}});const Lt=e({path:y(),title:y(),description:g(y())}),Rt=e({path:y(),title:y(),description:g(y()),anchors:S(e({slug:y(),excerpt:y()}))});async function zt(){return await l(new URL(`api/index/`,Ht()),{schema:S(Lt)})}async function Bt(e){return await l(new URL(`api/index/${e}`,Ht()),{schema:Rt})}async function Vt(e){return await l(new URL(e,Ht()),{headers:{Accept:`text/markdown`},schema:y()})}function Ht(){let e=x.PRISMIC_DOCS_HOST??me;return new URL(`https://${e}/docs/`)}var Ut=D({name:`prismic docs list`,description:`
|
|
12
12
|
List available documentation pages.
|
|
13
13
|
|
|
14
14
|
With a path argument, list the anchors within that page.
|
|
@@ -18,61 +18,61 @@ import{$ as e,A as t,B as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L a
|
|
|
18
18
|
Append #anchor to the path to view only the section under that heading.
|
|
19
19
|
`,positionals:{path:{description:`Documentation path, optionally with #anchor (e.g., setup#install)`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,i=n.indexOf(`#`),o=i>=0?n.slice(0,i):n,s=i>=0?n.slice(i+1):void 0,c;try{c=await Vt(o)}catch(e){throw e instanceof ne?new k(`Page not found: ${o}`):e instanceof a?new k(`Failed to fetch page: ${await e.text()}`):e}if(s){let e=Yt(c,s);if(!e)throw new k(`Anchor not found: #${s}`);c=e}if(r){console.info(v({path:o,anchor:s,content:c}));return}console.info(c)});function Yt(e,t){let n=e.split(`
|
|
20
20
|
`),r=new Kt,i,a,o,s;for(let e=0;e<n.length;e++){let c=n[e],l=c.match(/^(?<fence>`{3,}|~{3,})/)?.groups?.fence;if(i){l?.startsWith(i)&&(i=void 0);continue}else if(l){i=l;continue}let u=c.match(/^(?<level>#{1,6})\s+(?<text>.*)/);if(u?.groups?.level&&u?.groups?.text){if(a!==void 0&&s!==void 0&&u.groups.level.length<=s){o=e;break}r.slug(u.groups.text)===t&&(a=e,s=u.groups.level.length)}}if(a!==void 0)return n.slice(a,o).join(`
|
|
21
|
-
`).trim()}var Xt=O({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Ut,description:`List available documentation pages`},view:{handler:Jt,description:`View a documentation page`}}});const A={"to-slice":{type:`string`,description:`Name of the target slice`},"to-type":{type:`string`,description:`Name of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},Zt={"from-slice":{type:`string`,description:`Name of the source slice`},"from-type":{type:`string`,description:`Name of the source content type`},variation:A.variation,tab:A.tab,repo:A.repo};async function Qt(e,t,r){let a=await _(),{"from-slice":o,"from-type":s,variation:c=`default`}=t,l=[o,s].filter(Boolean).length;if(l===0)throw new k(`Specify a target with --from-slice or --from-type.`);if(l>1)throw new k(`Only one of --from-slice or --from-type can be specified.`);if(o){let t=(await i(r)).find(e=>e.name===o);if(!t)throw new k(`Slice not found: ${o}`);let n=t.variations.find(e=>e.id===c);if(!n)throw new k(`Variation "${n}" not found. Available: ${t.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return n.primary??={},M(n.primary,e),[n.primary,async()=>{await re(t,r);try{await a.updateSlice(t)}catch{await a.createSlice(t)}await a.generateTypes()},`slice`]}let u=(await m(r)).find(e=>e.label===s);if(!u)throw new k(`Type not found: ${s}`);let d;for(let t in u.json)e in u.json[t]&&(d=u.json[t]);if(!d)throw new k(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(u.json)))||`(none)`}`);return M(d,e),[d,async()=>{await n(u,r);try{await a.updateCustomType(u)}catch{await a.createCustomType(u)}await a.generateTypes()},`customType`]}async function j(e,t){let r=await _(),o=e[`to-slice`]??e[`from-slice`],s=e[`to-type`]??e[`from-type`],c=[o,s].filter(Boolean).length;if(c===0)throw new k(`Specify a target with --to-slice or --to-type.`);if(c>1)throw new k(`Only one of --to-slice or --to-type can be specified.`);if(o){if(`tab`in e)throw new k(`--tab is only valid for content types.`);let n=e.variation??`default`,s=(await i(t)).find(e=>e.name===o);if(!s)throw new k(`Slice not found: ${o}`);let c=structuredClone(s),l=c.variations?.find(e=>e.id===n);if(!l)throw new k(`Variation "${n}" not found. Available: ${s.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return l.primary??={},[l.primary,async()=>{try{await re(c,t)}catch(e){throw e instanceof a?new k(`Failed to update slice: ${await e.text()}`):e}try{await r.updateSlice(c)}catch{await r.createSlice(c)}await r.generateTypes()},`slice`]}if(`variation`in e)throw new k(`--variation is only valid for slices.`);let l=e.tab??`Main`,u=(await m(t)).find(e=>e.label===s);if(!u)throw new k(`Type not found: ${s}`);let d=structuredClone(u),f=d.json[l];if(!f)throw new k(`Tab "${l}" not found. Available: ${Object.keys(u.json).join(`, `)||`(none)`}`);return[f,async()=>{try{await n(d,t)}catch(e){throw e instanceof a?new k(`Failed to update type: ${await e.text()}`):e}try{await r.updateCustomType(d)}catch{await r.createCustomType(d)}await r.generateTypes()},`customType`]}function M(e,t){if(!t.includes(`.`))return[e,t];let n=t.split(`.`),r=n.pop();if(!r)throw Error(`This is a bug. We cannot continue.`);let i=e;for(let e of n){let t=i[e];if(!t)throw new k(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new k(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}var $t=D({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},"default-value":{type:`boolean`,description:`Default value`},"true-label":{type:`string`,description:`Label for true value`},"false-label":{type:`string`,description:`Label for false value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"default-value":i,"true-label":a,"false-label":o,repo:s=await C()}=t,[c,l]=await j(t,{repo:s,token:await T(),host:await E()}),[u,d]=M(c,n),f={type:`Boolean`,config:{label:r??b(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new k(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),en=D({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Color`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),tn=D({name:`prismic field add content-relationship`,description:`Add a content relationship field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Allowed tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`Link`,config:{label:r??b(u),select:`document`,tags:i,customtypes:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),nn=D({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`Date`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),rn=D({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Embed`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),an=D({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await C()}=t,[a,o]=await j(t,{repo:i,token:await T(),host:await E()}),[s,c]=M(a,n),l={type:`GeoPoint`,config:{label:r??b(c)}};if(c in s)throw new k(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),on=D({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await C()}=t,[a,o]=await j(t,{repo:i,token:await T(),host:await E()}),[s,c]=M(a,n),l={type:`Group`,config:{label:r??b(c)}};if(c in s)throw new k(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),sn=D({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Image`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),cn=D({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},catalog:{type:`string`,description:`Integration catalog ID`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,catalog:a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`IntegrationFields`,config:{label:r??b(u),placeholder:i,catalog:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),ln=D({name:`prismic field add link`,description:`Add a link field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"allow-target-blank":i,"allow-text":a,repeatable:o,variant:s,repo:c=await C()}=t,[l,u]=await j(t,{repo:c,token:await T(),host:await E()}),[d,f]=M(l,n),p={type:`Link`,config:{label:r??b(f),allowTargetBlank:i,allowText:a,repeat:o,variants:s}};if(f in d)throw new k(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),un=D({name:`prismic field add link-to-media`,description:`Add a link to media field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},"allow-text":{type:`boolean`,description:`Allow custom link text`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"allow-text":i,variant:a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`Link`,config:{label:r??b(u),select:`media`,allowText:i,variants:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),dn=D({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},min:{type:`string`,description:`Minimum value`},max:{type:`string`,description:`Maximum value`},step:{type:`string`,description:`Step increment`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,o=fn(t.min,`min`),s=fn(t.max,`max`),c=fn(t.step,`step`),[l,u]=await j(t,{repo:a,token:await T(),host:await E()}),[d,f]=M(l,n),p={type:`Number`,config:{label:r??b(f),placeholder:i,min:o,max:s,step:c}};if(f in d)throw new k(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)});function fn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new k(`--${t} must be a valid number, got "${e}"`);return n}var pn=D({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
|
|
21
|
+
`).trim()}var Xt=O({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Ut,description:`List available documentation pages`},view:{handler:Jt,description:`View a documentation page`}}});const A={"to-slice":{type:`string`,description:`Name of the target slice`},"to-type":{type:`string`,description:`Name of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},Zt={"from-slice":{type:`string`,description:`Name of the source slice`},"from-type":{type:`string`,description:`Name of the source content type`},variation:A.variation,tab:A.tab,repo:A.repo};async function Qt(e,t,r){let a=await _(),{"from-slice":o,"from-type":s,variation:c=`default`}=t,l=[o,s].filter(Boolean).length;if(l===0)throw new k(`Specify a target with --from-slice or --from-type.`);if(l>1)throw new k(`Only one of --from-slice or --from-type can be specified.`);if(o){let t=(await i(r)).find(e=>e.name===o);if(!t)throw new k(`Slice not found: ${o}`);let n=t.variations.find(e=>e.id===c);if(!n)throw new k(`Variation "${n}" not found. Available: ${t.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return n.primary??={},M(n.primary,e),[n.primary,async()=>{await re(t,r);try{await a.updateSlice(t)}catch{await a.createSlice(t)}await a.generateTypes()},`slice`]}let u=(await m(r)).find(e=>e.label===s);if(!u)throw new k(`Type not found: ${s}`);let d;for(let t in u.json)e in u.json[t]&&(d=u.json[t]);if(!d)throw new k(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(u.json)))||`(none)`}`);return M(d,e),[d,async()=>{await n(u,r);try{await a.updateCustomType(u)}catch{await a.createCustomType(u)}await a.generateTypes()},`customType`]}async function j(e,t){let r=await _(),o=e[`to-slice`]??e[`from-slice`],s=e[`to-type`]??e[`from-type`],c=[o,s].filter(Boolean).length;if(c===0)throw new k(`Specify a target with --to-slice or --to-type.`);if(c>1)throw new k(`Only one of --to-slice or --to-type can be specified.`);if(o){if(`tab`in e)throw new k(`--tab is only valid for content types.`);let n=e.variation??`default`,s=(await i(t)).find(e=>e.name===o);if(!s)throw new k(`Slice not found: ${o}`);let c=structuredClone(s),l=c.variations?.find(e=>e.id===n);if(!l)throw new k(`Variation "${n}" not found. Available: ${s.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return l.primary??={},[l.primary,async()=>{try{await re(c,t)}catch(e){throw e instanceof a?new k(`Failed to update slice: ${await e.text()}`):e}try{await r.updateSlice(c)}catch{await r.createSlice(c)}await r.generateTypes()},`slice`]}if(`variation`in e)throw new k(`--variation is only valid for slices.`);let l=e.tab??`Main`,u=(await m(t)).find(e=>e.label===s);if(!u)throw new k(`Type not found: ${s}`);let d=structuredClone(u),f=d.json[l];if(!f)throw new k(`Tab "${l}" not found. Available: ${Object.keys(u.json).join(`, `)||`(none)`}`);return[f,async()=>{try{await n(d,t)}catch(e){throw e instanceof a?new k(`Failed to update type: ${await e.text()}`):e}try{await r.updateCustomType(d)}catch{await r.createCustomType(d)}await r.generateTypes()},`customType`]}function M(e,t){if(!t.includes(`.`))return[e,t];let n=t.split(`.`),r=n.pop();if(!r)throw Error(`This is a bug. We cannot continue.`);let i=e;for(let e of n){let t=i[e];if(!t)throw new k(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new k(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}var $t=D({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},"default-value":{type:`boolean`,description:`Default value`},"true-label":{type:`string`,description:`Label for true value`},"false-label":{type:`string`,description:`Label for false value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,"default-value":i,"true-label":a,"false-label":o,repo:s=await C()}=t,[c,l]=await j(t,{repo:s,token:await T(),host:await E()}),[u,d]=M(c,n),f={type:`Boolean`,config:{label:r??b(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new k(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),en=D({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Color`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),tn=D({name:`prismic field add content-relationship`,description:`Add a content relationship field to a slice or custom type. Use for querying and displaying data from related documents (e.g. an author or category). For navigational links, use link instead.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Allowed tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`Link`,config:{label:r??b(u),select:`document`,tags:i,customtypes:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),nn=D({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`Date`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),rn=D({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Embed`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),an=D({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await C()}=t,[a,o]=await j(t,{repo:i,token:await T(),host:await E()}),[s,c]=M(a,n),l={type:`GeoPoint`,config:{label:r??b(c)}};if(c in s)throw new k(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),on=D({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await C()}=t,[a,o]=await j(t,{repo:i,token:await T(),host:await E()}),[s,c]=M(a,n),l={type:`Group`,config:{label:r??b(c)}};if(c in s)throw new k(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),sn=D({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Image`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),cn=D({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},catalog:{type:`string`,description:`Integration catalog ID`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,catalog:a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`IntegrationFields`,config:{label:r??b(u),placeholder:i,catalog:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),ln=D({name:`prismic field add link`,description:`Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},allow:{type:`string`,description:`Restrict to a link type: document, media, or web`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,r=[`document`,`media`,`web`],{label:i,allow:a,"allow-target-blank":o,"allow-text":s,repeatable:c,variant:l,repo:u=await C()}=t;if(a&&!r.includes(a))throw new k(`--allow must be one of: ${r.join(`, `)}`);let d=a,[f,p]=await j(t,{repo:u,token:await T(),host:await E()}),[m,h]=M(f,n),ee={type:`Link`,config:{label:i??b(h),select:d,allowTargetBlank:o,allowText:s,repeat:c,variants:l}};if(h in m)throw new k(`Field "${n}" already exists.`);m[h]=ee,await p(),console.info(`Field added: ${n}`)}),un=D({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},min:{type:`string`,description:`Minimum value`},max:{type:`string`,description:`Maximum value`},step:{type:`string`,description:`Step increment`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,o=dn(t.min,`min`),s=dn(t.max,`max`),c=dn(t.step,`step`),[l,u]=await j(t,{repo:a,token:await T(),host:await E()}),[d,f]=M(l,n),p={type:`Number`,config:{label:r??b(f),placeholder:i,min:o,max:s,step:c}};if(f in d)throw new k(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)});function dn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new k(`--${t} must be a valid number, got "${e}"`);return n}var fn=D({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
|
|
22
22
|
heading1, heading2, heading3, heading4, heading5, heading6,
|
|
23
23
|
paragraph, strong, em, preformatted, hyperlink, image, embed,
|
|
24
24
|
list-item, o-list-item, rtl
|
|
25
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},allow:{type:`string`,description:`Comma-separated allowed block types (e.g. heading1,heading2,paragraph)`},single:{type:`boolean`,description:`Restrict to a single block`},"allow-target-blank":{type:`boolean`,description:`Allow opening links in new tab`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,allow:a=`paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl`,single:o,"allow-target-blank":s,repo:c=await C()}=t,[l,u]=await j(t,{repo:c,token:await T(),host:await E()}),[d,f]=M(l,n),p={type:`StructuredText`,config:{label:r??b(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new k(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),
|
|
25
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},allow:{type:`string`,description:`Comma-separated allowed block types (e.g. heading1,heading2,paragraph)`},single:{type:`boolean`,description:`Restrict to a single block`},"allow-target-blank":{type:`boolean`,description:`Allow opening links in new tab`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,allow:a=`paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl`,single:o,"allow-target-blank":s,repo:c=await C()}=t,[l,u]=await j(t,{repo:c,token:await T(),host:await E()}),[d,f]=M(l,n),p={type:`StructuredText`,config:{label:r??b(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new k(`Field "${n}" already exists.`);d[f]=p,await u(),console.info(`Field added: ${n}`)}),pn=D({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default selected value`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,"default-value":a,option:o,repo:s=await C()}=t,[c,l]=await j(t,{repo:s,token:await T(),host:await E()}),[u,d]=M(c,n),f={type:`Select`,config:{label:r??b(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new k(`Field "${n}" already exists.`);u[d]=f,await l(),console.info(`Field added: ${n}`)}),mn=D({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,repo:i=await C()}=t,[a,o]=await j(t,{repo:i,token:await T(),host:await E()}),[s,c]=M(a,n),l={type:`Table`,config:{label:r??b(c)}};if(c in s)throw new k(`Field "${n}" already exists.`);s[c]=l,await o(),console.info(`Field added: ${n}`)}),hn=D({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,repo:a=await C()}=t,[o,s]=await j(t,{repo:a,token:await T(),host:await E()}),[c,l]=M(o,n),u={type:`Text`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new k(`Field "${n}" already exists.`);c[l]=u,await s(),console.info(`Field added: ${n}`)}),gn=D({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...A,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},default:{type:`string`,description:`Default value`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i,default:a,repo:o=await C()}=t,[s,c]=await j(t,{repo:o,token:await T(),host:await E()}),[l,u]=M(s,n),d={type:`Timestamp`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new k(`Field "${n}" already exists.`);l[u]=d,await c(),console.info(`Field added: ${n}`)}),_n=D({name:`prismic field add uid`,description:`Add a UID field to a content type.`,options:{"to-type":{type:`string`,description:`Name of the target content type`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`},label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({values:e})=>{let{label:t=`UID`,placeholder:n,repo:r=await C()}=e,[i,a]=await j(e,{repo:r,token:await T(),host:await E()}),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in i)throw new k(`Field "uid" already exists.`);i.uid=o,await a(),console.info(`Field added: uid`)}),vn=O({name:`prismic field add`,description:`Add a field to a slice or custom type.`,commands:{boolean:{handler:$t,description:`Add a boolean field`},color:{handler:en,description:`Add a color field`},"content-relationship":{handler:tn,description:`Add a content relationship field for querying linked documents (e.g. author, category)`},date:{handler:nn,description:`Add a date field`},embed:{handler:rn,description:`Add an embed field`},geopoint:{handler:an,description:`Add a geopoint field`},group:{handler:on,description:`Add a group field`},image:{handler:sn,description:`Add an image field`},integration:{handler:cn,description:`Add an integration field`},link:{handler:ln,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:un,description:`Add a number field`},"rich-text":{handler:fn,description:`Add a rich text field`},select:{handler:pn,description:`Add a select field`},table:{handler:mn,description:`Add a table field`},text:{handler:hn,description:`Add a text field`},timestamp:{handler:gn,description:`Add a timestamp field`},uid:{handler:_n,description:`Add a UID field`}}});const yn={name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
|
|
26
26
|
Options vary by field type. Only options matching the field's
|
|
27
27
|
type will be applied. See \`prismic field add <type> --help\`
|
|
28
28
|
for type-specific option details.
|
|
29
|
-
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...Zt,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link
|
|
29
|
+
`},positionals:{id:{description:`Field ID`,required:!0}},options:{...Zt,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link)`},repeatable:{type:`boolean`,description:`Allow multiple links (link)`},variant:{type:`string`,multiple:!0,description:`Allowed variant (link/link-to-media, can be repeated)`},tag:{type:`string`,multiple:!0,description:`Allowed tag (content-relationship, can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (content-relationship, can be repeated)`},allow:{type:`string`,description:`Comma-separated allowed block types (rich-text)`},single:{type:`boolean`,description:`Restrict to a single block (rich-text)`},catalog:{type:`string`,description:`Integration catalog ID (integration)`}}};var bn=D(yn,async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,[i,a]=await Qt(n,t,{repo:r,token:await T(),host:await E()}),[o,s]=M(i,n),c=o[s];switch(c.config??={},`label`in t&&(c.config.label=t.label),`placeholder`in t&&`placeholder`in c.config&&(c.config.placeholder=t.placeholder),c.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new k(`--default-value for boolean fields must be "true" or "false"`);c.config.default_value=e===`true`}`true-label`in t&&(c.config.placeholder_true=t[`true-label`]),`false-label`in t&&(c.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(c.config.min=xn(t.min,`min`)),`max`in t&&(c.config.max=xn(t.max,`max`)),`step`in t&&(c.config.step=xn(t.step,`step`));break;case`Select`:`default-value`in t&&(c.config.default_value=t[`default-value`]),`option`in t&&(c.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(c.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(c.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(c.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:c.config.multi??c.config.single;delete c.config.multi,c.config.single=e}else `allow`in t&&(`single`in yn?yn.single=t.allow:c.config.multi=t.allow);break;case`Link`:`allow-target-blank`in t&&(c.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(c.config.allowText=t[`allow-text`]),`repeatable`in t&&(c.config.repeat=t.repeatable),`variant`in t&&(c.config.variants=t.variant),`tag`in t&&(c.config.tags=t.tag),`custom-type`in t&&(c.config.customtypes=t[`custom-type`]);break}await a(),console.info(`Field updated: ${n}`)});function xn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new k(`--${t} must be a valid number, got "${e}"`);return n}var Sn=D({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Zt},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,[i,a]=await Qt(n,t,{repo:r,token:await T(),host:await E()}),[o,s]=M(i,n);if(!(s in o))throw new k(`Field "${n}" does not exist.`);delete o[s],await a(),console.info(`Field removed: ${n}`)}),Cn=D({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...Zt,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,[i]=await Qt(n,t,{repo:r,token:await T(),host:await E()}),[a,o]=M(i,n),s=a[o];if(!s)throw new k(`Field "${n}" does not exist.`);if(t.json){console.info(v({id:o,...s}));return}if(console.info(`Type: ${s.type}`),s.config){for(let[e,t]of Object.entries(s.config))if(t!==void 0)if(e===`fields`&&typeof t==`object`&&t){let e=Object.keys(t).join(`, `)||`(none)`;console.info(`Fields: ${e}`)}else Array.isArray(t)?console.info(`${b(e)}: ${t.join(`, `)}`):console.info(`${b(e)}: ${t}`)}}),wn=O({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:vn,description:`Add a field`},edit:{handler:bn,description:`Edit a field`},remove:{handler:Sn,description:`Remove a field`},view:{handler:Cn,description:`View details of a field`}}}),Tn=D({name:`prismic gen setup`,description:`
|
|
30
30
|
Generate framework-specific setup files for a Prismic project.
|
|
31
31
|
|
|
32
32
|
Installs dependencies, creates the Prismic client file, slice simulator
|
|
33
33
|
page, preview routes, and other files required by the detected framework.
|
|
34
34
|
Skips files that already exist.
|
|
35
|
-
`,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await _()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await p()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),
|
|
35
|
+
`,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await _()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await p()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),En=D({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await _()).generateTypes(),t=f(await ve(),e);console.info(`Generated types at ${t}`)}),Dn=O({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:Tn,description:`Generate framework-specific Prismic setup`},types:{handler:En,description:`Generate TypeScript types from local models`}}});function On(e){We(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var kn=D({name:`prismic init`,description:`
|
|
36
36
|
Initialize a Prismic project by creating a prismic.config.json file.
|
|
37
37
|
|
|
38
38
|
Detects the project framework, installs dependencies, and syncs models
|
|
39
39
|
from Prismic. If a slicemachine.config.json exists, it will be migrated.
|
|
40
|
-
`,options:{repo:{type:`string`,short:`r`,description:`Repository name`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`}}},async({values:e})=>{let{repo:t,"no-browser":n}=e;try{throw await te(),new k(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof ce))throw e}let i;try{i=await r()}catch(e){e instanceof ge&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let a=t??i?.repositoryName;if(!a)throw new k(`Missing required flag: --repo`);let s=await T(),c=await E(),l;try{l=await ye({token:s,host:c})}catch(e){if(e instanceof ie||e instanceof o){console.info(`Not logged in. Starting login...`);let{email:e}=await wt({onReady:e=>{n?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),
|
|
40
|
+
`,options:{repo:{type:`string`,short:`r`,description:`Repository name`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`}}},async({values:e})=>{let{repo:t,"no-browser":n}=e;try{throw await te(),new k(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof ce))throw e}let i;try{i=await r()}catch(e){e instanceof ge&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let a=t??i?.repositoryName;if(!a)throw new k(`Missing required flag: --repo`);let s=await T(),c=await E(),l;try{l=await ye({token:s,host:c})}catch(e){if(e instanceof ie||e instanceof o){console.info(`Not logged in. Starting login...`);let{email:e}=await wt({onReady:e=>{n?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),On(e))}});console.info(`Logged in as ${e}`),s=await T(),l=await ye({token:s,host:c})}else throw e}if(!l.repositories.find(e=>e.domain===a))throw new k(`Repository "${a}" not found in your account. Check the name or request access to the repository.`);if(!await Ce(a,{token:s,host:c}))throw new le;let u=await _();try{await de({repositoryName:a,documentAPIEndpoint:c===me?void 0:`https://${a}.cdn.${c}/api/v2/`,libraries:i?.libraries,routes:[]})}catch(e){throw e instanceof De?new k(`Could not find a package.json file. Run this command from a project directory.`):new k(`Failed to create prismic.config.json.`)}if(i){try{await Oe()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await u.initProject();try{console.info(`Installing dependencies...`),await p()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}await u.syncModels({repo:a,token:s,host:c}),console.info(`\nInitialized Prismic for repository "${a}".`)});const An=e({id:y(),label:y(),customName:se(y()),isMaster:c()});async function jn(t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,Pn(i));return a.searchParams.set(`repository`,n),(await l(a,{headers:{Authorization:`Bearer ${r}`},schema:e({results:S(An)})})).results}async function Mn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,Pn(i));return a.searchParams.set(`repository`,n),await l(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:An})}async function Nn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,Pn(i));a.searchParams.set(`repository`,n),await l(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function Pn(e){return new URL(`https://api.internal.${e}/locale/`)}var Fn=D({name:`prismic locale add`,description:`
|
|
41
41
|
Add a locale to a Prismic repository.
|
|
42
42
|
|
|
43
43
|
By default, this command reads the repository from prismic.config.json at the
|
|
44
44
|
project root.
|
|
45
|
-
`,positionals:{code:{description:`Locale code (e.g. fr-fr, es-es)`,required:!0}},options:{master:{type:`boolean`,description:`Set as the master locale`},name:{type:`string`,short:`n`,description:`Custom display name (for custom locales)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),master:i=!1,name:o}=t,s=await T(),c=await E();try{await
|
|
45
|
+
`,positionals:{code:{description:`Locale code (e.g. fr-fr, es-es)`,required:!0}},options:{master:{type:`boolean`,description:`Set as the master locale`},name:{type:`string`,short:`n`,description:`Custom display name (for custom locales)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),master:i=!1,name:o}=t,s=await T(),c=await E();try{await Mn({id:n,isMaster:i,customName:o},{repo:r,token:s,host:c})}catch(e){throw e instanceof a?new k(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),In=D({name:`prismic locale list`,description:`
|
|
46
46
|
List all locales in a Prismic repository.
|
|
47
47
|
|
|
48
48
|
By default, this command reads the repository from prismic.config.json at the
|
|
49
49
|
project root.
|
|
50
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await
|
|
50
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await jn({repo:t,token:await T(),host:await E()});if(n){console.info(v(r));return}if(r.length===0){console.info(`No locales found.`);return}for(let e of r){let t=e.isMaster?` (master)`:``;console.info(`${e.id} ${e.label}${t}`)}}),Ln=D({name:`prismic locale remove`,description:`
|
|
51
51
|
Remove a locale from a Prismic repository.
|
|
52
52
|
|
|
53
53
|
By default, this command reads the repository from prismic.config.json at the
|
|
54
54
|
project root.
|
|
55
|
-
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E();try{await
|
|
55
|
+
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E();try{await Nn(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),Rn=D({name:`prismic locale set-master`,description:`
|
|
56
56
|
Set the master locale for a Prismic repository.
|
|
57
57
|
|
|
58
58
|
By default, this command reads the repository from prismic.config.json at the
|
|
59
59
|
project root.
|
|
60
|
-
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=await
|
|
60
|
+
`,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=await jn({repo:r,token:i,host:o}),c=s.find(e=>e.id===n);if(!c)throw new k(`Locale "${n}" not found. Available locales: ${s.map(e=>e.id).join(`, `)}`);if(c.isMaster)throw new k(`Locale "${n}" is already the master.`);try{await Mn({id:c.id,isMaster:!0,customName:c.customName??void 0},{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),zn=O({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:Fn,description:`Add a locale`},list:{handler:In,description:`List locales`},remove:{handler:Ln,description:`Remove a locale`},"set-master":{handler:Rn,description:`Set the master locale`}}}),Bn=D({name:`prismic login`,description:`Log in to Prismic via browser.`,options:{"no-browser":{type:`boolean`,description:`Skip opening the browser automatically`}}},async({values:e})=>{let{"no-browser":t}=e,{email:n}=await wt({onReady:e=>{t?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),Vn(e))}});console.info(`Logged in to Prismic as ${n}`)});function Vn(e){We(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var Hn=D({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await xt())console.info(`Logged out of Prismic`);else throw new k(`Logout failed. You can log out manually by deleting the file.`)});const Un=e({results:S(e({id:y(),label:y(),url:y()}))});async function Wn(e){let{repo:t,token:n,host:r}=e;return(await l(new URL(`core/repository/preview_configs`,Xn(t,r)),{credentials:{"prismic-auth":n},schema:Un})).results}async function Gn(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`previews/new`,Xn(n,i)),{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}async function Kn(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`previews/delete/${e}`,Xn(n,i)),{method:`POST`,body:{},credentials:{"prismic-auth":r}})}const qn=e({simulator_url:g(y())});async function Jn(e){let{repo:t,token:n,host:r}=e;return(await l(new URL(`core/repository`,Xn(t,r)),{credentials:{"prismic-auth":n},schema:qn})).simulator_url}async function Yn(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`core/repository`,Xn(n,i)),{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}function Xn(e,t){return new URL(`https://${e}.${t}/`)}var Zn=D({name:`prismic preview add`,description:`
|
|
61
61
|
Add a preview configuration to a Prismic repository.
|
|
62
62
|
|
|
63
63
|
By default, this command reads the repository from prismic.config.json at the
|
|
64
64
|
project root.
|
|
65
|
-
`,positionals:{url:{description:`Preview URL (e.g. https://example.com/api/preview)`,required:!0}},options:{name:{type:`string`,short:`n`,description:`Display name (defaults to hostname)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),name:i}=t,o;try{o=new URL(n)}catch{throw new k(`Invalid URL: ${n}`)}let s=i||o.hostname,c=`${o.protocol}//${o.host}`,l=o.pathname===`/`?void 0:o.pathname,u=await T(),d=await E();try{await
|
|
65
|
+
`,positionals:{url:{description:`Preview URL (e.g. https://example.com/api/preview)`,required:!0}},options:{name:{type:`string`,short:`n`,description:`Display name (defaults to hostname)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),name:i}=t,o;try{o=new URL(n)}catch{throw new k(`Invalid URL: ${n}`)}let s=i||o.hostname,c=`${o.protocol}//${o.host}`,l=o.pathname===`/`?void 0:o.pathname,u=await T(),d=await E();try{await Gn({name:s,websiteURL:c,resolverPath:l},{repo:r,token:u,host:d})}catch(e){throw e instanceof a?new k(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`)}),Qn=D({name:`prismic preview list`,description:`
|
|
66
66
|
List all preview configurations in a Prismic repository.
|
|
67
67
|
|
|
68
68
|
By default, this command reads the repository from prismic.config.json at the
|
|
69
69
|
project root.
|
|
70
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await T(),i=await E(),[a,o]=await Promise.all([
|
|
70
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await T(),i=await E(),[a,o]=await Promise.all([Wn({repo:t,token:r,host:i}),Jn({repo:t,token:r,host:i})]);if(n){console.info(v({previews:a,simulatorUrl:o??null}));return}if(a.length===0&&!o){console.info(`No preview configurations found.`);return}for(let e of a)console.info(`${e.url} ${e.label}`);o&&console.info(`\nSimulator: ${o}`)}),$n=D({name:`prismic preview remove`,description:`
|
|
71
71
|
Remove a preview configuration from a Prismic repository.
|
|
72
72
|
|
|
73
73
|
By default, this command reads the repository from prismic.config.json at the
|
|
74
74
|
project root.
|
|
75
|
-
`,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await
|
|
75
|
+
`,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await Wn({repo:r,token:i,host:o})).find(e=>e.url===n);if(!s)throw new k(`Preview not found: ${n}`);try{await Kn(s.id,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),er=D({name:`prismic preview set-simulator`,description:`
|
|
76
76
|
Set the slice simulator URL for a Prismic repository.
|
|
77
77
|
|
|
78
78
|
If the URL pathname does not end with /slice-simulator, it is appended
|
|
@@ -80,54 +80,54 @@ import{$ as e,A as t,B as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L a
|
|
|
80
80
|
|
|
81
81
|
By default, this command reads the repository from prismic.config.json at the
|
|
82
82
|
project root.
|
|
83
|
-
`,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i;try{i=new URL(n)}catch{throw new k(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let o=i.toString(),s=await T(),c=await E();try{await
|
|
83
|
+
`,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i;try{i=new URL(n)}catch{throw new k(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let o=i.toString(),s=await T(),c=await E();try{await Yn(o,{repo:r,token:s,host:c})}catch(e){throw e instanceof a?new k(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${o}`)}),tr=O({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:Zn,description:`Add a preview configuration`},list:{handler:Qn,description:`List preview configurations`},remove:{handler:$n,description:`Remove a preview configuration`},"set-simulator":{handler:er,description:`Set the slice simulator URL`}}});const nr=e({documentsPublished:c(),documentsUnpublished:c(),releasesCreated:c(),releasesUpdated:c(),tagsCreated:c(),tagsDeleted:c()}),rr=Object.keys(nr.shape),ir=e({config:oe(nr,{_id:y(),url:y(),active:c(),name:se(y()),secret:se(y()),headers:Te(y(),y())})});async function ar(e){let{repo:t,token:n,host:r}=e,i=N(t,r);return await l(new URL(`app/settings/webhooks`,i),{credentials:{"prismic-auth":n},schema:S(ir)})}async function or(e,t){let{repo:n,token:r,host:i}=t,a=N(n,i),o=new URL(`app/settings/webhooks/create`,a),s=new FormData;s.set(`url`,e.url),s.set(`name`,e.name??``),s.set(`secret`,e.secret??``),s.set(`headers`,JSON.stringify({})),s.set(`active`,`on`),s.set(`documentsPublished`,e.documentsPublished.toString()),s.set(`documentsUnpublished`,e.documentsUnpublished.toString()),s.set(`releasesCreated`,e.releasesCreated.toString()),s.set(`releasesUpdated`,e.releasesUpdated.toString()),s.set(`tagsCreated`,e.tagsCreated.toString()),s.set(`tagsDeleted`,e.tagsDeleted.toString()),await l(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}async function sr(e,t,n){let{repo:r,token:i,host:a}=n,o=N(r,a),s=new URL(`app/settings/webhooks/${e}`,o),c=new FormData;c.set(`url`,t.url),c.set(`name`,t.name??``),c.set(`secret`,t.secret??``),c.set(`headers`,JSON.stringify(t.headers??{})),c.set(`active`,t.active?`on`:`off`),c.set(`documentsPublished`,t.documentsPublished.toString()),c.set(`documentsUnpublished`,t.documentsUnpublished.toString()),c.set(`releasesCreated`,t.releasesCreated.toString()),c.set(`releasesUpdated`,t.releasesUpdated.toString()),c.set(`tagsCreated`,t.tagsCreated.toString()),c.set(`tagsDeleted`,t.tagsDeleted.toString()),await l(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}async function cr(e,t){let{repo:n,token:r,host:i}=t,a=N(n,i);await l(new URL(`app/settings/webhooks/${e}/delete`,a),{method:`POST`,credentials:{"prismic-auth":r}})}const lr=e({id:y(),scope:y(),token:y(),created_at:e({$date:h()})}),ur=e({id:y(),name:y(),wroom_auths:S(lr)}),dr=e({app_name:y(),token:y(),timestamp:h()}),fr=e({max_tokens:h(),tokens:S(dr)});async function pr(e){return await l(new URL(`settings/security/contentapi`,N(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:S(ur)})}async function mr(e,t){return await l(new URL(`settings/security/oauthapp`,N(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:ur})}async function hr(e,t,n){return await l(new URL(`settings/security/authorizations`,N(n.repo,n.host)),{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:lr})}async function gr(e,t){await l(new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,N(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function _r(e){return await l(new URL(`settings/security/customtypesapi`,N(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:fr})}async function vr(e,t){return await l(new URL(`settings/security/token`,N(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:dr})}async function yr(e,t){await l(new URL(`settings/security/token/${encodeURIComponent(e)}`,N(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function br(e){let{domain:t,token:n,host:r}=e;return await l(new URL(`app/dashboard/repositories/${t}/exists`,Dr(r)),{credentials:{"prismic-auth":n},schema:c()})}async function xr(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await l(new URL(`app/dashboard/repositories`,Dr(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Sr=e({repository:e({api_access:y()})});async function Cr(e){let{repo:t,token:n,host:r}=e;return(await l(new URL(`syncState`,N(t,r)),{credentials:{"prismic-auth":n},schema:Sr})).repository.api_access}async function wr(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`settings/security/apiaccess`,N(n,i)),{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}const Tr=e({repository:e({name:y()})});async function Er(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,N(n,i)),o=new FormData;return o.set(`displayname`,e),(await l(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:Tr})).repository.name}function Dr(e){return new URL(`https://${e}/`)}function N(e,t){return new URL(`https://${e}.${t}/`)}var Or=D({name:`prismic repo create`,description:`Create a new Prismic repository.`,options:{name:{type:`string`,short:`n`,description:`Display name for the repository`}}},async({values:e})=>{let{name:t}=e,n=await T(),r=await E(),i=await kr({token:n,host:r});if(!i)throw new k(`Failed to create a repository. Please try again.`);let o=(await _().catch(()=>void 0))?.id??`other`;try{await xr({domain:i,name:t??i,framework:o,token:n,host:r})}catch(e){throw e instanceof a?new k(`Failed to create repository: ${await e.text()}`):e}console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function kr(e){let{token:t,host:n}=e,r;for(let e=0;e<5;e++){let e=crypto.randomUUID().replace(/-/g,``).slice(0,8);if(await br({domain:e,token:t,host:n})){r=e;break}}return r}var Ar=D({name:`prismic repo list`,description:`List all Prismic repositories associated with your account.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await T(),r=await E(),i;try{i=await ye({token:n,host:r})}catch(e){throw e instanceof a?new k(`Failed to list repositories: ${await e.text()}`):e}let o=i.repositories;if(t){console.info(v(o.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(o.length===0){console.info(`No repositories found.`);return}for(let e of o){let t=e.name||`(no name)`,n=e.role?` ${e.role}`:``;console.info(`${e.domain} ${t}${n}`)}});const jr=[`private`,`public`,`open`];var Mr=D({name:`prismic repo set-api-access`,description:`
|
|
84
84
|
Set the Content API access level of a Prismic repository.
|
|
85
85
|
|
|
86
86
|
By default, this command reads the repository from prismic.config.json at the
|
|
87
87
|
project root.
|
|
88
|
-
`,positionals:{level:{description:`Access level (${
|
|
88
|
+
`,positionals:{level:{description:`Access level (${jr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t;if(!jr.includes(n))throw new k(`Invalid access level: ${n}. Must be one of: ${jr.join(`, `)}`);let i=await T(),o=await E();try{await wr(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Nr=D({name:`prismic repo set-name`,description:`
|
|
89
89
|
Set the display name of a Prismic repository.
|
|
90
90
|
|
|
91
91
|
By default, this command reads the repository from prismic.config.json at the
|
|
92
92
|
project root.
|
|
93
|
-
`,positionals:{name:{description:`Display name for the repository`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s;try{s=await
|
|
93
|
+
`,positionals:{name:{description:`Display name for the repository`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s;try{s=await Er(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${s}`)}),Pr=D({name:`prismic repo view`,description:`
|
|
94
94
|
View details of a Prismic repository.
|
|
95
95
|
|
|
96
96
|
By default, this command reads the repository from prismic.config.json at the
|
|
97
97
|
project root.
|
|
98
|
-
`,options:{web:{type:`boolean`,short:`w`,description:`Open repository in browser`},json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),web:n,json:r}=e,i=await T(),o=await E(),s=`https://${t}.${o}/`;if(n){An(new URL(s)),console.info(`Opening ${s}`);return}let c,l;try{[c,l]=await Promise.all([ye({token:i,host:o}),Tr({repo:t,token:i,host:o})])}catch(e){throw e instanceof a?new k(`Failed to fetch repository details: ${await e.text()}`):e}let u=c.repositories.find(e=>e.domain===t);if(!u)throw new k(`Repository not found: ${t}`);if(r){console.info(v({domain:u.domain,name:u.name??null,url:s,apiAccess:l}));return}let d=u.name||`(no name)`;console.info(`Name: ${d}`),console.info(`URL: ${s}`),console.info(`Content API: ${l}`)}),Lr=O({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Ar,description:`Create a new repository`},list:{handler:Mr,description:`List repositories`},view:{handler:Ir,description:`View repository details`},"set-name":{handler:Fr,description:`Set repository display name`},"set-api-access":{handler:Pr,description:`Set Content API access level`}}}),Rr=D({name:`prismic slice add-variation`,description:`Add a variation to a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the slice`},id:{type:`string`,description:`Custom ID for the variation`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,id:o=ue(n),repo:s=await C()}=t,c=await _(),l=await T(),u=await E(),d=(await i({repo:s,token:l,host:u})).find(e=>e.name===r);if(!d)throw new k(`Slice not found: ${r}`);if(d.variations.some(e=>e.id===o))throw new k(`Variation "${o}" already exists in slice "${r}".`);let f={...d,variations:[...d.variations,{id:o,name:n,description:n,docURL:``,imageUrl:``,version:``,primary:{}}]};try{await re(f,{repo:s,host:u,token:l})}catch(e){throw e instanceof a?new k(`Failed to add variation: ${await e.text()}`):e}try{await c.updateSlice(f)}catch{await c.createSlice(f)}await c.generateTypes(),console.info(`Added variation "${n}" (id: "${o}") to slice "${r}"`)}),zr=D({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{to:o,"slice-zone":s=`slices`,repo:c=await C()}=t,l=await _(),u={repo:c,token:await T(),host:await E()},d=(await i(u)).find(e=>e.name===r);if(!d)throw new k(`Slice not found: ${r}`);let f=(await m(u)).find(e=>e.label===o);if(!f)throw new k(`Type not found: ${o}`);let p=Object.assign({},...Object.values(f.json))[s];if(!p||p.type!==`Slices`)throw new k(`Slice zone "${s}" not found in "${o}".`);if(p.config??={},p.config.choices??={},d.id in p.config.choices)throw new k(`Slice "${d.id}" is already connected to "${o}" in slice zone "${s}".`);p.config.choices[d.id]={type:`SharedSlice`};try{await n(f,u)}catch(e){throw e instanceof a?new k(`Failed to connect slice: ${await e.text()}`):e}try{await l.updateCustomType(f)}catch{await l.createCustomType(f)}await l.generateTypes(),console.info(`Connected slice "${r}" to "${o}"`)}),Br=D({name:`prismic slice create`,description:`Create a new slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{id:{type:`string`,description:`Custom ID for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{id:r=fe(n),repo:i=await C()}=t,o={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},s=await _(),c=await T(),l=await E();try{await u(o,{repo:i,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to create slice: ${await e.text()}`):e}await s.createSlice(o),await s.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`)}),Vr=D({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{from:o,"slice-zone":s=`slices`,repo:c=await C()}=t,l=await _(),u={repo:c,token:await T(),host:await E()},d=(await i(u)).find(e=>e.name===r);if(!d)throw new k(`Slice not found: ${r}`);let f=(await m(u)).find(e=>e.label===o);if(!f)throw new k(`Type not found: ${o}`);let p=Object.assign({},...Object.values(f.json))[s];if(!p||p.type!==`Slices`)throw new k(`Slice zone "${s}" not found in "${o}".`);if(!p.config?.choices||!(d.id in p.config.choices))throw new k(`Slice "${d.id}" is not connected to "${o}" in slice zone "${s}".`);delete p.config.choices[d.id];try{await n(f,u)}catch(e){throw e instanceof a?new k(`Failed to disconnect slice: ${await e.text()}`):e}try{await l.updateCustomType(f)}catch{await l.createCustomType(f)}await l.generateTypes(),console.info(`Disconnected slice "${r}" from "${o}"`)}),Hr=D({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,o=await _(),s=await T(),c=await E(),l=(await i({repo:r,token:s,host:c})).find(e=>e.name===n);if(!l)throw new k(`Slice not found: ${n}`);let u={...l};`name`in t&&(u.name=t.name);try{await re(u,{repo:r,host:c,token:s})}catch(e){throw e instanceof a?new k(`Failed to update slice: ${await e.text()}`):e}try{await o.updateSlice(u)}catch{await o.createSlice(u)}await o.generateTypes(),console.info(`Slice updated: "${u.name}" (id: ${u.id})`)}),Ur=D({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{in:{type:`string`,required:!0,description:`Name of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{in:r,repo:o=await C()}=t,s=await _(),c=await T(),l=await E(),u=(await i({repo:o,token:c,host:l})).find(e=>e.name===r);if(!u)throw new k(`Slice not found: ${r}`);let d=u.variations.find(e=>e.name===n);if(!d)throw new k(`Variation "${n}" not found in slice "${r}".`);`name`in t&&(d.name=t.name);let f={...u};try{await re(f,{repo:o,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to update variation: ${await e.text()}`):e}try{await s.updateSlice(f)}catch{await s.createSlice(f)}await s.generateTypes(),console.info(`Variation updated: "${d.name}" in slice "${r}"`)}),Wr=D({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await C()}=e,r=await i({repo:n,token:await T(),host:await E()});if(t){console.info(v(r));return}if(r.length===0){console.info(`No slices found.`);return}for(let e of r)console.info(`${e.name} (id: ${e.id})`)}),Gr=D({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,o=await _(),s=await T(),c=await E(),l=(await i({repo:r,token:s,host:c})).find(e=>e.name===n);if(!l)throw new k(`Slice not found: ${n}`);try{await ke(l.id,{repo:r,host:c,token:s})}catch(e){throw e instanceof a?new k(`Failed to remove slice: ${await e.text()}`):e}try{await o.deleteSlice(l.id)}catch{}await o.generateTypes(),console.info(`Slice removed: "${n}" (id: ${l.id})`)}),Kr=D({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:o=await C()}=t,s=await _(),c=await T(),l=await E(),u=(await i({repo:o,token:c,host:l})).find(e=>e.name===r);if(!u)throw new k(`Slice not found: ${r}`);let d=u.variations.find(e=>e.name===n);if(!d)throw new k(`Variation "${n}" not found in slice "${r}".`);let f={...u,variations:u.variations.filter(e=>e.id!==d.id)};try{await re(f,{repo:o,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to remove variation: ${await e.text()}`):e}try{await s.updateSlice(f)}catch{await s.createSlice(f)}await s.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),qr=D({name:`prismic slice view`,description:`View details of a slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:a=await C()}=t,o=(await i({repo:a,token:await T(),host:await E()})).find(e=>e.name===n);if(!o)throw new k(`Slice not found: ${n}`);if(r){console.info(v(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.name}`);let s=o.variations?.map(e=>e.id).join(`, `)||`(none)`;console.info(`Variations: ${s}`)}),Jr=O({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Br,description:`Create a new slice`},edit:{handler:Hr,description:`Edit a slice`},remove:{handler:Gr,description:`Remove a slice`},list:{handler:Wr,description:`List slices`},view:{handler:qr,description:`View a slice`},connect:{handler:zr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Vr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Rr,description:`Add a variation to a slice`},"edit-variation":{handler:Ur,description:`Edit a variation of a slice`},"remove-variation":{handler:Kr,description:`Remove a variation from a slice`}}});const Yr=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let Xr=!1,Zr=``,Qr=``,$r,ei;const ti={app:{name:mt,version:ht}},ni=[],ri=[];async function ii(){try{if(x.TEST||(Xr=await fi(),!Xr))return;Zr=ze(),Qr=`Basic ${btoa(Yr+`:`)}`,process.on(`exit`,ui)}catch{Xr=!1}}function ai(e,t={}){if(!Xr)return;let{repository:n=ei,watch:r}=t,i={commandType:e,fullCommand:process.argv.join(` `)};n&&(i.repository=n),r!==void 0&&(i.watch=r),ni.push({event:`Prismic CLI Start`,properties:i,context:li(n)})}function oi(e,t={}){if(!Xr)return;let{success:n=!process.exitCode,error:r,repository:i=ei,watch:a}=t,o={commandType:e,fullCommand:process.argv.join(` `),success:n};i&&(o.repository=i),a!==void 0&&(o.watch=a),r!==void 0&&(o.error=(r instanceof Error?r.message:String(r)).slice(0,512)),ni.push({event:`Prismic CLI End`,properties:o,context:li(i)})}function si(e){Xr&&($r=e.shortId,ri.push({userId:$r,anonymousId:Zr,integrations:{Intercom:{user_hash:e.intercomHash}},context:ti,timestamp:new Date().toISOString()}))}function ci(e){ei=e}function li(e){let t={...ti};return e&&(t.groupId={Repository:e}),t}function ui(){if(!(ni.length===0&&ri.length===0)){try{let e=Buffer.from(JSON.stringify({trackUrl:`https://api.segment.io/v1/track`,identifyUrl:`https://api.segment.io/v1/identify`,authorization:Qr,trackEvents:ni.map(e=>({...$r?{userId:$r}:{},anonymousId:Zr,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:e.context,timestamp:new Date().toISOString()})),identifyEvents:ri})).toString(`base64`);Ke(process.execPath,[`--input-type=module`,`-e`,di,e],{detached:!0,stdio:`ignore`}).unref()}catch{}ni.length=0,ri.length=0}}const di=`
|
|
98
|
+
`,options:{web:{type:`boolean`,short:`w`,description:`Open repository in browser`},json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),web:n,json:r}=e,i=await T(),o=await E(),s=`https://${t}.${o}/`;if(n){On(new URL(s)),console.info(`Opening ${s}`);return}let c,l;try{[c,l]=await Promise.all([ye({token:i,host:o}),Cr({repo:t,token:i,host:o})])}catch(e){throw e instanceof a?new k(`Failed to fetch repository details: ${await e.text()}`):e}let u=c.repositories.find(e=>e.domain===t);if(!u)throw new k(`Repository not found: ${t}`);if(r){console.info(v({domain:u.domain,name:u.name??null,url:s,apiAccess:l}));return}let d=u.name||`(no name)`;console.info(`Name: ${d}`),console.info(`URL: ${s}`),console.info(`Content API: ${l}`)}),Fr=O({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Or,description:`Create a new repository`},list:{handler:Ar,description:`List repositories`},view:{handler:Pr,description:`View repository details`},"set-name":{handler:Nr,description:`Set repository display name`},"set-api-access":{handler:Mr,description:`Set Content API access level`}}}),Ir=D({name:`prismic slice add-variation`,description:`Add a variation to a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the slice`},id:{type:`string`,description:`Custom ID for the variation`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,id:o=ue(n),repo:s=await C()}=t,c=await _(),l=await T(),u=await E(),d=(await i({repo:s,token:l,host:u})).find(e=>e.name===r);if(!d)throw new k(`Slice not found: ${r}`);if(d.variations.some(e=>e.id===o))throw new k(`Variation "${o}" already exists in slice "${r}".`);let f={...d,variations:[...d.variations,{id:o,name:n,description:n,docURL:``,imageUrl:``,version:``,primary:{}}]};try{await re(f,{repo:s,host:u,token:l})}catch(e){throw e instanceof a?new k(`Failed to add variation: ${await e.text()}`):e}try{await c.updateSlice(f)}catch{await c.createSlice(f)}await c.generateTypes(),console.info(`Added variation "${n}" (id: "${o}") to slice "${r}"`)}),Lr=D({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`Name of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{to:o,"slice-zone":s=`slices`,repo:c=await C()}=t,l=await _(),u={repo:c,token:await T(),host:await E()},d=(await i(u)).find(e=>e.name===r);if(!d)throw new k(`Slice not found: ${r}`);let f=(await m(u)).find(e=>e.label===o);if(!f)throw new k(`Type not found: ${o}`);let p=Object.assign({},...Object.values(f.json))[s];if(!p||p.type!==`Slices`)throw new k(`Slice zone "${s}" not found in "${o}".`);if(p.config??={},p.config.choices??={},d.id in p.config.choices)throw new k(`Slice "${d.id}" is already connected to "${o}" in slice zone "${s}".`);p.config.choices[d.id]={type:`SharedSlice`};try{await n(f,u)}catch(e){throw e instanceof a?new k(`Failed to connect slice: ${await e.text()}`):e}try{await l.updateCustomType(f)}catch{await l.createCustomType(f)}await l.generateTypes(),console.info(`Connected slice "${r}" to "${o}"`)}),Rr=D({name:`prismic slice create`,description:`Create a new slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{id:{type:`string`,description:`Custom ID for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{id:r=fe(n),repo:i=await C()}=t,o={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},s=await _(),c=await T(),l=await E();try{await u(o,{repo:i,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to create slice: ${await e.text()}`):e}await s.createSlice(o),await s.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`)}),zr=D({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[r]=e,{from:o,"slice-zone":s=`slices`,repo:c=await C()}=t,l=await _(),u={repo:c,token:await T(),host:await E()},d=(await i(u)).find(e=>e.name===r);if(!d)throw new k(`Slice not found: ${r}`);let f=(await m(u)).find(e=>e.label===o);if(!f)throw new k(`Type not found: ${o}`);let p=Object.assign({},...Object.values(f.json))[s];if(!p||p.type!==`Slices`)throw new k(`Slice zone "${s}" not found in "${o}".`);if(!p.config?.choices||!(d.id in p.config.choices))throw new k(`Slice "${d.id}" is not connected to "${o}" in slice zone "${s}".`);delete p.config.choices[d.id];try{await n(f,u)}catch(e){throw e instanceof a?new k(`Failed to disconnect slice: ${await e.text()}`):e}try{await l.updateCustomType(f)}catch{await l.createCustomType(f)}await l.generateTypes(),console.info(`Disconnected slice "${r}" from "${o}"`)}),Br=D({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,o=await _(),s=await T(),c=await E(),l=(await i({repo:r,token:s,host:c})).find(e=>e.name===n);if(!l)throw new k(`Slice not found: ${n}`);let u={...l};`name`in t&&(u.name=t.name);try{await re(u,{repo:r,host:c,token:s})}catch(e){throw e instanceof a?new k(`Failed to update slice: ${await e.text()}`):e}try{await o.updateSlice(u)}catch{await o.createSlice(u)}await o.generateTypes(),console.info(`Slice updated: "${u.name}" (id: ${u.id})`)}),Vr=D({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{"from-slice":{type:`string`,required:!0,description:`Name of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-slice":r,repo:o=await C()}=t,s=await _(),c=await T(),l=await E(),u=(await i({repo:o,token:c,host:l})).find(e=>e.name===r);if(!u)throw new k(`Slice not found: ${r}`);let d=u.variations.find(e=>e.name===n);if(!d)throw new k(`Variation "${n}" not found in slice "${r}".`);`name`in t&&(d.name=t.name);let f={...u};try{await re(f,{repo:o,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to update variation: ${await e.text()}`):e}try{await s.updateSlice(f)}catch{await s.createSlice(f)}await s.generateTypes(),console.info(`Variation updated: "${d.name}" in slice "${r}"`)}),Hr=D({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{json:t,repo:n=await C()}=e,r=await i({repo:n,token:await T(),host:await E()});if(t){console.info(v(r));return}if(r.length===0){console.info(`No slices found.`);return}for(let e of r)console.info(`${e.name} (id: ${e.id})`)}),Ur=D({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,o=await _(),s=await T(),c=await E(),l=(await i({repo:r,token:s,host:c})).find(e=>e.name===n);if(!l)throw new k(`Slice not found: ${n}`);try{await ke(l.id,{repo:r,host:c,token:s})}catch(e){throw e instanceof a?new k(`Failed to remove slice: ${await e.text()}`):e}try{await o.deleteSlice(l.id)}catch{}await o.generateTypes(),console.info(`Slice removed: "${n}" (id: ${l.id})`)}),Wr=D({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{name:{description:`Name of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`Name of the slice`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,repo:o=await C()}=t,s=await _(),c=await T(),l=await E(),u=(await i({repo:o,token:c,host:l})).find(e=>e.name===r);if(!u)throw new k(`Slice not found: ${r}`);let d=u.variations.find(e=>e.name===n);if(!d)throw new k(`Variation "${n}" not found in slice "${r}".`);let f={...u,variations:u.variations.filter(e=>e.id!==d.id)};try{await re(f,{repo:o,host:l,token:c})}catch(e){throw e instanceof a?new k(`Failed to remove variation: ${await e.text()}`):e}try{await s.updateSlice(f)}catch{await s.createSlice(f)}await s.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),Gr=D({name:`prismic slice view`,description:`View details of a slice.`,positionals:{name:{description:`Name of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r,repo:a=await C()}=t,o=(await i({repo:a,token:await T(),host:await E()})).find(e=>e.name===n);if(!o)throw new k(`Slice not found: ${n}`);if(r){console.info(v(o));return}console.info(`ID: ${o.id}`),console.info(`Name: ${o.name}`);for(let e of o.variations??[]){console.info(``),console.info(`${e.id}:`);let t=Object.entries(e.primary??{});if(t.length===0)console.info(` (no fields)`);else for(let[e,n]of t){let t=n.config,r=t?.label||``,i=t?.placeholder?`"${t.placeholder}"`:``;console.info(` ${[e,n.type,r,i].filter(Boolean).join(` `)}`)}}}),Kr=O({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Rr,description:`Create a new slice`},edit:{handler:Br,description:`Edit a slice`},remove:{handler:Ur,description:`Remove a slice`},list:{handler:Hr,description:`List slices`},view:{handler:Gr,description:`View a slice`},connect:{handler:Lr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:zr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Ir,description:`Add a variation to a slice`},"edit-variation":{handler:Vr,description:`Edit a variation of a slice`},"remove-variation":{handler:Wr,description:`Remove a variation from a slice`}}});const qr=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let Jr=!1,Yr=``,Xr=``,Zr,Qr;const $r={app:{name:mt,version:ht}},ei=[],ti=[];async function ni(){try{if(x.TEST||(Jr=await ui(),!Jr))return;Yr=ze(),Xr=`Basic ${btoa(qr+`:`)}`,process.on(`exit`,ci)}catch{Jr=!1}}function ri(e,t={}){if(!Jr)return;let{repository:n=Qr,watch:r}=t,i={commandType:e,fullCommand:process.argv.join(` `)};n&&(i.repository=n),r!==void 0&&(i.watch=r),ei.push({event:`Prismic CLI Start`,properties:i,context:si(n)})}function ii(e,t={}){if(!Jr)return;let{success:n=!process.exitCode,error:r,repository:i=Qr,watch:a}=t,o={commandType:e,fullCommand:process.argv.join(` `),success:n};i&&(o.repository=i),a!==void 0&&(o.watch=a),r!==void 0&&(o.error=(r instanceof Error?r.message:String(r)).slice(0,512)),ei.push({event:`Prismic CLI End`,properties:o,context:si(i)})}function ai(e){Jr&&(Zr=e.shortId,ti.push({userId:Zr,anonymousId:Yr,integrations:{Intercom:{user_hash:e.intercomHash}},context:$r,timestamp:new Date().toISOString()}))}function oi(e){Qr=e}function si(e){let t={...$r};return e&&(t.groupId={Repository:e}),t}function ci(){if(!(ei.length===0&&ti.length===0)){try{let e=Buffer.from(JSON.stringify({trackUrl:`https://api.segment.io/v1/track`,identifyUrl:`https://api.segment.io/v1/identify`,authorization:Xr,trackEvents:ei.map(e=>({...Zr?{userId:Zr}:{},anonymousId:Yr,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:e.context,timestamp:new Date().toISOString()})),identifyEvents:ti})).toString(`base64`);Ke(process.execPath,[`--input-type=module`,`-e`,li,e],{detached:!0,stdio:`ignore`}).unref()}catch{}ei.length=0,ti.length=0}}const li=`
|
|
99
99
|
const {trackUrl, identifyUrl, authorization, trackEvents, identifyEvents} = JSON.parse(Buffer.from(process.argv[1], "base64"));
|
|
100
100
|
const h = {"Content-Type": "application/json", Authorization: authorization};
|
|
101
101
|
await Promise.allSettled([
|
|
102
102
|
...trackEvents.map(e => fetch(trackUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
|
|
103
103
|
...identifyEvents.map(e => fetch(identifyUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
|
|
104
104
|
]);
|
|
105
|
-
`;async function
|
|
105
|
+
`;async function ui(){try{return!((await di(Ve(Ze(),`.prismicrc`)))?.telemetry===!1||(await di(Ve(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function di(e){try{let t=await Ne(e,`utf8`);return JSON.parse(t)}catch{return}}const fi=x.TEST?500:5e3,pi=6e4;var mi=D({name:`prismic sync`,description:`
|
|
106
106
|
Sync content types and slices from Prismic to local files.
|
|
107
107
|
|
|
108
108
|
Remote models are the source of truth. Local files are created, updated,
|
|
109
109
|
or deleted to match.
|
|
110
|
-
`,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`}}},async({values:e})=>{let{repo:t=await C(),watch:n}=e;if(!await Ce(t,{token:await T(),host:await E()}))throw new le;let r=await _();if(console.info(`Syncing from repository: ${t}`),
|
|
110
|
+
`,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`}}},async({values:e})=>{let{repo:t=await C(),watch:n}=e;if(!await Ce(t,{token:await T(),host:await E()}))throw new le;let r=await _();if(console.info(`Syncing from repository: ${t}`),ri(`sync`,{watch:n}),n)await hi(t,r);else{let e=await T(),i=await E();await r.syncModels({repo:t,token:e,host:i}),ii(`sync`,{watch:n}),console.info(`Sync complete`)}});async function hi(e,t){let n=await T(),r=await E(),a=await i({repo:e,token:n,host:r}),o=await m({repo:e,token:n,host:r});await t.syncModels({repo:e,token:n,host:r}),console.info(we`
|
|
111
111
|
Initial sync completed!
|
|
112
112
|
|
|
113
|
-
Watching for changes (polling every ${
|
|
113
|
+
Watching for changes (polling every ${fi/1e3}s),
|
|
114
114
|
Press Ctrl+C to stop\n
|
|
115
|
-
`);let s=
|
|
115
|
+
`);let s=vi(a),c=vi(o),l=0;for(process.on(`SIGINT`,gi),process.on(`SIGTERM`,gi),process.on(`SIGHUP`,gi),process.on(`SIGQUIT`,gi),process.platform===`win32`&&process.on(`SIGBREAK`,gi);;){await Qe(_i(l));try{let a=vi(await i({repo:e,token:n,host:r})),o=a!==s,u=vi(await m({repo:e,token:n,host:r})),d=u!==c;if(o||d){let i=[];o&&(await t.syncSlices({repo:e,token:n,host:r}),s=a,i.push(`slices`)),d&&(await t.syncCustomTypes({repo:e,token:n,host:r}),c=u,i.push(`custom types`));let l=new Date().toLocaleTimeString();console.info(`[${l}] Changes detected in ${i.join(` and `)}`)}l=0}catch(e){l++;let t=e instanceof Error?e.message:`Unknown error`,n=Math.min(fi*2**(l-1),pi);if(console.error(`Error checking for changes: ${t}. Retrying in ${n/1e3}s...`),l>=10)throw Error(`Too many consecutive errors (10), stopping watch.`)}}}function gi(){console.info(`Watch stopped. Goodbye!`),ii(`sync`,{watch:!0}),process.exit(0)}function _i(e){return e===0?fi:Math.min(fi*2**(e-1),pi)}function vi(e){return Re(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const yi=`Prismic CLI`;var bi=D({name:`prismic token create`,description:`
|
|
116
116
|
Create a new API token for a Prismic repository.
|
|
117
117
|
|
|
118
118
|
By default, this command reads the repository from prismic.config.json at the
|
|
119
119
|
project root.
|
|
120
|
-
`,options:{write:{type:`boolean`,description:`Create a write token`},"allow-releases":{type:`boolean`,description:`Allow access to releases (read tokens only)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),write:n,"allow-releases":r}=e;if(n&&r)throw new k(`--allow-releases is only valid for access tokens (not with --write)`);let i=await T(),a=await E();if(n){let e=await
|
|
120
|
+
`,options:{write:{type:`boolean`,description:`Create a write token`},"allow-releases":{type:`boolean`,description:`Allow access to releases (read tokens only)`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),write:n,"allow-releases":r}=e;if(n&&r)throw new k(`--allow-releases is only valid for access tokens (not with --write)`);let i=await T(),a=await E();if(n){let e=await vr(yi,{repo:t,token:i,host:a});console.info(`Token created: ${e.token}`)}else{let e=r?`master+releases`:`master`,n=(await pr({repo:t,token:i,host:a})).find(e=>e.name===yi);n||=await mr(yi,{repo:t,token:i,host:a});let o=await hr(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}),xi=D({name:`prismic token delete`,description:`
|
|
121
121
|
Delete a token from a Prismic repository.
|
|
122
122
|
|
|
123
123
|
By default, this command reads the repository from prismic.config.json at the
|
|
124
124
|
project root.
|
|
125
|
-
`,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),a=await E(),[o,s]=await Promise.all([
|
|
125
|
+
`,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),a=await E(),[o,s]=await Promise.all([pr({repo:r,token:i,host:a}),_r({repo:r,token:i,host:a})]),c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){await gr(c.id,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}let l=s.tokens.find(e=>e.token===n);if(l){await yr(l.token,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}throw new k(`Token not found: ${n}`)}),Si=O({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:D({name:`prismic token list`,description:`
|
|
126
126
|
List all API tokens for a Prismic repository.
|
|
127
127
|
|
|
128
128
|
By default, this command reads the repository from prismic.config.json at the
|
|
129
129
|
project root.
|
|
130
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await T(),i=await E(),[a,o]=await Promise.all([
|
|
130
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await T(),i=await E(),[a,o]=await Promise.all([pr({repo:t,token:r,host:i}),_r({repo:t,token:r,host:i})]),s=a.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,scope:t.scope,token:t.token,createdAt:new Date(t.created_at.$date).toISOString().split(`T`)[0]}))),c=o.tokens;if(n){console.info(v({accessTokens:s,writeTokens:c}));return}if(s.length>0){console.info(`ACCESS TOKENS`);for(let e of s)console.info(` ${e.name} ${e.scope} ${e.token} ${e.createdAt}`)}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),c.length>0){console.info(`WRITE TOKENS`);for(let e of c){let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];console.info(` ${e.app_name} ${e.token} ${t}`)}}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:bi,description:`Create a new token`},delete:{handler:xi,description:`Delete a token`}}}),Ci=D({name:`prismic webhook create`,description:`
|
|
131
131
|
Create a new webhook in a Prismic repository.
|
|
132
132
|
|
|
133
133
|
By default, this command reads the repository from prismic.config.json at the
|
|
@@ -141,27 +141,27 @@ await Promise.allSettled([
|
|
|
141
141
|
tagsDeleted When a tag is deleted
|
|
142
142
|
|
|
143
143
|
If no triggers specified, all are enabled.
|
|
144
|
-
`}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),name:i,secret:o,trigger:s=[]}=t;for(let e of s)if(!
|
|
144
|
+
`}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),name:i,secret:o,trigger:s=[]}=t;for(let e of s)if(!rr.includes(e))throw new k(`Invalid trigger: ${e}\nValid triggers: ${rr.join(`, `)}`);let c=await T(),l=await E(),u=!(s.length>0);try{await or({url:n,name:i??null,secret:o??null,documentsPublished:s.includes(`documentsPublished`)||u,documentsUnpublished:s.includes(`documentsUnpublished`)||u,releasesCreated:s.includes(`releasesCreated`)||u,releasesUpdated:s.includes(`releasesUpdated`)||u,tagsCreated:s.includes(`tagsCreated`)||u,tagsDeleted:s.includes(`tagsDeleted`)||u},{repo:r,token:c,host:l})}catch(e){throw e instanceof a?new k(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`)}),wi=D({name:`prismic webhook disable`,description:`
|
|
145
145
|
Disable a webhook in a Prismic repository.
|
|
146
146
|
|
|
147
147
|
By default, this command reads the repository from prismic.config.json at the
|
|
148
148
|
project root.
|
|
149
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await
|
|
149
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await ar({repo:r,token:i,host:o})).find(e=>e.config.url===n);if(!s)throw new k(`Webhook not found: ${n}`);if(!s.config.active){console.info(`Webhook already disabled: ${n}`);return}let c=s.config._id,l=structuredClone(s.config);l.active=!1;try{await sr(c,l,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),Ti=D({name:`prismic webhook enable`,description:`
|
|
150
150
|
Enable a webhook in a Prismic repository.
|
|
151
151
|
|
|
152
152
|
By default, this command reads the repository from prismic.config.json at the
|
|
153
153
|
project root.
|
|
154
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await
|
|
154
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await ar({repo:r,token:i,host:o})).find(e=>e.config.url===n);if(!s)throw new k(`Webhook not found: ${n}`);if(s.config.active){console.info(`Webhook already enabled: ${n}`);return}let c=s.config._id,l=structuredClone(s.config);l.active=!0;try{await sr(c,l,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),Ei=D({name:`prismic webhook list`,description:`
|
|
155
155
|
List all webhooks in a Prismic repository.
|
|
156
156
|
|
|
157
157
|
By default, this command reads the repository from prismic.config.json at the
|
|
158
158
|
project root.
|
|
159
|
-
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await
|
|
159
|
+
`,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await C(),json:n}=e,r=await ar({repo:t,token:await T(),host:await E()});if(n){console.info(v(r.map(e=>e.config)));return}if(r.length===0){console.info(`No webhooks configured.`);return}for(let e of r){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}),Di=D({name:`prismic webhook remove`,description:`
|
|
160
160
|
Delete a webhook from a Prismic repository.
|
|
161
161
|
|
|
162
162
|
By default, this command reads the repository from prismic.config.json at the
|
|
163
163
|
project root.
|
|
164
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await
|
|
164
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=await T(),o=await E(),s=(await ar({repo:r,token:i,host:o})).find(e=>e.config.url===n);if(!s)throw new k(`Webhook not found: ${n}`);let c=s.config._id;try{await cr(c,{repo:r,token:i,host:o})}catch(e){throw e instanceof a?new k(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),Oi=D({name:`prismic webhook set-triggers`,description:`
|
|
165
165
|
Update which events trigger a webhook.
|
|
166
166
|
|
|
167
167
|
By default, this command reads the repository from prismic.config.json at the
|
|
@@ -173,17 +173,17 @@ await Promise.allSettled([
|
|
|
173
173
|
releasesUpdated When a release is edited or deleted
|
|
174
174
|
tagsCreated When a tag is created
|
|
175
175
|
tagsDeleted When a tag is deleted
|
|
176
|
-
`}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),trigger:i=[]}=t;for(let e of i)if(!
|
|
176
|
+
`}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),trigger:i=[]}=t;for(let e of i)if(!rr.includes(e))throw new k(`Invalid trigger: ${e}\nValid triggers: ${rr.join(`, `)}`);let o=await T(),s=await E(),c=(await ar({repo:r,token:o,host:s})).find(e=>e.config.url===n);if(!c)throw new k(`Webhook not found: ${n}`);let l=c.config._id;try{await sr(l,{...c.config,documentsPublished:i.includes(`documentsPublished`),documentsUnpublished:i.includes(`documentsUnpublished`),releasesCreated:i.includes(`releasesCreated`),releasesUpdated:i.includes(`releasesUpdated`),tagsCreated:i.includes(`tagsCreated`),tagsDeleted:i.includes(`tagsDeleted`)},{repo:r,token:o,host:s})}catch(e){throw e instanceof a?new k(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${i.join(`, `)}`)}),ki=D({name:`prismic webhook view`,description:`
|
|
177
177
|
View details of a webhook in a Prismic repository.
|
|
178
178
|
|
|
179
179
|
By default, this command reads the repository from prismic.config.json at the
|
|
180
180
|
project root.
|
|
181
|
-
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=(await
|
|
182
|
-
`);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=qi.test(n)?n.replace(qi,`$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 Zi(i.slice(r))}}function Xi(e){return Array.isArray(e)?Yi(...e):e}function Zi(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Qi(t).function||``)&&t.pop(),t.reverse(),Ji.test(Qi(t).function||``)&&(t.pop(),Ji.test(Qi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Qi(t).filename,function:e.function||`?`}))}function Qi(e){return e[e.length-1]||{}}const $i=`<anonymous>`;function ea(e){try{return!e||typeof e!=`function`?$i:e.name||$i}catch{return $i}}function ta(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function na(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const ra={},ia={};function aa(e,t){ra[e]=ra[e]||[],ra[e].push(t)}function oa(e,t){if(!ia[e]){ia[e]=!0;try{t()}catch(t){P&&R.error(`Error while instrumenting ${e}`,t)}}}function sa(e,t){let n=e&&ra[e];if(n)for(let r of n)try{r(t)}catch(t){P&&R.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ea(r)}\nError:`,t)}}let ca=null;function la(e){let t=`error`;aa(t,e),oa(t,ua)}function ua(){ca=F.onerror,F.onerror=function(e,t,n,r,i){return sa(`error`,{column:r,error:i,line:n,msg:e,url:t}),ca?ca.apply(this,arguments):!1},F.onerror.__SENTRY_INSTRUMENTED__=!0}let da=null;function fa(e){let t=`unhandledrejection`;aa(t,e),oa(t,pa)}function pa(){da=F.onunhandledrejection,F.onunhandledrejection=function(e){return sa(`unhandledrejection`,e),da?da.apply(this,arguments):!0},F.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const ma=Object.prototype.toString;function ha(e){switch(ma.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return z(e,Error)}}function ga(e,t){return ma.call(e)===`[object ${t}]`}function _a(e){return ga(e,`ErrorEvent`)}function va(e){return ga(e,`String`)}function ya(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function ba(e){return e===null||ya(e)||typeof e!=`object`&&typeof e!=`function`}function xa(e){return ga(e,`Object`)}function Sa(e){return typeof Event<`u`&&z(e,Event)}function Ca(e){return typeof Element<`u`&&z(e,Element)}function wa(e){return ga(e,`RegExp`)}function Ta(e){return!!(e?.then&&typeof e.then==`function`)}function Ea(e){return xa(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function z(e,t){try{return e instanceof t}catch{return!1}}function Da(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const Oa=F;function ka(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=Aa(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 Aa(e,t){let n=e,r=[];if(!n?.tagName)return``;if(Oa.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&&va(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 ja(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Na(i,r);try{e[t]=i}catch{P&&R.log(`Failed to replace method "${t}" in object`,e)}}function Ma(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{P&&R.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Na(e,t){try{e.prototype=t.prototype=t.prototype||{},Ma(e,`__sentry_original__`,t)}catch{}}function Pa(e){return e.__sentry_original__}function Fa(e){if(ha(e))return{message:e.message,name:e.name,stack:e.stack,...La(e)};if(Sa(e)){let t={type:e.type,target:Ia(e.target),currentTarget:Ia(e.currentTarget),...La(e)};return typeof CustomEvent<`u`&&z(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Ia(e){try{return Ca(e)?ka(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function La(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 Ra(e){let t=Object.keys(Fa(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let za;function Ba(e){if(za!==void 0)return za?za(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=F;return t in n&&typeof n[t]==`function`?(za=n[t],za(e)):(za=null,e())}function B(){return Ba(()=>Math.random())}function Va(){return Ba(()=>Date.now())}function Ha(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Ua(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 Wa(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Da(r)?n.push(ta(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Ga(e,t,n=!1){return va(e)?wa(t)?t.test(e):va(t)?n?e===t:e.includes(t):!1:!1}function Ka(e,t=[],n=!1){return t.some(t=>Ga(e,t,n))}function qa(){let e=F;return e.crypto||e.msCrypto}let Ja;function Ya(){return B()*16}function V(e=qa()){try{if(e?.randomUUID)return Ba(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Ja||=`10000000100040008000100000000000`,Ja.replace(/[018]/g,e=>(e^(Ya()&15)>>e/4).toString(16))}function Xa(e){return e.exception?.values?.[0]}function Za(e){let{message:t,event_id:n}=e;if(t)return t;let r=Xa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Qa(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 $a(e,t){let n=Xa(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 eo=/^(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 to(e){return parseInt(e||``,10)}function no(e){let t=e.match(eo)||[],n=to(t[1]),r=to(t[2]),i=to(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 ro(e){if(io(e))return!0;try{Ma(e,`__sentry_captured__`,!0)}catch{}return!1}function io(e){try{return e.__sentry_captured__}catch{}}const ao=1e3;function oo(){return Va()/ao}function so(){let{performance:e}=F;if(!e?.now||!e.timeOrigin)return oo;let t=e.timeOrigin;return()=>(t+Ba(()=>e.now()))/ao}let co;function lo(){return(co??=so())()}function uo(e){let t=lo(),n={sid:V(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>mo(n)};return e&&fo(n,e),n}function fo(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||lo(),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:V()),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 po(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),fo(e,n)}function mo(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 ho(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]=ho(r[e],t[e],n-1));return r}function go(){return V()}function _o(){return V().substring(16)}const vo=`_sentrySpan`;function yo(e,t){t?Ma(e,vo,t):delete e[vo]}function bo(e){return e[vo]}var H=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:go(),sampleRand:B()}}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,yo(t,bo(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&&fo(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():xa(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,yo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:go(),sampleRand:B()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:oo(),...e,message:e.message?Ha(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:bo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ho(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||V();if(!this._client)return P&&R.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||V();if(!this._client)return P&&R.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||V();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(P&&R.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 xo(){return Ii(`defaultCurrentScope`,()=>new H)}function So(){return Ii(`defaultIsolationScope`,()=>new H)}var Co=class{constructor(e,t){let n;n=e||new H;let r;r=t||new H,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 Ta(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 wo(){let e=Fi(I());return e.stack=e.stack||new Co(xo(),So())}function To(e){return wo().withScope(e)}function Eo(e,t){let n=wo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Do(e){return wo().withScope(()=>e(wo().getIsolationScope()))}function Oo(){return{withIsolationScope:Do,withScope:To,withSetScope:Eo,withSetIsolationScope:(e,t)=>Do(t),getCurrentScope:()=>wo().getScope(),getIsolationScope:()=>wo().getIsolationScope()}}function ko(e){let t=Fi(I());t.acs=e}function U(e){let t=Fi(e);return t.acs?t.acs:Oo()}function W(){return U(I()).getCurrentScope()}function G(){return U(I()).getIsolationScope()}function Ao(){return Ii(`globalScope`,()=>new H)}function jo(...e){let t=U(I());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Mo(...e){let t=U(I());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function K(){return W().getClient()}function No(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||_o()};return n&&(i.parent_span_id=n),i}const Po=`sentry.profile_id`,Fo=`sentry.exclusive_time`;function Io(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function Lo(e){let t=e;return{scope:t._sentryScope,isolationScope:Io(t._sentryIsolationScope)}}const Ro=/^sentry-/;function zo(e){let t=Vo(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Ro)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Bo(e){if(e)return Uo(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Vo(e){if(!(!e||!va(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Ho(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Ho(e)}function Ho(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 Uo(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?(P&&R.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Wo=/^o(\d+)\./,Go=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Ko(e){return e===`http`||e===`https`}function qo(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 Jo(e){let t=Go.exec(e);if(!t){L(()=>{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 Yo({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Yo(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Xo(e){if(!P)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(R.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Ko(r)?t&&isNaN(parseInt(t,10))?(R.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(R.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(R.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Zo(e){return e.match(Wo)?.[1]}function Qo(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Zo(n)),r}function $o(e){let t=typeof e==`string`?Jo(e):Yo(e);if(!(!t||!Xo(t)))return t}function es(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 ts=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function ns(e){if(!e)return;let t=e.match(ts);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 rs(e,t){let n=ns(e),r=zo(t);if(!n?.traceId)return{traceId:go(),sampleRand:B()};let i=os(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 is(e=go(),t=_o(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function as(e=go(),t=_o(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function os(e,t){let n=es(t?.sample_rand);if(n!==void 0)return n;let r=es(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?B()*r:r+B()*(1-r):B()}function ss(e,t){let n=Qo(e);return t&&n&&t!==n?(R.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)?(R.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 cs=!1;function ls(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:hs(e).parent_span_id,a=Lo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||_o():t,trace_id:n}}function us(e){let{traceId:t,spanId:n}=e.spanContext();return is(t,n,vs(e))}function ds(e){let{traceId:t,spanId:n}=e.spanContext();return as(t,n,vs(e))}function fs(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 ps(e){return typeof e==`number`?ms(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ms(e.getTime()):lo()}function ms(e){return e>9999999999?e/1e3:e}function hs(e){if(_s(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(gs(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:ps(i),timestamp:ps(o)||void 0,status:ys(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:fs(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function gs(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function _s(e){return typeof e.getSpanJSON==`function`}function vs(e){let{traceFlags:t}=e.spanContext();return t===1}function ys(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function bs(e){return e._sentryRootSpan||e}function xs(){let e=U(I());return e.getActiveSpan?e.getActiveSpan():bo(W())}function Ss(){cs||=(L(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Cs=!1;function ws(){if(Cs)return;function e(){let e=xs(),t=e&&bs(e);if(t){let e=`internal_error`;P&&R.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Cs=!0,la(e),fa(e)}function Ts(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||K()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Es(e){R.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Ds(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(ks(n)){if(Ga(e.description,n))return P&&Es(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Ga(e.description,n.name):!0,r=n.op?e.op&&Ga(e.op,n.op):!0;if(t&&r)return P&&Es(e),!0}return!1}function Os(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 ks(e){return typeof e==`string`||e instanceof RegExp}const As=`production`;function js(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||As,release:n.release,public_key:r,trace_id:e,org_id:Qo(t)};return t.emit(`createDsc`,i),i}function Ms(e,t){let n=t.getPropagationContext();return n.dsc||js(n.traceId,e)}function Ns(e){let t=K();if(!t)return{};let n=bs(e),r=hs(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&&zo(l);if(u)return s(u);let d=js(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Ts()&&(d.sampled=String(vs(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Lo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function q(e,t=100,n=1/0){try{return Fs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ps(e,t=3,n=100*1024){let r=q(e,t);return zs(r)>n?Ps(e,t-1,n):r}function Fs(e,t,n=1/0,r=1/0,i=Bs()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Is(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 Fs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Fa(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]=Fs(e,t,c-1,r,i),d++}return o(t),u}function Is(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(Da(t))return ta(t);if(Ea(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${ea(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=Ls(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function Ls(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Rs(e){return~-encodeURI(e).split(/%..|./).length}function zs(e){return Rs(JSON.stringify(e))}function Bs(){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 J(e,t=[]){return[e,t]}function Vs(e,t){let[n,r]=e;return[n,[...r,t]]}function Hs(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 Us(e,t){return Hs(e,(e,n)=>t.includes(n))}function Ws(e){let t=Fi(F);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Gs(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Ws(r),e]:r.push(typeof e==`string`?Ws(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(q(n))}i(e)}}return typeof r==`string`?r:Ks(r)}function Ks(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 qs(e){let t=typeof e.data==`string`?Ws(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Js={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 Ys(e){return Js[e]}function Xs(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Zs(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:qo(r)},...i&&{trace:i}}}function Qs(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 $s(e,t,n,r){let i=Xs(n);return J({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:qo(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function ec(e,t,n,r){let i=Xs(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Qs(e,n?.sdk);let o=Zs(e,i,r,t);return delete e.sdkProcessingMetadata,J(o,[[{type:a},e]])}const tc=`__SENTRY_SUPPRESS_TRACING__`,nc=(e,t)=>{let n=U(I());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=K(),o=zo(i);return a&&!ss(a,o?.org_id)?ac(t):jo(e=>{let n=rs(r,i);return e.setPropagationContext(n),yo(e,void 0),t()})};function rc(e,t){let n=oc();return n.withActiveSpan?n.withActiveSpan(e,t):jo(n=>(yo(n,e||void 0),t(n)))}function ic(e){let t=oc();return t.suppressTracing?t.suppressTracing(e):jo(t=>{t.setSDKProcessingMetadata({[tc]:!0});let n=e();return t.setSDKProcessingMetadata({[tc]:void 0}),n})}function ac(e){return jo(t=>(t.setPropagationContext({traceId:go(),sampleRand:B()}),P&&R.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),rc(null,e)))}function oc(){return U(I())}function sc(e){return new lc(t=>{t(e)})}function cc(e){return new lc((t,n)=>{n(e)})}var lc=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(Ta(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 uc(e,t,n,r=0){try{let i=dc(t,n,e,r);return Ta(i)?i:sc(i)}catch(e){return cc(e)}}function dc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return P&&a===null&&R.log(`Event processor "${i.id||`?`}" dropped event`),Ta(a)?a.then(e=>dc(e,t,n,r+1)):dc(a,t,n,r+1)}let fc,pc,mc,Y;function hc(e){let t=F._sentryDebugIds,n=F._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Y&&r.length===pc&&i.length===mc)return Y;pc=r.length,mc=i.length,Y={},fc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=fc?.[r];if(i&&Y&&t)Y[i[0]]=t,fc&&(fc[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&&Y&&fc){Y[i]=t,fc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Y}function gc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;bc(e,t),r&&Cc(e,r),wc(e,n),xc(e,i),Sc(e,a)}function _c(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;vc(e,`extra`,n),vc(e,`tags`,r),vc(e,`attributes`,i),vc(e,`user`,a),vc(e,`contexts`,o),e.sdkProcessingMetadata=ho(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 vc(e,t,n){e[t]=ho(e[t],n,1)}function yc(e,t){let n=Ao().getScopeData();return e&&_c(n,e.getScopeData()),t&&_c(n,t.getScopeData()),n}function bc(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 xc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Sc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Cc(e,t){e.contexts={trace:ls(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ns(t),...e.sdkProcessingMetadata};let n=hs(bs(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function wc(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 Tc(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||V(),timestamp:t.timestamp||oo()},l=n.integrations||e.integrations.map(e=>e.name);Ec(c,e),kc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Dc(c,e.stackParser);let u=jc(r,n.captureContext);n.mechanism&&$a(c,n.mechanism);let d=i?i.getEventProcessors():[],f=yc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),gc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?sc(c):uc(m,c,n)).then(e=>(e&&Oc(e),typeof o==`number`&&o>0?Ac(e,o,s):e))}function Ec(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||As,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Ha(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Ha(e.value,a)})}function Dc(e,t){let n=hc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Oc(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 kc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Ac(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:q(e.data,t,n)}}))},...e.user&&{user:q(e.user,t,n)},...e.contexts&&{contexts:q(e.contexts,t,n)},...e.extra&&{extra:q(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=q(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:q(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=q(e.contexts.flags,3,n)),r}function jc(e,t){if(!t)return e;let n=e?e.clone():new H;return n.update(t),n}function Mc(e){if(e)return Nc(e)||Fc(e)?{captureContext:e}:e}function Nc(e){return e instanceof H||typeof e==`function`}const Pc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Fc(e){return Object.keys(e).some(e=>Pc.includes(e))}function Ic(e,t){return W().captureException(e,Mc(t))}function Lc(e,t){G().setContext(e,t)}function Rc(e,t){G().setTag(e,t)}function zc(e){G().setUser(e)}async function Bc(e){let t=K();return t?t.flush(e):(P&&R.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function Vc(){let e=K();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Hc(e){let t=G(),{user:n}=yc(t,W()),{userAgent:r}=F.navigator||{},i=uo({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&fo(a,{status:`exited`}),Uc(),t.setSession(i),i}function Uc(){let e=G(),t=W().getSession()||e.getSession();t&&po(t),Wc(),e.setSession()}function Wc(){let e=G(),t=K(),n=e.getSession();n&&t&&t.captureSession(n)}function Gc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Kc(e){return`${Gc(e)}${e.projectId}/envelope/`}function qc(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 Jc(e,t,n){return t||`${Kc(e)}?${qc(e,n)}`}const Yc=[];function Xc(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 Zc(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 Xc(r)}function Qc(e,t){let n={};return t.forEach(t=>{t&&el(e,t,n)}),n}function $c(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function el(e,t,n){if(n[t.name]){P&&R.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Yc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Yc.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)}P&&R.log(`Integration installed: ${t.name}`)}function X(e){return e}function tl(e,t){return t?jo(t,()=>{let n=xs(),r=n?ls(n):No(t);return[n?Ns(n):Ms(e,t),r]}):[void 0,void 0]}function nl(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function rl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=qo(r)),J(i,[nl(e)])}function il(e,t){let n=t??al(e)??[];if(n.length===0)return;let r=e.getOptions(),i=rl(n,r._metadata,r.tunnel,e.getDsn());ol().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function al(e){return ol().get(e)}function ol(){return Ii(`clientToLogBufferMap`,()=>new WeakMap)}function sl(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function cl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=qo(r)),J(i,[sl(e)])}function ll(e,t){let n=t??ul(e)??[];if(n.length===0)return;let r=e.getOptions(),i=cl(n,r._metadata,r.tunnel,e.getDsn());dl().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function ul(e){return dl().get(e)}function dl(){return Ii(`clientToMetricBufferMap`,()=>new WeakMap)}function fl(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const pl=Symbol.for(`SentryBufferFullError`);function ml(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return cc(pl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return sc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>fl(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function hl(e,t=Va()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function gl(e,t){return e[t]||e.all||0}function _l(e,t,n=Va()){return gl(e,t)>n}function vl(e,{statusCode:t,headers:n},r=Va()){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+hl(o,r):t===429&&(i.all=r+60*1e3);return i}function yl(e,t,n=ml(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Hs(i,(t,n)=>{let i=Ys(n);_l(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=J(i[0],a),s=t=>{if(Us(o,[`client_report`])){P&&R.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Hs(o,(n,r)=>{e.recordDroppedEvent(t,Ys(r))})};return n.add(()=>t({body:Gs(o)}).then(e=>e.statusCode===413?(P&&R.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(P&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&R.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=vl(r,e),e),e=>{throw s(`network_error`),P&&R.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===pl)return P&&R.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function bl(e,t,n){let r=[{type:`client_report`},{timestamp:n||oo(),discarded_events:e}];return J(t?{dsn:t}:{},[r])}function xl(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 Sl(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?.[Po],exclusive_time:o?.[Fo],measurements:e.measurements,is_segment:!0}}function Cl(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&&{[Po]:e.profile_id},...e.exclusive_time&&{[Fo]:e.exclusive_time}}}},measurements:e.measurements}}const wl=`Not capturing exception because it's already been captured.`,Tl=`Discarded session because of missing or non-string release`,El=Symbol.for(`SentryInternalError`),Dl=Symbol.for(`SentryDoNotSendEventError`);function Ol(e){return{message:e,[El]:!0}}function kl(e){return{message:e,[Dl]:!0}}function Al(e){return!!e&&typeof e==`object`&&El in e}function jl(e){return!!e&&typeof e==`object`&&Dl in e}function Ml(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=fl(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Nl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=ml(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=$o(e.dsn):P&&R.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Jc(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&&Ml(this,`afterCaptureLog`,`flushLogs`,Bl,il),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Ml(this,`afterCaptureMetric`,`flushMetrics`,zl,ll)}captureException(e,t,n){let r=V();if(ro(e))return P&&R.log(wl),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:V(),...n},a=ya(e)?e:String(e),o=ba(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=V();if(t?.originalException&&ro(t.originalException))return P&&R.log(wl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Pl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),fo(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){il(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];el(this,e,this._integrations),t||$c(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=ec(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Vs(n,qs(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=As}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){P&&R.warn(Tl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){P&&R.warn(Tl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=$s(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}`;P&&R.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 P&&R.error(`Error while sending envelope:`,e),{}}return P&&R.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Qc(this,e),$c(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)&&(fo(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),Tc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:No(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ms(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=W(),r=G()){return P&&Ll(e)&&R.log(`Captured error event \`${xl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{P&&(jl(e)?R.log(e.message):Al(e)?R.warn(e.message):R.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Rl(e),s=Ll(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:es(a);if(s&&typeof l==`number`&&B()>l)return this.recordDroppedEvent(`sample_rate`,`error`),cc(kl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Pl(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),kl("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:Fl(Il(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 kl(`${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 jl(e)||Al(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Ol(`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===pl&&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(){P&&R.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){P&&R.log(`No outcomes to send`);return}if(!this._dsn){P&&R.log(`No dsn provided, will not send outcomes`);return}P&&R.log(`Sending outcomes:`,e);let t=bl(e,this._options.tunnel&&qo(this._dsn));this.sendEnvelope(t)}};function Pl(e){return e===`replay_event`?`replay`:e||`error`}function Fl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Ta(e))return e.then(e=>{if(!xa(e)&&e!==null)throw Ol(n);return e},e=>{throw Ol(`${t} rejected with ${e}`)});if(!xa(e)&&e!==null)throw Ol(n);return e}function Il(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Ll(c)&&i)return i(c,r);if(Rl(c)){if(o||s){let t=Sl(c);if(s?.length&&Ds(t,s))return null;if(o){let e=o(t);e?c=ho(n,Cl(e)):Ss()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&Ds(e,s)){Os(n,e);continue}if(o){let n=o(e);n?t.push(n):(Ss(),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 Ll(e){return e.type===void 0}function Rl(e){return e.type===`transaction`}function zl(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Vl(e.attributes)}function Bl(e){let t=0;return e.message&&(t+=e.message.length*2),t+Vl(e.attributes)}function Vl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Hl(e[0]):ba(e)?t+=Hl(e):t+=100}),t}function Hl(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Ul(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=qo(i)),t&&(a.trace=t),J(a,[Wl(e)])}function Wl(e){return[{type:`check_in`},e]}function Gl(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 Kl(e,t){return e(t.stack||``,1)}function ql(e){return ha(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Jl(e){return ql(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Yl(e,t){let n={type:t.name||t.constructor.name,value:Jl(t)},r=Kl(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Xl(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function Zl(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=Ra(e);if(_a(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Ql(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Ql(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function $l(e,t,n,r){if(ha(n))return[n,void 0];if(t.synthetic=!0,xa(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:Ps(n,t)},a=Xl(n);if(a)return[a,i];let o=Zl(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 eu(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=$l(e,i,n,r),s={exception:{values:[Yl(t,a)]}};return o&&(s.extra=o),Qa(s,void 0,void 0),$a(s,i),{...s,event_id:r?.event_id}}function tu(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Kl(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},$a(a,{synthetic:!0}))}if(ya(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 nu=class extends Nl{constructor(e){ws(),Gl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=eu(this,this._options.stackParser,e,t);return n.level=`error`,sc(n)}eventFromMessage(e,t=`info`,n){return sc(tu(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return ru(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&ru(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:V();if(!this._isEnabled())return P&&R.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]=tl(this,n);l&&(s.contexts={trace:l});let u=Ul(s,c,this.getSdkMetadata(),o,this.getDsn());return P&&R.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){P&&R.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=ml(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 ru(e){let t=G().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const iu=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),au=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function ou(e,t){let n=String(e).toLowerCase();return iu.has(n)?!1:au.has(n)?!0:t?.strict?null:!!e}function su(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 cu(e){return e.split(/[?#]/,1)[0]}function lu(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function uu(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:Pi})),i.version=Pi)}function du(e={}){let t=e.client||K();if(!Vc()||!t)return{};let n=U(I());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||W(),i=e.span||xs(),a=i?us(i):fu(r),o=Bo(i?Ns(i):Ms(t,r));if(!ts.test(a))return R.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?ds(i):pu(r)),s}function fu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return is(t,r,n)}function pu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return as(t,r,n)}const mu=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function hu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return P&&!r&&R.log(mu,e),r;let i=Ka(e,t);return n?.set(e,i),P&&!i&&R.log(mu,e),i}function gu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function _u(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=vu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:yu(i),headers:gu(t),cookies:s,data:o}}function vu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function yu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function bu(e,t){let n=K(),r=G();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:oo(),...e},s=i?L(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let xu;const Su=new WeakMap,Cu=X((()=>({name:`FunctionToString`,setupOnce(){xu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Pa(this),n=Su.has(K())&&t!==void 0?t:this;return xu.apply(n,e)}}catch{}},setup(e){Su.set(e,!0)}}))),wu=[/^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$/],Tu=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=Eu(e,n.getOptions())},processEvent(n,r,i){return t||=Eu(e,i.getOptions()),Du(n,t)?null:n}}});function Eu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:wu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Du(e,t){if(e.type){if(e.type===`transaction`&&ku(e,t.ignoreTransactions))return P&&R.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Za(e)}`),!0}else{if(Ou(e,t.ignoreErrors))return P&&R.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Za(e)}`),!0;if(Pu(e))return P&&R.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Za(e)}`),!0;if(Au(e,t.denyUrls))return P&&R.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Za(e)}.\nUrl: ${Nu(e)}`),!0;if(!ju(e,t.allowUrls))return P&&R.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Za(e)}.\nUrl: ${Nu(e)}`),!0}return!1}function Ou(e,t){return t?.length?xl(e).some(e=>Ka(e,t)):!1}function ku(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ka(n,t):!1}function Au(e,t){if(!t?.length)return!1;let n=Nu(e);return n?Ka(n,t):!1}function ju(e,t){if(!t?.length)return!0;let n=Nu(e);return n?Ka(n,t):!0}function Mu(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 Nu(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Mu(t):null}catch{return P&&R.error(`Cannot extract url for event ${Za(e)}`),null}}function Pu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Fu(e,t,n,r,i,a){if(!i.exception?.values||!a||!z(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=Iu(e,t,r,a.originalException,n,i.exception.values,o,0))}function Iu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(z(r[i],Error)){Ru(o,s,r);let a=e(t,r[i]),l=c.length;zu(a,i,l,s),c=Iu(e,t,n,r[i],i,[a,...c],a,l)}return Lu(r)&&r.errors.forEach((a,l)=>{if(z(a,Error)){Ru(o,s,r);let u=e(t,a),d=c.length;zu(u,`errors[${l}]`,d,s),c=Iu(e,t,n,a,i,[u,...c],u,d)}}),c}function Lu(e){return Array.isArray(e.errors)}function Ru(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Lu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function zu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const Bu=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Fu(Yl,i.getOptions().stackParser,n,t,e,r)}}}));function Vu(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 Hu=[`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 Uu(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Hu.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Wu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Gu(e))||null}function Wu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Gu(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 Ku={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},qu=X(((e={})=>{let t={...Ku,...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&&Ju(e,a,{ipAddress:o},s),e}}}));function Ju(e,t,n,r){if(e.request={...e.request,...Yu(t,r)},r.ip){let r=t.headers&&Uu(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Yu(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Hu.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?Vu(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Xu(e){let t=`console`;aa(t,e),oa(t,Zu)}function Zu(){`console`in F&&Li.forEach(function(e){e in F.console&&ja(F.console,e,function(t){return Ri[e]=t,function(...t){sa(`console`,{args:t,level:e}),Ri[e]?.apply(F.console,t)}})})}function Qu(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const $u=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function ed(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=$u.exec(t);return n?n.slice(1):[]}function td(e){let t=ed(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const nd=X((e={})=>{let t=new Set(e.levels||Li);return{name:`Console`,setup(e){Xu(({args:n,level:r})=>{K()!==e||!t.has(r)||rd(r,n)})}}});function rd(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Qu(e),message:id(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${id(e)}`:`Assertion failed`,n.data.arguments=e}else return;bu(n,{input:t,level:e})}function id(e){return`util`in F&&typeof F.util.format==`function`?F.util.format(...e):Wa(e,` `)}function ad(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function od(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 sd(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=na(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?ud(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:ld(o[3]),colno:ld(o[4]),in_app:od(s||``,c)}}if(i.match(t))return{filename:i}}}function cd(e){return[90,sd(e)]}function ld(e){return parseInt(e||``,10)||void 0}function ud(e){try{return decodeURI(e)}catch{return}}var dd=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 Z=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var fd=class extends nu{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||w.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};uu(n,`node-light`,[`node-core`]),R.log(`Initializing Sentry: process: ${process.pid}, thread: ${$e?`main`:`worker-${et}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{il(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(()=>{Z&&R.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const pd=X((e={})=>({name:`ChildProcess`,setup(){tt.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&md(t.process,e)}),tt.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&hd(t.worker,e)})}}));function md(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&&bu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,bu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function hd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?bu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):Ic(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const gd=Me(at),_d=Me(st),vd=X(((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=yd(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 bd()),n.app&&(e.app=Sd()),n.device&&(e.device=Cd(n.device)),n.culture){let t=xd();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Ad()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function yd(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=w.freemem()),e}async function bd(){let e=w.platform();switch(e){case`darwin`:return Dd();case`linux`:return kd();default:return{name:wd[e]||e,version:w.release()}}}function xd(){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 Sd(){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 Cd(e){let t={},n;try{n=w.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=w.arch(),(e===!0||e.memory)&&(t.memory_size=w.totalmem(),t.free_memory=w.freemem()),e===!0||e.cpu){let e=w.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const wd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Td=[{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`]}],Ed={alpine:e=>e,arch:e=>Q(/distrib_release=(.*)/,e),centos:e=>Q(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Q(/release (..)/,e),mint:e=>Q(/distrib_release=(.*)/,e),red:e=>Q(/release ([^ ]+)/,e),suse:e=>Q(/VERSION = (.*)\n/,e),ubuntu:e=>Q(/distrib_release=(.*)/,e)};function Q(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Dd(){let e={kernel_version:w.release(),name:`Mac OS X`,version:`10.${Number(w.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Ge(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Q(/^ProductName:\s+(.*)$/m,t),e.version=Q(/^ProductVersion:\s+(.*)$/m,t),e.build=Q(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Od(e){return e.split(` `)[0].toLowerCase()}async function kd(){let e={kernel_version:w.release(),name:`Linux`};try{let t=await _d(`/etc`),n=Td.find(e=>t.includes(e.name));if(!n)return e;let r=(await gd(Ve(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Od(e))>=0)||i[0],e.version=Ed[Od(e.name)]?.(r)}catch{}return e}function Ad(){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 jd=new dd(10),Md=new dd(20);function Nd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Pd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Fd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function Id(e,t){let n=jd.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 Ld(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Gd(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=Gd(r,t)),n++}return a}function Rd(e,t,n){return new Promise((r,i)=>{let a=rt(e),o=Je({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){Md.set(e,1),Z&&R.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]=Ua(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 zd(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`||Pd(i)||Fd(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(Md.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Ld(r,t);if(a.every(t=>Id(e,t)))continue;let o=Nd(jd,e,{});i.push(Rd(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&R.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&&Bd(n.stacktrace.frames,t,jd);return e}function Bd(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;Hd(r.lineno,r,t,e)}}function Vd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Hd(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&R.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Ud(e,n);i<e;i++){let e=r[i];if(e===void 0){Vd(t),Z&&R.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){Vd(t),Z&&R.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Wd(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 Ud(e,t){return Math.max(1,e-t)}function Wd(e,t){return e+t}function Gd(e,t){return[Ud(e,t),Wd(e,t)]}const Kd=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return zd(e,t)}}})),qd=no(process.versions.node),Jd=qd.major;qd.minor;let Yd;async function Xd(){if(Yd===void 0)try{Yd=!!(await import(`node:inspector`)).url()}catch{Yd=!1}return Yd}const Zd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Qd(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 $d(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function ef(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||$d(e)&&$d(t)}function tf(...e){R.log(`[LocalVariables]`,...e)}const nf=X(((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||!ef(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&Zd in n.originalException&&Array.isArray(n.originalException[Zd])){for(let r of e.exception?.values||[])t(r,n.originalException[Zd]);n.originalException[Zd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new ct(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=>{tf(`Worker error`,e)}),t.once(`exit`,e=>{tf(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Xd()){R.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:R.isEnabled()};r().then(()=>{try{i(n)}catch(e){R.error(`Failed to start worker`,e)}},e=>{R.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function rf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function af(e,t){if(t!==void 0)return rf(e(t,1))}function of(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 sf=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}=of(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 cf=X(((e={},t)=>{let n=new dd(20),r,i=!1;function a(t){let r=rf(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||!ef(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=K()?.getOptions();if(a?.includeLocalVariables){if(Jd<18){R.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Xd()){R.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await sf.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=af(e,i.description);if(c==null){s();return}let{add:l,next:u}=of(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=Qd(e.maxExceptionsPerSecond||50,()=>{R.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{R.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){R.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]}}})),lf=(e={})=>qd.major<19?cf(e):nf(e);function uf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let df;const ff=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,pf=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,..._f()},e},getModules:_f}));function mf(){try{return Ee.cache?Object.keys(Ee.cache):[]}catch{return[]}}function hf(){return{...ff,...yf(),...uf()?gf():{}}}function gf(){let e=Ee.main?.paths||[],t=mf(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=Be(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),!it(o))return a();try{let e=JSON.parse(ot(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function _f(){return df||=hf(),df}function vf(){try{let e=Ve(process.cwd(),`package.json`);return JSON.parse(ot(e,`utf8`))}catch{return{}}}function yf(){let e=vf();return{...e.dependencies,...e.devDependencies}}function bf(e){L(()=>{console.error(e)});let t=K();if(t===void 0){Z&&R.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||Z&&R.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&R.error(e)})}const xf=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){$e&&global.process.on(`uncaughtException`,Sf(e,t))}}});function Sf(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=bf;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?(Z&&R.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),bf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,K()===e&&Ic(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const Cf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],wf=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Cf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Of(e,t))}}}));function Tf(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 Ef(e,t){let n=e.name===void 0||Ga(t.name,e.name,!0),r=e.message===void 0||Ga(t.message,e.message);return n&&r}function Df(e,t){let n=Tf(t);return e.some(e=>Ef(e,n))}function Of(e,t){return function(n,r){if(K()!==e||Df(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>rc(a,e):e=>e())(()=>{Ic(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),kf(n,t.mode)}}function kf(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`?L(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(L(()=>{console.warn(n)}),bf(e))}const Af=X(()=>({name:`ProcessSession`,setupOnce(){Hc(),process.on(`beforeExit`,()=>{G().getSession()?.status!==`ok`&&Uc()})}})),jf=`Spotlight`,Mf=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:jf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&R.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}Nf(e,t)}}}));function Nf(e,t){let n=Pf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){R.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Gs(e);ic(()=>{let e=Ye.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++,R.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Pf(e){try{return new URL(`${e}`)}catch{R.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Ff(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ae.getSystemErrorMap().has(e.errno)}const If=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Ff(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 Lf(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function Rf(e=process.argv[1]?td(process.argv[1]):process.cwd(),t=Ue===`\\`){let n=t?Lf(e):e;return e=>{if(!e)return;let r=t?Lf(e):e,{dir:i,base:a,ext:o}=He.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 zf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(F.SENTRY_RELEASE?.id)return F.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 Bf=Yi(cd(Rf())),$=Symbol(`AgentBaseInternalState`);var Vf=class extends Ye.Agent{constructor(e){super(e),this[$]={}}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(`
|
|
183
|
-
`).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 Ye.Agent)return i.addRequest(e,r);this[$].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[$].currentSocket;if(this[$].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[$].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[$]&&(this[$].defaultPort=e)}get protocol(){return this[$].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[$]&&(this[$].protocol=e)}};function
|
|
181
|
+
`,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,i=(await ar({repo:r,token:await T(),host:await E()})).find(e=>e.config.url===n);if(!i)throw new k(`Webhook not found: ${n}`);let{config:a}=i;console.info(`URL: ${a.url}`),console.info(`Name: ${a.name||`(none)`}`),console.info(`Status: ${a.active?`enabled`:`disabled`}`),console.info(`Secret: ${a.secret?`(set)`:`(none)`}`);let o=[];for(let e of rr)a[e]&&o.push(e);if(console.info(`Triggers: ${o.length>0?o.join(`, `):`(none)`}`),Object.keys(a.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(a.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),Ai=O({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:Ei,description:`List all webhooks`},create:{handler:Ci,description:`Create a new webhook`},view:{handler:ki,description:`View webhook details`},remove:{handler:Di,description:`Delete a webhook`},enable:{handler:Ti,description:`Enable a webhook`},disable:{handler:wi,description:`Disable a webhook`},"set-triggers":{handler:Oi,description:`Update webhook triggers`}}}),ji=D({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await ye({token:await T(),host:await E()});console.info(e.email)});const P=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,F=globalThis,I=`10.42.0`;function L(){return Mi(F),F}function Mi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||I,t[I]=t[I]||{}}function Ni(e,t,n=F){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[I]=r[I]||{};return i[e]||(i[e]=t())}const Pi=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Fi={};function R(e){if(!(`console`in F))return e();let t=F.console,n={},r=Object.keys(Fi);r.forEach(e=>{let r=Fi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Ii(){Ui().enabled=!0}function Li(){Ui().enabled=!1}function Ri(){return Ui().enabled}function zi(...e){Hi(`log`,...e)}function Bi(...e){Hi(`warn`,...e)}function Vi(...e){Hi(`error`,...e)}function Hi(e,...t){P&&Ri()&&R(()=>{F.console[e](`Sentry Logger [${e}]:`,...t)})}function Ui(){return P?Ni(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const z={enable:Ii,disable:Li,isEnabled:Ri,log:zi,warn:Bi,error:Vi},Wi=/\(error: (.*)\)/,Gi=/captureMessage|captureException/;function Ki(...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(`
|
|
182
|
+
`);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Wi.test(n)?n.replace(Wi,`$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 Ji(i.slice(r))}}function qi(e){return Array.isArray(e)?Ki(...e):e}function Ji(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Yi(t).function||``)&&t.pop(),t.reverse(),Gi.test(Yi(t).function||``)&&(t.pop(),Gi.test(Yi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Yi(t).filename,function:e.function||`?`}))}function Yi(e){return e[e.length-1]||{}}const Xi=`<anonymous>`;function Zi(e){try{return!e||typeof e!=`function`?Xi:e.name||Xi}catch{return Xi}}function Qi(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function $i(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const ea={},ta={};function na(e,t){ea[e]=ea[e]||[],ea[e].push(t)}function ra(e,t){if(!ta[e]){ta[e]=!0;try{t()}catch(t){P&&z.error(`Error while instrumenting ${e}`,t)}}}function ia(e,t){let n=e&&ea[e];if(n)for(let r of n)try{r(t)}catch(t){P&&z.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Zi(r)}\nError:`,t)}}let aa=null;function oa(e){let t=`error`;na(t,e),ra(t,sa)}function sa(){aa=F.onerror,F.onerror=function(e,t,n,r,i){return ia(`error`,{column:r,error:i,line:n,msg:e,url:t}),aa?aa.apply(this,arguments):!1},F.onerror.__SENTRY_INSTRUMENTED__=!0}let ca=null;function la(e){let t=`unhandledrejection`;na(t,e),ra(t,ua)}function ua(){ca=F.onunhandledrejection,F.onunhandledrejection=function(e){return ia(`unhandledrejection`,e),ca?ca.apply(this,arguments):!0},F.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const da=Object.prototype.toString;function fa(e){switch(da.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return B(e,Error)}}function pa(e,t){return da.call(e)===`[object ${t}]`}function ma(e){return pa(e,`ErrorEvent`)}function ha(e){return pa(e,`String`)}function ga(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function _a(e){return e===null||ga(e)||typeof e!=`object`&&typeof e!=`function`}function va(e){return pa(e,`Object`)}function ya(e){return typeof Event<`u`&&B(e,Event)}function ba(e){return typeof Element<`u`&&B(e,Element)}function xa(e){return pa(e,`RegExp`)}function Sa(e){return!!(e?.then&&typeof e.then==`function`)}function Ca(e){return va(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function B(e,t){try{return e instanceof t}catch{return!1}}function wa(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const Ta=F;function Ea(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=Da(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 Da(e,t){let n=e,r=[];if(!n?.tagName)return``;if(Ta.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&&ha(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 Oa(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Aa(i,r);try{e[t]=i}catch{P&&z.log(`Failed to replace method "${t}" in object`,e)}}function ka(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{P&&z.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Aa(e,t){try{e.prototype=t.prototype=t.prototype||{},ka(e,`__sentry_original__`,t)}catch{}}function ja(e){return e.__sentry_original__}function Ma(e){if(fa(e))return{message:e.message,name:e.name,stack:e.stack,...Pa(e)};if(ya(e)){let t={type:e.type,target:Na(e.target),currentTarget:Na(e.currentTarget),...Pa(e)};return typeof CustomEvent<`u`&&B(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Na(e){try{return ba(e)?Ea(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Pa(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 Fa(e){let t=Object.keys(Ma(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Ia;function La(e){if(Ia!==void 0)return Ia?Ia(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=F;return t in n&&typeof n[t]==`function`?(Ia=n[t],Ia(e)):(Ia=null,e())}function V(){return La(()=>Math.random())}function Ra(){return La(()=>Date.now())}function za(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Ba(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 Va(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{wa(r)?n.push(Qi(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Ha(e,t,n=!1){return ha(e)?xa(t)?t.test(e):ha(t)?n?e===t:e.includes(t):!1:!1}function Ua(e,t=[],n=!1){return t.some(t=>Ha(e,t,n))}function Wa(){let e=F;return e.crypto||e.msCrypto}let Ga;function Ka(){return V()*16}function H(e=Wa()){try{if(e?.randomUUID)return La(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Ga||=`10000000100040008000100000000000`,Ga.replace(/[018]/g,e=>(e^(Ka()&15)>>e/4).toString(16))}function qa(e){return e.exception?.values?.[0]}function Ja(e){let{message:t,event_id:n}=e;if(t)return t;let r=qa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Ya(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 Xa(e,t){let n=qa(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 Za=/^(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 Qa(e){return parseInt(e||``,10)}function $a(e){let t=e.match(Za)||[],n=Qa(t[1]),r=Qa(t[2]),i=Qa(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 eo(e){if(to(e))return!0;try{ka(e,`__sentry_captured__`,!0)}catch{}return!1}function to(e){try{return e.__sentry_captured__}catch{}}const no=1e3;function ro(){return Ra()/no}function io(){let{performance:e}=F;if(!e?.now||!e.timeOrigin)return ro;let t=e.timeOrigin;return()=>(t+La(()=>e.now()))/no}let ao;function oo(){return(ao??=io())()}function so(e){let t=oo(),n={sid:H(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>uo(n)};return e&&co(n,e),n}function co(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||oo(),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:H()),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 lo(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),co(e,n)}function uo(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 fo(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]=fo(r[e],t[e],n-1));return r}function po(){return H()}function mo(){return H().substring(16)}const ho=`_sentrySpan`;function go(e,t){t?ka(e,ho,t):delete e[ho]}function _o(e){return e[ho]}var U=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:po(),sampleRand:V()}}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,go(t,_o(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&&co(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():va(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,go(this,void 0),this._attachments=[],this.setPropagationContext({traceId:po(),sampleRand:V()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:ro(),...e,message:e.message?za(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:_o(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=fo(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||H();if(!this._client)return P&&z.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||H();if(!this._client)return P&&z.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||H();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(P&&z.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 vo(){return Ni(`defaultCurrentScope`,()=>new U)}function yo(){return Ni(`defaultIsolationScope`,()=>new U)}var bo=class{constructor(e,t){let n;n=e||new U;let r;r=t||new U,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 Sa(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 xo(){let e=Mi(L());return e.stack=e.stack||new bo(vo(),yo())}function So(e){return xo().withScope(e)}function Co(e,t){let n=xo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function wo(e){return xo().withScope(()=>e(xo().getIsolationScope()))}function To(){return{withIsolationScope:wo,withScope:So,withSetScope:Co,withSetIsolationScope:(e,t)=>wo(t),getCurrentScope:()=>xo().getScope(),getIsolationScope:()=>xo().getIsolationScope()}}function Eo(e){let t=Mi(L());t.acs=e}function W(e){let t=Mi(e);return t.acs?t.acs:To()}function G(){return W(L()).getCurrentScope()}function K(){return W(L()).getIsolationScope()}function Do(){return Ni(`globalScope`,()=>new U)}function Oo(...e){let t=W(L());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function ko(...e){let t=W(L());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function q(){return G().getClient()}function Ao(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||mo()};return n&&(i.parent_span_id=n),i}const jo=`sentry.profile_id`,Mo=`sentry.exclusive_time`;function No(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function Po(e){let t=e;return{scope:t._sentryScope,isolationScope:No(t._sentryIsolationScope)}}const Fo=/^sentry-/;function Io(e){let t=Ro(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Fo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Lo(e){if(e)return Bo(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Ro(e){if(!(!e||!ha(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=zo(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):zo(e)}function zo(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 Bo(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?(P&&z.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Vo=/^o(\d+)\./,Ho=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Uo(e){return e===`http`||e===`https`}function Wo(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 Go(e){let t=Ho.exec(e);if(!t){R(()=>{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 Ko({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Ko(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function qo(e){if(!P)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(z.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Uo(r)?t&&isNaN(parseInt(t,10))?(z.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(z.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(z.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Jo(e){return e.match(Vo)?.[1]}function Yo(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Jo(n)),r}function Xo(e){let t=typeof e==`string`?Go(e):Ko(e);if(!(!t||!qo(t)))return t}function Zo(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 Qo=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function $o(e){if(!e)return;let t=e.match(Qo);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 es(e,t){let n=$o(e),r=Io(t);if(!n?.traceId)return{traceId:po(),sampleRand:V()};let i=rs(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 ts(e=po(),t=mo(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function ns(e=po(),t=mo(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function rs(e,t){let n=Zo(t?.sample_rand);if(n!==void 0)return n;let r=Zo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?V()*r:r+V()*(1-r):V()}function is(e,t){let n=Yo(e);return t&&n&&t!==n?(z.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)?(z.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 as=!1;function os(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:fs(e).parent_span_id,a=Po(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||mo():t,trace_id:n}}function ss(e){let{traceId:t,spanId:n}=e.spanContext();return ts(t,n,hs(e))}function cs(e){let{traceId:t,spanId:n}=e.spanContext();return ns(t,n,hs(e))}function ls(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 us(e){return typeof e==`number`?ds(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ds(e.getTime()):oo()}function ds(e){return e>9999999999?e/1e3:e}function fs(e){if(ms(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(ps(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:us(i),timestamp:us(o)||void 0,status:gs(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:ls(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function ps(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ms(e){return typeof e.getSpanJSON==`function`}function hs(e){let{traceFlags:t}=e.spanContext();return t===1}function gs(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function _s(e){return e._sentryRootSpan||e}function vs(){let e=W(L());return e.getActiveSpan?e.getActiveSpan():_o(G())}function ys(){as||=(R(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let bs=!1;function xs(){if(bs)return;function e(){let e=vs(),t=e&&_s(e);if(t){let e=`internal_error`;P&&z.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,bs=!0,oa(e),la(e)}function Ss(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||q()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Cs(e){z.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ws(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(Es(n)){if(Ha(e.description,n))return P&&Cs(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Ha(e.description,n.name):!0,r=n.op?e.op&&Ha(e.op,n.op):!0;if(t&&r)return P&&Cs(e),!0}return!1}function Ts(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 Es(e){return typeof e==`string`||e instanceof RegExp}const Ds=`production`;function Os(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Ds,release:n.release,public_key:r,trace_id:e,org_id:Yo(t)};return t.emit(`createDsc`,i),i}function ks(e,t){let n=t.getPropagationContext();return n.dsc||Os(n.traceId,e)}function As(e){let t=q();if(!t)return{};let n=_s(e),r=fs(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&&Io(l);if(u)return s(u);let d=Os(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Ss()&&(d.sampled=String(hs(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Po(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function J(e,t=100,n=1/0){try{return Ms(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function js(e,t=3,n=100*1024){let r=J(e,t);return Is(r)>n?js(e,t-1,n):r}function Ms(e,t,n=1/0,r=1/0,i=Ls()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Ns(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 Ms(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Ma(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]=Ms(e,t,c-1,r,i),d++}return o(t),u}function Ns(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(wa(t))return Qi(t);if(Ca(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Zi(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=Ps(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function Ps(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Fs(e){return~-encodeURI(e).split(/%..|./).length}function Is(e){return Fs(JSON.stringify(e))}function Ls(){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 Rs(e,t=[]){return[e,t]}function zs(e,t){let[n,r]=e;return[n,[...r,t]]}function Bs(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 Vs(e,t){return Bs(e,(e,n)=>t.includes(n))}function Hs(e){let t=Mi(F);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Us(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Hs(r),e]:r.push(typeof e==`string`?Hs(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(J(n))}i(e)}}return typeof r==`string`?r:Ws(r)}function Ws(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 Gs(e){let t=typeof e.data==`string`?Hs(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Ks={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 qs(e){return Ks[e]}function Js(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Ys(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:Wo(r)},...i&&{trace:i}}}function Xs(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 Zs(e,t,n,r){let i=Js(n);return Rs({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Wo(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Qs(e,t,n,r){let i=Js(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Xs(e,n?.sdk);let o=Ys(e,i,r,t);return delete e.sdkProcessingMetadata,Rs(o,[[{type:a},e]])}const $s=`__SENTRY_SUPPRESS_TRACING__`,ec=(e,t)=>{let n=W(L());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=q(),o=Io(i);return a&&!is(a,o?.org_id)?rc(t):Oo(e=>{let n=es(r,i);return e.setPropagationContext(n),go(e,void 0),t()})};function tc(e,t){let n=ic();return n.withActiveSpan?n.withActiveSpan(e,t):Oo(n=>(go(n,e||void 0),t(n)))}function nc(e){let t=ic();return t.suppressTracing?t.suppressTracing(e):Oo(t=>{t.setSDKProcessingMetadata({[$s]:!0});let n=e();return t.setSDKProcessingMetadata({[$s]:void 0}),n})}function rc(e){return Oo(t=>(t.setPropagationContext({traceId:po(),sampleRand:V()}),P&&z.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),tc(null,e)))}function ic(){return W(L())}function ac(e){return new sc(t=>{t(e)})}function oc(e){return new sc((t,n)=>{n(e)})}var sc=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(Sa(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 cc(e,t,n,r=0){try{let i=lc(t,n,e,r);return Sa(i)?i:ac(i)}catch(e){return oc(e)}}function lc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return P&&a===null&&z.log(`Event processor "${i.id||`?`}" dropped event`),Sa(a)?a.then(e=>lc(e,t,n,r+1)):lc(a,t,n,r+1)}let uc,dc,fc,Y;function pc(e){let t=F._sentryDebugIds,n=F._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Y&&r.length===dc&&i.length===fc)return Y;dc=r.length,fc=i.length,Y={},uc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=uc?.[r];if(i&&Y&&t)Y[i[0]]=t,uc&&(uc[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&&Y&&uc){Y[i]=t,uc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Y}function mc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;vc(e,t),r&&xc(e,r),Sc(e,n),yc(e,i),bc(e,a)}function hc(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;gc(e,`extra`,n),gc(e,`tags`,r),gc(e,`attributes`,i),gc(e,`user`,a),gc(e,`contexts`,o),e.sdkProcessingMetadata=fo(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 gc(e,t,n){e[t]=fo(e[t],n,1)}function _c(e,t){let n=Do().getScopeData();return e&&hc(n,e.getScopeData()),t&&hc(n,t.getScopeData()),n}function vc(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 yc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function bc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function xc(e,t){e.contexts={trace:os(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:As(t),...e.sdkProcessingMetadata};let n=fs(_s(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Sc(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 Cc(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||H(),timestamp:t.timestamp||ro()},l=n.integrations||e.integrations.map(e=>e.name);wc(c,e),Dc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Tc(c,e.stackParser);let u=kc(r,n.captureContext);n.mechanism&&Xa(c,n.mechanism);let d=i?i.getEventProcessors():[],f=_c(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),mc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?ac(c):cc(m,c,n)).then(e=>(e&&Ec(e),typeof o==`number`&&o>0?Oc(e,o,s):e))}function wc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||Ds,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=za(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=za(e.value,a)})}function Tc(e,t){let n=pc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Ec(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 Dc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Oc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:J(e.data,t,n)}}))},...e.user&&{user:J(e.user,t,n)},...e.contexts&&{contexts:J(e.contexts,t,n)},...e.extra&&{extra:J(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=J(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:J(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=J(e.contexts.flags,3,n)),r}function kc(e,t){if(!t)return e;let n=e?e.clone():new U;return n.update(t),n}function Ac(e){if(e)return jc(e)||Nc(e)?{captureContext:e}:e}function jc(e){return e instanceof U||typeof e==`function`}const Mc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Nc(e){return Object.keys(e).some(e=>Mc.includes(e))}function Pc(e,t){return G().captureException(e,Ac(t))}function Fc(e,t){K().setContext(e,t)}function Ic(e,t){K().setTag(e,t)}function Lc(e){K().setUser(e)}async function Rc(e){let t=q();return t?t.flush(e):(P&&z.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function zc(){let e=q();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Bc(e){let t=K(),{user:n}=_c(t,G()),{userAgent:r}=F.navigator||{},i=so({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&co(a,{status:`exited`}),Vc(),t.setSession(i),i}function Vc(){let e=K(),t=G().getSession()||e.getSession();t&&lo(t),Hc(),e.setSession()}function Hc(){let e=K(),t=q(),n=e.getSession();n&&t&&t.captureSession(n)}function Uc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Wc(e){return`${Uc(e)}${e.projectId}/envelope/`}function Gc(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 Kc(e,t,n){return t||`${Wc(e)}?${Gc(e,n)}`}const qc=[];function Jc(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 Yc(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 Jc(r)}function Xc(e,t){let n={};return t.forEach(t=>{t&&Qc(e,t,n)}),n}function Zc(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Qc(e,t,n){if(n[t.name]){P&&z.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!qc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),qc.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)}P&&z.log(`Integration installed: ${t.name}`)}function X(e){return e}function $c(e,t){return t?Oo(t,()=>{let n=vs(),r=n?os(n):Ao(t);return[n?As(n):ks(e,t),r]}):[void 0,void 0]}function el(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function tl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Wo(r)),Rs(i,[el(e)])}function nl(e,t){let n=t??rl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=tl(n,r._metadata,r.tunnel,e.getDsn());il().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function rl(e){return il().get(e)}function il(){return Ni(`clientToLogBufferMap`,()=>new WeakMap)}function al(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function ol(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Wo(r)),Rs(i,[al(e)])}function sl(e,t){let n=t??cl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=ol(n,r._metadata,r.tunnel,e.getDsn());ll().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function cl(e){return ll().get(e)}function ll(){return Ni(`clientToMetricBufferMap`,()=>new WeakMap)}function ul(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const dl=Symbol.for(`SentryBufferFullError`);function fl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return oc(dl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return ac(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>ul(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function pl(e,t=Ra()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function ml(e,t){return e[t]||e.all||0}function hl(e,t,n=Ra()){return ml(e,t)>n}function gl(e,{statusCode:t,headers:n},r=Ra()){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+pl(o,r):t===429&&(i.all=r+60*1e3);return i}function _l(e,t,n=fl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Bs(i,(t,n)=>{let i=qs(n);hl(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Rs(i[0],a),s=t=>{if(Vs(o,[`client_report`])){P&&z.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Bs(o,(n,r)=>{e.recordDroppedEvent(t,qs(r))})};return n.add(()=>t({body:Us(o)}).then(e=>e.statusCode===413?(P&&z.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(P&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&z.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=gl(r,e),e),e=>{throw s(`network_error`),P&&z.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===dl)return P&&z.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function vl(e,t,n){let r=[{type:`client_report`},{timestamp:n||ro(),discarded_events:e}];return Rs(t?{dsn:t}:{},[r])}function yl(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 bl(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?.[jo],exclusive_time:o?.[Mo],measurements:e.measurements,is_segment:!0}}function xl(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&&{[jo]:e.profile_id},...e.exclusive_time&&{[Mo]:e.exclusive_time}}}},measurements:e.measurements}}const Sl=`Not capturing exception because it's already been captured.`,Cl=`Discarded session because of missing or non-string release`,wl=Symbol.for(`SentryInternalError`),Tl=Symbol.for(`SentryDoNotSendEventError`);function El(e){return{message:e,[wl]:!0}}function Dl(e){return{message:e,[Tl]:!0}}function Ol(e){return!!e&&typeof e==`object`&&wl in e}function kl(e){return!!e&&typeof e==`object`&&Tl in e}function Al(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=ul(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var jl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=fl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=Xo(e.dsn):P&&z.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Kc(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&&Al(this,`afterCaptureLog`,`flushLogs`,Rl,nl),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Al(this,`afterCaptureMetric`,`flushMetrics`,Ll,sl)}captureException(e,t,n){let r=H();if(eo(e))return P&&z.log(Sl),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:H(),...n},a=ga(e)?e:String(e),o=_a(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=H();if(t?.originalException&&eo(t.originalException))return P&&z.log(Sl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Ml(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),co(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){nl(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];Qc(this,e,this._integrations),t||Zc(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Qs(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=zs(n,Gs(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Ds}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){P&&z.warn(Cl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){P&&z.warn(Cl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Zs(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}`;P&&z.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 P&&z.error(`Error while sending envelope:`,e),{}}return P&&z.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Xc(this,e),Zc(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)&&(co(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),Cc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:Ao(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ks(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=G(),r=K()){return P&&Fl(e)&&z.log(`Captured error event \`${yl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{P&&(kl(e)?z.log(e.message):Ol(e)?z.warn(e.message):z.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Il(e),s=Fl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Zo(a);if(s&&typeof l==`number`&&V()>l)return this.recordDroppedEvent(`sample_rate`,`error`),oc(Dl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Ml(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Dl("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:Nl(Pl(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 Dl(`${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 kl(e)||Ol(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),El(`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===dl&&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(){P&&z.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){P&&z.log(`No outcomes to send`);return}if(!this._dsn){P&&z.log(`No dsn provided, will not send outcomes`);return}P&&z.log(`Sending outcomes:`,e);let t=vl(e,this._options.tunnel&&Wo(this._dsn));this.sendEnvelope(t)}};function Ml(e){return e===`replay_event`?`replay`:e||`error`}function Nl(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Sa(e))return e.then(e=>{if(!va(e)&&e!==null)throw El(n);return e},e=>{throw El(`${t} rejected with ${e}`)});if(!va(e)&&e!==null)throw El(n);return e}function Pl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Fl(c)&&i)return i(c,r);if(Il(c)){if(o||s){let t=bl(c);if(s?.length&&ws(t,s))return null;if(o){let e=o(t);e?c=fo(n,xl(e)):ys()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&ws(e,s)){Ts(n,e);continue}if(o){let n=o(e);n?t.push(n):(ys(),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 Fl(e){return e.type===void 0}function Il(e){return e.type===`transaction`}function Ll(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+zl(e.attributes)}function Rl(e){let t=0;return e.message&&(t+=e.message.length*2),t+zl(e.attributes)}function zl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Bl(e[0]):_a(e)?t+=Bl(e):t+=100}),t}function Bl(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Vl(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=Wo(i)),t&&(a.trace=t),Rs(a,[Hl(e)])}function Hl(e){return[{type:`check_in`},e]}function Ul(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 Wl(e,t){return e(t.stack||``,1)}function Gl(e){return fa(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Kl(e){return Gl(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function ql(e,t){let n={type:t.name||t.constructor.name,value:Kl(t)},r=Wl(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Jl(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function Yl(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=Fa(e);if(ma(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Xl(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Xl(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Zl(e,t,n,r){if(fa(n))return[n,void 0];if(t.synthetic=!0,va(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:js(n,t)},a=Jl(n);if(a)return[a,i];let o=Yl(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 Ql(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Zl(e,i,n,r),s={exception:{values:[ql(t,a)]}};return o&&(s.extra=o),Ya(s,void 0,void 0),Xa(s,i),{...s,event_id:r?.event_id}}function $l(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Wl(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Xa(a,{synthetic:!0}))}if(ga(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 eu=class extends jl{constructor(e){xs(),Ul(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Ql(this,this._options.stackParser,e,t);return n.level=`error`,ac(n)}eventFromMessage(e,t=`info`,n){return ac($l(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return tu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&tu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:H();if(!this._isEnabled())return P&&z.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]=$c(this,n);l&&(s.contexts={trace:l});let u=Vl(s,c,this.getSdkMetadata(),o,this.getDsn());return P&&z.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){P&&z.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=fl(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 tu(e){let t=K().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const nu=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),ru=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function iu(e,t){let n=String(e).toLowerCase();return nu.has(n)?!1:ru.has(n)?!0:t?.strict?null:!!e}function au(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 ou(e){return e.split(/[?#]/,1)[0]}function su(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function cu(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:I})),i.version=I)}function lu(e={}){let t=e.client||q();if(!zc()||!t)return{};let n=W(L());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||G(),i=e.span||vs(),a=i?ss(i):uu(r),o=Lo(i?As(i):ks(t,r));if(!Qo.test(a))return z.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?cs(i):du(r)),s}function uu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ts(t,r,n)}function du(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ns(t,r,n)}const fu=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function pu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return P&&!r&&z.log(fu,e),r;let i=Ua(e,t);return n?.set(e,i),P&&!i&&z.log(fu,e),i}function mu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function hu(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=gu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:_u(i),headers:mu(t),cookies:s,data:o}}function gu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function _u(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function vu(e,t){let n=q(),r=K();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:ro(),...e},s=i?R(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let yu;const bu=new WeakMap,xu=X((()=>({name:`FunctionToString`,setupOnce(){yu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=ja(this),n=bu.has(q())&&t!==void 0?t:this;return yu.apply(n,e)}}catch{}},setup(e){bu.set(e,!0)}}))),Su=[/^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$/],Cu=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=wu(e,n.getOptions())},processEvent(n,r,i){return t||=wu(e,i.getOptions()),Tu(n,t)?null:n}}});function wu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Su],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Tu(e,t){if(e.type){if(e.type===`transaction`&&Du(e,t.ignoreTransactions))return P&&z.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Ja(e)}`),!0}else{if(Eu(e,t.ignoreErrors))return P&&z.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Ja(e)}`),!0;if(Mu(e))return P&&z.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Ja(e)}`),!0;if(Ou(e,t.denyUrls))return P&&z.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Ja(e)}.\nUrl: ${ju(e)}`),!0;if(!ku(e,t.allowUrls))return P&&z.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Ja(e)}.\nUrl: ${ju(e)}`),!0}return!1}function Eu(e,t){return t?.length?yl(e).some(e=>Ua(e,t)):!1}function Du(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ua(n,t):!1}function Ou(e,t){if(!t?.length)return!1;let n=ju(e);return n?Ua(n,t):!1}function ku(e,t){if(!t?.length)return!0;let n=ju(e);return n?Ua(n,t):!0}function Au(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 ju(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Au(t):null}catch{return P&&z.error(`Cannot extract url for event ${Ja(e)}`),null}}function Mu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Nu(e,t,n,r,i,a){if(!i.exception?.values||!a||!B(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=Pu(e,t,r,a.originalException,n,i.exception.values,o,0))}function Pu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(B(r[i],Error)){Iu(o,s,r);let a=e(t,r[i]),l=c.length;Lu(a,i,l,s),c=Pu(e,t,n,r[i],i,[a,...c],a,l)}return Fu(r)&&r.errors.forEach((a,l)=>{if(B(a,Error)){Iu(o,s,r);let u=e(t,a),d=c.length;Lu(u,`errors[${l}]`,d,s),c=Pu(e,t,n,a,i,[u,...c],u,d)}}),c}function Fu(e){return Array.isArray(e.errors)}function Iu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Fu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Lu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const Ru=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Nu(ql,i.getOptions().stackParser,n,t,e,r)}}}));function zu(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 Bu=[`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 Vu(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Bu.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Hu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Uu(e))||null}function Hu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Uu(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 Wu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Gu=X(((e={})=>{let t={...Wu,...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&&Ku(e,a,{ipAddress:o},s),e}}}));function Ku(e,t,n,r){if(e.request={...e.request,...qu(t,r)},r.ip){let r=t.headers&&Vu(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function qu(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Bu.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?zu(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Ju(e){let t=`console`;na(t,e),ra(t,Yu)}function Yu(){`console`in F&&Pi.forEach(function(e){e in F.console&&Oa(F.console,e,function(t){return Fi[e]=t,function(...t){ia(`console`,{args:t,level:e}),Fi[e]?.apply(F.console,t)}})})}function Xu(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Zu=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Qu(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Zu.exec(t);return n?n.slice(1):[]}function $u(e){let t=Qu(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const ed=X((e={})=>{let t=new Set(e.levels||Pi);return{name:`Console`,setup(e){Ju(({args:n,level:r})=>{q()!==e||!t.has(r)||td(r,n)})}}});function td(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Xu(e),message:nd(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${nd(e)}`:`Assertion failed`,n.data.arguments=e}else return;vu(n,{input:t,level:e})}function nd(e){return`util`in F&&typeof F.util.format==`function`?F.util.format(...e):Va(e,` `)}function rd(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function id(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 ad(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=$i(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?cd(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:sd(o[3]),colno:sd(o[4]),in_app:id(s||``,c)}}if(i.match(t))return{filename:i}}}function od(e){return[90,ad(e)]}function sd(e){return parseInt(e||``,10)||void 0}function cd(e){try{return decodeURI(e)}catch{return}}var ld=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 Z=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var ud=class extends eu{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||w.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};cu(n,`node-light`,[`node-core`]),z.log(`Initializing Sentry: process: ${process.pid}, thread: ${$e?`main`:`worker-${et}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{nl(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(()=>{Z&&z.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const dd=X((e={})=>({name:`ChildProcess`,setup(){tt.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&fd(t.process,e)}),tt.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&pd(t.worker,e)})}}));function fd(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&&vu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,vu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function pd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?vu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):Pc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const md=Me(at),hd=Me(st),gd=X(((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=_d(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 vd()),n.app&&(e.app=bd()),n.device&&(e.device=xd(n.device)),n.culture){let t=yd();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Od()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function _d(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=w.freemem()),e}async function vd(){let e=w.platform();switch(e){case`darwin`:return Td();case`linux`:return Dd();default:return{name:Sd[e]||e,version:w.release()}}}function yd(){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 bd(){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 xd(e){let t={},n;try{n=w.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=w.arch(),(e===!0||e.memory)&&(t.memory_size=w.totalmem(),t.free_memory=w.freemem()),e===!0||e.cpu){let e=w.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const Sd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Cd=[{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`]}],wd={alpine:e=>e,arch:e=>Q(/distrib_release=(.*)/,e),centos:e=>Q(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Q(/release (..)/,e),mint:e=>Q(/distrib_release=(.*)/,e),red:e=>Q(/release ([^ ]+)/,e),suse:e=>Q(/VERSION = (.*)\n/,e),ubuntu:e=>Q(/distrib_release=(.*)/,e)};function Q(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Td(){let e={kernel_version:w.release(),name:`Mac OS X`,version:`10.${Number(w.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Ge(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Q(/^ProductName:\s+(.*)$/m,t),e.version=Q(/^ProductVersion:\s+(.*)$/m,t),e.build=Q(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Ed(e){return e.split(` `)[0].toLowerCase()}async function Dd(){let e={kernel_version:w.release(),name:`Linux`};try{let t=await hd(`/etc`),n=Cd.find(e=>t.includes(e.name));if(!n)return e;let r=(await md(Ve(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Ed(e))>=0)||i[0],e.version=wd[Ed(e.name)]?.(r)}catch{}return e}function Od(){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 kd=new ld(10),Ad=new ld(20);function jd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Md(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Nd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function Pd(e,t){let n=kd.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 Fd(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Ud(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=Ud(r,t)),n++}return a}function Id(e,t,n){return new Promise((r,i)=>{let a=rt(e),o=Je({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){Ad.set(e,1),Z&&z.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]=Ba(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 Ld(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`||Md(i)||Nd(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(Ad.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Fd(r,t);if(a.every(t=>Pd(e,t)))continue;let o=jd(kd,e,{});i.push(Id(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&z.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&&Rd(n.stacktrace.frames,t,kd);return e}function Rd(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;Bd(r.lineno,r,t,e)}}function zd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Bd(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&z.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Vd(e,n);i<e;i++){let e=r[i];if(e===void 0){zd(t),Z&&z.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){zd(t),Z&&z.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Hd(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 Vd(e,t){return Math.max(1,e-t)}function Hd(e,t){return e+t}function Ud(e,t){return[Vd(e,t),Hd(e,t)]}const Wd=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Ld(e,t)}}})),Gd=$a(process.versions.node),Kd=Gd.major;Gd.minor;let qd;async function Jd(){if(qd===void 0)try{qd=!!(await import(`node:inspector`)).url()}catch{qd=!1}return qd}const Yd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Xd(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 Zd(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Qd(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Zd(e)&&Zd(t)}function $d(...e){z.log(`[LocalVariables]`,...e)}const ef=X(((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||!Qd(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&Yd in n.originalException&&Array.isArray(n.originalException[Yd])){for(let r of e.exception?.values||[])t(r,n.originalException[Yd]);n.originalException[Yd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new ct(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=>{$d(`Worker error`,e)}),t.once(`exit`,e=>{$d(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Jd()){z.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:z.isEnabled()};r().then(()=>{try{i(n)}catch(e){z.error(`Failed to start worker`,e)}},e=>{z.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function tf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function nf(e,t){if(t!==void 0)return tf(e(t,1))}function rf(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 af=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}=rf(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 of=X(((e={},t)=>{let n=new ld(20),r,i=!1;function a(t){let r=tf(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||!Qd(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=q()?.getOptions();if(a?.includeLocalVariables){if(Kd<18){z.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Jd()){z.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await af.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=nf(e,i.description);if(c==null){s();return}let{add:l,next:u}=rf(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=Xd(e.maxExceptionsPerSecond||50,()=>{z.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{z.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){z.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]}}})),sf=(e={})=>Gd.major<19?of(e):ef(e);function cf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let lf;const uf=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,df=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...hf()},e},getModules:hf}));function ff(){try{return Ee.cache?Object.keys(Ee.cache):[]}catch{return[]}}function pf(){return{...uf,..._f(),...cf()?mf():{}}}function mf(){let e=Ee.main?.paths||[],t=ff(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=Be(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),!it(o))return a();try{let e=JSON.parse(ot(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function hf(){return lf||=pf(),lf}function gf(){try{let e=Ve(process.cwd(),`package.json`);return JSON.parse(ot(e,`utf8`))}catch{return{}}}function _f(){let e=gf();return{...e.dependencies,...e.devDependencies}}function vf(e){R(()=>{console.error(e)});let t=q();if(t===void 0){Z&&z.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||Z&&z.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&z.error(e)})}const yf=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){$e&&global.process.on(`uncaughtException`,bf(e,t))}}});function bf(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=vf;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?(Z&&z.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),vf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,q()===e&&Pc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const xf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Sf=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...xf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Ef(e,t))}}}));function Cf(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 wf(e,t){let n=e.name===void 0||Ha(t.name,e.name,!0),r=e.message===void 0||Ha(t.message,e.message);return n&&r}function Tf(e,t){let n=Cf(t);return e.some(e=>wf(e,n))}function Ef(e,t){return function(n,r){if(q()!==e||Tf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>tc(a,e):e=>e())(()=>{Pc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Df(n,t.mode)}}function Df(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`?R(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(R(()=>{console.warn(n)}),vf(e))}const Of=X(()=>({name:`ProcessSession`,setupOnce(){Bc(),process.on(`beforeExit`,()=>{K().getSession()?.status!==`ok`&&Vc()})}})),kf=`Spotlight`,Af=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:kf,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&z.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}jf(e,t)}}}));function jf(e,t){let n=Mf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){z.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Us(e);nc(()=>{let e=Ye.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++,z.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Mf(e){try{return new URL(`${e}`)}catch{z.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Nf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ae.getSystemErrorMap().has(e.errno)}const Pf=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Nf(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 Ff(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function If(e=process.argv[1]?$u(process.argv[1]):process.cwd(),t=Ue===`\\`){let n=t?Ff(e):e;return e=>{if(!e)return;let r=t?Ff(e):e,{dir:i,base:a,ext:o}=He.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 Lf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(F.SENTRY_RELEASE?.id)return F.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 Rf=Ki(od(If())),$=Symbol(`AgentBaseInternalState`);var zf=class extends Ye.Agent{constructor(e){super(e),this[$]={}}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(`
|
|
183
|
+
`).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 Ye.Agent)return i.addRequest(e,r);this[$].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[$].currentSocket;if(this[$].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[$].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[$]&&(this[$].defaultPort=e)}get protocol(){return this[$].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[$]&&(this[$].protocol=e)}};function Bf(...e){z.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Vf(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(),Bf(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Bf(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
|
|
184
184
|
\r
|
|
185
|
-
`);if(l===-1){
|
|
186
|
-
`),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}Hf(`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 Wf(...e){R.log(`[https-proxy-agent]`,...e)}var Gf=class extends Vf{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??{},Wf(`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?qf(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:`){Wf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ft.connect({...this.connectOpts,servername:e&&dt.isIP(e)?void 0:e})}else Wf("Creating `net.Socket`: %o",this.connectOpts),r=dt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=dt.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=Uf(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`,Kf),t.secureEndpoint){Wf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ft.connect({...qf(t,`host`,`path`,`port`),socket:r,servername:dt.isIP(e)?void 0:e})}return r}r.destroy();let u=new dt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Wf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Gf.__initStatic();function Kf(e){e.resume()}function qf(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Jf(e){return new qe({read(){this.push(e),this.push(null)}})}function Yf(e){let t;try{t=new URL(e.url)}catch{return L(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),yl(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Xf(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?lt:Ye,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Gf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return yl(e,Zf(e,e.httpModule??i,o))}function Xf(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Zf(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)=>{ic(()=>{let d=Jf(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(ut()));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 Qf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=ou(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 $f(){let e=new pt;function t(){return e.getStore()||{scope:xo(),isolationScope:So()}}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()))}ko({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function ep(e,t,n,r){let i=0,a=[];Z&&R.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`){Z&&R.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):Z&&R.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&R.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){Z&&R.error(r,`Error building captured request body`,e)}})}catch(e){Z&&R.error(r,`Error patching request to capture body`,e)}}function tp(e,t){if(!e)return t;let n=Vo(e),r=Vo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Uo(i)}const np=`@sentry/instrumentation-http`;function rp(e,t){let n=ap(e),r=t?.statusCode,i=ad(r);bu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function ip(e,t){let n=sp(e),{tracePropagationTargets:r,propagateTraceparent:i}=K()?.getOptions()||{},a=hu(n,r,t)?du({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),Z&&R.log(np,`Added sentry-trace header to outgoing request`)}catch(e){Z&&R.error(np,`Failed to add sentry-trace header to outgoing request:`,ha(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Z&&R.log(np,`Added traceparent header to outgoing request`)}catch(e){Z&&R.error(np,`Failed to add traceparent header to outgoing request:`,ha(e)?e.message:`Unknown error`)}if(s){let t=tp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&R.log(np,`Added baggage header to outgoing request`)}catch(e){Z&&R.error(np,`Failed to add baggage header to outgoing request:`,ha(e)?e.message:`Unknown error`)}}}function ap(e){try{let t=e.getHeader(`host`)||e.host,n=su(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:lu(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 op(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function sp(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const cp=`Http`,lp=new WeakSet,up=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new dd(100),r=new WeakMap;return{name:cp,setupOnce(){nt(`http.server.request.start`,(e=>{dp(e.server,t)})),nt(`http.client.request.created`,(e=>{fp(e.request,t,n,r)})),nt(`http.client.response.finish`,(e=>{let n=e;pp(n.request,n.response,t,r)})),nt(`http.client.request.error`,(e=>{pp(e.request,void 0,t,r)}))}}});function dp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(lp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!W().getClient())return e.apply(r,i);Z&&R.log(cp,`Handling incoming request`);let a=G().clone(),o=i[1],s=_u(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&ep(o,a,n,cp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${cu(l)}`;return a.setTransactionName(u),Mo(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return nc({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(W().getPropagationContext().propagationSpanId=_o(),e.apply(r,i)))})}});lp.add(i),e.emit=i}function fp(e,t,n,r){let i=mp(e,t);r.set(e,i),!i&&ip(e,n)}function pp(e,t,n,r){n.breadcrumbs&&((r.get(e)??mp(e,n))||rp(e,t))}function mp(e,t){if(W().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,op(e)):!1}const hp=`sentry-trace`,gp=`baggage`,_p=/baggage: (.*)\r\n/;function vp(e,t){let n=xp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=K()?.getOptions()||{},a=hu(n,r,t)?du({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(hp)&&t.push(hp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===gp);if(s&&n===-1)t.push(gp,s);else if(s){let e=t[n+1],r=tp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${hp}:`)&&(e.headers+=`${hp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(_p)?.[1];if(s&&!n)e.headers+=`${gp}: ${s}\r\n`;else if(s){let t=tp(n,s);t&&(e.headers=e.headers.replace(_p,`baggage: ${t}\r\n`))}}}function yp(e,t){let n=bp(e),r=t.statusCode,i=ad(r);bu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function bp(e){try{let t=su(xp(e.origin,e.path)),n={url:lu(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 xp(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 Sp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new dd(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){nt(`undici:request:create`,(e=>{Cp(e.request,t,n,r)})),nt(`undici:request:headers`,(e=>{let n=e;wp(n.request,n.response,t,r)}))}}});function Cp(e,t,n,r){let i=Tp(e,t);r.set(e,i),!i&&vp(e,n)}function wp(e,t,n,r){n.breadcrumbs&&(r.get(e)||yp(e,t))}function Tp(e,t){if(W().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(xp(e.origin,e.path)):!1}function Ep(){return[Tu(),Cu(),Bu(),qu(),If(),nd(),up(),Sp(),xf(),wf(),Kd(),lf(),vd(),pd(),Af(),pf()]}function Dp(e={}){return Op(e,Ep)}function Op(e={},t){let n=kp(e,t);n.debug===!0&&(Z?R.enable():L(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),$f(),W().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===jf)&&n.integrations.push(Mf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),uu(n,`node-light`,[`node-core`]);let r=new fd(n);return W().setClient(r),r.init(),R.log(`SDK initialized from ${uf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),Mp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function kp(e,t){let n=Ap(e.release),r=Qf(e.spotlight),i=jp(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??Yf,stackParser:Xi(e.stackParser||Bf),release:n,tracesSampleRate:i,spotlight:r,debug:ou(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:Zc({defaultIntegrations:s,integrations:o})}}function Ap(e){if(e!==void 0)return e;let t=zf();if(t!==void 0)return t}function jp(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 Mp(){if(ou(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=rs(e,t);W().setPropagationContext(n)}}function Np(){return x.PRISMIC_SENTRY_ENABLED??x.PROD}function Pp(){if(x.PRISMIC_SENTRY_ENVIRONMENT)return x.PRISMIC_SENTRY_ENVIRONMENT;let e=ht.match(/-(.+?)\./);return e?e[1]:`production`}function Fp(){try{if(!Np())return;Dp({dsn:x.PRISMIC_SENTRY_DSN,release:ht,environment:Pp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Lc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Ip(e){try{if(!Np())return;Ic(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Bc()}catch{}}const Lp=zc,Rp=Rc,zp=Lc,Bp=ae({latestKnownVersion:g(y()),lastUpdateCheckAt:g(h())});async function Vp(e){try{if(Hp())return;let t=await Up(e.statePath),n=ht;if(t?.latestKnownVersion&&Wp(t.latestKnownVersion,n)){let r=`Update available: ${n} → ${t.latestKnownVersion}. Run \`npx ${e.npmPackageName}@latest --version\` to update.`;process.on(`exit`,()=>{try{console.error(`\n${r}`)}catch{}})}(!t?.lastUpdateCheckAt||Date.now()-t.lastUpdateCheckAt>864e5)&&process.on(`exit`,()=>{Gp(e.npmPackageName,e.statePath)})}catch{}}function Hp(){return process.env.NO_UPDATE_NOTIFIER===`0`?!1:!!(process.env.NO_UPDATE_NOTIFIER===`1`||process.env.CI||!process.stderr.isTTY)}async function Up(e){try{let t=await Ne(e,`utf-8`);return _e(Bp,JSON.parse(t))}catch{return}}function Wp(e,t){if(e.includes(`-`)||t.includes(`-`))return!1;let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);if(n.length!==3||r.length!==3||n.some(e=>!Number.isFinite(e))||r.some(e=>!Number.isFinite(e)))return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}function Gp(e,t){try{let n=Buffer.from(JSON.stringify({npmPackageName:e,statePath:Ie(t),timeoutMs:2e3})).toString(`base64`);Ke(process.execPath,[`--input-type=module`,`-e`,Kp,n],{detached:!0,stdio:`ignore`}).unref()}catch{}}const Kp=`
|
|
185
|
+
`);if(l===-1){Bf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
|
|
186
|
+
`),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}Bf(`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 Hf(...e){z.log(`[https-proxy-agent]`,...e)}var Uf=class extends zf{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??{},Hf(`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?Gf(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:`){Hf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ft.connect({...this.connectOpts,servername:e&&dt.isIP(e)?void 0:e})}else Hf("Creating `net.Socket`: %o",this.connectOpts),r=dt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=dt.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=Vf(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`,Wf),t.secureEndpoint){Hf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ft.connect({...Gf(t,`host`,`path`,`port`),socket:r,servername:dt.isIP(e)?void 0:e})}return r}r.destroy();let u=new dt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Hf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Uf.__initStatic();function Wf(e){e.resume()}function Gf(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Kf(e){return new qe({read(){this.push(e),this.push(null)}})}function qf(e){let t;try{t=new URL(e.url)}catch{return R(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),_l(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Jf(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?lt:Ye,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Uf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return _l(e,Yf(e,e.httpModule??i,o))}function Jf(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Yf(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)=>{nc(()=>{let d=Kf(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(ut()));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 Xf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=iu(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 Zf(){let e=new pt;function t(){return e.getStore()||{scope:vo(),isolationScope:yo()}}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()))}Eo({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function Qf(e,t,n,r){let i=0,a=[];Z&&z.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`){Z&&z.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):Z&&z.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&z.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){Z&&z.error(r,`Error building captured request body`,e)}})}catch(e){Z&&z.error(r,`Error patching request to capture body`,e)}}function $f(e,t){if(!e)return t;let n=Ro(e),r=Ro(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Bo(i)}const ep=`@sentry/instrumentation-http`;function tp(e,t){let n=rp(e),r=t?.statusCode,i=rd(r);vu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function np(e,t){let n=ap(e),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=pu(n,r,t)?lu({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),Z&&z.log(ep,`Added sentry-trace header to outgoing request`)}catch(e){Z&&z.error(ep,`Failed to add sentry-trace header to outgoing request:`,fa(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Z&&z.log(ep,`Added traceparent header to outgoing request`)}catch(e){Z&&z.error(ep,`Failed to add traceparent header to outgoing request:`,fa(e)?e.message:`Unknown error`)}if(s){let t=$f(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&z.log(ep,`Added baggage header to outgoing request`)}catch(e){Z&&z.error(ep,`Failed to add baggage header to outgoing request:`,fa(e)?e.message:`Unknown error`)}}}function rp(e){try{let t=e.getHeader(`host`)||e.host,n=au(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:su(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 ip(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function ap(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const op=`Http`,sp=new WeakSet,cp=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new ld(100),r=new WeakMap;return{name:op,setupOnce(){nt(`http.server.request.start`,(e=>{lp(e.server,t)})),nt(`http.client.request.created`,(e=>{up(e.request,t,n,r)})),nt(`http.client.response.finish`,(e=>{let n=e;dp(n.request,n.response,t,r)})),nt(`http.client.request.error`,(e=>{dp(e.request,void 0,t,r)}))}}});function lp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(sp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!G().getClient())return e.apply(r,i);Z&&z.log(op,`Handling incoming request`);let a=K().clone(),o=i[1],s=hu(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&Qf(o,a,n,op),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${ou(l)}`;return a.setTransactionName(u),ko(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return ec({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(G().getPropagationContext().propagationSpanId=mo(),e.apply(r,i)))})}});sp.add(i),e.emit=i}function up(e,t,n,r){let i=fp(e,t);r.set(e,i),!i&&np(e,n)}function dp(e,t,n,r){n.breadcrumbs&&((r.get(e)??fp(e,n))||tp(e,t))}function fp(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,ip(e)):!1}const pp=`sentry-trace`,mp=`baggage`,hp=/baggage: (.*)\r\n/;function gp(e,t){let n=yp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=q()?.getOptions()||{},a=pu(n,r,t)?lu({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(pp)&&t.push(pp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===mp);if(s&&n===-1)t.push(mp,s);else if(s){let e=t[n+1],r=$f(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${pp}:`)&&(e.headers+=`${pp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(hp)?.[1];if(s&&!n)e.headers+=`${mp}: ${s}\r\n`;else if(s){let t=$f(n,s);t&&(e.headers=e.headers.replace(hp,`baggage: ${t}\r\n`))}}}function _p(e,t){let n=vp(e),r=t.statusCode,i=rd(r);vu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function vp(e){try{let t=au(yp(e.origin,e.path)),n={url:su(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 yp(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 bp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new ld(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){nt(`undici:request:create`,(e=>{xp(e.request,t,n,r)})),nt(`undici:request:headers`,(e=>{let n=e;Sp(n.request,n.response,t,r)}))}}});function xp(e,t,n,r){let i=Cp(e,t);r.set(e,i),!i&&gp(e,n)}function Sp(e,t,n,r){n.breadcrumbs&&(r.get(e)||_p(e,t))}function Cp(e,t){if(G().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(yp(e.origin,e.path)):!1}function wp(){return[Cu(),xu(),Ru(),Gu(),Pf(),ed(),cp(),bp(),yf(),Sf(),Wd(),sf(),gd(),dd(),Of(),df()]}function Tp(e={}){return Ep(e,wp)}function Ep(e={},t){let n=Dp(e,t);n.debug===!0&&(Z?z.enable():R(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Zf(),G().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===kf)&&n.integrations.push(Af({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),cu(n,`node-light`,[`node-core`]);let r=new ud(n);return G().setClient(r),r.init(),z.log(`SDK initialized from ${cf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),Ap(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Dp(e,t){let n=Op(e.release),r=Xf(e.spotlight),i=kp(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??qf,stackParser:qi(e.stackParser||Rf),release:n,tracesSampleRate:i,spotlight:r,debug:iu(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:Yc({defaultIntegrations:s,integrations:o})}}function Op(e){if(e!==void 0)return e;let t=Lf();if(t!==void 0)return t}function kp(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 Ap(){if(iu(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=es(e,t);G().setPropagationContext(n)}}function jp(){return x.PRISMIC_SENTRY_ENABLED??x.PROD}function Mp(){if(x.PRISMIC_SENTRY_ENVIRONMENT)return x.PRISMIC_SENTRY_ENVIRONMENT;let e=ht.match(/-(.+?)\./);return e?e[1]:`production`}function Np(){try{if(!jp())return;Tp({dsn:x.PRISMIC_SENTRY_DSN,release:ht,environment:Mp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Fc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Pp(e){try{if(!jp())return;Pc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Rc()}catch{}}const Fp=Lc,Ip=Ic,Lp=Fc,Rp=ae({latestKnownVersion:g(y()),lastUpdateCheckAt:g(h())});async function zp(e){try{if(Bp())return;let t=await Vp(e.statePath),n=ht;if(t?.latestKnownVersion&&Hp(t.latestKnownVersion,n)){let r=`Update available: ${n} → ${t.latestKnownVersion}. Run \`npx ${e.npmPackageName}@latest --version\` to update.`;process.on(`exit`,()=>{try{console.error(`\n${r}`)}catch{}})}(!t?.lastUpdateCheckAt||Date.now()-t.lastUpdateCheckAt>864e5)&&process.on(`exit`,()=>{Up(e.npmPackageName,e.statePath)})}catch{}}function Bp(){return process.env.NO_UPDATE_NOTIFIER===`0`?!1:!!(process.env.NO_UPDATE_NOTIFIER===`1`||process.env.CI||!process.stderr.isTTY)}async function Vp(e){try{let t=await Ne(e,`utf-8`);return _e(Rp,JSON.parse(t))}catch{return}}function Hp(e,t){if(e.includes(`-`)||t.includes(`-`))return!1;let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);if(n.length!==3||r.length!==3||n.some(e=>!Number.isFinite(e))||r.some(e=>!Number.isFinite(e)))return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}function Up(e,t){try{let n=Buffer.from(JSON.stringify({npmPackageName:e,statePath:Ie(t),timeoutMs:2e3})).toString(`base64`);Ke(process.execPath,[`--input-type=module`,`-e`,Wp,n],{detached:!0,stdio:`ignore`}).unref()}catch{}}const Wp=`
|
|
187
187
|
const {npmPackageName, statePath, timeoutMs} = JSON.parse(Buffer.from(process.argv[1], "base64").toString());
|
|
188
188
|
try {
|
|
189
189
|
const url = \`https://registry.npmjs.org/\${npmPackageName}/latest\`;
|
|
@@ -201,7 +201,7 @@ try {
|
|
|
201
201
|
existing.lastUpdateCheckAt = Date.now();
|
|
202
202
|
await fs.writeFile(statePath, JSON.stringify(existing, null, 2));
|
|
203
203
|
} catch {}
|
|
204
|
-
`,
|
|
204
|
+
`,Gp=[`login`,`logout`,`whoami`,`sync`,`docs`],Kp=[`login`,`logout`],qp=O({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:kn,description:`Initialize a Prismic project`},docs:{handler:Xt,description:`Browse Prismic documentation`},gen:{handler:Dn,description:`Generate files from local models`},sync:{handler:mi,description:`Sync types and slices from Prismic`},locale:{handler:zn,description:`Manage locales`},repo:{handler:Fr,description:`Manage repositories`},type:{handler:It,description:`Manage content types`},field:{handler:wn,description:`Manage fields`},slice:{handler:Kr,description:`Manage slices`},preview:{handler:tr,description:`Manage preview configurations`},token:{handler:Si,description:`Manage API tokens`},webhook:{handler:Ai,description:`Manage webhooks`},login:{handler:Bn,description:`Log in to Prismic`},logout:{handler:Hn,description:`Log out of Prismic`},whoami:{handler:ji,description:`Show the currently logged in user`}}});await Jp();async function Jp(){await zp({npmPackageName:mt,statePath:vt});let{positionals:[e],values:{version:t,help:n,repo:r=await pe()}}=je({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(ht);return}if(typeof r!=`string`&&(r=``),!n){Np(),await ni(),r&&(oi(r),Ip(`repository`,r),Lp(`Repository Data`,{name:r}));try{Ip(`framework`,(await _()).id)}catch{}e&&!Kp.includes(e)&&bt().then(async e=>{if(!e)return;let t=await ye({token:e,host:await E()});ai({shortId:t.shortId,intercomHash:t.intercomHash}),Fp({id:t.shortId})}).catch(()=>{}),e&&!Gp.includes(e)&&ri(e)}try{await qp(),e&&!Gp.includes(e)&&ii(e)}catch(t){if(process.exitCode=1,Gp.includes(e)||ii(e,{error:t}),t instanceof k||t instanceof xe){console.error(t.message);return}if(t instanceof ie||t instanceof o){console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof he){console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof ce){console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof le){console.error(we`
|
|
205
205
|
This command requires the Type Builder in your repository.
|
|
206
206
|
|
|
207
207
|
As of March 2026, the Type Builder is rolling out incrementally as Slice
|
|
@@ -209,4 +209,4 @@ try {
|
|
|
209
209
|
Slice Machine until your repository can upgrade.
|
|
210
210
|
|
|
211
211
|
Learn more at https://prismic.io/docs/type-builder
|
|
212
|
-
`);return}throw await
|
|
212
|
+
`);return}throw await Pp(t),t}}export{};
|