prismic 1.7.0-pr.172.c0ea6d4 → 1.7.1

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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,s as ee,t as _,u as v,v as y,w as b,y as te}from"./string-Bf7FlVOu.mjs";import{n as ne,t as re}from"./package-BKXvjNLI.mjs";import{_ as ie,a as ae,c as oe,d as se,f as ce,i as le,l as ue,n as de,p as x,r as S,s as fe,u as C}from"./schemas-CyhgtjZl.mjs";import{a as w,f as pe,i as T,m as me,n as E,o as D,p as he,r as ge,t as _e,u as ve}from"./request-DClMWmnH.mjs";import{a as ye,s as be}from"./packageJson-BNFJTFZF.mjs";import{n as xe,t as Se}from"./env-DbZx_TgQ.mjs";import{a as Ce,c as we,i as O,n as Te,r as k,s as Ee,t as De}from"./auth-IehtWQjS.mjs";import{a as Oe,i as A,n as ke,r as Ae,t as je}from"./segment-D7x0tp4Y.mjs";import{t as Me}from"./update-notifier-D6eTWuXN.mjs";import*as Ne from"node:util";import{parseArgs as Pe,promisify as Fe}from"node:util";import{fileURLToPath as Ie,pathToFileURL as Le}from"node:url";import{createHash as Re}from"node:crypto";import{dirname as ze,join as Be,posix as Ve,sep as He}from"node:path";import{exec as Ue,execFile as We}from"node:child_process";import{Readable as Ge}from"node:stream";import{createInterface as Ke}from"node:readline";import*as qe from"node:http";import*as j from"node:os";import{setTimeout as Je}from"node:timers/promises";import{isMainThread as Ye,threadId as Xe}from"worker_threads";import*as Ze from"node:diagnostics_channel";import{subscribe as Qe}from"node:diagnostics_channel";import{createReadStream as $e,existsSync as et,readFile as tt,readFileSync as nt,readdir as rt}from"node:fs";import{Worker as it}from"node:worker_threads";import*as at from"node:https";import{createGzip as ot}from"node:zlib";import*as st from"node:net";import*as ct from"node:tls";import{AsyncLocalStorage as lt}from"node:async_hooks";function M(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=Pe({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(ut(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new P(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new P(`Missing required option: --${e}`);await t(s)}}function ut(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[_(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=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(h(e))}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=c.map(e=>[` ${e.left}`,e.description]);if(o.push(h(l)),n)for(let e in n){let t=_(n[e]);o.push(``),o.push(e);for(let e of t.split(`
2
+ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,s as ee,t as _,u as v,v as y,w as b,y as te}from"./string-Bf7FlVOu.mjs";import{n as ne,t as re}from"./package-DdAnd1UD.mjs";import{_ as ie,a as ae,c as oe,d as se,f as ce,i as le,l as ue,n as de,p as x,r as S,s as fe,u as C}from"./schemas-CyhgtjZl.mjs";import{a as w,f as pe,i as T,m as me,n as E,o as D,p as he,r as ge,t as _e,u as ve}from"./request-DClMWmnH.mjs";import{a as ye,s as be}from"./packageJson-BNFJTFZF.mjs";import{n as xe,t as Se}from"./env-DbZx_TgQ.mjs";import{a as Ce,c as we,i as O,n as Te,r as k,s as Ee,t as De}from"./auth-IehtWQjS.mjs";import{a as Oe,i as A,n as ke,r as Ae,t as je}from"./segment-dg1LJ1rm.mjs";import{t as Me}from"./update-notifier-BoGbRmc9.mjs";import*as Ne from"node:util";import{parseArgs as Pe,promisify as Fe}from"node:util";import{fileURLToPath as Ie,pathToFileURL as Le}from"node:url";import{createHash as Re}from"node:crypto";import{dirname as ze,join as Be,posix as Ve,sep as He}from"node:path";import{exec as Ue,execFile as We}from"node:child_process";import{Readable as Ge}from"node:stream";import{createInterface as Ke}from"node:readline";import*as qe from"node:http";import*as j from"node:os";import{setTimeout as Je}from"node:timers/promises";import{isMainThread as Ye,threadId as Xe}from"worker_threads";import*as Ze from"node:diagnostics_channel";import{subscribe as Qe}from"node:diagnostics_channel";import{createReadStream as $e,existsSync as et,readFile as tt,readFileSync as nt,readdir as rt}from"node:fs";import{Worker as it}from"node:worker_threads";import*as at from"node:https";import{createGzip as ot}from"node:zlib";import*as st from"node:net";import*as ct from"node:tls";import{AsyncLocalStorage as lt}from"node:async_hooks";function M(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=Pe({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(ut(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new P(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new P(`Missing required option: --${e}`);await t(s)}}function ut(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[_(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=[];for(let t in r){let n=r[t],i=n.description+(n.required?` (required)`:``);e.push([` <${t}>`,i])}o.push(h(e))}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=c.map(e=>[` ${e.left}`,e.description]);if(o.push(h(l)),n)for(let e in n){let t=_(n[e]);o.push(``),o.push(e);for(let e of t.split(`
3
3
  `))o.push(e?` ${e}`:``)}o.push(``),o.push(`LEARN MORE`);let u=e.name.split(` `)[0];return o.push(` Use \`${u} <command> --help\` for more information about a command.`),o.join(`
4
4
  `)}function N(e){let t=e.name.split(` `).length;return async function(){let{positionals:[n]}=Pe({args:process.argv.slice(1+t),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1}),r=n?e.commands[n]:void 0;if(r){await r.handler();return}if(n)throw new P(`Unknown command: ${n}`);console.info(dt(e))}}function dt(e){let{name:t,description:n,sections:r,commands:i}=e,a=[n];a.push(``),a.push(`USAGE`),a.push(` ${t} <command> [options]`),a.push(``),a.push(`COMMANDS`);let o=Object.entries(i).map(([e,t])=>[` ${e}`,t.description]);if(a.push(h(o)),a.push(``),a.push(`OPTIONS`),a.push(` -h, --help Show help for command`),r)for(let e in r){let t=_(r[e]);a.push(``),a.push(e);for(let e of t.split(`
5
5
  `))a.push(e?` ${e}`:``)}return a.push(``),a.push(`LEARN MORE`),a.push(` Use \`${t} <command> --help\` for more information about a command.`),a.join(`
@@ -13,7 +13,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
13
13
  Append #anchor to the path to view only the section under that heading.
14
14
  `,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(`#`),a=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1):void 0,s;try{s=await gt(a)}catch(e){throw e instanceof T?new P(`Failed to fetch page: ${await e.text()}`):e}if(o){let e=wt(s,o);if(!e)throw new P(`Anchor not found: #${o}`);s=e}if(r){console.info(D({path:a,anchor:o,content:s}));return}console.info(s)});function wt(e,t){let n=e.split(`
15
15
  `),r=new xt,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(`
16
- `).trim()}var Tt=N({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:vt,description:`List available documentation pages`},view:{handler:Ct,description:`View a documentation page`}}});function F(e){if(!Et(e))return e;let t=Dt(e);return Array.isArray(t.variations)&&(t.variations=t.variations.map(e=>Et(e)?Dt(e):e)),t}function Et(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Dt(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}const I={"to-slice":{type:`string`,description:`ID of the target slice`},"to-type":{type:`string`,description:`ID of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`}},Ot={"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:I.variation};async function kt(e,t){let n=await o(),{"from-slice":r,"from-type":i,variation:a=`default`}=t,s=[r,i].filter(Boolean).length;if(s===0)throw new P(`Specify a target with --from-slice or --from-type.`);if(s>1)throw new P(`Only one of --from-slice or --from-type can be specified.`);if(r){let t=await n.getSlice(r),i=t.model.variations.find(e=>e.id===a);if(!i)throw new P(`Variation "${a}" not found. Available: ${t.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return i.primary??={},R(i.primary,e),[i.primary,async()=>{await n.updateSlice(t.model),await n.generateTypes()},`slice`]}let c=await n.getCustomType(i),l=e.includes(`.`)?e.split(`.`)[0]:e,u;for(let e in c.model.json)l in c.model.json[e]&&(u=c.model.json[e]);if(!u)throw new P(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(c.model.json))).join(`, `)||`(none)`}`);return R(u,e),[u,async()=>{await n.updateCustomType(c.model),await n.generateTypes()},`customType`]}async function At(e,t,n){let r=await o(),{"from-slice":i,"from-type":a,variation:s=`default`}=n,c=[i,a].filter(Boolean).length;if(c===0)throw new P(`Specify a target with --from-slice or --from-type.`);if(c>1)throw new P(`Only one of --from-slice or --from-type can be specified.`);if(i){let e=await r.getSlice(i),t=e.model.variations.find(e=>e.id===s);if(!t)throw new P(`Variation "${s}" not found. Available: ${e.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return t.primary??={},[t.primary,t.primary,async()=>{await r.updateSlice(e.model),await r.generateTypes()},`slice`]}let l=await r.getCustomType(a),u=e.includes(`.`)?e.split(`.`)[0]:e,d=t.includes(`.`)?t.split(`.`)[0]:t,f,p;for(let e in l.model.json){let t=l.model.json[e];u in t&&(f=t),d in t&&(p=t)}let m=Object.keys(Object.assign({},...Object.values(l.model.json))).join(`, `)||`(none)`;if(!f)throw new P(`Field "${e}" not found. Available: ${m}`);if(!p)throw new P(`Field "${t}" not found. Available: ${m}`);return[f,p,async()=>{await r.updateCustomType(l.model),await r.generateTypes()},`customType`]}async function L(e){let t=await o(),n=e[`to-slice`]??e[`from-slice`],r=e[`to-type`]??e[`from-type`],i=[n,r].filter(Boolean).length;if(i===0)throw new P(`Specify a target with --to-slice or --to-type.`);if(i>1)throw new P(`Only one of --to-slice or --to-type can be specified.`);if(n){if(`tab`in e)throw new P(`--tab is only valid for content types.`);let r=e.variation??`default`,i=await t.getSlice(n),a=i.model.variations?.find(e=>e.id===r);if(!a)throw new P(`Variation "${r}" not found. Available: ${i.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return a.primary??={},[a.primary,async()=>{await t.updateSlice(i.model),await t.generateTypes()},`slice`]}if(`variation`in e)throw new P(`--variation is only valid for slices.`);let a=e.tab??`Main`,s=await t.getCustomType(r),c=s.model.json[a];if(!c)throw new P(`Tab "${a}" not found. Available: ${Object.keys(s.model.json).join(`, `)||`(none)`}`);return[c,async()=>{await t.updateCustomType(s.model),await t.generateTypes()},`customType`]}function R(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 P(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new P(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}const jt=[`Slices`,`UID`,`Choice`];async function Mt(e,t){let n=await o(),r=await n.getCustomType(t);return Nt(e,Object.assign({},...Object.values(r.model.json)),r.model.id,n,1)}async function Nt(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)Pt(r,t,n),a.push(r);else{let t=r.slice(0,e),n=r.slice(e+1);o.has(t)||o.set(t,[]),o.get(t).push(n)}}for(let[e,s]of o){let o=t[e];if(!o)throw new P(`Field "${e}" not found on type "${n}".`);if(o.type===`Group`){let t=await Nt(s,o.config?.fields??{},n,r,i);a.push({id:e,fields:t})}else if(o.type===`Link`&&o.config?.select===`document`){if(i<=0)throw new P(`Cannot nest deeper than --field group.cr.group.leaf.`);let t=o.config?.customtypes;if(!t||t.length!==1)throw new P(`Field "${e}" must be restricted to a single custom type to select fields from it.`);let n=typeof t[0]==`string`?t[0]:t[0].id,c=await r.getCustomType(n),l=await Nt(s,Object.assign({},...Object.values(c.model.json)),n,r,i-1);a.push({id:e,customtypes:[{id:n,fields:l}]})}else throw new P(`Field "${e}" is not a group or content relationship field.`)}return a}function Pt(e,t,n){if(!(e in t))throw new P(`Field "${e}" not found on type "${n}".`);if(jt.includes(t[e].type)||e===`uid`)throw new P(`Field "${e}" cannot be fetched from a content relationship.`);if(t[e].type===`Group`)throw new P(`Field "${e}" is a group. Select specific sub-fields with --field ${e}.<sub-field>.`)}function z(e){let{modelKind:t,targetId:n}=e;return t===`slice`?`Run \`prismic slice view ${n}\` to view the updated slice.`:`Run \`prismic type view ${n}\` to view the updated type.`}var Ft=M({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[s,c,l]=await L(t),[u,d]=R(s,n),f={type:`Boolean`,config:{label:r??b(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new P(`Field "${n}" already exists.`);u[d]=f,await c(),console.info(`Field added: ${n}`);let p=t[`to-slice`]??t[`to-type`];console.info(z({targetId:p,modelKind:l}))}),It=M({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Color`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),Lt=M({name:`prismic field add content-relationship`,description:`
16
+ `).trim()}var Tt=N({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:vt,description:`List available documentation pages`},view:{handler:Ct,description:`View a documentation page`}}});function F(e){let t=Et(e);return`variations`in t&&(t.variations=t.variations.map(e=>Et(e))),t}function Et(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}const I={"to-slice":{type:`string`,description:`ID of the target slice`},"to-type":{type:`string`,description:`ID of the target content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`},tab:{type:`string`,description:`Content type tab name (default: "Main")`}},Dt={"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:I.variation};async function Ot(e,t){let n=await o(),{"from-slice":r,"from-type":i,variation:a=`default`}=t,s=[r,i].filter(Boolean).length;if(s===0)throw new P(`Specify a target with --from-slice or --from-type.`);if(s>1)throw new P(`Only one of --from-slice or --from-type can be specified.`);if(r){let t=await n.getSlice(r),i=t.model.variations.find(e=>e.id===a);if(!i)throw new P(`Variation "${a}" not found. Available: ${t.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return i.primary??={},R(i.primary,e),[i.primary,async()=>{await n.updateSlice(t.model),await n.generateTypes()},`slice`]}let c=await n.getCustomType(i),l=e.includes(`.`)?e.split(`.`)[0]:e,u;for(let e in c.model.json)l in c.model.json[e]&&(u=c.model.json[e]);if(!u)throw new P(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(c.model.json))).join(`, `)||`(none)`}`);return R(u,e),[u,async()=>{await n.updateCustomType(c.model),await n.generateTypes()},`customType`]}async function kt(e,t,n){let r=await o(),{"from-slice":i,"from-type":a,variation:s=`default`}=n,c=[i,a].filter(Boolean).length;if(c===0)throw new P(`Specify a target with --from-slice or --from-type.`);if(c>1)throw new P(`Only one of --from-slice or --from-type can be specified.`);if(i){let e=await r.getSlice(i),t=e.model.variations.find(e=>e.id===s);if(!t)throw new P(`Variation "${s}" not found. Available: ${e.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return t.primary??={},[t.primary,t.primary,async()=>{await r.updateSlice(e.model),await r.generateTypes()},`slice`]}let l=await r.getCustomType(a),u=e.includes(`.`)?e.split(`.`)[0]:e,d=t.includes(`.`)?t.split(`.`)[0]:t,f,p;for(let e in l.model.json){let t=l.model.json[e];u in t&&(f=t),d in t&&(p=t)}let m=Object.keys(Object.assign({},...Object.values(l.model.json))).join(`, `)||`(none)`;if(!f)throw new P(`Field "${e}" not found. Available: ${m}`);if(!p)throw new P(`Field "${t}" not found. Available: ${m}`);return[f,p,async()=>{await r.updateCustomType(l.model),await r.generateTypes()},`customType`]}async function L(e){let t=await o(),n=e[`to-slice`]??e[`from-slice`],r=e[`to-type`]??e[`from-type`],i=[n,r].filter(Boolean).length;if(i===0)throw new P(`Specify a target with --to-slice or --to-type.`);if(i>1)throw new P(`Only one of --to-slice or --to-type can be specified.`);if(n){if(`tab`in e)throw new P(`--tab is only valid for content types.`);let r=e.variation??`default`,i=await t.getSlice(n),a=i.model.variations?.find(e=>e.id===r);if(!a)throw new P(`Variation "${r}" not found. Available: ${i.model.variations?.map(e=>e.id).join(`, `)||`(none)`}`);return a.primary??={},[a.primary,async()=>{await t.updateSlice(i.model),await t.generateTypes()},`slice`]}if(`variation`in e)throw new P(`--variation is only valid for slices.`);let a=e.tab??`Main`,s=await t.getCustomType(r),c=s.model.json[a];if(!c)throw new P(`Tab "${a}" not found. Available: ${Object.keys(s.model.json).join(`, `)||`(none)`}`);return[c,async()=>{await t.updateCustomType(s.model),await t.generateTypes()},`customType`]}function R(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 P(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new P(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}const At=[`Slices`,`UID`,`Choice`];async function jt(e,t){let n=await o(),r=await n.getCustomType(t);return Mt(e,Object.assign({},...Object.values(r.model.json)),r.model.id,n,1)}async function Mt(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)Nt(r,t,n),a.push(r);else{let t=r.slice(0,e),n=r.slice(e+1);o.has(t)||o.set(t,[]),o.get(t).push(n)}}for(let[e,s]of o){let o=t[e];if(!o)throw new P(`Field "${e}" not found on type "${n}".`);if(o.type===`Group`){let t=await Mt(s,o.config?.fields??{},n,r,i);a.push({id:e,fields:t})}else if(o.type===`Link`&&o.config?.select===`document`){if(i<=0)throw new P(`Cannot nest deeper than --field group.cr.group.leaf.`);let t=o.config?.customtypes;if(!t||t.length!==1)throw new P(`Field "${e}" must be restricted to a single custom type to select fields from it.`);let n=typeof t[0]==`string`?t[0]:t[0].id,c=await r.getCustomType(n),l=await Mt(s,Object.assign({},...Object.values(c.model.json)),n,r,i-1);a.push({id:e,customtypes:[{id:n,fields:l}]})}else throw new P(`Field "${e}" is not a group or content relationship field.`)}return a}function Nt(e,t,n){if(!(e in t))throw new P(`Field "${e}" not found on type "${n}".`);if(At.includes(t[e].type)||e===`uid`)throw new P(`Field "${e}" cannot be fetched from a content relationship.`);if(t[e].type===`Group`)throw new P(`Field "${e}" is a group. Select specific sub-fields with --field ${e}.<sub-field>.`)}function z(e){let{modelKind:t,targetId:n}=e;return t===`slice`?`Run \`prismic slice view ${n}\` to view the updated slice.`:`Run \`prismic type view ${n}\` to view the updated type.`}var Pt=M({name:`prismic field add boolean`,description:`Add a boolean field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[s,c,l]=await L(t),[u,d]=R(s,n),f={type:`Boolean`,config:{label:r??b(d),default_value:i,placeholder_true:a,placeholder_false:o}};if(d in u)throw new P(`Field "${n}" already exists.`);u[d]=f,await c(),console.info(`Field added: ${n}`);let p=t[`to-slice`]??t[`to-type`];console.info(z({targetId:p,modelKind:l}))}),Ft=M({name:`prismic field add color`,description:`Add a color field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Color`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),It=M({name:`prismic field add content-relationship`,description:`
17
17
  Add a content relationship field to a slice or custom type.
18
18
 
19
19
  Content relationships fetch and display data from related documents
@@ -42,7 +42,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
42
42
 
43
43
  Fetch fields from the related document:
44
44
  prismic field add content-relationship author --to-type blog_post --custom-type author --field name --field bio
45
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Restrict to documents with this tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Restrict to documents of this type (can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (can be repeated, requires one --custom-type)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,field:o}=t;if(o&&(!a||a.length!==1))throw new P(`--field requires exactly one --custom-type.`);let[s,c,l]=await L(t),[u,d]=R(s,n),f=a;if(o&&a){let e=await Mt(o,a[0]);f=[{id:a[0],fields:e}]}let p={type:`Link`,config:{label:r??b(d),select:`document`,tags:i,customtypes:f}};if(d in u)throw new P(`Field "${n}" already exists.`);u[d]=p,await c(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(z({targetId:m,modelKind:l}))}),Rt=M({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[o,s,c]=await L(t),[l,u]=R(o,n),d={type:`Date`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new P(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),zt=M({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Embed`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),Bt=M({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await L(t),[s,c]=R(i,n),l={type:`GeoPoint`,config:{label:r??b(c)}};if(c in s)throw new P(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(z({targetId:u,modelKind:o}))}),Vt=M({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await L(t),[s,c]=R(i,n),l={type:`Group`,config:{label:r??b(c)}};if(c in s)throw new P(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(z({targetId:u,modelKind:o}))}),Ht=M({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Image`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),Ut=M({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[o,s,c]=await L(t),[l,u]=R(o,n),d={type:`IntegrationFields`,config:{label:r??b(u),placeholder:i,catalog:a}};if(u in l)throw new P(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),Wt=M({name:`prismic field add link`,description:`Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.`,sections:{EXAMPLES:`
45
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},tag:{type:`string`,multiple:!0,description:`Restrict to documents with this tag (can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Restrict to documents of this type (can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (can be repeated, requires one --custom-type)`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,tag:i,"custom-type":a,field:o}=t;if(o&&(!a||a.length!==1))throw new P(`--field requires exactly one --custom-type.`);let[s,c,l]=await L(t),[u,d]=R(s,n),f=a;if(o&&a){let e=await jt(o,a[0]);f=[{id:a[0],fields:e}]}let p={type:`Link`,config:{label:r??b(d),select:`document`,tags:i,customtypes:f}};if(d in u)throw new P(`Field "${n}" already exists.`);u[d]=p,await c(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(z({targetId:m,modelKind:l}))}),Lt=M({name:`prismic field add date`,description:`Add a date field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[o,s,c]=await L(t),[l,u]=R(o,n),d={type:`Date`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new P(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),Rt=M({name:`prismic field add embed`,description:`Add an embed field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Embed`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),zt=M({name:`prismic field add geopoint`,description:`Add a geopoint field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await L(t),[s,c]=R(i,n),l={type:`GeoPoint`,config:{label:r??b(c)}};if(c in s)throw new P(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(z({targetId:u,modelKind:o}))}),Bt=M({name:`prismic field add group`,description:`Add a group field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await L(t),[s,c]=R(i,n),l={type:`Group`,config:{label:r??b(c)}};if(c in s)throw new P(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(z({targetId:u,modelKind:o}))}),Vt=M({name:`prismic field add image`,description:`Add an image field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Image`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),Ht=M({name:`prismic field add integration`,description:`Add an integration field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[o,s,c]=await L(t),[l,u]=R(o,n),d={type:`IntegrationFields`,config:{label:r??b(u),placeholder:i,catalog:a}};if(u in l)throw new P(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),Ut=M({name:`prismic field add link`,description:`Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.`,sections:{EXAMPLES:`
46
46
  Add a link that opens in a new tab:
47
47
  prismic field add link cta --to-type landing_page --allow-target-blank
48
48
 
@@ -51,7 +51,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
51
51
 
52
52
  Add a repeatable link with custom text:
53
53
  prismic field add link nav_item --to-type navigation --repeatable --allow-text
54
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},allow:{type:`string`,description:`Restrict to a link type: document, media, or web`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,r=[`document`,`media`,`web`],{label:i,allow:a,"allow-target-blank":o,"allow-text":s,repeatable:c,variant:l}=t;if(a&&!r.includes(a))throw new P(`--allow must be one of: ${r.join(`, `)}`);let u=a,[d,f,p]=await L(t),[m,h]=R(d,n),g={type:`Link`,config:{label:i??b(h),select:u,allowTargetBlank:o,allowText:s,repeat:c,variants:l}};if(h in m)throw new P(`Field "${n}" already exists.`);m[h]=g,await f(),console.info(`Field added: ${n}`);let ee=t[`to-slice`]??t[`to-type`];console.info(z({targetId:ee,modelKind:p}))}),Gt=M({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,a=Kt(t.min,`min`),o=Kt(t.max,`max`),s=Kt(t.step,`step`),[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`Number`,config:{label:r??b(f),placeholder:i,min:a,max:o,step:s}};if(f in d)throw new P(`Field "${n}" already exists.`);d[f]=p,await l(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(z({targetId:m,modelKind:u}))});function Kt(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new P(`--${t} must be a valid number, got "${e}"`);return n}var qt=M({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
54
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},allow:{type:`string`,description:`Restrict to a link type: document, media, or web`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab`},"allow-text":{type:`boolean`,description:`Allow custom link text`},repeatable:{type:`boolean`,description:`Allow multiple links`},variant:{type:`string`,multiple:!0,description:`Allowed variant (can be repeated)`}}},async({positionals:e,values:t})=>{let[n]=e,r=[`document`,`media`,`web`],{label:i,allow:a,"allow-target-blank":o,"allow-text":s,repeatable:c,variant:l}=t;if(a&&!r.includes(a))throw new P(`--allow must be one of: ${r.join(`, `)}`);let u=a,[d,f,p]=await L(t),[m,h]=R(d,n),g={type:`Link`,config:{label:i??b(h),select:u,allowTargetBlank:o,allowText:s,repeat:c,variants:l}};if(h in m)throw new P(`Field "${n}" already exists.`);m[h]=g,await f(),console.info(`Field added: ${n}`);let ee=t[`to-slice`]??t[`to-type`];console.info(z({targetId:ee,modelKind:p}))}),Wt=M({name:`prismic field add number`,description:`Add a number field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,a=Gt(t.min,`min`),o=Gt(t.max,`max`),s=Gt(t.step,`step`),[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`Number`,config:{label:r??b(f),placeholder:i,min:a,max:o,step:s}};if(f in d)throw new P(`Field "${n}" already exists.`);d[f]=p,await l(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(z({targetId:m,modelKind:u}))});function Gt(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new P(`--${t} must be a valid number, got "${e}"`);return n}var Kt=M({name:`prismic field add rich-text`,description:`Add a rich text field to a slice or custom type.`,sections:{BLOCKS:`
55
55
  heading1, heading2, heading3, heading4, heading5, heading6,
56
56
  paragraph, strong, em, preformatted, hyperlink, image, embed,
57
57
  list-item, o-list-item, rtl
@@ -61,19 +61,19 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
61
61
 
62
62
  Add a body field with only headings and paragraphs:
63
63
  prismic field add rich-text body --to-type blog_post --allow heading1,heading2,paragraph,strong,em,hyperlink
64
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`StructuredText`,config:{label:r??b(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new P(`Field "${n}" already exists.`);d[f]=p,await l(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(z({targetId:m,modelKind:u}))}),Jt=M({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,sections:{EXAMPLES:`
64
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`StructuredText`,config:{label:r??b(f),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:s}};if(f in d)throw new P(`Field "${n}" already exists.`);d[f]=p,await l(),console.info(`Field added: ${n}`);let m=t[`to-slice`]??t[`to-type`];console.info(z({targetId:m,modelKind:u}))}),qt=M({name:`prismic field add select`,description:`Add a select field to a slice or custom type.`,sections:{EXAMPLES:`
65
65
  Add a select with options:
66
66
  prismic field add select theme --to-type landing_page --option light --option dark --option brand
67
67
 
68
68
  With a default value:
69
69
  prismic field add select layout --to-type landing_page --option full --option centered --option sidebar --default-value full
70
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[s,c,l]=await L(t),[u,d]=R(s,n),f={type:`Select`,config:{label:r??b(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new P(`Field "${n}" already exists.`);u[d]=f,await c(),console.info(`Field added: ${n}`);let p=t[`to-slice`]??t[`to-type`];console.info(z({targetId:p,modelKind:l}))}),Yt=M({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await L(t),[s,c]=R(i,n),l={type:`Table`,config:{label:r??b(c)}};if(c in s)throw new P(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(z({targetId:u,modelKind:o}))}),Xt=M({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Text`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),Zt=M({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[o,s,c]=await L(t),[l,u]=R(o,n),d={type:`Timestamp`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new P(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),Qt=M({name:`prismic field add uid`,description:`Add a UID field to a content type.`,options:{"to-type":{type:`string`,description:`Name of the target content type`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({values:e})=>{let{label:t=`UID`,placeholder:n}=e,[r,i,a]=await L(e),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in r)throw new P(`Field "uid" already exists.`);r.uid=o,await i(),console.info(`Field added: uid`);let s=e[`to-type`];console.info(z({targetId:s,modelKind:a}))}),$t=N({name:`prismic field add`,description:`Add a field to a slice or custom type.`,sections:{"GROUP FIELDS":`
70
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[s,c,l]=await L(t),[u,d]=R(s,n),f={type:`Select`,config:{label:r??b(d),placeholder:i,default_value:a,options:o}};if(d in u)throw new P(`Field "${n}" already exists.`);u[d]=f,await c(),console.info(`Field added: ${n}`);let p=t[`to-slice`]??t[`to-type`];console.info(z({targetId:p,modelKind:l}))}),Jt=M({name:`prismic field add table`,description:`Add a table field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r}=t,[i,a,o]=await L(t),[s,c]=R(i,n),l={type:`Table`,config:{label:r??b(c)}};if(c in s)throw new P(`Field "${n}" already exists.`);s[c]=l,await a(),console.info(`Field added: ${n}`);let u=t[`to-slice`]??t[`to-type`];console.info(z({targetId:u,modelKind:o}))}),Yt=M({name:`prismic field add text`,description:`Add a text field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({positionals:e,values:t})=>{let[n]=e,{label:r,placeholder:i}=t,[a,o,s]=await L(t),[c,l]=R(a,n),u={type:`Text`,config:{label:r??b(l),placeholder:i}};if(l in c)throw new P(`Field "${n}" already exists.`);c[l]=u,await o(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:s}))}),Xt=M({name:`prismic field add timestamp`,description:`Add a timestamp field to a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...I,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}=t,[o,s,c]=await L(t),[l,u]=R(o,n),d={type:`Timestamp`,config:{label:r??b(u),placeholder:i,default:a}};if(u in l)throw new P(`Field "${n}" already exists.`);l[u]=d,await s(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),Zt=M({name:`prismic field add uid`,description:`Add a UID field to a content type.`,options:{"to-type":{type:`string`,description:`Name of the target content type`},tab:{type:`string`,description:`Content type tab name (default: "Main")`},label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`}}},async({values:e})=>{let{label:t=`UID`,placeholder:n}=e,[r,i,a]=await L(e),o={type:`UID`,config:{label:t,placeholder:n}};if(`uid`in r)throw new P(`Field "uid" already exists.`);r.uid=o,await i(),console.info(`Field added: uid`);let s=e[`to-type`];console.info(z({targetId:s,modelKind:a}))}),Qt=N({name:`prismic field add`,description:`Add a field to a slice or custom type.`,sections:{"GROUP FIELDS":`
71
71
  To add a field inside a group, use dot notation for the field ID:
72
72
 
73
73
  prismic field add text my_group.description --to-type blog_post
74
74
 
75
75
  The group must already exist. Only one level of nesting is supported.
76
- `},commands:{boolean:{handler:Ft,description:`Add a boolean field`},color:{handler:It,description:`Add a color field`},"content-relationship":{handler:Lt,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:Rt,description:`Add a date field`},embed:{handler:zt,description:`Add an embed field`},geopoint:{handler:Bt,description:`Add a geopoint field`},group:{handler:Vt,description:`Add a group field`},image:{handler:Ht,description:`Add an image field`},integration:{handler:Ut,description:`Add an integration field`},link:{handler:Wt,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:Gt,description:`Add a number field`},"rich-text":{handler:qt,description:`Add a rich text field`},select:{handler:Jt,description:`Add a select field`},table:{handler:Yt,description:`Add a table field`},text:{handler:Xt,description:`Add a text field`},timestamp:{handler:Zt,description:`Add a timestamp field`},uid:{handler:Qt,description:`Add a UID field`}}}),en=M({name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
76
+ `},commands:{boolean:{handler:Pt,description:`Add a boolean field`},color:{handler:Ft,description:`Add a color field`},"content-relationship":{handler:It,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:Lt,description:`Add a date field`},embed:{handler:Rt,description:`Add an embed field`},geopoint:{handler:zt,description:`Add a geopoint field`},group:{handler:Bt,description:`Add a group field`},image:{handler:Vt,description:`Add an image field`},integration:{handler:Ht,description:`Add an integration field`},link:{handler:Ut,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:Wt,description:`Add a number field`},"rich-text":{handler:Kt,description:`Add a rich text field`},select:{handler:qt,description:`Add a select field`},table:{handler:Jt,description:`Add a table field`},text:{handler:Yt,description:`Add a text field`},timestamp:{handler:Xt,description:`Add a timestamp field`},uid:{handler:Zt,description:`Add a UID field`}}}),$t=M({name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
77
77
  Options vary by field type. Only options matching the field's
78
78
  type will be applied. See \`prismic field add <type> --help\`
79
79
  for type-specific option details.
@@ -86,13 +86,13 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
86
86
 
87
87
  Restrict a rich text field to a single block:
88
88
  prismic field edit subtitle --from-type blog_post --single
89
- `},positionals:{id:{description:`Field ID`,required:!0}},options:{...Ot,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link)`},repeatable:{type:`boolean`,description:`Allow multiple links (link)`},variant:{type:`string`,multiple:!0,description:`Allowed variant (link/link-to-media, can be repeated)`},tag:{type:`string`,multiple:!0,description:`Allowed tag (content-relationship, can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (content-relationship, can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (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)`}}},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await kt(n,t),[a,o]=R(r,n),s=a[o];if(!s)throw new P(`Field "${n}" does not exist.`);switch(s.config??={},`label`in t&&(s.config.label=t.label),`placeholder`in t&&(s.config.placeholder=t.placeholder),s.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new P(`--default-value for boolean fields must be "true" or "false"`);s.config.default_value=e===`true`}`true-label`in t&&(s.config.placeholder_true=t[`true-label`]),`false-label`in t&&(s.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(s.config.min=tn(t.min,`min`)),`max`in t&&(s.config.max=tn(t.max,`max`)),`step`in t&&(s.config.step=tn(t.step,`step`));break;case`Select`:`default-value`in t&&(s.config.default_value=t[`default-value`]),`option`in t&&(s.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(s.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(s.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(s.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:s.config.multi??s.config.single;delete s.config.multi,s.config.single=e}else `allow`in t&&(`single`in s.config?s.config.single=t.allow:s.config.multi=t.allow);break;case`Link`:if(`allow-target-blank`in t&&(s.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(s.config.allowText=t[`allow-text`]),`repeatable`in t&&(s.config.repeat=t.repeatable),`variant`in t&&(s.config.variants=t.variant),`tag`in t&&(s.config.tags=t.tag),`field`in t){let e=`custom-type`in t?t[`custom-type`]:s.config.customtypes;if(!e||e.length===0)throw new P(`--field requires the field to be restricted to a custom type. Use --custom-type to specify one.`);if(e.length>1)throw new P(`--field requires the field to be restricted to a single custom type.`);let n=typeof e[0]==`string`?e[0]:e[0].id,r=await Mt(t.field,n);s.config.customtypes=[{id:n,fields:r}]}else `custom-type`in t&&(s.config.customtypes=t[`custom-type`]);break}await i(),console.info(`Field updated: ${n}`)});function tn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new P(`--${t} must be a valid number, got "${e}"`);return n}var nn=M({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Ot},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await kt(n,t),[a,o]=R(r,n);if(!(o in a))throw new P(`Field "${n}" does not exist.`);delete a[o],await i(),console.info(`Field removed: ${n}`)}),rn=M({name:`prismic field reorder`,description:`Reorder a field in a slice or custom type.`,positionals:{id:{description:`Field ID to move`,required:!0}},options:{before:{type:`string`,description:`Place field before this field ID`},after:{type:`string`,description:`Place field after this field ID`},"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`}}},async({positionals:e,values:t})=>{let[n]=e,{before:r,after:i}=t;if(!r&&!i)throw new P(`Specify --before or --after.`);if(r&&i)throw new P(`Only one of --before or --after can be specified.`);let a=r??i,o=r?`before`:`after`;if(n===a)throw new P(`Cannot reorder "${n}" relative to itself.`);let s=n.lastIndexOf(`.`),c=a.lastIndexOf(`.`);if((s===-1?``:n.slice(0,s))!==(c===-1?``:a.slice(0,c)))throw new P(`Cannot reorder "${n}" relative to "${a}": fields must be in the same container.`);let[l,u,d]=await At(n,a,t),[f,p]=R(l,n),[m,h]=R(u,a);if(!(p in f))throw new P(`Field "${n}" does not exist.`);if(!(h in m))throw new P(`Field "${a}" does not exist.`);let g=f[p];delete f[p];let ee=Object.entries(m);for(let e of Object.keys(m))delete m[e];for(let[e,t]of ee)o===`before`&&e===h&&(m[p]=g),m[e]=t,o===`after`&&e===h&&(m[p]=g);await d(),console.info(`Field reordered: ${n}`)}),an=M({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...Ot,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,[r]=await kt(n,t),[i,a]=R(r,n),o=i[a];if(!o)throw new P(`Field "${n}" does not exist.`);if(t.json){console.info(D({id:a,...o}));return}if(console.info(`Type: ${o.type}`),o.config){for(let[e,t]of Object.entries(o.config))if(t!==void 0)if(e===`fields`&&typeof t==`object`&&t){let e=Object.keys(t).join(`, `)||`(none)`;console.info(`Fields: ${e}`)}else Array.isArray(t)?console.info(`${b(e)}: ${t.join(`, `)}`):console.info(`${b(e)}: ${t}`)}}),on=N({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:$t,description:`Add a field`},edit:{handler:en,description:`Edit a field`},remove:{handler:nn,description:`Remove a field`},reorder:{handler:rn,description:`Reorder a field`},view:{handler:an,description:`View details of a field`}}}),sn=M({name:`prismic gen setup`,description:`
89
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...Dt,label:{type:`string`,description:`Field label`},placeholder:{type:`string`,description:`Placeholder text`},"default-value":{type:`string`,description:`Default value (boolean: true/false, select: option value)`},"true-label":{type:`string`,description:`Label for true value (boolean)`},"false-label":{type:`string`,description:`Label for false value (boolean)`},default:{type:`string`,description:`Default value (date/timestamp)`},min:{type:`string`,description:`Minimum value (number)`},max:{type:`string`,description:`Maximum value (number)`},step:{type:`string`,description:`Step increment (number)`},option:{type:`string`,multiple:!0,description:`Select option value (can be repeated)`},"allow-target-blank":{type:`boolean`,description:`Allow opening in new tab (link/rich-text)`},"allow-text":{type:`boolean`,description:`Allow custom link text (link)`},repeatable:{type:`boolean`,description:`Allow multiple links (link)`},variant:{type:`string`,multiple:!0,description:`Allowed variant (link/link-to-media, can be repeated)`},tag:{type:`string`,multiple:!0,description:`Allowed tag (content-relationship, can be repeated)`},"custom-type":{type:`string`,multiple:!0,description:`Allowed custom type (content-relationship, can be repeated)`},field:{type:`string`,multiple:!0,description:`Fetch this field from the related document (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)`}}},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await Ot(n,t),[a,o]=R(r,n),s=a[o];if(!s)throw new P(`Field "${n}" does not exist.`);switch(s.config??={},`label`in t&&(s.config.label=t.label),`placeholder`in t&&(s.config.placeholder=t.placeholder),s.type){case`Boolean`:if(`default-value`in t){let e=t[`default-value`];if(e!==`true`&&e!==`false`)throw new P(`--default-value for boolean fields must be "true" or "false"`);s.config.default_value=e===`true`}`true-label`in t&&(s.config.placeholder_true=t[`true-label`]),`false-label`in t&&(s.config.placeholder_false=t[`false-label`]);break;case`Number`:`min`in t&&(s.config.min=en(t.min,`min`)),`max`in t&&(s.config.max=en(t.max,`max`)),`step`in t&&(s.config.step=en(t.step,`step`));break;case`Select`:`default-value`in t&&(s.config.default_value=t[`default-value`]),`option`in t&&(s.config.options=t.option);break;case`Date`:case`Timestamp`:`default`in t&&(s.config.default=t.default);break;case`IntegrationFields`:`catalog`in t&&(s.config.catalog=t.catalog);break;case`StructuredText`:if(`allow-target-blank`in t&&(s.config.allowTargetBlank=t[`allow-target-blank`]),`single`in t){let e=`allow`in t?t.allow:s.config.multi??s.config.single;delete s.config.multi,s.config.single=e}else `allow`in t&&(`single`in s.config?s.config.single=t.allow:s.config.multi=t.allow);break;case`Link`:if(`allow-target-blank`in t&&(s.config.allowTargetBlank=t[`allow-target-blank`]),`allow-text`in t&&(s.config.allowText=t[`allow-text`]),`repeatable`in t&&(s.config.repeat=t.repeatable),`variant`in t&&(s.config.variants=t.variant),`tag`in t&&(s.config.tags=t.tag),`field`in t){let e=`custom-type`in t?t[`custom-type`]:s.config.customtypes;if(!e||e.length===0)throw new P(`--field requires the field to be restricted to a custom type. Use --custom-type to specify one.`);if(e.length>1)throw new P(`--field requires the field to be restricted to a single custom type.`);let n=typeof e[0]==`string`?e[0]:e[0].id,r=await jt(t.field,n);s.config.customtypes=[{id:n,fields:r}]}else `custom-type`in t&&(s.config.customtypes=t[`custom-type`]);break}await i(),console.info(`Field updated: ${n}`)});function en(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new P(`--${t} must be a valid number, got "${e}"`);return n}var tn=M({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Dt},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await Ot(n,t),[a,o]=R(r,n);if(!(o in a))throw new P(`Field "${n}" does not exist.`);delete a[o],await i(),console.info(`Field removed: ${n}`)}),nn=M({name:`prismic field reorder`,description:`Reorder a field in a slice or custom type.`,positionals:{id:{description:`Field ID to move`,required:!0}},options:{before:{type:`string`,description:`Place field before this field ID`},after:{type:`string`,description:`Place field after this field ID`},"from-slice":{type:`string`,description:`ID of the source slice`},"from-type":{type:`string`,description:`ID of the source content type`},variation:{type:`string`,description:`Slice variation ID (default: "default")`}}},async({positionals:e,values:t})=>{let[n]=e,{before:r,after:i}=t;if(!r&&!i)throw new P(`Specify --before or --after.`);if(r&&i)throw new P(`Only one of --before or --after can be specified.`);let a=r??i,o=r?`before`:`after`;if(n===a)throw new P(`Cannot reorder "${n}" relative to itself.`);let s=n.lastIndexOf(`.`),c=a.lastIndexOf(`.`);if((s===-1?``:n.slice(0,s))!==(c===-1?``:a.slice(0,c)))throw new P(`Cannot reorder "${n}" relative to "${a}": fields must be in the same container.`);let[l,u,d]=await kt(n,a,t),[f,p]=R(l,n),[m,h]=R(u,a);if(!(p in f))throw new P(`Field "${n}" does not exist.`);if(!(h in m))throw new P(`Field "${a}" does not exist.`);let g=f[p];delete f[p];let ee=Object.entries(m);for(let e of Object.keys(m))delete m[e];for(let[e,t]of ee)o===`before`&&e===h&&(m[p]=g),m[e]=t,o===`after`&&e===h&&(m[p]=g);await d(),console.info(`Field reordered: ${n}`)}),rn=M({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...Dt,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,[r]=await Ot(n,t),[i,a]=R(r,n),o=i[a];if(!o)throw new P(`Field "${n}" does not exist.`);if(t.json){console.info(D({id:a,...o}));return}if(console.info(`Type: ${o.type}`),o.config){for(let[e,t]of Object.entries(o.config))if(t!==void 0)if(e===`fields`&&typeof t==`object`&&t){let e=Object.keys(t).join(`, `)||`(none)`;console.info(`Fields: ${e}`)}else Array.isArray(t)?console.info(`${b(e)}: ${t.join(`, `)}`):console.info(`${b(e)}: ${t}`)}}),an=N({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:Qt,description:`Add a field`},edit:{handler:$t,description:`Edit a field`},remove:{handler:tn,description:`Remove a field`},reorder:{handler:nn,description:`Reorder a field`},view:{handler:rn,description:`View details of a field`}}}),on=M({name:`prismic gen setup`,description:`
90
90
  Generate framework-specific setup files for a Prismic project.
91
91
 
92
92
  Installs dependencies, creates the Prismic client file, slice simulator
93
93
  page, preview routes, and other files required by the detected framework.
94
94
  Skips files that already exist.
95
- `,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await o()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await ye()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),cn=M({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await o()).generateTypes(),t=me(await u(),e);console.info(`Generated types at ${t}`)}),ln=N({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`}}});async function un(e){let{repo:t,token:n,host:r}=e,i=Sn(r),a=new URL(`customtypes`,i);try{return await w(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function dn(e,t){let{repo:n,token:r,host:i}=t,a=Sn(i);await w(new URL(`customtypes/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function fn(e,t){let{repo:n,token:r,host:i}=t,a=Sn(i);await w(new URL(`customtypes/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function pn(e,t){let{repo:n,token:r,host:i}=t,a=Sn(i);await w(new URL(`customtypes/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}async function mn(e){let{repo:t,token:n,host:r}=e,i=Sn(r),a=new URL(`slices`,i);try{return await w(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function hn(e,t){let{repo:n,token:r,host:i}=t,a=Sn(i);await w(new URL(`slices/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function gn(e,t){let{repo:n,token:r,host:i}=t,a=Sn(i);await w(new URL(`slices/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function _n(e,t){let{repo:n,token:r,host:i}=t,a=Sn(i);await w(new URL(`slices/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}const vn=C({values:C({url:x(),fields:ce(x(),x())}),imgixEndpoint:x()}),yn={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function bn(e,t){let{sliceId:n,variationId:r,repo:i,token:a,host:o}=t,s=e.type;if(!(s in yn))throw new xn(s);let c=await w(new URL(`create`,Cn(o)),{headers:{Repository:i,Authorization:`Bearer ${a}`},schema:vn}),l=yn[s],u=`${i}/shared-slices/${n}/${r}/${Re(`md5`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${l}`,d=new FormData;for(let[e,t]of Object.entries(c.values.fields))d.append(e,t);d.append(`key`,u),d.append(`Content-Type`,s),d.append(`file`,e),await w(c.values.url,{method:`POST`,body:d});let f=new URL(u,pe(c.imgixEndpoint));return f.searchParams.set(`auto`,`compress,format`),f}var xn=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){super(`Unsupported file type: ${e||`unknown`}. Supported: ${Object.keys(yn).join(`, `)}`)}};function Sn(e){return new URL(`https://customtypes.${e}/`)}function Cn(e){return new URL(`https://acl-provider.${e}/`)}function wn(e){Ue(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start ""`:`xdg-open`} "${e.toString()}"`)}function B(e,t,n){let{getKey:r}=n,i={insert:[],update:[],delete:[]};for(let n of e){let e=t.find(e=>r(e)===r(n));e?JSON.stringify(n)!==JSON.stringify(e)&&i.update.push(n):i.insert.push(n)}for(let n of t)e.some(e=>r(e)===r(n))||i.delete.push(n);return i}const Tn=C({documentsPublished:le(),documentsUnpublished:le(),releasesCreated:le(),releasesUpdated:le(),tagsCreated:le(),tagsDeleted:le()}),En=Object.keys(Tn.shape),Dn=C({config:ae(Tn,{_id:x(),url:x(),active:le(),name:oe(x()),secret:oe(x()),headers:ce(x(),x())})});async function On(e){let{repo:t,token:n,host:r}=e,i=V(t,r),a=new URL(`app/settings/webhooks`,i);try{return await w(a,{credentials:{"prismic-auth":n},schema:S(Dn)})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function kn(e,t){let{repo:n,token:r,host:i}=t,a=V(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());try{await w(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function An(e,t,n){let{repo:r,token:i,host:a}=n,o=V(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());try{await w(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof E&&(e.message=`Webhook not found`),e}}async function jn(e,t){let{repo:n,token:r,host:i}=t,a=V(n,i),o=new URL(`app/settings/webhooks/${e}/delete`,a);try{await w(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Webhook not found`),e}}const Mn=C({id:x(),scope:x(),token:x(),created_at:C({$date:ue()})}),Nn=C({id:x(),name:x(),wroom_auths:S(Mn)}),Pn=C({app_name:x(),token:x(),timestamp:ue()}),Fn=C({max_tokens:ue(),tokens:S(Pn)});async function In(e){let t=new URL(`settings/security/contentapi`,V(e.repo,e.host));try{return await w(t,{credentials:{"prismic-auth":e.token},schema:S(Nn)})}catch(t){throw t instanceof E&&(t.message=`Repository not found: ${e.repo}`),t}}async function Ln(e,t){let n=new URL(`settings/security/oauthapp`,V(t.repo,t.host));try{return await w(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Nn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t.repo}`),e}}async function Rn(e,t,n){let r=new URL(`settings/security/authorizations`,V(n.repo,n.host));try{return await w(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Mn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n.repo}`),e}}async function zn(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await w(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof E&&(e.message=`Token not found`),e}}async function Bn(e){let t=new URL(`settings/security/customtypesapi`,V(e.repo,e.host));try{return await w(t,{credentials:{"prismic-auth":e.token},schema:Fn})}catch(t){throw t instanceof E&&(t.message=`Repository not found: ${e.repo}`),t}}async function Vn(e,t){let n=new URL(`settings/security/token`,V(t.repo,t.host));try{return await w(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Pn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t.repo}`),e}}async function Hn(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await w(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof E&&(t.message=`Token not found: ${e}`),t}}async function Un(e){let{domain:t,token:n,host:r}=e;return await w(new URL(`app/dashboard/repositories/${t}/exists`,Xn(r)),{credentials:{"prismic-auth":n},schema:le()})}async function Wn(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await w(new URL(`app/dashboard/repositories`,Xn(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Gn=C({repository:C({api_access:x()})});async function Kn(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,V(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:Gn})).repository.api_access}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function qn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,V(n,i));try{await w(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}const Jn=C({repository:C({name:x()})});async function Yn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,V(n,i)),o=new FormData;o.set(`displayname`,e);try{return(await w(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:Jn})).repository.name}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}function Xn(e){return new URL(`https://${e}/`)}function V(e,t){return new URL(`https://${e}.${t}/`)}var Zn=M({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 O(),r=await k(),i=await Qn({name:t,token:n,host:r});console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Qn(e){let{name:t,token:n,host:r}=e,i=await $n({token:n,host:r});if(!i)throw new P(`Failed to create a repository. Please try again.`);let a=(await o().catch(()=>void 0))?.id??`other`;try{await Wn({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof T?new P(`Failed to create repository: ${await e.text()}`):e}return i}async function $n(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 er=M({name:`prismic init`,description:`
95
+ `,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await o()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await ye()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),sn=M({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await o()).generateTypes(),t=me(await u(),e);console.info(`Generated types at ${t}`)}),cn=N({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:on,description:`Generate framework-specific Prismic setup`},types:{handler:sn,description:`Generate TypeScript types from local models`}}});async function ln(e){let{repo:t,token:n,host:r}=e,i=xn(r),a=new URL(`customtypes`,i);try{return await w(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function un(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await w(new URL(`customtypes/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function dn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await w(new URL(`customtypes/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function fn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await w(new URL(`customtypes/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}async function pn(e){let{repo:t,token:n,host:r}=e,i=xn(r),a=new URL(`slices`,i);try{return await w(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function mn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await w(new URL(`slices/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function hn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await w(new URL(`slices/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function gn(e,t){let{repo:n,token:r,host:i}=t,a=xn(i);await w(new URL(`slices/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}const _n=C({values:C({url:x(),fields:ce(x(),x())}),imgixEndpoint:x()}),vn={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function yn(e,t){let{sliceId:n,variationId:r,repo:i,token:a,host:o}=t,s=e.type;if(!(s in vn))throw new bn(s);let c=await w(new URL(`create`,Sn(o)),{headers:{Repository:i,Authorization:`Bearer ${a}`},schema:_n}),l=vn[s],u=`${i}/shared-slices/${n}/${r}/${Re(`md5`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${l}`,d=new FormData;for(let[e,t]of Object.entries(c.values.fields))d.append(e,t);d.append(`key`,u),d.append(`Content-Type`,s),d.append(`file`,e),await w(c.values.url,{method:`POST`,body:d});let f=new URL(u,pe(c.imgixEndpoint));return f.searchParams.set(`auto`,`compress,format`),f}var bn=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){super(`Unsupported file type: ${e||`unknown`}. Supported: ${Object.keys(vn).join(`, `)}`)}};function xn(e){return new URL(`https://customtypes.${e}/`)}function Sn(e){return new URL(`https://acl-provider.${e}/`)}function Cn(e){Ue(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start ""`:`xdg-open`} "${e.toString()}"`)}function B(e,t,n){let{getKey:r,equals:i=(e,t)=>JSON.stringify(e)===JSON.stringify(t)}=n,a={insert:[],update:[],delete:[]};for(let n of e){let e=t.find(e=>r(e)===r(n));e?i(n,e)||a.update.push(n):a.insert.push(n)}for(let n of t)e.some(e=>r(e)===r(n))||a.delete.push(n);return a}const wn=C({documentsPublished:le(),documentsUnpublished:le(),releasesCreated:le(),releasesUpdated:le(),tagsCreated:le(),tagsDeleted:le()}),Tn=Object.keys(wn.shape),En=C({config:ae(wn,{_id:x(),url:x(),active:le(),name:oe(x()),secret:oe(x()),headers:ce(x(),x())})});async function Dn(e){let{repo:t,token:n,host:r}=e,i=V(t,r),a=new URL(`app/settings/webhooks`,i);try{return await w(a,{credentials:{"prismic-auth":n},schema:S(En)})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function On(e,t){let{repo:n,token:r,host:i}=t,a=V(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());try{await w(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function kn(e,t,n){let{repo:r,token:i,host:a}=n,o=V(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());try{await w(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof E&&(e.message=`Webhook not found`),e}}async function An(e,t){let{repo:n,token:r,host:i}=t,a=V(n,i),o=new URL(`app/settings/webhooks/${e}/delete`,a);try{await w(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Webhook not found`),e}}const jn=C({id:x(),scope:x(),token:x(),created_at:C({$date:ue()})}),Mn=C({id:x(),name:x(),wroom_auths:S(jn)}),Nn=C({app_name:x(),token:x(),timestamp:ue()}),Pn=C({max_tokens:ue(),tokens:S(Nn)});async function Fn(e){let t=new URL(`settings/security/contentapi`,V(e.repo,e.host));try{return await w(t,{credentials:{"prismic-auth":e.token},schema:S(Mn)})}catch(t){throw t instanceof E&&(t.message=`Repository not found: ${e.repo}`),t}}async function In(e,t){let n=new URL(`settings/security/oauthapp`,V(t.repo,t.host));try{return await w(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Mn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t.repo}`),e}}async function Ln(e,t,n){let r=new URL(`settings/security/authorizations`,V(n.repo,n.host));try{return await w(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:jn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n.repo}`),e}}async function Rn(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await w(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof E&&(e.message=`Token not found`),e}}async function zn(e){let t=new URL(`settings/security/customtypesapi`,V(e.repo,e.host));try{return await w(t,{credentials:{"prismic-auth":e.token},schema:Pn})}catch(t){throw t instanceof E&&(t.message=`Repository not found: ${e.repo}`),t}}async function Bn(e,t){let n=new URL(`settings/security/token`,V(t.repo,t.host));try{return await w(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:Nn})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t.repo}`),e}}async function Vn(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await w(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof E&&(t.message=`Token not found: ${e}`),t}}async function Hn(e){let{domain:t,token:n,host:r}=e;return await w(new URL(`app/dashboard/repositories/${t}/exists`,Yn(r)),{credentials:{"prismic-auth":n},schema:le()})}async function Un(e){let{domain:t,name:n,framework:r,token:i,host:a}=e;await w(new URL(`app/dashboard/repositories`,Yn(a)),{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":i}})}const Wn=C({repository:C({api_access:x()})});async function Gn(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,V(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:Wn})).repository.api_access}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function Kn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,V(n,i));try{await w(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}const qn=C({repository:C({name:x()})});async function Jn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`app/settings/repository`,V(n,i)),o=new FormData;o.set(`displayname`,e);try{return(await w(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:qn})).repository.name}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}function Yn(e){return new URL(`https://${e}/`)}function V(e,t){return new URL(`https://${e}.${t}/`)}var Xn=M({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 O(),r=await k(),i=await Zn({name:t,token:n,host:r});console.info(`Repository created: ${i}`),console.info(`URL: https://${i}.${r}/`)});async function Zn(e){let{name:t,token:n,host:r}=e,i=await Qn({token:n,host:r});if(!i)throw new P(`Failed to create a repository. Please try again.`);let a=(await o().catch(()=>void 0))?.id??`other`;try{await Un({domain:i,name:t??i,framework:a,token:n,host:r})}catch(e){throw e instanceof T?new P(`Failed to create repository: ${await e.text()}`):e}return i}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 Hn({domain:e,token:t,host:n})){r=e;break}}return r}var $n=M({name:`prismic init`,description:`
96
96
  Initialize a new Prismic project by creating a repository and
97
97
  prismic.config.json file. Detects the project framework, installs
98
98
  dependencies, and syncs models from Prismic.
@@ -100,42 +100,42 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
100
100
  Use --repo to connect to an existing repository instead. If a
101
101
  slicemachine.config.json exists, its repository and settings will be
102
102
  migrated.
103
- `,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 y(),new P(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof c))throw e}let i;try{i=await te()}catch(e){e instanceof g&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let a=await O(),s=await k(),u;try{u=await r({token:a,host:s})}catch(e){if(e instanceof ge||e instanceof _e){console.info(`Not logged in. Starting login...`);let{email:e}=await Te({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}`),wn(e))}});console.info(`Logged in as ${e}`),a=await O(),u=await r({token:a,host:s})}else throw e}let f=t??i?.repositoryName;if(f){if(!u.repositories.some(e=>e.domain===f))throw new P(`Repository "${f}" not found in your account. Check the name or request access to the repository.`);if(!await l(f,{token:a,host:s}))throw new p}let h=await o();f||(f=await Qn({token:a,host:s}),console.info(`Created repository: ${f}`));try{let e=s===Se?void 0:`https://${f}.cdn.${s}/api/v2/`;await m({repositoryName:f,documentAPIEndpoint:e,libraries:i?.libraries,routes:[]})}catch(e){throw e instanceof v?new P(`Could not find a package.json file. Run this command from a project directory.`):new P(`Failed to create prismic.config.json.`)}if(i){try{await d()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await h.initProject();try{console.info(`Installing dependencies...`),await ye()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}let[ee,_,b,ne]=await Promise.all([un({repo:f,token:a,host:s}),mn({repo:f,token:a,host:s}),h.getCustomTypes(),h.getSlices()]),re=b.map(e=>e.model),ie=B(_,ne.map(e=>e.model),{getKey:e=>e.id});for(let e of ie.update)await h.updateSlice(e);for(let e of ie.delete)await h.deleteSlice(e.id);for(let e of ie.insert)await h.createSlice(e);let ae=B(ee,re,{getKey:e=>e.id});for(let e of ae.update)await h.updateCustomType(e);for(let e of ae.delete)await h.deleteCustomType(e.id);for(let e of ae.insert)await h.createCustomType(e);await h.generateTypes(),console.info(`\nInitialized Prismic for repository "${f}".`),console.info("Run `prismic type create <name>` to create a content type."),console.info("Run `prismic sync` to sync models from Prismic.")});const tr=C({id:x(),label:x(),customName:oe(x()),isMaster:le()});async function nr(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,ar(r));i.searchParams.set(`repository`,t);try{return(await w(i,{headers:{Authorization:`Bearer ${n}`},schema:C({results:S(tr)})})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function rr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,ar(i));a.searchParams.set(`repository`,n);try{return await w(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:tr})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function ir(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,ar(i));a.searchParams.set(`repository`,n),await w(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function ar(e){return new URL(`https://api.internal.${e}/locale/`)}const or=C({results:S(C({id:x(),label:x(),url:x()}))});async function sr(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository/preview_configs`,hr(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:or})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function cr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/new`,hr(n,i));try{await w(a,{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function lr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/delete/${e}`,hr(n,i));try{await w(a,{method:`POST`,body:{},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Preview not found`),e}}const ur=C({kind:de([`prod`,`stage`,`dev`]),name:x(),domain:x(),users:S(C({id:x()}))});async function dr(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/environments`,hr(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:C({results:S(ur)})})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}const fr=C({simulator_url:se(x())});async function pr(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository`,hr(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:fr})).simulator_url}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function mr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`core/repository`,hr(n,i));try{await w(a,{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}function hr(e,t){return new URL(`https://${e}.${t}/`)}async function H(e,t){let{repo:n,token:i,host:a}=t,[o,s]=await Promise.all([r({token:i,host:a}),dr({repo:n,token:i,host:a})]),c=s.filter(e=>(e.kind===`prod`||e.kind===`stage`)&&e.users.some(e=>e.id===o.shortId)),l=c.find(t=>t.domain===e);if(l)return l.domain;throw new gr(e,c,n)}var gr=class extends Error{name=`InvalidEnvironmentError`;repo;env;availableEnvironments;constructor(e,t,n){super(),this.repo=n,this.env=e,this.availableEnvironments=t}},_r=M({name:`prismic locale add`,description:`
103
+ `,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 y(),new P(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof c))throw e}let i;try{i=await te()}catch(e){e instanceof g&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let a=await O(),s=await k(),u;try{u=await r({token:a,host:s})}catch(e){if(e instanceof ge||e instanceof _e){console.info(`Not logged in. Starting login...`);let{email:e}=await Te({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}`),Cn(e))}});console.info(`Logged in as ${e}`),a=await O(),u=await r({token:a,host:s})}else throw e}let f=t??i?.repositoryName;if(f){if(!u.repositories.some(e=>e.domain===f))throw new P(`Repository "${f}" not found in your account. Check the name or request access to the repository.`);if(!await l(f,{token:a,host:s}))throw new p}let h=await o();f||(f=await Zn({token:a,host:s}),console.info(`Created repository: ${f}`));try{let e=s===Se?void 0:`https://${f}.cdn.${s}/api/v2/`;await m({repositoryName:f,documentAPIEndpoint:e,libraries:i?.libraries,routes:[]})}catch(e){throw e instanceof v?new P(`Could not find a package.json file. Run this command from a project directory.`):new P(`Failed to create prismic.config.json.`)}if(i){try{await d()}catch{}console.info(`Migrated slicemachine.config.json to prismic.config.json`)}await h.initProject();try{console.info(`Installing dependencies...`),await ye()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}let[ee,_,b,ne]=await Promise.all([ln({repo:f,token:a,host:s}),pn({repo:f,token:a,host:s}),h.getCustomTypes(),h.getSlices()]),re=b.map(e=>e.model),ie=B(_,ne.map(e=>e.model),{getKey:e=>e.id});for(let e of ie.update)await h.updateSlice(e);for(let e of ie.delete)await h.deleteSlice(e.id);for(let e of ie.insert)await h.createSlice(e);let ae=B(ee,re,{getKey:e=>e.id});for(let e of ae.update)await h.updateCustomType(e);for(let e of ae.delete)await h.deleteCustomType(e.id);for(let e of ae.insert)await h.createCustomType(e);await h.generateTypes(),console.info(`\nInitialized Prismic for repository "${f}".`),console.info("Run `prismic type create <name>` to create a content type."),console.info("Run `prismic sync` to sync models from Prismic.")});const er=C({id:x(),label:x(),customName:oe(x()),isMaster:le()});async function tr(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,ir(r));i.searchParams.set(`repository`,t);try{return(await w(i,{headers:{Authorization:`Bearer ${n}`},schema:C({results:S(er)})})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function nr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,ir(i));a.searchParams.set(`repository`,n);try{return await w(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:er})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function rr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,ir(i));a.searchParams.set(`repository`,n),await w(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function ir(e){return new URL(`https://api.internal.${e}/locale/`)}const ar=C({results:S(C({id:x(),label:x(),url:x()}))});async function or(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository/preview_configs`,mr(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:ar})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function sr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/new`,mr(n,i));try{await w(a,{method:`POST`,body:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}async function cr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`previews/delete/${e}`,mr(n,i));try{await w(a,{method:`POST`,body:{},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Preview not found`),e}}const lr=C({kind:de([`prod`,`stage`,`dev`]),name:x(),domain:x(),users:S(C({id:x()}))});async function ur(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/environments`,mr(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:C({results:S(lr)})})).results}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}const dr=C({simulator_url:se(x())});async function fr(e){let{repo:t,token:n,host:r}=e,i=new URL(`core/repository`,mr(t,r));try{return(await w(i,{credentials:{"prismic-auth":n},schema:dr})).simulator_url}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${t}`),e}}async function pr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`core/repository`,mr(n,i));try{await w(a,{method:`PATCH`,body:{simulator_url:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof E&&(e.message=`Repository not found: ${n}`),e}}function mr(e,t){return new URL(`https://${e}.${t}/`)}async function H(e,t){let{repo:n,token:i,host:a}=t,[o,s]=await Promise.all([r({token:i,host:a}),ur({repo:n,token:i,host:a})]),c=s.filter(e=>(e.kind===`prod`||e.kind===`stage`)&&e.users.some(e=>e.id===o.shortId)),l=c.find(t=>t.domain===e);if(l)return l.domain;throw new hr(e,c,n)}var hr=class extends Error{name=`InvalidEnvironmentError`;repo;env;availableEnvironments;constructor(e,t,n){super(),this.repo=n,this.env=e,this.availableEnvironments=t}},gr=M({name:`prismic locale add`,description:`
104
104
  Add a locale to a Prismic repository.
105
105
 
106
106
  By default, this command reads the repository from prismic.config.json at the
107
107
  project root.
108
- `,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,master:o=!1,name:s}=t,c=await O(),l=await k(),u=i?await H(i,{repo:r,token:c,host:l}):r;try{await rr({id:n,isMaster:o,customName:s},{repo:u,token:c,host:l})}catch(e){throw e instanceof T?new P(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),vr=M({name:`prismic locale list`,description:`
108
+ `,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,master:o=!1,name:s}=t,c=await O(),l=await k(),u=i?await H(i,{repo:r,token:c,host:l}):r;try{await nr({id:n,isMaster:o,customName:s},{repo:u,token:c,host:l})}catch(e){throw e instanceof T?new P(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),_r=M({name:`prismic locale list`,description:`
109
109
  List all locales in a Prismic repository.
110
110
 
111
111
  By default, this command reads the repository from prismic.config.json at the
112
112
  project root.
113
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c;try{c=await nr({repo:s,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to list locales: ${await e.text()}`):e}if(r){console.info(D(c));return}if(c.length===0){console.info(`No locales found.`);return}let l=c.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(h(l,{headers:[`ID`,`LABEL`]}))}),yr=M({name:`prismic locale remove`,description:`
113
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c;try{c=await tr({repo:s,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to list locales: ${await e.text()}`):e}if(r){console.info(D(c));return}if(c.length===0){console.info(`No locales found.`);return}let l=c.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(h(l,{headers:[`ID`,`LABEL`]}))}),vr=M({name:`prismic locale remove`,description:`
114
114
  Remove a locale from a Prismic repository.
115
115
 
116
116
  By default, this command reads the repository from prismic.config.json at the
117
117
  project root.
118
- `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r;try{await ir(n,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),br=M({name:`prismic locale set-master`,description:`
118
+ `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r;try{await rr(n,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),yr=M({name:`prismic locale set-master`,description:`
119
119
  Set the master locale for a Prismic repository.
120
120
 
121
121
  By default, this command reads the repository from prismic.config.json at the
122
122
  project root.
123
- `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await nr({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to set master locale: ${await e.text()}`):e}let u=l.find(e=>e.id===n);if(!u)throw new P(`Locale "${n}" not found. Available locales: ${l.map(e=>e.id).join(`, `)}`);if(u.isMaster)throw new P(`Locale "${n}" is already the master.`);try{await rr({id:u.id,isMaster:!0,customName:u.customName??void 0},{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),xr=N({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:_r,description:`Add a locale`},list:{handler:vr,description:`List locales`},remove:{handler:yr,description:`Remove a locale`},"set-master":{handler:br,description:`Set the master locale`}}}),Sr=M({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 Te({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}`),wn(e))}});console.info(`Logged in to Prismic as ${n}`)}),Cr=M({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await Ce())console.info(`Logged out of Prismic`);else throw new P(`Logout failed. You can log out manually by deleting the file.`)}),wr=M({name:`prismic preview add`,description:`
123
+ `,positionals:{code:{description:`Locale code (e.g. en-us, fr-fr)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await tr({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to set master locale: ${await e.text()}`):e}let u=l.find(e=>e.id===n);if(!u)throw new P(`Locale "${n}" not found. Available locales: ${l.map(e=>e.id).join(`, `)}`);if(u.isMaster)throw new P(`Locale "${n}" is already the master.`);try{await nr({id:u.id,isMaster:!0,customName:u.customName??void 0},{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),br=N({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:gr,description:`Add a locale`},list:{handler:_r,description:`List locales`},remove:{handler:vr,description:`Remove a locale`},"set-master":{handler:yr,description:`Set the master locale`}}}),xr=M({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 Te({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}`),Cn(e))}});console.info(`Logged in to Prismic as ${n}`)}),Sr=M({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await Ce())console.info(`Logged out of Prismic`);else throw new P(`Logout failed. You can log out manually by deleting the file.`)}),Cr=M({name:`prismic preview add`,description:`
124
124
  Add a preview configuration to a Prismic repository.
125
125
 
126
126
  By default, this command reads the repository from prismic.config.json at the
127
127
  project root.
128
- `,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,name:o}=t,s;try{s=new URL(n)}catch{throw new P(`Invalid URL: ${n}`)}let c=o||s.hostname,l=`${s.protocol}//${s.host}`,u=s.pathname===`/`?void 0:s.pathname,d=await O(),f=await k(),p=i?await H(i,{repo:r,token:d,host:f}):r;try{await cr({name:c,websiteURL:l,resolverPath:u},{repo:p,token:d,host:f})}catch(e){throw e instanceof T?new P(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`),console.info("Run `prismic preview set-simulator <url>` to set the slice simulator URL.")}),Tr=M({name:`prismic preview list`,description:`
128
+ `,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,name:o}=t,s;try{s=new URL(n)}catch{throw new P(`Invalid URL: ${n}`)}let c=o||s.hostname,l=`${s.protocol}//${s.host}`,u=s.pathname===`/`?void 0:s.pathname,d=await O(),f=await k(),p=i?await H(i,{repo:r,token:d,host:f}):r;try{await sr({name:c,websiteURL:l,resolverPath:u},{repo:p,token:d,host:f})}catch(e){throw e instanceof T?new P(`Failed to add preview: ${await e.text()}`):e}console.info(`Preview added: ${n}`),console.info("Run `prismic preview set-simulator <url>` to set the slice simulator URL.")}),wr=M({name:`prismic preview list`,description:`
129
129
  List all preview configurations in a Prismic repository.
130
130
 
131
131
  By default, this command reads the repository from prismic.config.json at the
132
132
  project root.
133
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c,l;try{[c,l]=await Promise.all([sr({repo:s,token:i,host:o}),pr({repo:s,token:i,host:o})])}catch(e){throw e instanceof T?new P(`Failed to list previews: ${await e.text()}`):e}if(r){console.info(D({previews:c,simulatorUrl:l??null}));return}if(c.length===0&&!l){console.info(`No preview configurations found.`);return}if(c.length>0){let e=c.map(e=>[e.url,e.label]);console.info(h(e,{headers:[`URL`,`NAME`]}))}l&&(c.length>0&&console.info(``),console.info(`Simulator: ${l}`))}),Er=M({name:`prismic preview remove`,description:`
133
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c,l;try{[c,l]=await Promise.all([or({repo:s,token:i,host:o}),fr({repo:s,token:i,host:o})])}catch(e){throw e instanceof T?new P(`Failed to list previews: ${await e.text()}`):e}if(r){console.info(D({previews:c,simulatorUrl:l??null}));return}if(c.length===0&&!l){console.info(`No preview configurations found.`);return}if(c.length>0){let e=c.map(e=>[e.url,e.label]);console.info(h(e,{headers:[`URL`,`NAME`]}))}l&&(c.length>0&&console.info(``),console.info(`Simulator: ${l}`))}),Tr=M({name:`prismic preview remove`,description:`
134
134
  Remove a preview configuration from a Prismic repository.
135
135
 
136
136
  By default, this command reads the repository from prismic.config.json at the
137
137
  project root.
138
- `,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await sr({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove preview: ${await e.text()}`):e}let u=l.find(e=>e.url===n);if(!u)throw new P(`Preview not found: ${n}`);try{await lr(u.id,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),Dr=M({name:`prismic preview set-simulator`,description:`
138
+ `,positionals:{url:{description:`Preview URL to remove`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await or({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove preview: ${await e.text()}`):e}let u=l.find(e=>e.url===n);if(!u)throw new P(`Preview not found: ${n}`);try{await cr(u.id,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),Er=M({name:`prismic preview set-simulator`,description:`
139
139
  Set the slice simulator URL for a Prismic repository.
140
140
 
141
141
  If the URL pathname does not end with /slice-simulator, it is appended
@@ -143,13 +143,13 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
143
143
 
144
144
  By default, this command reads the repository from prismic.config.json at the
145
145
  project root.
146
- `,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o;try{o=new URL(n)}catch{throw new P(`Invalid URL: ${n}`)}o.pathname.endsWith(`/slice-simulator`)||(o.pathname=o.pathname.replace(/\/+$/,``)+`/slice-simulator`);let s=o.toString(),c=await O(),l=await k(),u=i?await H(i,{repo:r,token:c,host:l}):r;try{await mr(s,{repo:u,token:c,host:l})}catch(e){throw e instanceof T?new P(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${s}`)}),Or=N({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:wr,description:`Add a preview configuration`},list:{handler:Tr,description:`List preview configurations`},remove:{handler:Er,description:`Remove a preview configuration`},"set-simulator":{handler:Dr,description:`Set the slice simulator URL`}}});async function kr(e){try{let{stdout:t}=await be(`git`,[`rev-parse`,`--show-toplevel`],{nodeOptions:{cwd:Ie(e)},throwOnError:!0}),n=t.trim();return n?pe(Le(n)):void 0}catch{return}}async function Ar(e){try{let{stdout:t}=await be(`git`,[`status`,`--porcelain`,`--untracked-files=all`],{nodeOptions:{cwd:Ie(e)},throwOnError:!0}),n=[];for(let r of t.split(`
147
- `)){if(r.length<4)continue;let t=r.slice(3),i=t.indexOf(` -> `);i!==-1&&(t=t.slice(i+4)),n.push(new URL(t,e))}return n}catch{return[]}}var jr=M({name:`prismic pull`,description:`
146
+ `,positionals:{url:{description:`Simulator URL (e.g. https://example.com/slice-simulator)`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o;try{o=new URL(n)}catch{throw new P(`Invalid URL: ${n}`)}o.pathname.endsWith(`/slice-simulator`)||(o.pathname=o.pathname.replace(/\/+$/,``)+`/slice-simulator`);let s=o.toString(),c=await O(),l=await k(),u=i?await H(i,{repo:r,token:c,host:l}):r;try{await pr(s,{repo:u,token:c,host:l})}catch(e){throw e instanceof T?new P(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${s}`)}),Dr=N({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:Cr,description:`Add a preview configuration`},list:{handler:wr,description:`List preview configurations`},remove:{handler:Tr,description:`Remove a preview configuration`},"set-simulator":{handler:Er,description:`Set the slice simulator URL`}}});async function Or(e){try{let{stdout:t}=await be(`git`,[`rev-parse`,`--show-toplevel`],{nodeOptions:{cwd:Ie(e)},throwOnError:!0}),n=t.trim();return n?pe(Le(n)):void 0}catch{return}}async function kr(e){try{let{stdout:t}=await be(`git`,[`status`,`--porcelain`,`--untracked-files=all`],{nodeOptions:{cwd:Ie(e)},throwOnError:!0}),n=[];for(let r of t.split(`
147
+ `)){if(r.length<4)continue;let t=r.slice(3),i=t.indexOf(` -> `);i!==-1&&(t=t.slice(i+4)),n.push(new URL(t,e))}return n}catch{return[]}}var Ar=M({name:`prismic pull`,description:`
148
148
  Pull content types and slices from Prismic to local files.
149
149
 
150
150
  Remote models are the source of truth. Local files are created, updated,
151
151
  or deleted to match.
152
- `,options:{force:{type:`boolean`,short:`f`,description:`Overwrite local changes`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:t=!1,repo:n=await a(),env:r}=e,i=await O(),s=await k(),c=await o(),l=await u(),d=r?await H(r,{repo:n,token:i,host:s}):n;console.info(`Pulling from repository: ${n}${r?` (env: ${r})`:``}`);let[f,p,m]=await Promise.all([kr(l),c.getCustomTypeLibraries(),c.getSliceLibraries()]);if(!t&&f){let e=(await Ar(f)).filter(e=>e.pathname.endsWith(`/model.json`)&&m.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&p.some(t=>he(t,e))).map(e=>me(l,e));if(e.length>0)throw new P(`
152
+ `,options:{force:{type:`boolean`,short:`f`,description:`Overwrite local changes`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:t=!1,repo:n=await a(),env:r}=e,i=await O(),s=await k(),c=await o(),l=await u(),d=r?await H(r,{repo:n,token:i,host:s}):n;console.info(`Pulling from repository: ${n}${r?` (env: ${r})`:``}`);let[f,p,m]=await Promise.all([Or(l),c.getCustomTypeLibraries(),c.getSliceLibraries()]);if(!t&&f){let e=(await kr(f)).filter(e=>e.pathname.endsWith(`/model.json`)&&m.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&p.some(t=>he(t,e))).map(e=>me(l,e));if(e.length>0)throw new P(`
153
153
  Local model files have uncommitted changes. Commit them first so a
154
154
  pull won't silently discard your edits:
155
155
 
@@ -160,7 +160,7 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
160
160
  Other options:
161
161
  prismic push --force Keep local edits, overwrite remote
162
162
  prismic pull --force Discard local edits, adopt remote
163
- `)}let[h,g,ee,_]=await Promise.all([c.getCustomTypes(),c.getSlices(),un({repo:d,token:i,host:s}),mn({repo:d,token:i,host:s})]),v=B(ee.map(F),h.map(e=>F(e.model)),{getKey:e=>e.id}),y=B(_.map(F),g.map(e=>F(e.model)),{getKey:e=>e.id});if(!t&&!f){let e=new Set([...v.update,...v.delete].map(e=>e.id)),t=new Set([...y.update,...y.delete].map(e=>e.id)),n=[...h.filter(t=>e.has(t.model.id)),...g.filter(e=>t.has(e.model.id))].map(e=>me(l,e.modelPath));if(n.length>0)throw new P(`
163
+ `)}let[h,g,ee,_]=await Promise.all([c.getCustomTypes(),c.getSlices(),ln({repo:d,token:i,host:s}),pn({repo:d,token:i,host:s})]),v=B(ee,h.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))}),y=B(_,g.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))});if(!t&&!f){let e=new Set([...v.update,...v.delete].map(e=>e.id)),t=new Set([...y.update,...y.delete].map(e=>e.id)),n=[...h.filter(t=>e.has(t.model.id)),...g.filter(e=>t.has(e.model.id))].map(e=>me(l,e.modelPath));if(n.length>0)throw new P(`
164
164
  Pull would modify or delete local model files:
165
165
  ${n.join(`
166
166
  `)}
@@ -168,12 +168,12 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
168
168
  This project isn't in a git repo, so changes can't be tracked. Choose one:
169
169
  prismic pull --force Discard local files, adopt remote
170
170
  prismic push --force Keep local files, overwrite remote
171
- `)}for(let e of v.insert)await c.createCustomType(e);for(let e of v.update)await c.updateCustomType(e);for(let e of v.delete)await c.deleteCustomType(e.id);for(let e of y.insert)await c.createSlice(e);for(let e of y.update)await c.updateSlice(e);for(let e of y.delete)await c.deleteSlice(e.id);await c.generateTypes();let b=v.insert.length+v.update.length,te=y.insert.length+y.update.length,ne=v.delete.length+y.delete.length;if(b===0&&te===0&&ne===0){console.info(`Already up to date.`);return}console.info(`Inserted ${v.insert.length}, updated ${v.update.length}, deleted ${v.delete.length} types`),console.info(`Inserted ${y.insert.length}, updated ${y.update.length}, deleted ${y.delete.length} slices`)}),Mr=M({name:`prismic push`,description:`
171
+ `)}for(let e of v.insert)await c.createCustomType(e);for(let e of v.update)await c.updateCustomType(e);for(let e of v.delete)await c.deleteCustomType(e.id);for(let e of y.insert)await c.createSlice(e);for(let e of y.update)await c.updateSlice(e);for(let e of y.delete)await c.deleteSlice(e.id);await c.generateTypes();let b=v.insert.length+v.update.length,te=y.insert.length+y.update.length,ne=v.delete.length+y.delete.length;if(b===0&&te===0&&ne===0){console.info(`Already up to date.`);return}console.info(`Inserted ${v.insert.length}, updated ${v.update.length}, deleted ${v.delete.length} types`),console.info(`Inserted ${y.insert.length}, updated ${y.update.length}, deleted ${y.delete.length} slices`)}),jr=M({name:`prismic push`,description:`
172
172
  Push local content types and slices to Prismic.
173
173
 
174
174
  Local models are the source of truth. Remote models are created,
175
175
  updated, or deleted to match.
176
- `,options:{force:{type:`boolean`,short:`f`,description:`Skip safety checks`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:t=!1,repo:n=await a(),env:r}=e,s=await O(),c=await k(),l=await o(),d=await u(),f=r?await H(r,{repo:n,token:s,host:c}):n;console.info(`Pushing to repository: ${n}${r?` (env: ${r})`:``}`);let[p,m,h]=await Promise.all([kr(d),l.getCustomTypeLibraries(),l.getSliceLibraries()]);if(!t&&p){let e=(await Ar(p)).filter(e=>e.pathname.endsWith(`/model.json`)&&h.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&m.some(t=>he(t,e))).map(e=>me(d,e));if(e.length>0)throw new P(`
176
+ `,options:{force:{type:`boolean`,short:`f`,description:`Skip safety checks`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{force:t=!1,repo:n=await a(),env:r}=e,s=await O(),c=await k(),l=await o(),d=await u(),f=r?await H(r,{repo:n,token:s,host:c}):n;console.info(`Pushing to repository: ${n}${r?` (env: ${r})`:``}`);let[p,m,h]=await Promise.all([Or(d),l.getCustomTypeLibraries(),l.getSliceLibraries()]);if(!t&&p){let e=(await kr(p)).filter(e=>e.pathname.endsWith(`/model.json`)&&h.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&m.some(t=>he(t,e))).map(e=>me(d,e));if(e.length>0)throw new P(`
177
177
  Local model files have uncommitted changes. Commit them, then push:
178
178
 
179
179
  git add ${e.join(` `)}
@@ -181,39 +181,39 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
181
181
  prismic push
182
182
 
183
183
  Or skip the safety check with \`prismic push --force\`.
184
- `)}let[g,ee,_,v]=await Promise.all([l.getCustomTypes(),l.getSlices(),un({repo:f,token:s,host:c}),mn({repo:f,token:s,host:c})]),y=B(g.map(e=>F(e.model)),_.map(F),{getKey:e=>e.id}),b=B(ee.map(e=>F(e.model)),v.map(F),{getKey:e=>e.id});if(!t){let e=pe(m[0]),t=pe(h[0]),n=[...y.delete.map(t=>me(d,new URL(`${t.id}/index.json`,e))),...b.delete.map(e=>me(d,new URL(`${i(e.name)}/model.json`,t)))];if(n.length>0)throw new P(`
184
+ `)}let[g,ee,_,v]=await Promise.all([l.getCustomTypes(),l.getSlices(),ln({repo:f,token:s,host:c}),pn({repo:f,token:s,host:c})]),y=B(g.map(e=>e.model),_,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))}),b=B(ee.map(e=>e.model),v,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))});if(!t){let e=pe(m[0]),t=pe(h[0]),n=[...y.delete.map(t=>me(d,new URL(`${t.id}/index.json`,e))),...b.delete.map(e=>me(d,new URL(`${i(e.name)}/model.json`,t)))];if(n.length>0)throw new P(`
185
185
  Push would delete remote models. Re-run with --force to proceed.
186
186
 
187
187
  Models that would be deleted:
188
188
  ${n.join(`
189
189
  `)}
190
- `)}for(let e of y.insert)await dn(e,{repo:f,token:s,host:c});for(let e of y.update)await fn(e,{repo:f,token:s,host:c});for(let e of y.delete.map(e=>e.id))await pn(e,{repo:f,token:s,host:c});for(let e of b.insert)await hn(e,{repo:f,token:s,host:c});for(let e of b.update)await gn(e,{repo:f,token:s,host:c});for(let e of b.delete.map(e=>e.id))await _n(e,{repo:f,token:s,host:c});let te=y.insert.length+y.update.length,ne=b.insert.length+b.update.length,re=y.delete.length+b.delete.length;te===0&&ne===0&&re===0?console.info(`Already up to date.`):(console.info(`Pushed ${te} type(s), ${ne} slice(s).`),re>0&&console.info(`Deleted ${re} model(s).`))}),Nr=M({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 O(),i=await k(),a;try{a=await r({token:n,host:i})}catch(e){throw e instanceof T?new P(`Failed to list repositories: ${await e.text()}`):e}let o=a.repositories;if(t){console.info(D(o.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${i}/`}))));return}if(o.length===0){console.info(`No repositories found.`);return}let s=o.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,e.role??``]});console.info(h(s,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});const Pr=[`private`,`public`,`open`];var Fr=M({name:`prismic repo set-api-access`,description:`
190
+ `)}for(let e of y.insert)await un(e,{repo:f,token:s,host:c});for(let e of y.update)await dn(e,{repo:f,token:s,host:c});for(let e of y.delete.map(e=>e.id))await fn(e,{repo:f,token:s,host:c});for(let e of b.insert)await mn(e,{repo:f,token:s,host:c});for(let e of b.update)await hn(e,{repo:f,token:s,host:c});for(let e of b.delete.map(e=>e.id))await gn(e,{repo:f,token:s,host:c});let te=y.insert.length+y.update.length,ne=b.insert.length+b.update.length,re=y.delete.length+b.delete.length;te===0&&ne===0&&re===0?console.info(`Already up to date.`):(console.info(`Pushed ${te} type(s), ${ne} slice(s).`),re>0&&console.info(`Deleted ${re} model(s).`))}),Mr=M({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 O(),i=await k(),a;try{a=await r({token:n,host:i})}catch(e){throw e instanceof T?new P(`Failed to list repositories: ${await e.text()}`):e}let o=a.repositories;if(t){console.info(D(o.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${i}/`}))));return}if(o.length===0){console.info(`No repositories found.`);return}let s=o.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,e.role??``]});console.info(h(s,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});const Nr=[`private`,`public`,`open`];var Pr=M({name:`prismic repo set-api-access`,description:`
191
191
  Set the Content API access level of a Prismic repository.
192
192
 
193
193
  By default, this command reads the repository from prismic.config.json at the
194
194
  project root.
195
- `,positionals:{level:{description:`Access level (${Pr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a()}=t;if(!Pr.includes(n))throw new P(`Invalid access level: ${n}. Must be one of: ${Pr.join(`, `)}`);let i=await O(),o=await k();try{await qn(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Ir=M({name:`prismic repo set-name`,description:`
195
+ `,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 a()}=t;if(!Nr.includes(n))throw new P(`Invalid access level: ${n}. Must be one of: ${Nr.join(`, `)}`);let i=await O(),o=await k();try{await Kn(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Fr=M({name:`prismic repo set-name`,description:`
196
196
  Set the display name of a Prismic repository.
197
197
 
198
198
  By default, this command reads the repository from prismic.config.json at the
199
199
  project root.
200
- `,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 a()}=t,i=await O(),o=await k(),s;try{s=await Yn(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${s}`)}),Lr=M({name:`prismic repo view`,description:`
200
+ `,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 a()}=t,i=await O(),o=await k(),s;try{s=await Jn(n,{repo:r,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${s}`)}),Ir=M({name:`prismic repo view`,description:`
201
201
  View details of a Prismic repository.
202
202
 
203
203
  By default, this command reads the repository from prismic.config.json at the
204
204
  project root.
205
- `,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 a(),web:n,json:i}=e,o=await O(),s=await k(),c=`https://${t}.${s}/`;if(n){wn(new URL(c)),console.info(`Opening ${c}`);return}let l,u;try{[l,u]=await Promise.all([r({token:o,host:s}),Kn({repo:t,token:o,host:s})])}catch(e){throw e instanceof T?new P(`Failed to fetch repository details: ${await e.text()}`):e}let d=l.repositories.find(e=>e.domain===t);if(!d)throw new P(`Repository not found: ${t}`);if(i){console.info(D({domain:d.domain,name:d.name??null,url:c,apiAccess:u}));return}let f=d.name||`(no name)`;console.info(`Name: ${f}`),console.info(`URL: ${c}`),console.info(`Content API: ${u}`)}),Rr=N({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Zn,description:`Create a new repository`},list:{handler:Nr,description:`List repositories`},view:{handler:Lr,description:`View repository details`},"set-name":{handler:Ir,description:`Set repository display name`},"set-api-access":{handler:Fr,description:`Set Content API access level`}}}),zr=M({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:`ID of the slice`},id:{type:`string`,description:`Custom ID for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`}}},async({positionals:t,values:n})=>{let[r]=t,{to:i,id:s=e(r),screenshot:c}=n,l=await o(),{model:u}=await l.getSlice(i);if(u.variations.some(e=>e.id===s))throw new P(`Variation "${s}" already exists in slice "${i}".`);let d=``;if(c){let e=await a(),t=await O(),n=await k(),r=await ve(/^https?:\/\//i.test(c)?new URL(c):Le(c)),i;try{i=await bn(r,{sliceId:u.id,variationId:s,repo:e,token:t,host:n})}catch(e){throw e instanceof xn?new P(e.message):e}d=i.toString()}u.variations=[...u.variations,{id:s,name:r,description:r,docURL:``,imageUrl:d,version:``,primary:{}}],await l.updateSlice(u),await l.generateTypes(),console.info(`Added variation "${r}" (id: "${s}") to slice "${i}"`)}),Br=M({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,sections:{EXAMPLES:`
205
+ `,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 a(),web:n,json:i}=e,o=await O(),s=await k(),c=`https://${t}.${s}/`;if(n){Cn(new URL(c)),console.info(`Opening ${c}`);return}let l,u;try{[l,u]=await Promise.all([r({token:o,host:s}),Gn({repo:t,token:o,host:s})])}catch(e){throw e instanceof T?new P(`Failed to fetch repository details: ${await e.text()}`):e}let d=l.repositories.find(e=>e.domain===t);if(!d)throw new P(`Repository not found: ${t}`);if(i){console.info(D({domain:d.domain,name:d.name??null,url:c,apiAccess:u}));return}let f=d.name||`(no name)`;console.info(`Name: ${f}`),console.info(`URL: ${c}`),console.info(`Content API: ${u}`)}),Lr=N({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:Xn,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=M({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:`ID of the slice`},id:{type:`string`,description:`Custom ID for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`}}},async({positionals:t,values:n})=>{let[r]=t,{to:i,id:s=e(r),screenshot:c}=n,l=await o(),{model:u}=await l.getSlice(i);if(u.variations.some(e=>e.id===s))throw new P(`Variation "${s}" already exists in slice "${i}".`);let d=``;if(c){let e=await a(),t=await O(),n=await k(),r=await ve(/^https?:\/\//i.test(c)?new URL(c):Le(c)),i;try{i=await yn(r,{sliceId:u.id,variationId:s,repo:e,token:t,host:n})}catch(e){throw e instanceof bn?new P(e.message):e}d=i.toString()}u.variations=[...u.variations,{id:s,name:r,description:r,docURL:``,imageUrl:d,version:``,primary:{}}],await l.updateSlice(u),await l.generateTypes(),console.info(`Added variation "${r}" (id: "${s}") to slice "${i}"`)}),zr=M({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,sections:{EXAMPLES:`
206
206
  Connect a slice to a type's default slice zone:
207
207
  prismic slice connect hero --to blog_post
208
208
 
209
209
  Connect to a named slice zone:
210
210
  prismic slice connect hero --to blog_post --slice-zone page_slices
211
- `},positionals:{id:{description:`ID of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"slice-zone":i=`slices`}=t,a=await o(),{model:s}=await a.getSlice(n),{model:c}=await a.getCustomType(r),l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new P(`Slice zone "${i}" not found in "${r}".`);if(l.config??={},l.config.choices??={},s.id in l.config.choices)throw new P(`Slice "${s.id}" is already connected to "${r}" in slice zone "${i}".`);l.config.choices[s.id]={type:`SharedSlice`},await a.updateCustomType(c),await a.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),Vr=M({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`}}},async({positionals:e,values:n})=>{let[r]=e,{id:i=t(r)}=n,a={id:i,name:r,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},s=await o();await s.createSlice(a),await s.generateTypes(),console.info(`Created slice "${r}" (id: "${i}")`),console.info(`Run \`prismic field add <type> --to-slice ${i}\` to add fields.`),console.info(`Run \`prismic slice connect ${i} --to <type>\` to connect the slice to a type.`)}),Hr=M({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,"slice-zone":i=`slices`}=t,a=await o(),{model:s}=await a.getSlice(n),{model:c}=await a.getCustomType(r),l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new P(`Slice zone "${i}" not found in "${r}".`);if(!l.config?.choices||!(s.id in l.config.choices))throw new P(`Slice "${s.id}" is not connected to "${r}" in slice zone "${i}".`);delete l.config.choices[s.id],await a.updateCustomType(c),await a.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),Ur=M({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`}}},async({positionals:e,values:t})=>{let[n]=e,r=await o(),{model:i}=await r.getSlice(n);`name`in t&&(i.name=t.name),await r.updateSlice(i),await r.generateTypes(),console.info(`Slice updated: "${i.name}" (id: ${i.id})`)}),Wr=M({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{"from-slice":{type:`string`,required:!0,description:`ID of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-slice":r,screenshot:i}=t,s=await o(),{model:c}=await s.getSlice(r),l=c.variations.find(e=>e.id===n);if(!l)throw new P(`Variation "${n}" not found in slice "${r}".`);if(`name`in t&&(l.name=t.name),i){let e=await a(),t=await O(),n=await k(),r=await ve(/^https?:\/\//i.test(i)?new URL(i):Le(i)),o;try{o=await bn(r,{sliceId:c.id,variationId:l.id,repo:e,token:t,host:n})}catch(e){throw e instanceof xn?new P(e.message):e}l.imageUrl=o.toString()}await s.updateSlice(c),await s.generateTypes(),console.info(`Variation updated: "${n}" in slice "${r}"`)}),Gr=M({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await(await o()).getSlices();if(t){console.info(D(n.map(e=>e.model)));return}if(n.length===0){console.info(`No slices found.`);return}let r=n.map(({model:e})=>[e.name,e.id]);console.info(h(r,{headers:[`NAME`,`ID`]}))}),Kr=M({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}}},async({positionals:e})=>{let[t]=e,n=await o(),{model:r}=await n.getSlice(t);await n.deleteSlice(r.id),await n.generateTypes(),console.info(`Slice removed: ${t}`)}),qr=M({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the slice`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r}=t,i=await o(),{model:a}=await i.getSlice(r),s=a.variations.find(e=>e.id===n);if(!s)throw new P(`Variation "${n}" not found in slice "${r}".`);a.variations=a.variations.filter(e=>e.id!==s.id),await i.updateSlice(a),await i.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),Jr=M({name:`prismic slice view`,description:`View details of a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,{model:i}=await(await o()).getSlice(n);if(r){console.info(D(i));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.name}`);for(let e of i.variations??[]){console.info(``),console.info(`${e.id}:`);let t=Object.entries(e.primary??{});if(t.length===0)console.info(` (no fields)`);else{let e=t.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(h(e))}}}),Yr=N({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Vr,description:`Create a new slice`},edit:{handler:Ur,description:`Edit a slice`},remove:{handler:Kr,description:`Remove a slice`},list:{handler:Gr,description:`List slices`},view:{handler:Jr,description:`View a slice`},connect:{handler:Br,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Hr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:zr,description:`Add a variation to a slice`},"edit-variation":{handler:Wr,description:`Edit a variation of a slice`},"remove-variation":{handler:qr,description:`Remove a variation from a slice`}}}),Xr=M({name:`prismic status`,description:`
211
+ `},positionals:{id:{description:`ID of the slice`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"slice-zone":i=`slices`}=t,a=await o(),{model:s}=await a.getSlice(n),{model:c}=await a.getCustomType(r),l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new P(`Slice zone "${i}" not found in "${r}".`);if(l.config??={},l.config.choices??={},s.id in l.config.choices)throw new P(`Slice "${s.id}" is already connected to "${r}" in slice zone "${i}".`);l.config.choices[s.id]={type:`SharedSlice`},await a.updateCustomType(c),await a.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),Br=M({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`}}},async({positionals:e,values:n})=>{let[r]=e,{id:i=t(r)}=n,a={id:i,name:r,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},s=await o();await s.createSlice(a),await s.generateTypes(),console.info(`Created slice "${r}" (id: "${i}")`),console.info(`Run \`prismic field add <type> --to-slice ${i}\` to add fields.`),console.info(`Run \`prismic slice connect ${i} --to <type>\` to connect the slice to a type.`)}),Vr=M({name:`prismic slice disconnect`,description:`Disconnect a slice from a type's slice zone.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`},"slice-zone":{type:`string`,description:`Slice zone field ID (default: "slices")`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r,"slice-zone":i=`slices`}=t,a=await o(),{model:s}=await a.getSlice(n),{model:c}=await a.getCustomType(r),l=Object.assign({},...Object.values(c.json))[i];if(!l||l.type!==`Slices`)throw new P(`Slice zone "${i}" not found in "${r}".`);if(!l.config?.choices||!(s.id in l.config.choices))throw new P(`Slice "${s.id}" is not connected to "${r}" in slice zone "${i}".`);delete l.config.choices[s.id],await a.updateCustomType(c),await a.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),Hr=M({name:`prismic slice edit`,description:`Edit a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the slice`}}},async({positionals:e,values:t})=>{let[n]=e,r=await o(),{model:i}=await r.getSlice(n);`name`in t&&(i.name=t.name),await r.updateSlice(i),await r.generateTypes(),console.info(`Slice updated: "${i.name}" (id: ${i.id})`)}),Ur=M({name:`prismic slice edit-variation`,description:`Edit a variation of a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{"from-slice":{type:`string`,required:!0,description:`ID of the slice`},name:{type:`string`,short:`n`,description:`New name for the variation`},screenshot:{type:`string`,short:`s`,description:`Screenshot image file path or URL`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-slice":r,screenshot:i}=t,s=await o(),{model:c}=await s.getSlice(r),l=c.variations.find(e=>e.id===n);if(!l)throw new P(`Variation "${n}" not found in slice "${r}".`);if(`name`in t&&(l.name=t.name),i){let e=await a(),t=await O(),n=await k(),r=await ve(/^https?:\/\//i.test(i)?new URL(i):Le(i)),o;try{o=await yn(r,{sliceId:c.id,variationId:l.id,repo:e,token:t,host:n})}catch(e){throw e instanceof bn?new P(e.message):e}l.imageUrl=o.toString()}await s.updateSlice(c),await s.generateTypes(),console.info(`Variation updated: "${n}" in slice "${r}"`)}),Wr=M({name:`prismic slice list`,description:`List all slices.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await(await o()).getSlices();if(t){console.info(D(n.map(e=>e.model)));return}if(n.length===0){console.info(`No slices found.`);return}let r=n.map(({model:e})=>[e.name,e.id]);console.info(h(r,{headers:[`NAME`,`ID`]}))}),Gr=M({name:`prismic slice remove`,description:`Remove a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}}},async({positionals:e})=>{let[t]=e,n=await o(),{model:r}=await n.getSlice(t);await n.deleteSlice(r.id),await n.generateTypes(),console.info(`Slice removed: ${t}`)}),Kr=M({name:`prismic slice remove-variation`,description:`Remove a variation from a slice.`,positionals:{id:{description:`ID of the variation`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the slice`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r}=t,i=await o(),{model:a}=await i.getSlice(r),s=a.variations.find(e=>e.id===n);if(!s)throw new P(`Variation "${n}" not found in slice "${r}".`);a.variations=a.variations.filter(e=>e.id!==s.id),await i.updateSlice(a),await i.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),qr=M({name:`prismic slice view`,description:`View details of a slice.`,positionals:{id:{description:`ID of the slice`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,{model:i}=await(await o()).getSlice(n);if(r){console.info(D(i));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.name}`);for(let e of i.variations??[]){console.info(``),console.info(`${e.id}:`);let t=Object.entries(e.primary??{});if(t.length===0)console.info(` (no fields)`);else{let e=t.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(h(e))}}}),Jr=N({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Br,description:`Create a new slice`},edit:{handler:Hr,description:`Edit a slice`},remove:{handler:Gr,description:`Remove a slice`},list:{handler:Wr,description:`List slices`},view:{handler:qr,description:`View a slice`},connect:{handler:zr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Vr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Rr,description:`Add a variation to a slice`},"edit-variation":{handler:Ur,description:`Edit a variation of a slice`},"remove-variation":{handler:Kr,description:`Remove a variation from a slice`}}}),Yr=M({name:`prismic status`,description:`
212
212
  Show local vs remote model differences.
213
213
 
214
214
  Reports what would be pushed to or pulled from Prismic, plus any local
215
215
  model files with uncommitted git changes that would block pull and push.
216
- `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n}=e,i=await O(),s=await k(),c=await o(),l=await u(),[d,f,p,m,h]=await Promise.all([kr(l),c.getCustomTypeLibraries(),c.getSliceLibraries(),c.getCustomTypes(),c.getSlices()]),g=t,ee,v,y;if(i){n&&(g=await H(n,{repo:t,token:i,host:s}));let[e,a,o]=await Promise.all([r({token:i,host:s}),un({repo:g,token:i,host:s}),mn({repo:g,token:i,host:s})]);ee=e.email,v=B(m.map(e=>F(e.model)),a.map(F),{getKey:e=>e.id}),y=B(h.map(e=>F(e.model)),o.map(F),{getKey:e=>e.id})}let b=[];d&&(b=(await Ar(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&p.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&f.some(t=>he(t,e))).map(e=>me(l,e))),console.info(`Repository: ${t}`),n&&console.info(`Environment: ${n}`),ee?console.info(`Authenticated as: ${ee}`):console.info("Not logged in — log in with `prismic login` to compare with remote.");let te=v!==void 0&&y!==void 0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0&&y.insert.length===0&&y.update.length===0&&y.delete.length===0;if(te&&b.length===0){console.info(``),console.info(`Already up to date.`);return}if(v&&y){let e=[],t=[...v.insert.map(e=>` ${e.id} (custom type)`),...y.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[...v.delete.map(e=>` ${e.id} (custom type)`),...y.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[...v.update.map(e=>` ${e.id} (custom type)`),...y.update.map(e=>` ${e.id} (slice)`)];r.length>0&&e.push([`Differ:`,...r]);for(let t of e){console.info(``);for(let e of t)console.info(e)}}if(b.length>0&&(console.info(``),console.info(_`
216
+ `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n}=e,i=await O(),s=await k(),c=await o(),l=await u(),[d,f,p,m,h]=await Promise.all([Or(l),c.getCustomTypeLibraries(),c.getSliceLibraries(),c.getCustomTypes(),c.getSlices()]),g=t,ee,v,y;if(i){n&&(g=await H(n,{repo:t,token:i,host:s}));let[e,a,o]=await Promise.all([r({token:i,host:s}),ln({repo:g,token:i,host:s}),pn({repo:g,token:i,host:s})]);ee=e.email,v=B(m.map(e=>e.model),a,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))}),y=B(h.map(e=>e.model),o,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))})}let b=[];d&&(b=(await kr(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&p.some(t=>he(t,e))||e.pathname.endsWith(`/index.json`)&&f.some(t=>he(t,e))).map(e=>me(l,e))),console.info(`Repository: ${t}`),n&&console.info(`Environment: ${n}`),ee?console.info(`Authenticated as: ${ee}`):console.info("Not logged in — log in with `prismic login` to compare with remote.");let te=v!==void 0&&y!==void 0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0&&y.insert.length===0&&y.update.length===0&&y.delete.length===0;if(te&&b.length===0){console.info(``),console.info(`Already up to date.`);return}if(v&&y){let e=[],t=[...v.insert.map(e=>` ${e.id} (custom type)`),...y.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[...v.delete.map(e=>` ${e.id} (custom type)`),...y.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[...v.update.map(e=>` ${e.id} (custom type)`),...y.update.map(e=>` ${e.id} (slice)`)];r.length>0&&e.push([`Differ:`,...r]);for(let t of e){console.info(``);for(let e of t)console.info(e)}}if(b.length>0&&(console.info(``),console.info(_`
217
217
  Pull and push won't run while these model files have uncommitted git changes:
218
218
  ${b.join(`
219
219
  `)}
@@ -223,27 +223,27 @@ import{C as e,E as t,O as n,S as r,T as i,_ as a,a as o,b as s,c,f as l,g as u,h
223
223
  git commit -m "Update Prismic models"
224
224
 
225
225
  Or override with \`prismic push --force\` (keep local) or \`prismic pull --force\` (discard local).
226
- `)),v&&y&&!te){let e=v.insert.length+y.insert.length,t=v.update.length+y.update.length,n=v.delete.length+y.delete.length;console.info(``),console.info(`Next:`),console.info(` prismic push — would create ${e}, update ${t}, delete ${n}`),console.info(` prismic pull — would create ${n}, update ${t}, delete ${e}`)}});const Zr=xe.TEST?500:5e3;var Qr=M({name:`prismic sync`,description:`
226
+ `)),v&&y&&!te){let e=v.insert.length+y.insert.length,t=v.update.length+y.update.length,n=v.delete.length+y.delete.length;console.info(``),console.info(`Next:`),console.info(` prismic push — would create ${e}, update ${t}, delete ${n}`),console.info(` prismic pull — would create ${n}, update ${t}, delete ${e}`)}});const Xr=xe.TEST?500:5e3;var Zr=M({name:`prismic sync`,description:`
227
227
  Watch Prismic and continuously pull changes to local files.
228
228
 
229
229
  For one-time pulls, use \`prismic pull\`.
230
230
  `,options:{watch:{type:`boolean`,short:`w`,description:`Watch for changes and sync continuously`,required:!0},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n}=e,r=await O(),i=await k(),s=await o(),c=n?await H(n,{repo:t,token:r,host:i}):t;Oe(`sync`,{watch:!0}),process.on(`SIGINT`,()=>{console.info(`
231
- Watch stopped. Goodbye!`),A(`sync`,{watch:!0}),process.exit(0)}),console.info(`Watching repository: ${t}${n?` (env: ${n})`:``} (polling every ${Zr/1e3}s, Ctrl+C to stop)`);let l=``,u=0;for(;;){try{let[e,t]=await Promise.all([un({repo:c,token:r,host:i}),mn({repo:c,token:r,host:i})]),n=$r({remoteCustomTypes:e,remoteSlices:t});if(n!==l){let r=l===``,[i,a]=await Promise.all([s.getCustomTypes(),s.getSlices()]),o=i.map(e=>e.model),c=a.map(e=>e.model),u=[],d=B(t,c,{getKey:e=>e.id});if(d.insert.length+d.update.length+d.delete.length>0){for(let e of d.update)await s.updateSlice(e);for(let e of d.delete)await s.deleteSlice(e.id);for(let e of d.insert)await s.createSlice(e);u.push(`slices`)}let f=B(e,o,{getKey:e=>e.id});if(f.insert.length+f.update.length+f.delete.length>0){for(let e of f.update)await s.updateCustomType(e);for(let e of f.delete)await s.deleteCustomType(e.id);for(let e of f.insert)await s.createCustomType(e);u.push(`custom types`)}if(await s.generateTypes(),l=n,r)console.info(`Initial sync complete.`);else{let e=new Date().toLocaleTimeString();console.info(`[${e}] Changes detected in ${u.join(` and `)}`)}}u=0}catch(e){u++;let t=e instanceof Error?e.message:`Unknown error`;if(console.error(`Error checking for changes: ${t}`),u>=5)throw Error(`Too many consecutive errors (5), stopping watch.`)}await Je(Zr)}});function $r(e){return Re(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const ei=`Prismic CLI`;var ti=M({name:`prismic token create`,description:`
231
+ Watch stopped. Goodbye!`),A(`sync`,{watch:!0}),process.exit(0)}),console.info(`Watching repository: ${t}${n?` (env: ${n})`:``} (polling every ${Xr/1e3}s, Ctrl+C to stop)`);let l=``,u=0;for(;;){try{let[e,t]=await Promise.all([ln({repo:c,token:r,host:i}),pn({repo:c,token:r,host:i})]),n=Qr({remoteCustomTypes:e,remoteSlices:t});if(n!==l){let r=l===``,[i,a]=await Promise.all([s.getCustomTypes(),s.getSlices()]),o=i.map(e=>e.model),c=a.map(e=>e.model),u=[],d=B(t,c,{getKey:e=>e.id});if(d.insert.length+d.update.length+d.delete.length>0){for(let e of d.update)await s.updateSlice(e);for(let e of d.delete)await s.deleteSlice(e.id);for(let e of d.insert)await s.createSlice(e);u.push(`slices`)}let f=B(e,o,{getKey:e=>e.id});if(f.insert.length+f.update.length+f.delete.length>0){for(let e of f.update)await s.updateCustomType(e);for(let e of f.delete)await s.deleteCustomType(e.id);for(let e of f.insert)await s.createCustomType(e);u.push(`custom types`)}if(await s.generateTypes(),l=n,r)console.info(`Initial sync complete.`);else{let e=new Date().toLocaleTimeString();console.info(`[${e}] Changes detected in ${u.join(` and `)}`)}}u=0}catch(e){u++;let t=e instanceof Error?e.message:`Unknown error`;if(console.error(`Error checking for changes: ${t}`),u>=5)throw Error(`Too many consecutive errors (5), stopping watch.`)}await Je(Xr)}});function Qr(e){return Re(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const $r=`Prismic CLI`;var ei=M({name:`prismic token create`,description:`
232
232
  Create a new API token for a Prismic repository.
233
233
 
234
234
  By default, this command reads the repository from prismic.config.json at the
235
235
  project root.
236
- `,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,write:r,"allow-releases":i}=e;if(r&&i)throw new P(`--allow-releases is only valid for access tokens (not with --write)`);let o=await O(),s=await k(),c=n?await H(n,{repo:t,token:o,host:s}):t,l;try{if(r)l=(await Vn(ei,{repo:c,token:o,host:s})).token;else{let e=i?`master+releases`:`master`,t=(await In({repo:c,token:o,host:s})).find(e=>e.name===ei);t||=await Ln(ei,{repo:c,token:o,host:s}),l=(await Rn(t.id,e,{repo:c,token:o,host:s})).token}}catch(e){throw e instanceof T?new P(`Failed to create token: ${await e.text()}`):e}console.info(`Token created: ${l}`);let u=r?`PRISMIC_WRITE_TOKEN`:`PRISMIC_ACCESS_TOKEN`;console.info(`Add it to your .env file: ${u}=${l}`)}),ni=M({name:`prismic token delete`,description:`
236
+ `,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`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,write:r,"allow-releases":i}=e;if(r&&i)throw new P(`--allow-releases is only valid for access tokens (not with --write)`);let o=await O(),s=await k(),c=n?await H(n,{repo:t,token:o,host:s}):t,l;try{if(r)l=(await Bn($r,{repo:c,token:o,host:s})).token;else{let e=i?`master+releases`:`master`,t=(await Fn({repo:c,token:o,host:s})).find(e=>e.name===$r);t||=await In($r,{repo:c,token:o,host:s}),l=(await Ln(t.id,e,{repo:c,token:o,host:s})).token}}catch(e){throw e instanceof T?new P(`Failed to create token: ${await e.text()}`):e}console.info(`Token created: ${l}`);let u=r?`PRISMIC_WRITE_TOKEN`:`PRISMIC_ACCESS_TOKEN`;console.info(`Add it to your .env file: ${u}=${l}`)}),ti=M({name:`prismic token delete`,description:`
237
237
  Delete a token from a Prismic repository.
238
238
 
239
239
  By default, this command reads the repository from prismic.config.json at the
240
240
  project root.
241
- `,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l,u;try{[l,u]=await Promise.all([In({repo:c,token:o,host:s}),Bn({repo:c,token:o,host:s})])}catch(e){throw e instanceof T?new P(`Failed to delete token: ${await e.text()}`):e}let d=l.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(d){try{await zn(d.id,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let f=u.tokens.find(e=>e.token===n);if(f){try{await Hn(f.token,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new P(`Token not found: ${n}`)}),ri=N({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:M({name:`prismic token list`,description:`
241
+ `,positionals:{token:{description:`Token value`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l,u;try{[l,u]=await Promise.all([Fn({repo:c,token:o,host:s}),zn({repo:c,token:o,host:s})])}catch(e){throw e instanceof T?new P(`Failed to delete token: ${await e.text()}`):e}let d=l.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(d){try{await Rn(d.id,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let f=u.tokens.find(e=>e.token===n);if(f){try{await Vn(f.token,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new P(`Token not found: ${n}`)}),ni=N({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:M({name:`prismic token list`,description:`
242
242
  List all API tokens for a Prismic repository.
243
243
 
244
244
  By default, this command reads the repository from prismic.config.json at the
245
245
  project root.
246
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c,l;try{[c,l]=await Promise.all([In({repo:s,token:i,host:o}),Bn({repo:s,token:i,host:o})])}catch(e){throw e instanceof T?new P(`Failed to list tokens: ${await e.text()}`):e}let u=c.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]}))),d=l.tokens;if(r){console.info(D({accessTokens:u,writeTokens:d}));return}if(u.length>0){console.info(`ACCESS TOKENS`);let e=u.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(h(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),d.length>0){console.info(`WRITE TOKENS`);let e=d.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(h(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:ti,description:`Create a new token`},delete:{handler:ni,description:`Delete a token`}}}),ii=M({name:`prismic type add-tab`,description:`Add a tab to a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"with-slice-zone":i}=t,a=await o(),{model:s}=await a.getCustomType(r);if(n in s.json)throw new P(`Tab "${n}" already exists in "${r}".`);s.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{},await a.updateCustomType(s),await a.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),ai=M({name:`prismic type create`,description:`Create a new content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{format:{type:`string`,short:`f`,description:`Type format: "custom" (default) or "page"`},single:{type:`boolean`,short:`s`,description:`Allow only one document of this type`},id:{type:`string`,description:`Custom ID for the content type`}},sections:{FORMATS:`
246
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c,l;try{[c,l]=await Promise.all([Fn({repo:s,token:i,host:o}),zn({repo:s,token:i,host:o})])}catch(e){throw e instanceof T?new P(`Failed to list tokens: ${await e.text()}`):e}let u=c.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]}))),d=l.tokens;if(r){console.info(D({accessTokens:u,writeTokens:d}));return}if(u.length>0){console.info(`ACCESS TOKENS`);let e=u.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(h(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),d.length>0){console.info(`WRITE TOKENS`);let e=d.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(h(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:ei,description:`Create a new token`},delete:{handler:ti,description:`Delete a token`}}}),ri=M({name:`prismic type add-tab`,description:`Add a tab to a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{to:{type:`string`,required:!0,description:`ID of the content type`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`}}},async({positionals:e,values:t})=>{let[n]=e,{to:r,"with-slice-zone":i}=t,a=await o(),{model:s}=await a.getCustomType(r);if(n in s.json)throw new P(`Tab "${n}" already exists in "${r}".`);s.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{},await a.updateCustomType(s),await a.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),ii=M({name:`prismic type create`,description:`Create a new content type.`,positionals:{name:{description:`Name of the content type`,required:!0}},options:{format:{type:`string`,short:`f`,description:`Type format: "custom" (default) or "page"`},single:{type:`boolean`,short:`s`,description:`Allow only one document of this type`},id:{type:`string`,description:`Custom ID for the content type`}},sections:{FORMATS:`
247
247
  custom A non-page type (e.g. settings, navigation, author, blog
248
248
  category). This is the default.
249
249
  page A page type with a URL (e.g. homepage, blog post, landing
@@ -258,7 +258,7 @@ Watch stopped. Goodbye!`),A(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
258
258
 
259
259
  Create with a custom ID:
260
260
  prismic type create "Landing Page" --format page --id landing
261
- `}},async({positionals:e,values:n})=>{let[r]=e,{format:i=`custom`,single:a=!1,id:s=t(r)}=n;if(i!==`custom`&&i!==`page`)throw new P(`Invalid format: "${i}". Use "custom" or "page".`);let c={id:s,label:r,repeatable:!a,status:!0,format:i,json:i===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}}},l=await o();await l.createCustomType(c),await l.generateTypes(),console.info(`Created type "${r}" (id: "${s}", format: "${i}")`),console.info(`Run \`prismic field add <type> --to-type ${s}\` to add fields.`),console.info(`Run \`prismic type view ${s}\` to view the type.`)}),oi=M({name:`prismic type edit`,description:`Edit a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`}}},async({positionals:e,values:t})=>{let[n]=e;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new P(`Invalid format: "${t.format}". Use "custom" or "page".`);let r=await o(),{model:i}=await r.getCustomType(n);`name`in t&&(i.label=t.name),`format`in t&&(i.format=t.format),await r.updateCustomType(i),await r.generateTypes(),console.info(`Type updated: "${i.label}" (id: ${i.id})`)}),si=M({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{"from-type":{type:`string`,required:!0,description:`ID of the content type`},name:{type:`string`,short:`n`,description:`New name for the tab`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},"without-slice-zone":{type:`boolean`,description:`Remove the slice zone from the tab`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-type":r}=t,i=await o(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new P(`Tab "${n}" not found in "${r}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new P(`Cannot use --with-slice-zone and --without-slice-zone together.`);if(`with-slice-zone`in t){let e=a.json[n];if(Object.values(e).some(e=>e.type===`Slices`))throw new P(`Tab "${n}" already has a slice zone.`);e.slices={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}if(`without-slice-zone`in t){let e=a.json[n],t=Object.entries(e).find(([,e])=>e.type===`Slices`);if(!t)throw new P(`Tab "${n}" does not have a slice zone.`);let[r,i]=t,o=i.type===`Slices`?i.config?.choices??{}:{};if(Object.keys(o).length>0)throw new P(`Cannot remove slice zone from "${n}": disconnect all slices first.`);delete e[r]}if(`name`in t){if(t.name in a.json)throw new P(`Tab "${t.name}" already exists in "${r}".`);let e={};for(let[r,i]of Object.entries(a.json))e[r===n?t.name:r]=i;a.json=e}await i.updateCustomType(a),await i.generateTypes(),console.info(`Tab updated: "${n}" in "${r}"`)}),ci=M({name:`prismic type list`,description:`List all content types.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await(await o()).getCustomTypes();if(t){console.info(D(n.map(e=>e.model)));return}if(n.length===0){console.info(`No types found.`);return}let r=n.map(({model:e})=>[e.label||`(no name)`,e.id,e.format??``]);console.info(h(r,{headers:[`NAME`,`ID`,`FORMAT`]}))}),li=M({name:`prismic type remove`,description:`Remove a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}}},async({positionals:e})=>{let[t]=e,n=await o(),{model:r}=await n.getCustomType(t);await n.deleteCustomType(r.id),await n.generateTypes(),console.info(`Type removed: ${t}`)}),ui=M({name:`prismic type remove-tab`,description:`Remove a tab from a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r}=t,i=await o(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new P(`Tab "${n}" not found in "${r}".`);if(Object.keys(a.json).length<=1)throw new P(`Cannot remove the last tab from "${r}".`);delete a.json[n],await i.updateCustomType(a),await i.generateTypes(),console.info(`Removed tab "${n}" from "${r}"`)}),di=M({name:`prismic type view`,description:`View details of a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,{model:i}=await(await o()).getCustomType(n);if(r){console.info(D(i));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.label||`(no name)`}`),console.info(`Format: ${i.format}`),console.info(`Repeatable: ${i.repeatable}`);for(let[e,t]of Object.entries(i.json)){console.info(``),console.info(`${e}:`);let n=Object.entries(t);if(n.length===0)console.info(` (no fields)`);else{let e=n.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(h(e))}}}),fi=N({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:ai,description:`Create a new content type`},edit:{handler:oi,description:`Edit a content type`},remove:{handler:li,description:`Remove a content type`},list:{handler:ci,description:`List content types`},view:{handler:di,description:`View a content type`},"add-tab":{handler:ii,description:`Add a tab to a content type`},"edit-tab":{handler:si,description:`Edit a tab of a content type`},"remove-tab":{handler:ui,description:`Remove a tab from a content type`}}}),pi=M({name:`prismic webhook create`,description:`
261
+ `}},async({positionals:e,values:n})=>{let[r]=e,{format:i=`custom`,single:a=!1,id:s=t(r)}=n;if(i!==`custom`&&i!==`page`)throw new P(`Invalid format: "${i}". Use "custom" or "page".`);let c={id:s,label:r,repeatable:!a,status:!0,format:i,json:i===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}}},l=await o();await l.createCustomType(c),await l.generateTypes(),console.info(`Created type "${r}" (id: "${s}", format: "${i}")`),console.info(`Run \`prismic field add <type> --to-type ${s}\` to add fields.`),console.info(`Run \`prismic type view ${s}\` to view the type.`)}),ai=M({name:`prismic type edit`,description:`Edit a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{name:{type:`string`,short:`n`,description:`New name for the type`},format:{type:`string`,short:`f`,description:`Type format: "custom" or "page"`}}},async({positionals:e,values:t})=>{let[n]=e;if(`format`in t&&t.format!==`custom`&&t.format!==`page`)throw new P(`Invalid format: "${t.format}". Use "custom" or "page".`);let r=await o(),{model:i}=await r.getCustomType(n);`name`in t&&(i.label=t.name),`format`in t&&(i.format=t.format),await r.updateCustomType(i),await r.generateTypes(),console.info(`Type updated: "${i.label}" (id: ${i.id})`)}),oi=M({name:`prismic type edit-tab`,description:`Edit a tab of a content type.`,positionals:{name:{description:`Current name of the tab`,required:!0}},options:{"from-type":{type:`string`,required:!0,description:`ID of the content type`},name:{type:`string`,short:`n`,description:`New name for the tab`},"with-slice-zone":{type:`boolean`,description:`Add a slice zone to the tab`},"without-slice-zone":{type:`boolean`,description:`Remove the slice zone from the tab`}}},async({positionals:e,values:t})=>{let[n]=e,{"from-type":r}=t,i=await o(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new P(`Tab "${n}" not found in "${r}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new P(`Cannot use --with-slice-zone and --without-slice-zone together.`);if(`with-slice-zone`in t){let e=a.json[n];if(Object.values(e).some(e=>e.type===`Slices`))throw new P(`Tab "${n}" already has a slice zone.`);e.slices={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}if(`without-slice-zone`in t){let e=a.json[n],t=Object.entries(e).find(([,e])=>e.type===`Slices`);if(!t)throw new P(`Tab "${n}" does not have a slice zone.`);let[r,i]=t,o=i.type===`Slices`?i.config?.choices??{}:{};if(Object.keys(o).length>0)throw new P(`Cannot remove slice zone from "${n}": disconnect all slices first.`);delete e[r]}if(`name`in t){if(t.name in a.json)throw new P(`Tab "${t.name}" already exists in "${r}".`);let e={};for(let[r,i]of Object.entries(a.json))e[r===n?t.name:r]=i;a.json=e}await i.updateCustomType(a),await i.generateTypes(),console.info(`Tab updated: "${n}" in "${r}"`)}),si=M({name:`prismic type list`,description:`List all content types.`,options:{json:{type:`boolean`,description:`Output as JSON`}}},async({values:e})=>{let{json:t}=e,n=await(await o()).getCustomTypes();if(t){console.info(D(n.map(e=>e.model)));return}if(n.length===0){console.info(`No types found.`);return}let r=n.map(({model:e})=>[e.label||`(no name)`,e.id,e.format??``]);console.info(h(r,{headers:[`NAME`,`ID`,`FORMAT`]}))}),ci=M({name:`prismic type remove`,description:`Remove a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}}},async({positionals:e})=>{let[t]=e,n=await o(),{model:r}=await n.getCustomType(t);await n.deleteCustomType(r.id),await n.generateTypes(),console.info(`Type removed: ${t}`)}),li=M({name:`prismic type remove-tab`,description:`Remove a tab from a content type.`,positionals:{name:{description:`Name of the tab`,required:!0}},options:{from:{type:`string`,required:!0,description:`ID of the content type`}}},async({positionals:e,values:t})=>{let[n]=e,{from:r}=t,i=await o(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new P(`Tab "${n}" not found in "${r}".`);if(Object.keys(a.json).length<=1)throw new P(`Cannot remove the last tab from "${r}".`);delete a.json[n],await i.updateCustomType(a),await i.generateTypes(),console.info(`Removed tab "${n}" from "${r}"`)}),ui=M({name:`prismic type view`,description:`View details of a content type.`,positionals:{id:{description:`ID of the content type`,required:!0}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t,{model:i}=await(await o()).getCustomType(n);if(r){console.info(D(i));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.label||`(no name)`}`),console.info(`Format: ${i.format}`),console.info(`Repeatable: ${i.repeatable}`);for(let[e,t]of Object.entries(i.json)){console.info(``),console.info(`${e}:`);let n=Object.entries(t);if(n.length===0)console.info(` (no fields)`);else{let e=n.map(([e,t])=>{let n=t.config,r=n?.label||``,i=n?.placeholder?`"${n.placeholder}"`:``;return[` ${e}`,t.type,r,i]});console.info(h(e))}}}),di=N({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:ii,description:`Create a new content type`},edit:{handler:ai,description:`Edit a content type`},remove:{handler:ci,description:`Remove a content type`},list:{handler:si,description:`List content types`},view:{handler:ui,description:`View a content type`},"add-tab":{handler:ri,description:`Add a tab to a content type`},"edit-tab":{handler:oi,description:`Edit a tab of a content type`},"remove-tab":{handler:li,description:`Remove a tab from a content type`}}}),fi=M({name:`prismic webhook create`,description:`
262
262
  Create a new webhook in a Prismic repository.
263
263
 
264
264
  By default, this command reads the repository from prismic.config.json at the
@@ -281,27 +281,27 @@ Watch stopped. Goodbye!`),A(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
281
281
 
282
282
  Create a named webhook with a secret:
283
283
  prismic webhook create https://example.com/webhook --name "Deploy" --secret my-secret
284
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,name:o,secret:s,trigger:c=[]}=t;for(let e of c)if(!En.includes(e))throw new P(`Invalid trigger: ${e}\nValid triggers: ${En.join(`, `)}`);let l=await O(),u=await k(),d=i?await H(i,{repo:r,token:l,host:u}):r,f=!(c.length>0);try{await kn({url:n,name:o??null,secret:s??null,documentsPublished:c.includes(`documentsPublished`)||f,documentsUnpublished:c.includes(`documentsUnpublished`)||f,releasesCreated:c.includes(`releasesCreated`)||f,releasesUpdated:c.includes(`releasesUpdated`)||f,tagsCreated:c.includes(`tagsCreated`)||f,tagsDeleted:c.includes(`tagsDeleted`)||f},{repo:d,token:l,host:u})}catch(e){throw e instanceof T?new P(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`),console.info(`Run \`prismic webhook set-triggers ${n}\` to configure triggers.`)}),mi=M({name:`prismic webhook disable`,description:`
284
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,name:o,secret:s,trigger:c=[]}=t;for(let e of c)if(!Tn.includes(e))throw new P(`Invalid trigger: ${e}\nValid triggers: ${Tn.join(`, `)}`);let l=await O(),u=await k(),d=i?await H(i,{repo:r,token:l,host:u}):r,f=!(c.length>0);try{await On({url:n,name:o??null,secret:s??null,documentsPublished:c.includes(`documentsPublished`)||f,documentsUnpublished:c.includes(`documentsUnpublished`)||f,releasesCreated:c.includes(`releasesCreated`)||f,releasesUpdated:c.includes(`releasesUpdated`)||f,tagsCreated:c.includes(`tagsCreated`)||f,tagsDeleted:c.includes(`tagsDeleted`)||f},{repo:d,token:l,host:u})}catch(e){throw e instanceof T?new P(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`),console.info(`Run \`prismic webhook set-triggers ${n}\` to configure triggers.`)}),pi=M({name:`prismic webhook disable`,description:`
285
285
  Disable a webhook in a Prismic repository.
286
286
 
287
287
  By default, this command reads the repository from prismic.config.json at the
288
288
  project root.
289
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await On({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to disable webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);if(!u.config.active){console.info(`Webhook already disabled: ${n}`);return}let d=u.config._id,f=structuredClone(u.config);f.active=!1;try{await An(d,f,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),hi=M({name:`prismic webhook enable`,description:`
289
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await Dn({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to disable webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);if(!u.config.active){console.info(`Webhook already disabled: ${n}`);return}let d=u.config._id,f=structuredClone(u.config);f.active=!1;try{await kn(d,f,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),mi=M({name:`prismic webhook enable`,description:`
290
290
  Enable a webhook in a Prismic repository.
291
291
 
292
292
  By default, this command reads the repository from prismic.config.json at the
293
293
  project root.
294
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await On({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to enable webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);if(u.config.active){console.info(`Webhook already enabled: ${n}`);return}let d=u.config._id,f=structuredClone(u.config);f.active=!0;try{await An(d,f,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),gi=M({name:`prismic webhook list`,description:`
294
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await Dn({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to enable webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);if(u.config.active){console.info(`Webhook already enabled: ${n}`);return}let d=u.config._id,f=structuredClone(u.config);f.active=!0;try{await kn(d,f,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),hi=M({name:`prismic webhook list`,description:`
295
295
  List all webhooks in a Prismic repository.
296
296
 
297
297
  By default, this command reads the repository from prismic.config.json at the
298
298
  project root.
299
- `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c;try{c=await On({repo:s,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to list webhooks: ${await e.text()}`):e}if(r){console.info(D(c.map(e=>e.config)));return}if(c.length===0){console.info(`No webhooks configured.`);return}let l=c.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(h(l,{headers:[`URL`,`STATUS`]}))}),_i=M({name:`prismic webhook remove`,description:`
299
+ `,options:{json:{type:`boolean`,description:`Output as JSON`},repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:t=await a(),env:n,json:r}=e,i=await O(),o=await k(),s=n?await H(n,{repo:t,token:i,host:o}):t,c;try{c=await Dn({repo:s,token:i,host:o})}catch(e){throw e instanceof T?new P(`Failed to list webhooks: ${await e.text()}`):e}if(r){console.info(D(c.map(e=>e.config)));return}if(c.length===0){console.info(`No webhooks configured.`);return}let l=c.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(h(l,{headers:[`URL`,`STATUS`]}))}),gi=M({name:`prismic webhook remove`,description:`
300
300
  Delete a webhook from a Prismic repository.
301
301
 
302
302
  By default, this command reads the repository from prismic.config.json at the
303
303
  project root.
304
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await On({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);let d=u.config._id;try{await jn(d,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),vi=M({name:`prismic webhook set-triggers`,description:`
304
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await Dn({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove webhook: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);let d=u.config._id;try{await An(d,{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),_i=M({name:`prismic webhook set-triggers`,description:`
305
305
  Update which events trigger a webhook.
306
306
 
307
307
  By default, this command reads the repository from prismic.config.json at the
@@ -313,17 +313,17 @@ Watch stopped. Goodbye!`),A(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
313
313
  releasesUpdated When a release is edited or deleted
314
314
  tagsCreated When a tag is created
315
315
  tagsDeleted When a tag is deleted
316
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,trigger:o=[]}=t;for(let e of o)if(!En.includes(e))throw new P(`Invalid trigger: ${e}\nValid triggers: ${En.join(`, `)}`);let s=await O(),c=await k(),l=i?await H(i,{repo:r,token:s,host:c}):r,u;try{u=await On({repo:l,token:s,host:c})}catch(e){throw e instanceof T?new P(`Failed to update webhook triggers: ${await e.text()}`):e}let d=u.find(e=>e.config.url===n);if(!d)throw new P(`Webhook not found: ${n}`);let f=d.config._id;try{await An(f,{...d.config,documentsPublished:o.includes(`documentsPublished`),documentsUnpublished:o.includes(`documentsUnpublished`),releasesCreated:o.includes(`releasesCreated`),releasesUpdated:o.includes(`releasesUpdated`),tagsCreated:o.includes(`tagsCreated`),tagsDeleted:o.includes(`tagsDeleted`)},{repo:l,token:s,host:c})}catch(e){throw e instanceof T?new P(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${o.join(`, `)}`)}),yi=M({name:`prismic webhook view`,description:`
316
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i,trigger:o=[]}=t;for(let e of o)if(!Tn.includes(e))throw new P(`Invalid trigger: ${e}\nValid triggers: ${Tn.join(`, `)}`);let s=await O(),c=await k(),l=i?await H(i,{repo:r,token:s,host:c}):r,u;try{u=await Dn({repo:l,token:s,host:c})}catch(e){throw e instanceof T?new P(`Failed to update webhook triggers: ${await e.text()}`):e}let d=u.find(e=>e.config.url===n);if(!d)throw new P(`Webhook not found: ${n}`);let f=d.config._id;try{await kn(f,{...d.config,documentsPublished:o.includes(`documentsPublished`),documentsUnpublished:o.includes(`documentsUnpublished`),releasesCreated:o.includes(`releasesCreated`),releasesUpdated:o.includes(`releasesUpdated`),tagsCreated:o.includes(`tagsCreated`),tagsDeleted:o.includes(`tagsDeleted`)},{repo:l,token:s,host:c})}catch(e){throw e instanceof T?new P(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${o.join(`, `)}`)}),vi=M({name:`prismic webhook view`,description:`
317
317
  View details of a webhook in a Prismic repository.
318
318
 
319
319
  By default, this command reads the repository from prismic.config.json at the
320
320
  project root.
321
- `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await On({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to fetch webhook details: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);let{config:d}=u;console.info(`URL: ${d.url}`),console.info(`Name: ${d.name||`(none)`}`),console.info(`Status: ${d.active?`enabled`:`disabled`}`),console.info(`Secret: ${d.secret?`(set)`:`(none)`}`);let f=[];for(let e of En)d[e]&&f.push(e);if(console.info(`Triggers: ${f.length>0?f.join(`, `):`(none)`}`),Object.keys(d.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(d.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),bi=N({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:gi,description:`List all webhooks`},create:{handler:pi,description:`Create a new webhook`},view:{handler:yi,description:`View webhook details`},remove:{handler:_i,description:`Delete a webhook`},enable:{handler:hi,description:`Enable a webhook`},disable:{handler:mi,description:`Disable a webhook`},"set-triggers":{handler:vi,description:`Update webhook triggers`}}}),xi=M({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await r({token:await O(),host:await k()});console.info(e.email)});const Si=fe({exp:se(ue())});function Ci(e){try{let[,t]=e.split(`.`);return t?ie(Si,JSON.parse(Buffer.from(t,`base64url`).toString())):void 0}catch{return}}const U=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,W=globalThis,wi=`10.42.0`;function G(){return Ti(W),W}function Ti(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||wi,t[wi]=t[wi]||{}}function Ei(e,t,n=W){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[wi]=r[wi]||{};return i[e]||(i[e]=t())}const Di=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Oi={};function ki(e){if(!(`console`in W))return e();let t=W.console,n={},r=Object.keys(Oi);r.forEach(e=>{let r=Oi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Ai(){Li().enabled=!0}function ji(){Li().enabled=!1}function Mi(){return Li().enabled}function Ni(...e){Ii(`log`,...e)}function Pi(...e){Ii(`warn`,...e)}function Fi(...e){Ii(`error`,...e)}function Ii(e,...t){U&&Mi()&&ki(()=>{W.console[e](`Sentry Logger [${e}]:`,...t)})}function Li(){return U?Ei(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const K={enable:Ai,disable:ji,isEnabled:Mi,log:Ni,warn:Pi,error:Fi},Ri=/\(error: (.*)\)/,zi=/captureMessage|captureException/;function Bi(...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(`
322
- `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Ri.test(n)?n.replace(Ri,`$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 Hi(i.slice(r))}}function Vi(e){return Array.isArray(e)?Bi(...e):e}function Hi(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Ui(t).function||``)&&t.pop(),t.reverse(),zi.test(Ui(t).function||``)&&(t.pop(),zi.test(Ui(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Ui(t).filename,function:e.function||`?`}))}function Ui(e){return e[e.length-1]||{}}const Wi=`<anonymous>`;function Gi(e){try{return!e||typeof e!=`function`?Wi:e.name||Wi}catch{return Wi}}function Ki(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function qi(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Ji={},Yi={};function Xi(e,t){Ji[e]=Ji[e]||[],Ji[e].push(t)}function Zi(e,t){if(!Yi[e]){Yi[e]=!0;try{t()}catch(t){U&&K.error(`Error while instrumenting ${e}`,t)}}}function Qi(e,t){let n=e&&Ji[e];if(n)for(let r of n)try{r(t)}catch(t){U&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Gi(r)}\nError:`,t)}}let $i=null;function ea(e){let t=`error`;Xi(t,e),Zi(t,ta)}function ta(){$i=W.onerror,W.onerror=function(e,t,n,r,i){return Qi(`error`,{column:r,error:i,line:n,msg:e,url:t}),$i?$i.apply(this,arguments):!1},W.onerror.__SENTRY_INSTRUMENTED__=!0}let na=null;function ra(e){let t=`unhandledrejection`;Xi(t,e),Zi(t,ia)}function ia(){na=W.onunhandledrejection,W.onunhandledrejection=function(e){return Qi(`unhandledrejection`,e),na?na.apply(this,arguments):!0},W.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const aa=Object.prototype.toString;function oa(e){switch(aa.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return va(e,Error)}}function sa(e,t){return aa.call(e)===`[object ${t}]`}function ca(e){return sa(e,`ErrorEvent`)}function la(e){return sa(e,`String`)}function ua(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function da(e){return e===null||ua(e)||typeof e!=`object`&&typeof e!=`function`}function fa(e){return sa(e,`Object`)}function pa(e){return typeof Event<`u`&&va(e,Event)}function ma(e){return typeof Element<`u`&&va(e,Element)}function ha(e){return sa(e,`RegExp`)}function ga(e){return!!(e?.then&&typeof e.then==`function`)}function _a(e){return fa(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function va(e,t){try{return e instanceof t}catch{return!1}}function ya(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const ba=W;function xa(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=Sa(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 Sa(e,t){let n=e,r=[];if(!n?.tagName)return``;if(ba.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&&la(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 Ca(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ta(i,r);try{e[t]=i}catch{U&&K.log(`Failed to replace method "${t}" in object`,e)}}function wa(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{U&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ta(e,t){try{e.prototype=t.prototype=t.prototype||{},wa(e,`__sentry_original__`,t)}catch{}}function Ea(e){return e.__sentry_original__}function Da(e){if(oa(e))return{message:e.message,name:e.name,stack:e.stack,...ka(e)};if(pa(e)){let t={type:e.type,target:Oa(e.target),currentTarget:Oa(e.currentTarget),...ka(e)};return typeof CustomEvent<`u`&&va(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Oa(e){try{return ma(e)?xa(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function ka(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 Aa(e){let t=Object.keys(Da(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let ja;function Ma(e){if(ja!==void 0)return ja?ja(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=W;return t in n&&typeof n[t]==`function`?(ja=n[t],ja(e)):(ja=null,e())}function Na(){return Ma(()=>Math.random())}function Pa(){return Ma(()=>Date.now())}function Fa(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Ia(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 La(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{ya(r)?n.push(Ki(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function Ra(e,t,n=!1){return la(e)?ha(t)?t.test(e):la(t)?n?e===t:e.includes(t):!1:!1}function za(e,t=[],n=!1){return t.some(t=>Ra(e,t,n))}function Ba(){let e=W;return e.crypto||e.msCrypto}let Va;function Ha(){return Na()*16}function q(e=Ba()){try{if(e?.randomUUID)return Ma(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Va||=`10000000100040008000100000000000`,Va.replace(/[018]/g,e=>(e^(Ha()&15)>>e/4).toString(16))}function Ua(e){return e.exception?.values?.[0]}function Wa(e){let{message:t,event_id:n}=e;if(t)return t;let r=Ua(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Ga(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 Ka(e,t){let n=Ua(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 qa=/^(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 Ja(e){return parseInt(e||``,10)}function Ya(e){let t=e.match(qa)||[],n=Ja(t[1]),r=Ja(t[2]),i=Ja(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 Xa(e){if(Za(e))return!0;try{wa(e,`__sentry_captured__`,!0)}catch{}return!1}function Za(e){try{return e.__sentry_captured__}catch{}}const Qa=1e3;function $a(){return Pa()/Qa}function eo(){let{performance:e}=W;if(!e?.now||!e.timeOrigin)return $a;let t=e.timeOrigin;return()=>(t+Ma(()=>e.now()))/Qa}let to;function no(){return(to??=eo())()}function ro(e){let t=no(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>oo(n)};return e&&io(n,e),n}function io(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||no(),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:q()),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 ao(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),io(e,n)}function oo(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 so(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]=so(r[e],t[e],n-1));return r}function co(){return q()}function lo(){return q().substring(16)}const uo=`_sentrySpan`;function fo(e,t){t?wa(e,uo,t):delete e[uo]}function po(e){return e[uo]}var mo=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:co(),sampleRand:Na()}}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,fo(t,po(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&&io(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():fa(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,fo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:co(),sampleRand:Na()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:$a(),...e,message:e.message?Fa(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:po(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=so(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||q();if(!this._client)return U&&K.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||q();if(!this._client)return U&&K.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||q();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(U&&K.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 ho(){return Ei(`defaultCurrentScope`,()=>new mo)}function go(){return Ei(`defaultIsolationScope`,()=>new mo)}var _o=class{constructor(e,t){let n;n=e||new mo;let r;r=t||new mo,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 ga(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 vo(){let e=Ti(G());return e.stack=e.stack||new _o(ho(),go())}function yo(e){return vo().withScope(e)}function bo(e,t){let n=vo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function xo(e){return vo().withScope(()=>e(vo().getIsolationScope()))}function So(){return{withIsolationScope:xo,withScope:yo,withSetScope:bo,withSetIsolationScope:(e,t)=>xo(t),getCurrentScope:()=>vo().getScope(),getIsolationScope:()=>vo().getIsolationScope()}}function Co(e){let t=Ti(G());t.acs=e}function wo(e){let t=Ti(e);return t.acs?t.acs:So()}function J(){return wo(G()).getCurrentScope()}function Y(){return wo(G()).getIsolationScope()}function To(){return Ei(`globalScope`,()=>new mo)}function Eo(...e){let t=wo(G());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Do(...e){let t=wo(G());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function X(){return J().getClient()}function Oo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||lo()};return n&&(i.parent_span_id=n),i}const ko=`sentry.profile_id`,Ao=`sentry.exclusive_time`;function jo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function Mo(e){let t=e;return{scope:t._sentryScope,isolationScope:jo(t._sentryIsolationScope)}}const No=/^sentry-/;function Po(e){let t=Io(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(No)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Fo(e){if(e)return Ro(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Io(e){if(!(!e||!la(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Lo(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Lo(e)}function Lo(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 Ro(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?(U&&K.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const zo=/^o(\d+)\./,Bo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Vo(e){return e===`http`||e===`https`}function Ho(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 Uo(e){let t=Bo.exec(e);if(!t){ki(()=>{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 Wo({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Wo(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Go(e){if(!U)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(K.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Vo(r)?t&&isNaN(parseInt(t,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ko(e){return e.match(zo)?.[1]}function qo(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Ko(n)),r}function Jo(e){let t=typeof e==`string`?Uo(e):Wo(e);if(!(!t||!Go(t)))return t}function Yo(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 Xo=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Zo(e){if(!e)return;let t=e.match(Xo);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 Qo(e,t){let n=Zo(e),r=Po(t);if(!n?.traceId)return{traceId:co(),sampleRand:Na()};let i=ts(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 $o(e=co(),t=lo(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function es(e=co(),t=lo(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function ts(e,t){let n=Yo(t?.sample_rand);if(n!==void 0)return n;let r=Yo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Na()*r:r+Na()*(1-r):Na()}function ns(e,t){let n=qo(e);return t&&n&&t!==n?(K.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)?(K.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 rs=!1;function is(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:us(e).parent_span_id,a=Mo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||lo():t,trace_id:n}}function as(e){let{traceId:t,spanId:n}=e.spanContext();return $o(t,n,ps(e))}function os(e){let{traceId:t,spanId:n}=e.spanContext();return es(t,n,ps(e))}function ss(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 cs(e){return typeof e==`number`?ls(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ls(e.getTime()):no()}function ls(e){return e>9999999999?e/1e3:e}function us(e){if(fs(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(ds(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:cs(i),timestamp:cs(o)||void 0,status:ms(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:ss(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function ds(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function fs(e){return typeof e.getSpanJSON==`function`}function ps(e){let{traceFlags:t}=e.spanContext();return t===1}function ms(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function hs(e){return e._sentryRootSpan||e}function gs(){let e=wo(G());return e.getActiveSpan?e.getActiveSpan():po(J())}function _s(){rs||=(ki(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let vs=!1;function ys(){if(vs)return;function e(){let e=gs(),t=e&&hs(e);if(t){let e=`internal_error`;U&&K.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,vs=!0,ea(e),ra(e)}function bs(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||X()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function xs(e){K.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Ss(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(ws(n)){if(Ra(e.description,n))return U&&xs(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?Ra(e.description,n.name):!0,r=n.op?e.op&&Ra(e.op,n.op):!0;if(t&&r)return U&&xs(e),!0}return!1}function Cs(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 ws(e){return typeof e==`string`||e instanceof RegExp}const Ts=`production`;function Es(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Ts,release:n.release,public_key:r,trace_id:e,org_id:qo(t)};return t.emit(`createDsc`,i),i}function Ds(e,t){let n=t.getPropagationContext();return n.dsc||Es(n.traceId,e)}function Os(e){let t=X();if(!t)return{};let n=hs(e),r=us(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&&Po(l);if(u)return s(u);let d=Es(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),bs()&&(d.sampled=String(ps(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Mo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function ks(e,t=100,n=1/0){try{return js(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function As(e,t=3,n=100*1024){let r=ks(e,t);return Fs(r)>n?As(e,t-1,n):r}function js(e,t,n=1/0,r=1/0,i=Is()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Ms(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 js(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Da(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]=js(e,t,c-1,r,i),d++}return o(t),u}function Ms(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(ya(t))return Ki(t);if(_a(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Gi(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=Ns(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function Ns(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Ps(e){return~-encodeURI(e).split(/%..|./).length}function Fs(e){return Ps(JSON.stringify(e))}function Is(){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 Ls(e,t=[]){return[e,t]}function Rs(e,t){let[n,r]=e;return[n,[...r,t]]}function zs(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 Bs(e,t){return zs(e,(e,n)=>t.includes(n))}function Vs(e){let t=Ti(W);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Hs(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Vs(r),e]:r.push(typeof e==`string`?Vs(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(ks(n))}i(e)}}return typeof r==`string`?r:Us(r)}function Us(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 Ws(e){let t=typeof e.data==`string`?Vs(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Gs={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 Ks(e){return Gs[e]}function qs(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Js(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:Ho(r)},...i&&{trace:i}}}function Ys(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 Xs(e,t,n,r){let i=qs(n);return Ls({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Ho(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Zs(e,t,n,r){let i=qs(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Ys(e,n?.sdk);let o=Js(e,i,r,t);return delete e.sdkProcessingMetadata,Ls(o,[[{type:a},e]])}const Qs=`__SENTRY_SUPPRESS_TRACING__`,$s=(e,t)=>{let n=wo(G());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=X(),o=Po(i);return a&&!ns(a,o?.org_id)?nc(t):Eo(e=>{let n=Qo(r,i);return e.setPropagationContext(n),fo(e,void 0),t()})};function ec(e,t){let n=rc();return n.withActiveSpan?n.withActiveSpan(e,t):Eo(n=>(fo(n,e||void 0),t(n)))}function tc(e){let t=rc();return t.suppressTracing?t.suppressTracing(e):Eo(t=>{t.setSDKProcessingMetadata({[Qs]:!0});let n=e();return t.setSDKProcessingMetadata({[Qs]:void 0}),n})}function nc(e){return Eo(t=>(t.setPropagationContext({traceId:co(),sampleRand:Na()}),U&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),ec(null,e)))}function rc(){return wo(G())}function ic(e){return new oc(t=>{t(e)})}function ac(e){return new oc((t,n)=>{n(e)})}var oc=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(ga(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 sc(e,t,n,r=0){try{let i=cc(t,n,e,r);return ga(i)?i:ic(i)}catch(e){return ac(e)}}function cc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return U&&a===null&&K.log(`Event processor "${i.id||`?`}" dropped event`),ga(a)?a.then(e=>cc(e,t,n,r+1)):cc(a,t,n,r+1)}let lc,uc,dc,fc;function pc(e){let t=W._sentryDebugIds,n=W._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(fc&&r.length===uc&&i.length===dc)return fc;uc=r.length,dc=i.length,fc={},lc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=lc?.[r];if(i&&fc&&t)fc[i[0]]=t,lc&&(lc[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&&fc&&lc){fc[i]=t,lc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),fc}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=so(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]=so(e[t],n,1)}function _c(e,t){let n=To().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:is(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Os(t),...e.sdkProcessingMetadata};let n=us(hs(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||q(),timestamp:t.timestamp||$a()},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&&Ka(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?ic(c):sc(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||Ts,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Fa(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Fa(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:ks(e.data,t,n)}}))},...e.user&&{user:ks(e.user,t,n)},...e.contexts&&{contexts:ks(e.contexts,t,n)},...e.extra&&{extra:ks(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=ks(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:ks(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=ks(e.contexts.flags,3,n)),r}function kc(e,t){if(!t)return e;let n=e?e.clone():new mo;return n.update(t),n}function Ac(e){if(e)return jc(e)||Nc(e)?{captureContext:e}:e}function jc(e){return e instanceof mo||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 J().captureException(e,Ac(t))}function Fc(e,t){Y().setContext(e,t)}function Ic(e,t){Y().setTag(e,t)}function Lc(e){Y().setUser(e)}async function Rc(e){let t=X();return t?t.flush(e):(U&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function zc(){let e=X();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Bc(e){let t=Y(),{user:n}=_c(t,J()),{userAgent:r}=W.navigator||{},i=ro({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&io(a,{status:`exited`}),Vc(),t.setSession(i),i}function Vc(){let e=Y(),t=J().getSession()||e.getSession();t&&ao(t),Hc(),e.setSession()}function Hc(){let e=Y(),t=X(),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]){U&&K.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)}U&&K.log(`Integration installed: ${t.name}`)}function Z(e){return e}function $c(e,t){return t?Eo(t,()=>{let n=gs(),r=n?is(n):Oo(t);return[n?Os(n):Ds(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=Ho(r)),Ls(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 Ei(`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=Ho(r)),Ls(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 Ei(`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 ac(dl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return ic(!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=Pa()){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=Pa()){return ml(e,t)>n}function gl(e,{statusCode:t,headers:n},r=Pa()){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(zs(i,(t,n)=>{let i=Ks(n);hl(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Ls(i[0],a),s=t=>{if(Bs(o,[`client_report`])){U&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}zs(o,(n,r)=>{e.recordDroppedEvent(t,Ks(r))})};return n.add(()=>t({body:Hs(o)}).then(e=>e.statusCode===413?(U&&K.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(U&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&K.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=gl(r,e),e),e=>{throw s(`network_error`),U&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===dl)return U&&K.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||$a(),discarded_events:e}];return Ls(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?.[ko],exclusive_time:o?.[Ao],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&&{[ko]:e.profile_id},...e.exclusive_time&&{[Ao]: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=Jo(e.dsn):U&&K.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=q();if(Xa(e))return U&&K.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:q(),...n},a=ua(e)?e:String(e),o=da(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=q();if(t?.originalException&&Xa(t.originalException))return U&&K.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),io(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=Zs(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Rs(n,Ws(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Ts}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){U&&K.warn(Cl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){U&&K.warn(Cl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Xs(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}`;U&&K.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 U&&K.error(`Error while sending envelope:`,e),{}}return U&&K.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)&&(io(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:Oo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ds(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=Y()){return U&&Fl(e)&&K.log(`Captured error event \`${yl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{U&&(kl(e)?K.log(e.message):Ol(e)?K.warn(e.message):K.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:Yo(a);if(s&&typeof l==`number`&&Na()>l)return this.recordDroppedEvent(`sample_rate`,`error`),ac(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(){U&&K.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){U&&K.log(`No outcomes to send`);return}if(!this._dsn){U&&K.log(`No dsn provided, will not send outcomes`);return}U&&K.log(`Sending outcomes:`,e);let t=vl(e,this._options.tunnel&&Ho(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(ga(e))return e.then(e=>{if(!fa(e)&&e!==null)throw El(n);return e},e=>{throw El(`${t} rejected with ${e}`)});if(!fa(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&&Ss(t,s))return null;if(o){let e=o(t);e?c=so(n,xl(e)):_s()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&Ss(e,s)){Cs(n,e);continue}if(o){let n=o(e);n?t.push(n):(_s(),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]):da(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=Ho(i)),t&&(a.trace=t),Ls(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 oa(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=Aa(e);if(ca(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(oa(n))return[n,void 0];if(t.synthetic=!0,fa(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:As(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),Ga(s,void 0,void 0),Ka(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}}]},Ka(a,{synthetic:!0}))}if(ua(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){ys(),Ul(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Ql(this,this._options.stackParser,e,t);return n.level=`error`,ic(n)}eventFromMessage(e,t=`info`,n){return ic($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:q();if(!this._isEnabled())return U&&K.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 U&&K.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){U&&K.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=Y().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:wi})),i.version=wi)}function lu(e={}){let t=e.client||X();if(!zc()||!t)return{};let n=wo(G());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||gs(),a=i?as(i):uu(r),o=Fo(i?Os(i):Ds(t,r));if(!Xo.test(a))return K.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?os(i):du(r)),s}function uu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return $o(t,r,n)}function du(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return es(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 U&&!r&&K.log(fu,e),r;let i=za(e,t);return n?.set(e,i),U&&!i&&K.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=X(),r=Y();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:$a(),...e},s=i?ki(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let yu;const bu=new WeakMap,xu=Z((()=>({name:`FunctionToString`,setupOnce(){yu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Ea(this),n=bu.has(X())&&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=Z((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 U&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Wa(e)}`),!0}else{if(Eu(e,t.ignoreErrors))return U&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Wa(e)}`),!0;if(Mu(e))return U&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Wa(e)}`),!0;if(Ou(e,t.denyUrls))return U&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Wa(e)}.\nUrl: ${ju(e)}`),!0;if(!ku(e,t.allowUrls))return U&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Wa(e)}.\nUrl: ${ju(e)}`),!0}return!1}function Eu(e,t){return t?.length?yl(e).some(e=>za(e,t)):!1}function Du(e,t){if(!t?.length)return!1;let n=e.transaction;return n?za(n,t):!1}function Ou(e,t){if(!t?.length)return!1;let n=ju(e);return n?za(n,t):!1}function ku(e,t){if(!t?.length)return!0;let n=ju(e);return n?za(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 U&&K.error(`Cannot extract url for event ${Wa(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||!va(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(va(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(va(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=Z(((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=Z(((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`;Xi(t,e),Zi(t,Yu)}function Yu(){`console`in W&&Di.forEach(function(e){e in W.console&&Ca(W.console,e,function(t){return Oi[e]=t,function(...t){Qi(`console`,{args:t,level:e}),Oi[e]?.apply(W.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=Z((e={})=>{let t=new Set(e.levels||Di);return{name:`Console`,setup(e){Ju(({args:n,level:r})=>{X()!==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 W&&typeof W.util.format==`function`?W.util.format(...e):La(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=qi(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 Q=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||j.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};cu(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${Ye?`main`:`worker-${Xe}`}.`),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(()=>{Q&&K.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const dd=Z((e={})=>({name:`ChildProcess`,setup(){Ze.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&fd(t.process,e)}),Ze.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=Fe(tt),hd=Fe(rt),gd=Z(((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=kd()),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=j.freemem()),e}async function vd(){let e=j.platform();switch(e){case`darwin`:return Ed();case`linux`:return Od();default:return{name:Sd[e]||e,version:j.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=j.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=j.arch(),(e===!0||e.memory)&&(t.memory_size=j.totalmem(),t.free_memory=j.freemem()),e===!0||e.cpu){let e=j.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=>Td(/distrib_release=(.*)/,e),centos:e=>Td(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Td(/release (..)/,e),mint:e=>Td(/distrib_release=(.*)/,e),red:e=>Td(/release ([^ ]+)/,e),suse:e=>Td(/VERSION = (.*)\n/,e),ubuntu:e=>Td(/distrib_release=(.*)/,e)};function Td(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Ed(){let e={kernel_version:j.release(),name:`Mac OS X`,version:`10.${Number(j.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{We(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Td(/^ProductName:\s+(.*)$/m,t),e.version=Td(/^ProductVersion:\s+(.*)$/m,t),e.build=Td(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Dd(e){return e.split(` `)[0].toLowerCase()}async function Od(){let e={kernel_version:j.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(Be(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Dd(e))>=0)||i[0],e.version=wd[Dd(e.name)]?.(r)}catch{}return e}function kd(){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 Ad=new ld(10),jd=new ld(20);function Md(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Nd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function Pd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function Fd(e,t){let n=Ad.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 Id(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=Wd(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=Wd(r,t)),n++}return a}function Ld(e,t,n){return new Promise((r,i)=>{let a=$e(e),o=Ke({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){jd.set(e,1),Q&&K.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]=Ia(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 Rd(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`||Nd(i)||Pd(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(jd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=Id(r,t);if(a.every(t=>Fd(e,t)))continue;let o=Md(Ad,e,{});i.push(Ld(e,a,o))}if(await Promise.all(i).catch(()=>{Q&&K.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&&zd(n.stacktrace.frames,t,Ad);return e}function zd(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;Vd(r.lineno,r,t,e)}}function Bd(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Vd(e,t,n,r){if(t.lineno===void 0||r===void 0){Q&&K.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=Hd(e,n);i<e;i++){let e=r[i];if(e===void 0){Bd(t),Q&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){Bd(t),Q&&K.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=Ud(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 Hd(e,t){return Math.max(1,e-t)}function Ud(e,t){return e+t}function Wd(e,t){return[Hd(e,t),Ud(e,t)]}const Gd=Z(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Rd(e,t)}}})),Kd=Ya(process.versions.node),qd=Kd.major;Kd.minor;let Jd;async function Yd(){if(Jd===void 0)try{Jd=!!(await import(`node:inspector`)).url()}catch{Jd=!1}return Jd}const Xd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Zd(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 Qd(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function $d(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Qd(e)&&Qd(t)}function ef(...e){K.log(`[LocalVariables]`,...e)}const tf=Z(((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||!$d(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&Xd in n.originalException&&Array.isArray(n.originalException[Xd])){for(let r of e.exception?.values||[])t(r,n.originalException[Xd]);n.originalException[Xd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new it(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=>{ef(`Worker error`,e)}),t.once(`exit`,e=>{ef(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Yd()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:K.isEnabled()};r().then(()=>{try{i(n)}catch(e){K.error(`Failed to start worker`,e)}},e=>{K.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function nf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function rf(e,t){if(t!==void 0)return nf(e(t,1))}function af(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 of=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}=af(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 sf=Z(((e={},t)=>{let n=new ld(20),r,i=!1;function a(t){let r=nf(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||!$d(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=X()?.getOptions();if(a?.includeLocalVariables){if(qd<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Yd()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await of.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=rf(e,i.description);if(c==null){s();return}let{add:l,next:u}=af(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=Zd(e.maxExceptionsPerSecond||50,()=>{K.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{K.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){K.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]}}})),cf=(e={})=>Kd.major<19?sf(e):tf(e);function lf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let uf;const df=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,ff=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...gf()},e},getModules:gf}));function pf(){try{return n.cache?Object.keys(n.cache):[]}catch{return[]}}function mf(){return{...df,...vf(),...lf()?hf():{}}}function hf(){let e=n.main?.paths||[],t=pf(),r={},i=new Set;return t.forEach(t=>{let n=t,a=()=>{let t=n;if(n=ze(t),!n||t===n||i.has(t))return;if(e.indexOf(n)<0)return a();let o=Be(t,`package.json`);if(i.add(t),!et(o))return a();try{let e=JSON.parse(nt(o,`utf8`));r[e.name]=e.version}catch{}};a()}),r}function gf(){return uf||=mf(),uf}function _f(){try{let e=Be(process.cwd(),`package.json`);return JSON.parse(nt(e,`utf8`))}catch{return{}}}function vf(){let e=_f();return{...e.dependencies,...e.devDependencies}}function yf(e){ki(()=>{console.error(e)});let t=X();if(t===void 0){Q&&K.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||Q&&K.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Q&&K.error(e)})}const bf=Z((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Ye&&global.process.on(`uncaughtException`,xf(e,t))}}});function xf(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=yf;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?(Q&&K.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),yf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,X()===e&&Pc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const Sf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Cf=Z(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Sf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Df(e,t))}}}));function wf(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 Tf(e,t){let n=e.name===void 0||Ra(t.name,e.name,!0),r=e.message===void 0||Ra(t.message,e.message);return n&&r}function Ef(e,t){let n=wf(t);return e.some(e=>Tf(e,n))}function Df(e,t){return function(n,r){if(X()!==e||Ef(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>ec(a,e):e=>e())(()=>{Pc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Of(n,t.mode)}}function Of(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`?ki(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(ki(()=>{console.warn(n)}),yf(e))}const kf=Z(()=>({name:`ProcessSession`,setupOnce(){Bc(),process.on(`beforeExit`,()=>{Y().getSession()?.status!==`ok`&&Vc()})}})),Af=`Spotlight`,jf=Z(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Af,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&K.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}Mf(e,t)}}}));function Mf(e,t){let n=Nf(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){K.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Hs(e);tc(()=>{let e=qe.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++,K.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Nf(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Pf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ne.getSystemErrorMap().has(e.errno)}const Ff=Z((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!Pf(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 If(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function Lf(e=process.argv[1]?$u(process.argv[1]):process.cwd(),t=He===`\\`){let n=t?If(e):e;return e=>{if(!e)return;let r=t?If(e):e,{dir:i,base:a,ext:o}=Ve.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 Rf(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(W.SENTRY_RELEASE?.id)return W.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 zf=Bi(od(Lf())),Bf=Symbol(`AgentBaseInternalState`);var Vf=class extends qe.Agent{constructor(e){super(e),this[Bf]={}}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(`
323
- `).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 qe.Agent)return i.addRequest(e,r);this[Bf].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[Bf].currentSocket;if(this[Bf].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Bf].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[Bf]&&(this[Bf].defaultPort=e)}get protocol(){return this[Bf].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[Bf]&&(this[Bf].protocol=e)}};function Hf(...e){K.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Uf(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(),Hf(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Hf(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
321
+ `,positionals:{url:{description:`Webhook URL`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await a(),env:i}=t,o=await O(),s=await k(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await Dn({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new P(`Failed to fetch webhook details: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new P(`Webhook not found: ${n}`);let{config:d}=u;console.info(`URL: ${d.url}`),console.info(`Name: ${d.name||`(none)`}`),console.info(`Status: ${d.active?`enabled`:`disabled`}`),console.info(`Secret: ${d.secret?`(set)`:`(none)`}`);let f=[];for(let e of Tn)d[e]&&f.push(e);if(console.info(`Triggers: ${f.length>0?f.join(`, `):`(none)`}`),Object.keys(d.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(d.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),yi=N({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:hi,description:`List all webhooks`},create:{handler:fi,description:`Create a new webhook`},view:{handler:vi,description:`View webhook details`},remove:{handler:gi,description:`Delete a webhook`},enable:{handler:mi,description:`Enable a webhook`},disable:{handler:pi,description:`Disable a webhook`},"set-triggers":{handler:_i,description:`Update webhook triggers`}}}),bi=M({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await r({token:await O(),host:await k()});console.info(e.email)});const xi=fe({exp:se(ue())});function Si(e){try{let[,t]=e.split(`.`);return t?ie(xi,JSON.parse(Buffer.from(t,`base64url`).toString())):void 0}catch{return}}const U=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,W=globalThis,Ci=`10.42.0`;function G(){return wi(W),W}function wi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ci,t[Ci]=t[Ci]||{}}function Ti(e,t,n=W){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Ci]=r[Ci]||{};return i[e]||(i[e]=t())}const Ei=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Di={};function Oi(e){if(!(`console`in W))return e();let t=W.console,n={},r=Object.keys(Di);r.forEach(e=>{let r=Di[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function ki(){Ii().enabled=!0}function Ai(){Ii().enabled=!1}function ji(){return Ii().enabled}function Mi(...e){Fi(`log`,...e)}function Ni(...e){Fi(`warn`,...e)}function Pi(...e){Fi(`error`,...e)}function Fi(e,...t){U&&ji()&&Oi(()=>{W.console[e](`Sentry Logger [${e}]:`,...t)})}function Ii(){return U?Ti(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const K={enable:ki,disable:Ai,isEnabled:ji,log:Mi,warn:Ni,error:Pi},Li=/\(error: (.*)\)/,Ri=/captureMessage|captureException/;function zi(...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(`
322
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Li.test(n)?n.replace(Li,`$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 Vi(i.slice(r))}}function Bi(e){return Array.isArray(e)?zi(...e):e}function Vi(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Hi(t).function||``)&&t.pop(),t.reverse(),Ri.test(Hi(t).function||``)&&(t.pop(),Ri.test(Hi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Hi(t).filename,function:e.function||`?`}))}function Hi(e){return e[e.length-1]||{}}const Ui=`<anonymous>`;function Wi(e){try{return!e||typeof e!=`function`?Ui:e.name||Ui}catch{return Ui}}function Gi(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function Ki(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const qi={},Ji={};function Yi(e,t){qi[e]=qi[e]||[],qi[e].push(t)}function Xi(e,t){if(!Ji[e]){Ji[e]=!0;try{t()}catch(t){U&&K.error(`Error while instrumenting ${e}`,t)}}}function Zi(e,t){let n=e&&qi[e];if(n)for(let r of n)try{r(t)}catch(t){U&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Wi(r)}\nError:`,t)}}let Qi=null;function $i(e){let t=`error`;Yi(t,e),Xi(t,ea)}function ea(){Qi=W.onerror,W.onerror=function(e,t,n,r,i){return Zi(`error`,{column:r,error:i,line:n,msg:e,url:t}),Qi?Qi.apply(this,arguments):!1},W.onerror.__SENTRY_INSTRUMENTED__=!0}let ta=null;function na(e){let t=`unhandledrejection`;Yi(t,e),Xi(t,ra)}function ra(){ta=W.onunhandledrejection,W.onunhandledrejection=function(e){return Zi(`unhandledrejection`,e),ta?ta.apply(this,arguments):!0},W.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const ia=Object.prototype.toString;function aa(e){switch(ia.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return _a(e,Error)}}function oa(e,t){return ia.call(e)===`[object ${t}]`}function sa(e){return oa(e,`ErrorEvent`)}function ca(e){return oa(e,`String`)}function la(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function ua(e){return e===null||la(e)||typeof e!=`object`&&typeof e!=`function`}function da(e){return oa(e,`Object`)}function fa(e){return typeof Event<`u`&&_a(e,Event)}function pa(e){return typeof Element<`u`&&_a(e,Element)}function ma(e){return oa(e,`RegExp`)}function ha(e){return!!(e?.then&&typeof e.then==`function`)}function ga(e){return da(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function _a(e,t){try{return e instanceof t}catch{return!1}}function va(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const ya=W;function ba(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=xa(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 xa(e,t){let n=e,r=[];if(!n?.tagName)return``;if(ya.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&&ca(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 Sa(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&wa(i,r);try{e[t]=i}catch{U&&K.log(`Failed to replace method "${t}" in object`,e)}}function Ca(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{U&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function wa(e,t){try{e.prototype=t.prototype=t.prototype||{},Ca(e,`__sentry_original__`,t)}catch{}}function Ta(e){return e.__sentry_original__}function Ea(e){if(aa(e))return{message:e.message,name:e.name,stack:e.stack,...Oa(e)};if(fa(e)){let t={type:e.type,target:Da(e.target),currentTarget:Da(e.currentTarget),...Oa(e)};return typeof CustomEvent<`u`&&_a(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Da(e){try{return pa(e)?ba(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Oa(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 ka(e){let t=Object.keys(Ea(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Aa;function ja(e){if(Aa!==void 0)return Aa?Aa(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=W;return t in n&&typeof n[t]==`function`?(Aa=n[t],Aa(e)):(Aa=null,e())}function Ma(){return ja(()=>Math.random())}function Na(){return ja(()=>Date.now())}function Pa(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Fa(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 Ia(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{va(r)?n.push(Gi(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function La(e,t,n=!1){return ca(e)?ma(t)?t.test(e):ca(t)?n?e===t:e.includes(t):!1:!1}function Ra(e,t=[],n=!1){return t.some(t=>La(e,t,n))}function za(){let e=W;return e.crypto||e.msCrypto}let Ba;function Va(){return Ma()*16}function q(e=za()){try{if(e?.randomUUID)return ja(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Ba||=`10000000100040008000100000000000`,Ba.replace(/[018]/g,e=>(e^(Va()&15)>>e/4).toString(16))}function Ha(e){return e.exception?.values?.[0]}function Ua(e){let{message:t,event_id:n}=e;if(t)return t;let r=Ha(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Wa(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 Ga(e,t){let n=Ha(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 Ka=/^(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 Ja(e){let t=e.match(Ka)||[],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 Ya(e){if(Xa(e))return!0;try{Ca(e,`__sentry_captured__`,!0)}catch{}return!1}function Xa(e){try{return e.__sentry_captured__}catch{}}const Za=1e3;function Qa(){return Na()/Za}function $a(){let{performance:e}=W;if(!e?.now||!e.timeOrigin)return Qa;let t=e.timeOrigin;return()=>(t+ja(()=>e.now()))/Za}let eo;function to(){return(eo??=$a())()}function no(e){let t=to(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>ao(n)};return e&&ro(n,e),n}function ro(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||to(),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:q()),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 io(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),ro(e,n)}function ao(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 oo(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]=oo(r[e],t[e],n-1));return r}function so(){return q()}function co(){return q().substring(16)}const lo=`_sentrySpan`;function uo(e,t){t?Ca(e,lo,t):delete e[lo]}function fo(e){return e[lo]}var po=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:so(),sampleRand:Ma()}}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,uo(t,fo(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&&ro(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():da(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,uo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:so(),sampleRand:Ma()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:Qa(),...e,message:e.message?Pa(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:fo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=oo(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||q();if(!this._client)return U&&K.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||q();if(!this._client)return U&&K.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||q();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(U&&K.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 mo(){return Ti(`defaultCurrentScope`,()=>new po)}function ho(){return Ti(`defaultIsolationScope`,()=>new po)}var go=class{constructor(e,t){let n;n=e||new po;let r;r=t||new po,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 ha(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 _o(){let e=wi(G());return e.stack=e.stack||new go(mo(),ho())}function vo(e){return _o().withScope(e)}function yo(e,t){let n=_o();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function bo(e){return _o().withScope(()=>e(_o().getIsolationScope()))}function xo(){return{withIsolationScope:bo,withScope:vo,withSetScope:yo,withSetIsolationScope:(e,t)=>bo(t),getCurrentScope:()=>_o().getScope(),getIsolationScope:()=>_o().getIsolationScope()}}function So(e){let t=wi(G());t.acs=e}function Co(e){let t=wi(e);return t.acs?t.acs:xo()}function J(){return Co(G()).getCurrentScope()}function Y(){return Co(G()).getIsolationScope()}function wo(){return Ti(`globalScope`,()=>new po)}function To(...e){let t=Co(G());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Eo(...e){let t=Co(G());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function X(){return J().getClient()}function Do(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||co()};return n&&(i.parent_span_id=n),i}const Oo=`sentry.profile_id`,ko=`sentry.exclusive_time`;function Ao(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function jo(e){let t=e;return{scope:t._sentryScope,isolationScope:Ao(t._sentryIsolationScope)}}const Mo=/^sentry-/;function No(e){let t=Fo(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Mo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Po(e){if(e)return Lo(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function Fo(e){if(!(!e||!ca(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Io(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Io(e)}function Io(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 Lo(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?(U&&K.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const Ro=/^o(\d+)\./,zo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Bo(e){return e===`http`||e===`https`}function Vo(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 Ho(e){let t=zo.exec(e);if(!t){Oi(()=>{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 Uo({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Uo(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Wo(e){if(!U)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(K.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?Bo(r)?t&&isNaN(parseInt(t,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Go(e){return e.match(Ro)?.[1]}function Ko(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Go(n)),r}function qo(e){let t=typeof e==`string`?Ho(e):Uo(e);if(!(!t||!Wo(t)))return t}function Jo(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 Yo=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Xo(e){if(!e)return;let t=e.match(Yo);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 Zo(e,t){let n=Xo(e),r=No(t);if(!n?.traceId)return{traceId:so(),sampleRand:Ma()};let i=es(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 Qo(e=so(),t=co(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function $o(e=so(),t=co(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function es(e,t){let n=Jo(t?.sample_rand);if(n!==void 0)return n;let r=Jo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Ma()*r:r+Ma()*(1-r):Ma()}function ts(e,t){let n=Ko(e);return t&&n&&t!==n?(K.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)?(K.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 ns=!1;function rs(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:ls(e).parent_span_id,a=jo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||co():t,trace_id:n}}function is(e){let{traceId:t,spanId:n}=e.spanContext();return Qo(t,n,fs(e))}function as(e){let{traceId:t,spanId:n}=e.spanContext();return $o(t,n,fs(e))}function os(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 ss(e){return typeof e==`number`?cs(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?cs(e.getTime()):to()}function cs(e){return e>9999999999?e/1e3:e}function ls(e){if(ds(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(us(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:ss(i),timestamp:ss(o)||void 0,status:ps(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:os(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function us(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ds(e){return typeof e.getSpanJSON==`function`}function fs(e){let{traceFlags:t}=e.spanContext();return t===1}function ps(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function ms(e){return e._sentryRootSpan||e}function hs(){let e=Co(G());return e.getActiveSpan?e.getActiveSpan():fo(J())}function gs(){ns||=(Oi(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let _s=!1;function vs(){if(_s)return;function e(){let e=hs(),t=e&&ms(e);if(t){let e=`internal_error`;U&&K.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,_s=!0,$i(e),na(e)}function ys(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||X()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function bs(e){K.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function xs(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(Cs(n)){if(La(e.description,n))return U&&bs(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?La(e.description,n.name):!0,r=n.op?e.op&&La(e.op,n.op):!0;if(t&&r)return U&&bs(e),!0}return!1}function Ss(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 Cs(e){return typeof e==`string`||e instanceof RegExp}const ws=`production`;function Ts(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||ws,release:n.release,public_key:r,trace_id:e,org_id:Ko(t)};return t.emit(`createDsc`,i),i}function Es(e,t){let n=t.getPropagationContext();return n.dsc||Ts(n.traceId,e)}function Ds(e){let t=X();if(!t)return{};let n=ms(e),r=ls(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&&No(l);if(u)return s(u);let d=Ts(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),ys()&&(d.sampled=String(fs(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??jo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function Os(e,t=100,n=1/0){try{return As(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function ks(e,t=3,n=100*1024){let r=Os(e,t);return Ps(r)>n?ks(e,t-1,n):r}function As(e,t,n=1/0,r=1/0,i=Fs()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=js(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 As(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Ea(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]=As(e,t,c-1,r,i),d++}return o(t),u}function js(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(va(t))return Gi(t);if(ga(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Wi(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=Ms(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function Ms(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Ns(e){return~-encodeURI(e).split(/%..|./).length}function Ps(e){return Ns(JSON.stringify(e))}function Fs(){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 Is(e,t=[]){return[e,t]}function Ls(e,t){let[n,r]=e;return[n,[...r,t]]}function Rs(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 zs(e,t){return Rs(e,(e,n)=>t.includes(n))}function Bs(e){let t=wi(W);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Vs(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Bs(r),e]:r.push(typeof e==`string`?Bs(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(Os(n))}i(e)}}return typeof r==`string`?r:Hs(r)}function Hs(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 Us(e){let t=typeof e.data==`string`?Bs(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Ws={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 Gs(e){return Ws[e]}function Ks(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function qs(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:Vo(r)},...i&&{trace:i}}}function Js(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 Ys(e,t,n,r){let i=Ks(n);return Is({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Vo(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Xs(e,t,n,r){let i=Ks(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Js(e,n?.sdk);let o=qs(e,i,r,t);return delete e.sdkProcessingMetadata,Is(o,[[{type:a},e]])}const Zs=`__SENTRY_SUPPRESS_TRACING__`,Qs=(e,t)=>{let n=Co(G());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=X(),o=No(i);return a&&!ts(a,o?.org_id)?tc(t):To(e=>{let n=Zo(r,i);return e.setPropagationContext(n),uo(e,void 0),t()})};function $s(e,t){let n=nc();return n.withActiveSpan?n.withActiveSpan(e,t):To(n=>(uo(n,e||void 0),t(n)))}function ec(e){let t=nc();return t.suppressTracing?t.suppressTracing(e):To(t=>{t.setSDKProcessingMetadata({[Zs]:!0});let n=e();return t.setSDKProcessingMetadata({[Zs]:void 0}),n})}function tc(e){return To(t=>(t.setPropagationContext({traceId:so(),sampleRand:Ma()}),U&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),$s(null,e)))}function nc(){return Co(G())}function rc(e){return new ac(t=>{t(e)})}function ic(e){return new ac((t,n)=>{n(e)})}var ac=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(ha(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 oc(e,t,n,r=0){try{let i=sc(t,n,e,r);return ha(i)?i:rc(i)}catch(e){return ic(e)}}function sc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return U&&a===null&&K.log(`Event processor "${i.id||`?`}" dropped event`),ha(a)?a.then(e=>sc(e,t,n,r+1)):sc(a,t,n,r+1)}let cc,lc,uc,dc;function fc(e){let t=W._sentryDebugIds,n=W._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(dc&&r.length===lc&&i.length===uc)return dc;lc=r.length,uc=i.length,dc={},cc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=cc?.[r];if(i&&dc&&t)dc[i[0]]=t,cc&&(cc[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&&dc&&cc){dc[i]=t,cc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),dc}function pc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;_c(e,t),r&&bc(e,r),xc(e,n),vc(e,i),yc(e,a)}function mc(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;hc(e,`extra`,n),hc(e,`tags`,r),hc(e,`attributes`,i),hc(e,`user`,a),hc(e,`contexts`,o),e.sdkProcessingMetadata=oo(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 hc(e,t,n){e[t]=oo(e[t],n,1)}function gc(e,t){let n=wo().getScopeData();return e&&mc(n,e.getScopeData()),t&&mc(n,t.getScopeData()),n}function _c(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 vc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function yc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function bc(e,t){e.contexts={trace:rs(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ds(t),...e.sdkProcessingMetadata};let n=ls(ms(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function xc(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 Sc(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||q(),timestamp:t.timestamp||Qa()},l=n.integrations||e.integrations.map(e=>e.name);Cc(c,e),Ec(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&wc(c,e.stackParser);let u=Oc(r,n.captureContext);n.mechanism&&Ga(c,n.mechanism);let d=i?i.getEventProcessors():[],f=gc(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),pc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?rc(c):oc(m,c,n)).then(e=>(e&&Tc(e),typeof o==`number`&&o>0?Dc(e,o,s):e))}function Cc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||ws,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Pa(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Pa(e.value,a)})}function wc(e,t){let n=fc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Tc(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 Ec(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Dc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Os(e.data,t,n)}}))},...e.user&&{user:Os(e.user,t,n)},...e.contexts&&{contexts:Os(e.contexts,t,n)},...e.extra&&{extra:Os(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Os(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Os(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Os(e.contexts.flags,3,n)),r}function Oc(e,t){if(!t)return e;let n=e?e.clone():new po;return n.update(t),n}function kc(e){if(e)return Ac(e)||Mc(e)?{captureContext:e}:e}function Ac(e){return e instanceof po||typeof e==`function`}const jc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Mc(e){return Object.keys(e).some(e=>jc.includes(e))}function Nc(e,t){return J().captureException(e,kc(t))}function Pc(e,t){Y().setContext(e,t)}function Fc(e,t){Y().setTag(e,t)}function Ic(e){Y().setUser(e)}async function Lc(e){let t=X();return t?t.flush(e):(U&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function Rc(){let e=X();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function zc(e){let t=Y(),{user:n}=gc(t,J()),{userAgent:r}=W.navigator||{},i=no({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&ro(a,{status:`exited`}),Bc(),t.setSession(i),i}function Bc(){let e=Y(),t=J().getSession()||e.getSession();t&&io(t),Vc(),e.setSession()}function Vc(){let e=Y(),t=X(),n=e.getSession();n&&t&&t.captureSession(n)}function Hc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Uc(e){return`${Hc(e)}${e.projectId}/envelope/`}function Wc(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 Gc(e,t,n){return t||`${Uc(e)}?${Wc(e,n)}`}const Kc=[];function qc(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 Jc(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 qc(r)}function Yc(e,t){let n={};return t.forEach(t=>{t&&Zc(e,t,n)}),n}function Xc(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Zc(e,t,n){if(n[t.name]){U&&K.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Kc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Kc.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)}U&&K.log(`Integration installed: ${t.name}`)}function Z(e){return e}function Qc(e,t){return t?To(t,()=>{let n=hs(),r=n?rs(n):Do(t);return[n?Ds(n):Es(e,t),r]}):[void 0,void 0]}function $c(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function el(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Vo(r)),Is(i,[$c(e)])}function tl(e,t){let n=t??nl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=el(n,r._metadata,r.tunnel,e.getDsn());rl().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function nl(e){return rl().get(e)}function rl(){return Ti(`clientToLogBufferMap`,()=>new WeakMap)}function il(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function al(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Vo(r)),Is(i,[il(e)])}function ol(e,t){let n=t??sl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=al(n,r._metadata,r.tunnel,e.getDsn());cl().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function sl(e){return cl().get(e)}function cl(){return Ti(`clientToMetricBufferMap`,()=>new WeakMap)}function ll(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const ul=Symbol.for(`SentryBufferFullError`);function dl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return ic(ul);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return rc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>ll(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function fl(e,t=Na()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function pl(e,t){return e[t]||e.all||0}function ml(e,t,n=Na()){return pl(e,t)>n}function hl(e,{statusCode:t,headers:n},r=Na()){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+fl(o,r):t===429&&(i.all=r+60*1e3);return i}function gl(e,t,n=dl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Rs(i,(t,n)=>{let i=Gs(n);ml(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Is(i[0],a),s=t=>{if(zs(o,[`client_report`])){U&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Rs(o,(n,r)=>{e.recordDroppedEvent(t,Gs(r))})};return n.add(()=>t({body:Vs(o)}).then(e=>e.statusCode===413?(U&&K.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(U&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&K.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=hl(r,e),e),e=>{throw s(`network_error`),U&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===ul)return U&&K.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function _l(e,t,n){let r=[{type:`client_report`},{timestamp:n||Qa(),discarded_events:e}];return Is(t?{dsn:t}:{},[r])}function vl(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 yl(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?.[Oo],exclusive_time:o?.[ko],measurements:e.measurements,is_segment:!0}}function bl(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&&{[Oo]:e.profile_id},...e.exclusive_time&&{[ko]:e.exclusive_time}}}},measurements:e.measurements}}const xl=`Not capturing exception because it's already been captured.`,Sl=`Discarded session because of missing or non-string release`,Cl=Symbol.for(`SentryInternalError`),wl=Symbol.for(`SentryDoNotSendEventError`);function Tl(e){return{message:e,[Cl]:!0}}function El(e){return{message:e,[wl]:!0}}function Dl(e){return!!e&&typeof e==`object`&&Cl in e}function Ol(e){return!!e&&typeof e==`object`&&wl in e}function kl(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=ll(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Al=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=dl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=qo(e.dsn):U&&K.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Gc(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&&kl(this,`afterCaptureLog`,`flushLogs`,Ll,tl),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&kl(this,`afterCaptureMetric`,`flushMetrics`,Il,ol)}captureException(e,t,n){let r=q();if(Ya(e))return U&&K.log(xl),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:q(),...n},a=la(e)?e:String(e),o=ua(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=q();if(t?.originalException&&Ya(t.originalException))return U&&K.log(xl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=jl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),ro(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){tl(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];Zc(this,e,this._integrations),t||Xc(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=Xs(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Ls(n,Us(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=ws}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){U&&K.warn(Sl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){U&&K.warn(Sl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Ys(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}`;U&&K.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 U&&K.error(`Error while sending envelope:`,e),{}}return U&&K.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Yc(this,e),Xc(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)&&(ro(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),Sc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:Do(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Es(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=Y()){return U&&Pl(e)&&K.log(`Captured error event \`${vl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{U&&(Ol(e)?K.log(e.message):Dl(e)?K.warn(e.message):K.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Fl(e),s=Pl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Jo(a);if(s&&typeof l==`number`&&Ma()>l)return this.recordDroppedEvent(`sample_rate`,`error`),ic(El(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=jl(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),El("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:Ml(Nl(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 El(`${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 Ol(e)||Dl(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Tl(`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===ul&&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(){U&&K.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){U&&K.log(`No outcomes to send`);return}if(!this._dsn){U&&K.log(`No dsn provided, will not send outcomes`);return}U&&K.log(`Sending outcomes:`,e);let t=_l(e,this._options.tunnel&&Vo(this._dsn));this.sendEnvelope(t)}};function jl(e){return e===`replay_event`?`replay`:e||`error`}function Ml(e,t){let n=`${t} must return \`null\` or a valid event.`;if(ha(e))return e.then(e=>{if(!da(e)&&e!==null)throw Tl(n);return e},e=>{throw Tl(`${t} rejected with ${e}`)});if(!da(e)&&e!==null)throw Tl(n);return e}function Nl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(Pl(c)&&i)return i(c,r);if(Fl(c)){if(o||s){let t=yl(c);if(s?.length&&xs(t,s))return null;if(o){let e=o(t);e?c=oo(n,bl(e)):gs()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&xs(e,s)){Ss(n,e);continue}if(o){let n=o(e);n?t.push(n):(gs(),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 Pl(e){return e.type===void 0}function Fl(e){return e.type===`transaction`}function Il(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Rl(e.attributes)}function Ll(e){let t=0;return e.message&&(t+=e.message.length*2),t+Rl(e.attributes)}function Rl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*zl(e[0]):ua(e)?t+=zl(e):t+=100}),t}function zl(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Bl(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=Vo(i)),t&&(a.trace=t),Is(a,[Vl(e)])}function Vl(e){return[{type:`check_in`},e]}function Hl(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 Ul(e,t){return e(t.stack||``,1)}function Wl(e){return aa(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Gl(e){return Wl(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Kl(e,t){let n={type:t.name||t.constructor.name,value:Gl(t)},r=Ul(e,t);return r.length&&(n.stacktrace={frames:r}),n}function ql(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function Jl(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=ka(e);if(sa(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Yl(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Yl(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Xl(e,t,n,r){if(aa(n))return[n,void 0];if(t.synthetic=!0,da(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:ks(n,t)},a=ql(n);if(a)return[a,i];let o=Jl(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 Zl(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Xl(e,i,n,r),s={exception:{values:[Kl(t,a)]}};return o&&(s.extra=o),Wa(s,void 0,void 0),Ga(s,i),{...s,event_id:r?.event_id}}function Ql(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=Ul(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Ga(a,{synthetic:!0}))}if(la(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 $l=class extends Al{constructor(e){vs(),Hl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=Zl(this,this._options.stackParser,e,t);return n.level=`error`,rc(n)}eventFromMessage(e,t=`info`,n){return rc(Ql(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return eu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&eu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:q();if(!this._isEnabled())return U&&K.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]=Qc(this,n);l&&(s.contexts={trace:l});let u=Bl(s,c,this.getSdkMetadata(),o,this.getDsn());return U&&K.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){U&&K.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=dl(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 eu(e){let t=Y().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const tu=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),nu=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function ru(e,t){let n=String(e).toLowerCase();return tu.has(n)?!1:nu.has(n)?!0:t?.strict?null:!!e}function iu(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 au(e){return e.split(/[?#]/,1)[0]}function ou(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function su(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:Ci})),i.version=Ci)}function cu(e={}){let t=e.client||X();if(!Rc()||!t)return{};let n=Co(G());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||hs(),a=i?is(i):lu(r),o=Po(i?Ds(i):Es(t,r));if(!Yo.test(a))return K.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let s={"sentry-trace":a,baggage:o};return e.propagateTraceparent&&(s.traceparent=i?as(i):uu(r)),s}function lu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Qo(t,r,n)}function uu(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return $o(t,r,n)}const du=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function fu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return U&&!r&&K.log(du,e),r;let i=Ra(e,t);return n?.set(e,i),U&&!i&&K.log(du,e),i}function pu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function mu(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=hu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:gu(i),headers:pu(t),cookies:s,data:o}}function hu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function gu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function _u(e,t){let n=X(),r=Y();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:Qa(),...e},s=i?Oi(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let vu;const yu=new WeakMap,bu=Z((()=>({name:`FunctionToString`,setupOnce(){vu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Ta(this),n=yu.has(X())&&t!==void 0?t:this;return vu.apply(n,e)}}catch{}},setup(e){yu.set(e,!0)}}))),xu=[/^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$/],Su=Z((e={})=>{let t;return{name:`EventFilters`,setup(n){t=Cu(e,n.getOptions())},processEvent(n,r,i){return t||=Cu(e,i.getOptions()),wu(n,t)?null:n}}});function Cu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:xu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function wu(e,t){if(e.type){if(e.type===`transaction`&&Eu(e,t.ignoreTransactions))return U&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Ua(e)}`),!0}else{if(Tu(e,t.ignoreErrors))return U&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Ua(e)}`),!0;if(ju(e))return U&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Ua(e)}`),!0;if(Du(e,t.denyUrls))return U&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Ua(e)}.\nUrl: ${Au(e)}`),!0;if(!Ou(e,t.allowUrls))return U&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Ua(e)}.\nUrl: ${Au(e)}`),!0}return!1}function Tu(e,t){return t?.length?vl(e).some(e=>Ra(e,t)):!1}function Eu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Ra(n,t):!1}function Du(e,t){if(!t?.length)return!1;let n=Au(e);return n?Ra(n,t):!1}function Ou(e,t){if(!t?.length)return!0;let n=Au(e);return n?Ra(n,t):!0}function ku(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 Au(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?ku(t):null}catch{return U&&K.error(`Cannot extract url for event ${Ua(e)}`),null}}function ju(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Mu(e,t,n,r,i,a){if(!i.exception?.values||!a||!_a(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=Nu(e,t,r,a.originalException,n,i.exception.values,o,0))}function Nu(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(_a(r[i],Error)){Fu(o,s,r);let a=e(t,r[i]),l=c.length;Iu(a,i,l,s),c=Nu(e,t,n,r[i],i,[a,...c],a,l)}return Pu(r)&&r.errors.forEach((a,l)=>{if(_a(a,Error)){Fu(o,s,r);let u=e(t,a),d=c.length;Iu(u,`errors[${l}]`,d,s),c=Nu(e,t,n,a,i,[u,...c],u,d)}}),c}function Pu(e){return Array.isArray(e.errors)}function Fu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Pu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Iu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const Lu=Z(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Mu(Kl,i.getOptions().stackParser,n,t,e,r)}}}));function Ru(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 zu=[`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 Bu(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return zu.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Vu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Hu(e))||null}function Vu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Hu(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 Uu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Wu=Z(((e={})=>{let t={...Uu,...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&&Gu(e,a,{ipAddress:o},s),e}}}));function Gu(e,t,n,r){if(e.request={...e.request,...Ku(t,r)},r.ip){let r=t.headers&&Bu(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Ku(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||zu.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?Ru(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function qu(e){let t=`console`;Yi(t,e),Xi(t,Ju)}function Ju(){`console`in W&&Ei.forEach(function(e){e in W.console&&Sa(W.console,e,function(t){return Di[e]=t,function(...t){Zi(`console`,{args:t,level:e}),Di[e]?.apply(W.console,t)}})})}function Yu(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Xu=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Zu(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Xu.exec(t);return n?n.slice(1):[]}function Qu(e){let t=Zu(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const $u=Z((e={})=>{let t=new Set(e.levels||Ei);return{name:`Console`,setup(e){qu(({args:n,level:r})=>{X()!==e||!t.has(r)||ed(r,n)})}}});function ed(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Yu(e),message:td(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${td(e)}`:`Assertion failed`,n.data.arguments=e}else return;_u(n,{input:t,level:e})}function td(e){return`util`in W&&typeof W.util.format==`function`?W.util.format(...e):Ia(e,` `)}function nd(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function rd(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 id(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=Ki(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?sd(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:od(o[3]),colno:od(o[4]),in_app:rd(s||``,c)}}if(i.match(t))return{filename:i}}}function ad(e){return[90,id(e)]}function od(e){return parseInt(e||``,10)||void 0}function sd(e){try{return decodeURI(e)}catch{return}}var cd=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 Q=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var ld=class extends $l{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||j.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};su(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${Ye?`main`:`worker-${Xe}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{tl(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(()=>{Q&&K.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const ud=Z((e={})=>({name:`ChildProcess`,setup(){Ze.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&dd(t.process,e)}),Ze.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&fd(t.worker,e)})}}));function dd(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&&_u({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,_u({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function fd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?_u({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):Nc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const pd=Fe(tt),md=Fe(rt),hd=Z(((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=gd(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 _d()),n.app&&(e.app=yd()),n.device&&(e.device=bd(n.device)),n.culture){let t=vd();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Od()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function gd(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=j.freemem()),e}async function _d(){let e=j.platform();switch(e){case`darwin`:return Td();case`linux`:return Dd();default:return{name:xd[e]||e,version:j.release()}}}function vd(){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 yd(){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 bd(e){let t={},n;try{n=j.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=j.arch(),(e===!0||e.memory)&&(t.memory_size=j.totalmem(),t.free_memory=j.freemem()),e===!0||e.cpu){let e=j.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const xd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Sd=[{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`]}],Cd={alpine:e=>e,arch:e=>wd(/distrib_release=(.*)/,e),centos:e=>wd(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>wd(/release (..)/,e),mint:e=>wd(/distrib_release=(.*)/,e),red:e=>wd(/release ([^ ]+)/,e),suse:e=>wd(/VERSION = (.*)\n/,e),ubuntu:e=>wd(/distrib_release=(.*)/,e)};function wd(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Td(){let e={kernel_version:j.release(),name:`Mac OS X`,version:`10.${Number(j.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{We(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=wd(/^ProductName:\s+(.*)$/m,t),e.version=wd(/^ProductVersion:\s+(.*)$/m,t),e.build=wd(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Ed(e){return e.split(` `)[0].toLowerCase()}async function Dd(){let e={kernel_version:j.release(),name:`Linux`};try{let t=await md(`/etc`),n=Sd.find(e=>t.includes(e.name));if(!n)return e;let r=(await pd(Be(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Ed(e))>=0)||i[0],e.version=Cd[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 cd(10),Ad=new cd(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=$e(e),o=Ke({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),Q&&K.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]=Fa(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(()=>{Q&&K.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){Q&&K.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),Q&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){zd(t),Q&&K.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=Z(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return Ld(e,t)}}})),Gd=Ja(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){K.log(`[LocalVariables]`,...e)}const ef=Z(((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 it(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()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:K.isEnabled()};r().then(()=>{try{i(n)}catch(e){K.error(`Failed to start worker`,e)}},e=>{K.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=Z(((e={},t)=>{let n=new cd(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=X()?.getOptions();if(a?.includeLocalVariables){if(Kd<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Jd()){K.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,()=>{K.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{K.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){K.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 n.cache?Object.keys(n.cache):[]}catch{return[]}}function pf(){return{...uf,..._f(),...cf()?mf():{}}}function mf(){let e=n.main?.paths||[],t=ff(),r={},i=new Set;return t.forEach(t=>{let n=t,a=()=>{let t=n;if(n=ze(t),!n||t===n||i.has(t))return;if(e.indexOf(n)<0)return a();let o=Be(t,`package.json`);if(i.add(t),!et(o))return a();try{let e=JSON.parse(nt(o,`utf8`));r[e.name]=e.version}catch{}};a()}),r}function hf(){return lf||=pf(),lf}function gf(){try{let e=Be(process.cwd(),`package.json`);return JSON.parse(nt(e,`utf8`))}catch{return{}}}function _f(){let e=gf();return{...e.dependencies,...e.devDependencies}}function vf(e){Oi(()=>{console.error(e)});let t=X();if(t===void 0){Q&&K.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||Q&&K.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Q&&K.error(e)})}const yf=Z((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Ye&&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?(Q&&K.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,X()===e&&Nc(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=Z(((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||La(t.name,e.name,!0),r=e.message===void 0||La(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(X()!==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=>$s(a,e):e=>e())(()=>{Nc(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`?Oi(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(Oi(()=>{console.warn(n)}),vf(e))}const Of=Z(()=>({name:`ProcessSession`,setupOnce(){zc(),process.on(`beforeExit`,()=>{Y().getSession()?.status!==`ok`&&Bc()})}})),kf=`Spotlight`,Af=Z(((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`&&K.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){K.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=Vs(e);ec(()=>{let e=qe.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++,K.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Mf(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function Nf(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ne.getSystemErrorMap().has(e.errno)}const Pf=Z((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]?Qu(process.argv[1]):process.cwd(),t=He===`\\`){let n=t?Ff(e):e;return e=>{if(!e)return;let r=t?Ff(e):e,{dir:i,base:a,ext:o}=Ve.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(W.SENTRY_RELEASE?.id)return W.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=zi(ad(If())),zf=Symbol(`AgentBaseInternalState`);var Bf=class extends qe.Agent{constructor(e){super(e),this[zf]={}}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(`
323
+ `).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 qe.Agent)return i.addRequest(e,r);this[zf].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[zf].currentSocket;if(this[zf].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[zf].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[zf]&&(this[zf].defaultPort=e)}get protocol(){return this[zf].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[zf]&&(this[zf].protocol=e)}};function Vf(...e){K.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function Hf(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(),Vf(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),Vf(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
324
324
  \r
325
- `);if(l===-1){Hf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
326
- `),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}Hf(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}function Wf(...e){K.log(`[https-proxy-agent]`,...e)}var Gf=class extends Vf{static __initStatic(){this.protocols=[`http`,`https`]}constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},Wf(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?qf(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){Wf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ct.connect({...this.connectOpts,servername:e&&st.isIP(e)?void 0:e})}else Wf("Creating `net.Socket`: %o",this.connectOpts),r=st.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=st.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let s=Uf(r);r.write(`${o}\r\n`);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,Kf),t.secureEndpoint){Wf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ct.connect({...qf(t,`host`,`path`,`port`),socket:r,servername:st.isIP(e)?void 0:e})}return r}r.destroy();let u=new st.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Wf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Gf.__initStatic();function Kf(e){e.resume()}function qf(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Jf(e){return new Ge({read(){this.push(e),this.push(null)}})}function Yf(e){let t;try{t=new URL(e.url)}catch{return ki(()=>{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=Xf(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?at:qe,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Gf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return _l(e,Zf(e,e.httpModule??i,o))}function Xf(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Zf(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{tc(()=>{let d=Jf(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(ot()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function Qf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=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 $f(){let e=new lt;function t(){return e.getStore()||{scope:ho(),isolationScope:go()}}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()))}Co({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function ep(e,t,n,r){let i=0,a=[];Q&&K.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`){Q&&K.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):Q&&K.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Q&&K.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){Q&&K.error(r,`Error building captured request body`,e)}})}catch(e){Q&&K.error(r,`Error patching request to capture body`,e)}}function tp(e,t){if(!e)return t;let n=Io(e),r=Io(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Ro(i)}const np=`@sentry/instrumentation-http`;function rp(e,t){let n=ap(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 ip(e,t){let n=sp(e),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.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),Q&&K.log(np,`Added sentry-trace header to outgoing request`)}catch(e){Q&&K.error(np,`Failed to add sentry-trace header to outgoing request:`,oa(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&K.log(np,`Added traceparent header to outgoing request`)}catch(e){Q&&K.error(np,`Failed to add traceparent header to outgoing request:`,oa(e)?e.message:`Unknown error`)}if(s){let t=tp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&K.log(np,`Added baggage header to outgoing request`)}catch(e){Q&&K.error(np,`Failed to add baggage header to outgoing request:`,oa(e)?e.message:`Unknown error`)}}}function ap(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 op(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function sp(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const cp=`Http`,lp=new WeakSet,up=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new ld(100),r=new WeakMap;return{name:cp,setupOnce(){Qe(`http.server.request.start`,(e=>{dp(e.server,t)})),Qe(`http.client.request.created`,(e=>{fp(e.request,t,n,r)})),Qe(`http.client.response.finish`,(e=>{let n=e;pp(n.request,n.response,t,r)})),Qe(`http.client.request.error`,(e=>{pp(e.request,void 0,t,r)}))}}});function dp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(lp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!J().getClient())return e.apply(r,i);Q&&K.log(cp,`Handling incoming request`);let a=Y().clone(),o=i[1],s=hu(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&ep(o,a,n,cp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${ou(l)}`;return a.setTransactionName(u),Do(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return $s({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=lo(),e.apply(r,i)))})}});lp.add(i),e.emit=i}function fp(e,t,n,r){let i=mp(e,t);r.set(e,i),!i&&ip(e,n)}function pp(e,t,n,r){n.breadcrumbs&&((r.get(e)??mp(e,n))||rp(e,t))}function mp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,op(e)):!1}const hp=`sentry-trace`,gp=`baggage`,_p=/baggage: (.*)\r\n/;function vp(e,t){let n=xp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.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(hp)&&t.push(hp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===gp);if(s&&n===-1)t.push(gp,s);else if(s){let e=t[n+1],r=tp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${hp}:`)&&(e.headers+=`${hp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(_p)?.[1];if(s&&!n)e.headers+=`${gp}: ${s}\r\n`;else if(s){let t=tp(n,s);t&&(e.headers=e.headers.replace(_p,`baggage: ${t}\r\n`))}}}function yp(e,t){let n=bp(e),r=t.statusCode,i=rd(r);vu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function bp(e){try{let t=au(xp(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 xp(e,t=`/`){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}}const Sp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new ld(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){Qe(`undici:request:create`,(e=>{Cp(e.request,t,n,r)})),Qe(`undici:request:headers`,(e=>{let n=e;wp(n.request,n.response,t,r)}))}}});function Cp(e,t,n,r){let i=Tp(e,t);r.set(e,i),!i&&vp(e,n)}function wp(e,t,n,r){n.breadcrumbs&&(r.get(e)||yp(e,t))}function Tp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(xp(e.origin,e.path)):!1}function Ep(){return[Cu(),xu(),Ru(),Gu(),Ff(),ed(),up(),Sp(),bf(),Cf(),Gd(),cf(),gd(),dd(),kf(),ff()]}function Dp(e={}){return Op(e,Ep)}function Op(e={},t){let n=kp(e,t);n.debug===!0&&(Q?K.enable():ki(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),$f(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===Af)&&n.integrations.push(jf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),cu(n,`node-light`,[`node-core`]);let r=new ud(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${lf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),Mp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function kp(e,t){let n=Ap(e.release),r=Qf(e.spotlight),i=jp(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Yf,stackParser:Vi(e.stackParser||zf),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 Ap(e){if(e!==void 0)return e;let t=Rf();if(t!==void 0)return t}function jp(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function Mp(){if(iu(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Qo(e,t);J().setPropagationContext(n)}}function Np(){return xe.PRISMIC_SENTRY_ENABLED??xe.PROD}function Pp(){if(xe.PRISMIC_SENTRY_ENVIRONMENT)return xe.PRISMIC_SENTRY_ENVIRONMENT;let e=ne.match(/-(.+?)\./);return e?e[1]:`production`}function Fp(){try{if(!Np())return;Dp({dsn:xe.PRISMIC_SENTRY_DSN,release:ne,environment:Pp(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Fc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Ip(e){try{if(!Np())return;Pc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Rc()}catch{}}const Lp=Lc,Rp=Ic,zp=Fc,$=[`login`,`logout`,`whoami`,`sync`,`docs`,`status`],Bp=N({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,sections:{DOCUMENTATION:"\n Run `prismic docs list` to browse available documentation topics.\n Run `prismic docs view <path>` to read a topic.\n "},commands:{init:{handler:er,description:`Initialize a Prismic project`},docs:{handler:Tt,description:`Browse Prismic documentation`},gen:{handler:ln,description:`Generate files from local models`},pull:{handler:jr,description:`Pull types and slices from Prismic`},push:{handler:Mr,description:`Push types and slices to Prismic`},sync:{handler:Qr,description:`Sync types and slices from Prismic`},status:{handler:Xr,description:`Show local vs remote model differences`},locale:{handler:xr,description:`Manage locales`},repo:{handler:Rr,description:`Manage repositories`},type:{handler:fi,description:`Manage content types`},field:{handler:on,description:`Manage fields`},slice:{handler:Yr,description:`Manage slices`},preview:{handler:Or,description:`Manage preview configurations`},token:{handler:ri,description:`Manage API tokens`},webhook:{handler:bi,description:`Manage webhooks`},login:{handler:Sr,description:`Log in to Prismic`},logout:{handler:Cr,description:`Log out of Prismic`},whoami:{handler:xi,description:`Show the currently logged in user`}}});await Vp();async function Vp(){await Me({npmPackageName:re,statePath:we}),De().catch(()=>{});let{positionals:[e],values:{version:t,help:n,repo:i=await s()}}=Pe({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(ne);return}if(typeof i!=`string`&&(i=``),!n){Fp(),await je(),i&&(Ae(i),Rp(`repository`,i),zp(`Repository Data`,{name:i}));try{Rp(`framework`,(await o()).id)}catch{}let t=await O();if(t){let e=await k(),n=Ci(t)?.exp,i=Date.now()/1e3;(!n||n-i<=3600)&&process.on(`exit`,()=>Ee()),(!n||n>i)&&r({token:t,host:e}).then(e=>{ke({shortId:e.shortId,intercomHash:e.intercomHash}),Lp({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&Oe(e)}try{await Bp(),e&&!$.includes(e)&&A(e)}catch(t){if(process.exitCode=1,t instanceof P){$.includes(e)||A(e),console.error(_(t.message));return}if(t instanceof f){$.includes(e)||A(e,{error:t}),console.error(t.message);return}if(t instanceof gr){if($.includes(e)||A(e),t.availableEnvironments.length===1&&t.repo===t.availableEnvironments[0].domain)console.error(`No environments available on repository "${t.repo}".`);else{let e=t.availableEnvironments.map(e=>e.domain).join(`
325
+ `);if(l===-1){Vf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
326
+ `),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}Vf(`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 Uf(...e){K.log(`[https-proxy-agent]`,...e)}var Wf=class extends Bf{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??{},Uf(`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?Kf(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:`){Uf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=ct.connect({...this.connectOpts,servername:e&&st.isIP(e)?void 0:e})}else Uf("Creating `net.Socket`: %o",this.connectOpts),r=st.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=st.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=Hf(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`,Gf),t.secureEndpoint){Uf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return ct.connect({...Kf(t,`host`,`path`,`port`),socket:r,servername:st.isIP(e)?void 0:e})}return r}r.destroy();let u=new st.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{Uf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Wf.__initStatic();function Gf(e){e.resume()}function Kf(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function qf(e){return new Ge({read(){this.push(e),this.push(null)}})}function Jf(e){let t;try{t=new URL(e.url)}catch{return Oi(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),gl(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Yf(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?at:qe,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Wf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return gl(e,Xf(e,e.httpModule??i,o))}function Yf(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Xf(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)=>{ec(()=>{let d=qf(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(ot()));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 Zf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=ru(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 Qf(){let e=new lt;function t(){return e.getStore()||{scope:mo(),isolationScope:ho()}}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()))}So({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function $f(e,t,n,r){let i=0,a=[];Q&&K.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`){Q&&K.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):Q&&K.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Q&&K.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){Q&&K.error(r,`Error building captured request body`,e)}})}catch(e){Q&&K.error(r,`Error patching request to capture body`,e)}}function ep(e,t){if(!e)return t;let n=Fo(e),r=Fo(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),Lo(i)}const tp=`@sentry/instrumentation-http`;function np(e,t){let n=ip(e),r=t?.statusCode,i=nd(r);_u({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function rp(e,t){let n=op(e),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=fu(n,r,t)?cu({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),Q&&K.log(tp,`Added sentry-trace header to outgoing request`)}catch(e){Q&&K.error(tp,`Failed to add sentry-trace header to outgoing request:`,aa(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&K.log(tp,`Added traceparent header to outgoing request`)}catch(e){Q&&K.error(tp,`Failed to add traceparent header to outgoing request:`,aa(e)?e.message:`Unknown error`)}if(s){let t=ep(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&K.log(tp,`Added baggage header to outgoing request`)}catch(e){Q&&K.error(tp,`Failed to add baggage header to outgoing request:`,aa(e)?e.message:`Unknown error`)}}}function ip(e){try{let t=e.getHeader(`host`)||e.host,n=iu(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:ou(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 ap(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function op(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const sp=`Http`,cp=new WeakSet,lp=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new cd(100),r=new WeakMap;return{name:sp,setupOnce(){Qe(`http.server.request.start`,(e=>{up(e.server,t)})),Qe(`http.client.request.created`,(e=>{dp(e.request,t,n,r)})),Qe(`http.client.response.finish`,(e=>{let n=e;fp(n.request,n.response,t,r)})),Qe(`http.client.request.error`,(e=>{fp(e.request,void 0,t,r)}))}}});function up(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(cp.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!J().getClient())return e.apply(r,i);Q&&K.log(sp,`Handling incoming request`);let a=Y().clone(),o=i[1],s=mu(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&$f(o,a,n,sp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${au(l)}`;return a.setTransactionName(u),Eo(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Qs({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=co(),e.apply(r,i)))})}});cp.add(i),e.emit=i}function dp(e,t,n,r){let i=pp(e,t);r.set(e,i),!i&&rp(e,n)}function fp(e,t,n,r){n.breadcrumbs&&((r.get(e)??pp(e,n))||np(e,t))}function pp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(`${e.protocol}//${e.getHeader(`host`)||e.host}${e.path}`,ap(e)):!1}const mp=`sentry-trace`,hp=`baggage`,gp=/baggage: (.*)\r\n/;function _p(e,t){let n=bp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=fu(n,r,t)?cu({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(mp)&&t.push(mp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===hp);if(s&&n===-1)t.push(hp,s);else if(s){let e=t[n+1],r=ep(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${mp}:`)&&(e.headers+=`${mp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(gp)?.[1];if(s&&!n)e.headers+=`${hp}: ${s}\r\n`;else if(s){let t=ep(n,s);t&&(e.headers=e.headers.replace(gp,`baggage: ${t}\r\n`))}}}function vp(e,t){let n=yp(e),r=t.statusCode,i=nd(r);_u({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function yp(e){try{let t=iu(bp(e.origin,e.path)),n={url:ou(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 bp(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 xp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new cd(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){Qe(`undici:request:create`,(e=>{Sp(e.request,t,n,r)})),Qe(`undici:request:headers`,(e=>{let n=e;Cp(n.request,n.response,t,r)}))}}});function Sp(e,t,n,r){let i=wp(e,t);r.set(e,i),!i&&_p(e,n)}function Cp(e,t,n,r){n.breadcrumbs&&(r.get(e)||vp(e,t))}function wp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(bp(e.origin,e.path)):!1}function Tp(){return[Su(),bu(),Lu(),Wu(),Pf(),$u(),lp(),xp(),yf(),Sf(),Wd(),sf(),hd(),ud(),Of(),df()]}function Ep(e={}){return Dp(e,Tp)}function Dp(e={},t){let n=Op(e,t);n.debug===!0&&(Q?K.enable():Oi(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Qf(),J().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})),su(n,`node-light`,[`node-core`]);let r=new ld(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${cf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),jp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Op(e,t){let n=kp(e.release),r=Zf(e.spotlight),i=Ap(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??Jf,stackParser:Bi(e.stackParser||Rf),release:n,tracesSampleRate:i,spotlight:r,debug:ru(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:Jc({defaultIntegrations:s,integrations:o})}}function kp(e){if(e!==void 0)return e;let t=Lf();if(t!==void 0)return t}function Ap(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 jp(){if(ru(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Zo(e,t);J().setPropagationContext(n)}}function Mp(){return xe.PRISMIC_SENTRY_ENABLED??xe.PROD}function Np(){if(xe.PRISMIC_SENTRY_ENVIRONMENT)return xe.PRISMIC_SENTRY_ENVIRONMENT;let e=ne.match(/-(.+?)\./);return e?e[1]:`production`}function Pp(){try{if(!Mp())return;Ep({dsn:xe.PRISMIC_SENTRY_DSN,release:ne,environment:Np(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),Pc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function Fp(e){try{if(!Mp())return;Nc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await Lc()}catch{}}const Ip=Ic,Lp=Fc,Rp=Pc,$=[`login`,`logout`,`whoami`,`sync`,`docs`,`status`],zp=N({name:`prismic`,description:`Prismic CLI for managing repositories and configurations.`,sections:{DOCUMENTATION:"\n Run `prismic docs list` to browse available documentation topics.\n Run `prismic docs view <path>` to read a topic.\n "},commands:{init:{handler:$n,description:`Initialize a Prismic project`},docs:{handler:Tt,description:`Browse Prismic documentation`},gen:{handler:cn,description:`Generate files from local models`},pull:{handler:Ar,description:`Pull types and slices from Prismic`},push:{handler:jr,description:`Push types and slices to Prismic`},sync:{handler:Zr,description:`Sync types and slices from Prismic`},status:{handler:Yr,description:`Show local vs remote model differences`},locale:{handler:br,description:`Manage locales`},repo:{handler:Lr,description:`Manage repositories`},type:{handler:di,description:`Manage content types`},field:{handler:an,description:`Manage fields`},slice:{handler:Jr,description:`Manage slices`},preview:{handler:Dr,description:`Manage preview configurations`},token:{handler:ni,description:`Manage API tokens`},webhook:{handler:yi,description:`Manage webhooks`},login:{handler:xr,description:`Log in to Prismic`},logout:{handler:Sr,description:`Log out of Prismic`},whoami:{handler:bi,description:`Show the currently logged in user`}}});await Bp();async function Bp(){await Me({npmPackageName:re,statePath:we}),De().catch(()=>{});let{positionals:[e],values:{version:t,help:n,repo:i=await s()}}=Pe({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(ne);return}if(typeof i!=`string`&&(i=``),!n){Pp(),await je(),i&&(Ae(i),Lp(`repository`,i),Rp(`Repository Data`,{name:i}));try{Lp(`framework`,(await o()).id)}catch{}let t=await O();if(t){let e=await k(),n=Si(t)?.exp,i=Date.now()/1e3;(!n||n-i<=3600)&&process.on(`exit`,()=>Ee()),(!n||n>i)&&r({token:t,host:e}).then(e=>{ke({shortId:e.shortId,intercomHash:e.intercomHash}),Ip({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&Oe(e)}try{await zp(),e&&!$.includes(e)&&A(e)}catch(t){if(process.exitCode=1,t instanceof P){$.includes(e)||A(e),console.error(_(t.message));return}if(t instanceof f){$.includes(e)||A(e,{error:t}),console.error(t.message);return}if(t instanceof hr){if($.includes(e)||A(e),t.availableEnvironments.length===1&&t.repo===t.availableEnvironments[0].domain)console.error(`No environments available on repository "${t.repo}".`);else{let e=t.availableEnvironments.map(e=>e.domain).join(`
327
327
  `);console.error(_`
328
328
  Environment "${t.env}" not found on repository "${t.repo}".
329
329
 
@@ -337,4 +337,4 @@ Watch stopped. Goodbye!`),A(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
337
337
  Slice Machine until your repository can upgrade.
338
338
 
339
339
  Learn more at https://prismic.io/docs/type-builder
340
- `);return}throw $.includes(e)||A(e,{error:t}),await Ip(t),t}}export{};
340
+ `);return}throw $.includes(e)||A(e,{error:t}),await Fp(t),t}}export{};