prismic 1.12.1 → 1.12.2-pr.217.01acb9b

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,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a as u,c as d,d as f,f as p,g as m,h,i as g,j as _,k as v,l as y,m as b,n as x,o as ee,p as te,r as ne,s as re,t as ie,w as S,x as ae,y as oe}from"./core-B3dkaK-K.mjs";import{n as se,t as ce}from"./package-B6B-2r6P.mjs";import{C as le,D as ue,E as C,N as de,O as fe,S as pe,T as me,a as w,b as he,c as ge,d as _e,h as ve,i as ye,k as T,m as be,n as xe,o as E,p as Se,r as D,s as O,t as Ce,u as we,v as Te,w as Ee,y as De}from"./request-Cd3z-82Y.mjs";import{a as Oe,c as ke,o as Ae,s as je}from"./packageJson-Dn1dLHIw.mjs";import{a as Me,c as Ne,i as k,l as Pe,n as Fe,r as A,s as Ie,t as Le,u as Re}from"./auth-BWMyYkdd.mjs";import{i as ze,r as Be,t as Ve}from"./segment-5vSzgFig.mjs";import{t as He}from"./update-notifier-5hqPbgS9.mjs";import*as Ue from"node:util";import{parseArgs as We,promisify as Ge}from"node:util";import{realpath as Ke}from"node:fs/promises";import{fileURLToPath as qe,pathToFileURL as Je}from"node:url";import{createHash as Ye}from"node:crypto";import{dirname as Xe,join as Ze,posix as Qe,sep as $e}from"node:path";import{exec as et,execFile as tt}from"node:child_process";import{Readable as nt}from"node:stream";import{createInterface as rt}from"node:readline";import*as it from"node:http";import*as j from"node:os";import{homedir as at}from"node:os";import{setTimeout as ot}from"node:timers/promises";import{isMainThread as st,threadId as ct}from"worker_threads";import*as lt from"node:diagnostics_channel";import{subscribe as ut}from"node:diagnostics_channel";import{createReadStream as dt,existsSync as ft,readFile as pt,readFileSync as mt,readdir as ht}from"node:fs";import{Worker as gt}from"node:worker_threads";import*as _t from"node:https";import{createGzip as vt}from"node:zlib";import*as yt from"node:net";import*as bt from"node:tls";import{AsyncLocalStorage as xt}from"node:async_hooks";const St=C({email:T(),shortId:T(),intercomHash:T(),repositories:Te(C({domain:T(),name:ue(T()),role:Ee(T())}))});async function Ct(e){let{token:t,host:n}=e,r=wt(n);return await E(new URL(`profile`,r),{credentials:{"prismic-auth":t},schema:St})}function wt(e){return new URL(`https://user-service.${e}/`)}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=We({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(Tt(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 Tt(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[d(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(y(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(y(l)),n)for(let e in n){let t=d(n[e]);o.push(``),o.push(e);for(let e of t.split(`
2
+ import{A as e,C as t,D as n,E as r,F as i,L as a,M as o,N as s,P as c,S as l,T as u,_ as d,a as f,c as p,d as m,f as h,g,h as ee,i as _,j as te,k as v,l as y,m as b,n as x,o as ne,p as re,r as ie,s as ae,t as oe,w as S,x as se,y as ce}from"./core-Dzm5w89l.mjs";import{n as le,t as ue}from"./package-BhJjBm_V.mjs";import{A as de,C as fe,D as pe,E as me,N as he,O as C,S as ge,T as w,a as T,b as _e,c as ve,d as ye,h as be,i as xe,m as Se,n as Ce,o as E,p as we,r as D,s as O,t as Te,u as Ee,v as De,w as Oe,y as ke}from"./request-Dtd3MvMj.mjs";import{a as Ae,c as je,o as Me,s as Ne}from"./packageJson-DuN38oFo.mjs";import{a as Pe,c as Fe,i as k,l as Ie,n as Le,r as A,s as Re,t as ze,u as j}from"./auth-t8Ao2K5y.mjs";import{i as Be,r as Ve,t as He}from"./segment-o0v3YJDx.mjs";import{t as Ue}from"./update-notifier-BFo6lfdc.mjs";import*as We from"node:util";import{parseArgs as Ge,promisify as Ke}from"node:util";import{realpath as qe}from"node:fs/promises";import{fileURLToPath as Je,pathToFileURL as Ye}from"node:url";import{createHash as Xe}from"node:crypto";import{dirname as Ze,join as Qe,posix as $e,sep as et}from"node:path";import{exec as tt,execFile as nt}from"node:child_process";import{Readable as rt}from"node:stream";import{createInterface as it}from"node:readline";import*as at from"node:http";import*as M from"node:os";import{homedir as ot}from"node:os";import{setTimeout as st}from"node:timers/promises";import{isMainThread as ct,threadId as lt}from"worker_threads";import*as ut from"node:diagnostics_channel";import{subscribe as dt}from"node:diagnostics_channel";import{createReadStream as ft,existsSync as pt,readFile as mt,readFileSync as ht,readdir as gt}from"node:fs";import{Worker as _t}from"node:worker_threads";import*as vt from"node:https";import{createGzip as yt}from"node:zlib";import*as bt from"node:net";import*as xt from"node:tls";import{AsyncLocalStorage as St}from"node:async_hooks";const Ct=w({email:C(),shortId:C(),intercomHash:C(),repositories:De(w({domain:C(),name:me(C()),role:me(de([C(),pe(C(),C())]))}))});async function wt(e){let{token:t,host:n}=e,r=Tt(n);return await E(new URL(`profile`,r),{credentials:{"prismic-auth":t},schema:Ct})}function Tt(e){return new URL(`https://user-service.${e}/`)}function N(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=Ge({args:a,options:{...r,help:{type:`boolean`,short:`h`}},allowPositionals:o,strict:!0});if(s.values.help){console.info(Et(e));return}for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!s.positionals[e])throw new F(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r))if(t.required&&!(e in s.values))throw new F(`Missing required option: --${e}`);await t(s)}}function Et(e){let{description:t,sections:n,positionals:r={},options:i}=e,a=Object.keys(r),o=[p(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(y(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(y(l)),n)for(let e in n){let t=p(n[e]);o.push(``),o.push(e);for(let e of t.split(`
3
3
  `))o.push(e?` ${e}`:``)}o.push(``),o.push(`LEARN MORE`);let u=e.name.split(` `)[0];return o.push(` Use \`${u} <command> --help\` for more information about a command.`),o.join(`
4
- `)}function N(e){let t=e.name.split(` `).length;return async function(){let{positionals:[n]}=We({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(Et(e))}}function Et(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(y(o)),a.push(``),a.push(`OPTIONS`),a.push(` -h, --help Show help for command`),r)for(let e in r){let t=d(r[e]);a.push(``),a.push(e);for(let e of t.split(`
4
+ `)}function P(e){let t=e.name.split(` `).length;return async function(){let{positionals:[n]}=Ge({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 F(`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(y(o)),a.push(``),a.push(`OPTIONS`),a.push(` -h, --help Show help for command`),r)for(let e in r){let t=p(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(`
6
- `)}var P=class extends Error{name=`CommandError`};const Dt=C({path:T(),title:T(),description:ue(T())}),Ot=C({path:T(),title:T(),description:ue(T()),anchors:Te(C({slug:T(),excerpt:T()}))});async function kt(){return await E(new URL(`api/index/`,Mt()),{schema:Te(Dt)})}async function At(e){let t=new URL(`api/index/${e}`,Mt());try{return await E(t,{schema:Ot})}catch(t){throw t instanceof D&&(t.message=`Documentation page not found: ${e}`),t}}async function jt(e){let t=new URL(e,Mt());try{return await E(t,{headers:{Accept:`text/markdown`},schema:T()})}catch(t){throw t instanceof D&&(t.message=`Page not found: ${e}`),t}}function Mt(){let e=Re.PRISMIC_DOCS_HOST??Pe;return new URL(`https://${e}/docs/`)}var Nt=M({name:`prismic docs list`,description:`
6
+ `)}var F=class extends Error{name=`CommandError`};const Ot=w({path:C(),title:C(),description:me(C())}),kt=w({path:C(),title:C(),description:me(C()),anchors:De(w({slug:C(),excerpt:C()}))});async function At(){return await E(new URL(`api/index/`,Nt()),{schema:De(Ot)})}async function jt(e){let t=new URL(`api/index/${e}`,Nt());try{return await E(t,{schema:kt})}catch(t){throw t instanceof D&&(t.message=`Documentation page not found: ${e}`),t}}async function Mt(e){let t=new URL(e,Nt());try{return await E(t,{headers:{Accept:`text/markdown`},schema:C()})}catch(t){throw t instanceof D&&(t.message=`Page not found: ${e}`),t}}function Nt(){let e=j.PRISMIC_DOCS_HOST??Ie;return new URL(`https://${e}/docs/`)}var Pt=N({name:`prismic docs list`,description:`
7
7
  List available documentation pages.
8
8
 
9
9
  With a path argument, list the anchors within that page.
10
- `,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await At(n)}catch(e){throw e instanceof w?new P(`Failed to fetch documentation index: ${await e.text()}`):e}if(r){console.info(O(e));return}if(e.anchors.length===0){console.info(`(no anchors)`);return}let t=e.anchors.map(e=>[`${n}#${e.slug}`,e.excerpt]);console.info(y(t,{headers:[`PATH`,`EXCERPT`]}))}else{let e;try{e=await kt()}catch(e){throw e instanceof w?new P(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.sort((e,t)=>e.path.localeCompare(t.path)),r){console.info(O(e));return}if(e.length===0){console.info(`No documentation pages found.`);return}let t=e.map(e=>[e.path,e.title,e.description??``]);console.info(y(t,{headers:[`PATH`,`TITLE`,`DESCRIPTION`]}))}});const Pt=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,Ft=Object.hasOwnProperty;var It=class{constructor(){this.occurrences,this.reset()}slug(e,t){let n=this,r=Lt(e,t===!0),i=r;for(;Ft.call(n.occurrences,r);)n.occurrences[i]++,r=i+`-`+n.occurrences[i];return n.occurrences[r]=0,r}reset(){this.occurrences=Object.create(null)}};function Lt(e,t){return typeof e==`string`?(t||(e=e.toLowerCase()),e.replace(Pt,``).replace(/ /g,`-`)):``}var Rt=M({name:`prismic docs view`,description:`
10
+ `,positionals:{path:{description:`Documentation path to list anchors for`,required:!1}},options:{json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,{json:r}=t;if(n){let e;try{e=await jt(n)}catch(e){throw e instanceof T?new F(`Failed to fetch documentation index: ${await e.text()}`):e}if(r){console.info(O(e));return}if(e.anchors.length===0){console.info(`(no anchors)`);return}let t=e.anchors.map(e=>[`${n}#${e.slug}`,e.excerpt]);console.info(y(t,{headers:[`PATH`,`EXCERPT`]}))}else{let e;try{e=await At()}catch(e){throw e instanceof T?new F(`Failed to fetch documentation index: ${await e.text()}`):e}if(e.sort((e,t)=>e.path.localeCompare(t.path)),r){console.info(O(e));return}if(e.length===0){console.info(`No documentation pages found.`);return}let t=e.map(e=>[e.path,e.title,e.description??``]);console.info(y(t,{headers:[`PATH`,`TITLE`,`DESCRIPTION`]}))}});const Ft=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,It=Object.hasOwnProperty;var Lt=class{constructor(){this.occurrences,this.reset()}slug(e,t){let n=this,r=Rt(e,t===!0),i=r;for(;It.call(n.occurrences,r);)n.occurrences[i]++,r=i+`-`+n.occurrences[i];return n.occurrences[r]=0,r}reset(){this.occurrences=Object.create(null)}};function Rt(e,t){return typeof e==`string`?(t||(e=e.toLowerCase()),e.replace(Ft,``).replace(/ /g,`-`)):``}var zt=N({name:`prismic docs view`,description:`
11
11
  View a documentation page as Markdown.
12
12
 
13
13
  Append #anchor to the path to view only the section under that heading.
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 jt(a)}catch(e){throw e instanceof w?new P(`Failed to fetch page: ${await e.text()}`):e}if(o){let e=zt(s,o);if(!e)throw new P(`Anchor not found: #${o}`);s=e}if(r){console.info(O({path:a,anchor:o,content:s}));return}console.info(s)});function zt(e,t){let n=e.split(`
15
- `),r=new It,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 Bt=N({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Nt,description:`List available documentation pages`},view:{handler:Rt,description:`View a documentation page`}}});function F(e){let t=Vt(e);return`variations`in t&&(t.variations=t.variations.map(e=>Vt(e))),t}function Vt(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")`}},Ht={"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 Ut(e,t){let n=await p(),{"from-slice":r,"from-type":i,variation:a=`default`}=t,o=[r,i].filter(Boolean).length;if(o===0)throw new P(`Specify a target with --from-slice or --from-type.`);if(o>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 s=await n.getCustomType(i),c=e.includes(`.`)?e.split(`.`)[0]:e,l;for(let e in s.model.json)c in s.model.json[e]&&(l=s.model.json[e]);if(!l)throw new P(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(s.model.json))).join(`, `)||`(none)`}`);return R(l,e),[l,async()=>{await n.updateCustomType(s.model),await n.generateTypes()},`customType`]}async function Wt(e,t,n){let r=await p(),{"from-slice":i,"from-type":a,variation:o=`default`}=n,s=[i,a].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(i){let e=await r.getSlice(i),t=e.model.variations.find(e=>e.id===o);if(!t)throw new P(`Variation "${o}" 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 c=await r.getCustomType(a),l=e.includes(`.`)?e.split(`.`)[0]:e,u=t.includes(`.`)?t.split(`.`)[0]:t,d,f;for(let e in c.model.json){let t=c.model.json[e];l in t&&(d=t),u in t&&(f=t)}let m=Object.keys(Object.assign({},...Object.values(c.model.json))).join(`, `)||`(none)`;if(!d)throw new P(`Field "${e}" not found. Available: ${m}`);if(!f)throw new P(`Field "${t}" not found. Available: ${m}`);return[d,f,async()=>{await r.updateCustomType(c.model),await r.generateTypes()},`customType`]}async function L(e){let t=await p(),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`,o=await t.getCustomType(r),s=o.model.json[a];if(!s)throw new P(`Tab "${a}" not found. Available: ${Object.keys(o.model.json).join(`, `)||`(none)`}`);return[s,async()=>{await t.updateCustomType(o.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 Gt=[`Slices`,`UID`,`Choice`];async function Kt(e,t){let n=await p(),r=await n.getCustomType(t);return qt(e,Object.assign({},...Object.values(r.model.json)),r.model.id,n,1)}async function qt(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)Jt(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 qt(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 qt(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 Jt(e,t,n){if(!(e in t))throw new P(`Field "${e}" not found on type "${n}".`);if(Gt.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 Yt=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??_(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}))}),Xt=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??_(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 content-relationship`,description:`
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 Mt(a)}catch(e){throw e instanceof T?new F(`Failed to fetch page: ${await e.text()}`):e}if(o){let e=Bt(s,o);if(!e)throw new F(`Anchor not found: #${o}`);s=e}if(r){console.info(O({path:a,anchor:o,content:s}));return}console.info(s)});function Bt(e,t){let n=e.split(`
15
+ `),r=new Lt,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 Vt=P({name:`prismic docs`,description:`Browse Prismic documentation.`,commands:{list:{handler:Pt,description:`List available documentation pages`},view:{handler:zt,description:`View a documentation page`}}});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")`}},Ht={"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 Ut(e,t){let n=await h(),{"from-slice":r,"from-type":i,variation:a=`default`}=t,o=[r,i].filter(Boolean).length;if(o===0)throw new F(`Specify a target with --from-slice or --from-type.`);if(o>1)throw new F(`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 F(`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 s=await n.getCustomType(i),c=e.includes(`.`)?e.split(`.`)[0]:e,l;for(let e in s.model.json)c in s.model.json[e]&&(l=s.model.json[e]);if(!l)throw new F(`Field "${e}" not found. Available: ${Object.keys(Object.assign({},...Object.values(s.model.json))).join(`, `)||`(none)`}`);return R(l,e),[l,async()=>{await n.updateCustomType(s.model),await n.generateTypes()},`customType`]}async function Wt(e,t,n){let r=await h(),{"from-slice":i,"from-type":a,variation:o=`default`}=n,s=[i,a].filter(Boolean).length;if(s===0)throw new F(`Specify a target with --from-slice or --from-type.`);if(s>1)throw new F(`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===o);if(!t)throw new F(`Variation "${o}" 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 c=await r.getCustomType(a),l=e.includes(`.`)?e.split(`.`)[0]:e,u=t.includes(`.`)?t.split(`.`)[0]:t,d,f;for(let e in c.model.json){let t=c.model.json[e];l in t&&(d=t),u in t&&(f=t)}let p=Object.keys(Object.assign({},...Object.values(c.model.json))).join(`, `)||`(none)`;if(!d)throw new F(`Field "${e}" not found. Available: ${p}`);if(!f)throw new F(`Field "${t}" not found. Available: ${p}`);return[d,f,async()=>{await r.updateCustomType(c.model),await r.generateTypes()},`customType`]}async function L(e){let t=await h(),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 F(`Specify a target with --to-slice or --to-type.`);if(i>1)throw new F(`Only one of --to-slice or --to-type can be specified.`);if(n){if(`tab`in e)throw new F(`--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 F(`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 F(`--variation is only valid for slices.`);let a=e.tab??`Main`,o=await t.getCustomType(r),s=o.model.json[a];if(!s)throw new F(`Tab "${a}" not found. Available: ${Object.keys(o.model.json).join(`, `)||`(none)`}`);return[s,async()=>{await t.updateCustomType(o.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 F(`Field "${e}" does not exist.`);if(t.type!==`Group`)throw new F(`Field "${e}" is not a group field.`);t.config??={},t.config.fields??={},i=t.config.fields}return[i,r]}const Gt=[`Slices`,`UID`,`Choice`];async function Kt(e,t){let n=await h(),r=await n.getCustomType(t);return qt(e,Object.assign({},...Object.values(r.model.json)),r.model.id,n,1)}async function qt(e,t,n,r,i){let a=[],o=new Map;for(let r of e){let e=r.indexOf(`.`);if(e===-1)Jt(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 F(`Field "${e}" not found on type "${n}".`);if(o.type===`Group`){let t=await qt(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 F(`Cannot nest deeper than --field group.cr.group.leaf.`);let t=o.config?.customtypes;if(!t||t.length!==1)throw new F(`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 qt(s,Object.assign({},...Object.values(c.model.json)),n,r,i-1);a.push({id:e,customtypes:[{id:n,fields:l}]})}else throw new F(`Field "${e}" is not a group or content relationship field.`)}return a}function Jt(e,t,n){if(!(e in t))throw new F(`Field "${e}" not found on type "${n}".`);if(Gt.includes(t[e].type)||e===`uid`)throw new F(`Field "${e}" cannot be fetched from a content relationship.`);if(t[e].type===`Group`)throw new F(`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 Yt=N({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,[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`Boolean`,config:{label:r??s(f),default_value:i,placeholder_true:a,placeholder_false:o}};if(f in d)throw new F(`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}))}),Xt=N({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,c]=await L(t),[l,u]=R(a,n),d={type:`Color`,config:{label:r??s(u),placeholder:i}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await o(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),Zt=N({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{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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 Kt(o,a[0]);f=[{id:a[0],fields:e}]}let p={type:`Link`,config:{label:r??_(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}))}),Qt=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??_(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}))}),$t=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??_(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}))}),en=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??_(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}))}),tn=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??_(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}))}),nn=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??_(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}))}),rn=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??_(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}))}),an=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 F(`--field requires exactly one --custom-type.`);let[c,l,u]=await L(t),[d,f]=R(c,n),p=a;if(o&&a){let e=await Kt(o,a[0]);p=[{id:a[0],fields:e}]}let m={type:`Link`,config:{label:r??s(f),select:`document`,tags:i,customtypes:p}};if(f in d)throw new F(`Field "${n}" already exists.`);d[f]=m,await l(),console.info(`Field added: ${n}`);let h=t[`to-slice`]??t[`to-type`];console.info(z({targetId:h,modelKind:u}))}),Qt=N({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,c,l]=await L(t),[u,d]=R(o,n),f={type:`Date`,config:{label:r??s(d),placeholder:i,default:a}};if(d in u)throw new F(`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}))}),$t=N({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,c]=await L(t),[l,u]=R(a,n),d={type:`Embed`,config:{label:r??s(u),placeholder:i}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await o(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),en=N({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),[c,l]=R(i,n),u={type:`GeoPoint`,config:{label:r??s(l)}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await a(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:o}))}),tn=N({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),[c,l]=R(i,n),u={type:`Group`,config:{label:r??s(l)}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await a(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:o}))}),nn=N({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,c]=await L(t),[l,u]=R(a,n),d={type:`Image`,config:{label:r??s(u),placeholder:i}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await o(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),rn=N({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,c,l]=await L(t),[u,d]=R(o,n),f={type:`IntegrationFields`,config:{label:r??s(d),placeholder:i,catalog:a}};if(d in u)throw new F(`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}))}),an=N({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{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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??_(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 v=t[`to-slice`]??t[`to-type`];console.info(z({targetId:v,modelKind:p}))}),on=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=sn(t.min,`min`),o=sn(t.max,`max`),s=sn(t.step,`step`),[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`Number`,config:{label:r??_(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 sn(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 cn=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":c,repeatable:l,variant:u}=t;if(a&&!r.includes(a))throw new F(`--allow must be one of: ${r.join(`, `)}`);let d=a,[f,p,m]=await L(t),[h,g]=R(f,n),ee={type:`Link`,config:{label:i??s(g),select:d,allowTargetBlank:o,allowText:c,repeat:l,variants:u}};if(g in h)throw new F(`Field "${n}" already exists.`);h[g]=ee,await p(),console.info(`Field added: ${n}`);let _=t[`to-slice`]??t[`to-type`];console.info(z({targetId:_,modelKind:m}))}),on=N({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=sn(t.min,`min`),o=sn(t.max,`max`),c=sn(t.step,`step`),[l,u,d]=await L(t),[f,p]=R(l,n),m={type:`Number`,config:{label:r??s(p),placeholder:i,min:a,max:o,step:c}};if(p in f)throw new F(`Field "${n}" already exists.`);f[p]=m,await u(),console.info(`Field added: ${n}`);let h=t[`to-slice`]??t[`to-type`];console.info(z({targetId:h,modelKind:d}))});function sn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new F(`--${t} must be a valid number, got "${e}"`);return n}var cn=N({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{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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??_(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}))}),ln=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":c}=t,[l,u,d]=await L(t),[f,p]=R(l,n),m={type:`StructuredText`,config:{label:r??s(p),placeholder:i,...o?{single:a}:{multi:a},allowTargetBlank:c}};if(p in f)throw new F(`Field "${n}" already exists.`);f[p]=m,await u(),console.info(`Field added: ${n}`);let h=t[`to-slice`]??t[`to-type`];console.info(z({targetId:h,modelKind:d}))}),ln=N({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??_(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}))}),un=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??_(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}))}),dn=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??_(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}))}),fn=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??_(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}))}),pn=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}))}),mn=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,[c,l,u]=await L(t),[d,f]=R(c,n),p={type:`Select`,config:{label:r??s(f),placeholder:i,default_value:a,options:o}};if(f in d)throw new F(`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}))}),un=N({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),[c,l]=R(i,n),u={type:`Table`,config:{label:r??s(l)}};if(l in c)throw new F(`Field "${n}" already exists.`);c[l]=u,await a(),console.info(`Field added: ${n}`);let d=t[`to-slice`]??t[`to-type`];console.info(z({targetId:d,modelKind:o}))}),dn=N({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,c]=await L(t),[l,u]=R(a,n),d={type:`Text`,config:{label:r??s(u),placeholder:i}};if(u in l)throw new F(`Field "${n}" already exists.`);l[u]=d,await o(),console.info(`Field added: ${n}`);let f=t[`to-slice`]??t[`to-type`];console.info(z({targetId:f,modelKind:c}))}),fn=N({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,c,l]=await L(t),[u,d]=R(o,n),f={type:`Timestamp`,config:{label:r??s(d),placeholder:i,default:a}};if(d in u)throw new F(`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}))}),pn=N({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 F(`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}))}),mn=P({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:Yt,description:`Add a boolean field`},color:{handler:Xt,description:`Add a color field`},"content-relationship":{handler:Zt,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:Qt,description:`Add a date field`},embed:{handler:$t,description:`Add an embed field`},geopoint:{handler:en,description:`Add a geopoint field`},group:{handler:tn,description:`Add a group field`},image:{handler:nn,description:`Add an image field`},integration:{handler:rn,description:`Add an integration field`},link:{handler:an,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:on,description:`Add a number field`},"rich-text":{handler:cn,description:`Add a rich text field`},select:{handler:ln,description:`Add a select field`},table:{handler:un,description:`Add a table field`},text:{handler:dn,description:`Add a text field`},timestamp:{handler:fn,description:`Add a timestamp field`},uid:{handler:pn,description:`Add a UID field`}}}),hn=M({name:`prismic field edit`,description:`Edit an existing field in a slice or custom type.`,sections:{"FIELD TYPE OPTIONS":`
76
+ `},commands:{boolean:{handler:Yt,description:`Add a boolean field`},color:{handler:Xt,description:`Add a color field`},"content-relationship":{handler:Zt,description:`Add a content relationship field for fetching data from related documents (not for navigation -- use link)`},date:{handler:Qt,description:`Add a date field`},embed:{handler:$t,description:`Add an embed field`},geopoint:{handler:en,description:`Add a geopoint field`},group:{handler:tn,description:`Add a group field`},image:{handler:nn,description:`Add an image field`},integration:{handler:rn,description:`Add an integration field`},link:{handler:an,description:`Add a link field for URLs, documents, or media (navigational)`},number:{handler:on,description:`Add a number field`},"rich-text":{handler:cn,description:`Add a rich text field`},select:{handler:ln,description:`Add a select field`},table:{handler:un,description:`Add a table field`},text:{handler:dn,description:`Add a text field`},timestamp:{handler:fn,description:`Add a timestamp field`},uid:{handler:pn,description:`Add a UID field`}}}),hn=N({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{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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:{...Ht,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 Ut(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=gn(t.min,`min`)),`max`in t&&(s.config.max=gn(t.max,`max`)),`step`in t&&(s.config.step=gn(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 Kt(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 gn(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 _n=M({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Ht},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await Ut(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}`)}),vn=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 Wt(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 _=Object.entries(m);for(let e of Object.keys(m))delete m[e];for(let[e,t]of _)o===`before`&&e===h&&(m[p]=g),m[e]=t,o===`after`&&e===h&&(m[p]=g);await d(),console.info(`Field reordered: ${n}`)}),yn=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:{...Ht,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,[r]=await Ut(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(O({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(`${_(e)}: ${t.join(`, `)}`):console.info(`${_(e)}: ${t}`)}}),bn=N({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:mn,description:`Add a field`},edit:{handler:hn,description:`Edit a field`},remove:{handler:_n,description:`Remove a field`},reorder:{handler:vn,description:`Reorder a field`},view:{handler:yn,description:`View details of a field`}}}),xn=M({name:`prismic gen setup`,description:`
89
+ `},positionals:{id:{description:`Field ID`,required:!0}},options:{...Ht,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 Ut(n,t),[a,o]=R(r,n),s=a[o];if(!s)throw new F(`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 F(`--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=gn(t.min,`min`)),`max`in t&&(s.config.max=gn(t.max,`max`)),`step`in t&&(s.config.step=gn(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 F(`--field requires the field to be restricted to a custom type. Use --custom-type to specify one.`);if(e.length>1)throw new F(`--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 Kt(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 gn(e,t){if(e===void 0)return;let n=Number(e);if(Number.isNaN(n))throw new F(`--${t} must be a valid number, got "${e}"`);return n}var _n=N({name:`prismic field remove`,description:`Remove a field from a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:Ht},async({positionals:e,values:t})=>{let[n]=e,[r,i]=await Ut(n,t),[a,o]=R(r,n);if(!(o in a))throw new F(`Field "${n}" does not exist.`);delete a[o],await i(),console.info(`Field removed: ${n}`)}),vn=N({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 F(`Specify --before or --after.`);if(r&&i)throw new F(`Only one of --before or --after can be specified.`);let a=r??i,o=r?`before`:`after`;if(n===a)throw new F(`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 F(`Cannot reorder "${n}" relative to "${a}": fields must be in the same container.`);let[l,u,d]=await Wt(n,a,t),[f,p]=R(l,n),[m,h]=R(u,a);if(!(p in f))throw new F(`Field "${n}" does not exist.`);if(!(h in m))throw new F(`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}`)}),yn=N({name:`prismic field view`,description:`View details of a field in a slice or custom type.`,positionals:{id:{description:`Field ID`,required:!0}},options:{...Ht,json:{type:`boolean`,description:`Output as JSON`}}},async({positionals:e,values:t})=>{let[n]=e,[r]=await Ut(n,t),[i,a]=R(r,n),o=i[a];if(!o)throw new F(`Field "${n}" does not exist.`);if(t.json){console.info(O({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(`${s(e)}: ${t.join(`, `)}`):console.info(`${s(e)}: ${t}`)}}),bn=P({name:`prismic field`,description:`Manage fields in slices and content types.`,commands:{add:{handler:mn,description:`Add a field`},edit:{handler:hn,description:`Edit a field`},remove:{handler:_n,description:`Remove a field`},reorder:{handler:vn,description:`Reorder a field`},view:{handler:yn,description:`View details of a field`}}}),xn=N({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 p()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await Oe()}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 p()).generateTypes(),n=ve(await t(),e);console.info(`Generated types at ${n}`)}),Cn=N({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:xn,description:`Generate framework-specific Prismic setup`},types:{handler:Sn,description:`Generate TypeScript types from local models`}}});async function wn(e){let{repo:t,token:n,host:r}=e,i=Ln(r),a=new URL(`customtypes`,i);try{return await E(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function Tn(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`customtypes/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function En(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`customtypes/update`,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=Ln(i);await E(new URL(`customtypes/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}async function On(e){let{repo:t,token:n,host:r}=e,i=Ln(r),a=new URL(`slices`,i);try{return await E(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function kn(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`slices/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function An(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`slices/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function jn(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`slices/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}const Mn=C({values:C({url:T(),fields:fe(T(),T())}),imgixEndpoint:T()}),Nn={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function Pn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`delete`,Rn(i));a.searchParams.set(`repository`,n),await E(a,{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:{sliceId:e}})}async function Fn(e,t){let{sliceId:n,variationId:r,repo:i,token:a,host:o}=t,s=e.type;if(!(s in Nn))throw new In(s);let c=new URL(`presigned-url`,Rn(o));c.searchParams.set(`repository`,i);let l=await E(c,{headers:{repository:i,Authorization:`Bearer ${a}`},schema:Mn}),u=Nn[s],d=`${i}/shared-slices/${n}/${r}/${Ye(`sha1`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${u}`,f=new FormData;for(let[e,t]of Object.entries(l.values.fields))f.append(e,t);f.set(`key`,d),f.set(`Content-Type`,s),f.set(`file`,e),await E(l.values.url,{method:`POST`,body:f});let p=new URL(d,Se(l.imgixEndpoint));return p.searchParams.set(`auto`,`compress,format`),p}var In=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){super(`Unsupported file type: ${e||`unknown`}. Supported: ${Object.keys(Nn).join(`, `)}`)}};function Ln(e){return new URL(`https://customtypes.${e}/`)}function Rn(e){return new URL(`https://api.internal.${e}/screenshot/`)}function zn(e){et(`${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 Bn=C({id:T(),label:T(),customName:le(T()),isMaster:De()});async function Vn(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,Wn(r));i.searchParams.set(`repository`,t);try{return(await E(i,{headers:{Authorization:`Bearer ${n}`},schema:C({results:Te(Bn)})})).results}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function Hn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,Wn(i));a.searchParams.set(`repository`,n);try{return await E(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:Bn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}async function Un(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,Wn(i));a.searchParams.set(`repository`,n),await E(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function Wn(e){return new URL(`https://api.internal.${e}/locale/`)}const Gn=C({documentsPublished:De(),documentsUnpublished:De(),releasesCreated:De(),releasesUpdated:De(),tagsCreated:De(),tagsDeleted:De()}),Kn=Object.keys(Gn.shape),qn=C({config:he(Gn,{_id:T(),url:T(),active:De(),name:le(T()),secret:le(T()),headers:fe(T(),T())})});async function Jn(e){let{repo:t,token:n,host:r}=e,i=V(t,r),a=new URL(`app/settings/webhooks`,i);try{return await E(a,{credentials:{"prismic-auth":n},schema:Te(qn)})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function Yn(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 E(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}async function Xn(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 E(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof D&&(e.message=`Webhook not found`),e}}async function Zn(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 E(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Webhook not found`),e}}const Qn=C({id:T(),scope:T(),token:T(),created_at:C({$date:me()})}),$n=C({id:T(),name:T(),wroom_auths:Te(Qn)}),er=C({app_name:T(),token:T(),timestamp:me()}),tr=C({max_tokens:me(),tokens:Te(er)});async function nr(e){let t=new URL(`settings/security/contentapi`,V(e.repo,e.host));try{return await E(t,{credentials:{"prismic-auth":e.token},schema:Te($n)})}catch(t){throw t instanceof D&&(t.message=`Repository not found: ${e.repo}`),t}}async function rr(e,t){let n=new URL(`settings/security/oauthapp`,V(t.repo,t.host));try{return await E(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:$n})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t.repo}`),e}}async function ir(e,t,n){let r=new URL(`settings/security/authorizations`,V(n.repo,n.host));try{return await E(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Qn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n.repo}`),e}}async function ar(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await E(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof D&&(e.message=`Token not found`),e}}async function or(e){let t=new URL(`settings/security/customtypesapi`,V(e.repo,e.host));try{return await E(t,{credentials:{"prismic-auth":e.token},schema:tr})}catch(t){throw t instanceof D&&(t.message=`Repository not found: ${e.repo}`),t}}async function sr(e,t){let n=new URL(`settings/security/token`,V(t.repo,t.host));try{return await E(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:er})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t.repo}`),e}}async function cr(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await E(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof D&&(t.message=`Token not found: ${e}`),t}}async function lr(e){let{domain:t,token:n,host:r}=e;return await E(new URL(`app/dashboard/repositories/${t}/exists`,gr(r)),{credentials:{"prismic-auth":n},schema:De()})}async function ur(e){let{domain:t,name:n,framework:r,agent:i,token:a,host:o}=e,s=new URL(`app/dashboard/repositories`,gr(o));s.searchParams.set(`app`,`cli`),i&&s.searchParams.set(`agent`,i),await E(s,{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":a}})}const dr=C({repository:C({api_access:T()})});async function fr(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,V(t,r));try{return(await E(i,{credentials:{"prismic-auth":n},schema:dr})).repository.api_access}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function pr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,V(n,i));try{await E(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}const mr=C({repository:C({name:T()})});async function hr(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 E(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:mr})).repository.name}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}function gr(e){return new URL(`https://${e}/`)}function V(e,t){return new URL(`https://${e}.${t}/`)}function _r(e){let{repo:t,host:n,customTypeId:r}=e,i=new URL(`builder/working`,V(t,n));return i.searchParams.set(`customTypes`,r),i.href}function vr(e){let{repo:t,host:n,format:r}=e,i=[`builder`,`types`,r===`custom`?`custom-types`:`page-types`].join(`/`);return new URL(i,V(t,n)).href}async function yr(){if(process.env.AI_AGENT)return process.env.AI_AGENT.toLowerCase();if(process.env.CLAUDE_CODE_IS_COWORK===`1`||process.env.CLAUDE_CODE_IS_COWORK===`true`)return`claude-cowork`;if(process.env.CLAUDECODE===`1`||process.env.CLAUDE_CODE)return`claude-code`;if(process.env.CODEX_CI===`1`||process.env.CODEX_SANDBOX||process.env.CODEX_THREAD_ID)return`codex`;if(process.env.CURSOR_AGENT===`1`||process.env.CURSOR_EXTENSION_HOST_ROLE===`agent-exec`)return`cursor`;if(process.env.CLINE_ACTIVE===`true`)return`cline`;if(process.env.ANTIGRAVITY_AGENT)return`antigravity`;if(process.env.AUGMENT_AGENT===`1`)return`augment`;if(process.env.OPENCODE_CLIENT===`1`)return`opencode`;if(process.env.GEMINI_CLI===`1`)return`gemini-cli`;if(process.env.TRAE_AI_SHELL_ID)return`trae`;if(process.env.REPL_ID)return`replit`;if(process.env.COPILOT_MODEL||process.env.COPILOT_ALLOW_ALL||process.env.COPILOT_GITHUB_TOKEN)return`github-copilot`;let e=process.env.AGENT?.toLowerCase();if(e===`goose`||e===`amp`)return e;if(process.platform===`linux`&&await ge(new URL(`file:///opt/.devin`)))return`devin`;if(process.env.IS_SANDBOX===`yes`)return`unknown-sandbox`}var br=M({name:`prismic repo create`,description:`Create a new Prismic repository.`,options:{name:{type:`string`,short:`n`,description:`Display name for the repository`},lang:{type:`string`,short:`l`,description:`Master locale for the new repository (default: en-us)`}}},async({values:e})=>{let{name:t,lang:n}=e,r=await k(),i=await A(),a=await xr({name:t,lang:n,token:r,host:i});console.info(`Repository created: ${a}`),console.info(`URL: https://${a}.${i}/`)});async function xr(e){let{name:t,lang:n=`en-us`,token:r,host:i}=e,a=await Sr({token:r,host:i});if(!a)throw new P(`Failed to create a repository. Please try again.`);let o=(await p().catch(()=>void 0))?.id??`other`,s=await yr();try{await ur({domain:a,name:t??a,framework:o,agent:s,token:r,host:i})}catch(e){throw e instanceof w?new P(`Failed to create repository: ${await e.text()}`):e}try{await Hn({id:n,isMaster:!0},{repo:a,token:r,host:i})}catch(e){throw e instanceof w?new P(`Failed to set master locale: ${await e.text()}`):e}return await v({repo:a,token:r,host:i,stepIds:[`createPrismicProject`]}),a}async function Sr(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 lr({domain:e,token:t,host:n})){r=e;break}}return r}var Cr=M({name:`prismic init`,description:`
95
+ `,options:{"no-install":{type:`boolean`,description:`Skip installing dependencies`}}},async({values:e})=>{if(await(await h()).setupProject(),!e[`no-install`])try{console.info(`Installing dependencies...`),await Ae()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}console.info(`Generated setup files.`)}),Sn=N({name:`prismic gen types`,description:`Generate TypeScript types for slices and content types.`},async()=>{let e=await(await h()).generateTypes(),n=be(await t(),e);console.info(`Generated types at ${n}`)}),Cn=P({name:`prismic gen`,description:`Generate files from local Prismic models.`,commands:{setup:{handler:xn,description:`Generate framework-specific Prismic setup`},types:{handler:Sn,description:`Generate TypeScript types from local models`}}});async function wn(e){let{repo:t,token:n,host:r}=e,i=Ln(r),a=new URL(`customtypes`,i);try{return await E(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function Tn(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`customtypes/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function En(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`customtypes/update`,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=Ln(i);await E(new URL(`customtypes/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}async function On(e){let{repo:t,token:n,host:r}=e,i=Ln(r),a=new URL(`slices`,i);try{return await E(a,{headers:{repository:t,Authorization:`Bearer ${n}`}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function kn(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`slices/insert`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function An(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`slices/update`,a),{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:e})}async function jn(e,t){let{repo:n,token:r,host:i}=t,a=Ln(i);await E(new URL(`slices/${encodeURIComponent(e)}`,a),{method:`DELETE`,headers:{repository:n,Authorization:`Bearer ${r}`}})}const Mn=w({values:w({url:C(),fields:pe(C(),C())}),imgixEndpoint:C()}),Nn={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function Pn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`delete`,Rn(i));a.searchParams.set(`repository`,n),await E(a,{method:`POST`,headers:{repository:n,Authorization:`Bearer ${r}`},body:{sliceId:e}})}async function Fn(e,t){let{sliceId:n,variationId:r,repo:i,token:a,host:o}=t,s=e.type;if(!(s in Nn))throw new In(s);let c=new URL(`presigned-url`,Rn(o));c.searchParams.set(`repository`,i);let l=await E(c,{headers:{repository:i,Authorization:`Bearer ${a}`},schema:Mn}),u=Nn[s],d=`${i}/shared-slices/${n}/${r}/${Xe(`sha1`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${u}`,f=new FormData;for(let[e,t]of Object.entries(l.values.fields))f.append(e,t);f.set(`key`,d),f.set(`Content-Type`,s),f.set(`file`,e),await E(l.values.url,{method:`POST`,body:f});let p=new URL(d,we(l.imgixEndpoint));return p.searchParams.set(`auto`,`compress,format`),p}var In=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){super(`Unsupported file type: ${e||`unknown`}. Supported: ${Object.keys(Nn).join(`, `)}`)}};function Ln(e){return new URL(`https://customtypes.${e}/`)}function Rn(e){return new URL(`https://api.internal.${e}/screenshot/`)}function zn(e){tt(`${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 Bn=w({id:C(),label:C(),customName:fe(C()),isMaster:ke()});async function Vn(e){let{repo:t,token:n,host:r}=e,i=new URL(`repository/locales`,Wn(r));i.searchParams.set(`repository`,t);try{return(await E(i,{headers:{Authorization:`Bearer ${n}`},schema:w({results:De(Bn)})})).results}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function Hn(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales`,Wn(i));a.searchParams.set(`repository`,n);try{return await E(a,{method:`POST`,body:{id:e.id,isMaster:e.isMaster??!1,...e.customName?{customName:e.customName}:{}},headers:{Authorization:`Bearer ${r}`},schema:Bn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}async function Un(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`repository/locales/${encodeURIComponent(e)}`,Wn(i));a.searchParams.set(`repository`,n),await E(a,{method:`DELETE`,headers:{Authorization:`Bearer ${r}`}})}function Wn(e){return new URL(`https://api.internal.${e}/locale/`)}const Gn=w({documentsPublished:ke(),documentsUnpublished:ke(),releasesCreated:ke(),releasesUpdated:ke(),tagsCreated:ke(),tagsDeleted:ke()}),Kn=Object.keys(Gn.shape),qn=w({config:_e(Gn,{_id:C(),url:C(),active:ke(),name:fe(C()),secret:fe(C()),headers:pe(C(),C())})});async function Jn(e){let{repo:t,token:n,host:r}=e,i=V(t,r),a=new URL(`app/settings/webhooks`,i);try{return await E(a,{credentials:{"prismic-auth":n},schema:De(qn)})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function Yn(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 E(o,{method:`POST`,body:s,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}async function Xn(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 E(s,{method:`POST`,body:c,credentials:{"prismic-auth":i}})}catch(e){throw e instanceof D&&(e.message=`Webhook not found`),e}}async function Zn(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 E(o,{method:`POST`,credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Webhook not found`),e}}const Qn=w({id:C(),scope:C(),token:C(),created_at:w({$date:Oe()})}),$n=w({id:C(),name:C(),wroom_auths:De(Qn)}),er=w({app_name:C(),token:C(),timestamp:Oe()}),tr=w({max_tokens:Oe(),tokens:De(er)});async function nr(e){let t=new URL(`settings/security/contentapi`,V(e.repo,e.host));try{return await E(t,{credentials:{"prismic-auth":e.token},schema:De($n)})}catch(t){throw t instanceof D&&(t.message=`Repository not found: ${e.repo}`),t}}async function rr(e,t){let n=new URL(`settings/security/oauthapp`,V(t.repo,t.host));try{return await E(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:$n})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t.repo}`),e}}async function ir(e,t,n){let r=new URL(`settings/security/authorizations`,V(n.repo,n.host));try{return await E(r,{method:`POST`,body:{app:e,scope:t},credentials:{"prismic-auth":n.token},schema:Qn})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n.repo}`),e}}async function ar(e,t){let n=new URL(`settings/security/authorizations/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await E(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(e){throw e instanceof D&&(e.message=`Token not found`),e}}async function or(e){let t=new URL(`settings/security/customtypesapi`,V(e.repo,e.host));try{return await E(t,{credentials:{"prismic-auth":e.token},schema:tr})}catch(t){throw t instanceof D&&(t.message=`Repository not found: ${e.repo}`),t}}async function sr(e,t){let n=new URL(`settings/security/token`,V(t.repo,t.host));try{return await E(n,{method:`POST`,body:{app_name:e},credentials:{"prismic-auth":t.token},schema:er})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t.repo}`),e}}async function cr(e,t){let n=new URL(`settings/security/token/${encodeURIComponent(e)}`,V(t.repo,t.host));try{await E(n,{method:`DELETE`,credentials:{"prismic-auth":t.token}})}catch(t){throw t instanceof D&&(t.message=`Token not found: ${e}`),t}}async function lr(e){let{domain:t,token:n,host:r}=e;return await E(new URL(`app/dashboard/repositories/${t}/exists`,gr(r)),{credentials:{"prismic-auth":n},schema:ke()})}async function ur(e){let{domain:t,name:n,framework:r,agent:i,token:a,host:o}=e,s=new URL(`app/dashboard/repositories`,gr(o));s.searchParams.set(`app`,`cli`),i&&s.searchParams.set(`agent`,i),await E(s,{method:`POST`,body:{domain:t,name:n,framework:r,plan:`personal`},credentials:{"prismic-auth":a}})}const dr=w({repository:w({api_access:C()})});async function fr(e){let{repo:t,token:n,host:r}=e,i=new URL(`syncState`,V(t,r));try{return(await E(i,{credentials:{"prismic-auth":n},schema:dr})).repository.api_access}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${t}`),e}}async function pr(e,t){let{repo:n,token:r,host:i}=t,a=new URL(`settings/security/apiaccess`,V(n,i));try{await E(a,{method:`POST`,body:{api_access:e},credentials:{"prismic-auth":r}})}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}const mr=w({repository:w({name:C()})});async function hr(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 E(a,{method:`POST`,body:o,credentials:{"prismic-auth":r},schema:mr})).repository.name}catch(e){throw e instanceof D&&(e.message=`Repository not found: ${n}`),e}}function gr(e){return new URL(`https://${e}/`)}function V(e,t){return new URL(`https://${e}.${t}/`)}function _r(e){let{repo:t,host:n,customTypeId:r}=e,i=new URL(`builder/working`,V(t,n));return i.searchParams.set(`customTypes`,r),i.href}function vr(e){let{repo:t,host:n,format:r}=e,i=[`builder`,`types`,r===`custom`?`custom-types`:`page-types`].join(`/`);return new URL(i,V(t,n)).href}async function yr(){if(process.env.AI_AGENT)return process.env.AI_AGENT.toLowerCase();if(process.env.CLAUDE_CODE_IS_COWORK===`1`||process.env.CLAUDE_CODE_IS_COWORK===`true`)return`claude-cowork`;if(process.env.CLAUDECODE===`1`||process.env.CLAUDE_CODE)return`claude-code`;if(process.env.CODEX_CI===`1`||process.env.CODEX_SANDBOX||process.env.CODEX_THREAD_ID)return`codex`;if(process.env.CURSOR_AGENT===`1`||process.env.CURSOR_EXTENSION_HOST_ROLE===`agent-exec`)return`cursor`;if(process.env.CLINE_ACTIVE===`true`)return`cline`;if(process.env.ANTIGRAVITY_AGENT)return`antigravity`;if(process.env.AUGMENT_AGENT===`1`)return`augment`;if(process.env.OPENCODE_CLIENT===`1`)return`opencode`;if(process.env.GEMINI_CLI===`1`)return`gemini-cli`;if(process.env.TRAE_AI_SHELL_ID)return`trae`;if(process.env.REPL_ID)return`replit`;if(process.env.COPILOT_MODEL||process.env.COPILOT_ALLOW_ALL||process.env.COPILOT_GITHUB_TOKEN)return`github-copilot`;let e=process.env.AGENT?.toLowerCase();if(e===`goose`||e===`amp`)return e;if(process.platform===`linux`&&await ve(new URL(`file:///opt/.devin`)))return`devin`;if(process.env.IS_SANDBOX===`yes`)return`unknown-sandbox`}var br=N({name:`prismic repo create`,description:`Create a new Prismic repository.`,options:{name:{type:`string`,short:`n`,description:`Display name for the repository`},lang:{type:`string`,short:`l`,description:`Master locale for the new repository (default: en-us)`}}},async({values:e})=>{let{name:t,lang:n}=e,r=await k(),i=await A(),a=await xr({name:t,lang:n,token:r,host:i});console.info(`Repository created: ${a}`),console.info(`URL: https://${a}.${i}/`)});async function xr(e){let{name:t,lang:n=`en-us`,token:r,host:i}=e,a=await Sr({token:r,host:i});if(!a)throw new F(`Failed to create a repository. Please try again.`);let o=(await h().catch(()=>void 0))?.id??`other`,s=await yr();try{await ur({domain:a,name:t??a,framework:o,agent:s,token:r,host:i})}catch(e){throw e instanceof T?new F(`Failed to create repository: ${await e.text()}`):e}try{await Hn({id:n,isMaster:!0},{repo:a,token:r,host:i})}catch(e){throw e instanceof T?new F(`Failed to set master locale: ${await e.text()}`):e}return await v({repo:a,token:r,host:i,stepIds:[`createPrismicProject`]}),a}async function Sr(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 lr({domain:e,token:t,host:n})){r=e;break}}return r}var Cr=N({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 pulls models from Prismic.
@@ -100,42 +100,42 @@ import{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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`},lang:{type:`string`,short:`l`,description:`Master locale for a new repository (default: en-us)`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`},"no-setup":{type:`boolean`,description:`Skip framework scaffolding (dependencies and framework files)`}}},async({values:e})=>{let{repo:t,lang:n,"no-browser":i,"no-setup":a}=e;try{throw await c(),new P(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof h))throw e}let o;try{o=await r()}catch(e){e instanceof te&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let u=await k(),d=await A(),f;try{f=await Ct({token:u,host:d})}catch(e){if(e instanceof ye||e instanceof xe){if(Re.PRISMIC_TOKEN)throw new P(`PRISMIC_TOKEN is invalid or expired. Unset it to log in with a browser, or replace it with a valid token.`);console.info(`Not logged in. Starting login...`);let{email:e}=await Fe({onReady:e=>{i?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),zn(e))}});console.info(`Logged in as ${e}`),u=await k(),f=await Ct({token:u,host:d})}else throw e}let g=(t??o?.repositoryName)?.toLowerCase();if(g){if(!f.repositories.some(e=>e.domain===g))throw new P(`Repository "${g}" not found in your account. Check the name or request access to the repository.`);if(!await oe(g,{token:u,host:d}))throw new m}let _=await p();g||(g=await xr({lang:n,token:u,host:d}),console.info(`Created repository: ${g}`));try{let e=d===Pe?void 0:`https://${g}.cdn.${d}/api/v2/`;await ae({repositoryName:g,documentAPIEndpoint:e,libraries:o?.libraries,routes:[]})}catch(e){throw e instanceof l?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(o){try{await s()}catch{}let{dependencies:e,devDependencies:t,peerDependencies:n}=await Ae(),r=Object.keys({...e,...t,...n}).filter(e=>e===`slice-machine-ui`||e.startsWith(`@slicemachine/adapter-`));r.length>0&&await je(r),console.info(`Migrated slicemachine.config.json to prismic.config.json`)}if(await _.initProject({setup:!a}),!a)try{console.info(`Installing dependencies...`),await Oe()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}let[v,y,b,x]=await Promise.all([wn({repo:g,token:u,host:d}),On({repo:g,token:u,host:d}),_.getCustomTypes(),_.getSlices()]),ee=b.map(e=>e.model),ne=B(y,x.map(e=>e.model),{getKey:e=>e.id});for(let e of ne.update)await _.updateSlice(e);for(let e of ne.delete)await _.deleteSlice(e.id);for(let e of ne.insert)await _.createSlice(e);let re=B(v,ee,{getKey:e=>e.id});for(let e of re.update)await _.updateCustomType(e);for(let e of re.delete)await _.deleteCustomType(e.id);for(let e of re.insert)await _.createCustomType(e);await _.generateTypes(),console.info(`\nInitialized Prismic for repository "${g}".`),console.info("Run `prismic type create <name>` to create a content type."),console.info("Run `prismic pull` to pull models from Prismic.")});async function H(e,t){let{repo:n,token:r,host:i}=t,[a,o]=await Promise.all([Ct({token:r,host:i}),ne({repo:n,token:r,host:i})]),s=o.filter(e=>(e.kind===`prod`||e.kind===`stage`)&&e.users.some(e=>e.id===a.shortId)),c=s.find(t=>t.domain===e);if(c)return c.domain;throw new wr(e,s,n)}var wr=class extends Error{name=`InvalidEnvironmentError`;repo;env;availableEnvironments;constructor(e,t,n){super(),this.repo=n,this.env=e,this.availableEnvironments=t}},Tr=M({name:`prismic locale add`,description:`
103
+ `,options:{repo:{type:`string`,short:`r`,description:`Repository name`},lang:{type:`string`,short:`l`,description:`Master locale for a new repository (default: en-us)`},"no-browser":{type:`boolean`,description:`Skip opening the browser automatically during login`},"no-setup":{type:`boolean`,description:`Skip framework scaffolding (dependencies and framework files)`}}},async({values:e})=>{let{repo:t,lang:n,"no-browser":i,"no-setup":a}=e;try{throw await u(),new F(`A prismic.config.json file exists. This project is already initialized.`)}catch(e){if(!(e instanceof ee))throw e}let o;try{o=await r()}catch(e){e instanceof re&&console.warn(`Could not read slicemachine.config.json, ignoring.`)}let s=await k(),c=await A(),f;try{f=await wt({token:s,host:c})}catch(e){if(e instanceof xe||e instanceof Ce){if(j.PRISMIC_TOKEN)throw new F(`PRISMIC_TOKEN is invalid or expired. Unset it to log in with a browser, or replace it with a valid token.`);console.info(`Not logged in. Starting login...`);let{email:e}=await Le({onReady:e=>{i?console.info(`Open this URL to log in: ${e}`):(console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),zn(e))}});console.info(`Logged in as ${e}`),s=await k(),f=await wt({token:s,host:c})}else throw e}let p=(t??o?.repositoryName)?.toLowerCase();if(p){if(!f.repositories.some(e=>e.domain===p))throw new F(`Repository "${p}" not found in your account. Check the name or request access to the repository.`);if(!await ce(p,{token:s,host:c}))throw new g}let m=await h();p||(p=await xr({lang:n,token:s,host:c}),console.info(`Created repository: ${p}`));try{let e=c===Ie?void 0:`https://${p}.cdn.${c}/api/v2/`;await se({repositoryName:p,documentAPIEndpoint:e,libraries:o?.libraries,routes:[]})}catch(e){throw e instanceof d?new F(`Could not find a package.json file. Run this command from a project directory.`):new F(`Failed to create prismic.config.json.`)}if(o){try{await l()}catch{}let{dependencies:e,devDependencies:t,peerDependencies:n}=await Me(),r=Object.keys({...e,...t,...n}).filter(e=>e===`slice-machine-ui`||e.startsWith(`@slicemachine/adapter-`));r.length>0&&await Ne(r),console.info(`Migrated slicemachine.config.json to prismic.config.json`)}if(await m.initProject({setup:!a}),!a)try{console.info(`Installing dependencies...`),await Ae()}catch{console.warn("Could not install dependencies automatically. Please install them manually (i.e. `npm install`).")}let[_,te,v,y]=await Promise.all([wn({repo:p,token:s,host:c}),On({repo:p,token:s,host:c}),m.getCustomTypes(),m.getSlices()]),b=v.map(e=>e.model),x=B(te,y.map(e=>e.model),{getKey:e=>e.id});for(let e of x.update)await m.updateSlice(e);for(let e of x.delete)await m.deleteSlice(e.id);for(let e of x.insert)await m.createSlice(e);let ne=B(_,b,{getKey:e=>e.id});for(let e of ne.update)await m.updateCustomType(e);for(let e of ne.delete)await m.deleteCustomType(e.id);for(let e of ne.insert)await m.createCustomType(e);await m.generateTypes(),console.info(`\nInitialized Prismic for repository "${p}".`),console.info("Run `prismic type create <name>` to create a content type."),console.info("Run `prismic pull` to pull models from Prismic.")});async function H(e,t){let{repo:n,token:r,host:i}=t,[a,o]=await Promise.all([wt({token:r,host:i}),ie({repo:n,token:r,host:i})]),s=o.filter(e=>(e.kind===`prod`||e.kind===`stage`)&&e.users.some(e=>e.id===a.shortId)),c=s.find(t=>t.domain===e);if(c)return c.domain;throw new wr(e,s,n)}var wr=class extends Error{name=`InvalidEnvironmentError`;repo;env;availableEnvironments;constructor(e,t,n){super(),this.repo=n,this.env=e,this.availableEnvironments=t}},Tr=N({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 S(),env:i,master:a=!1,name:o}=t,s=await k(),c=await A(),l=i?await H(i,{repo:r,token:s,host:c}):r;try{await Hn({id:n,isMaster:a,customName:o},{repo:l,token:s,host:c})}catch(e){throw e instanceof w?new P(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),Er=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 S(),env:i,master:a=!1,name:o}=t,s=await k(),c=await A(),l=i?await H(i,{repo:r,token:s,host:c}):r;try{await Hn({id:n,isMaster:a,customName:o},{repo:l,token:s,host:c})}catch(e){throw e instanceof T?new F(`Failed to add locale: ${await e.text()}`):e}console.info(`Locale added: ${n}`)}),Er=N({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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s;try{s=await Vn({repo:o,token:i,host:a})}catch(e){throw e instanceof w?new P(`Failed to list locales: ${await e.text()}`):e}if(r){console.info(O(s));return}if(s.length===0){console.info(`No locales found.`);return}let c=s.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(y(c,{headers:[`ID`,`LABEL`]}))}),Dr=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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s;try{s=await Vn({repo:o,token:i,host:a})}catch(e){throw e instanceof T?new F(`Failed to list locales: ${await e.text()}`):e}if(r){console.info(O(s));return}if(s.length===0){console.info(`No locales found.`);return}let c=s.map(e=>{let t=e.isMaster?` (master)`:``;return[e.id,`${e.label}${t}`]});console.info(y(c,{headers:[`ID`,`LABEL`]}))}),Dr=N({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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r;try{await Un(n,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),Or=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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r;try{await Un(n,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to remove locale: ${await e.text()}`):e}console.info(`Locale removed: ${n}`)}),Or=N({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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Vn({repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to set master locale: ${await e.text()}`):e}let l=c.find(e=>e.id===n);if(!l)throw new P(`Locale "${n}" not found. Available locales: ${c.map(e=>e.id).join(`, `)}`);if(l.isMaster)throw new P(`Locale "${n}" is already the master.`);try{await Hn({id:l.id,isMaster:!0,customName:l.customName??void 0},{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),kr=N({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:Tr,description:`Add a locale`},list:{handler:Er,description:`List locales`},remove:{handler:Dr,description:`Remove a locale`},"set-master":{handler:Or,description:`Set the master locale`}}}),Ar=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 Fe({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}`),zn(e))}});console.info(`Logged in to Prismic as ${n}`)}),jr=M({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await Me())console.info(`Logged out of Prismic`);else throw new P(`Logout failed. You can log out manually by deleting the file.`)}),Mr=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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Vn({repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to set master locale: ${await e.text()}`):e}let l=c.find(e=>e.id===n);if(!l)throw new F(`Locale "${n}" not found. Available locales: ${c.map(e=>e.id).join(`, `)}`);if(l.isMaster)throw new F(`Locale "${n}" is already the master.`);try{await Hn({id:l.id,isMaster:!0,customName:l.customName??void 0},{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to set master locale: ${await e.text()}`):e}console.info(`Master locale set: ${n}`)}),kr=P({name:`prismic locale`,description:`Manage locales in a Prismic repository.`,commands:{add:{handler:Tr,description:`Add a locale`},list:{handler:Er,description:`List locales`},remove:{handler:Dr,description:`Remove a locale`},"set-master":{handler:Or,description:`Set the master locale`}}}),Ar=N({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 Le({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}`),zn(e))}});console.info(`Logged in to Prismic as ${n}`)}),jr=N({name:`prismic logout`,description:`Log out of Prismic.`},async()=>{if(await Pe())console.info(`Logged out of Prismic`);else throw new F(`Logout failed. You can log out manually by deleting the file.`)}),Mr=N({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 S(),env:i,name:a}=t,o;try{o=new URL(n)}catch{throw new P(`Invalid URL: ${n}`)}let s=a||o.hostname,c=`${o.protocol}//${o.host}`,l=o.pathname===`/`?void 0:o.pathname,u=await k(),d=await A(),f=i?await H(i,{repo:r,token:u,host:d}):r;try{await ie({name:s,websiteURL:c,resolverPath:l},{repo:f,token:u,host:d})}catch(e){throw e instanceof w?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.")}),Nr=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 S(),env:i,name:a}=t,o;try{o=new URL(n)}catch{throw new F(`Invalid URL: ${n}`)}let s=a||o.hostname,c=`${o.protocol}//${o.host}`,l=o.pathname===`/`?void 0:o.pathname,u=await k(),d=await A(),f=i?await H(i,{repo:r,token:u,host:d}):r;try{await oe({name:s,websiteURL:c,resolverPath:l},{repo:f,token:u,host:d})}catch(e){throw e instanceof T?new F(`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.")}),Nr=N({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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s,c;try{[s,c]=await Promise.all([g({repo:o,token:i,host:a}),u({repo:o,token:i,host:a})])}catch(e){throw e instanceof w?new P(`Failed to list previews: ${await e.text()}`):e}if(r){console.info(O({previews:s,simulatorUrl:c??null}));return}if(s.length===0&&!c){console.info(`No preview configurations found.`);return}if(s.length>0){let e=s.map(e=>[e.url,e.label]);console.info(y(e,{headers:[`URL`,`NAME`]}))}c&&(s.length>0&&console.info(``),console.info(`Simulator: ${c}`))}),Pr=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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s,c;try{[s,c]=await Promise.all([_({repo:o,token:i,host:a}),f({repo:o,token:i,host:a})])}catch(e){throw e instanceof T?new F(`Failed to list previews: ${await e.text()}`):e}if(r){console.info(O({previews:s,simulatorUrl:c??null}));return}if(s.length===0&&!c){console.info(`No preview configurations found.`);return}if(s.length>0){let e=s.map(e=>[e.url,e.label]);console.info(y(e,{headers:[`URL`,`NAME`]}))}c&&(s.length>0&&console.info(``),console.info(`Simulator: ${c}`))}),Pr=N({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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await g({repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to remove preview: ${await e.text()}`):e}let l=c.find(e=>e.url===n);if(!l)throw new P(`Preview not found: ${n}`);try{await ee(l.id,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),Fr=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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await _({repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to remove preview: ${await e.text()}`):e}let l=c.find(e=>e.url===n);if(!l)throw new F(`Preview not found: ${n}`);try{await ne(l.id,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to remove preview: ${await e.text()}`):e}console.info(`Preview removed: ${n}`)}),Fr=N({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{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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 S(),env:i}=t,a;try{a=new URL(n)}catch{throw new P(`Invalid URL: ${n}`)}a.pathname.endsWith(`/slice-simulator`)||(a.pathname=a.pathname.replace(/\/+$/,``)+`/slice-simulator`);let o=a.toString(),s=await k(),c=await A(),l=i?await H(i,{repo:r,token:s,host:c}):r;try{await re(o,{repo:l,token:s,host:c})}catch(e){throw e instanceof w?new P(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${o}`)}),Ir=N({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:Mr,description:`Add a preview configuration`},list:{handler:Nr,description:`List preview configurations`},remove:{handler:Pr,description:`Remove a preview configuration`},"set-simulator":{handler:Fr,description:`Set the slice simulator URL`}}});async function Lr(e){try{let{stdout:t}=await ke(`git`,[`rev-parse`,`--show-toplevel`],{nodeOptions:{cwd:qe(e)},throwOnError:!0}),n=t.trim();return n?Se(Je(await Ke(n))):void 0}catch{return}}async function Rr(e){try{let{stdout:t}=await ke(`git`,[`status`,`--porcelain`,`--untracked-files=all`],{nodeOptions:{cwd:qe(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 zr=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 S(),env:i}=t,a;try{a=new URL(n)}catch{throw new F(`Invalid URL: ${n}`)}a.pathname.endsWith(`/slice-simulator`)||(a.pathname=a.pathname.replace(/\/+$/,``)+`/slice-simulator`);let o=a.toString(),s=await k(),c=await A(),l=i?await H(i,{repo:r,token:s,host:c}):r;try{await ae(o,{repo:l,token:s,host:c})}catch(e){throw e instanceof T?new F(`Failed to set simulator URL: ${await e.text()}`):e}console.info(`Simulator URL set: ${o}`)}),Ir=P({name:`prismic preview`,description:`Manage preview configurations in a Prismic repository.`,commands:{add:{handler:Mr,description:`Add a preview configuration`},list:{handler:Nr,description:`List preview configurations`},remove:{handler:Pr,description:`Remove a preview configuration`},"set-simulator":{handler:Fr,description:`Set the slice simulator URL`}}});async function Lr(e){try{let{stdout:t}=await je(`git`,[`rev-parse`,`--show-toplevel`],{nodeOptions:{cwd:Je(e)},throwOnError:!0}),n=t.trim();return n?we(Ye(await qe(n))):void 0}catch{return}}async function Rr(e){try{let{stdout:t}=await je(`git`,[`status`,`--porcelain`,`--untracked-files=all`],{nodeOptions:{cwd:Je(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 zr=N({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:n=!1,repo:r=await S(),env:i}=e,a=await k(),o=await A(),s=await p(),c=await t(),l=i?await H(i,{repo:r,token:a,host:o}):r;console.info(`Pulling from repository: ${r}${i?` (env: ${i})`:``}`);let[u,d,f]=await Promise.all([Lr(c),s.getCustomTypeLibraries(),s.getSliceLibraries()]);if(!n&&u){let e=(await Rr(u)).filter(e=>e.pathname.endsWith(`/model.json`)&&f.some(t=>be(t,e))||e.pathname.endsWith(`/index.json`)&&d.some(t=>be(t,e))).map(e=>ve(c,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:n})=>{let{force:r=!1,repo:i=await S(),env:a}=n,o=await k(),s=await A(),c=await h(),l=await t(),u=a?await H(a,{repo:i,token:o,host:s}):i;console.info(`Pulling from repository: ${i}${a?` (env: ${a})`:``}`);let[d,f,p]=await Promise.all([Lr(l),c.getCustomTypeLibraries(),c.getSliceLibraries()]);if(!r&&d){let e=(await Rr(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&p.some(t=>Se(t,e))||e.pathname.endsWith(`/index.json`)&&f.some(t=>Se(t,e))).map(e=>be(l,e));if(e.length>0)throw new F(`
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{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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[m,h,g,_]=await Promise.all([s.getCustomTypes(),s.getSlices(),wn({repo:l,token:a,host:o}),On({repo:l,token:a,host:o})]),y=B(g,m.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))}),b=B(_,h.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))});if(!n&&!u){let e=new Set([...y.update,...y.delete].map(e=>e.id)),t=new Set([...b.update,...b.delete].map(e=>e.id)),n=[...m.filter(t=>e.has(t.model.id)),...h.filter(e=>t.has(e.model.id))].map(e=>ve(c,e.modelPath));if(n.length>0)throw new P(`
163
+ `)}let[m,g,ee,_]=await Promise.all([c.getCustomTypes(),c.getSlices(),wn({repo:u,token:o,host:s}),On({repo:u,token:o,host:s})]),y=B(ee,m.map(e=>e.model),{getKey:e=>e.id,equals:(t,n)=>JSON.stringify(e(t))===JSON.stringify(e(n))}),b=B(_,g.map(e=>e.model),{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(te(e))===JSON.stringify(te(t))});if(!r&&!d){let e=new Set([...y.update,...y.delete].map(e=>e.id)),t=new Set([...b.update,...b.delete].map(e=>e.id)),n=[...m.filter(t=>e.has(t.model.id)),...g.filter(e=>t.has(e.model.id))].map(e=>be(l,e.modelPath));if(n.length>0)throw new F(`
164
164
  Pull would modify or delete local model files:
165
165
  ${n.join(`
166
166
  `)}
@@ -168,12 +168,12 @@ import{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
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 y.insert)await s.createCustomType(e);for(let e of y.update)await s.updateCustomType(e);for(let e of y.delete)await s.deleteCustomType(e.id);for(let e of b.insert)await s.createSlice(e);for(let e of b.update)await s.updateSlice(e);for(let e of b.delete)await s.deleteSlice(e.id);await s.generateTypes(),await v({repo:r,token:a,host:o,stepIds:[`connectPrismic`]});let x=y.insert.length+y.update.length,ee=b.insert.length+b.update.length,te=y.delete.length+b.delete.length;if(x===0&&ee===0&&te===0){console.info(`Already up to date.`);return}console.info(`Inserted ${y.insert.length}, updated ${y.update.length}, deleted ${y.delete.length} types`),console.info(`Inserted ${b.insert.length}, updated ${b.update.length}, deleted ${b.delete.length} slices`)}),Br=M({name:`prismic push`,description:`
171
+ `)}for(let e of y.insert)await c.createCustomType(e);for(let e of y.update)await c.updateCustomType(e);for(let e of y.delete)await c.deleteCustomType(e.id);for(let e of b.insert)await c.createSlice(e);for(let e of b.update)await c.updateSlice(e);for(let e of b.delete)await c.deleteSlice(e.id);await c.generateTypes(),await v({repo:i,token:o,host:s,stepIds:[`connectPrismic`]});let x=y.insert.length+y.update.length,ne=b.insert.length+b.update.length,re=y.delete.length+b.delete.length;if(x===0&&ne===0&&re===0){console.info(`Already up to date.`);return}console.info(`Inserted ${y.insert.length}, updated ${y.update.length}, deleted ${y.delete.length} types`),console.info(`Inserted ${b.insert.length}, updated ${b.update.length}, deleted ${b.delete.length} slices`)}),Br=N({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:n=!1,repo:r=await S(),env:i}=e,o=await k(),s=await A(),c=await p(),l=await t(),u=i?await H(i,{repo:r,token:o,host:s}):r;console.info(`Pushing to repository: ${r}${i?` (env: ${i})`:``}`);let[d,f,m]=await Promise.all([Lr(l),c.getCustomTypeLibraries(),c.getSliceLibraries()]);if(!n&&d){let e=(await Rr(d)).filter(e=>e.pathname.endsWith(`/model.json`)&&m.some(t=>be(t,e))||e.pathname.endsWith(`/index.json`)&&f.some(t=>be(t,e))).map(e=>ve(l,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:n})=>{let{force:r=!1,repo:i=await S(),env:a}=n,o=await k(),s=await A(),l=await h(),u=await t(),d=a?await H(a,{repo:i,token:o,host:s}):i;console.info(`Pushing to repository: ${i}${a?` (env: ${a})`:``}`);let[f,p,m]=await Promise.all([Lr(u),l.getCustomTypeLibraries(),l.getSliceLibraries()]);if(!r&&f){let e=(await Rr(f)).filter(e=>e.pathname.endsWith(`/model.json`)&&m.some(t=>Se(t,e))||e.pathname.endsWith(`/index.json`)&&p.some(t=>Se(t,e))).map(e=>be(u,e));if(e.length>0)throw new F(`
177
177
  Local model files have uncommitted changes. Commit them, then push:
178
178
 
179
179
  git add ${e.join(` `)}
@@ -181,41 +181,41 @@ import{A as e,C as t,D as n,E as r,F as i,M as a,N as o,S as s,T as c,_ as l,a a
181
181
  prismic push
182
182
 
183
183
  Or skip the safety check with \`prismic push --force\`.
184
- `)}let[h,g,_,y]=await Promise.all([c.getCustomTypes(),c.getSlices(),wn({repo:u,token:o,host:s}),On({repo:u,token:o,host:s})]),b=B(h.map(e=>e.model),_,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))}),x=B(g.map(e=>e.model),y,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))});if(!n){let e=Se(f[0]),t=Se(m[0]),n=[...b.delete.map(t=>ve(l,new URL(`${t.id}/index.json`,e))),...x.delete.map(e=>ve(l,new URL(`${a(e.name)}/model.json`,t)))];if(n.length>0)throw new P(`
184
+ `)}let[g,ee,_,y]=await Promise.all([l.getCustomTypes(),l.getSlices(),wn({repo:d,token:o,host:s}),On({repo:d,token:o,host:s})]),b=B(g.map(e=>e.model),_,{getKey:e=>e.id,equals:(t,n)=>JSON.stringify(e(t))===JSON.stringify(e(n))}),x=B(ee.map(e=>e.model),y,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(te(e))===JSON.stringify(te(t))});if(!r){let e=we(p[0]),t=we(m[0]),n=[...b.delete.map(t=>be(u,new URL(`${t.id}/index.json`,e))),...x.delete.map(e=>be(u,new URL(`${c(e.name)}/model.json`,t)))];if(n.length>0)throw new F(`
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 b.insert)await Tn(e,{repo:u,token:o,host:s});for(let e of b.update)await En(e,{repo:u,token:o,host:s});for(let e of b.delete)await Vr(e,{repo:u,token:o,host:s});for(let e of x.insert)await kn(e,{repo:u,token:o,host:s});for(let e of x.update)await An(e,{repo:u,token:o,host:s});for(let e of x.delete.map(e=>e.id))await jn(e,{repo:u,token:o,host:s}),await Pn(e,{repo:u,token:o,host:s}).catch(t=>{let n=t instanceof Error?t.message:String(t);console.warn(`Failed to delete screenshots for slice "${e}": ${n}`)});let ee=[];x.insert.length>0&&ee.push(`createSlice`),b.insert.some(e=>e.format===`page`)&&ee.push(`createPageType`),ee.length>0&&await v({repo:r,token:o,host:s,stepIds:ee});let te=b.insert.length+b.update.length,ne=x.insert.length+x.update.length,re=b.delete.length+x.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).`))});async function Vr(e,t){let{repo:n,token:r,host:i}=t,{id:a,format:o}=e;try{await Dn(a,{repo:n,token:r,host:i})}catch(e){if(!await Hr(e))throw new P(`Could not delete type "${a}": ${e instanceof Error?e.message:String(e)}"
191
- Please try again, or manually deleting the type at: `+vr({repo:n,host:i,format:o??`custom`}));let t;try{t=await x(a,{repo:n,token:r,host:i})}catch{throw new P(`Could not check whether type "${a}" has associated pages.
192
- Please try again, or manually delete any associated pages at: `+_r({repo:n,host:i,customTypeId:a}))}throw new P(`Could not delete type "${a}" because it has${t>0?` ${t}`:``} associated ${t===1?`page`:`pages`}. \nDelete any associated pages manually before pushing at: `+_r({repo:n,host:i,customTypeId:a}))}}async function Hr(e){if(!(e instanceof Ce))return!1;let t=await e.text();return t.includes(`associated documents`)||t.includes(`Delete all documents belonging`)}var Ur=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 k(),r=await A(),i;try{i=await Ct({token:n,host:r})}catch(e){throw e instanceof w?new P(`Failed to list repositories: ${await e.text()}`):e}let a=i.repositories;if(t){console.info(O(a.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(a.length===0){console.info(`No repositories found.`);return}let o=a.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,e.role??``]});console.info(y(o,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});const Wr=[`private`,`public`,`open`];var Gr=M({name:`prismic repo set-api-access`,description:`
190
+ `)}for(let e of b.insert)await Tn(e,{repo:d,token:o,host:s});for(let e of b.update)await En(e,{repo:d,token:o,host:s});for(let e of b.delete)await Vr(e,{repo:d,token:o,host:s});for(let e of x.insert)await kn(e,{repo:d,token:o,host:s});for(let e of x.update)await An(e,{repo:d,token:o,host:s});for(let e of x.delete.map(e=>e.id))await jn(e,{repo:d,token:o,host:s}),await Pn(e,{repo:d,token:o,host:s}).catch(t=>{let n=t instanceof Error?t.message:String(t);console.warn(`Failed to delete screenshots for slice "${e}": ${n}`)});let ne=[];x.insert.length>0&&ne.push(`createSlice`),b.insert.some(e=>e.format===`page`)&&ne.push(`createPageType`),ne.length>0&&await v({repo:i,token:o,host:s,stepIds:ne});let re=b.insert.length+b.update.length,ie=x.insert.length+x.update.length,ae=b.delete.length+x.delete.length;re===0&&ie===0&&ae===0?console.info(`Already up to date.`):(console.info(`Pushed ${re} type(s), ${ie} slice(s).`),ae>0&&console.info(`Deleted ${ae} model(s).`))});async function Vr(e,t){let{repo:n,token:r,host:i}=t,{id:a,format:o}=e;try{await Dn(a,{repo:n,token:r,host:i})}catch(e){if(!await Hr(e))throw new F(`Could not delete type "${a}": ${e instanceof Error?e.message:String(e)}"
191
+ Please try again, or manually deleting the type at: `+vr({repo:n,host:i,format:o??`custom`}));let t;try{t=await x(a,{repo:n,token:r,host:i})}catch{throw new F(`Could not check whether type "${a}" has associated pages.
192
+ Please try again, or manually delete any associated pages at: `+_r({repo:n,host:i,customTypeId:a}))}throw new F(`Could not delete type "${a}" because it has${t>0?` ${t}`:``} associated ${t===1?`page`:`pages`}. \nDelete any associated pages manually before pushing at: `+_r({repo:n,host:i,customTypeId:a}))}}async function Hr(e){if(!(e instanceof Te))return!1;let t=await e.text();return t.includes(`associated documents`)||t.includes(`Delete all documents belonging`)}var Ur=N({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 k(),r=await A(),i;try{i=await wt({token:n,host:r})}catch(e){throw e instanceof T?new F(`Failed to list repositories: ${await e.text()}`):e}let a=i.repositories;if(t){console.info(O(a.map(e=>({domain:e.domain,name:e.name??null,role:e.role??null,url:`https://${e.domain}.${r}/`}))));return}if(a.length===0){console.info(`No repositories found.`);return}let o=a.map(e=>{let t=e.name||`(no name)`;return[e.domain,t,Wr(e.role)]});console.info(y(o,{headers:[`DOMAIN`,`NAME`,`ROLE`]}))});function Wr(e){return typeof e==`string`?e:e?Object.entries(e).map(([e,t])=>`${t} (${e})`).join(`, `):``}const Gr=[`private`,`public`,`open`];var Kr=N({name:`prismic repo set-api-access`,description:`
193
193
  Set the Content API access level of a Prismic repository.
194
194
 
195
195
  By default, this command reads the repository from prismic.config.json at the
196
196
  project root.
197
- `,positionals:{level:{description:`Access level (${Wr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await S()}=t;if(!Wr.includes(n))throw new P(`Invalid access level: ${n}. Must be one of: ${Wr.join(`, `)}`);let i=await k(),a=await A();try{await pr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof w?new P(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),Kr=M({name:`prismic repo set-name`,description:`
197
+ `,positionals:{level:{description:`Access level (${Gr.join(`, `)})`,required:!0}},options:{repo:{type:`string`,short:`r`,description:`Repository domain`}}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await S()}=t;if(!Gr.includes(n))throw new F(`Invalid access level: ${n}. Must be one of: ${Gr.join(`, `)}`);let i=await k(),a=await A();try{await pr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof T?new F(`Failed to set repository access: ${await e.text()}`):e}console.info(`Repository access set to: ${n}`)}),qr=N({name:`prismic repo set-name`,description:`
198
198
  Set the display name of a Prismic repository.
199
199
 
200
200
  By default, this command reads the repository from prismic.config.json at the
201
201
  project root.
202
- `,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 S()}=t,i=await k(),a=await A(),o;try{o=await hr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof w?new P(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),qr=M({name:`prismic repo view`,description:`
202
+ `,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 S()}=t,i=await k(),a=await A(),o;try{o=await hr(n,{repo:r,token:i,host:a})}catch(e){throw e instanceof T?new F(`Failed to set repository name: ${await e.text()}`):e}console.info(`Repository name set to: ${o}`)}),Jr=N({name:`prismic repo view`,description:`
203
203
  View details of a Prismic repository.
204
204
 
205
205
  By default, this command reads the repository from prismic.config.json at the
206
206
  project root.
207
- `,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 S(),web:n,json:r}=e,i=await k(),a=await A(),o=`https://${t}.${a}/`;if(n){zn(new URL(o)),console.info(`Opening ${o}`);return}let s,c;try{[s,c]=await Promise.all([Ct({token:i,host:a}),fr({repo:t,token:i,host:a})])}catch(e){throw e instanceof w?new P(`Failed to fetch repository details: ${await e.text()}`):e}let l=s.repositories.find(e=>e.domain===t);if(!l)throw new P(`Repository not found: ${t}`);if(r){console.info(O({domain:l.domain,name:l.name??null,url:o,apiAccess:c}));return}let u=l.name||`(no name)`;console.info(`Name: ${u}`),console.info(`URL: ${o}`),console.info(`Content API: ${c}`)}),Jr=N({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:br,description:`Create a new repository`},list:{handler:Ur,description:`List repositories`},view:{handler:qr,description:`View repository details`},"set-name":{handler:Kr,description:`Set repository display name`},"set-api-access":{handler:Gr,description:`Set Content API access level`}}}),Yr=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:a=e(r),screenshot:o}=n,s=await p(),{model:c}=await s.getSlice(i);if(c.variations.some(e=>e.id===a))throw new P(`Variation "${a}" already exists in slice "${i}".`);let l=``;if(o){let e=await S(),t=await k(),n=await A(),r=await _e(/^https?:\/\//i.test(o)?new URL(o):Je(o)),i;try{i=await Fn(r,{sliceId:c.id,variationId:a,repo:e,token:t,host:n})}catch(e){throw e instanceof In?new P(e.message):e}l=i.toString()}c.variations=[...c.variations,{id:a,name:r,description:r,docURL:``,imageUrl:l,version:``,primary:{}}],await s.updateSlice(c),await s.generateTypes(),console.info(`Added variation "${r}" (id: "${a}") to slice "${i}"`)}),Xr=M({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,sections:{EXAMPLES:`
207
+ `,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 S(),web:n,json:r}=e,i=await k(),a=await A(),o=`https://${t}.${a}/`;if(n){zn(new URL(o)),console.info(`Opening ${o}`);return}let s,c;try{[s,c]=await Promise.all([wt({token:i,host:a}),fr({repo:t,token:i,host:a})])}catch(e){throw e instanceof T?new F(`Failed to fetch repository details: ${await e.text()}`):e}let l=s.repositories.find(e=>e.domain===t);if(!l)throw new F(`Repository not found: ${t}`);if(r){console.info(O({domain:l.domain,name:l.name??null,url:o,apiAccess:c}));return}let u=l.name||`(no name)`;console.info(`Name: ${u}`),console.info(`URL: ${o}`),console.info(`Content API: ${c}`)}),Yr=P({name:`prismic repo`,description:`Manage Prismic repositories.`,commands:{create:{handler:br,description:`Create a new repository`},list:{handler:Ur,description:`List repositories`},view:{handler:Jr,description:`View repository details`},"set-name":{handler:qr,description:`Set repository display name`},"set-api-access":{handler:Kr,description:`Set Content API access level`}}}),Xr=N({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:e,values:t})=>{let[n]=e,{to:r,id:i=o(n),screenshot:a}=t,s=await h(),{model:c}=await s.getSlice(r);if(c.variations.some(e=>e.id===i))throw new F(`Variation "${i}" already exists in slice "${r}".`);let l=``;if(a){let e=await S(),t=await k(),n=await A(),r=await ye(/^https?:\/\//i.test(a)?new URL(a):Ye(a)),o;try{o=await Fn(r,{sliceId:c.id,variationId:i,repo:e,token:t,host:n})}catch(e){throw e instanceof In?new F(e.message):e}l=o.toString()}c.variations=[...c.variations,{id:i,name:n,description:n,docURL:``,imageUrl:l,version:``,primary:{}}],await s.updateSlice(c),await s.generateTypes(),console.info(`Added variation "${n}" (id: "${i}") to slice "${r}"`)}),Zr=N({name:`prismic slice connect`,description:`Connect a slice to a type's slice zone.`,sections:{EXAMPLES:`
208
208
  Connect a slice to a type's default slice zone:
209
209
  prismic slice connect hero --to blog_post
210
210
 
211
211
  Connect to a named slice zone:
212
212
  prismic slice connect hero --to blog_post --slice-zone page_slices
213
- `},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 p(),{model:o}=await a.getSlice(n),{model:s}=await a.getCustomType(r),c=Object.assign({},...Object.values(s.json))[i];if(!c||c.type!==`Slices`)throw new P(`Slice zone "${i}" not found in "${r}".`);if(c.config??={},c.config.choices??={},o.id in c.config.choices)throw new P(`Slice "${o.id}" is already connected to "${r}" in slice zone "${i}".`);c.config.choices[o.id]={type:`SharedSlice`},await a.updateCustomType(s),await a.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),Zr=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:t})=>{let[n]=e,{id:r=o(n)}=t,i={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},a=await p();await a.createSlice(i),await a.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`),console.info(`Run \`prismic field add <type> --to-slice ${r}\` to add fields.`),console.info(`Run \`prismic slice connect ${r} --to <type>\` to connect the slice to a type.`)}),Qr=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 p(),{model:o}=await a.getSlice(n),{model:s}=await a.getCustomType(r),c=Object.assign({},...Object.values(s.json))[i];if(!c||c.type!==`Slices`)throw new P(`Slice zone "${i}" not found in "${r}".`);if(!c.config?.choices||!(o.id in c.config.choices))throw new P(`Slice "${o.id}" is not connected to "${r}" in slice zone "${i}".`);delete c.config.choices[o.id],await a.updateCustomType(s),await a.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),$r=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 p(),{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})`)}),ei=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,a=await p(),{model:o}=await a.getSlice(r),s=o.variations.find(e=>e.id===n);if(!s)throw new P(`Variation "${n}" not found in slice "${r}".`);if(`name`in t&&(s.name=t.name),i){let e=await S(),t=await k(),n=await A(),r=await _e(/^https?:\/\//i.test(i)?new URL(i):Je(i)),a;try{a=await Fn(r,{sliceId:o.id,variationId:s.id,repo:e,token:t,host:n})}catch(e){throw e instanceof In?new P(e.message):e}s.imageUrl=a.toString()}await a.updateSlice(o),await a.generateTypes(),console.info(`Variation updated: "${n}" in slice "${r}"`)}),ti=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 p()).getSlices();if(t){console.info(O(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(y(r,{headers:[`NAME`,`ID`]}))}),ni=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 p(),{model:r}=await n.getSlice(t);await n.deleteSlice(r.id),await n.generateTypes(),console.info(`Slice removed: ${t}`)}),ri=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 p(),{model:a}=await i.getSlice(r),o=a.variations.find(e=>e.id===n);if(!o)throw new P(`Variation "${n}" not found in slice "${r}".`);a.variations=a.variations.filter(e=>e.id!==o.id),await i.updateSlice(a),await i.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),ii=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 p()).getSlice(n);if(r){console.info(O(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(y(e))}}}),ai=N({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Zr,description:`Create a new slice`},edit:{handler:$r,description:`Edit a slice`},remove:{handler:ni,description:`Remove a slice`},list:{handler:ti,description:`List slices`},view:{handler:ii,description:`View a slice`},connect:{handler:Xr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:Qr,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Yr,description:`Add a variation to a slice`},"edit-variation":{handler:ei,description:`Edit a variation of a slice`},"remove-variation":{handler:ri,description:`Remove a variation from a slice`}}}),oi=M({name:`prismic status`,description:`
213
+ `},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 h(),{model:o}=await a.getSlice(n),{model:s}=await a.getCustomType(r),c=Object.assign({},...Object.values(s.json))[i];if(!c||c.type!==`Slices`)throw new F(`Slice zone "${i}" not found in "${r}".`);if(c.config??={},c.config.choices??={},o.id in c.config.choices)throw new F(`Slice "${o.id}" is already connected to "${r}" in slice zone "${i}".`);c.config.choices[o.id]={type:`SharedSlice`},await a.updateCustomType(s),await a.generateTypes(),console.info(`Connected slice "${n}" to "${r}"`)}),Qr=N({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:t})=>{let[n]=e,{id:r=i(n)}=t,a={id:r,name:n,type:`SharedSlice`,variations:[{id:`default`,name:`Default`,description:`Default`,docURL:``,imageUrl:``,version:``,primary:{}}]},o=await h();await o.createSlice(a),await o.generateTypes(),console.info(`Created slice "${n}" (id: "${r}")`),console.info(`Run \`prismic field add <type> --to-slice ${r}\` to add fields.`),console.info(`Run \`prismic slice connect ${r} --to <type>\` to connect the slice to a type.`)}),$r=N({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 h(),{model:o}=await a.getSlice(n),{model:s}=await a.getCustomType(r),c=Object.assign({},...Object.values(s.json))[i];if(!c||c.type!==`Slices`)throw new F(`Slice zone "${i}" not found in "${r}".`);if(!c.config?.choices||!(o.id in c.config.choices))throw new F(`Slice "${o.id}" is not connected to "${r}" in slice zone "${i}".`);delete c.config.choices[o.id],await a.updateCustomType(s),await a.generateTypes(),console.info(`Disconnected slice "${n}" from "${r}"`)}),ei=N({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 h(),{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})`)}),ti=N({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,a=await h(),{model:o}=await a.getSlice(r),s=o.variations.find(e=>e.id===n);if(!s)throw new F(`Variation "${n}" not found in slice "${r}".`);if(`name`in t&&(s.name=t.name),i){let e=await S(),t=await k(),n=await A(),r=await ye(/^https?:\/\//i.test(i)?new URL(i):Ye(i)),a;try{a=await Fn(r,{sliceId:o.id,variationId:s.id,repo:e,token:t,host:n})}catch(e){throw e instanceof In?new F(e.message):e}s.imageUrl=a.toString()}await a.updateSlice(o),await a.generateTypes(),console.info(`Variation updated: "${n}" in slice "${r}"`)}),ni=N({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 h()).getSlices();if(t){console.info(O(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(y(r,{headers:[`NAME`,`ID`]}))}),ri=N({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 h(),{model:r}=await n.getSlice(t);await n.deleteSlice(r.id),await n.generateTypes(),console.info(`Slice removed: ${t}`)}),ii=N({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 h(),{model:a}=await i.getSlice(r),o=a.variations.find(e=>e.id===n);if(!o)throw new F(`Variation "${n}" not found in slice "${r}".`);a.variations=a.variations.filter(e=>e.id!==o.id),await i.updateSlice(a),await i.generateTypes(),console.info(`Removed variation "${n}" from slice "${r}"`)}),ai=N({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 h()).getSlice(n);if(r){console.info(O(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(y(e))}}}),oi=P({name:`prismic slice`,description:`Manage slices.`,commands:{create:{handler:Qr,description:`Create a new slice`},edit:{handler:ei,description:`Edit a slice`},remove:{handler:ri,description:`Remove a slice`},list:{handler:ni,description:`List slices`},view:{handler:ai,description:`View a slice`},connect:{handler:Zr,description:`Connect a slice to a type's slice zone`},disconnect:{handler:$r,description:`Disconnect a slice from a type's slice zone`},"add-variation":{handler:Xr,description:`Add a variation to a slice`},"edit-variation":{handler:ti,description:`Edit a variation of a slice`},"remove-variation":{handler:ii,description:`Remove a variation from a slice`}}}),si=N({name:`prismic status`,description:`
214
214
  Show local vs remote model differences.
215
215
 
216
216
  Reports what would be pushed to or pulled from Prismic, plus any local
217
217
  model files with uncommitted git changes that would block pull and push.
218
- `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:e})=>{let{repo:n=await S(),env:r}=e,i=await k(),a=await A(),o=await p(),s=await t(),[c,l,u,f,m]=await Promise.all([Lr(s),o.getCustomTypeLibraries(),o.getSliceLibraries(),o.getCustomTypes(),o.getSlices()]),h=n,g,_,v;if(i){r&&(h=await H(r,{repo:n,token:i,host:a}));let[e,t,o]=await Promise.all([Ct({token:i,host:a}),wn({repo:h,token:i,host:a}),On({repo:h,token:i,host:a})]);g=e.email,_=B(f.map(e=>e.model),t,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))}),v=B(m.map(e=>e.model),o,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(F(e))===JSON.stringify(F(t))})}let y=[];c&&(y=(await Rr(c)).filter(e=>e.pathname.endsWith(`/model.json`)&&u.some(t=>be(t,e))||e.pathname.endsWith(`/index.json`)&&l.some(t=>be(t,e))).map(e=>ve(s,e))),console.info(`Repository: ${n}`),r&&console.info(`Environment: ${r}`),g?console.info(`Authenticated as: ${g}`):console.info("Not logged in — log in with `prismic login` to compare with remote.");let b=_!==void 0&&v!==void 0&&_.insert.length===0&&_.update.length===0&&_.delete.length===0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0;if(b&&y.length===0){console.info(``),console.info(`Already up to date.`);return}if(_&&v){let e=[],t=[..._.insert.map(e=>` ${e.id} (custom type)`),...v.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[..._.delete.map(e=>` ${e.id} (custom type)`),...v.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[..._.update.map(e=>` ${e.id} (custom type)`),...v.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(y.length>0&&(console.info(``),console.info(d`
218
+ `,options:{repo:{type:`string`,short:`r`,description:`Repository domain`},env:{type:`string`,short:`e`,description:`Environment domain`}}},async({values:n})=>{let{repo:r=await S(),env:i}=n,a=await k(),o=await A(),s=await h(),c=await t(),[l,u,d,f,m]=await Promise.all([Lr(c),s.getCustomTypeLibraries(),s.getSliceLibraries(),s.getCustomTypes(),s.getSlices()]),g=r,ee,_,v;if(a){i&&(g=await H(i,{repo:r,token:a,host:o}));let[t,n,s]=await Promise.all([wt({token:a,host:o}),wn({repo:g,token:a,host:o}),On({repo:g,token:a,host:o})]);ee=t.email,_=B(f.map(e=>e.model),n,{getKey:e=>e.id,equals:(t,n)=>JSON.stringify(e(t))===JSON.stringify(e(n))}),v=B(m.map(e=>e.model),s,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(te(e))===JSON.stringify(te(t))})}let y=[];l&&(y=(await Rr(l)).filter(e=>e.pathname.endsWith(`/model.json`)&&d.some(t=>Se(t,e))||e.pathname.endsWith(`/index.json`)&&u.some(t=>Se(t,e))).map(e=>be(c,e))),console.info(`Repository: ${r}`),i&&console.info(`Environment: ${i}`),ee?console.info(`Authenticated as: ${ee}`):console.info("Not logged in — log in with `prismic login` to compare with remote.");let b=_!==void 0&&v!==void 0&&_.insert.length===0&&_.update.length===0&&_.delete.length===0&&v.insert.length===0&&v.update.length===0&&v.delete.length===0;if(b&&y.length===0){console.info(``),console.info(`Already up to date.`);return}if(_&&v){let e=[],t=[..._.insert.map(e=>` ${e.id} (custom type)`),...v.insert.map(e=>` ${e.id} (slice)`)];t.length>0&&e.push([`Local-only:`,...t]);let n=[..._.delete.map(e=>` ${e.id} (custom type)`),...v.delete.map(e=>` ${e.id} (slice)`)];n.length>0&&e.push([`Remote-only:`,...n]);let r=[..._.update.map(e=>` ${e.id} (custom type)`),...v.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(y.length>0&&(console.info(``),console.info(p`
219
219
  Pull and push won't run while these model files have uncommitted git changes:
220
220
  ${y.join(`
221
221
  `)}
@@ -225,27 +225,27 @@ Please try again, or manually delete any associated pages at: `+_r({repo:n,host:
225
225
  git commit -m "Update Prismic models"
226
226
 
227
227
  Or override with \`prismic push --force\` (keep local) or \`prismic pull --force\` (discard local).
228
- `)),_&&v&&!b){let e=_.insert.length+v.insert.length,t=_.update.length+v.update.length,n=_.delete.length+v.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}`)}});let si,ci;async function li(e){if(Re.TEST)return;let{host:t}=e;if(!await mi())return;let n=t===Pe?`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`:`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`;ci=await yr(),await Ve({writeKey:n})}function ui(e){si=e}function di(e){ze({userId:e.shortId,intercomHash:e.intercomHash})}function fi(e,t={}){let{watch:n}=t;Be(`Prismic CLI Start`,{properties:{commandType:e,fullCommand:process.argv.join(` `),repository:si,watch:n,agent:ci},groupId:si?{Repository:si}:void 0})}function U(e,t={}){let{watch:n,success:r=!process.exitCode,error:i}=t,a=i?i instanceof Error?i.message:String(i):void 0;Be(`Prismic CLI End`,{properties:{commandType:e,fullCommand:process.argv.join(` `),success:r,repository:si,watch:n,error:a?.slice(0,512),agent:ci},groupId:si?{Repository:si}:void 0})}const pi=C({telemetry:De()});async function mi(){try{return!((await we(new URL(`.prismicrc`,Se(Je(at()))),{schema:pi}).catch(()=>({telemetry:!0}))).telemetry===!1||(await we(new URL(`.prismicrc`,Se(Je(process.cwd()))),{schema:pi}).catch(()=>({telemetry:!0}))).telemetry===!1)}catch{return!0}}const hi=Re.TEST?500:5e3;var gi=M({name:`prismic sync`,description:`
228
+ `)),_&&v&&!b){let e=_.insert.length+v.insert.length,t=_.update.length+v.update.length,n=_.delete.length+v.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}`)}});let ci,li;async function ui(e){if(j.TEST)return;let{host:t}=e;if(!await hi())return;let n=t===Ie?`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`:`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`;li=await yr(),await He({writeKey:n})}function di(e){ci=e}function fi(e){Be({userId:e.shortId,intercomHash:e.intercomHash})}function pi(e,t={}){let{watch:n}=t;Ve(`Prismic CLI Start`,{properties:{commandType:e,fullCommand:process.argv.join(` `),repository:ci,watch:n,agent:li},groupId:ci?{Repository:ci}:void 0})}function U(e,t={}){let{watch:n,success:r=!process.exitCode,error:i}=t,a=i?i instanceof Error?i.message:String(i):void 0;Ve(`Prismic CLI End`,{properties:{commandType:e,fullCommand:process.argv.join(` `),success:r,repository:ci,watch:n,error:a?.slice(0,512),agent:li},groupId:ci?{Repository:ci}:void 0})}const mi=w({telemetry:ke()});async function hi(){try{return!((await Ee(new URL(`.prismicrc`,we(Ye(ot()))),{schema:mi}).catch(()=>({telemetry:!0}))).telemetry===!1||(await Ee(new URL(`.prismicrc`,we(Ye(process.cwd()))),{schema:mi}).catch(()=>({telemetry:!0}))).telemetry===!1)}catch{return!0}}const gi=j.TEST?500:5e3;var _i=N({name:`prismic sync`,description:`
229
229
  Watch Prismic and continuously pull changes to local files.
230
230
 
231
231
  For one-time pulls, use \`prismic pull\`.
232
- `,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 S(),env:n}=e,r=await k(),i=await A(),a=await p(),o=n?await H(n,{repo:t,token:r,host:i}):t;fi(`sync`,{watch:!0}),process.on(`SIGINT`,()=>{console.info(`
233
- Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`Watching repository: ${t}${n?` (env: ${n})`:``} (polling every ${hi/1e3}s, Ctrl+C to stop)`);let s=``,c=0;for(;;){try{let[e,n]=await Promise.all([wn({repo:o,token:r,host:i}),On({repo:o,token:r,host:i})]),l=_i({remoteCustomTypes:e,remoteSlices:n});if(l!==s){let o=s===``,[c,u]=await Promise.all([a.getCustomTypes(),a.getSlices()]),d=c.map(e=>e.model),f=u.map(e=>e.model),p=[],m=B(n,f,{getKey:e=>e.id});if(m.insert.length+m.update.length+m.delete.length>0){for(let e of m.update)await a.updateSlice(e);for(let e of m.delete)await a.deleteSlice(e.id);for(let e of m.insert)await a.createSlice(e);p.push(`slices`)}let h=B(e,d,{getKey:e=>e.id});if(h.insert.length+h.update.length+h.delete.length>0){for(let e of h.update)await a.updateCustomType(e);for(let e of h.delete)await a.deleteCustomType(e.id);for(let e of h.insert)await a.createCustomType(e);p.push(`custom types`)}if(await a.generateTypes(),s=l,o)await v({repo:t,token:r,host:i,stepIds:[`connectPrismic`]}),console.info(`Initial sync complete.`);else{let e=new Date().toLocaleTimeString();console.info(`[${e}] Changes detected in ${p.join(` and `)}`)}}c=0}catch(e){c++;let t=e instanceof Error?e.message:`Unknown error`;if(console.error(`Error checking for changes: ${t}`),c>=5)throw Error(`Too many consecutive errors (5), stopping watch.`)}await ot(hi)}});function _i(e){return Ye(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const vi=`Prismic CLI`;var yi=M({name:`prismic token create`,description:`
232
+ `,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 S(),env:n}=e,r=await k(),i=await A(),a=await h(),o=n?await H(n,{repo:t,token:r,host:i}):t;pi(`sync`,{watch:!0}),process.on(`SIGINT`,()=>{console.info(`
233
+ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`Watching repository: ${t}${n?` (env: ${n})`:``} (polling every ${gi/1e3}s, Ctrl+C to stop)`);let s=``,c=0;for(;;){try{let[e,n]=await Promise.all([wn({repo:o,token:r,host:i}),On({repo:o,token:r,host:i})]),l=vi({remoteCustomTypes:e,remoteSlices:n});if(l!==s){let o=s===``,[c,u]=await Promise.all([a.getCustomTypes(),a.getSlices()]),d=c.map(e=>e.model),f=u.map(e=>e.model),p=[],m=B(n,f,{getKey:e=>e.id});if(m.insert.length+m.update.length+m.delete.length>0){for(let e of m.update)await a.updateSlice(e);for(let e of m.delete)await a.deleteSlice(e.id);for(let e of m.insert)await a.createSlice(e);p.push(`slices`)}let h=B(e,d,{getKey:e=>e.id});if(h.insert.length+h.update.length+h.delete.length>0){for(let e of h.update)await a.updateCustomType(e);for(let e of h.delete)await a.deleteCustomType(e.id);for(let e of h.insert)await a.createCustomType(e);p.push(`custom types`)}if(await a.generateTypes(),s=l,o)await v({repo:t,token:r,host:i,stepIds:[`connectPrismic`]}),console.info(`Initial sync complete.`);else{let e=new Date().toLocaleTimeString();console.info(`[${e}] Changes detected in ${p.join(` and `)}`)}}c=0}catch(e){c++;let t=e instanceof Error?e.message:`Unknown error`;if(console.error(`Error checking for changes: ${t}`),c>=5)throw Error(`Too many consecutive errors (5), stopping watch.`)}await st(gi)}});function vi(e){return Xe(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const yi=`Prismic CLI`;var bi=N({name:`prismic token create`,description:`
234
234
  Create a new API token for a Prismic repository.
235
235
 
236
236
  By default, this command reads the repository from prismic.config.json at the
237
237
  project root.
238
- `,options:{write:{type:`boolean`,description:`Create a write token`},"allow-releases":{type:`boolean`,description:`Allow access to releases (read tokens only)`},name:{type:`string`,short:`n`,description:`Name to identify the token (default: "${vi}")`},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 S(),env:n,write:r,"allow-releases":i,name:a=vi,json:o}=e;if(r&&i)throw new P(`--allow-releases is only valid for access tokens (not with --write)`);let s=await k(),c=await A(),l=n?await H(n,{repo:t,token:s,host:c}):t,u,d;try{if(r)u=(await sr(a,{repo:l,token:s,host:c})).token;else{d=i?`master+releases`:`master`;let e=(await nr({repo:l,token:s,host:c})).find(e=>e.name===a);e||=await rr(a,{repo:l,token:s,host:c}),u=(await ir(e.id,d,{repo:l,token:s,host:c})).token}}catch(e){throw e instanceof w?new P(`Failed to create token: ${await e.text()}`):e}if(o){console.info(O({token:u,type:r?`write`:`access`,name:a,repository:l,...d?{scope:d}:{}}));return}console.info(`Token created: ${u}`)}),bi=M({name:`prismic token delete`,description:`
238
+ `,options:{write:{type:`boolean`,description:`Create a write token`},"allow-releases":{type:`boolean`,description:`Allow access to releases (read tokens only)`},name:{type:`string`,short:`n`,description:`Name to identify the token (default: "${yi}")`},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 S(),env:n,write:r,"allow-releases":i,name:a=yi,json:o}=e;if(r&&i)throw new F(`--allow-releases is only valid for access tokens (not with --write)`);let s=await k(),c=await A(),l=n?await H(n,{repo:t,token:s,host:c}):t,u,d;try{if(r)u=(await sr(a,{repo:l,token:s,host:c})).token;else{d=i?`master+releases`:`master`;let e=(await nr({repo:l,token:s,host:c})).find(e=>e.name===a);e||=await rr(a,{repo:l,token:s,host:c}),u=(await ir(e.id,d,{repo:l,token:s,host:c})).token}}catch(e){throw e instanceof T?new F(`Failed to create token: ${await e.text()}`):e}if(o){console.info(O({token:u,type:r?`write`:`access`,name:a,repository:l,...d?{scope:d}:{}}));return}console.info(`Token created: ${u}`)}),xi=N({name:`prismic token delete`,description:`
239
239
  Delete a token from a Prismic repository.
240
240
 
241
241
  By default, this command reads the repository from prismic.config.json at the
242
242
  project root.
243
- `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c,l;try{[c,l]=await Promise.all([nr({repo:s,token:a,host:o}),or({repo:s,token:a,host:o})])}catch(e){throw e instanceof w?new P(`Failed to delete token: ${await e.text()}`):e}let u=c.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(u){try{await ar(u.id,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let d=l.tokens.find(e=>e.token===n);if(d){try{await cr(d.token,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new P(`Token not found: ${n}`)}),xi=N({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:M({name:`prismic token list`,description:`
243
+ `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c,l;try{[c,l]=await Promise.all([nr({repo:s,token:a,host:o}),or({repo:s,token:a,host:o})])}catch(e){throw e instanceof T?new F(`Failed to delete token: ${await e.text()}`):e}let u=c.flatMap(e=>e.wroom_auths).find(e=>e.token===n);if(u){try{await ar(u.id,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}let d=l.tokens.find(e=>e.token===n);if(d){try{await cr(d.token,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to delete token: ${await e.text()}`):e}console.info(`Token deleted`);return}throw new F(`Token not found: ${n}`)}),Si=P({name:`prismic token`,description:`Manage API tokens for a Prismic repository.`,commands:{list:{handler:N({name:`prismic token list`,description:`
244
244
  List all API tokens for a Prismic repository.
245
245
 
246
246
  By default, this command reads the repository from prismic.config.json at the
247
247
  project root.
248
- `,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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s,c;try{[s,c]=await Promise.all([nr({repo:o,token:i,host:a}),or({repo:o,token:i,host:a})])}catch(e){throw e instanceof w?new P(`Failed to list tokens: ${await e.text()}`):e}let l=s.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]}))),u=c.tokens;if(r){console.info(O({accessTokens:l,writeTokens:u}));return}if(l.length>0){console.info(`ACCESS TOKENS`);let e=l.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(y(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),u.length>0){console.info(`WRITE TOKENS`);let e=u.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(y(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:yi,description:`Create a new token`},delete:{handler:bi,description:`Delete a token`}}}),Si=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 p(),{model:o}=await a.getCustomType(r);if(n in o.json)throw new P(`Tab "${n}" already exists in "${r}".`);o.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{},await a.updateCustomType(o),await a.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),Ci=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:`
248
+ `,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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s,c;try{[s,c]=await Promise.all([nr({repo:o,token:i,host:a}),or({repo:o,token:i,host:a})])}catch(e){throw e instanceof T?new F(`Failed to list tokens: ${await e.text()}`):e}let l=s.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]}))),u=c.tokens;if(r){console.info(O({accessTokens:l,writeTokens:u}));return}if(l.length>0){console.info(`ACCESS TOKENS`);let e=l.map(e=>[` ${e.name}`,e.scope,e.token,e.createdAt]);console.info(y(e))}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),u.length>0){console.info(`WRITE TOKENS`);let e=u.map(e=>{let t=new Date(e.timestamp*1e3).toISOString().split(`T`)[0];return[` ${e.app_name}`,e.token,t]});console.info(y(e))}else console.info(`WRITE TOKENS (none)`)}),description:`List all tokens`},create:{handler:bi,description:`Create a new token`},delete:{handler:xi,description:`Delete a token`}}}),Ci=N({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 h(),{model:o}=await a.getCustomType(r);if(n in o.json)throw new F(`Tab "${n}" already exists in "${r}".`);o.json[n]=i?{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}}:{},await a.updateCustomType(o),await a.generateTypes(),console.info(`Added tab "${n}" to "${r}"`)}),wi=N({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:`
249
249
  custom A non-page type (e.g. settings, navigation, author, blog
250
250
  category). This is the default.
251
251
  page A page type with a URL (e.g. homepage, blog post, landing
@@ -260,7 +260,7 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
260
260
 
261
261
  Create with a custom ID:
262
262
  prismic type create "Landing Page" --format page --id landing
263
- `}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:i=!1,id:a=o(n)}=t;if(r!==`custom`&&r!==`page`)throw new P(`Invalid format: "${r}". Use "custom" or "page".`);let s=r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}};i||(s.Main={uid:{type:`UID`,config:{label:`UID`}},...s.Main});let c={id:a,label:n,repeatable:!i,status:!0,format:r,json:s},l=await p();await l.createCustomType(c),await l.generateTypes(),console.info(`Created type "${n}" (id: "${a}", format: "${r}")`),console.info(`Run \`prismic field add <type> --to-type ${a}\` to add fields.`),console.info(`Run \`prismic type view ${a}\` to view the type.`)}),wi=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 p(),{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})`)}),Ti=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 p(),{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}"`)}),Ei=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 p()).getCustomTypes();if(t){console.info(O(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(y(r,{headers:[`NAME`,`ID`,`FORMAT`]}))}),Di=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 p(),{model:r}=await n.getCustomType(t);await n.deleteCustomType(r.id),await n.generateTypes(),console.info(`Type removed: ${t}`)}),Oi=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 p(),{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}"`)}),ki=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 p()).getCustomType(n);if(r){console.info(O(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(y(e))}}}),Ai=N({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:Ci,description:`Create a new content type`},edit:{handler:wi,description:`Edit a content type`},remove:{handler:Di,description:`Remove a content type`},list:{handler:Ei,description:`List content types`},view:{handler:ki,description:`View a content type`},"add-tab":{handler:Si,description:`Add a tab to a content type`},"edit-tab":{handler:Ti,description:`Edit a tab of a content type`},"remove-tab":{handler:Oi,description:`Remove a tab from a content type`}}}),ji=M({name:`prismic webhook create`,description:`
263
+ `}},async({positionals:e,values:t})=>{let[n]=e,{format:r=`custom`,single:a=!1,id:o=i(n)}=t;if(r!==`custom`&&r!==`page`)throw new F(`Invalid format: "${r}". Use "custom" or "page".`);let s=r===`page`?{Main:{slices:{type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}}},"SEO & Metadata":{meta_title:{type:`Text`,config:{label:`Meta Title`,placeholder:`A title of the page used for social media and search engines`}},meta_description:{type:`Text`,config:{label:`Meta Description`,placeholder:`A brief summary of the page`}},meta_image:{type:`Image`,config:{label:`Meta Image`,constraint:{width:2400,height:1260},thumbnails:[]}}}}:{Main:{}};a||(s.Main={uid:{type:`UID`,config:{label:`UID`}},...s.Main});let c={id:o,label:n,repeatable:!a,status:!0,format:r,json:s},l=await h();await l.createCustomType(c),await l.generateTypes(),console.info(`Created type "${n}" (id: "${o}", format: "${r}")`),console.info(`Run \`prismic field add <type> --to-type ${o}\` to add fields.`),console.info(`Run \`prismic type view ${o}\` to view the type.`)}),Ti=N({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 F(`Invalid format: "${t.format}". Use "custom" or "page".`);let r=await h(),{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})`)}),Ei=N({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 h(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new F(`Tab "${n}" not found in "${r}".`);if(`with-slice-zone`in t&&`without-slice-zone`in t)throw new F(`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 F(`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 F(`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 F(`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 F(`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}"`)}),Di=N({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 h()).getCustomTypes();if(t){console.info(O(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(y(r,{headers:[`NAME`,`ID`,`FORMAT`]}))}),Oi=N({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 h(),{model:r}=await n.getCustomType(t);await n.deleteCustomType(r.id),await n.generateTypes(),console.info(`Type removed: ${t}`)}),ki=N({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 h(),{model:a}=await i.getCustomType(r);if(!(n in a.json))throw new F(`Tab "${n}" not found in "${r}".`);if(Object.keys(a.json).length<=1)throw new F(`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}"`)}),Ai=N({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 h()).getCustomType(n);if(r){console.info(O(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(y(e))}}}),ji=P({name:`prismic type`,description:`Manage content types.`,commands:{create:{handler:wi,description:`Create a new content type`},edit:{handler:Ti,description:`Edit a content type`},remove:{handler:Oi,description:`Remove a content type`},list:{handler:Di,description:`List content types`},view:{handler:Ai,description:`View a content type`},"add-tab":{handler:Ci,description:`Add a tab to a content type`},"edit-tab":{handler:Ei,description:`Edit a tab of a content type`},"remove-tab":{handler:ki,description:`Remove a tab from a content type`}}}),Mi=N({name:`prismic webhook create`,description:`
264
264
  Create a new webhook in a Prismic repository.
265
265
 
266
266
  By default, this command reads the repository from prismic.config.json at the
@@ -283,27 +283,27 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
283
283
 
284
284
  Create a named webhook with a secret:
285
285
  prismic webhook create https://example.com/webhook --name "Deploy" --secret my-secret
286
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await S(),env:i,name:a,secret:o,trigger:s=[]}=t;for(let e of s)if(!Kn.includes(e))throw new P(`Invalid trigger: ${e}\nValid triggers: ${Kn.join(`, `)}`);let c=await k(),l=await A(),u=i?await H(i,{repo:r,token:c,host:l}):r,d=!(s.length>0);try{await Yn({url:n,name:a??null,secret:o??null,documentsPublished:s.includes(`documentsPublished`)||d,documentsUnpublished:s.includes(`documentsUnpublished`)||d,releasesCreated:s.includes(`releasesCreated`)||d,releasesUpdated:s.includes(`releasesUpdated`)||d,tagsCreated:s.includes(`tagsCreated`)||d,tagsDeleted:s.includes(`tagsDeleted`)||d},{repo:u,token:c,host:l})}catch(e){throw e instanceof w?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:`
286
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await S(),env:i,name:a,secret:o,trigger:s=[]}=t;for(let e of s)if(!Kn.includes(e))throw new F(`Invalid trigger: ${e}\nValid triggers: ${Kn.join(`, `)}`);let c=await k(),l=await A(),u=i?await H(i,{repo:r,token:c,host:l}):r,d=!(s.length>0);try{await Yn({url:n,name:a??null,secret:o??null,documentsPublished:s.includes(`documentsPublished`)||d,documentsUnpublished:s.includes(`documentsUnpublished`)||d,releasesCreated:s.includes(`releasesCreated`)||d,releasesUpdated:s.includes(`releasesUpdated`)||d,tagsCreated:s.includes(`tagsCreated`)||d,tagsDeleted:s.includes(`tagsDeleted`)||d},{repo:u,token:c,host:l})}catch(e){throw e instanceof T?new F(`Failed to create webhook: ${await e.text()}`):e}console.info(`Webhook created: ${n}`),console.info(`Run \`prismic webhook set-triggers ${n}\` to configure triggers.`)}),Ni=N({name:`prismic webhook disable`,description:`
287
287
  Disable a webhook in a Prismic repository.
288
288
 
289
289
  By default, this command reads the repository from prismic.config.json at the
290
290
  project root.
291
- `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to disable webhook: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new P(`Webhook not found: ${n}`);if(!l.config.active){console.info(`Webhook already disabled: ${n}`);return}let u=l.config._id,d=structuredClone(l.config);d.active=!1;try{await Xn(u,d,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),Ni=M({name:`prismic webhook enable`,description:`
291
+ `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to disable webhook: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new F(`Webhook not found: ${n}`);if(!l.config.active){console.info(`Webhook already disabled: ${n}`);return}let u=l.config._id,d=structuredClone(l.config);d.active=!1;try{await Xn(u,d,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to disable webhook: ${await e.text()}`):e}console.info(`Webhook disabled: ${n}`)}),Pi=N({name:`prismic webhook enable`,description:`
292
292
  Enable a webhook in a Prismic repository.
293
293
 
294
294
  By default, this command reads the repository from prismic.config.json at the
295
295
  project root.
296
- `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to enable webhook: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new P(`Webhook not found: ${n}`);if(l.config.active){console.info(`Webhook already enabled: ${n}`);return}let u=l.config._id,d=structuredClone(l.config);d.active=!0;try{await Xn(u,d,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),Pi=M({name:`prismic webhook list`,description:`
296
+ `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to enable webhook: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new F(`Webhook not found: ${n}`);if(l.config.active){console.info(`Webhook already enabled: ${n}`);return}let u=l.config._id,d=structuredClone(l.config);d.active=!0;try{await Xn(u,d,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to enable webhook: ${await e.text()}`):e}console.info(`Webhook enabled: ${n}`)}),Fi=N({name:`prismic webhook list`,description:`
297
297
  List all webhooks in a Prismic repository.
298
298
 
299
299
  By default, this command reads the repository from prismic.config.json at the
300
300
  project root.
301
- `,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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s;try{s=await Jn({repo:o,token:i,host:a})}catch(e){throw e instanceof w?new P(`Failed to list webhooks: ${await e.text()}`):e}if(r){console.info(O(s.map(e=>e.config)));return}if(s.length===0){console.info(`No webhooks configured.`);return}let c=s.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(y(c,{headers:[`URL`,`STATUS`]}))}),Fi=M({name:`prismic webhook remove`,description:`
301
+ `,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 S(),env:n,json:r}=e,i=await k(),a=await A(),o=n?await H(n,{repo:t,token:i,host:a}):t,s;try{s=await Jn({repo:o,token:i,host:a})}catch(e){throw e instanceof T?new F(`Failed to list webhooks: ${await e.text()}`):e}if(r){console.info(O(s.map(e=>e.config)));return}if(s.length===0){console.info(`No webhooks configured.`);return}let c=s.map(e=>{let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;return[`${e.config.url}${n}`,`[${t}]`]});console.info(y(c,{headers:[`URL`,`STATUS`]}))}),Ii=N({name:`prismic webhook remove`,description:`
302
302
  Delete a webhook from a Prismic repository.
303
303
 
304
304
  By default, this command reads the repository from prismic.config.json at the
305
305
  project root.
306
- `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to remove webhook: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new P(`Webhook not found: ${n}`);let u=l.config._id;try{await Zn(u,{repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),Ii=M({name:`prismic webhook set-triggers`,description:`
306
+ `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to remove webhook: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new F(`Webhook not found: ${n}`);let u=l.config._id;try{await Zn(u,{repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to remove webhook: ${await e.text()}`):e}console.info(`Webhook removed: ${n}`)}),Li=N({name:`prismic webhook set-triggers`,description:`
307
307
  Update which events trigger a webhook.
308
308
 
309
309
  By default, this command reads the repository from prismic.config.json at the
@@ -315,29 +315,29 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
315
315
  releasesUpdated When a release is edited or deleted
316
316
  tagsCreated When a tag is created
317
317
  tagsDeleted When a tag is deleted
318
- `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await S(),env:i,trigger:a=[]}=t;for(let e of a)if(!Kn.includes(e))throw new P(`Invalid trigger: ${e}\nValid triggers: ${Kn.join(`, `)}`);let o=await k(),s=await A(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await Jn({repo:c,token:o,host:s})}catch(e){throw e instanceof w?new P(`Failed to update webhook triggers: ${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 Xn(d,{...u.config,documentsPublished:a.includes(`documentsPublished`),documentsUnpublished:a.includes(`documentsUnpublished`),releasesCreated:a.includes(`releasesCreated`),releasesUpdated:a.includes(`releasesUpdated`),tagsCreated:a.includes(`tagsCreated`),tagsDeleted:a.includes(`tagsDeleted`)},{repo:c,token:o,host:s})}catch(e){throw e instanceof w?new P(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${a.join(`, `)}`)}),Li=M({name:`prismic webhook view`,description:`
318
+ `}},async({positionals:e,values:t})=>{let[n]=e,{repo:r=await S(),env:i,trigger:a=[]}=t;for(let e of a)if(!Kn.includes(e))throw new F(`Invalid trigger: ${e}\nValid triggers: ${Kn.join(`, `)}`);let o=await k(),s=await A(),c=i?await H(i,{repo:r,token:o,host:s}):r,l;try{l=await Jn({repo:c,token:o,host:s})}catch(e){throw e instanceof T?new F(`Failed to update webhook triggers: ${await e.text()}`):e}let u=l.find(e=>e.config.url===n);if(!u)throw new F(`Webhook not found: ${n}`);let d=u.config._id;try{await Xn(d,{...u.config,documentsPublished:a.includes(`documentsPublished`),documentsUnpublished:a.includes(`documentsUnpublished`),releasesCreated:a.includes(`releasesCreated`),releasesUpdated:a.includes(`releasesUpdated`),tagsCreated:a.includes(`tagsCreated`),tagsDeleted:a.includes(`tagsDeleted`)},{repo:c,token:o,host:s})}catch(e){throw e instanceof T?new F(`Failed to update webhook triggers: ${await e.text()}`):e}console.info(`Webhook triggers updated: ${a.join(`, `)}`)}),Ri=N({name:`prismic webhook view`,description:`
319
319
  View details of a webhook in a Prismic repository.
320
320
 
321
321
  By default, this command reads the repository from prismic.config.json at the
322
322
  project root.
323
- `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof w?new P(`Failed to fetch webhook details: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new P(`Webhook not found: ${n}`);let{config:u}=l;console.info(`URL: ${u.url}`),console.info(`Name: ${u.name||`(none)`}`),console.info(`Status: ${u.active?`enabled`:`disabled`}`),console.info(`Secret: ${u.secret?`(set)`:`(none)`}`);let d=[];for(let e of Kn)u[e]&&d.push(e);if(console.info(`Triggers: ${d.length>0?d.join(`, `):`(none)`}`),Object.keys(u.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(u.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),Ri=N({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:Pi,description:`List all webhooks`},create:{handler:ji,description:`Create a new webhook`},view:{handler:Li,description:`View webhook details`},remove:{handler:Fi,description:`Delete a webhook`},enable:{handler:Ni,description:`Enable a webhook`},disable:{handler:Mi,description:`Disable a webhook`},"set-triggers":{handler:Ii,description:`Update webhook triggers`}}}),zi=M({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await Ct({token:await k(),host:await A()});console.info(e.email)});const Bi=pe({exp:ue(me())});function Vi(e){try{let[,t]=e.split(`.`);return t?de(Bi,JSON.parse(Buffer.from(t,`base64url`).toString())):void 0}catch{return}}const W=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,G=globalThis,Hi=`10.42.0`;function Ui(){return Wi(G),G}function Wi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Hi,t[Hi]=t[Hi]||{}}function Gi(e,t,n=G){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Hi]=r[Hi]||{};return i[e]||(i[e]=t())}const Ki=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],qi={};function Ji(e){if(!(`console`in G))return e();let t=G.console,n={},r=Object.keys(qi);r.forEach(e=>{let r=qi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Yi(){na().enabled=!0}function Xi(){na().enabled=!1}function Zi(){return na().enabled}function Qi(...e){ta(`log`,...e)}function $i(...e){ta(`warn`,...e)}function ea(...e){ta(`error`,...e)}function ta(e,...t){W&&Zi()&&Ji(()=>{G.console[e](`Sentry Logger [${e}]:`,...t)})}function na(){return W?Gi(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const K={enable:Yi,disable:Xi,isEnabled:Zi,log:Qi,warn:$i,error:ea},ra=/\(error: (.*)\)/,ia=/captureMessage|captureException/;function aa(...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(`
324
- `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=ra.test(n)?n.replace(ra,`$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 sa(i.slice(r))}}function oa(e){return Array.isArray(e)?aa(...e):e}function sa(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(ca(t).function||``)&&t.pop(),t.reverse(),ia.test(ca(t).function||``)&&(t.pop(),ia.test(ca(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||ca(t).filename,function:e.function||`?`}))}function ca(e){return e[e.length-1]||{}}const la=`<anonymous>`;function ua(e){try{return!e||typeof e!=`function`?la:e.name||la}catch{return la}}function da(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function fa(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const pa={},ma={};function ha(e,t){pa[e]=pa[e]||[],pa[e].push(t)}function ga(e,t){if(!ma[e]){ma[e]=!0;try{t()}catch(t){W&&K.error(`Error while instrumenting ${e}`,t)}}}function _a(e,t){let n=e&&pa[e];if(n)for(let r of n)try{r(t)}catch(t){W&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ua(r)}\nError:`,t)}}let va=null;function ya(e){let t=`error`;ha(t,e),ga(t,ba)}function ba(){va=G.onerror,G.onerror=function(e,t,n,r,i){return _a(`error`,{column:r,error:i,line:n,msg:e,url:t}),va?va.apply(this,arguments):!1},G.onerror.__SENTRY_INSTRUMENTED__=!0}let xa=null;function Sa(e){let t=`unhandledrejection`;ha(t,e),ga(t,Ca)}function Ca(){xa=G.onunhandledrejection,G.onunhandledrejection=function(e){return _a(`unhandledrejection`,e),xa?xa.apply(this,arguments):!0},G.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const wa=Object.prototype.toString;function Ta(e){switch(wa.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return La(e,Error)}}function Ea(e,t){return wa.call(e)===`[object ${t}]`}function Da(e){return Ea(e,`ErrorEvent`)}function Oa(e){return Ea(e,`String`)}function ka(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function Aa(e){return e===null||ka(e)||typeof e!=`object`&&typeof e!=`function`}function ja(e){return Ea(e,`Object`)}function Ma(e){return typeof Event<`u`&&La(e,Event)}function Na(e){return typeof Element<`u`&&La(e,Element)}function Pa(e){return Ea(e,`RegExp`)}function Fa(e){return!!(e?.then&&typeof e.then==`function`)}function Ia(e){return ja(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function La(e,t){try{return e instanceof t}catch{return!1}}function Ra(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const za=G;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=Va(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 Va(e,t){let n=e,r=[];if(!n?.tagName)return``;if(za.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&&Oa(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 Ha(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{W&&K.log(`Failed to replace method "${t}" in object`,e)}}function Ua(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{W&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Wa(e,t){try{e.prototype=t.prototype=t.prototype||{},Ua(e,`__sentry_original__`,t)}catch{}}function Ga(e){return e.__sentry_original__}function Ka(e){if(Ta(e))return{message:e.message,name:e.name,stack:e.stack,...Ja(e)};if(Ma(e)){let t={type:e.type,target:qa(e.target),currentTarget:qa(e.currentTarget),...Ja(e)};return typeof CustomEvent<`u`&&La(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function qa(e){try{return Na(e)?Ba(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Ja(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 Ya(e){let t=Object.keys(Ka(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Xa;function Za(e){if(Xa!==void 0)return Xa?Xa(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=G;return t in n&&typeof n[t]==`function`?(Xa=n[t],Xa(e)):(Xa=null,e())}function Qa(){return Za(()=>Math.random())}function $a(){return Za(()=>Date.now())}function eo(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function to(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 no(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Ra(r)?n.push(da(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function ro(e,t,n=!1){return Oa(e)?Pa(t)?t.test(e):Oa(t)?n?e===t:e.includes(t):!1:!1}function io(e,t=[],n=!1){return t.some(t=>ro(e,t,n))}function ao(){let e=G;return e.crypto||e.msCrypto}let oo;function so(){return Qa()*16}function q(e=ao()){try{if(e?.randomUUID)return Za(()=>e.randomUUID()).replace(/-/g,``)}catch{}return oo||=`10000000100040008000100000000000`,oo.replace(/[018]/g,e=>(e^(so()&15)>>e/4).toString(16))}function co(e){return e.exception?.values?.[0]}function lo(e){let{message:t,event_id:n}=e;if(t)return t;let r=co(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function uo(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 fo(e,t){let n=co(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 po=/^(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 mo(e){return parseInt(e||``,10)}function ho(e){let t=e.match(po)||[],n=mo(t[1]),r=mo(t[2]),i=mo(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 go(e){if(_o(e))return!0;try{Ua(e,`__sentry_captured__`,!0)}catch{}return!1}function _o(e){try{return e.__sentry_captured__}catch{}}const vo=1e3;function yo(){return $a()/vo}function bo(){let{performance:e}=G;if(!e?.now||!e.timeOrigin)return yo;let t=e.timeOrigin;return()=>(t+Za(()=>e.now()))/vo}let xo;function So(){return(xo??=bo())()}function Co(e){let t=So(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Eo(n)};return e&&wo(n,e),n}function wo(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||So(),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 To(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),wo(e,n)}function Eo(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 Do(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]=Do(r[e],t[e],n-1));return r}function Oo(){return q()}function ko(){return q().substring(16)}const Ao=`_sentrySpan`;function jo(e,t){t?Ua(e,Ao,t):delete e[Ao]}function Mo(e){return e[Ao]}var No=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:Oo(),sampleRand:Qa()}}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,jo(t,Mo(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&&wo(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():ja(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,jo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Oo(),sampleRand:Qa()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:yo(),...e,message:e.message?eo(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:Mo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Do(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 W&&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 W&&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):(W&&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 Po(){return Gi(`defaultCurrentScope`,()=>new No)}function Fo(){return Gi(`defaultIsolationScope`,()=>new No)}var Io=class{constructor(e,t){let n;n=e||new No;let r;r=t||new No,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 Fa(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 Lo(){let e=Wi(Ui());return e.stack=e.stack||new Io(Po(),Fo())}function Ro(e){return Lo().withScope(e)}function zo(e,t){let n=Lo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Bo(e){return Lo().withScope(()=>e(Lo().getIsolationScope()))}function Vo(){return{withIsolationScope:Bo,withScope:Ro,withSetScope:zo,withSetIsolationScope:(e,t)=>Bo(t),getCurrentScope:()=>Lo().getScope(),getIsolationScope:()=>Lo().getIsolationScope()}}function Ho(e){let t=Wi(Ui());t.acs=e}function Uo(e){let t=Wi(e);return t.acs?t.acs:Vo()}function J(){return Uo(Ui()).getCurrentScope()}function Y(){return Uo(Ui()).getIsolationScope()}function Wo(){return Gi(`globalScope`,()=>new No)}function Go(...e){let t=Uo(Ui());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Ko(...e){let t=Uo(Ui());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 qo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||ko()};return n&&(i.parent_span_id=n),i}const Jo=`sentry.profile_id`,Yo=`sentry.exclusive_time`;function Xo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function Zo(e){let t=e;return{scope:t._sentryScope,isolationScope:Xo(t._sentryIsolationScope)}}const Qo=/^sentry-/;function $o(e){let t=ts(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Qo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function es(e){if(e)return rs(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function ts(e){if(!(!e||!Oa(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=ns(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):ns(e)}function ns(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 rs(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?(W&&K.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const is=/^o(\d+)\./,as=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function os(e){return e===`http`||e===`https`}function ss(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 cs(e){let t=as.exec(e);if(!t){Ji(()=>{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 ls({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function ls(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function us(e){if(!W)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+$/)?os(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 ds(e){return e.match(is)?.[1]}function fs(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=ds(n)),r}function ps(e){let t=typeof e==`string`?cs(e):ls(e);if(!(!t||!us(t)))return t}function ms(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 hs=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function gs(e){if(!e)return;let t=e.match(hs);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 _s(e,t){let n=gs(e),r=$o(t);if(!n?.traceId)return{traceId:Oo(),sampleRand:Qa()};let i=bs(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 vs(e=Oo(),t=ko(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function ys(e=Oo(),t=ko(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function bs(e,t){let n=ms(t?.sample_rand);if(n!==void 0)return n;let r=ms(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Qa()*r:r+Qa()*(1-r):Qa()}function xs(e,t){let n=fs(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 Ss=!1;function Cs(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:ks(e).parent_span_id,a=Zo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||ko():t,trace_id:n}}function ws(e){let{traceId:t,spanId:n}=e.spanContext();return vs(t,n,Ms(e))}function Ts(e){let{traceId:t,spanId:n}=e.spanContext();return ys(t,n,Ms(e))}function Es(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 Ds(e){return typeof e==`number`?Os(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Os(e.getTime()):So()}function Os(e){return e>9999999999?e/1e3:e}function ks(e){if(js(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(As(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:Ds(i),timestamp:Ds(o)||void 0,status:Ns(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Es(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function As(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function js(e){return typeof e.getSpanJSON==`function`}function Ms(e){let{traceFlags:t}=e.spanContext();return t===1}function Ns(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function Ps(e){return e._sentryRootSpan||e}function Fs(){let e=Uo(Ui());return e.getActiveSpan?e.getActiveSpan():Mo(J())}function Is(){Ss||=(Ji(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Ls=!1;function Rs(){if(Ls)return;function e(){let e=Fs(),t=e&&Ps(e);if(t){let e=`internal_error`;W&&K.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Ls=!0,ya(e),Sa(e)}function zs(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 Vs(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(Us(n)){if(ro(e.description,n))return W&&Bs(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?ro(e.description,n.name):!0,r=n.op?e.op&&ro(e.op,n.op):!0;if(t&&r)return W&&Bs(e),!0}return!1}function Hs(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 Us(e){return typeof e==`string`||e instanceof RegExp}const Ws=`production`;function Gs(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:fs(t)};return t.emit(`createDsc`,i),i}function Ks(e,t){let n=t.getPropagationContext();return n.dsc||Gs(n.traceId,e)}function qs(e){let t=X();if(!t)return{};let n=Ps(e),r=ks(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&&$o(l);if(u)return s(u);let d=Gs(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),zs()&&(d.sampled=String(Ms(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Zo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function Js(e,t=100,n=1/0){try{return Xs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ys(e,t=3,n=100*1024){let r=Js(e,t);return ec(r)>n?Ys(e,t-1,n):r}function Xs(e,t,n=1/0,r=1/0,i=tc()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Zs(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 Xs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Ka(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]=Xs(e,t,c-1,r,i),d++}return o(t),u}function Zs(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(Ra(t))return da(t);if(Ia(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${ua(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=Qs(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function Qs(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function $s(e){return~-encodeURI(e).split(/%..|./).length}function ec(e){return $s(JSON.stringify(e))}function tc(){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 nc(e,t=[]){return[e,t]}function rc(e,t){let[n,r]=e;return[n,[...r,t]]}function ic(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 ac(e,t){return ic(e,(e,n)=>t.includes(n))}function oc(e){let t=Wi(G);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function sc(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[oc(r),e]:r.push(typeof e==`string`?oc(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(Js(n))}i(e)}}return typeof r==`string`?r:cc(r)}function cc(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 lc(e){let t=typeof e.data==`string`?oc(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const uc={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 dc(e){return uc[e]}function fc(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function pc(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:ss(r)},...i&&{trace:i}}}function mc(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 hc(e,t,n,r){let i=fc(n);return nc({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:ss(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function gc(e,t,n,r){let i=fc(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;mc(e,n?.sdk);let o=pc(e,i,r,t);return delete e.sdkProcessingMetadata,nc(o,[[{type:a},e]])}const _c=`__SENTRY_SUPPRESS_TRACING__`,vc=(e,t)=>{let n=Uo(Ui());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=X(),o=$o(i);return a&&!xs(a,o?.org_id)?xc(t):Go(e=>{let n=_s(r,i);return e.setPropagationContext(n),jo(e,void 0),t()})};function yc(e,t){let n=Sc();return n.withActiveSpan?n.withActiveSpan(e,t):Go(n=>(jo(n,e||void 0),t(n)))}function bc(e){let t=Sc();return t.suppressTracing?t.suppressTracing(e):Go(t=>{t.setSDKProcessingMetadata({[_c]:!0});let n=e();return t.setSDKProcessingMetadata({[_c]:void 0}),n})}function xc(e){return Go(t=>(t.setPropagationContext({traceId:Oo(),sampleRand:Qa()}),W&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),yc(null,e)))}function Sc(){return Uo(Ui())}function Cc(e){return new Tc(t=>{t(e)})}function wc(e){return new Tc((t,n)=>{n(e)})}var Tc=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(Fa(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 Ec(e,t,n,r=0){try{let i=Dc(t,n,e,r);return Fa(i)?i:Cc(i)}catch(e){return wc(e)}}function Dc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return W&&a===null&&K.log(`Event processor "${i.id||`?`}" dropped event`),Fa(a)?a.then(e=>Dc(e,t,n,r+1)):Dc(a,t,n,r+1)}let Oc,kc,Ac,jc;function Mc(e){let t=G._sentryDebugIds,n=G._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(jc&&r.length===kc&&i.length===Ac)return jc;kc=r.length,Ac=i.length,jc={},Oc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Oc?.[r];if(i&&jc&&t)jc[i[0]]=t,Oc&&(Oc[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&&jc&&Oc){jc[i]=t,Oc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),jc}function Nc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Lc(e,t),r&&Bc(e,r),Vc(e,n),Rc(e,i),zc(e,a)}function Pc(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;Fc(e,`extra`,n),Fc(e,`tags`,r),Fc(e,`attributes`,i),Fc(e,`user`,a),Fc(e,`contexts`,o),e.sdkProcessingMetadata=Do(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 Fc(e,t,n){e[t]=Do(e[t],n,1)}function Ic(e,t){let n=Wo().getScopeData();return e&&Pc(n,e.getScopeData()),t&&Pc(n,t.getScopeData()),n}function Lc(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 Rc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function zc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Bc(e,t){e.contexts={trace:Cs(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:qs(t),...e.sdkProcessingMetadata};let n=ks(Ps(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Vc(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 Hc(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||yo()},l=n.integrations||e.integrations.map(e=>e.name);Uc(c,e),Kc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Wc(c,e.stackParser);let u=Jc(r,n.captureContext);n.mechanism&&fo(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Ic(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Nc(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Cc(c):Ec(m,c,n)).then(e=>(e&&Gc(e),typeof o==`number`&&o>0?qc(e,o,s):e))}function Uc(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=eo(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=eo(e.value,a)})}function Wc(e,t){let n=Mc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Gc(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Kc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function qc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Js(e.data,t,n)}}))},...e.user&&{user:Js(e.user,t,n)},...e.contexts&&{contexts:Js(e.contexts,t,n)},...e.extra&&{extra:Js(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Js(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Js(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Js(e.contexts.flags,3,n)),r}function Jc(e,t){if(!t)return e;let n=e?e.clone():new No;return n.update(t),n}function Yc(e){if(e)return Xc(e)||Qc(e)?{captureContext:e}:e}function Xc(e){return e instanceof No||typeof e==`function`}const Zc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Qc(e){return Object.keys(e).some(e=>Zc.includes(e))}function $c(e,t){return J().captureException(e,Yc(t))}function el(e,t){Y().setContext(e,t)}function tl(e,t){Y().setTag(e,t)}function nl(e){Y().setUser(e)}async function rl(e){let t=X();return t?t.flush(e):(W&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function il(){let e=X();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function al(e){let t=Y(),{user:n}=Ic(t,J()),{userAgent:r}=G.navigator||{},i=Co({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&wo(a,{status:`exited`}),ol(),t.setSession(i),i}function ol(){let e=Y(),t=J().getSession()||e.getSession();t&&To(t),sl(),e.setSession()}function sl(){let e=Y(),t=X(),n=e.getSession();n&&t&&t.captureSession(n)}function cl(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function ll(e){return`${cl(e)}${e.projectId}/envelope/`}function ul(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 dl(e,t,n){return t||`${ll(e)}?${ul(e,n)}`}const fl=[];function pl(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 ml(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 pl(r)}function hl(e,t){let n={};return t.forEach(t=>{t&&_l(e,t,n)}),n}function gl(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function _l(e,t,n){if(n[t.name]){W&&K.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!fl.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),fl.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)}W&&K.log(`Integration installed: ${t.name}`)}function Z(e){return e}function vl(e,t){return t?Go(t,()=>{let n=Fs(),r=n?Cs(n):qo(t);return[n?qs(n):Ks(e,t),r]}):[void 0,void 0]}function yl(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function bl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=ss(r)),nc(i,[yl(e)])}function xl(e,t){let n=t??Sl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=bl(n,r._metadata,r.tunnel,e.getDsn());Cl().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Sl(e){return Cl().get(e)}function Cl(){return Gi(`clientToLogBufferMap`,()=>new WeakMap)}function wl(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+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=ss(r)),nc(i,[wl(e)])}function El(e,t){let n=t??Dl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Tl(n,r._metadata,r.tunnel,e.getDsn());Ol().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Dl(e){return Ol().get(e)}function Ol(){return Gi(`clientToMetricBufferMap`,()=>new WeakMap)}function kl(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const Al=Symbol.for(`SentryBufferFullError`);function jl(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return wc(Al);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Cc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>kl(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Ml(e,t=$a()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function Nl(e,t){return e[t]||e.all||0}function Pl(e,t,n=$a()){return Nl(e,t)>n}function Fl(e,{statusCode:t,headers:n},r=$a()){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+Ml(o,r):t===429&&(i.all=r+60*1e3);return i}function Il(e,t,n=jl(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(ic(i,(t,n)=>{let i=dc(n);Pl(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=nc(i[0],a),s=t=>{if(ac(o,[`client_report`])){W&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}ic(o,(n,r)=>{e.recordDroppedEvent(t,dc(r))})};return n.add(()=>t({body:sc(o)}).then(e=>e.statusCode===413?(W&&K.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(W&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&K.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Fl(r,e),e),e=>{throw s(`network_error`),W&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===Al)return W&&K.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Ll(e,t,n){let r=[{type:`client_report`},{timestamp:n||yo(),discarded_events:e}];return nc(t?{dsn:t}:{},[r])}function Rl(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 zl(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[Jo],exclusive_time:o?.[Yo],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&&{[Jo]:e.profile_id},...e.exclusive_time&&{[Yo]:e.exclusive_time}}}},measurements:e.measurements}}const Vl=`Not capturing exception because it's already been captured.`,Hl=`Discarded session because of missing or non-string release`,Ul=Symbol.for(`SentryInternalError`),Wl=Symbol.for(`SentryDoNotSendEventError`);function Gl(e){return{message:e,[Ul]:!0}}function Kl(e){return{message:e,[Wl]:!0}}function ql(e){return!!e&&typeof e==`object`&&Ul in e}function Jl(e){return!!e&&typeof e==`object`&&Wl in e}function Yl(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=kl(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Xl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=jl(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=ps(e.dsn):W&&K.warn(`No DSN provided, client will not send events.`),this._dsn){let t=dl(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&&Yl(this,`afterCaptureLog`,`flushLogs`,ru,xl),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Yl(this,`afterCaptureMetric`,`flushMetrics`,nu,El)}captureException(e,t,n){let r=q();if(go(e))return W&&K.log(Vl),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=ka(e)?e:String(e),o=Aa(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&&go(t.originalException))return W&&K.log(Vl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Zl(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),wo(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){xl(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];_l(this,e,this._integrations),t||gl(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=gc(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=rc(n,lc(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){W&&K.warn(Hl);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){W&&K.warn(Hl);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=hc(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}`;W&&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 W&&K.error(`Error while sending envelope:`,e),{}}return W&&K.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=hl(this,e),gl(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)&&(wo(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),Hc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:qo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ks(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=Y()){return W&&eu(e)&&K.log(`Captured error event \`${Rl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{W&&(Jl(e)?K.log(e.message):ql(e)?K.warn(e.message):K.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=tu(e),s=eu(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ms(a);if(s&&typeof l==`number`&&Qa()>l)return this.recordDroppedEvent(`sample_rate`,`error`),wc(Kl(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Zl(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Kl("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:Ql($l(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Kl(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Jl(e)||ql(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Gl(`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===Al&&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(){W&&K.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){W&&K.log(`No outcomes to send`);return}if(!this._dsn){W&&K.log(`No dsn provided, will not send outcomes`);return}W&&K.log(`Sending outcomes:`,e);let t=Ll(e,this._options.tunnel&&ss(this._dsn));this.sendEnvelope(t)}};function Zl(e){return e===`replay_event`?`replay`:e||`error`}function Ql(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Fa(e))return e.then(e=>{if(!ja(e)&&e!==null)throw Gl(n);return e},e=>{throw Gl(`${t} rejected with ${e}`)});if(!ja(e)&&e!==null)throw Gl(n);return e}function $l(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(eu(c)&&i)return i(c,r);if(tu(c)){if(o||s){let t=zl(c);if(s?.length&&Vs(t,s))return null;if(o){let e=o(t);e?c=Do(n,Bl(e)):Is()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&Vs(e,s)){Hs(n,e);continue}if(o){let n=o(e);n?t.push(n):(Is(),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 eu(e){return e.type===void 0}function tu(e){return e.type===`transaction`}function nu(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+iu(e.attributes)}function ru(e){let t=0;return e.message&&(t+=e.message.length*2),t+iu(e.attributes)}function iu(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*au(e[0]):Aa(e)?t+=au(e):t+=100}),t}function au(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function ou(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=ss(i)),t&&(a.trace=t),nc(a,[su(e)])}function su(e){return[{type:`check_in`},e]}function cu(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 lu(e,t){return e(t.stack||``,1)}function uu(e){return Ta(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function du(e){return uu(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function fu(e,t){let n={type:t.name||t.constructor.name,value:du(t)},r=lu(e,t);return r.length&&(n.stacktrace={frames:r}),n}function pu(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function mu(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=Ya(e);if(Da(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=hu(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function hu(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function gu(e,t,n,r){if(Ta(n))return[n,void 0];if(t.synthetic=!0,ja(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:Ys(n,t)},a=pu(n);if(a)return[a,i];let o=mu(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 _u(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=gu(e,i,n,r),s={exception:{values:[fu(t,a)]}};return o&&(s.extra=o),uo(s,void 0,void 0),fo(s,i),{...s,event_id:r?.event_id}}function vu(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=lu(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},fo(a,{synthetic:!0}))}if(ka(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 yu=class extends Xl{constructor(e){Rs(),cu(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=_u(this,this._options.stackParser,e,t);return n.level=`error`,Cc(n)}eventFromMessage(e,t=`info`,n){return Cc(vu(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return bu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&bu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:q();if(!this._isEnabled())return W&&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]=vl(this,n);l&&(s.contexts={trace:l});let u=ou(s,c,this.getSdkMetadata(),o,this.getDsn());return W&&K.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){W&&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=jl(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 bu(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 xu=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),Su=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Cu(e,t){let n=String(e).toLowerCase();return xu.has(n)?!1:Su.has(n)?!0:t?.strict?null:!!e}function wu(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 Tu(e){return e.split(/[?#]/,1)[0]}function Eu(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Du(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:Hi})),i.version=Hi)}function Ou(e={}){let t=e.client||X();if(!il()||!t)return{};let n=Uo(Ui());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||Fs(),a=i?ws(i):ku(r),o=es(i?qs(i):Ks(t,r));if(!hs.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?Ts(i):Au(r)),s}function ku(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return vs(t,r,n)}function Au(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ys(t,r,n)}const ju=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Mu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return W&&!r&&K.log(ju,e),r;let i=io(e,t);return n?.set(e,i),W&&!i&&K.log(ju,e),i}function Nu(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Pu(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=Fu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Iu(i),headers:Nu(t),cookies:s,data:o}}function Fu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Iu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Lu(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:yo(),...e},s=i?Ji(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let Ru;const zu=new WeakMap,Bu=Z((()=>({name:`FunctionToString`,setupOnce(){Ru=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Ga(this),n=zu.has(X())&&t!==void 0?t:this;return Ru.apply(n,e)}}catch{}},setup(e){zu.set(e,!0)}}))),Vu=[/^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$/],Hu=Z((e={})=>{let t;return{name:`EventFilters`,setup(n){t=Uu(e,n.getOptions())},processEvent(n,r,i){return t||=Uu(e,i.getOptions()),Wu(n,t)?null:n}}});function Uu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Vu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Wu(e,t){if(e.type){if(e.type===`transaction`&&Ku(e,t.ignoreTransactions))return W&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${lo(e)}`),!0}else{if(Gu(e,t.ignoreErrors))return W&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${lo(e)}`),!0;if(Zu(e))return W&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${lo(e)}`),!0;if(qu(e,t.denyUrls))return W&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${lo(e)}.\nUrl: ${Xu(e)}`),!0;if(!Ju(e,t.allowUrls))return W&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${lo(e)}.\nUrl: ${Xu(e)}`),!0}return!1}function Gu(e,t){return t?.length?Rl(e).some(e=>io(e,t)):!1}function Ku(e,t){if(!t?.length)return!1;let n=e.transaction;return n?io(n,t):!1}function qu(e,t){if(!t?.length)return!1;let n=Xu(e);return n?io(n,t):!1}function Ju(e,t){if(!t?.length)return!0;let n=Xu(e);return n?io(n,t):!0}function Yu(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 Xu(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Yu(t):null}catch{return W&&K.error(`Cannot extract url for event ${lo(e)}`),null}}function Zu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Qu(e,t,n,r,i,a){if(!i.exception?.values||!a||!La(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=$u(e,t,r,a.originalException,n,i.exception.values,o,0))}function $u(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(La(r[i],Error)){td(o,s,r);let a=e(t,r[i]),l=c.length;nd(a,i,l,s),c=$u(e,t,n,r[i],i,[a,...c],a,l)}return ed(r)&&r.errors.forEach((a,l)=>{if(La(a,Error)){td(o,s,r);let u=e(t,a),d=c.length;nd(u,`errors[${l}]`,d,s),c=$u(e,t,n,a,i,[u,...c],u,d)}}),c}function ed(e){return Array.isArray(e.errors)}function td(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...ed(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function nd(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const rd=Z(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){Qu(fu,i.getOptions().stackParser,n,t,e,r)}}}));function id(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 ad=[`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 od(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return ad.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?sd(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&cd(e))||null}function sd(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function cd(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 ld={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},ud=Z(((e={})=>{let t={...ld,...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&&dd(e,a,{ipAddress:o},s),e}}}));function dd(e,t,n,r){if(e.request={...e.request,...fd(t,r)},r.ip){let r=t.headers&&od(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function fd(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||ad.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?id(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function pd(e){let t=`console`;ha(t,e),ga(t,md)}function md(){`console`in G&&Ki.forEach(function(e){e in G.console&&Ha(G.console,e,function(t){return qi[e]=t,function(...t){_a(`console`,{args:t,level:e}),qi[e]?.apply(G.console,t)}})})}function hd(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const gd=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function _d(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=gd.exec(t);return n?n.slice(1):[]}function vd(e){let t=_d(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const yd=Z((e={})=>{let t=new Set(e.levels||Ki);return{name:`Console`,setup(e){pd(({args:n,level:r})=>{X()!==e||!t.has(r)||bd(r,n)})}}});function bd(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:hd(e),message:xd(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${xd(e)}`:`Assertion failed`,n.data.arguments=e}else return;Lu(n,{input:t,level:e})}function xd(e){return`util`in G&&typeof G.util.format==`function`?G.util.format(...e):no(e,` `)}function Sd(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Cd(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 wd(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=fa(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Dd(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Ed(o[3]),colno:Ed(o[4]),in_app:Cd(s||``,c)}}if(i.match(t))return{filename:i}}}function Td(e){return[90,wd(e)]}function Ed(e){return parseInt(e||``,10)||void 0}function Dd(e){try{return decodeURI(e)}catch{return}}var Od=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 kd=class extends yu{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};Du(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${st?`main`:`worker-${ct}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{xl(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 Ad=Z((e={})=>({name:`ChildProcess`,setup(){lt.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&jd(t.process,e)}),lt.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Md(t.worker,e)})}}));function jd(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&&Lu({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Lu({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Md(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Lu({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):$c(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const Nd=Ge(pt),Pd=Ge(ht),Fd=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=Id(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 Ld()),n.app&&(e.app=zd()),n.device&&(e.device=Bd(n.device)),n.culture){let t=Rd();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Jd()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function Id(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 Ld(){let e=j.platform();switch(e){case`darwin`:return Gd();case`linux`:return qd();default:return{name:Vd[e]||e,version:j.release()}}}function Rd(){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 zd(){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 Vd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Hd=[{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`]}],Ud={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 Gd(){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)=>{tt(`/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 Kd(e){return e.split(` `)[0].toLowerCase()}async function qd(){let e={kernel_version:j.release(),name:`Linux`};try{let t=await Pd(`/etc`),n=Hd.find(e=>t.includes(e.name));if(!n)return e;let r=(await Nd(Ze(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(Kd(e))>=0)||i[0],e.version=Ud[Kd(e.name)]?.(r)}catch{}return e}function Jd(){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 Yd=new Od(10),Xd=new Od(20);function Zd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function Qd(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function $d(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function ef(e,t){let n=Yd.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 tf(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=uf(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=uf(r,t)),n++}return a}function nf(e,t,n){return new Promise((r,i)=>{let a=dt(e),o=rt({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){Xd.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]=to(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 rf(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`||Qd(i)||$d(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(Xd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=tf(r,t);if(a.every(t=>ef(e,t)))continue;let o=Zd(Yd,e,{});i.push(nf(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&&af(n.stacktrace.frames,t,Yd);return e}function af(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;sf(r.lineno,r,t,e)}}function of(e){delete e.pre_context,delete e.context_line,delete e.post_context}function sf(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=cf(e,n);i<e;i++){let e=r[i];if(e===void 0){of(t),Q&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){of(t),Q&&K.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=lf(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 cf(e,t){return Math.max(1,e-t)}function lf(e,t){return e+t}function uf(e,t){return[cf(e,t),lf(e,t)]}const df=Z(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return rf(e,t)}}})),ff=ho(process.versions.node),pf=ff.major;ff.minor;let mf;async function hf(){if(mf===void 0)try{mf=!!(await import(`node:inspector`)).url()}catch{mf=!1}return mf}const gf=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function _f(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 vf(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function yf(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||vf(e)&&vf(t)}function bf(...e){K.log(`[LocalVariables]`,...e)}const xf=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||!yf(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&gf in n.originalException&&Array.isArray(n.originalException[gf])){for(let r of e.exception?.values||[])t(r,n.originalException[gf]);n.originalException[gf]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new gt(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=>{bf(`Worker error`,e)}),t.once(`exit`,e=>{bf(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await hf()){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 Sf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Cf(e,t){if(t!==void 0)return Sf(e(t,1))}function wf(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 Tf=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}=wf(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 Ef=Z(((e={},t)=>{let n=new Od(20),r,i=!1;function a(t){let r=Sf(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||!yf(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(pf<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await hf()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Tf.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Cf(e,i.description);if(c==null){s();return}let{add:l,next:u}=wf(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=_f(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]}}})),Df=(e={})=>ff.major<19?Ef(e):xf(e);function Of(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let kf;const Af=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,jf=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Ff()},e},getModules:Ff}));function Mf(){try{return i.cache?Object.keys(i.cache):[]}catch{return[]}}function Nf(){return{...Af,...Lf(),...Of()?Pf():{}}}function Pf(){let e=i.main?.paths||[],t=Mf(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=Xe(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=Ze(t,`package.json`);if(r.add(t),!ft(o))return a();try{let e=JSON.parse(mt(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function Ff(){return kf||=Nf(),kf}function If(){try{let e=Ze(process.cwd(),`package.json`);return JSON.parse(mt(e,`utf8`))}catch{return{}}}function Lf(){let e=If();return{...e.dependencies,...e.devDependencies}}function Rf(e){Ji(()=>{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 zf=Z((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){st&&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=Rf;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`),Rf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,X()===e&&$c(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const Vf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Hf=Z(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Vf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,Kf(e,t))}}}));function Uf(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||ro(t.name,e.name,!0),r=e.message===void 0||ro(t.message,e.message);return n&&r}function Gf(e,t){let n=Uf(t);return e.some(e=>Wf(e,n))}function Kf(e,t){return function(n,r){if(X()!==e||Gf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>yc(a,e):e=>e())(()=>{$c(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),qf(n,t.mode)}}function qf(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`?Ji(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(Ji(()=>{console.warn(n)}),Rf(e))}const Jf=Z(()=>({name:`ProcessSession`,setupOnce(){al(),process.on(`beforeExit`,()=>{Y().getSession()?.status!==`ok`&&ol()})}})),Yf=`Spotlight`,Xf=Z(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Yf,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{}Zf(e,t)}}}));function Zf(e,t){let n=Qf(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=sc(e);bc(()=>{let e=it.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 Qf(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function $f(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:Ue.getSystemErrorMap().has(e.errno)}const ep=Z((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!$f(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 tp(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function np(e=process.argv[1]?vd(process.argv[1]):process.cwd(),t=$e===`\\`){let n=t?tp(e):e;return e=>{if(!e)return;let r=t?tp(e):e,{dir:i,base:a,ext:o}=Qe.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 rp(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(G.SENTRY_RELEASE?.id)return G.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 ip=aa(Td(np())),ap=Symbol(`AgentBaseInternalState`);var op=class extends it.Agent{constructor(e){super(e),this[ap]={}}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(`
325
- `).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 it.Agent)return i.addRequest(e,r);this[ap].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[ap].currentSocket;if(this[ap].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[ap].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[ap]&&(this[ap].defaultPort=e)}get protocol(){return this[ap].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[ap]&&(this[ap].protocol=e)}};function sp(...e){K.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function cp(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(),sp(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),sp(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
323
+ `,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 S(),env:i}=t,a=await k(),o=await A(),s=i?await H(i,{repo:r,token:a,host:o}):r,c;try{c=await Jn({repo:s,token:a,host:o})}catch(e){throw e instanceof T?new F(`Failed to fetch webhook details: ${await e.text()}`):e}let l=c.find(e=>e.config.url===n);if(!l)throw new F(`Webhook not found: ${n}`);let{config:u}=l;console.info(`URL: ${u.url}`),console.info(`Name: ${u.name||`(none)`}`),console.info(`Status: ${u.active?`enabled`:`disabled`}`),console.info(`Secret: ${u.secret?`(set)`:`(none)`}`);let d=[];for(let e of Kn)u[e]&&d.push(e);if(console.info(`Triggers: ${d.length>0?d.join(`, `):`(none)`}`),Object.keys(u.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(u.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}),zi=P({name:`prismic webhook`,description:`Manage webhooks in a Prismic repository.`,commands:{list:{handler:Fi,description:`List all webhooks`},create:{handler:Mi,description:`Create a new webhook`},view:{handler:Ri,description:`View webhook details`},remove:{handler:Ii,description:`Delete a webhook`},enable:{handler:Pi,description:`Enable a webhook`},disable:{handler:Ni,description:`Disable a webhook`},"set-triggers":{handler:Li,description:`Update webhook triggers`}}}),Bi=N({name:`prismic whoami`,description:`Show the currently logged in user.`},async()=>{let e=await wt({token:await k(),host:await A()});console.info(e.email)});const Vi=ge({exp:me(Oe())});function Hi(e){try{let[,t]=e.split(`.`);return t?he(Vi,JSON.parse(Buffer.from(t,`base64url`).toString())):void 0}catch{return}}const W=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,G=globalThis,Ui=`10.42.0`;function Wi(){return Gi(G),G}function Gi(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ui,t[Ui]=t[Ui]||{}}function Ki(e,t,n=G){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Ui]=r[Ui]||{};return i[e]||(i[e]=t())}const qi=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Ji={};function Yi(e){if(!(`console`in G))return e();let t=G.console,n={},r=Object.keys(Ji);r.forEach(e=>{let r=Ji[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Xi(){ra().enabled=!0}function Zi(){ra().enabled=!1}function Qi(){return ra().enabled}function $i(...e){na(`log`,...e)}function ea(...e){na(`warn`,...e)}function ta(...e){na(`error`,...e)}function na(e,...t){W&&Qi()&&Yi(()=>{G.console[e](`Sentry Logger [${e}]:`,...t)})}function ra(){return W?Ki(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const K={enable:Xi,disable:Zi,isEnabled:Qi,log:$i,warn:ea,error:ta},ia=/\(error: (.*)\)/,aa=/captureMessage|captureException/;function oa(...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(`
324
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=ia.test(n)?n.replace(ia,`$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 ca(i.slice(r))}}function sa(e){return Array.isArray(e)?oa(...e):e}function ca(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(la(t).function||``)&&t.pop(),t.reverse(),aa.test(la(t).function||``)&&(t.pop(),aa.test(la(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||la(t).filename,function:e.function||`?`}))}function la(e){return e[e.length-1]||{}}const ua=`<anonymous>`;function da(e){try{return!e||typeof e!=`function`?ua:e.name||ua}catch{return ua}}function fa(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function pa(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const ma={},ha={};function ga(e,t){ma[e]=ma[e]||[],ma[e].push(t)}function _a(e,t){if(!ha[e]){ha[e]=!0;try{t()}catch(t){W&&K.error(`Error while instrumenting ${e}`,t)}}}function va(e,t){let n=e&&ma[e];if(n)for(let r of n)try{r(t)}catch(t){W&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${da(r)}\nError:`,t)}}let ya=null;function ba(e){let t=`error`;ga(t,e),_a(t,xa)}function xa(){ya=G.onerror,G.onerror=function(e,t,n,r,i){return va(`error`,{column:r,error:i,line:n,msg:e,url:t}),ya?ya.apply(this,arguments):!1},G.onerror.__SENTRY_INSTRUMENTED__=!0}let Sa=null;function Ca(e){let t=`unhandledrejection`;ga(t,e),_a(t,wa)}function wa(){Sa=G.onunhandledrejection,G.onunhandledrejection=function(e){return va(`unhandledrejection`,e),Sa?Sa.apply(this,arguments):!0},G.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Ta=Object.prototype.toString;function Ea(e){switch(Ta.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Ra(e,Error)}}function Da(e,t){return Ta.call(e)===`[object ${t}]`}function Oa(e){return Da(e,`ErrorEvent`)}function ka(e){return Da(e,`String`)}function Aa(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function ja(e){return e===null||Aa(e)||typeof e!=`object`&&typeof e!=`function`}function Ma(e){return Da(e,`Object`)}function Na(e){return typeof Event<`u`&&Ra(e,Event)}function Pa(e){return typeof Element<`u`&&Ra(e,Element)}function Fa(e){return Da(e,`RegExp`)}function Ia(e){return!!(e?.then&&typeof e.then==`function`)}function La(e){return Ma(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function Ra(e,t){try{return e instanceof t}catch{return!1}}function za(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const Ba=G;function Va(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=Ha(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 Ha(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&&ka(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 Ua(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ga(i,r);try{e[t]=i}catch{W&&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{W&&K.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ga(e,t){try{e.prototype=t.prototype=t.prototype||{},Wa(e,`__sentry_original__`,t)}catch{}}function Ka(e){return e.__sentry_original__}function qa(e){if(Ea(e))return{message:e.message,name:e.name,stack:e.stack,...Ya(e)};if(Na(e)){let t={type:e.type,target:Ja(e.target),currentTarget:Ja(e.currentTarget),...Ya(e)};return typeof CustomEvent<`u`&&Ra(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Ja(e){try{return Pa(e)?Va(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function Ya(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 Xa(e){let t=Object.keys(qa(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let Za;function Qa(e){if(Za!==void 0)return Za?Za(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=G;return t in n&&typeof n[t]==`function`?(Za=n[t],Za(e)):(Za=null,e())}function $a(){return Qa(()=>Math.random())}function eo(){return Qa(()=>Date.now())}function to(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function no(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 ro(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{za(r)?n.push(fa(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function io(e,t,n=!1){return ka(e)?Fa(t)?t.test(e):ka(t)?n?e===t:e.includes(t):!1:!1}function ao(e,t=[],n=!1){return t.some(t=>io(e,t,n))}function oo(){let e=G;return e.crypto||e.msCrypto}let so;function co(){return $a()*16}function q(e=oo()){try{if(e?.randomUUID)return Qa(()=>e.randomUUID()).replace(/-/g,``)}catch{}return so||=`10000000100040008000100000000000`,so.replace(/[018]/g,e=>(e^(co()&15)>>e/4).toString(16))}function lo(e){return e.exception?.values?.[0]}function uo(e){let{message:t,event_id:n}=e;if(t)return t;let r=lo(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function fo(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 po(e,t){let n=lo(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 mo=/^(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 ho(e){return parseInt(e||``,10)}function go(e){let t=e.match(mo)||[],n=ho(t[1]),r=ho(t[2]),i=ho(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 _o(e){if(vo(e))return!0;try{Wa(e,`__sentry_captured__`,!0)}catch{}return!1}function vo(e){try{return e.__sentry_captured__}catch{}}const yo=1e3;function bo(){return eo()/yo}function xo(){let{performance:e}=G;if(!e?.now||!e.timeOrigin)return bo;let t=e.timeOrigin;return()=>(t+Qa(()=>e.now()))/yo}let So;function Co(){return(So??=xo())()}function wo(e){let t=Co(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Do(n)};return e&&To(n,e),n}function To(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||Co(),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 Eo(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),To(e,n)}function Do(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 ko(){return q()}function Ao(){return q().substring(16)}const jo=`_sentrySpan`;function Mo(e,t){t?Wa(e,jo,t):delete e[jo]}function No(e){return e[jo]}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:ko(),sampleRand:$a()}}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,Mo(t,No(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&&To(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():Ma(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,Mo(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ko(),sampleRand:$a()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:bo(),...e,message:e.message?to(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:No(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 W&&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 W&&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):(W&&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 Fo(){return Ki(`defaultCurrentScope`,()=>new Po)}function Io(){return Ki(`defaultIsolationScope`,()=>new Po)}var Lo=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 Ia(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 Ro(){let e=Gi(Wi());return e.stack=e.stack||new Lo(Fo(),Io())}function zo(e){return Ro().withScope(e)}function Bo(e,t){let n=Ro();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Vo(e){return Ro().withScope(()=>e(Ro().getIsolationScope()))}function Ho(){return{withIsolationScope:Vo,withScope:zo,withSetScope:Bo,withSetIsolationScope:(e,t)=>Vo(t),getCurrentScope:()=>Ro().getScope(),getIsolationScope:()=>Ro().getIsolationScope()}}function Uo(e){let t=Gi(Wi());t.acs=e}function Wo(e){let t=Gi(e);return t.acs?t.acs:Ho()}function J(){return Wo(Wi()).getCurrentScope()}function Y(){return Wo(Wi()).getIsolationScope()}function Go(){return Ki(`globalScope`,()=>new Po)}function Ko(...e){let t=Wo(Wi());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function qo(...e){let t=Wo(Wi());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 Jo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Ao()};return n&&(i.parent_span_id=n),i}const Yo=`sentry.profile_id`,Xo=`sentry.exclusive_time`;function Zo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function Qo(e){let t=e;return{scope:t._sentryScope,isolationScope:Zo(t._sentryIsolationScope)}}const $o=/^sentry-/;function es(e){let t=ns(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match($o)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function ts(e){if(e)return is(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function ns(e){if(!(!e||!ka(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=rs(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):rs(e)}function rs(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 is(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?(W&&K.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const as=/^o(\d+)\./,os=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ss(e){return e===`http`||e===`https`}function cs(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 ls(e){let t=os.exec(e);if(!t){Yi(()=>{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 us({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function us(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function ds(e){if(!W)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+$/)?ss(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 fs(e){return e.match(as)?.[1]}function ps(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=fs(n)),r}function ms(e){let t=typeof e==`string`?ls(e):us(e);if(!(!t||!ds(t)))return t}function hs(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 gs=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function _s(e){if(!e)return;let t=e.match(gs);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 vs(e,t){let n=_s(e),r=es(t);if(!n?.traceId)return{traceId:ko(),sampleRand:$a()};let i=xs(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 ys(e=ko(),t=Ao(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function bs(e=ko(),t=Ao(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function xs(e,t){let n=hs(t?.sample_rand);if(n!==void 0)return n;let r=hs(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?$a()*r:r+$a()*(1-r):$a()}function Ss(e,t){let n=ps(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 Cs=!1;function ws(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:As(e).parent_span_id,a=Qo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Ao():t,trace_id:n}}function Ts(e){let{traceId:t,spanId:n}=e.spanContext();return ys(t,n,Ns(e))}function Es(e){let{traceId:t,spanId:n}=e.spanContext();return bs(t,n,Ns(e))}function Ds(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 Os(e){return typeof e==`number`?ks(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ks(e.getTime()):Co()}function ks(e){return e>9999999999?e/1e3:e}function As(e){if(Ms(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(js(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:Os(i),timestamp:Os(o)||void 0,status:Ps(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Ds(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function js(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Ms(e){return typeof e.getSpanJSON==`function`}function Ns(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 Fs(e){return e._sentryRootSpan||e}function Is(){let e=Wo(Wi());return e.getActiveSpan?e.getActiveSpan():No(J())}function Ls(){Cs||=(Yi(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Rs=!1;function zs(){if(Rs)return;function e(){let e=Is(),t=e&&Fs(e);if(t){let e=`internal_error`;W&&K.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}e.tag=`sentry_tracingErrorCallback`,Rs=!0,ba(e),Ca(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 Vs(e){K.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Hs(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(Ws(n)){if(io(e.description,n))return W&&Vs(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?io(e.description,n.name):!0,r=n.op?e.op&&io(e.op,n.op):!0;if(t&&r)return W&&Vs(e),!0}return!1}function Us(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 Gs=`production`;function Ks(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Gs,release:n.release,public_key:r,trace_id:e,org_id:ps(t)};return t.emit(`createDsc`,i),i}function qs(e,t){let n=t.getPropagationContext();return n.dsc||Ks(n.traceId,e)}function Js(e){let t=X();if(!t)return{};let n=Fs(e),r=As(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&&es(l);if(u)return s(u);let d=Ks(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Bs()&&(d.sampled=String(Ns(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??Qo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function Ys(e,t=100,n=1/0){try{return Zs(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Xs(e,t=3,n=100*1024){let r=Ys(e,t);return tc(r)>n?Xs(e,t-1,n):r}function Zs(e,t,n=1/0,r=1/0,i=nc()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Qs(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 Zs(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=qa(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]=Zs(e,t,c-1,r,i),d++}return o(t),u}function Qs(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(za(t))return fa(t);if(La(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${da(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=$s(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function $s(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function ec(e){return~-encodeURI(e).split(/%..|./).length}function tc(e){return ec(JSON.stringify(e))}function nc(){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 rc(e,t=[]){return[e,t]}function ic(e,t){let[n,r]=e;return[n,[...r,t]]}function ac(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 oc(e,t){return ac(e,(e,n)=>t.includes(n))}function sc(e){let t=Gi(G);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function cc(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[sc(r),e]:r.push(typeof e==`string`?sc(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(Ys(n))}i(e)}}return typeof r==`string`?r:lc(r)}function lc(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 uc(e){let t=typeof e.data==`string`?sc(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const dc={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 fc(e){return dc[e]}function pc(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function mc(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:cs(r)},...i&&{trace:i}}}function hc(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 gc(e,t,n,r){let i=pc(n);return rc({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:cs(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function _c(e,t,n,r){let i=pc(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;hc(e,n?.sdk);let o=mc(e,i,r,t);return delete e.sdkProcessingMetadata,rc(o,[[{type:a},e]])}const vc=`__SENTRY_SUPPRESS_TRACING__`,yc=(e,t)=>{let n=Wo(Wi());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=X(),o=es(i);return a&&!Ss(a,o?.org_id)?Sc(t):Ko(e=>{let n=vs(r,i);return e.setPropagationContext(n),Mo(e,void 0),t()})};function bc(e,t){let n=Cc();return n.withActiveSpan?n.withActiveSpan(e,t):Ko(n=>(Mo(n,e||void 0),t(n)))}function xc(e){let t=Cc();return t.suppressTracing?t.suppressTracing(e):Ko(t=>{t.setSDKProcessingMetadata({[vc]:!0});let n=e();return t.setSDKProcessingMetadata({[vc]:void 0}),n})}function Sc(e){return Ko(t=>(t.setPropagationContext({traceId:ko(),sampleRand:$a()}),W&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),bc(null,e)))}function Cc(){return Wo(Wi())}function wc(e){return new Ec(t=>{t(e)})}function Tc(e){return new Ec((t,n)=>{n(e)})}var Ec=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(Ia(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 Dc(e,t,n,r=0){try{let i=Oc(t,n,e,r);return Ia(i)?i:wc(i)}catch(e){return Tc(e)}}function Oc(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return W&&a===null&&K.log(`Event processor "${i.id||`?`}" dropped event`),Ia(a)?a.then(e=>Oc(e,t,n,r+1)):Oc(a,t,n,r+1)}let kc,Ac,jc,Mc;function Nc(e){let t=G._sentryDebugIds,n=G._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Mc&&r.length===Ac&&i.length===jc)return Mc;Ac=r.length,jc=i.length,Mc={},kc||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=kc?.[r];if(i&&Mc&&t)Mc[i[0]]=t,kc&&(kc[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&&Mc&&kc){Mc[i]=t,kc[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Mc}function Pc(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Rc(e,t),r&&Vc(e,r),Hc(e,n),zc(e,i),Bc(e,a)}function Fc(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;Ic(e,`extra`,n),Ic(e,`tags`,r),Ic(e,`attributes`,i),Ic(e,`user`,a),Ic(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 Ic(e,t,n){e[t]=Oo(e[t],n,1)}function Lc(e,t){let n=Go().getScopeData();return e&&Fc(n,e.getScopeData()),t&&Fc(n,t.getScopeData()),n}function Rc(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 zc(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Bc(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Vc(e,t){e.contexts={trace:ws(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Js(t),...e.sdkProcessingMetadata};let n=As(Fs(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Hc(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 Uc(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||bo()},l=n.integrations||e.integrations.map(e=>e.name);Wc(c,e),qc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Gc(c,e.stackParser);let u=Yc(r,n.captureContext);n.mechanism&&po(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Lc(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?wc(c):Dc(m,c,n)).then(e=>(e&&Kc(e),typeof o==`number`&&o>0?Jc(e,o,s):e))}function Wc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||Gs,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=to(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=to(e.value,a)})}function Gc(e,t){let n=Nc(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Kc(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 qc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Jc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Ys(e.data,t,n)}}))},...e.user&&{user:Ys(e.user,t,n)},...e.contexts&&{contexts:Ys(e.contexts,t,n)},...e.extra&&{extra:Ys(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ys(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Ys(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ys(e.contexts.flags,3,n)),r}function Yc(e,t){if(!t)return e;let n=e?e.clone():new Po;return n.update(t),n}function Xc(e){if(e)return Zc(e)||$c(e)?{captureContext:e}:e}function Zc(e){return e instanceof Po||typeof e==`function`}const Qc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function $c(e){return Object.keys(e).some(e=>Qc.includes(e))}function el(e,t){return J().captureException(e,Xc(t))}function tl(e,t){Y().setContext(e,t)}function nl(e,t){Y().setTag(e,t)}function rl(e){Y().setUser(e)}async function il(e){let t=X();return t?t.flush(e):(W&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function al(){let e=X();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function ol(e){let t=Y(),{user:n}=Lc(t,J()),{userAgent:r}=G.navigator||{},i=wo({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&To(a,{status:`exited`}),sl(),t.setSession(i),i}function sl(){let e=Y(),t=J().getSession()||e.getSession();t&&Eo(t),cl(),e.setSession()}function cl(){let e=Y(),t=X(),n=e.getSession();n&&t&&t.captureSession(n)}function ll(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function ul(e){return`${ll(e)}${e.projectId}/envelope/`}function dl(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 fl(e,t,n){return t||`${ul(e)}?${dl(e,n)}`}const pl=[];function ml(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 hl(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 ml(r)}function gl(e,t){let n={};return t.forEach(t=>{t&&vl(e,t,n)}),n}function _l(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function vl(e,t,n){if(n[t.name]){W&&K.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!pl.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),pl.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)}W&&K.log(`Integration installed: ${t.name}`)}function Z(e){return e}function yl(e,t){return t?Ko(t,()=>{let n=Is(),r=n?ws(n):Jo(t);return[n?Js(n):qs(e,t),r]}):[void 0,void 0]}function bl(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function xl(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=cs(r)),rc(i,[bl(e)])}function Sl(e,t){let n=t??Cl(e)??[];if(n.length===0)return;let r=e.getOptions(),i=xl(n,r._metadata,r.tunnel,e.getDsn());wl().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Cl(e){return wl().get(e)}function wl(){return Ki(`clientToLogBufferMap`,()=>new WeakMap)}function Tl(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+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=cs(r)),rc(i,[Tl(e)])}function Dl(e,t){let n=t??Ol(e)??[];if(n.length===0)return;let r=e.getOptions(),i=El(n,r._metadata,r.tunnel,e.getDsn());kl().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Ol(e){return kl().get(e)}function kl(){return Ki(`clientToMetricBufferMap`,()=>new WeakMap)}function Al(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const jl=Symbol.for(`SentryBufferFullError`);function Ml(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Tc(jl);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return wc(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Al(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Nl(e,t=eo()){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 Fl(e,t,n=eo()){return Pl(e,t)>n}function Il(e,{statusCode:t,headers:n},r=eo()){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+Nl(o,r):t===429&&(i.all=r+60*1e3);return i}function Ll(e,t,n=Ml(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(ac(i,(t,n)=>{let i=fc(n);Fl(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=rc(i[0],a),s=t=>{if(oc(o,[`client_report`])){W&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}ac(o,(n,r)=>{e.recordDroppedEvent(t,fc(r))})};return n.add(()=>t({body:cc(o)}).then(e=>e.statusCode===413?(W&&K.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(W&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&K.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Il(r,e),e),e=>{throw s(`network_error`),W&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===jl)return W&&K.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Rl(e,t,n){let r=[{type:`client_report`},{timestamp:n||bo(),discarded_events:e}];return rc(t?{dsn:t}:{},[r])}function zl(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?.[Yo],exclusive_time:o?.[Xo],measurements:e.measurements,is_segment:!0}}function Vl(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&&{[Yo]:e.profile_id},...e.exclusive_time&&{[Xo]:e.exclusive_time}}}},measurements:e.measurements}}const Hl=`Not capturing exception because it's already been captured.`,Ul=`Discarded session because of missing or non-string release`,Wl=Symbol.for(`SentryInternalError`),Gl=Symbol.for(`SentryDoNotSendEventError`);function Kl(e){return{message:e,[Wl]:!0}}function ql(e){return{message:e,[Gl]:!0}}function Jl(e){return!!e&&typeof e==`object`&&Wl in e}function Yl(e){return!!e&&typeof e==`object`&&Gl in e}function Xl(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=Al(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var Zl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Ml(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=ms(e.dsn):W&&K.warn(`No DSN provided, client will not send events.`),this._dsn){let t=fl(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&&Xl(this,`afterCaptureLog`,`flushLogs`,iu,Sl),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Xl(this,`afterCaptureMetric`,`flushMetrics`,ru,Dl)}captureException(e,t,n){let r=q();if(_o(e))return W&&K.log(Hl),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=Aa(e)?e:String(e),o=ja(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&&_o(t.originalException))return W&&K.log(Hl),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Ql(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),To(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){Sl(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];vl(this,e,this._integrations),t||_l(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=_c(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=ic(n,uc(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Gs}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){W&&K.warn(Ul);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){W&&K.warn(Ul);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=gc(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}`;W&&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 W&&K.error(`Error while sending envelope:`,e),{}}return W&&K.error(`Transport disabled`),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=gl(this,e),_l(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)&&(To(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),Uc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:Jo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:qs(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=Y()){return W&&tu(e)&&K.log(`Captured error event \`${zl(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{W&&(Yl(e)?K.log(e.message):Jl(e)?K.warn(e.message):K.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=nu(e),s=tu(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:hs(a);if(s&&typeof l==`number`&&$a()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Tc(ql(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Ql(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),ql("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:$l(eu(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 ql(`${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 Yl(e)||Jl(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Kl(`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===jl&&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(){W&&K.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){W&&K.log(`No outcomes to send`);return}if(!this._dsn){W&&K.log(`No dsn provided, will not send outcomes`);return}W&&K.log(`Sending outcomes:`,e);let t=Rl(e,this._options.tunnel&&cs(this._dsn));this.sendEnvelope(t)}};function Ql(e){return e===`replay_event`?`replay`:e||`error`}function $l(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Ia(e))return e.then(e=>{if(!Ma(e)&&e!==null)throw Kl(n);return e},e=>{throw Kl(`${t} rejected with ${e}`)});if(!Ma(e)&&e!==null)throw Kl(n);return e}function eu(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(tu(c)&&i)return i(c,r);if(nu(c)){if(o||s){let t=Bl(c);if(s?.length&&Hs(t,s))return null;if(o){let e=o(t);e?c=Oo(n,Vl(e)):Ls()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&Hs(e,s)){Us(n,e);continue}if(o){let n=o(e);n?t.push(n):(Ls(),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 tu(e){return e.type===void 0}function nu(e){return e.type===`transaction`}function ru(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+au(e.attributes)}function iu(e){let t=0;return e.message&&(t+=e.message.length*2),t+au(e.attributes)}function au(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*ou(e[0]):ja(e)?t+=ou(e):t+=100}),t}function ou(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function su(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=cs(i)),t&&(a.trace=t),rc(a,[cu(e)])}function cu(e){return[{type:`check_in`},e]}function lu(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 uu(e,t){return e(t.stack||``,1)}function du(e){return Ea(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function fu(e){return du(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function pu(e,t){let n={type:t.name||t.constructor.name,value:fu(t)},r=uu(e,t);return r.length&&(n.stacktrace={frames:r}),n}function mu(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function hu(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=Xa(e);if(Oa(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=gu(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function gu(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function _u(e,t,n,r){if(Ea(n))return[n,void 0];if(t.synthetic=!0,Ma(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:Xs(n,t)},a=mu(n);if(a)return[a,i];let o=hu(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 vu(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=_u(e,i,n,r),s={exception:{values:[pu(t,a)]}};return o&&(s.extra=o),fo(s,void 0,void 0),po(s,i),{...s,event_id:r?.event_id}}function yu(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=uu(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},po(a,{synthetic:!0}))}if(Aa(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 bu=class extends Zl{constructor(e){zs(),lu(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=vu(this,this._options.stackParser,e,t);return n.level=`error`,wc(n)}eventFromMessage(e,t=`info`,n){return wc(yu(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return xu(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&xu(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:q();if(!this._isEnabled())return W&&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]=yl(this,n);l&&(s.contexts={trace:l});let u=su(s,c,this.getSdkMetadata(),o,this.getDsn());return W&&K.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}dispose(){W&&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=Ml(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function xu(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 Su=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),Cu=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function wu(e,t){let n=String(e).toLowerCase();return Su.has(n)?!1:Cu.has(n)?!0:t?.strict?null:!!e}function Tu(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 Eu(e){return e.split(/[?#]/,1)[0]}function Du(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Ou(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:Ui})),i.version=Ui)}function ku(e={}){let t=e.client||X();if(!al()||!t)return{};let n=Wo(Wi());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||Is(),a=i?Ts(i):Au(r),o=ts(i?Js(i):qs(t,r));if(!gs.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?Es(i):ju(r)),s}function Au(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ys(t,r,n)}function ju(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return bs(t,r,n)}const Mu=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Nu(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return W&&!r&&K.log(Mu,e),r;let i=ao(e,t);return n?.set(e,i),W&&!i&&K.log(Mu,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 Fu(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=Iu({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Lu(i),headers:Pu(t),cookies:s,data:o}}function Iu({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Lu(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Ru(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:bo(),...e},s=i?Yi(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let zu;const Bu=new WeakMap,Vu=Z((()=>({name:`FunctionToString`,setupOnce(){zu=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Ka(this),n=Bu.has(X())&&t!==void 0?t:this;return zu.apply(n,e)}}catch{}},setup(e){Bu.set(e,!0)}}))),Hu=[/^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$/],Uu=Z((e={})=>{let t;return{name:`EventFilters`,setup(n){t=Wu(e,n.getOptions())},processEvent(n,r,i){return t||=Wu(e,i.getOptions()),Gu(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?[]:Hu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Gu(e,t){if(e.type){if(e.type===`transaction`&&qu(e,t.ignoreTransactions))return W&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${uo(e)}`),!0}else{if(Ku(e,t.ignoreErrors))return W&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${uo(e)}`),!0;if(Qu(e))return W&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${uo(e)}`),!0;if(Ju(e,t.denyUrls))return W&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${uo(e)}.\nUrl: ${Zu(e)}`),!0;if(!Yu(e,t.allowUrls))return W&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${uo(e)}.\nUrl: ${Zu(e)}`),!0}return!1}function Ku(e,t){return t?.length?zl(e).some(e=>ao(e,t)):!1}function qu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?ao(n,t):!1}function Ju(e,t){if(!t?.length)return!1;let n=Zu(e);return n?ao(n,t):!1}function Yu(e,t){if(!t?.length)return!0;let n=Zu(e);return n?ao(n,t):!0}function Xu(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 Zu(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Xu(t):null}catch{return W&&K.error(`Cannot extract url for event ${uo(e)}`),null}}function Qu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function $u(e,t,n,r,i,a){if(!i.exception?.values||!a||!Ra(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=ed(e,t,r,a.originalException,n,i.exception.values,o,0))}function ed(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Ra(r[i],Error)){nd(o,s,r);let a=e(t,r[i]),l=c.length;rd(a,i,l,s),c=ed(e,t,n,r[i],i,[a,...c],a,l)}return td(r)&&r.errors.forEach((a,l)=>{if(Ra(a,Error)){nd(o,s,r);let u=e(t,a),d=c.length;rd(u,`errors[${l}]`,d,s),c=ed(e,t,n,a,i,[u,...c],u,d)}}),c}function td(e){return Array.isArray(e.errors)}function nd(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...td(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function rd(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const id=Z(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){$u(pu,i.getOptions().stackParser,n,t,e,r)}}}));function ad(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 od=[`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 sd(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return od.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?cd(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&ld(e))||null}function cd(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function ld(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 ud={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},dd=Z(((e={})=>{let t={...ud,...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&&fd(e,a,{ipAddress:o},s),e}}}));function fd(e,t,n,r){if(e.request={...e.request,...pd(t,r)},r.ip){let r=t.headers&&sd(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function pd(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||od.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?ad(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function md(e){let t=`console`;ga(t,e),_a(t,hd)}function hd(){`console`in G&&qi.forEach(function(e){e in G.console&&Ua(G.console,e,function(t){return Ji[e]=t,function(...t){va(`console`,{args:t,level:e}),Ji[e]?.apply(G.console,t)}})})}function gd(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const _d=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function vd(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=_d.exec(t);return n?n.slice(1):[]}function yd(e){let t=vd(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const bd=Z((e={})=>{let t=new Set(e.levels||qi);return{name:`Console`,setup(e){md(({args:n,level:r})=>{X()!==e||!t.has(r)||xd(r,n)})}}});function xd(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:gd(e),message:Sd(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Sd(e)}`:`Assertion failed`,n.data.arguments=e}else return;Ru(n,{input:t,level:e})}function Sd(e){return`util`in G&&typeof G.util.format==`function`?G.util.format(...e):ro(e,` `)}function Cd(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function wd(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 Td(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=pa(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?Od(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Dd(o[3]),colno:Dd(o[4]),in_app:wd(s||``,c)}}if(i.match(t))return{filename:i}}}function Ed(e){return[90,Td(e)]}function Dd(e){return parseInt(e||``,10)||void 0}function Od(e){try{return decodeURI(e)}catch{return}}var kd=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 Ad=class extends bu{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||M.hostname(),n={...e,platform:`node`,runtime:{name:`node`,version:global.process.version},serverName:t};Ou(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${ct?`main`:`worker-${lt}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Sl(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 jd=Z((e={})=>({name:`ChildProcess`,setup(){ut.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Md(t.process,e)}),ut.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Nd(t.worker,e)})}}));function Md(e,t){let n=!1,r;e.on(`spawn`,()=>{if(e.spawnfile===`/usr/bin/sw_vers`){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on(`exit`,e=>{n||(n=!0,e!==null&&e!==0&&Ru({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Ru({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Nd(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Ru({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):el(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const Pd=Ke(mt),Fd=Ke(gt),Id=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=Ld(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 Rd()),n.app&&(e.app=Bd()),n.device&&(e.device=Vd(n.device)),n.culture){let t=zd();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=Yd()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function Ld(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=M.freemem()),e}async function Rd(){let e=M.platform();switch(e){case`darwin`:return Kd();case`linux`:return Jd();default:return{name:Hd[e]||e,version:M.release()}}}function zd(){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 Vd(e){let t={},n;try{n=M.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=M.arch(),(e===!0||e.memory)&&(t.memory_size=M.totalmem(),t.free_memory=M.freemem()),e===!0||e.cpu){let e=M.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}const Hd={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},Ud=[{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=>Gd(/distrib_release=(.*)/,e),centos:e=>Gd(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Gd(/release (..)/,e),mint:e=>Gd(/distrib_release=(.*)/,e),red:e=>Gd(/release ([^ ]+)/,e),suse:e=>Gd(/VERSION = (.*)\n/,e),ubuntu:e=>Gd(/distrib_release=(.*)/,e)};function Gd(e,t){let n=e.exec(t);return n?n[1]:void 0}async function Kd(){let e={kernel_version:M.release(),name:`Mac OS X`,version:`10.${Number(M.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{nt(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=Gd(/^ProductName:\s+(.*)$/m,t),e.version=Gd(/^ProductVersion:\s+(.*)$/m,t),e.build=Gd(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function qd(e){return e.split(` `)[0].toLowerCase()}async function Jd(){let e={kernel_version:M.release(),name:`Linux`};try{let t=await Fd(`/etc`),n=Ud.find(e=>t.includes(e.name));if(!n)return e;let r=(await Pd(Qe(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(qd(e))>=0)||i[0],e.version=Wd[qd(e.name)]?.(r)}catch{}return e}function Yd(){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 Xd=new kd(10),Zd=new kd(20);function Qd(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function $d(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function ef(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function tf(e,t){let n=Xd.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 nf(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=df(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=df(r,t)),n++}return a}function rf(e,t,n){return new Promise((r,i)=>{let a=ft(e),o=it({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){Zd.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]=no(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 af(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`||$d(i)||ef(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(Zd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=nf(r,t);if(a.every(t=>tf(e,t)))continue;let o=Qd(Xd,e,{});i.push(rf(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&&of(n.stacktrace.frames,t,Xd);return e}function of(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;cf(r.lineno,r,t,e)}}function sf(e){delete e.pre_context,delete e.context_line,delete e.post_context}function cf(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=lf(e,n);i<e;i++){let e=r[i];if(e===void 0){sf(t),Q&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){sf(t),Q&&K.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=uf(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 lf(e,t){return Math.max(1,e-t)}function uf(e,t){return e+t}function df(e,t){return[lf(e,t),uf(e,t)]}const ff=Z(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return af(e,t)}}})),pf=go(process.versions.node),mf=pf.major;pf.minor;let hf;async function gf(){if(hf===void 0)try{hf=!!(await import(`node:inspector`)).url()}catch{hf=!1}return hf}const _f=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function vf(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 yf(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function bf(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||yf(e)&&yf(t)}function xf(...e){K.log(`[LocalVariables]`,...e)}const Sf=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||!bf(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&_f in n.originalException&&Array.isArray(n.originalException[_f])){for(let r of e.exception?.values||[])t(r,n.originalException[_f]);n.originalException[_f]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new _t(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=>{xf(`Worker error`,e)}),t.once(`exit`,e=>{xf(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await gf()){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 Cf(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function wf(e,t){if(t!==void 0)return Cf(e(t,1))}function Tf(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 Ef=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}=Tf(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 Df=Z(((e={},t)=>{let n=new kd(20),r,i=!1;function a(t){let r=Cf(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||!bf(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(mf<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await gf()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Ef.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=wf(e,i.description);if(c==null){s();return}let{add:l,next:u}=Tf(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=vf(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]}}})),Of=(e={})=>pf.major<19?Df(e):Sf(e);function kf(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Af;const jf=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Mf=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...If()},e},getModules:If}));function Nf(){try{return a.cache?Object.keys(a.cache):[]}catch{return[]}}function Pf(){return{...jf,...Rf(),...kf()?Ff():{}}}function Ff(){let e=a.main?.paths||[],t=Nf(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=Ze(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=Qe(t,`package.json`);if(r.add(t),!pt(o))return a();try{let e=JSON.parse(ht(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function If(){return Af||=Pf(),Af}function Lf(){try{let e=Qe(process.cwd(),`package.json`);return JSON.parse(ht(e,`utf8`))}catch{return{}}}function Rf(){let e=Lf();return{...e.dependencies,...e.devDependencies}}function zf(e){Yi(()=>{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){ct&&global.process.on(`uncaughtException`,Vf(e,t))}}});function Vf(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=zf;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`),zf(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,X()===e&&el(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const Hf=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Uf=Z(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Hf,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,qf(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 Gf(e,t){let n=e.name===void 0||io(t.name,e.name,!0),r=e.message===void 0||io(t.message,e.message);return n&&r}function Kf(e,t){let n=Wf(t);return e.some(e=>Gf(e,n))}function qf(e,t){return function(n,r){if(X()!==e||Kf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>bc(a,e):e=>e())(()=>{el(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Jf(n,t.mode)}}function Jf(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`?Yi(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(Yi(()=>{console.warn(n)}),zf(e))}const Yf=Z(()=>({name:`ProcessSession`,setupOnce(){ol(),process.on(`beforeExit`,()=>{Y().getSession()?.status!==`ok`&&sl()})}})),Xf=`Spotlight`,Zf=Z(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:Xf,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{}Qf(e,t)}}}));function Qf(e,t){let n=$f(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=cc(e);xc(()=>{let e=at.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 $f(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function ep(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:We.getSystemErrorMap().has(e.errno)}const tp=Z((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!ep(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 np(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function rp(e=process.argv[1]?yd(process.argv[1]):process.cwd(),t=et===`\\`){let n=t?np(e):e;return e=>{if(!e)return;let r=t?np(e):e,{dir:i,base:a,ext:o}=$e.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 ip(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(G.SENTRY_RELEASE?.id)return G.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 ap=oa(Ed(rp())),op=Symbol(`AgentBaseInternalState`);var sp=class extends at.Agent{constructor(e){super(e),this[op]={}}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(`
325
+ `).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 at.Agent)return i.addRequest(e,r);this[op].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[op].currentSocket;if(this[op].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[op].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[op]&&(this[op].defaultPort=e)}get protocol(){return this[op].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[op]&&(this[op].protocol=e)}};function cp(...e){K.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function lp(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(),cp(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),cp(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
326
326
  \r
327
- `);if(l===-1){sp(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
328
- `),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}sp(`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 lp(...e){K.log(`[https-proxy-agent]`,...e)}var up=class extends op{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??{},lp(`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?fp(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:`){lp("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=bt.connect({...this.connectOpts,servername:e&&yt.isIP(e)?void 0:e})}else lp("Creating `net.Socket`: %o",this.connectOpts),r=yt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=yt.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=cp(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`,dp),t.secureEndpoint){lp(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return bt.connect({...fp(t,`host`,`path`,`port`),socket:r,servername:yt.isIP(e)?void 0:e})}return r}r.destroy();let u=new yt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{lp(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};up.__initStatic();function dp(e){e.resume()}function fp(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function pp(e){return new nt({read(){this.push(e),this.push(null)}})}function mp(e){let t;try{t=new URL(e.url)}catch{return Ji(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),Il(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=hp(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?_t:it,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new up(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return Il(e,gp(e,e.httpModule??i,o))}function hp(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function gp(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)=>{bc(()=>{let d=pp(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(vt()));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 _p(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Cu(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 vp(){let e=new xt;function t(){return e.getStore()||{scope:Po(),isolationScope:Fo()}}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()))}Ho({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function yp(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 bp(e,t){if(!e)return t;let n=ts(e),r=ts(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),rs(i)}const xp=`@sentry/instrumentation-http`;function Sp(e,t){let n=wp(e),r=t?.statusCode,i=Sd(r);Lu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Cp(e,t){let n=Ep(e),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=Mu(n,r,t)?Ou({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(xp,`Added sentry-trace header to outgoing request`)}catch(e){Q&&K.error(xp,`Failed to add sentry-trace header to outgoing request:`,Ta(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&K.log(xp,`Added traceparent header to outgoing request`)}catch(e){Q&&K.error(xp,`Failed to add traceparent header to outgoing request:`,Ta(e)?e.message:`Unknown error`)}if(s){let t=bp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&K.log(xp,`Added baggage header to outgoing request`)}catch(e){Q&&K.error(xp,`Failed to add baggage header to outgoing request:`,Ta(e)?e.message:`Unknown error`)}}}function wp(e){try{let t=e.getHeader(`host`)||e.host,n=wu(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Eu(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 Tp(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Ep(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Dp=`Http`,Op=new WeakSet,kp=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Od(100),r=new WeakMap;return{name:Dp,setupOnce(){ut(`http.server.request.start`,(e=>{Ap(e.server,t)})),ut(`http.client.request.created`,(e=>{jp(e.request,t,n,r)})),ut(`http.client.response.finish`,(e=>{let n=e;Mp(n.request,n.response,t,r)})),ut(`http.client.request.error`,(e=>{Mp(e.request,void 0,t,r)}))}}});function Ap(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Op.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(Dp,`Handling incoming request`);let a=Y().clone(),o=i[1],s=Pu(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&yp(o,a,n,Dp),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Tu(l)}`;return a.setTransactionName(u),Ko(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return vc({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=ko(),e.apply(r,i)))})}});Op.add(i),e.emit=i}function jp(e,t,n,r){let i=Np(e,t);r.set(e,i),!i&&Cp(e,n)}function Mp(e,t,n,r){n.breadcrumbs&&((r.get(e)??Np(e,n))||Sp(e,t))}function Np(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}`,Tp(e)):!1}const Pp=`sentry-trace`,Fp=`baggage`,Ip=/baggage: (.*)\r\n/;function Lp(e,t){let n=Bp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=Mu(n,r,t)?Ou({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(Array.isArray(e.headers)){let t=e.headers;o&&!t.includes(Pp)&&t.push(Pp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Fp);if(s&&n===-1)t.push(Fp,s);else if(s){let e=t[n+1],r=bp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Pp}:`)&&(e.headers+=`${Pp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Ip)?.[1];if(s&&!n)e.headers+=`${Fp}: ${s}\r\n`;else if(s){let t=bp(n,s);t&&(e.headers=e.headers.replace(Ip,`baggage: ${t}\r\n`))}}}function Rp(e,t){let n=zp(e),r=t.statusCode,i=Sd(r);Lu({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function zp(e){try{let t=wu(Bp(e.origin,e.path)),n={url:Eu(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 Vp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Od(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){ut(`undici:request:create`,(e=>{Hp(e.request,t,n,r)})),ut(`undici:request:headers`,(e=>{let n=e;Up(n.request,n.response,t,r)}))}}});function Hp(e,t,n,r){let i=Wp(e,t);r.set(e,i),!i&&Lp(e,n)}function Up(e,t,n,r){n.breadcrumbs&&(r.get(e)||Rp(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 Gp(){return[Hu(),Bu(),rd(),ud(),ep(),yd(),kp(),Vp(),zf(),Hf(),df(),Df(),Fd(),Ad(),Jf(),jf()]}function Kp(e={}){return qp(e,Gp)}function qp(e={},t){let n=Jp(e,t);n.debug===!0&&(Q?K.enable():Ji(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),vp(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===Yf)&&n.integrations.push(Xf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Du(n,`node-light`,[`node-core`]);let r=new kd(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${Of()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),Zp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Jp(e,t){let n=Yp(e.release),r=_p(e.spotlight),i=Xp(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??mp,stackParser:oa(e.stackParser||ip),release:n,tracesSampleRate:i,spotlight:r,debug:Cu(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:ml({defaultIntegrations:s,integrations:o})}}function Yp(e){if(e!==void 0)return e;let t=rp();if(t!==void 0)return t}function Xp(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 Zp(){if(Cu(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=_s(e,t);J().setPropagationContext(n)}}function Qp(){return Re.PRISMIC_SENTRY_ENABLED??Re.PROD}function $p(){if(Re.PRISMIC_SENTRY_ENVIRONMENT)return Re.PRISMIC_SENTRY_ENVIRONMENT;let e=se.match(/-(.+?)\./);return e?e[1]:`production`}function em(){try{if(!Qp())return;Kp({dsn:Re.PRISMIC_SENTRY_DSN,release:se,environment:$p(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),el(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function tm(e){try{if(!Qp())return;$c(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await rl()}catch{}}const nm=nl,rm=tl,im=el,$=[`login`,`logout`,`whoami`,`sync`,`docs`,`status`],am=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:Cr,description:`Initialize a Prismic project`},docs:{handler:Bt,description:`Browse Prismic documentation`},gen:{handler:Cn,description:`Generate files from local models`},pull:{handler:zr,description:`Pull types and slices from Prismic`},push:{handler:Br,description:`Push types and slices to Prismic`},sync:{handler:gi,description:`Sync types and slices from Prismic`},status:{handler:oi,description:`Show local vs remote model differences`},locale:{handler:kr,description:`Manage locales`},repo:{handler:Jr,description:`Manage repositories`},type:{handler:Ai,description:`Manage content types`},field:{handler:bn,description:`Manage fields`},slice:{handler:ai,description:`Manage slices`},preview:{handler:Ir,description:`Manage preview configurations`},token:{handler:xi,description:`Manage API tokens`},webhook:{handler:Ri,description:`Manage webhooks`},login:{handler:Ar,description:`Log in to Prismic`},logout:{handler:jr,description:`Log out of Prismic`},whoami:{handler:zi,description:`Show the currently logged in user`}}});await om();async function om(){await He({npmPackageName:ce,statePath:Ne}),Le().catch(()=>{});let{positionals:[e],values:{version:t,help:r,repo:i=await n()}}=We({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(se);return}if(typeof i!=`string`&&(i=``),!r){let t=await A();em(),await li({host:t}),i&&(ui(i),rm(`repository`,i),im(`Repository Data`,{name:i}));try{rm(`framework`,(await p()).id)}catch{}let n=await k();if(n){let e=Vi(n)?.exp,r=Date.now()/1e3;(!e||e-r<=3600)&&process.on(`exit`,()=>Ie()),(!e||e>r)&&Ct({token:n,host:t}).then(e=>{di(e),nm({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&fi(e)}try{await am(),e&&!$.includes(e)&&U(e)}catch(t){if(process.exitCode=1,t instanceof P){$.includes(e)||U(e),console.error(d(t.message));return}if(t instanceof f){$.includes(e)||U(e,{error:t}),console.error(t.message);return}if(t instanceof wr){if($.includes(e)||U(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(`
329
- `);console.error(d`
327
+ `);if(l===-1){cp(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
328
+ `),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}cp(`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 up(...e){K.log(`[https-proxy-agent]`,...e)}var dp=class extends sp{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??{},up(`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?pp(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:`){up("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=xt.connect({...this.connectOpts,servername:e&&bt.isIP(e)?void 0:e})}else up("Creating `net.Socket`: %o",this.connectOpts),r=bt.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=bt.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=lp(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`,fp),t.secureEndpoint){up(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return xt.connect({...pp(t,`host`,`path`,`port`),socket:r,servername:bt.isIP(e)?void 0:e})}return r}r.destroy();let u=new bt.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{up(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};dp.__initStatic();function fp(e){e.resume()}function pp(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function mp(e){return new rt({read(){this.push(e),this.push(null)}})}function hp(e){let t;try{t=new URL(e.url)}catch{return Yi(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),Ll(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=gp(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?vt:at,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new dp(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return Ll(e,_p(e,e.httpModule??i,o))}function gp(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function _p(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)=>{xc(()=>{let d=mp(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(yt()));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 vp(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=wu(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 yp(){let e=new St;function t(){return e.getStore()||{scope:Fo(),isolationScope:Io()}}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()))}Uo({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function bp(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 xp(e,t){if(!e)return t;let n=ns(e),r=ns(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),is(i)}const Sp=`@sentry/instrumentation-http`;function Cp(e,t){let n=Tp(e),r=t?.statusCode,i=Cd(r);Ru({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function wp(e,t){let n=Dp(e),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=Nu(n,r,t)?ku({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(Sp,`Added sentry-trace header to outgoing request`)}catch(e){Q&&K.error(Sp,`Failed to add sentry-trace header to outgoing request:`,Ea(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Q&&K.log(Sp,`Added traceparent header to outgoing request`)}catch(e){Q&&K.error(Sp,`Failed to add traceparent header to outgoing request:`,Ea(e)?e.message:`Unknown error`)}if(s){let t=xp(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Q&&K.log(Sp,`Added baggage header to outgoing request`)}catch(e){Q&&K.error(Sp,`Failed to add baggage header to outgoing request:`,Ea(e)?e.message:`Unknown error`)}}}function Tp(e){try{let t=e.getHeader(`host`)||e.host,n=Tu(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Du(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 Ep(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Dp(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const Op=`Http`,kp=new WeakSet,Ap=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new kd(100),r=new WeakMap;return{name:Op,setupOnce(){dt(`http.server.request.start`,(e=>{jp(e.server,t)})),dt(`http.client.request.created`,(e=>{Mp(e.request,t,n,r)})),dt(`http.client.response.finish`,(e=>{let n=e;Np(n.request,n.response,t,r)})),dt(`http.client.request.error`,(e=>{Np(e.request,void 0,t,r)}))}}});function jp(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(kp.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(Op,`Handling incoming request`);let a=Y().clone(),o=i[1],s=Fu(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&bp(o,a,n,Op),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Eu(l)}`;return a.setTransactionName(u),qo(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return yc({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=Ao(),e.apply(r,i)))})}});kp.add(i),e.emit=i}function Mp(e,t,n,r){let i=Pp(e,t);r.set(e,i),!i&&wp(e,n)}function Np(e,t,n,r){n.breadcrumbs&&((r.get(e)??Pp(e,n))||Cp(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}`,Ep(e)):!1}const Fp=`sentry-trace`,Ip=`baggage`,Lp=/baggage: (.*)\r\n/;function Rp(e,t){let n=Vp(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=X()?.getOptions()||{},a=Nu(n,r,t)?ku({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(Fp)&&t.push(Fp,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===Ip);if(s&&n===-1)t.push(Ip,s);else if(s){let e=t[n+1],r=xp(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Fp}:`)&&(e.headers+=`${Fp}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Lp)?.[1];if(s&&!n)e.headers+=`${Ip}: ${s}\r\n`;else if(s){let t=xp(n,s);t&&(e.headers=e.headers.replace(Lp,`baggage: ${t}\r\n`))}}}function zp(e,t){let n=Bp(e),r=t.statusCode,i=Cd(r);Ru({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Bp(e){try{let t=Tu(Vp(e.origin,e.path)),n={url:Du(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 Vp(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 Hp=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new kd(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){dt(`undici:request:create`,(e=>{Up(e.request,t,n,r)})),dt(`undici:request:headers`,(e=>{let n=e;Wp(n.request,n.response,t,r)}))}}});function Up(e,t,n,r){let i=Gp(e,t);r.set(e,i),!i&&Rp(e,n)}function Wp(e,t,n,r){n.breadcrumbs&&(r.get(e)||zp(e,t))}function Gp(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(Vp(e.origin,e.path)):!1}function Kp(){return[Uu(),Vu(),id(),dd(),tp(),bd(),Ap(),Hp(),Bf(),Uf(),ff(),Of(),Id(),jd(),Yf(),Mf()]}function qp(e={}){return Jp(e,Kp)}function Jp(e={},t){let n=Yp(e,t);n.debug===!0&&(Q?K.enable():Yi(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),yp(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===Xf)&&n.integrations.push(Zf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Ou(n,`node-light`,[`node-core`]);let r=new Ad(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${kf()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),Qp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function Yp(e,t){let n=Xp(e.release),r=vp(e.spotlight),i=Zp(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??hp,stackParser:sa(e.stackParser||ap),release:n,tracesSampleRate:i,spotlight:r,debug:wu(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:hl({defaultIntegrations:s,integrations:o})}}function Xp(e){if(e!==void 0)return e;let t=ip();if(t!==void 0)return t}function Zp(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 Qp(){if(wu(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=vs(e,t);J().setPropagationContext(n)}}function $p(){return j.PRISMIC_SENTRY_ENABLED??j.PROD}function em(){if(j.PRISMIC_SENTRY_ENVIRONMENT)return j.PRISMIC_SENTRY_ENVIRONMENT;let e=le.match(/-(.+?)\./);return e?e[1]:`production`}function tm(){try{if(!$p())return;qp({dsn:j.PRISMIC_SENTRY_DSN,release:le,environment:em(),defaultIntegrations:!1,integrations:[],maxValueLength:2500}),tl(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function nm(e){try{if(!$p())return;el(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await il()}catch{}}const rm=rl,im=nl,am=tl,$=[`login`,`logout`,`whoami`,`sync`,`docs`,`status`],om=P({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:Cr,description:`Initialize a Prismic project`},docs:{handler:Vt,description:`Browse Prismic documentation`},gen:{handler:Cn,description:`Generate files from local models`},pull:{handler:zr,description:`Pull types and slices from Prismic`},push:{handler:Br,description:`Push types and slices to Prismic`},sync:{handler:_i,description:`Sync types and slices from Prismic`},status:{handler:si,description:`Show local vs remote model differences`},locale:{handler:kr,description:`Manage locales`},repo:{handler:Yr,description:`Manage repositories`},type:{handler:ji,description:`Manage content types`},field:{handler:bn,description:`Manage fields`},slice:{handler:oi,description:`Manage slices`},preview:{handler:Ir,description:`Manage preview configurations`},token:{handler:Si,description:`Manage API tokens`},webhook:{handler:zi,description:`Manage webhooks`},login:{handler:Ar,description:`Log in to Prismic`},logout:{handler:jr,description:`Log out of Prismic`},whoami:{handler:Bi,description:`Show the currently logged in user`}}});await sm();async function sm(){await Ue({npmPackageName:ue,statePath:Fe}),ze().catch(()=>{});let{positionals:[e],values:{version:t,help:r,repo:i=await n()}}=Ge({options:{version:{type:`boolean`,short:`v`},help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}},allowPositionals:!0,strict:!1});if(t){console.info(le);return}if(typeof i!=`string`&&(i=``),!r){let t=await A();tm(),await ui({host:t}),i&&(di(i),im(`repository`,i),am(`Repository Data`,{name:i}));try{im(`framework`,(await h()).id)}catch{}let n=await k();if(n){let e=Hi(n)?.exp,r=Date.now()/1e3;(!e||e-r<=3600)&&process.on(`exit`,()=>Re()),(!e||e>r)&&wt({token:n,host:t}).then(e=>{fi(e),rm({id:e.shortId})}).catch(()=>{})}e&&!$.includes(e)&&pi(e)}try{await om(),e&&!$.includes(e)&&U(e)}catch(t){if(process.exitCode=1,t instanceof F){$.includes(e)||U(e),console.error(p(t.message));return}if(t instanceof m){$.includes(e)||U(e,{error:t}),console.error(t.message);return}if(t instanceof wr){if($.includes(e)||U(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(`
329
+ `);console.error(p`
330
330
  Environment "${t.env}" not found on repository "${t.repo}".
331
331
 
332
332
  Available environments:
333
333
  ${e}
334
- `)}return}if(t instanceof ye||t instanceof xe){$.includes(e)||U(e,{error:t}),await k()?Re.PRISMIC_TOKEN?console.error(`PRISMIC_TOKEN is invalid or expired, or doesn't have access to this repository. Unset it to log in with a browser, or replace it with a valid token.`):t instanceof ye?console.error("Your session is invalid or expired. Run `prismic login` to sign in again."):console.error(`You do not have access to this repository. Check the repository name or log in with an account that has access.`):console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof D){$.includes(e)||U(e),console.error(t.message||`Not found. Verify the repository and any specified identifiers exist.`);return}if(t instanceof w){$.includes(e)||U(e,{error:t});let n=new URL(t.response.url);n.search=``,console.error(d`
334
+ `)}return}if(t instanceof xe||t instanceof Ce){$.includes(e)||U(e,{error:t}),await k()?j.PRISMIC_TOKEN?console.error(`PRISMIC_TOKEN is invalid or expired, or doesn't have access to this repository. Unset it to log in with a browser, or replace it with a valid token.`):t instanceof xe?console.error("Your session is invalid or expired. Run `prismic login` to sign in again."):console.error(`You do not have access to this repository. Check the repository name or log in with an account that has access.`):console.error("Not logged in. Run `prismic login` first.");return}if(t instanceof D){$.includes(e)||U(e),console.error(t.message||`Not found. Verify the repository and any specified identifiers exist.`);return}if(t instanceof T){$.includes(e)||U(e,{error:t});let n=new URL(t.response.url);n.search=``,console.error(p`
335
335
  A network request failed unexpectedly:
336
336
 
337
337
  ${n}
338
338
 
339
339
  If this error happens repeatedly, report the issue here: https://github.com/prismicio/cli/issues
340
- `);return}if(t instanceof b){$.includes(e)||U(e),console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof h){$.includes(e)||U(e),console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof m){$.includes(e)||U(e),console.error(d`
340
+ `);return}if(t instanceof b){$.includes(e)||U(e),console.error(`${t.message} Run \`prismic init\` to re-create a config.`);return}if(t instanceof ee){$.includes(e)||U(e),console.error(`${t.message} Run \`prismic init\` to create a config.`);return}if(t instanceof g){$.includes(e)||U(e),console.error(p`
341
341
  This command requires the Type Builder in your repository.
342
342
 
343
343
  As of March 2026, the Type Builder is rolling out incrementally as Slice
@@ -345,4 +345,4 @@ Watch stopped. Goodbye!`),U(`sync`,{watch:!0}),process.exit(0)}),console.info(`W
345
345
  Slice Machine until your repository can upgrade.
346
346
 
347
347
  Learn more at https://prismic.io/docs/type-builder
348
- `);return}throw $.includes(e)||U(e,{error:t}),await tm(t),t}}export{};
348
+ `);return}throw $.includes(e)||U(e,{error:t}),await nm(t),t}}export{};