prismic 1.4.0 → 1.5.0-pr.83.2ebff06

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 CHANGED
@@ -1,71 +1,72 @@
1
1
  #!/usr/bin/env node
2
- import{B as e,D as t,E as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,P as d,Q as f,R as p,S as m,T as h,U as ee,V as te,W as g,Y as ne,_,a as re,b as ie,d as ae,f as oe,g as se,h as ce,i as le,l as ue,m as de,o as fe,p as v,q as y,r as pe,s as me,t as he,u as b,v as x,w as ge,x as _e,y as ve,z as S}from"./string-BBnEuzIe.mjs";import*as ye from"node:util";import{parseArgs as be,promisify as xe}from"node:util";import{readFile as Se,rm as Ce,writeFile as we}from"node:fs/promises";import{pathToFileURL as Te}from"node:url";import{createHash as Ee,randomUUID as De}from"node:crypto";import{dirname as Oe,join as ke,posix as Ae,sep as je}from"node:path";import{exec as Me,execFile as Ne,spawn as Pe}from"node:child_process";import{Readable as Fe}from"node:stream";import{createInterface as Ie}from"node:readline";import*as Le from"node:http";import{createServer as Re}from"node:http";import*as C from"node:os";import{homedir as ze}from"node:os";import{setTimeout as Be}from"node:timers/promises";import{isMainThread as Ve,threadId as He}from"worker_threads";import*as Ue from"node:diagnostics_channel";import{subscribe as We}from"node:diagnostics_channel";import{createReadStream as Ge,existsSync as Ke,readFile as qe,readFileSync as Je,readdir as Ye}from"node:fs";import{Worker as Xe}from"node:worker_threads";import*as Ze from"node:https";import{createGzip as Qe}from"node:zlib";import*as $e from"node:net";import*as et from"node:tls";import{AsyncLocalStorage as tt}from"node:async_hooks";var nt=`prismic`,rt=`1.4.0`;async function it(e,t){let{host:n}=t,r=at(n),i=new URL(`refreshtoken`,r);return i.searchParams.set(`token`,e),await x(i,{schema:y()})}function at(e){return new URL(`https://auth.${e}/`)}const ot=new URL(`.prismic`,a(Te(ze()))),st=te({token:r(y().check(o(1))),host:r(y().check(o(1))),base:r(y()),cookies:r(y())});async function w(){let e=await ut();if(await fe()&&e?.cookies){for(let t of e.cookies.split(`; `))if(t.startsWith(`prismic-auth=`))return t.replace(/^prismic-auth=/,``)}return e?.token}async function T(){if(v.PRISMIC_HOST)return v.PRISMIC_HOST;let e=await ut();if(await fe()&&e?.base)try{return new URL(e.base).host||oe}catch{}return e?.host||oe}async function ct(){let e=await w();if(!e)return;let t=await T(),n=await it(e,{host:t});return await dt({token:n,host:t}),n}async function lt(){if(!await d(ot))return!0;try{return await Ce(ot,{force:!0}),!0}catch{return!1}}async function ut(){try{let e=await Se(ot,`utf-8`);return ne(st,JSON.parse(e))}catch{return}}async function dt(e){let t={...await ut(),...e};await fe()&&(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 we(ot,u(t))}async function ft(e){let t=await T(),n=`https://${t}`;return new Promise((r,i)=>{let a=Re((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 dt({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 pt(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 pt(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 E(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=be({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(mt(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new O(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new O(`Missing required option: --${e}`);await t(s)}}function mt(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[he(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=he(n[e]);o.push(``),o.push(e);for(let e of t.split(`
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.83.2ebff06`;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
- `)}function D(e){let{name:t,description:n,commands:r}=e,i=t.split(` `).length;return async function(){let{positionals:[a]}=be({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 O(`Unknown command: ${a}`);console.info(ht({name:t,description:n,commands:r}))}}function ht(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
- `)}var O=class extends Error{name=`CommandError`},gt=E({name:`prismic gen setup`,description:`
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
+ `)}var k=class extends Error{name=`CommandError`},Ot=D({name:`prismic custom-type create`,description:`Create a new custom type.`,positionals:{name:{description:`Name of the custom type`,required:!0}},options:{single:{type:`boolean`,short:`s`,description:`Allow only one of this type`},id:{type:`string`,description:`Custom ID for the custom type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{single:r=!1,id:i=fe(n),repo:o=await C()}=t,c={id:i,label:n,repeatable:!r,status:!0,format:`custom`,json:{Main:{}}},l=await _(),u=await T(),d=await E();try{await s(c,{repo:o,host:d,token:u})}catch(e){throw e instanceof a?new k(`Failed to create custom type: ${await e.text()}`):e}await l.createCustomType(c),await l.generateTypes(),console.info(`Created custom type "${n}" (id: "${i}")`)}),kt=D({name:`prismic custom-type list`,description:`List all custom 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()})).filter(e=>e.format!==`page`);if(t){console.info(v(r));return}if(r.length===0){console.info(`No custom types found.`);return}for(let e of r){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id})`)}}),At=D({name:`prismic custom-type remove`,description:`Remove a custom type.`,positionals:{name:{description:`Name of the custom 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(`Custom type not found: ${n}`);if(c.format===`page`)throw new k(`"${n}" is not a custom type. Use \`prismic page-type remove\` instead.`);try{await ee(c.id,{repo:r,host:s,token:o})}catch(e){throw e instanceof a?new k(`Failed to remove custom type: ${await e.text()}`):e}try{await i.deleteCustomType(c.id)}catch{}await i.generateTypes(),console.info(`Custom type removed: "${n}" (id: ${c.id})`)}),jt=D({name:`prismic custom-type view`,description:`View details of a custom type.`,positionals:{name:{description:`Name of the custom 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(`Custom type not found: ${n}`);if(a.format===`page`)throw new k(`"${n}" is not a custom type. Use \`prismic page-type view\` instead.`);if(r){console.info(v(a));return}console.info(`ID: ${a.id}`),console.info(`Name: ${a.label||`(no name)`}`),console.info(`Repeatable: ${a.repeatable}`);let o=Object.keys(a.json).join(`, `)||`(none)`;console.info(`Tabs: ${o}`)}),Mt=O({name:`prismic custom-type`,description:`Manage custom types.`,commands:{create:{handler:Ot,description:`Create a new custom type`},remove:{handler:At,description:`Remove a custom type`},list:{handler:kt,description:`List custom types`},view:{handler:jt,description:`View a custom type`}}});const Nt=e({path:y(),title:y(),description:g(y())}),Pt=e({path:y(),title:y(),description:g(y()),anchors:S(e({slug:y(),excerpt:y()}))});async function Ft(){return await l(new URL(`api/index/`,Rt()),{schema:S(Nt)})}async function It(e){return await l(new URL(`api/index/${e}`,Rt()),{schema:Pt})}async function Lt(e){return await l(new URL(e,Rt()),{headers:{Accept:`text/markdown`},schema:y()})}function Rt(){let e=x.PRISMIC_DOCS_HOST??me;return new URL(`https://${e}/docs/`)}var zt=D({name:`prismic docs list`,description:`
6
+ List available documentation pages.
7
+
8
+ With a path argument, list the anchors within that page.
9
+ `,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await It(n)}catch(e){throw e instanceof ne?new k(`Documentation page not found: ${n}`):e instanceof a?new k(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.anchors.sort((e,t)=>e.slug.localeCompare(t.slug)),r){console.info(v(e));return}if(e.anchors.length===0){console.info(`(no anchors)`);return}for(let t of e.anchors)console.info(`${n}#${t.slug}: ${t.excerpt}`)}else{let e;try{e=await Ft()}catch(e){throw e instanceof a?new k(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.sort((e,t)=>e.path.localeCompare(t.path)),r){console.info(v(e));return}if(e.length===0){console.info(`No documentation pages found.`);return}for(let t of e){let e=t.description?` — ${t.description}`:``;console.info(`${t.path}: ${t.title}${e}`)}}});const Bt=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,Vt=Object.hasOwnProperty;var Ht=class{constructor(){this.occurrences,this.reset()}slug(e,t){let n=this,r=Ut(e,t===!0),i=r;for(;Vt.call(n.occurrences,r);)n.occurrences[i]++,r=i+`-`+n.occurrences[i];return n.occurrences[r]=0,r}reset(){this.occurrences=Object.create(null)}};function Ut(e,t){return typeof e==`string`?(t||(e=e.toLowerCase()),e.replace(Bt,``).replace(/ /g,`-`)):``}var Wt=D({name:`prismic docs view`,description:`
10
+ View a documentation page as Markdown.
11
+
12
+ Append #anchor to the path to view only the section under that heading.
13
+ `,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 Lt(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=Gt(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 Gt(e,t){let n=e.split(`
14
+ `),r=new Ht,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(`
15
+ `).trim()}var Kt=O({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:zt,description:`List available documentation pages`},view:{handler:Wt,description:`View a documentation page`}}});const A={"to-slice":{type:`string`,description:`Name of the target slice`},"to-page-type":{type:`string`,description:`Name of the target page type`},"to-custom-type":{type:`string`,description:`Name of the target custom type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Custom type tab name (default: "Main")`},repo:{type:`string`,short:`r`,description:`Repository domain`}},qt={"from-slice":{type:`string`,description:`Name of the source slice`},"from-page-type":{type:`string`,description:`Name of the source page type`},"from-custom-type":{type:`string`,description:`Name of the source custom type`},variation:A.variation,tab:A.tab,repo:A.repo};async function Jt(e,t,r){let a=await _(),{"from-slice":o,"from-page-type":s,"from-custom-type":c,variation:l=`default`}=t,u=[o,s,c].filter(Boolean).length;if(u===0)throw new k(`Specify a target with --from-slice, --from-page-type, or --from-custom-type.`);if(u>1)throw new k(`Only one of --from-slice, --from-page-type, or --from-custom-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===l);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 d=s||c,f=s?`Page type`:`Custom type`,p=(await m(r)).find(e=>e.label===d?s?e.format===`page`:e.format!==`page`:!1);if(!p)throw new k(`${f} not found: ${d}`);let h;for(let t in p.json)e in p.json[t]&&(h=p.json[t]);if(!h)throw new k(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(p.json)))||`(none)`}`);return M(h,e),[h,async()=>{await n(p,r);try{await a.updateCustomType(p)}catch{await a.createCustomType(p)}await a.generateTypes()},`customType`]}async function j(e,t){let r=await _(),o=e[`to-slice`]??e[`from-slice`],s=e[`to-page-type`]??e[`from-page-type`],c=e[`to-custom-type`]??e[`from-custom-type`],l=[o,s,c].filter(Boolean).length;if(l===0)throw new k(`Specify a target with --to-slice, --to-page-type, or --to-custom-type.`);if(l>1)throw new k(`Only one of --to-slice, --to-page-type, or --to-custom-type can be specified.`);if(o){if(`tab`in e)throw new k(`--tab is only valid for page types or custom 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`]}let u=s??c,d=s?`Page type`:`Custom type`;if(`variation`in e)throw new k(`--variation is only valid for slices.`);let f=e.tab??`Main`,p=(await m(t)).find(e=>e.label===u?s?e.format===`page`:e.format!==`page`:!1);if(!p)throw new k(`${d} not found: ${u}`);let h=structuredClone(p),ee=h.json[f];if(!ee)throw new k(`Tab "${f}" not found. Available: ${Object.keys(p.json).join(`, `)||`(none)`}`);return[ee,async()=>{try{await n(h,t)}catch(e){if(e instanceof a){let t=await e.text();throw new k(`Failed to update ${d.toLowerCase()}: ${t}`)}throw e}try{await r.updateCustomType(h)}catch{await r.createCustomType(h)}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 Yt=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}`)}),Xt=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}`)}),Zt=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}`)}),Qt=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}`)}),$t=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}`)}),en=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}`)}),tn=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}`)}),nn=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}`)}),rn=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}`)}),an=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}`)}),on=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}`)}),sn=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=cn(t.min,`min`),s=cn(t.max,`max`),c=cn(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 cn(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 ln=D({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
16
+ heading1, heading2, heading3, heading4, heading5, heading6,
17
+ paragraph, strong, em, preformatted, hyperlink, image, embed,
18
+ list-item, o-list-item, rtl
19
+ `},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}`)}),un=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}`)}),dn=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}`)}),fn=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}`)}),pn=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}`)}),mn=D({name:`prismic field add uid`,description:`Add a UID field to a custom type.`,options:{"to-page-type":{type:`string`,description:`Name of the target page type`},"to-custom-type":{type:`string`,description:`Name of the target custom type`},tab:{type:`string`,description:`Custom 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`)}),hn=O({name:`prismic field add`,description:`Add a field to a slice or custom type.`,commands:{boolean:{handler:Yt,description:`Add a boolean field`},color:{handler:Xt,description:`Add a color field`},"content-relationship":{handler:Zt,description:`Add a content relationship field`},date:{handler:Qt,description:`Add a date field`},embed:{handler:$t,description:`Add an embed field`},geopoint:{handler:en,description:`Add a geopoint field`},group:{handler:tn,description:`Add a group field`},image:{handler:nn,description:`Add an image field`},integration:{handler:rn,description:`Add an integration field`},link:{handler:an,description:`Add a link field`},"link-to-media":{handler:on,description:`Add a link to media field`},number:{handler:sn,description:`Add a number field`},"rich-text":{handler:ln,description:`Add a rich text field`},select:{handler:un,description:`Add a select field`},table:{handler:dn,description:`Add a table field`},text:{handler:fn,description:`Add a text field`},timestamp:{handler:pn,description:`Add a timestamp field`},uid:{handler:mn,description:`Add a UID field`}}});const gn={name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
20
+ Options vary by field type. Only options matching the field's
21
+ type will be applied. See \`prismic field add <type> --help\`
22
+ for type-specific option details.
23
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...qt,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/link-to-media)`},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 _n=D(gn,async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,[i,a]=await Jt(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=vn(t.min,`min`)),`max`in t&&(c.config.max=vn(t.max,`max`)),`step`in t&&(c.config.step=vn(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 gn?gn.single=t.allow:c.config.multi=t.allow);break;case`Link`:c.config.select===`document`?(`tag`in t&&(c.config.tags=t.tag),`custom-type`in t&&(c.config.customtypes=t[`custom-type`])):c.config.select===`media`?(`allow-text`in t&&(c.config.allowText=t[`allow-text`]),`variant`in t&&(c.config.variants=t.variant)):(`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));break}await a(),console.info(`Field updated: ${n}`)});function vn(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 yn=D({name:`prismic field list`,description:`List fields in a slice or custom type.`,options:{...qt,json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{repo:t=await C()}=e,[n]=await j(e,{repo:t,token:await T(),host:await E()}),r=Object.entries(n).map(([e,t])=>({id:e,type:t.type,label:t.config?.label||void 0}));if(e.json){console.info(v(r));return}if(r.length===0){console.info(`No fields found.`);return}for(let e of r){let t=e.label?` ${e.label}`:``;console.info(`${e.id} ${e.type}${t}`)}}),bn=D({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:qt},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C()}=t,[i,a]=await Jt(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}`)}),xn=O({name:`prismic field`,description:`Manage fields in slices and custom types.`,commands:{add:{handler:hn,description:`Add a field`},edit:{handler:_n,description:`Edit a field`},list:{handler:yn,description:`List fields`},remove:{handler:bn,description:`Remove a field`}}}),Sn=D({name:`prismic gen setup`,description:`
6
24
  Generate framework-specific setup files for a Prismic project.
7
25
 
8
26
  Installs dependencies, creates the Prismic client file, slice simulator
9
27
  page, preview routes, and other files required by the detected framework.
10
28
  Skips files that already exist.
11
- `,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await le()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await l()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),_t=E({name:`prismic gen types`,description:`Generate TypeScript types for slices, page types, and custom types.`},async()=>{let e=await(await le()).generateTypes(),t=c(await ue(),e);console.info(`Generated types at ${t}`)}),vt=D({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:gt,description:`Generate framework-specific Prismic setup`},types:{handler:_t,description:`Generate TypeScript types from local models`}}});function yt(e){Me(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function bt(e){let{repo:t,token:n,host:r}=e,i=St(r);return await x(new URL(`customtypes`,i),{headers:{repository:t,Authorization:`Bearer ${n}`}})}async function xt(e){let{repo:t,token:n,host:r}=e,i=St(r);return await x(new URL(`slices`,i),{headers:{repository:t,Authorization:`Bearer ${n}`}})}function St(e){return new URL(`https://customtypes.${e}/`)}const Ct=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let wt=!1,Tt=``,Et=``,Dt,Ot;const kt={app:{name:nt,version:rt}},At=[],jt=[];async function Mt(){try{if(v.TEST||(wt=await Bt(),!wt))return;Tt=De(),Et=`Basic ${btoa(Ct+`:`)}`,process.on(`exit`,Rt)}catch{wt=!1}}function Nt(e,t={}){if(!wt)return;let{repository:n=Ot,watch:r}=t,i={commandType:e,fullCommand:process.argv.join(` `)};n&&(i.repository=n),r!==void 0&&(i.watch=r),At.push({event:`Prismic CLI Start`,properties:i,context:Lt(n)})}function Pt(e,t={}){if(!wt)return;let{success:n=!process.exitCode,error:r,repository:i=Ot,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)),At.push({event:`Prismic CLI End`,properties:o,context:Lt(i)})}function Ft(e){wt&&(Dt=e.shortId,jt.push({userId:Dt,anonymousId:Tt,integrations:{Intercom:{user_hash:e.intercomHash}},context:kt,timestamp:new Date().toISOString()}))}function It(e){Ot=e}function Lt(e){let t={...kt};return e&&(t.groupId={Repository:e}),t}function Rt(){if(!(At.length===0&&jt.length===0)){try{let e=Buffer.from(JSON.stringify({trackUrl:`https://api.segment.io/v1/track`,identifyUrl:`https://api.segment.io/v1/identify`,authorization:Et,trackEvents:At.map(e=>({...Dt?{userId:Dt}:{},anonymousId:Tt,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:e.context,timestamp:new Date().toISOString()})),identifyEvents:jt})).toString(`base64`);Pe(process.execPath,[`--input-type=module`,`-e`,zt,e],{detached:!0,stdio:`ignore`}).unref()}catch{}At.length=0,jt.length=0}}const zt=`
12
- const {trackUrl, identifyUrl, authorization, trackEvents, identifyEvents} = JSON.parse(Buffer.from(process.argv[1], "base64"));
13
- const h = {"Content-Type": "application/json", Authorization: authorization};
14
- await Promise.allSettled([
15
- ...trackEvents.map(e => fetch(trackUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
16
- ...identifyEvents.map(e => fetch(identifyUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
17
- ]);
18
- `;async function Bt(){try{return!((await Vt(ke(ze(),`.prismicrc`)))?.telemetry===!1||(await Vt(ke(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function Vt(e){try{let t=await Se(e,`utf8`);return JSON.parse(t)}catch{return}}const Ht=v.TEST?500:5e3,Ut=6e4;var Wt=E({name:`prismic sync`,description:`
19
- Sync slices, page types, and custom types from Prismic to local files.
20
-
21
- Remote models are the source of truth. Local files are created, updated,
22
- or deleted to match.
23
- `,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 b(),watch:n}=e;if(!await me(t,{token:await w(),host:await T()}))throw new re;let r=await le();console.info(`Syncing from repository: ${t}`),Nt(`sync`,{watch:n}),n?await Gt(t,r):(await Kt(t,r),await qt(t,r),await r.generateTypes(),Pt(`sync`,{watch:n}),console.info(`Sync complete`))});async function Gt(e,t){let n=await w(),r=await T(),i=await xt({repo:e,token:n,host:r}),a=await bt({repo:e,token:n,host:r});await Kt(e,t),await qt(e,t),await t.generateTypes(),console.info(he`
24
- Initial sync completed!
25
-
26
- Watching for changes (polling every ${Ht/1e3}s),
27
- Press Ctrl+C to stop\n
28
- `);let o=Xt(i),s=Xt(a),c=0;for(process.on(`SIGINT`,Jt),process.on(`SIGTERM`,Jt),process.on(`SIGHUP`,Jt),process.on(`SIGQUIT`,Jt),process.platform===`win32`&&process.on(`SIGBREAK`,Jt);;){await Be(Yt(c));try{let i=Xt(await xt({repo:e,token:n,host:r})),a=i!==o,l=Xt(await bt({repo:e,token:n,host:r})),u=l!==s;if(a||u){let n=[];a&&(await Kt(e,t),o=i,n.push(`slices`)),u&&(await qt(e,t),s=l,n.push(`custom types`)),await t.generateTypes();let r=new Date().toLocaleTimeString();console.info(`[${r}] Changes detected in ${n.join(` and `)}`)}c=0}catch(e){c++;let t=e instanceof Error?e.message:`Unknown error`,n=Math.min(Ht*2**(c-1),Ut);if(console.error(`Error checking for changes: ${t}. Retrying in ${n/1e3}s...`),c>=10)throw Error(`Too many consecutive errors (10), stopping watch.`)}}}async function Kt(e,t){let n=await xt({repo:e,token:await w(),host:await T()}),r=await t.getSlices();for(let e of n)r.find(t=>t.model.id===e.id)&&await t.updateSlice(e);for(let e of r)n.some(t=>t.id===e.model.id)||await t.deleteSlice(e.model.id);let i=await t.getDefaultSliceLibrary();for(let e of n)r.some(t=>t.model.id===e.id)||await t.createSlice(e,i)}async function qt(e,t){let n=await bt({repo:e,token:await w(),host:await T()}),r=await t.getCustomTypes();for(let e of n)r.find(t=>t.model.id===e.id)&&await t.updateCustomType(e);for(let e of r)n.some(t=>t.id===e.model.id)||await t.deleteCustomType(e.model.id);for(let e of n)r.some(t=>t.model.id===e.id)||await t.createCustomType(e)}function Jt(){console.info(`Watch stopped. Goodbye!`),Pt(`sync`,{watch:!0}),process.exit(0)}function Yt(e){return e===0?Ht:Math.min(Ht*2**(e-1),Ut)}function Xt(e){return Ee(`sha256`).update(JSON.stringify(e)).digest(`hex`)}var Zt=E({name:`prismic init`,description:`
29
+ `,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.`)}),Cn=D({name:`prismic gen types`,description:`Generate TypeScript types for slices, page types, and custom types.`},async()=>{let e=await(await _()).generateTypes(),t=f(await ve(),e);console.info(`Generated types at ${t}`)}),wn=O({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:Sn,description:`Generate framework-specific Prismic setup`},types:{handler:Cn,description:`Generate TypeScript types from local models`}}});function Tn(e){We(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var En=D({name:`prismic init`,description:`
29
30
  Initialize a Prismic project by creating a prismic.config.json file.
30
31
 
31
32
  Detects the project framework, installs dependencies, and syncs models
32
33
  from Prismic. If a slicemachine.config.json exists, it will be migrated.
33
- `,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:r,"no-browser":i}=e;try{throw await n(),new O(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof _e))throw e}let a;try{a=await t()}catch(e){e instanceof ve&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let o=r??a?.repositoryName;if(!o)throw new O(`Missing required flag: --repo`);let s=await w(),c=await T(),u;try{u=await de({token:s,host:c})}catch(e){if(e instanceof se||e instanceof ce){console.info(`Not logged in. Starting login...`);let{email:e}=await ft({onReady:e=>{i?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}`),yt(e))}});console.info(`Logged in as ${e}`),s=await w(),u=await de({token:s,host:c})}else throw e}if(!u.repositories.find(e=>e.domain===o))throw new O(`Repository "${o}" not found in your account. Check the name or request access to the repository.`);if(!await me(o,{token:s,host:c}))throw new re;let d=await le();try{await ge({repositoryName:o,documentAPIEndpoint:c===oe?void 0:`https://${o}.cdn.${c}/api/v2/`,libraries:a?.libraries,routes:[]})}catch(e){throw e instanceof m?new O(`Could not find a package.json file. Run this command from a project directory.`):new O(`Failed to create prismic.config.json.`)}if(a){try{await h()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await d.initProject();try{console.info(`Installing dependencies...`),await l()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}await Kt(o,d),await qt(o,d),await d.generateTypes(),console.info(`\nInitialized Prismic for repository "${o}".`)});const Qt=g({id:y(),label:y(),customName:i(y()),isMaster:S()});async function $t(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,nn(r));return i.searchParams.set(`repository`,t),(await x(i,{headers:{Authorization:`Bearer ${n}`},schema:g({results:p(Qt)})})).results}async function en(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,nn(i));return a.searchParams.set(`repository`,n),await x(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:Qt})}async function tn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,nn(i));a.searchParams.set(`repository`,n),await x(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function nn(e){return new URL(`https://api.internal.${e}/locale/`)}var rn=E({name:`prismic locale add`,description:`
34
+ `,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}`),Tn(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 Dn=e({id:y(),label:y(),customName:se(y()),isMaster:c()});async function On(t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,jn(i));return a.searchParams.set(`repository`,n),(await l(a,{headers:{Authorization:`Bearer ${r}`},schema:e({results:S(Dn)})})).results}async function kn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,jn(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:Dn})}async function An(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,jn(i));a.searchParams.set(`repository`,n),await l(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function jn(e){return new URL(`https://api.internal.${e}/locale/`)}var Mn=D({name:`prismic locale add`,description:`
34
35
  Add a locale to a Prismic repository.
35
36
 
36
37
  By default, this command reads the repository from prismic.config.json at the
37
38
  project root.
38
- `,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 b(),master:i=!1,name:a}=t,o=await w(),s=await T();try{await en({id:n,isMaster:i,customName:a},{repo:r,token:o,host:s})}catch(e){throw e instanceof _?new O(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),an=E({name:`prismic locale list`,description:`
39
+ `,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 kn({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}`)}),Nn=D({name:`prismic locale list`,description:`
39
40
  List all locales in a Prismic repository.
40
41
 
41
42
  By default, this command reads the repository from prismic.config.json at the
42
43
  project root.
43
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await b(),json:n}=e,r=await $t({repo:t,token:await w(),host:await T()});if(n){console.info(u(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}`)}}),on=E({name:`prismic locale remove`,description:`
44
+ `,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 On({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}`)}}),Pn=D({name:`prismic locale remove`,description:`
44
45
  Remove a locale from a Prismic repository.
45
46
 
46
47
  By default, this command reads the repository from prismic.config.json at the
47
48
  project root.
48
- `,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 b()}=t,i=await w(),a=await T();try{await tn(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),sn=E({name:`prismic locale set-master`,description:`
49
+ `,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 An(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}`)}),Fn=D({name:`prismic locale set-master`,description:`
49
50
  Set the master locale for a Prismic repository.
50
51
 
51
52
  By default, this command reads the repository from prismic.config.json at the
52
53
  project root.
53
- `,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 b()}=t,i=await w(),a=await T(),o=await $t({repo:r,token:i,host:a}),s=o.find(e=>e.id===n);if(!s)throw new O(`Locale "${n}" not found. Available locales: ${o.map(e=>e.id).join(`, `)}`);if(s.isMaster)throw new O(`Locale "${n}" is already the master.`);try{await en({id:s.id,isMaster:!0,customName:s.customName??void 0},{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),cn=D({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:rn,description:`Add a locale`},list:{handler:an,description:`List locales`},remove:{handler:on,description:`Remove a locale`},"set-master":{handler:sn,description:`Set the master locale`}}}),ln=E({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 ft({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}`),un(e))}});console.info(`Logged in to Prismic as ${n}`)});function un(e){Me(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var dn=E({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await lt())console.info(`Logged out of Prismic`);else throw new O(`Logout failed. You can log out manually by deleting the file.`)});const fn=g({results:p(g({id:y(),label:y(),url:y()}))});async function pn(e){let{repo:t,token:n,host:r}=e;return(await x(new URL(`core/repository/preview_configs`,yn(t,r)),{credentials:{"prismic-auth":n},schema:fn})).results}async function mn(e,t){let{repo:n,token:r,host:i}=t;await x(new URL(`previews/new`,yn(n,i)),{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}async function hn(e,t){let{repo:n,token:r,host:i}=t;await x(new URL(`previews/delete/${e}`,yn(n,i)),{method:`POST`,body:{},credentials:{"prismic-auth":r}})}const gn=g({simulator_url:r(y())});async function _n(e){let{repo:t,token:n,host:r}=e;return(await x(new URL(`core/repository`,yn(t,r)),{credentials:{"prismic-auth":n},schema:gn})).simulator_url}async function vn(e,t){let{repo:n,token:r,host:i}=t;await x(new URL(`core/repository`,yn(n,i)),{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}function yn(e,t){return new URL(`https://${e}.${t}/`)}var bn=E({name:`prismic preview add`,description:`
54
+ `,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 On({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 kn({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}`)}),In=O({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:Mn,description:`Add a locale`},list:{handler:Nn,description:`List locales`},remove:{handler:Pn,description:`Remove a locale`},"set-master":{handler:Fn,description:`Set the master locale`}}}),Ln=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}`),Rn(e))}});console.info(`Logged in to Prismic as ${n}`)});function Rn(e){We(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}var zn=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.`)}),Bn=D({name:`prismic page-type create`,description:`Create a new page type.`,positionals:{name:{description:`Name of the page type`,required:!0}},options:{single:{type:`boolean`,short:`s`,description:`Allow only page one of this type`},id:{type:`string`,description:`Custom ID for the page type`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{single:r=!1,id:i=fe(n),repo:o=await C()}=t,c={id:i,label:n,repeatable:!r,status:!0,format:`page`,json:{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:[]}}}}},l=await _(),u=await T(),d=await E();try{await s(c,{repo:o,host:d,token:u})}catch(e){throw e instanceof a?new k(`Failed to create page type: ${await e.text()}`):e}await l.createCustomType(c),await l.generateTypes(),console.info(`Created page type "${n}" (id: "${i}")`)}),Vn=D({name:`prismic page-type list`,description:`List all page 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()})).filter(e=>e.format===`page`);if(t){console.info(v(r));return}if(r.length===0){console.info(`No page types found.`);return}for(let e of r){let t=e.label||`(no name)`;console.info(`${t} (id: ${e.id})`)}}),Hn=D({name:`prismic page-type remove`,description:`Remove a page type.`,positionals:{name:{description:`Name of the page 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(`Page type not found: ${n}`);if(c.format!==`page`)throw new k(`"${n}" is not a page type. Use \`prismic custom-type remove\` instead.`);try{await ee(c.id,{repo:r,host:s,token:o})}catch(e){throw e instanceof a?new k(`Failed to create page type: ${await e.text()}`):e}try{await i.deleteCustomType(c.id)}catch{}await i.generateTypes(),console.info(`Page type removed: "${n}" (id: ${c.id})`)}),Un=D({name:`prismic page-type view`,description:`View details of a page type.`,positionals:{name:{description:`Name of the page 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(`Page type not found: ${n}`);if(a.format!==`page`)throw new k(`"${n}" is not a page type. Use \`prismic custom-type view\` instead.`);if(r){console.info(v(a));return}console.info(`ID: ${a.id}`),console.info(`Name: ${a.label||`(no name)`}`),console.info(`Repeatable: ${a.repeatable}`);let o=Object.keys(a.json).join(`, `)||`(none)`;console.info(`Tabs: ${o}`)}),Wn=O({name:`prismic page-type`,description:`Manage page types.`,commands:{create:{handler:Bn,description:`Create a new page type`},remove:{handler:Hn,description:`Remove a page type`},list:{handler:Vn,description:`List page types`},view:{handler:Un,description:`View a page type`}}});const Gn=e({results:S(e({id:y(),label:y(),url:y()}))});async function Kn(e){let{repo:t,token:n,host:r}=e;return(await l(new URL(`core/repository/preview_configs`,Qn(t,r)),{credentials:{"prismic-auth":n},schema:Gn})).results}async function qn(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`previews/new`,Qn(n,i)),{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}async function Jn(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`previews/delete/${e}`,Qn(n,i)),{method:`POST`,body:{},credentials:{"prismic-auth":r}})}const Yn=e({simulator_url:g(y())});async function Xn(e){let{repo:t,token:n,host:r}=e;return(await l(new URL(`core/repository`,Qn(t,r)),{credentials:{"prismic-auth":n},schema:Yn})).simulator_url}async function Zn(e,t){let{repo:n,token:r,host:i}=t;await l(new URL(`core/repository`,Qn(n,i)),{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}function Qn(e,t){return new URL(`https://${e}.${t}/`)}var $n=D({name:`prismic preview add`,description:`
54
55
  Add a preview configuration to a Prismic repository.
55
56
 
56
57
  By default, this command reads the repository from prismic.config.json at the
57
58
  project root.
58
- `,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 b(),name:i}=t,a;try{a=new URL(n)}catch{throw new O(`Invalid URL: ${n}`)}let o=i||a.hostname,s=`${a.protocol}//${a.host}`,c=a.pathname===`/`?void 0:a.pathname,l=await w(),u=await T();try{await mn({name:o,websiteURL:s,resolverPath:c},{repo:r,token:l,host:u})}catch(e){throw e instanceof _?new O(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`)}),xn=E({name:`prismic preview list`,description:`
59
+ `,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 qn({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}`)}),er=D({name:`prismic preview list`,description:`
59
60
  List all preview configurations in a Prismic repository.
60
61
 
61
62
  By default, this command reads the repository from prismic.config.json at the
62
63
  project root.
63
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await b(),json:n}=e,r=await w(),i=await T(),[a,o]=await Promise.all([pn({repo:t,token:r,host:i}),_n({repo:t,token:r,host:i})]);if(n){console.info(u({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}`)}),Sn=E({name:`prismic preview remove`,description:`
64
+ `,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([Kn({repo:t,token:r,host:i}),Xn({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}`)}),tr=D({name:`prismic preview remove`,description:`
64
65
  Remove a preview configuration from a Prismic repository.
65
66
 
66
67
  By default, this command reads the repository from prismic.config.json at the
67
68
  project root.
68
- `,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 b()}=t,i=await w(),a=await T(),o=(await pn({repo:r,token:i,host:a})).find(e=>e.url===n);if(!o)throw new O(`Preview not found: ${n}`);try{await hn(o.id,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),Cn=E({name:`prismic preview set-simulator`,description:`
69
+ `,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 Kn({repo:r,token:i,host:o})).find(e=>e.url===n);if(!s)throw new k(`Preview not found: ${n}`);try{await Jn(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}`)}),nr=D({name:`prismic preview set-simulator`,description:`
69
70
  Set the slice simulator URL for a Prismic repository.
70
71
 
71
72
  If the URL pathname does not end with /slice-simulator, it is appended
@@ -73,37 +74,54 @@ await Promise.allSettled([
73
74
 
74
75
  By default, this command reads the repository from prismic.config.json at the
75
76
  project root.
76
- `,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 b()}=t,i;try{i=new URL(n)}catch{throw new O(`Invalid URL: ${n}`)}i.pathname.endsWith(`/slice-simulator`)||(i.pathname=i.pathname.replace(/\/+$/,``)+`/slice-simulator`);let a=i.toString(),o=await w(),s=await T();try{await vn(a,{repo:r,token:o,host:s})}catch(e){throw e instanceof _?new O(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${a}`)}),wn=D({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:bn,description:`Add a preview configuration`},list:{handler:xn,description:`List preview configurations`},remove:{handler:Sn,description:`Remove a preview configuration`},"set-simulator":{handler:Cn,description:`Set the slice simulator URL`}}});const Tn=g({documentsPublished:S(),documentsUnpublished:S(),releasesCreated:S(),releasesUpdated:S(),tagsCreated:S(),tagsDeleted:S()}),En=Object.keys(Tn.shape),Dn=g({config:e(Tn,{_id:y(),url:y(),active:S(),name:i(y()),secret:i(y()),headers:s(y(),y())})});async function On(e){let{repo:t,token:n,host:r}=e,i=k(t,r);return await x(new URL(`app/settings/webhooks`,i),{credentials:{"prismic-auth":n},schema:p(Dn)})}async function kn(e,t){let{repo:n,token:r,host:i}=t,a=k(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 x(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}async function An(e,t,n){let{repo:r,token:i,host:a}=n,o=k(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 x(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}async function jn(e,t){let{repo:n,token:r,host:i}=t,a=k(n,i);await x(new URL(`app/settings/webhooks/${e}/delete`,a),{method:`POST`,credentials:{"prismic-auth":r}})}const Mn=g({id:y(),scope:y(),token:y(),created_at:g({$date:ee()})}),Nn=g({id:y(),name:y(),wroom_auths:p(Mn)}),Pn=g({app_name:y(),token:y(),timestamp:ee()}),Fn=g({max_tokens:ee(),tokens:p(Pn)});async function In(e){return await x(new URL(`settings/security/contentapi`,k(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:p(Nn)})}async function Ln(e,t){return await x(new URL(`settings/security/oauthapp`,k(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Nn})}async function Rn(e,t,n){return await x(new URL(`settings/security/authorizations`,k(n.repo,n.host)),{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Mn})}async function zn(e,t){await x(new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,k(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function Bn(e){return await x(new URL(`settings/security/customtypesapi`,k(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:Fn})}async function Vn(e,t){return await x(new URL(`settings/security/token`,k(t.repo,t.host)),{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Pn})}async function Hn(e,t){await x(new URL(`settings/security/token/${encodeURIComponent(e)}`,k(t.repo,t.host)),{method:`DELETE`,credentials:{"prismic-auth":t.token}})}async function Un(e){let{domain:t,token:n,host:r}=e;return await x(new URL(`app/dashboard/repositories/${t}/exists`,Xn(r)),{credentials:{"prismic-auth":n},schema:S()})}async function Wn(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await x(new URL(`app/dashboard/repositories`,Xn(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Gn=g({repository:g({api_access:y()})});async function Kn(e){let{repo:t,token:n,host:r}=e;return(await x(new URL(`syncState`,k(t,r)),{credentials:{"prismic-auth":n},schema:Gn})).repository.api_access}async function qn(e,t){let{repo:n,token:r,host:i}=t;await x(new URL(`settings/security/apiaccess`,k(n,i)),{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}const Jn=g({repository:g({name:y()})});async function Yn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,k(n,i)),o=new FormData;return o.set(`displayname`,e),(await x(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:Jn})).repository.name}function Xn(e){return new URL(`https://${e}/`)}function k(e,t){return new URL(`https://${e}.${t}/`)}var Zn=E({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 w(),r=await T(),i=await Qn({token:n,host:r});if(!i)throw new O(`Failed to create a repository. Please try again.`);let a=(await le().catch(()=>void 0))?.id??`other`;try{await Wn({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof _?new O(`Failed to create repository: ${await e.text()}`):e}console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Qn(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 Un({domain:e,token:t,host:n})){r=e;break}}return r}var $n=E({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 w(),r=await T(),i;try{i=await de({token:n,host:r})}catch(e){throw e instanceof _?new O(`Failed to list repositories: ${await e.text()}`):e}let a=i.repositories;if(t){console.info(u(a.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(a.length===0){console.info(`No repositories found.`);return}for(let e of a){let t=e.name||`(no name)`,n=e.role?` ${e.role}`:``;console.info(`${e.domain} ${t}${n}`)}});const er=[`private`,`public`,`open`];var tr=E({name:`prismic repo set-api-access`,description:`
77
+ `,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 Zn(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}`)}),rr=O({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:$n,description:`Add a preview configuration`},list:{handler:er,description:`List preview configurations`},remove:{handler:tr,description:`Remove a preview configuration`},"set-simulator":{handler:nr,description:`Set the slice simulator URL`}}});const ir=e({documentsPublished:c(),documentsUnpublished:c(),releasesCreated:c(),releasesUpdated:c(),tagsCreated:c(),tagsDeleted:c()}),ar=Object.keys(ir.shape),or=e({config:oe(ir,{_id:y(),url:y(),active:c(),name:se(y()),secret:se(y()),headers:Te(y(),y())})});async function sr(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(or)})}async function cr(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 lr(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 ur(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 dr=e({id:y(),scope:y(),token:y(),created_at:e({$date:h()})}),fr=e({id:y(),name:y(),wroom_auths:S(dr)}),pr=e({app_name:y(),token:y(),timestamp:h()}),mr=e({max_tokens:h(),tokens:S(pr)});async function hr(e){return await l(new URL(`settings/security/contentapi`,N(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:S(fr)})}async function gr(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:fr})}async function _r(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:dr})}async function vr(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 yr(e){return await l(new URL(`settings/security/customtypesapi`,N(e.repo,e.host)),{credentials:{"prismic-auth":e.token},schema:mr})}async function br(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:pr})}async function xr(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 Sr(e){let{domain:t,token:n,host:r}=e;return await l(new URL(`app/dashboard/repositories/${t}/exists`,kr(r)),{credentials:{"prismic-auth":n},schema:c()})}async function Cr(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await l(new URL(`app/dashboard/repositories`,kr(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const wr=e({repository:e({api_access:y()})});async function Tr(e){let{repo:t,token:n,host:r}=e;return(await l(new URL(`syncState`,N(t,r)),{credentials:{"prismic-auth":n},schema:wr})).repository.api_access}async function Er(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 Dr=e({repository:e({name:y()})});async function Or(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:Dr})).repository.name}function kr(e){return new URL(`https://${e}/`)}function N(e,t){return new URL(`https://${e}.${t}/`)}var Ar=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 jr({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 Cr({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 jr(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 Sr({domain:e,token:t,host:n})){r=e;break}}return r}var Mr=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 Nr=[`private`,`public`,`open`];var Pr=D({name:`prismic repo set-api-access`,description:`
77
78
  Set the Content API access level of a Prismic repository.
78
79
 
79
80
  By default, this command reads the repository from prismic.config.json at the
80
81
  project root.
81
- `,positionals:{level:{description:`Access level (${er.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await b()}=t;if(!er.includes(n))throw new O(`Invalid access level: ${n}. Must be one of: ${er.join(`, `)}`);let i=await w(),a=await T();try{await qn(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),nr=E({name:`prismic repo set-name`,description:`
82
+ `,positionals:{level:{description:`Access level (${Nr.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(!Nr.includes(n))throw new k(`Invalid access level: ${n}. Must be one of: ${Nr.join(`, `)}`);let i=await T(),o=await E();try{await Er(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}`)}),Fr=D({name:`prismic repo set-name`,description:`
82
83
  Set the display name of a Prismic repository.
83
84
 
84
85
  By default, this command reads the repository from prismic.config.json at the
85
86
  project root.
86
- `,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 b()}=t,i=await w(),a=await T(),o;try{o=await Yn(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),rr=E({name:`prismic repo view`,description:`
87
+ `,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 Or(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}`)}),Ir=D({name:`prismic repo view`,description:`
87
88
  View details of a Prismic repository.
88
89
 
89
90
  By default, this command reads the repository from prismic.config.json at the
90
91
  project root.
91
- `,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 b(),web:n,json:r}=e,i=await w(),a=await T(),o=`https://${t}.${a}/`;if(n){yt(new URL(o)),console.info(`Opening ${o}`);return}let s,c;try{[s,c]=await Promise.all([de({token:i,host:a}),Kn({repo:t,token:i,host:a})])}catch(e){throw e instanceof _?new O(`Failed to fetch repository details: ${await e.text()}`):e}let l=s.repositories.find(e=>e.domain===t);if(!l)throw new O(`Repository not found: ${t}`);if(r){console.info(u({domain:l.domain,name:l.name??null,url:o,apiAccess:c}));return}let d=l.name||`(no name)`;console.info(`Name: ${d}`),console.info(`URL: ${o}`),console.info(`Content API: ${c}`)}),ir=D({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Zn,description:`Create a new repository`},list:{handler:$n,description:`List repositories`},view:{handler:rr,description:`View repository details`},"set-name":{handler:nr,description:`Set repository display name`},"set-api-access":{handler:tr,description:`Set Content API access level`}}});const ar=`Prismic CLI`;var or=E({name:`prismic token create`,description:`
92
+ `,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){Tn(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 page type or custom 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 page type or custom 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 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}`);let s=o.variations?.map(e=>e.id).join(`, `)||`(none)`;console.info(`Variations: ${s}`)}),Kr=O({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Br,description:`Create a new slice`},remove:{handler:Ur,description:`Remove a slice`},list:{handler:Hr,description:`List slices`},view:{handler:Gr,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`},"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=`
93
+ const {trackUrl, identifyUrl, authorization, trackEvents, identifyEvents} = JSON.parse(Buffer.from(process.argv[1], "base64"));
94
+ const h = {"Content-Type": "application/json", Authorization: authorization};
95
+ await Promise.allSettled([
96
+ ...trackEvents.map(e => fetch(trackUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
97
+ ...identifyEvents.map(e => fetch(identifyUrl, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})),
98
+ ]);
99
+ `;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:`
100
+ Sync slices, page types, and custom types from Prismic to local files.
101
+
102
+ Remote models are the source of truth. Local files are created, updated,
103
+ or deleted to match.
104
+ `,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`
105
+ Initial sync completed!
106
+
107
+ Watching for changes (polling every ${fi/1e3}s),
108
+ Press Ctrl+C to stop\n
109
+ `);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:`
92
110
  Create a new API token for a Prismic repository.
93
111
 
94
112
  By default, this command reads the repository from prismic.config.json at the
95
113
  project root.
96
- `,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 b(),write:n,"allow-releases":r}=e;if(n&&r)throw new O(`--allow-releases is only valid for access tokens (not with --write)`);let i=await w(),a=await T();if(n){let e=await Vn(ar,{repo:t,token:i,host:a});console.info(`Token created: ${e.token}`)}else{let e=r?`master+releases`:`master`,n=(await In({repo:t,token:i,host:a})).find(e=>e.name===ar);n||=await Ln(ar,{repo:t,token:i,host:a});let o=await Rn(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}),sr=E({name:`prismic token delete`,description:`
114
+ `,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 br(yi,{repo:t,token:i,host:a});console.info(`Token created: ${e.token}`)}else{let e=r?`master+releases`:`master`,n=(await hr({repo:t,token:i,host:a})).find(e=>e.name===yi);n||=await gr(yi,{repo:t,token:i,host:a});let o=await _r(n.id,e,{repo:t,token:i,host:a});console.info(`Token created: ${o.token}`)}}),xi=D({name:`prismic token delete`,description:`
97
115
  Delete a token from a Prismic repository.
98
116
 
99
117
  By default, this command reads the repository from prismic.config.json at the
100
118
  project root.
101
- `,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 b()}=t,i=await w(),a=await T(),[o,s]=await Promise.all([In({repo:r,token:i,host:a}),Bn({repo:r,token:i,host:a})]),c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){await zn(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 Hn(l.token,{repo:r,token:i,host:a}),console.info(`Token deleted`);return}throw new O(`Token not found: ${n}`)}),cr=D({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:E({name:`prismic token list`,description:`
119
+ `,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([hr({repo:r,token:i,host:a}),yr({repo:r,token:i,host:a})]),c=o.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(c){await vr(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 xr(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:`
102
120
  List all API tokens for a Prismic repository.
103
121
 
104
122
  By default, this command reads the repository from prismic.config.json at the
105
123
  project root.
106
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await b(),json:n}=e,r=await w(),i=await T(),[a,o]=await Promise.all([In({repo:t,token:r,host:i}),Bn({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(u({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:or,description:`Create a new token`},delete:{handler:sr,description:`Delete a token`}}}),lr=E({name:`prismic webhook create`,description:`
124
+ `,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([hr({repo:t,token:r,host:i}),yr({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:`
107
125
  Create a new webhook in a Prismic repository.
108
126
 
109
127
  By default, this command reads the repository from prismic.config.json at the
@@ -117,27 +135,27 @@ await Promise.allSettled([
117
135
  tagsDeleted When a tag is deleted
118
136
 
119
137
  If no triggers specified, all are enabled.
120
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await b(),name:i,secret:a,trigger:o=[]}=t;for(let e of o)if(!En.includes(e))throw new O(`Invalid trigger: ${e}\nValid triggers: ${En.join(`, `)}`);let s=await w(),c=await T(),l=!(o.length>0);try{await kn({url:n,name:i??null,secret:a??null,documentsPublished:o.includes(`documentsPublished`)||l,documentsUnpublished:o.includes(`documentsUnpublished`)||l,releasesCreated:o.includes(`releasesCreated`)||l,releasesUpdated:o.includes(`releasesUpdated`)||l,tagsCreated:o.includes(`tagsCreated`)||l,tagsDeleted:o.includes(`tagsDeleted`)||l},{repo:r,token:s,host:c})}catch(e){throw e instanceof _?new O(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`)}),ur=E({name:`prismic webhook disable`,description:`
138
+ `}},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(!ar.includes(e))throw new k(`Invalid trigger: ${e}\nValid triggers: ${ar.join(`, `)}`);let c=await T(),l=await E(),u=!(s.length>0);try{await cr({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:`
121
139
  Disable a webhook in a Prismic repository.
122
140
 
123
141
  By default, this command reads the repository from prismic.config.json at the
124
142
  project root.
125
- `,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 b()}=t,i=await w(),a=await T(),o=(await On({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new O(`Webhook not found: ${n}`);if(!o.config.active){console.info(`Webhook already disabled: ${n}`);return}let s=o.config._id,c=structuredClone(o.config);c.active=!1;try{await An(s,c,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),dr=E({name:`prismic webhook enable`,description:`
143
+ `,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 sr({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 lr(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:`
126
144
  Enable a webhook in a Prismic repository.
127
145
 
128
146
  By default, this command reads the repository from prismic.config.json at the
129
147
  project root.
130
- `,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 b()}=t,i=await w(),a=await T(),o=(await On({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new O(`Webhook not found: ${n}`);if(o.config.active){console.info(`Webhook already enabled: ${n}`);return}let s=o.config._id,c=structuredClone(o.config);c.active=!0;try{await An(s,c,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),fr=E({name:`prismic webhook list`,description:`
148
+ `,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 sr({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 lr(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:`
131
149
  List all webhooks in a Prismic repository.
132
150
 
133
151
  By default, this command reads the repository from prismic.config.json at the
134
152
  project root.
135
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({values:e})=>{let{repo:t=await b(),json:n}=e,r=await On({repo:t,token:await w(),host:await T()});if(n){console.info(u(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}]`)}}),pr=E({name:`prismic webhook remove`,description:`
153
+ `,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 sr({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:`
136
154
  Delete a webhook from a Prismic repository.
137
155
 
138
156
  By default, this command reads the repository from prismic.config.json at the
139
157
  project root.
140
- `,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 b()}=t,i=await w(),a=await T(),o=(await On({repo:r,token:i,host:a})).find(e=>e.config.url===n);if(!o)throw new O(`Webhook not found: ${n}`);let s=o.config._id;try{await jn(s,{repo:r,token:i,host:a})}catch(e){throw e instanceof _?new O(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),mr=E({name:`prismic webhook set-triggers`,description:`
158
+ `,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 sr({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 ur(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:`
141
159
  Update which events trigger a webhook.
142
160
 
143
161
  By default, this command reads the repository from prismic.config.json at the
@@ -149,17 +167,35 @@ await Promise.allSettled([
149
167
  releasesUpdated When a release is edited or deleted
150
168
  tagsCreated When a tag is created
151
169
  tagsDeleted When a tag is deleted
152
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await b(),trigger:i=[]}=t;for(let e of i)if(!En.includes(e))throw new O(`Invalid trigger: ${e}\nValid triggers: ${En.join(`, `)}`);let a=await w(),o=await T(),s=(await On({repo:r,token:a,host:o})).find(e=>e.config.url===n);if(!s)throw new O(`Webhook not found: ${n}`);let c=s.config._id;try{await An(c,{...s.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:a,host:o})}catch(e){throw e instanceof _?new O(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${i.join(`, `)}`)}),hr=E({name:`prismic webhook view`,description:`
170
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await C(),trigger:i=[]}=t;for(let e of i)if(!ar.includes(e))throw new k(`Invalid trigger: ${e}\nValid triggers: ${ar.join(`, `)}`);let o=await T(),s=await E(),c=(await sr({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 lr(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:`
153
171
  View details of a webhook in a Prismic repository.
154
172
 
155
173
  By default, this command reads the repository from prismic.config.json at the
156
174
  project root.
157
- `,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 b()}=t,i=(await On({repo:r,token:await w(),host:await T()})).find(e=>e.config.url===n);if(!i)throw new O(`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 En)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)`)}),gr=D({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:fr,description:`List all webhooks`},create:{handler:lr,description:`Create a new webhook`},view:{handler:hr,description:`View webhook details`},remove:{handler:pr,description:`Delete a webhook`},enable:{handler:dr,description:`Enable a webhook`},disable:{handler:ur,description:`Disable a webhook`},"set-triggers":{handler:mr,description:`Update webhook triggers`}}}),_r=E({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await de({token:await w(),host:await T()});console.info(e.email)});const A=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,j=globalThis,M=`10.42.0`;function N(){return vr(j),j}function vr(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||M,t[M]=t[M]||{}}function yr(e,t,n=j){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[M]=r[M]||{};return i[e]||(i[e]=t())}const br=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],xr={};function P(e){if(!(`console`in j))return e();let t=j.console,n={},r=Object.keys(xr);r.forEach(e=>{let r=xr[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Sr(){kr().enabled=!0}function Cr(){kr().enabled=!1}function wr(){return kr().enabled}function Tr(...e){Or(`log`,...e)}function Er(...e){Or(`warn`,...e)}function Dr(...e){Or(`error`,...e)}function Or(e,...t){A&&wr()&&P(()=>{j.console[e](`Sentry Logger [${e}]:`,...t)})}function kr(){return A?yr(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const F={enable:Sr,disable:Cr,isEnabled:wr,log:Tr,warn:Er,error:Dr},Ar=/\(error: (.*)\)/,jr=/captureMessage|captureException/;function Mr(...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(`
158
- `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Ar.test(n)?n.replace(Ar,`$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 Pr(i.slice(r))}}function Nr(e){return Array.isArray(e)?Mr(...e):e}function Pr(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Fr(t).function||``)&&t.pop(),t.reverse(),jr.test(Fr(t).function||``)&&(t.pop(),jr.test(Fr(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Fr(t).filename,function:e.function||`?`}))}function Fr(e){return e[e.length-1]||{}}const Ir=`<anonymous>`;function Lr(e){try{return!e||typeof e!=`function`?Ir:e.name||Ir}catch{return Ir}}function Rr(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function zr(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Br={},Vr={};function Hr(e,t){Br[e]=Br[e]||[],Br[e].push(t)}function Ur(e,t){if(!Vr[e]){Vr[e]=!0;try{t()}catch(t){A&&F.error(`Error while instrumenting ${e}`,t)}}}function Wr(e,t){let n=e&&Br[e];if(n)for(let r of n)try{r(t)}catch(t){A&&F.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Lr(r)}\nError:`,t)}}let Gr=null;function Kr(e){let t=`error`;Hr(t,e),Ur(t,qr)}function qr(){Gr=j.onerror,j.onerror=function(e,t,n,r,i){return Wr(`error`,{column:r,error:i,line:n,msg:e,url:t}),Gr?Gr.apply(this,arguments):!1},j.onerror.__SENTRY_INSTRUMENTED__=!0}let Jr=null;function Yr(e){let t=`unhandledrejection`;Hr(t,e),Ur(t,Xr)}function Xr(){Jr=j.onunhandledrejection,j.onunhandledrejection=function(e){return Wr(`unhandledrejection`,e),Jr?Jr.apply(this,arguments):!0},j.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Zr=Object.prototype.toString;function I(e){switch(Zr.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return L(e,Error)}}function Qr(e,t){return Zr.call(e)===`[object ${t}]`}function $r(e){return Qr(e,`ErrorEvent`)}function ei(e){return Qr(e,`String`)}function ti(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function ni(e){return e===null||ti(e)||typeof e!=`object`&&typeof e!=`function`}function ri(e){return Qr(e,`Object`)}function ii(e){return typeof Event<`u`&&L(e,Event)}function ai(e){return typeof Element<`u`&&L(e,Element)}function oi(e){return Qr(e,`RegExp`)}function si(e){return!!(e?.then&&typeof e.then==`function`)}function ci(e){return ri(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function L(e,t){try{return e instanceof t}catch{return!1}}function li(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const ui=j;function di(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=fi(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 fi(e,t){let n=e,r=[];if(!n?.tagName)return``;if(ui.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&&ei(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 pi(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&hi(i,r);try{e[t]=i}catch{A&&F.log(`Failed to replace method "${t}" in object`,e)}}function mi(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{A&&F.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function hi(e,t){try{e.prototype=t.prototype=t.prototype||{},mi(e,`__sentry_original__`,t)}catch{}}function gi(e){return e.__sentry_original__}function _i(e){if(I(e))return{message:e.message,name:e.name,stack:e.stack,...yi(e)};if(ii(e)){let t={type:e.type,target:vi(e.target),currentTarget:vi(e.currentTarget),...yi(e)};return typeof CustomEvent<`u`&&L(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function vi(e){try{return ai(e)?di(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function yi(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 bi(e){let t=Object.keys(_i(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let R;function xi(e){if(R!==void 0)return R?R(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=j;return t in n&&typeof n[t]==`function`?(R=n[t],R(e)):(R=null,e())}function z(){return xi(()=>Math.random())}function Si(){return xi(()=>Date.now())}function Ci(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function wi(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 Ti(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{li(r)?n.push(Rr(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function B(e,t,n=!1){return ei(e)?oi(t)?t.test(e):ei(t)?n?e===t:e.includes(t):!1:!1}function Ei(e,t=[],n=!1){return t.some(t=>B(e,t,n))}function Di(){let e=j;return e.crypto||e.msCrypto}let Oi;function ki(){return z()*16}function V(e=Di()){try{if(e?.randomUUID)return xi(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Oi||=`10000000100040008000100000000000`,Oi.replace(/[018]/g,e=>(e^(ki()&15)>>e/4).toString(16))}function Ai(e){return e.exception?.values?.[0]}function ji(e){let{message:t,event_id:n}=e;if(t)return t;let r=Ai(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Mi(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 Ni(e,t){let n=Ai(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 Pi=/^(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 Fi(e){return parseInt(e||``,10)}function Ii(e){let t=e.match(Pi)||[],n=Fi(t[1]),r=Fi(t[2]),i=Fi(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 Li(e){if(Ri(e))return!0;try{mi(e,`__sentry_captured__`,!0)}catch{}return!1}function Ri(e){try{return e.__sentry_captured__}catch{}}const zi=1e3;function Bi(){return Si()/zi}function Vi(){let{performance:e}=j;if(!e?.now||!e.timeOrigin)return Bi;let t=e.timeOrigin;return()=>(t+xi(()=>e.now()))/zi}let Hi;function Ui(){return(Hi??=Vi())()}function Wi(e){let t=Ui(),n={sid:V(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>qi(n)};return e&&Gi(n,e),n}function Gi(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||Ui(),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 Ki(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Gi(e,n)}function qi(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 Ji(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]=Ji(r[e],t[e],n-1));return r}function Yi(){return V()}function Xi(){return V().substring(16)}const Zi=`_sentrySpan`;function Qi(e,t){t?mi(e,Zi,t):delete e[Zi]}function $i(e){return e[Zi]}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:Yi(),sampleRand:z()}}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,Qi(t,$i(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&&Gi(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():ri(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,Qi(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Yi(),sampleRand:z()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:Bi(),...e,message:e.message?Ci(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:$i(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Ji(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 A&&F.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 A&&F.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):(A&&F.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 ea(){return yr(`defaultCurrentScope`,()=>new H)}function ta(){return yr(`defaultIsolationScope`,()=>new H)}var na=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 si(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 ra(){let e=vr(N());return e.stack=e.stack||new na(ea(),ta())}function ia(e){return ra().withScope(e)}function aa(e,t){let n=ra();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function oa(e){return ra().withScope(()=>e(ra().getIsolationScope()))}function sa(){return{withIsolationScope:oa,withScope:ia,withSetScope:aa,withSetIsolationScope:(e,t)=>oa(t),getCurrentScope:()=>ra().getScope(),getIsolationScope:()=>ra().getIsolationScope()}}function ca(e){let t=vr(N());t.acs=e}function U(e){let t=vr(e);return t.acs?t.acs:sa()}function W(){return U(N()).getCurrentScope()}function G(){return U(N()).getIsolationScope()}function la(){return yr(`globalScope`,()=>new H)}function ua(...e){let t=U(N());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function da(...e){let t=U(N());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 fa(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Xi()};return n&&(i.parent_span_id=n),i}const pa=`sentry.profile_id`,ma=`sentry.exclusive_time`;function ha(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function ga(e){let t=e;return{scope:t._sentryScope,isolationScope:ha(t._sentryIsolationScope)}}const _a=/^sentry-/;function va(e){let t=ba(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(_a)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function ya(e){if(e)return Sa(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function ba(e){if(!(!e||!ei(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=xa(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):xa(e)}function xa(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 Sa(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?(A&&F.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Ca=/^o(\d+)\./,wa=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Ta(e){return e===`http`||e===`https`}function Ea(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 Da(e){let t=wa.exec(e);if(!t){P(()=>{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 Oa({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Oa(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function ka(e){if(!A)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(F.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Ta(r)?t&&isNaN(parseInt(t,10))?(F.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(F.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(F.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Aa(e){return e.match(Ca)?.[1]}function ja(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Aa(n)),r}function Ma(e){let t=typeof e==`string`?Da(e):Oa(e);if(!(!t||!ka(t)))return t}function Na(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 Pa=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Fa(e){if(!e)return;let t=e.match(Pa);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 Ia(e,t){let n=Fa(e),r=va(t);if(!n?.traceId)return{traceId:Yi(),sampleRand:z()};let i=za(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 La(e=Yi(),t=Xi(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Ra(e=Yi(),t=Xi(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function za(e,t){let n=Na(t?.sample_rand);if(n!==void 0)return n;let r=Na(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?z()*r:r+z()*(1-r):z()}function Ba(e,t){let n=ja(e);return t&&n&&t!==n?(F.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)?(F.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 Va=!1;function Ha(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Ja(e).parent_span_id,a=ga(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Xi():t,trace_id:n}}function Ua(e){let{traceId:t,spanId:n}=e.spanContext();return La(t,n,Za(e))}function Wa(e){let{traceId:t,spanId:n}=e.spanContext();return Ra(t,n,Za(e))}function Ga(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 Ka(e){return typeof e==`number`?qa(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?qa(e.getTime()):Ui()}function qa(e){return e>9999999999?e/1e3:e}function Ja(e){if(Xa(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Ya(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:Ka(i),timestamp:Ka(o)||void 0,status:Qa(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Ga(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Ya(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Xa(e){return typeof e.getSpanJSON==`function`}function Za(e){let{traceFlags:t}=e.spanContext();return t===1}function Qa(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function $a(e){return e._sentryRootSpan||e}function eo(){let e=U(N());return e.getActiveSpan?e.getActiveSpan():$i(W())}function to(){Va||=(P(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let no=!1;function ro(){if(no)return;function e(){let e=eo(),t=e&&$a(e);if(t){let e=`internal_error`;A&&F.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,no=!0,Kr(e),Yr(e)}function io(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||K()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function ao(e){F.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function oo(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(co(n)){if(B(e.description,n))return A&&ao(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?B(e.description,n.name):!0,r=n.op?e.op&&B(e.op,n.op):!0;if(t&&r)return A&&ao(e),!0}return!1}function so(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 co(e){return typeof e==`string`||e instanceof RegExp}const lo=`production`;function uo(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||lo,release:n.release,public_key:r,trace_id:e,org_id:ja(t)};return t.emit(`createDsc`,i),i}function fo(e,t){let n=t.getPropagationContext();return n.dsc||uo(n.traceId,e)}function po(e){let t=K();if(!t)return{};let n=$a(e),r=Ja(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&&va(l);if(u)return s(u);let d=uo(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),io()&&(d.sampled=String(Za(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??ga(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function q(e,t=100,n=1/0){try{return ho(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function mo(e,t=3,n=100*1024){let r=q(e,t);return yo(r)>n?mo(e,t-1,n):r}function ho(e,t,n=1/0,r=1/0,i=bo()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=go(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 ho(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=_i(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]=ho(e,t,c-1,r,i),d++}return o(t),u}function go(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(li(t))return Rr(t);if(ci(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Lr(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=_o(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function _o(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function vo(e){return~-encodeURI(e).split(/%..|./).length}function yo(e){return vo(JSON.stringify(e))}function bo(){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 xo(e,t){let[n,r]=e;return[n,[...r,t]]}function So(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 Co(e,t){return So(e,(e,n)=>t.includes(n))}function wo(e){let t=vr(j);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function To(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[wo(r),e]:r.push(typeof e==`string`?wo(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:Eo(r)}function Eo(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 Do(e){let t=typeof e.data==`string`?wo(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Oo={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 ko(e){return Oo[e]}function Ao(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function jo(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:Ea(r)},...i&&{trace:i}}}function Mo(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 No(e,t,n,r){let i=Ao(n);return J({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Ea(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Po(e,t,n,r){let i=Ao(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Mo(e,n?.sdk);let o=jo(e,i,r,t);return delete e.sdkProcessingMetadata,J(o,[[{type:a},e]])}const Fo=`__SENTRY_SUPPRESS_TRACING__`,Io=(e,t)=>{let n=U(N());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=K(),o=va(i);return a&&!Ba(a,o?.org_id)?zo(t):ua(e=>{let n=Ia(r,i);return e.setPropagationContext(n),Qi(e,void 0),t()})};function Lo(e,t){let n=Bo();return n.withActiveSpan?n.withActiveSpan(e,t):ua(n=>(Qi(n,e||void 0),t(n)))}function Ro(e){let t=Bo();return t.suppressTracing?t.suppressTracing(e):ua(t=>{t.setSDKProcessingMetadata({[Fo]:!0});let n=e();return t.setSDKProcessingMetadata({[Fo]:void 0}),n})}function zo(e){return ua(t=>(t.setPropagationContext({traceId:Yi(),sampleRand:z()}),A&&F.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),Lo(null,e)))}function Bo(){return U(N())}function Vo(e){return new Uo(t=>{t(e)})}function Ho(e){return new Uo((t,n)=>{n(e)})}var Uo=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(si(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 Wo(e,t,n,r=0){try{let i=Go(t,n,e,r);return si(i)?i:Vo(i)}catch(e){return Ho(e)}}function Go(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return A&&a===null&&F.log(`Event processor "${i.id||`?`}" dropped event`),si(a)?a.then(e=>Go(e,t,n,r+1)):Go(a,t,n,r+1)}let Ko,qo,Jo,Y;function Yo(e){let t=j._sentryDebugIds,n=j._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Y&&r.length===qo&&i.length===Jo)return Y;qo=r.length,Jo=i.length,Y={},Ko||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Ko?.[r];if(i&&Y&&t)Y[i[0]]=t,Ko&&(Ko[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&&Ko){Y[i]=t,Ko[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Y}function Xo(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;es(e,t),r&&rs(e,r),is(e,n),ts(e,i),ns(e,a)}function Zo(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;Qo(e,`extra`,n),Qo(e,`tags`,r),Qo(e,`attributes`,i),Qo(e,`user`,a),Qo(e,`contexts`,o),e.sdkProcessingMetadata=Ji(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 Qo(e,t,n){e[t]=Ji(e[t],n,1)}function $o(e,t){let n=la().getScopeData();return e&&Zo(n,e.getScopeData()),t&&Zo(n,t.getScopeData()),n}function es(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 ts(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function ns(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function rs(e,t){e.contexts={trace:Ha(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:po(t),...e.sdkProcessingMetadata};let n=Ja($a(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function is(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 as(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||Bi()},l=n.integrations||e.integrations.map(e=>e.name);os(c,e),ls(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&ss(c,e.stackParser);let u=ds(r,n.captureContext);n.mechanism&&Ni(c,n.mechanism);let d=i?i.getEventProcessors():[],f=$o(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Xo(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Vo(c):Wo(m,c,n)).then(e=>(e&&cs(e),typeof o==`number`&&o>0?us(e,o,s):e))}function os(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||lo,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Ci(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Ci(e.value,a)})}function ss(e,t){let n=Yo(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function cs(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 ls(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function us(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 ds(e,t){if(!t)return e;let n=e?e.clone():new H;return n.update(t),n}function fs(e){if(e)return ps(e)||hs(e)?{captureContext:e}:e}function ps(e){return e instanceof H||typeof e==`function`}const ms=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function hs(e){return Object.keys(e).some(e=>ms.includes(e))}function gs(e,t){return W().captureException(e,fs(t))}function _s(e,t){G().setContext(e,t)}function vs(e,t){G().setTag(e,t)}function ys(e){G().setUser(e)}async function bs(e){let t=K();return t?t.flush(e):(A&&F.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function xs(){let e=K();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Ss(e){let t=G(),{user:n}=$o(t,W()),{userAgent:r}=j.navigator||{},i=Wi({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Gi(a,{status:`exited`}),Cs(),t.setSession(i),i}function Cs(){let e=G(),t=W().getSession()||e.getSession();t&&Ki(t),ws(),e.setSession()}function ws(){let e=G(),t=K(),n=e.getSession();n&&t&&t.captureSession(n)}function Ts(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Es(e){return`${Ts(e)}${e.projectId}/envelope/`}function Ds(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 Os(e,t,n){return t||`${Es(e)}?${Ds(e,n)}`}const ks=[];function As(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 js(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 As(r)}function Ms(e,t){let n={};return t.forEach(t=>{t&&Ps(e,t,n)}),n}function Ns(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Ps(e,t,n){if(n[t.name]){A&&F.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!ks.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),ks.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)}A&&F.log(`Integration installed: ${t.name}`)}function X(e){return e}function Fs(e,t){return t?ua(t,()=>{let n=eo(),r=n?Ha(n):fa(t);return[n?po(n):fo(e,t),r]}):[void 0,void 0]}function Is(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function Ls(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Ea(r)),J(i,[Is(e)])}function Rs(e,t){let n=t??zs(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Ls(n,r._metadata,r.tunnel,e.getDsn());Bs().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function zs(e){return Bs().get(e)}function Bs(){return yr(`clientToLogBufferMap`,()=>new WeakMap)}function Vs(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Hs(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Ea(r)),J(i,[Vs(e)])}function Us(e,t){let n=t??Ws(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Hs(n,r._metadata,r.tunnel,e.getDsn());Gs().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Ws(e){return Gs().get(e)}function Gs(){return yr(`clientToMetricBufferMap`,()=>new WeakMap)}function Ks(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const qs=Symbol.for(`SentryBufferFullError`);function Js(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Ho(qs);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Vo(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Ks(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Ys(e,t=Si()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function Xs(e,t){return e[t]||e.all||0}function Zs(e,t,n=Si()){return Xs(e,t)>n}function Qs(e,{statusCode:t,headers:n},r=Si()){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+Ys(o,r):t===429&&(i.all=r+60*1e3);return i}function $s(e,t,n=Js(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(So(i,(t,n)=>{let i=ko(n);Zs(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(Co(o,[`client_report`])){A&&F.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}So(o,(n,r)=>{e.recordDroppedEvent(t,ko(r))})};return n.add(()=>t({body:To(o)}).then(e=>e.statusCode===413?(A&&F.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(A&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&F.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Qs(r,e),e),e=>{throw s(`network_error`),A&&F.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===qs)return A&&F.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function ec(e,t,n){let r=[{type:`client_report`},{timestamp:n||Bi(),discarded_events:e}];return J(t?{dsn:t}:{},[r])}function tc(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 nc(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?.[pa],exclusive_time:o?.[ma],measurements:e.measurements,is_segment:!0}}function rc(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&&{[pa]:e.profile_id},...e.exclusive_time&&{[ma]:e.exclusive_time}}}},measurements:e.measurements}}const ic=`Not capturing exception because it's already been captured.`,ac=`Discarded session because of missing or non-string release`,oc=Symbol.for(`SentryInternalError`),sc=Symbol.for(`SentryDoNotSendEventError`);function cc(e){return{message:e,[oc]:!0}}function lc(e){return{message:e,[sc]:!0}}function uc(e){return!!e&&typeof e==`object`&&oc in e}function dc(e){return!!e&&typeof e==`object`&&sc in e}function fc(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=Ks(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var pc=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Js(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=Ma(e.dsn):A&&F.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Os(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&&fc(this,`afterCaptureLog`,`flushLogs`,bc,Rs),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&fc(this,`afterCaptureMetric`,`flushMetrics`,yc,Us)}captureException(e,t,n){let r=V();if(Li(e))return A&&F.log(ic),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=ti(e)?e:String(e),o=ni(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&&Li(t.originalException))return A&&F.log(ic),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=mc(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Gi(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){Rs(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];Ps(this,e,this._integrations),t||Ns(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Po(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=xo(n,Do(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=lo}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){A&&F.warn(ac);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){A&&F.warn(ac);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=No(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}`;A&&F.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 A&&F.error(`Error while sending envelope:`,e),{}}return A&&F.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Ms(this,e),Ns(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)&&(Gi(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),as(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:fa(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:fo(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=W(),r=G()){return A&&_c(e)&&F.log(`Captured error event \`${tc(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{A&&(dc(e)?F.log(e.message):uc(e)?F.warn(e.message):F.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=vc(e),s=_c(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Na(a);if(s&&typeof l==`number`&&z()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Ho(lc(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=mc(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),lc("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:hc(gc(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 lc(`${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 dc(e)||uc(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),cc(`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===qs&&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(){A&&F.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){A&&F.log(`No outcomes to send`);return}if(!this._dsn){A&&F.log(`No dsn provided, will not send outcomes`);return}A&&F.log(`Sending outcomes:`,e);let t=ec(e,this._options.tunnel&&Ea(this._dsn));this.sendEnvelope(t)}};function mc(e){return e===`replay_event`?`replay`:e||`error`}function hc(e,t){let n=`${t} must return \`null\` or a valid event.`;if(si(e))return e.then(e=>{if(!ri(e)&&e!==null)throw cc(n);return e},e=>{throw cc(`${t} rejected with ${e}`)});if(!ri(e)&&e!==null)throw cc(n);return e}function gc(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(_c(c)&&i)return i(c,r);if(vc(c)){if(o||s){let t=nc(c);if(s?.length&&oo(t,s))return null;if(o){let e=o(t);e?c=Ji(n,rc(e)):to()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&oo(e,s)){so(n,e);continue}if(o){let n=o(e);n?t.push(n):(to(),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 _c(e){return e.type===void 0}function vc(e){return e.type===`transaction`}function yc(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+xc(e.attributes)}function bc(e){let t=0;return e.message&&(t+=e.message.length*2),t+xc(e.attributes)}function xc(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Sc(e[0]):ni(e)?t+=Sc(e):t+=100}),t}function Sc(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Cc(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=Ea(i)),t&&(a.trace=t),J(a,[wc(e)])}function wc(e){return[{type:`check_in`},e]}function Tc(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 Ec(e,t){return e(t.stack||``,1)}function Dc(e){return I(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Oc(e){return Dc(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function kc(e,t){let n={type:t.name||t.constructor.name,value:Oc(t)},r=Ec(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Ac(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function jc(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=bi(e);if($r(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Mc(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Mc(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Nc(e,t,n,r){if(I(n))return[n,void 0];if(t.synthetic=!0,ri(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:mo(n,t)},a=Ac(n);if(a)return[a,i];let o=jc(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 Pc(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Nc(e,i,n,r),s={exception:{values:[kc(t,a)]}};return o&&(s.extra=o),Mi(s,void 0,void 0),Ni(s,i),{...s,event_id:r?.event_id}}function Fc(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Ec(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Ni(a,{synthetic:!0}))}if(ti(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 Ic=class extends pc{constructor(e){ro(),Tc(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Pc(this,this._options.stackParser,e,t);return n.level=`error`,Vo(n)}eventFromMessage(e,t=`info`,n){return Vo(Fc(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Lc(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Lc(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:V();if(!this._isEnabled())return A&&F.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]=Fs(this,n);l&&(s.contexts={trace:l});let u=Cc(s,c,this.getSdkMetadata(),o,this.getDsn());return A&&F.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){A&&F.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=Js(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 Lc(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 Rc=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),zc=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Bc(e,t){let n=String(e).toLowerCase();return Rc.has(n)?!1:zc.has(n)?!0:t?.strict?null:!!e}function Vc(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 Hc(e){return e.split(/[?#]/,1)[0]}function Uc(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Wc(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:M})),i.version=M)}function Gc(e={}){let t=e.client||K();if(!xs()||!t)return{};let n=U(N());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||W(),i=e.span||eo(),a=i?Ua(i):Kc(r),o=ya(i?po(i):fo(t,r));if(!Pa.test(a))return F.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?Wa(i):qc(r)),s}function Kc(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return La(t,r,n)}function qc(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ra(t,r,n)}const Jc=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Yc(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return A&&!r&&F.log(Jc,e),r;let i=Ei(e,t);return n?.set(e,i),A&&!i&&F.log(Jc,e),i}function Xc(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Zc(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=Qc({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:$c(i),headers:Xc(t),cookies:s,data:o}}function Qc({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function $c(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function el(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:Bi(),...e},s=i?P(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let tl;const nl=new WeakMap,rl=X((()=>({name:`FunctionToString`,setupOnce(){tl=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=gi(this),n=nl.has(K())&&t!==void 0?t:this;return tl.apply(n,e)}}catch{}},setup(e){nl.set(e,!0)}}))),il=[/^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$/],al=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=ol(e,n.getOptions())},processEvent(n,r,i){return t||=ol(e,i.getOptions()),sl(n,t)?null:n}}});function ol(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:il],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function sl(e,t){if(e.type){if(e.type===`transaction`&&ll(e,t.ignoreTransactions))return A&&F.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${ji(e)}`),!0}else{if(cl(e,t.ignoreErrors))return A&&F.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${ji(e)}`),!0;if(ml(e))return A&&F.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${ji(e)}`),!0;if(ul(e,t.denyUrls))return A&&F.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${ji(e)}.\nUrl: ${pl(e)}`),!0;if(!dl(e,t.allowUrls))return A&&F.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${ji(e)}.\nUrl: ${pl(e)}`),!0}return!1}function cl(e,t){return t?.length?tc(e).some(e=>Ei(e,t)):!1}function ll(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ei(n,t):!1}function ul(e,t){if(!t?.length)return!1;let n=pl(e);return n?Ei(n,t):!1}function dl(e,t){if(!t?.length)return!0;let n=pl(e);return n?Ei(n,t):!0}function fl(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 pl(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?fl(t):null}catch{return A&&F.error(`Cannot extract url for event ${ji(e)}`),null}}function ml(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function hl(e,t,n,r,i,a){if(!i.exception?.values||!a||!L(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=gl(e,t,r,a.originalException,n,i.exception.values,o,0))}function gl(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(L(r[i],Error)){vl(o,s,r);let a=e(t,r[i]),l=c.length;yl(a,i,l,s),c=gl(e,t,n,r[i],i,[a,...c],a,l)}return _l(r)&&r.errors.forEach((a,l)=>{if(L(a,Error)){vl(o,s,r);let u=e(t,a),d=c.length;yl(u,`errors[${l}]`,d,s),c=gl(e,t,n,a,i,[u,...c],u,d)}}),c}function _l(e){return Array.isArray(e.errors)}function vl(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,..._l(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function yl(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const bl=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){hl(kc,i.getOptions().stackParser,n,t,e,r)}}}));function xl(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 Sl=[`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 Cl(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Sl.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?wl(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Tl(e))||null}function wl(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Tl(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 El={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Dl=X(((e={})=>{let t={...El,...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&&Ol(e,a,{ipAddress:o},s),e}}}));function Ol(e,t,n,r){if(e.request={...e.request,...kl(t,r)},r.ip){let r=t.headers&&Cl(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function kl(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||Sl.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?xl(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Al(e){let t=`console`;Hr(t,e),Ur(t,jl)}function jl(){`console`in j&&br.forEach(function(e){e in j.console&&pi(j.console,e,function(t){return xr[e]=t,function(...t){Wr(`console`,{args:t,level:e}),xr[e]?.apply(j.console,t)}})})}function Ml(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Nl=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Pl(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Nl.exec(t);return n?n.slice(1):[]}function Fl(e){let t=Pl(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const Il=X((e={})=>{let t=new Set(e.levels||br);return{name:`Console`,setup(e){Al(({args:n,level:r})=>{K()!==e||!t.has(r)||Ll(r,n)})}}});function Ll(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Ml(e),message:Rl(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Rl(e)}`:`Assertion failed`,n.data.arguments=e}else return;el(n,{input:t,level:e})}function Rl(e){return`util`in j&&typeof j.util.format==`function`?j.util.format(...e):Ti(e,` `)}function zl(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Bl(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 Vl(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=zr(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Wl(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Ul(o[3]),colno:Ul(o[4]),in_app:Bl(s||``,c)}}if(i.match(t))return{filename:i}}}function Hl(e){return[90,Vl(e)]}function Ul(e){return parseInt(e||``,10)||void 0}function Wl(e){try{return decodeURI(e)}catch{return}}var Gl=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 Kl=class extends Ic{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||C.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};Wc(n,`node-light`,[`node-core`]),F.log(`Initializing Sentry: process: ${process.pid}, thread: ${Ve?`main`:`worker-${He}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Rs(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&&F.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const ql=X((e={})=>({name:`ChildProcess`,setup(){Ue.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Jl(t.process,e)}),Ue.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Yl(t.worker,e)})}}));function Jl(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&&el({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,el({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Yl(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?el({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):gs(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const Xl=xe(qe),Zl=xe(Ye),Ql=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=$l(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 eu()),n.app&&(e.app=nu()),n.device&&(e.device=ru(n.device)),n.culture){let t=tu();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=uu()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function $l(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=C.freemem()),e}async function eu(){let e=C.platform();switch(e){case`darwin`:return su();case`linux`:return lu();default:return{name:iu[e]||e,version:C.release()}}}function tu(){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 nu(){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 ru(e){let t={},n;try{n=C.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=C.arch(),(e===!0||e.memory)&&(t.memory_size=C.totalmem(),t.free_memory=C.freemem()),e===!0||e.cpu){let e=C.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const iu={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},au=[{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`]}],ou={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 su(){let e={kernel_version:C.release(),name:`Mac OS X`,version:`10.${Number(C.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Ne(`/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 cu(e){return e.split(` `)[0].toLowerCase()}async function lu(){let e={kernel_version:C.release(),name:`Linux`};try{let t=await Zl(`/etc`),n=au.find(e=>t.includes(e.name));if(!n)return e;let r=(await Xl(ke(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(cu(e))>=0)||i[0],e.version=ou[cu(e.name)]?.(r)}catch{}return e}function uu(){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 du=new Gl(10),fu=new Gl(20);function pu(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function mu(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function hu(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function gu(e,t){let n=du.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 _u(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Tu(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=Tu(r,t)),n++}return a}function vu(e,t,n){return new Promise((r,i)=>{let a=Ge(e),o=Ie({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){fu.set(e,1),Z&&F.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]=wi(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 yu(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`||mu(i)||hu(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(fu.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=_u(r,t);if(a.every(t=>gu(e,t)))continue;let o=pu(du,e,{});i.push(vu(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&F.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&&bu(n.stacktrace.frames,t,du);return e}function bu(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;Su(r.lineno,r,t,e)}}function xu(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Su(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&F.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Cu(e,n);i<e;i++){let e=r[i];if(e===void 0){xu(t),Z&&F.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){xu(t),Z&&F.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=wu(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 Cu(e,t){return Math.max(1,e-t)}function wu(e,t){return e+t}function Tu(e,t){return[Cu(e,t),wu(e,t)]}const Eu=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return yu(e,t)}}})),Du=Ii(process.versions.node),Ou=Du.major;Du.minor;let ku;async function Au(){if(ku===void 0)try{ku=!!(await import(`node:inspector`)).url()}catch{ku=!1}return ku}const ju=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Mu(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 Nu(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Pu(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Nu(e)&&Nu(t)}function Fu(...e){F.log(`[LocalVariables]`,...e)}const Iu=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||!Pu(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&ju in n.originalException&&Array.isArray(n.originalException[ju])){for(let r of e.exception?.values||[])t(r,n.originalException[ju]);n.originalException[ju]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Xe(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=>{Fu(`Worker error`,e)}),t.once(`exit`,e=>{Fu(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Au()){F.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:F.isEnabled()};r().then(()=>{try{i(n)}catch(e){F.error(`Failed to start worker`,e)}},e=>{F.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function Lu(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Ru(e,t){if(t!==void 0)return Lu(e(t,1))}function zu(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 Bu=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}=zu(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 Vu=X(((e={},t)=>{let n=new Gl(20),r,i=!1;function a(t){let r=Lu(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||!Pu(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(Ou<18){F.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Au()){F.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Bu.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Ru(e,i.description);if(c==null){s();return}let{add:l,next:u}=zu(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=Mu(e.maxExceptionsPerSecond||50,()=>{F.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{F.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){F.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]}}})),Hu=(e={})=>Du.major<19?Vu(e):Iu(e);function Uu(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Wu;const Gu=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Ku=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Xu()},e},getModules:Xu}));function qu(){try{return f.cache?Object.keys(f.cache):[]}catch{return[]}}function Ju(){return{...Gu,...Qu(),...Uu()?Yu():{}}}function Yu(){let e=f.main?.paths||[],t=qu(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=Oe(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=ke(t,`package.json`);if(r.add(t),!Ke(o))return a();try{let e=JSON.parse(Je(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function Xu(){return Wu||=Ju(),Wu}function Zu(){try{let e=ke(process.cwd(),`package.json`);return JSON.parse(Je(e,`utf8`))}catch{return{}}}function Qu(){let e=Zu();return{...e.dependencies,...e.devDependencies}}function $u(e){P(()=>{console.error(e)});let t=K();if(t===void 0){Z&&F.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&&F.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&F.error(e)})}const ed=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Ve&&global.process.on(`uncaughtException`,td(e,t))}}});function td(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=$u;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&&F.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),$u(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,K()===e&&gs(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const nd=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],rd=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...nd,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,sd(e,t))}}}));function id(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 ad(e,t){let n=e.name===void 0||B(t.name,e.name,!0),r=e.message===void 0||B(t.message,e.message);return n&&r}function od(e,t){let n=id(t);return e.some(e=>ad(e,n))}function sd(e,t){return function(n,r){if(K()!==e||od(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>Lo(a,e):e=>e())(()=>{gs(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),cd(n,t.mode)}}function cd(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`?P(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(P(()=>{console.warn(n)}),$u(e))}const ld=X(()=>({name:`ProcessSession`,setupOnce(){Ss(),process.on(`beforeExit`,()=>{G().getSession()?.status!==`ok`&&Cs()})}})),ud=`Spotlight`,dd=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:ud,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&F.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}fd(e,t)}}}));function fd(e,t){let n=pd(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){F.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=To(e);Ro(()=>{let e=Le.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++,F.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function pd(e){try{return new URL(`${e}`)}catch{F.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function md(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:ye.getSystemErrorMap().has(e.errno)}const hd=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!md(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 gd(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function _d(e=process.argv[1]?Fl(process.argv[1]):process.cwd(),t=je===`\\`){let n=t?gd(e):e;return e=>{if(!e)return;let r=t?gd(e):e,{dir:i,base:a,ext:o}=Ae.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 vd(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(j.SENTRY_RELEASE?.id)return j.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 yd=Mr(Hl(_d())),$=Symbol(`AgentBaseInternalState`);var bd=class extends Le.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(`
159
- `).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 Le.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 xd(...e){F.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Sd(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(),xd(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),xd(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
175
+ `,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 sr({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 ar)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(`
176
+ `);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(`
177
+ `).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
160
178
  \r
161
- `);if(l===-1){xd(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
162
- `),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}xd(`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 Cd(...e){F.log(`[https-proxy-agent]`,...e)}var wd=class extends bd{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??{},Cd(`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?Ed(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:`){Cd("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=et.connect({...this.connectOpts,servername:e&&$e.isIP(e)?void 0:e})}else Cd("Creating `net.Socket`: %o",this.connectOpts),r=$e.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=$e.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=Sd(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`,Td),t.secureEndpoint){Cd(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return et.connect({...Ed(t,`host`,`path`,`port`),socket:r,servername:$e.isIP(e)?void 0:e})}return r}r.destroy();let u=new $e.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Cd(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};wd.__initStatic();function Td(e){e.resume()}function Ed(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Dd(e){return new Fe({read(){this.push(e),this.push(null)}})}function Od(e){let t;try{t=new URL(e.url)}catch{return P(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),$s(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=kd(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?Ze:Le,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new wd(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return $s(e,Ad(e,e.httpModule??i,o))}function kd(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Ad(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)=>{Ro(()=>{let d=Dd(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(Qe()));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 jd(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Bc(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 Md(){let e=new tt;function t(){return e.getStore()||{scope:ea(),isolationScope:ta()}}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()))}ca({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function Nd(e,t,n,r){let i=0,a=[];Z&&F.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&&F.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&&F.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&F.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&&F.error(r,`Error building captured request body`,e)}})}catch(e){Z&&F.error(r,`Error patching request to capture body`,e)}}function Pd(e,t){if(!e)return t;let n=ba(e),r=ba(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Sa(i)}const Fd=`@sentry/instrumentation-http`;function Id(e,t){let n=Rd(e),r=t?.statusCode,i=zl(r);el({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Ld(e,t){let n=Bd(e),{tracePropagationTargets:r,propagateTraceparent:i}=K()?.getOptions()||{},a=Yc(n,r,t)?Gc({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&&F.log(Fd,`Added sentry-trace header to outgoing request`)}catch(e){Z&&F.error(Fd,`Failed to add sentry-trace header to outgoing request:`,I(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Z&&F.log(Fd,`Added traceparent header to outgoing request`)}catch(e){Z&&F.error(Fd,`Failed to add traceparent header to outgoing request:`,I(e)?e.message:`Unknown error`)}if(s){let t=Pd(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&F.log(Fd,`Added baggage header to outgoing request`)}catch(e){Z&&F.error(Fd,`Failed to add baggage header to outgoing request:`,I(e)?e.message:`Unknown error`)}}}function Rd(e){try{let t=e.getHeader(`host`)||e.host,n=Vc(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Uc(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 zd(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Bd(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Vd=`Http`,Hd=new WeakSet,Ud=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Gl(100),r=new WeakMap;return{name:Vd,setupOnce(){We(`http.server.request.start`,(e=>{Wd(e.server,t)})),We(`http.client.request.created`,(e=>{Gd(e.request,t,n,r)})),We(`http.client.response.finish`,(e=>{let n=e;Kd(n.request,n.response,t,r)})),We(`http.client.request.error`,(e=>{Kd(e.request,void 0,t,r)}))}}});function Wd(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Hd.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!W().getClient())return e.apply(r,i);Z&&F.log(Vd,`Handling incoming request`);let a=G().clone(),o=i[1],s=Zc(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&Nd(o,a,n,Vd),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Hc(l)}`;return a.setTransactionName(u),da(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Io({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(W().getPropagationContext().propagationSpanId=Xi(),e.apply(r,i)))})}});Hd.add(i),e.emit=i}function Gd(e,t,n,r){let i=qd(e,t);r.set(e,i),!i&&Ld(e,n)}function Kd(e,t,n,r){n.breadcrumbs&&((r.get(e)??qd(e,n))||Id(e,t))}function qd(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}`,zd(e)):!1}const Jd=`sentry-trace`,Yd=`baggage`,Xd=/baggage: (.*)\r\n/;function Zd(e,t){let n=ef(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=K()?.getOptions()||{},a=Yc(n,r,t)?Gc({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(Jd)&&t.push(Jd,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Yd);if(s&&n===-1)t.push(Yd,s);else if(s){let e=t[n+1],r=Pd(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Jd}:`)&&(e.headers+=`${Jd}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Xd)?.[1];if(s&&!n)e.headers+=`${Yd}: ${s}\r\n`;else if(s){let t=Pd(n,s);t&&(e.headers=e.headers.replace(Xd,`baggage: ${t}\r\n`))}}}function Qd(e,t){let n=$d(e),r=t.statusCode,i=zl(r);el({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function $d(e){try{let t=Vc(ef(e.origin,e.path)),n={url:Uc(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 ef(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 tf=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Gl(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){We(`undici:request:create`,(e=>{nf(e.request,t,n,r)})),We(`undici:request:headers`,(e=>{let n=e;rf(n.request,n.response,t,r)}))}}});function nf(e,t,n,r){let i=af(e,t);r.set(e,i),!i&&Zd(e,n)}function rf(e,t,n,r){n.breadcrumbs&&(r.get(e)||Qd(e,t))}function af(e,t){if(W().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(ef(e.origin,e.path)):!1}function of(){return[al(),rl(),bl(),Dl(),hd(),Il(),Ud(),tf(),ed(),rd(),Eu(),Hu(),Ql(),ql(),ld(),Ku()]}function sf(e={}){return cf(e,of)}function cf(e={},t){let n=lf(e,t);n.debug===!0&&(Z?F.enable():P(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Md(),W().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===ud)&&n.integrations.push(dd({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Wc(n,`node-light`,[`node-core`]);let r=new Kl(n);return W().setClient(r),r.init(),F.log(`SDK initialized from ${Uu()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),ff(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function lf(e,t){let n=uf(e.release),r=jd(e.spotlight),i=df(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??Od,stackParser:Nr(e.stackParser||yd),release:n,tracesSampleRate:i,spotlight:r,debug:Bc(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:js({defaultIntegrations:s,integrations:o})}}function uf(e){if(e!==void 0)return e;let t=vd();if(t!==void 0)return t}function df(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 ff(){if(Bc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Ia(e,t);W().setPropagationContext(n)}}function pf(){return v.PRISMIC_SENTRY_ENABLED??v.PROD}function mf(){if(v.PRISMIC_SENTRY_ENVIRONMENT)return v.PRISMIC_SENTRY_ENVIRONMENT;let e=rt.match(/-(.+?)\./);return e?e[1]:`production`}function hf(){try{if(!pf())return;sf({dsn:v.PRISMIC_SENTRY_DSN,release:rt,environment:mf(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),_s(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function gf(e){try{if(!pf())return;gs(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await bs()}catch{}}const _f=ys,vf=vs,yf=_s,bf=[`login`,`logout`,`whoami`,`sync`],xf=[`login`,`logout`],Sf=D({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:Zt,description:`Initialize a Prismic project`},gen:{handler:vt,description:`Generate files from local models`},sync:{handler:Wt,description:`Sync types and slices from Prismic`},locale:{handler:cn,description:`Manage locales`},repo:{handler:ir,description:`Manage repositories`},preview:{handler:wn,description:`Manage preview configurations`},token:{handler:cr,description:`Manage API tokens`},webhook:{handler:gr,description:`Manage webhooks`},login:{handler:ln,description:`Log in to Prismic`},logout:{handler:dn,description:`Log out of Prismic`},whoami:{handler:_r,description:`Show the currently logged in user`}}});await Cf();async function Cf(){let{positionals:[e],values:{version:t,help:n,repo:r=await ae()}}=be({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(rt);return}if(typeof r!=`string`&&(r=``),!n){hf(),await Mt(),r&&(It(r),vf(`repository`,r),yf(`Repository Data`,{name:r}));try{vf(`framework`,(await le()).id)}catch{}e&&!xf.includes(e)&&ct().then(async e=>{if(!e)return;let t=await de({token:e,host:await T()});Ft({shortId:t.shortId,intercomHash:t.intercomHash}),_f({id:t.shortId})}).catch(()=>{}),e&&!bf.includes(e)&&Nt(e)}try{await Sf(),e&&!bf.includes(e)&&Pt(e)}catch(t){if(process.exitCode=1,bf.includes(e)||Pt(e,{error:t}),t instanceof O||t instanceof pe){console.error(t.message);return}if(t instanceof se||t instanceof ce){console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof ie){console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof _e){console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof re){console.error(he`
179
+ `);if(l===-1){Bf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
180
+ `),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=`
181
+ const {npmPackageName, statePath, timeoutMs} = JSON.parse(Buffer.from(process.argv[1], "base64").toString());
182
+ try {
183
+ const url = \`https://registry.npmjs.org/\${npmPackageName}/latest\`;
184
+ const res = await fetch(url, {signal: AbortSignal.timeout(timeoutMs)});
185
+ if (!res.ok) process.exit(0);
186
+ const {version} = await res.json();
187
+ if (typeof version !== "string") process.exit(0);
188
+ const fs = await import("node:fs/promises");
189
+ let existing = {};
190
+ try {
191
+ const parsed = JSON.parse(await fs.readFile(statePath, "utf-8"));
192
+ if (parsed && typeof parsed === "object") existing = parsed;
193
+ } catch {}
194
+ existing.latestKnownVersion = version;
195
+ existing.lastUpdateCheckAt = Date.now();
196
+ await fs.writeFile(statePath, JSON.stringify(existing, null, 2));
197
+ } catch {}
198
+ `,Gp=[`login`,`logout`,`whoami`,`sync`,`docs`],Kp=[`login`,`logout`],qp=O({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,commands:{init:{handler:En,description:`Initialize a Prismic project`},docs:{handler:Kt,description:`Browse Prismic documentation`},gen:{handler:wn,description:`Generate files from local models`},sync:{handler:mi,description:`Sync types and slices from Prismic`},locale:{handler:In,description:`Manage locales`},repo:{handler:Lr,description:`Manage repositories`},"custom-type":{handler:Mt,description:`Manage custom types`},field:{handler:xn,description:`Manage fields`},"page-type":{handler:Wn,description:`Manage page types`},slice:{handler:Kr,description:`Manage slices`},preview:{handler:rr,description:`Manage preview configurations`},token:{handler:Si,description:`Manage API tokens`},webhook:{handler:Ai,description:`Manage webhooks`},login:{handler:Ln,description:`Log in to Prismic`},logout:{handler:zn,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`
163
199
  This command requires the Type Builder in your repository.
164
200
 
165
201
  As of March 2026, the Type Builder is rolling out incrementally as Slice
@@ -167,4 +203,4 @@ await Promise.allSettled([
167
203
  Slice Machine until your repository can upgrade.
168
204
 
169
205
  Learn more at https://prismic.io/docs/type-builder
170
- `);return}throw await gf(t),t}}export{};
206
+ `);return}throw await Pp(t),t}}export{};