prismic 0.0.0-pr.28.59bf330

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.
Files changed (158) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +69 -0
  3. package/dist/builders-hKD4IrLX-DsO7BUQw.mjs +97 -0
  4. package/dist/dist-B11B2hHn.mjs +1 -0
  5. package/dist/dist-DT8CtumB.mjs +1 -0
  6. package/dist/framework-CfjEoVk0.mjs +17 -0
  7. package/dist/index.mjs +2537 -0
  8. package/dist/nextjs-9z7YrSnS.mjs +312 -0
  9. package/dist/nuxt-KoJ61G2q.mjs +59 -0
  10. package/dist/sveltekit-DjXKCG78.mjs +226 -0
  11. package/package.json +58 -0
  12. package/src/codegen-types.ts +82 -0
  13. package/src/codegen.ts +45 -0
  14. package/src/custom-type-add-field-boolean.ts +185 -0
  15. package/src/custom-type-add-field-color.ts +168 -0
  16. package/src/custom-type-add-field-date.ts +171 -0
  17. package/src/custom-type-add-field-embed.ts +168 -0
  18. package/src/custom-type-add-field-geo-point.ts +165 -0
  19. package/src/custom-type-add-field-group.ts +142 -0
  20. package/src/custom-type-add-field-image.ts +168 -0
  21. package/src/custom-type-add-field-key-text.ts +168 -0
  22. package/src/custom-type-add-field-link.ts +191 -0
  23. package/src/custom-type-add-field-number.ts +200 -0
  24. package/src/custom-type-add-field-rich-text.ts +192 -0
  25. package/src/custom-type-add-field-select.ts +174 -0
  26. package/src/custom-type-add-field-timestamp.ts +171 -0
  27. package/src/custom-type-add-field-uid.ts +151 -0
  28. package/src/custom-type-add-field.ts +116 -0
  29. package/src/custom-type-connect-slice.ts +178 -0
  30. package/src/custom-type-create.ts +98 -0
  31. package/src/custom-type-disconnect-slice.ts +134 -0
  32. package/src/custom-type-list.ts +110 -0
  33. package/src/custom-type-remove-field.ts +135 -0
  34. package/src/custom-type-remove.ts +103 -0
  35. package/src/custom-type-set-name.ts +102 -0
  36. package/src/custom-type-view.ts +118 -0
  37. package/src/custom-type.ts +85 -0
  38. package/src/docs-fetch.ts +146 -0
  39. package/src/docs-list.ts +131 -0
  40. package/src/docs.ts +54 -0
  41. package/src/env.d.ts +12 -0
  42. package/src/framework/index.ts +399 -0
  43. package/src/framework/nextjs.templates.ts +426 -0
  44. package/src/framework/nextjs.ts +216 -0
  45. package/src/framework/nuxt.templates.ts +74 -0
  46. package/src/framework/nuxt.ts +250 -0
  47. package/src/framework/sveltekit.templates.ts +278 -0
  48. package/src/framework/sveltekit.ts +241 -0
  49. package/src/index.ts +155 -0
  50. package/src/init.ts +173 -0
  51. package/src/lib/auth.ts +200 -0
  52. package/src/lib/browser.ts +11 -0
  53. package/src/lib/config.ts +111 -0
  54. package/src/lib/custom-types-api.ts +385 -0
  55. package/src/lib/field-path.ts +81 -0
  56. package/src/lib/file.ts +49 -0
  57. package/src/lib/json.ts +3 -0
  58. package/src/lib/packageJson.ts +35 -0
  59. package/src/lib/profile.ts +39 -0
  60. package/src/lib/request.ts +116 -0
  61. package/src/lib/segment.ts +145 -0
  62. package/src/lib/sentry.ts +63 -0
  63. package/src/lib/string.ts +10 -0
  64. package/src/lib/url.ts +31 -0
  65. package/src/locale-add.ts +116 -0
  66. package/src/locale-list.ts +107 -0
  67. package/src/locale-remove.ts +88 -0
  68. package/src/locale-set-default.ts +131 -0
  69. package/src/locale.ts +60 -0
  70. package/src/login.ts +45 -0
  71. package/src/logout.ts +36 -0
  72. package/src/page-type-add-field-boolean.ts +179 -0
  73. package/src/page-type-add-field-color.ts +165 -0
  74. package/src/page-type-add-field-date.ts +168 -0
  75. package/src/page-type-add-field-embed.ts +165 -0
  76. package/src/page-type-add-field-geo-point.ts +162 -0
  77. package/src/page-type-add-field-group.ts +139 -0
  78. package/src/page-type-add-field-image.ts +165 -0
  79. package/src/page-type-add-field-key-text.ts +165 -0
  80. package/src/page-type-add-field-link.ts +188 -0
  81. package/src/page-type-add-field-number.ts +197 -0
  82. package/src/page-type-add-field-rich-text.ts +189 -0
  83. package/src/page-type-add-field-select.ts +171 -0
  84. package/src/page-type-add-field-timestamp.ts +168 -0
  85. package/src/page-type-add-field-uid.ts +148 -0
  86. package/src/page-type-add-field.ts +116 -0
  87. package/src/page-type-connect-slice.ts +178 -0
  88. package/src/page-type-create.ts +128 -0
  89. package/src/page-type-disconnect-slice.ts +134 -0
  90. package/src/page-type-list.ts +109 -0
  91. package/src/page-type-remove-field.ts +135 -0
  92. package/src/page-type-remove.ts +103 -0
  93. package/src/page-type-set-name.ts +102 -0
  94. package/src/page-type-set-repeatable.ts +111 -0
  95. package/src/page-type-view.ts +118 -0
  96. package/src/page-type.ts +90 -0
  97. package/src/preview-add.ts +126 -0
  98. package/src/preview-get-simulator.ts +104 -0
  99. package/src/preview-list.ts +106 -0
  100. package/src/preview-remove-simulator.ts +80 -0
  101. package/src/preview-remove.ts +109 -0
  102. package/src/preview-set-name.ts +137 -0
  103. package/src/preview-set-simulator.ts +116 -0
  104. package/src/preview.ts +75 -0
  105. package/src/pull.ts +236 -0
  106. package/src/push.ts +409 -0
  107. package/src/repo-create.ts +175 -0
  108. package/src/repo-get-access.ts +86 -0
  109. package/src/repo-list.ts +100 -0
  110. package/src/repo-set-access.ts +100 -0
  111. package/src/repo-set-name.ts +102 -0
  112. package/src/repo-view.ts +113 -0
  113. package/src/repo.ts +70 -0
  114. package/src/slice-add-field-boolean.ts +219 -0
  115. package/src/slice-add-field-color.ts +205 -0
  116. package/src/slice-add-field-date.ts +205 -0
  117. package/src/slice-add-field-embed.ts +205 -0
  118. package/src/slice-add-field-geo-point.ts +202 -0
  119. package/src/slice-add-field-group.ts +170 -0
  120. package/src/slice-add-field-image.ts +202 -0
  121. package/src/slice-add-field-key-text.ts +205 -0
  122. package/src/slice-add-field-link.ts +224 -0
  123. package/src/slice-add-field-number.ts +205 -0
  124. package/src/slice-add-field-rich-text.ts +229 -0
  125. package/src/slice-add-field-select.ts +211 -0
  126. package/src/slice-add-field-timestamp.ts +205 -0
  127. package/src/slice-add-field.ts +111 -0
  128. package/src/slice-add-variation.ts +142 -0
  129. package/src/slice-create.ts +164 -0
  130. package/src/slice-list-variations.ts +71 -0
  131. package/src/slice-list.ts +60 -0
  132. package/src/slice-remove-field.ts +125 -0
  133. package/src/slice-remove-variation.ts +113 -0
  134. package/src/slice-remove.ts +92 -0
  135. package/src/slice-rename.ts +104 -0
  136. package/src/slice-set-screenshot.ts +239 -0
  137. package/src/slice-view.ts +83 -0
  138. package/src/slice.ts +95 -0
  139. package/src/status.ts +834 -0
  140. package/src/sync.ts +259 -0
  141. package/src/token-create.ts +203 -0
  142. package/src/token-delete.ts +182 -0
  143. package/src/token-list.ts +223 -0
  144. package/src/token-set-name.ts +193 -0
  145. package/src/token.ts +60 -0
  146. package/src/webhook-add-header.ts +118 -0
  147. package/src/webhook-create.ts +152 -0
  148. package/src/webhook-disable.ts +109 -0
  149. package/src/webhook-enable.ts +132 -0
  150. package/src/webhook-list.ts +93 -0
  151. package/src/webhook-remove-header.ts +117 -0
  152. package/src/webhook-remove.ts +106 -0
  153. package/src/webhook-set-triggers.ts +148 -0
  154. package/src/webhook-status.ts +90 -0
  155. package/src/webhook-test.ts +106 -0
  156. package/src/webhook-view.ts +147 -0
  157. package/src/webhook.ts +95 -0
  158. package/src/whoami.ts +62 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,2537 @@
1
+ #!/usr/bin/env node
2
+ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,U as g,V as _,W as v,_ as y,a as b,b as x,c as ee,d as te,f as ne,g as S,h as C,i as re,j as ie,k as w,l as T,m as E,n as ae,o as D,p as oe,r as O,s as k,v as se,w as ce,x as le,y as ue,z as de}from"./framework-CfjEoVk0.mjs";import{t as fe}from"./dist-B11B2hHn.mjs";import*as pe from"node:util";import{parseArgs as A,promisify as me}from"node:util";import{readFile as he,readdir as ge,rm as _e,writeFile as ve}from"node:fs/promises";import*as ye from"node:crypto";import{createHash as be,randomUUID as xe}from"node:crypto";import{dirname as Se,extname as Ce,join as we,posix as Te,sep as Ee}from"node:path";import*as De from"node:http";import*as j from"node:os";import{homedir as Oe}from"node:os";import{exec as ke,execFile as Ae,spawn as je}from"node:child_process";import{isMainThread as Me,threadId as Ne}from"worker_threads";import*as Pe from"node:diagnostics_channel";import{subscribe as Fe}from"node:diagnostics_channel";import{createReadStream as Ie,existsSync as Le,readFile as Re,readFileSync as ze,readdir as Be}from"node:fs";import{createInterface as Ve}from"node:readline";import{Worker as He}from"node:worker_threads";import*as Ue from"node:https";import{Readable as We}from"node:stream";import{createGzip as Ge}from"node:zlib";import*as Ke from"node:net";import*as qe from"node:tls";import{AsyncLocalStorage as Je}from"node:async_hooks";import{setTimeout as Ye}from"node:timers/promises";var Xe=`prismic`,Ze=`0.0.0-pr.28.59bf330`,Qe=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=i([``,``],[``,``]);function i(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(){var t=this,n=[...arguments];return a(this,e),this.tag=function(e){var n=[...arguments].slice(1);return typeof e==`function`?t.interimTag.bind(t,e):typeof e==`string`?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return typeof e==`function`?e():e}),this.tag}return n(e,[{key:`interimTag`,value:function(e,t){var n=[...arguments].slice(2);return this.tag(r,e.apply(void 0,[t].concat(n)))}},{key:`processSubstitutions`,value:function(e,t,n){return`${t}${this.transformSubstitution(e.shift(),t)}${n}`}},{key:`transformString`,value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:`transformSubstitution`,value:function(e,t){return this.transformers.reduce(function(e,n){return n.onSubstitution?n.onSubstitution(e,t):e},e)}},{key:`transformEndResult`,value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}(),t.exports=e.default})),M=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Qe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),$e=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return{onEndResult:function(t){if(e===``)return t.trim();if(e=e.toLowerCase(),e===`start`||e===`left`)return t.replace(/^\s*/,``);if(e===`end`||e===`right`)return t.replace(/\s*$/,``);throw Error(`Side not supported: `+e)}}},t.exports=e.default})),N=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r($e());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),et=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`initial`;return{onEndResult:function(t){if(e===`initial`){var r=t.match(/^[^\S\n]*(?=\S)/gm),i=r&&Math.min.apply(Math,n(r.map(function(e){return e.length})));if(i){var a=RegExp(`^.{`+i+`}`,`gm`);return t.replace(a,``)}return t}if(e===`all`)return t.replace(/^[^\S\n]+/gm,``);throw Error(`Unknown type: `+e)}}},t.exports=e.default})),tt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(et());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),nt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onEndResult:function(n){if(e==null||t==null)throw Error(`replaceResultTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),rt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(nt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),it=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onSubstitution:function(n,r){if(e==null||t==null)throw Error(`replaceSubstitutionTransformer requires at least 2 arguments.`);return n==null?n:n.toString().replace(e,t)}}},t.exports=e.default})),at=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(it());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ot=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onString:function(n){if(e==null||t==null)throw Error(`replaceStringTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),st=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ot());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ct=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n={separator:``,conjunction:``,serial:!1};e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n;return{onSubstitution:function(t,n){if(Array.isArray(t)){var r=t.length,i=e.separator,a=e.conjunction,o=e.serial,s=n.match(/(\n?[^\S\n]+)$/);if(t=s?t.join(i+s[1]):t.join(i+` `),a&&r>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:``)+` `+a+t.slice(c+1)}}return t}}},t.exports=e.default})),lt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ct());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ut=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e){return{onSubstitution:function(t,n){if(e!=null&&typeof e==`string`)typeof t==`string`&&t.includes(e)&&(t=t.split(e));else throw Error(`You need to specify a string character to split by.`);return t}}},t.exports=e.default})),dt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ut());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ft=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!=`boolean`};e.default=function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(n):n(e)?e:``}}},t.exports=e.default})),pt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ft());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),mt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(tt()),i=o(lt()),a=o(N());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`}),r.default,a.default),t.exports=e.default})),ht=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(mt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),gt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(tt()),i=o(lt()),a=o(N());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`and`}),r.default,a.default),t.exports=e.default})),_t=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(gt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),vt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(tt()),i=o(lt()),a=o(N());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`or`}),r.default,a.default),t.exports=e.default})),yt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(vt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),bt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(M()),r=c(tt()),i=c(lt()),a=c(N()),o=c(dt()),s=c(pt());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
3
+ `),s.default,i.default,r.default,a.default),t.exports=e.default})),xt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(bt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),St=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(xt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ct=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(xt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),wt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(M()),r=c(tt()),i=c(lt()),a=c(N()),o=c(dt()),s=c(at());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
4
+ `),i.default,r.default,a.default,(0,s.default)(/&/g,`&amp;`),(0,s.default)(/</g,`&lt;`),(0,s.default)(/>/g,`&gt;`),(0,s.default)(/"/g,`&quot;`),(0,s.default)(/'/g,`&#x27;`),(0,s.default)(/`/g,`&#x60;`)),t.exports=e.default})),Tt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(wt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Et=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(M()),r=a(N()),i=a(rt());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n(?:\s*))+/g,` `),r.default),t.exports=e.default})),Dt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Et());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ot=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(M()),r=a(N()),i=a(rt());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n\s*)/g,``),r.default),t.exports=e.default})),kt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ot());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),At=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(lt()),i=o(N()),a=o(rt());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),jt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(At());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Mt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(lt()),i=o(N()),a=o(rt());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`or`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Nt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Mt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Pt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(lt()),i=o(N()),a=o(rt());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`and`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Ft=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Pt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),It=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(tt()),i=o(lt()),a=o(N());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(i.default,r.default,a.default),t.exports=e.default})),Lt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(It());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Rt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(M()),r=o(lt()),i=o(N()),a=o(rt());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),zt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Rt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Bt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(M()),r=a(tt()),i=a(N());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,i.default),t.exports=e.default})),Vt=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Bt());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ht=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(M()),r=a(tt()),i=a(N());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)(`all`),i.default),t.exports=e.default})),Ut=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ht());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),P=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stripIndents=e.stripIndent=e.oneLineInlineLists=e.inlineLists=e.oneLineCommaListsAnd=e.oneLineCommaListsOr=e.oneLineCommaLists=e.oneLineTrim=e.oneLine=e.safeHtml=e.source=e.codeBlock=e.html=e.commaListsOr=e.commaListsAnd=e.commaLists=e.removeNonPrintingValuesTransformer=e.splitStringTransformer=e.inlineArrayTransformer=e.replaceStringTransformer=e.replaceSubstitutionTransformer=e.replaceResultTransformer=e.stripIndentTransformer=e.trimResultTransformer=e.TemplateTag=void 0;var t=C(M()),n=C(N()),r=C(tt()),i=C(rt()),a=C(at()),o=C(st()),s=C(lt()),c=C(dt()),l=C(pt()),u=C(ht()),d=C(_t()),f=C(yt()),p=C(xt()),m=C(St()),h=C(Ct()),g=C(Tt()),_=C(Dt()),v=C(kt()),y=C(jt()),b=C(Nt()),x=C(Ft()),ee=C(Lt()),te=C(zt()),ne=C(Vt()),S=C(Ut());function C(e){return e&&e.__esModule?e:{default:e}}e.TemplateTag=t.default,e.trimResultTransformer=n.default,e.stripIndentTransformer=r.default,e.replaceResultTransformer=i.default,e.replaceSubstitutionTransformer=a.default,e.replaceStringTransformer=o.default,e.inlineArrayTransformer=s.default,e.splitStringTransformer=c.default,e.removeNonPrintingValuesTransformer=l.default,e.commaLists=u.default,e.commaListsAnd=d.default,e.commaListsOr=f.default,e.html=p.default,e.codeBlock=m.default,e.source=h.default,e.safeHtml=g.default,e.oneLine=_.default,e.oneLineTrim=v.default,e.oneLineCommaLists=y.default,e.oneLineCommaListsOr=b.default,e.oneLineCommaListsAnd=x.default,e.inlineLists=ee.default,e.oneLineInlineLists=te.default,e.stripIndent=ne.default,e.stripIndents=S.default}))(),Wt=class extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge==`number`&&e.maxAge===0)throw TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||1/0,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction==`function`)for(let[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return typeof t.expiry==`number`&&t.expiry<=Date.now()?(typeof this.onEviction==`function`&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){let n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield e)}for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield e)}}get(e){if(this.cache.has(e)){let t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){let t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){let r=typeof n==`number`&&n!==1/0?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){let t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw TypeError("`maxSize` must be a number greater than 0");let t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.cache.has(n)||this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}}*entriesAscending(){for(let[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(let t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(let[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}};function Gt(e,t){return(!e||e.endsWith(`
5
+ `))&&!t?.force?e:e+`
6
+ `}function F(e,t){return Gt(t)+e}function Kt(e,t){return(!e||e.endsWith(`
7
+
8
+ `))&&!t?.force?e:Gt(e)+`
9
+ `}function I(e,t){return Kt(t)+e}const qt=`https://prismic.io/docs/slices`,Jt={UID:`https://prismic.io/docs/fields/uid`,Boolean:`https://prismic.io/docs/fields/boolean`,Color:`https://prismic.io/docs/fields/color`,Date:`https://prismic.io/docs/fields/date`,Timestamp:`https://prismic.io/docs/fields/timestamp`,Number:`https://prismic.io/docs/fields/number`,Text:`https://prismic.io/docs/fields/text`,Select:`https://prismic.io/docs/fields/select`,StructuredText:`https://prismic.io/docs/fields/rich-text`,Image:`https://prismic.io/docs/fields/image`,Link:{contentRelationship:`https://prismic.io/docs/fields/content-relationship`,link:`https://prismic.io/docs/fields/link`,linkToMedia:`https://prismic.io/docs/fields/link-to-media`},Embed:`https://prismic.io/docs/fields/embed`,GeoPoint:`https://prismic.io/docs/fields/geopoint`,Table:`https://prismic.io/docs/fields/table`,Group:`https://prismic.io/docs/fields/repeatable-group`,IntegrationFields:`https://prismic.io/docs/fields/integration`,Slices:`https://prismic.io/docs/slices`,Choice:`https://prismic.io/docs/slices`};var Yt=o({__addDisposableResource:()=>wn,__assign:()=>On,__asyncDelegator:()=>gn,__asyncGenerator:()=>hn,__asyncValues:()=>_n,__await:()=>mn,__awaiter:()=>on,__classPrivateFieldGet:()=>xn,__classPrivateFieldIn:()=>Cn,__classPrivateFieldSet:()=>Sn,__createBinding:()=>kn,__decorate:()=>Qt,__disposeResources:()=>Tn,__esDecorate:()=>en,__exportStar:()=>cn,__extends:()=>Xt,__generator:()=>sn,__importDefault:()=>bn,__importStar:()=>yn,__makeTemplateObject:()=>vn,__metadata:()=>an,__param:()=>$t,__propKey:()=>nn,__read:()=>un,__rest:()=>Zt,__rewriteRelativeImportExtension:()=>En,__runInitializers:()=>tn,__setFunctionName:()=>rn,__spread:()=>dn,__spreadArray:()=>pn,__spreadArrays:()=>fn,__values:()=>ln,default:()=>Nn});function Xt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Dn(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Zt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Qt(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function $t(e,t){return function(n,r){t(n,r,e)}}function en(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function tn(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function nn(e){return typeof e==`symbol`?e:`${e}`}function rn(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function an(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function on(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function sn(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function cn(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&kn(t,e,n)}function ln(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function un(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function dn(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(un(arguments[t]));return e}function fn(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function pn(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function mn(e){return this instanceof mn?(this.v=e,this):new mn(e)}function hn(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof mn?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function gn(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:mn(e[r](t)),done:!1}:i?i(t):t}:i}}function _n(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof ln==`function`?ln(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function vn(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function yn(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=jn(e),r=0;r<n.length;r++)n[r]!==`default`&&kn(t,e,n[r]);return An(t,e),t}function bn(e){return e&&e.__esModule?e:{default:e}}function xn(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function Sn(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function Cn(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function wn(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function Tn(e){function t(t){e.error=e.hasError?new Mn(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function En(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var Dn,On,kn,An,jn,Mn,Nn,Pn=_((()=>{Dn=function(e,t){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Dn(e,t)},On=function(){return On=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},On.apply(this,arguments)},kn=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),An=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},jn=function(e){return jn=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},jn(e)},Mn=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},Nn={__extends:Xt,__assign:On,__rest:Zt,__decorate:Qt,__param:$t,__esDecorate:en,__runInitializers:tn,__propKey:nn,__setFunctionName:rn,__metadata:an,__awaiter:on,__generator:sn,__createBinding:kn,__exportStar:cn,__values:ln,__read:un,__spread:dn,__spreadArrays:fn,__spreadArray:pn,__await:mn,__asyncGenerator:hn,__asyncDelegator:gn,__asyncValues:_n,__makeTemplateObject:vn,__importStar:yn,__importDefault:bn,__classPrivateFieldGet:xn,__classPrivateFieldSet:Sn,__classPrivateFieldIn:Cn,__addDisposableResource:wn,__disposeResources:Tn,__rewriteRelativeImportExtension:En}})),Fn=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.lowerCase=e.localeLowerCase=void 0;var t={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{İ:`i`,I:`ı`,İ:`i`}},az:{regexp:/\u0130/g,map:{İ:`i`,I:`ı`,İ:`i`}},lt:{regexp:/\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,map:{I:`i̇`,J:`j̇`,Į:`į̇`,Ì:`i̇̀`,Í:`i̇́`,Ĩ:`i̇̃`}}};function n(e,n){var i=t[n.toLowerCase()];return r(i?e.replace(i.regexp,function(e){return i.map[e]}):e)}e.localeLowerCase=n;function r(e){return e.toLowerCase()}e.lowerCase=r})),In=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noCase=void 0;var t=Fn(),n=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],r=/[^A-Z0-9]+/gi;function i(e,i){i===void 0&&(i={});for(var o=i.splitRegexp,s=o===void 0?n:o,c=i.stripRegexp,l=c===void 0?r:c,u=i.transform,d=u===void 0?t.lowerCase:u,f=i.delimiter,p=f===void 0?` `:f,m=a(a(e,s,`$1\0$2`),l,`\0`),h=0,g=m.length;m.charAt(h)===`\0`;)h++;for(;m.charAt(g-1)===`\0`;)g--;return m.slice(h,g).split(`\0`).map(d).join(p)}e.noCase=i;function a(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(e,t){return e.replace(t,n)},e)}})),Ln=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.pascalCase=e.pascalCaseTransformMerge=e.pascalCaseTransform=void 0;var t=(Pn(),v(Yt)),n=In();function r(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>=`0`&&n<=`9`?`_`+n+r:``+n.toUpperCase()+r}e.pascalCaseTransform=r;function i(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}e.pascalCaseTransformMerge=i;function a(e,i){return i===void 0&&(i={}),n.noCase(e,t.__assign({delimiter:``,transform:r},i))}e.pascalCase=a}))();const L=(...e)=>{let t=(0,Ln.pascalCase)(e.filter(Boolean).join(` `),{transform:Ln.pascalCaseTransformMerge});return/^[0-9]/.test(t)&&(t=`_${t}`),t},Rn={Boolean:`Boolean`,Color:`Color`,Date:`Date`,Embed:`Embed`,GeoPoint:`GeoPoint`,Group:`Group`,Image:`Image`,Integration:`IntegrationFields`,Link:`Link`,Number:`Number`,Select:`Select`,Slices:`Slices`,StructuredText:`StructuredText`,Table:`Table`,Text:`Text`,Timestamp:`Timestamp`,UID:`UID`,IntegrationFields:`IntegrationFields`,Range:`Range`,Separator:`Separator`,LegacySlices:`Choice`};function zn(e){let t=``;for(let n=0;n<e.path.length;n++){n>0&&(t+=`.`);let r=e.path[n];if(r.model&&`type`in r.model&&(r.model.type===`Group`||r.model.type===`Slices`))t+=`${r.name}[]`;else{if(r.name===`items`){let i=e.path[n-1];if(i.model&&`json`in i.model||i.model&&`type`in i.model&&i.model.type===`SharedSlice`){t+=`${r.name}[]`;continue}}t+=r.name}}return t}const Bn=e=>{if(`json`in e.model)return e.model.label||e.model.id;if(`type`in e.model&&e.model.type===`SharedSlice`)return e.model.name;if(`type`in e.model&&e.model.type===`Slice`)return e.model.fieldset||e.name;if(`type`in e.model){if(e.model.config&&`label`in e.model.config)return e.model.config.label||e.name;if(e.model.config&&`fieldset`in e.model)return e.model.fieldset||e.name}return`\`${e.name}\``};function Vn(e){return e.path.map(e=>e.label?e.label:e.model?Bn({model:e.model,name:e.name}):e.name).join(` → `)}function Hn(e){switch(e.field.type){case`StructuredText`:return`Rich Text`;case`IntegrationFields`:{let t=e.field.config?.catalog;return`Integration Fields (Catalog: ${t?`\`${t}\``:`*unknown*`})`}case`Link`:switch(e.field.config?.select){case`document`:return`Content Relationship`;case`media`:return`Link to Media`;default:return`Link`}case`Slices`:return`Slice Zone`;default:return e.field.type}}function Un(e){switch(e.field.type){case`Link`:{let t=Jt.Link;switch(e.field.config?.select){case`document`:return t.contentRelationship;case`media`:return t.linkToMedia;default:return t.link}}default:{let t=Jt[e.field.type];if(typeof t==`string`)return t}}}function Wn(e){let t=`/**`,n=Bn({model:e.field,name:e.name}),r=Vn({path:e.path}),i=Hn({field:e.field});t=F(` * ${n} field in *${r}*`,t),t=F(` *`,t),t=F(` * - **Field Type**: ${i}`,t),t=F(` * - **Placeholder**: ${e.field.config&&`placeholder`in e.field.config&&e.field.config.placeholder||`*None*`}`,t);let a=e.field.config&&`default_value`in e.field.config?e.field.config.default_value:void 0;a!==void 0&&(t=F(` * - **Default Value**: ${typeof a==`boolean`?`${a}`:a}`,t)),t=F(` * - **API ID Path**: ${zn({path:[...e.path,{name:e.name,model:e.field}]})}`,t),e.tabName&&(t=F(` * - **Tab**: ${e.tabName}`,t));let o=Un({field:e.field});return o&&(t=F(` * - **Documentation**: ${o}`,t)),t=F(` */`,t),t}function Gn(e){return e.filter(Boolean).join(` | `)||`never`}function Kn(e){let t=Wn({name:e.name,field:e.field,path:e.path,tabName:e.tabName}),n=[],r=[],i=e.name.includes(`-`)||e.name.includes(`:`)||/^[0-9]/.test(e.name)?`"${e.name}"`:e.name;switch(e.field.type){case`UID`:break;case`Boolean`:t=F(`${i}: prismic.BooleanField;`,t);break;case`Color`:t=F(`${i}: prismic.ColorField;`,t);break;case`Date`:t=F(`${i}: prismic.DateField;`,t);break;case`Embed`:{let n=[];if(e.fieldConfigs.embed?.providerTypes)for(let t in e.fieldConfigs.embed?.providerTypes){let r=e.fieldConfigs.embed?.providerTypes[t];n.push(`({ provider_name: "${t}" } & ${r})`)}let r=Gn(n);t=n.length>0?F(`${i}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${r})>`,t):F(`${i}: prismic.EmbedField`,t);break}case`GeoPoint`:t=F(`${i}: prismic.GeoPointField;`,t);break;case`Image`:t=e.field.config?.thumbnails&&e.field.config.thumbnails.length>0?F(`${i}: prismic.ImageField<${Gn(e.field.config.thumbnails.map(e=>`"${e.name}"`))}>;`,t):F(`${i}: prismic.ImageField<never>;`,t);break;case`IntegrationFields`:{let n=e.field.config?.catalog?e.fieldConfigs.integrationFields?.catalogTypes?.[e.field.config.catalog]:void 0;t=F(n?`${i}: prismic.IntegrationField<${n}>;`:`${i}: prismic.IntegrationField;`,t);break}case`Link`:{let n=e.field.config&&`variants`in e.field.config&&Array.isArray(e.field.config.variants)&&e.field.config.variants.length>0?e.field.config.variants.map(e=>`"${e.replace(/\"/g,`\\"`)}"`).join(` | `):`never`;switch(e.field.config?.select){case`document`:t=`customtypes`in e.field.config&&e.field.config.customtypes&&e.field.config.customtypes.length>0?F(`${i}: ${Gn(e.field.config.customtypes.map(e=>typeof e==`string`?`prismic.ContentRelationshipField<"${e}">`:`ContentRelationshipFieldWithData<${JSON.stringify([e])}>`))};`,t):F(`${i}: prismic.ContentRelationshipField;`,t);break;case`media`:t=F(`${i}: prismic.LinkToMediaField<prismic.FieldState, ${n}>;`,t);break;default:{let r=`prismic.LinkField<string, string, unknown, prismic.FieldState, ${n}>`;e.field.config?.repeat&&(r=`prismic.Repeatable<${r}>`),t=F(`${i}: ${r};`,t);break}}break}case`Number`:t=F(`${i}: prismic.NumberField;`,t);break;case`StructuredText`:t=F(`${i}: prismic.RichTextField;`,t);break;case`Select`:{let n=(e.field.config?.options)?.map(e=>`"${e}"`)||[],r=n.length?Gn(n):`string`;t=e.field.config?.default_value?F(`${i}: prismic.SelectField<${r}, "filled">;`,t):F(`${i}: prismic.SelectField${n.length>0?`<${r}>`:``};`,t);break}case`Table`:t=F(`${i}: prismic.TableField;`,t);break;case`Text`:t=F(`${i}: prismic.KeyTextField;`,t);break;case`Timestamp`:t=F(`${i}: prismic.TimestampField;`,t);break;case`Group`:{let a=e.path.filter(e=>e.model!==void 0&&`type`in e.model&&e.model.type===Rn.Group),o=a.length>0,s;if(e.path[0].model&&`type`in e.path[0].model&&e.path[0].model.type===`SharedSlice`){let[t,n,r]=e.path;s=L(t.name,`Slice`,n.name,r.name,...a.map(e=>e.name),e.name,`Item`)}else s=L(e.path[0].name,`Document`,`Data`,...a.map(e=>e.name),e.name,`Item`);let c=[...e.path,{name:i,model:e.field}],l=Vn({path:c}),u=qn({fields:e.field.config?.fields||{},fieldConfigs:e.fieldConfigs,path:c});n.push(...u.auxiliaryTypes),r.push(...u.contentTypeNames),n.push({name:s,code:P.source`
10
+ /**
11
+ * Item in *${l}*
12
+ */
13
+ export interface ${s} {
14
+ ${u.code}
15
+ }
16
+ `}),r.push(s),t=F(o?`${i}: prismic.NestedGroupField<Simplify<${s}>>;`:`${i}: prismic.GroupField<Simplify<${s}>>;`,t);break}case`Slices`:{let a=[];if(e.field.config?.choices)for(let t in e.field.config.choices){let i=e.field.config.choices[t];if(i.type===`SharedSlice`)a.push(L(t,`Slice`));else if(i.type===`Slice`){let o=L(e.path[0].name,`Document`,`Data`,e.name,t,`Slice`),s;if(i[`non-repeat`]&&Object.keys(i[`non-repeat`]).length>0){s=L(o,`Primary`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`primary`,label:`Primary`}],c=Vn({path:a}),l=qn({fields:i[`non-repeat`],fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=P.stripIndent`
17
+ /**
18
+ * Primary content in *${c}*
19
+ */
20
+ `;u=l.code?F(P.source`
21
+ export interface ${s} {
22
+ ${l.code}
23
+ }
24
+ `,u):F(`export interface ${s} {}`,u),n.push({name:s,code:u}),r.push(s)}let c;if(i.repeat&&Object.keys(i.repeat).length>0){c=L(o,`Item`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`items`,label:`Items`}],s=Vn({path:a}),l=qn({fields:i.repeat,fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=P.stripIndent`
25
+ /**
26
+ * Item content in *${s}*
27
+ */
28
+ `;u=l.code?F(P.source`
29
+ export interface ${c} {
30
+ ${l.code}
31
+ }
32
+ `,u):F(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:P.stripIndent`
33
+ /**
34
+ * Slice for *${Vn({path:[...e.path,{name:e.name,model:e.field}]})}*
35
+ */
36
+ export type ${o} = prismic.Slice<"${t}", ${s?`Simplify<${s}>`:`Record<string, never>`}, ${c?`Simplify<${c}>`:`never`}>
37
+ `}),a.push(o)}}let o=L(e.path[0].name,`Document`,`Data`,e.name,`Slice`),s=Gn(a);n.push({name:o,code:`type ${o} = ${s}`}),r.push(o),t=F(`${i}: prismic.SliceZone<${o}>;`,t);break}default:t=F(`${i}: unknown;`,t)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function qn(e){let t=``,n=[],r=[];for(let i in e.fields){let a=e.fields[i],o=Kn({name:i,field:a,path:e.path,fieldConfigs:e.fieldConfigs,tabName:e.tabName});t=I(o.code,t),n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Jn(e){let t=``,n=[],r=[],i=L(e.model.id,`Document`,`Data`),a=Bn({name:e.model.id,model:e.model}),o=``;for(let t in e.model.json){let{uid:i,...a}=e.model.json[t],s=qn({fields:a,fieldConfigs:e.fieldConfigs,path:[{name:e.model.id,model:e.model}],tabName:t});o+=s.code,n.push(...s.auxiliaryTypes),r.push(...s.contentTypeNames)}return t=o?P.source`
38
+ /**
39
+ * Content for ${a} documents
40
+ */
41
+ interface ${i} {
42
+ ${o}
43
+ }
44
+ `:`interface ${i} {}`,{name:i,code:t,auxiliaryTypes:n,contentTypeNames:r}}function Yn(e){return`uid`in Object.assign({},...Object.values(e.json))}const Xn=e=>ye.createHash(`sha1`).update(JSON.stringify(e)).digest(`hex`);function Zn(e){if(e.cache){let t=Xn(e.model),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=L(e.model.id,`Document`),a=e.localeIDs&&e.localeIDs.length>0?Gn(e.localeIDs.map(e=>`"${e}"`)):`string`,o=Yn(e.model)?`PrismicDocumentWithUID`:`PrismicDocumentWithoutUID`,s=Bn({name:e.model.id,model:e.model}),c=Jn({model:e.model,fieldConfigs:e.fieldConfigs});n.push(...c.auxiliaryTypes),r.push(c.name),r.push(...c.contentTypeNames),t=I(c.code,t),t=I(P.source`
45
+ /**
46
+ * ${s} document from Prismic
47
+ *
48
+ * - **API ID**: \`${e.model.id}\`
49
+ * - **Repeatable**: \`${e.model.repeatable.toString()}\`
50
+ * - **Documentation**: ${`https://prismic.io/docs/content-modeling`}
51
+ *
52
+ * @typeParam Lang - Language API ID of the document.
53
+ */
54
+ export type ${i}<Lang extends string = ${a}> = prismic.${o}<Simplify<${c.name}>, "${e.model.id}", Lang>;
55
+ `,t);let l={name:i,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Xn(e.model);e.cache.set(t,l)}return l}function Qn(e){if(e.cache){let t=Xn([e.model,e.fieldConfigs]),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=L(e.model.id,`Slice`),a=Bn({name:e.model.id,model:e.model}),o=[];for(let s of e.model.variations){let c=L(i,s.id),l;if(s.primary&&Object.keys(s.primary).length>0){l=L(c,`Primary`);let i=[{name:e.model.id,model:e.model},{name:s.id,label:s.name},{name:`primary`,label:`Primary`}],a=Vn({path:i}),o=qn({fields:s.primary,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(l);let u=P.stripIndent`
56
+ /**
57
+ * Primary content in *${a}*
58
+ */
59
+ `;t=I(o.code?P.source`
60
+ ${u}
61
+ export interface ${l} {
62
+ ${o.code}
63
+ }
64
+ `:P.source`
65
+ ${u}
66
+ export interface ${l} {}
67
+ `,t)}let u;if(s.items&&Object.keys(s.items).length>0){u=L(c,`Item`);let i=[{name:e.model.id,model:e.model},{name:`items`,label:`Items`}],a=Vn({path:i}),o=qn({fields:s.items,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(u);let l=P.stripIndent`
68
+ /**
69
+ * Primary content in *${a}*
70
+ */
71
+ `;t=I(o.code?P.source`
72
+ ${l}
73
+ export interface ${u} {
74
+ ${o.code}
75
+ }
76
+ `:P.source`
77
+ ${l}
78
+ export interface ${u} {}
79
+ `,t)}t=I(P.source`
80
+ /**
81
+ * ${s.name} variation for ${a} Slice
82
+ *
83
+ * - **API ID**: \`${s.id}\`
84
+ * - **Description**: ${s.description||`*None*`}
85
+ * - **Documentation**: ${qt}
86
+ */
87
+ export type ${c} = prismic.SharedSliceVariation<"${s.id}", ${l?`Simplify<${l}>`:`Record<string, never>`}, ${u?`Simplify<${u}>`:`never`}>;
88
+ `,t),o.push(c)}let s=L(i,`Variation`),c=Gn(o);r.push(s),r.push(...o),t=I(P.source`
89
+ /**
90
+ * Slice variation for *${a}*
91
+ */
92
+ type ${s} = ${o.length>0?c:`never`}
93
+ `,t),t=I(P.source`
94
+ /**
95
+ * ${a} Shared Slice
96
+ *
97
+ * - **API ID**: \`${e.model.id}\`
98
+ * - **Description**: ${e.model.description||`*None*`}
99
+ * - **Documentation**: ${qt}
100
+ */
101
+ export type ${i} = prismic.SharedSlice<"${e.model.id}", ${s}>;
102
+ `,t);let l={name:i,variationNames:o,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Xn([e.model,e.fieldConfigs]);e.cache.set(t,l)}return l}const $n=new Wt({maxSize:1e3});function er(e={}){let t=e.fieldConfigs||{},n=e.cache??!0,r=``,i=e.typesProvider||`@prismicio/types`,a=`prismic`;r=F(`import type * as prismic from "${i}";`,r),(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace)&&i!==`@prismicio/client`&&(a=`prismicClient`,r=F(`import type * as ${a} from "@prismicio/client";`,r)),r=I(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`,r),r=I(`
103
+ type PickContentRelationshipFieldData<
104
+ TRelationship extends prismic.CustomTypeModelFetchCustomTypeLevel1 | prismic.CustomTypeModelFetchCustomTypeLevel2 | prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2,
105
+ TData extends Record<string, prismic.AnyRegularField | prismic.GroupField | prismic.NestedGroupField | prismic.SliceZone>,
106
+ TLang extends string
107
+ > = |
108
+ // Content relationship fields
109
+ {
110
+ [TSubRelationship in Extract<
111
+ TRelationship["fields"][number], prismic.CustomTypeModelFetchContentRelationshipLevel1
112
+ > as TSubRelationship["id"]]:
113
+ ContentRelationshipFieldWithData<TSubRelationship["customtypes"], TLang>;
114
+ } &
115
+ // Group
116
+ {
117
+ [TGroup in Extract<
118
+ TRelationship["fields"][number], prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2
119
+ > as TGroup["id"]]:
120
+ TData[TGroup["id"]] extends prismic.GroupField<infer TGroupData>
121
+ ? prismic.GroupField<PickContentRelationshipFieldData<TGroup, TGroupData, TLang>>
122
+ : never
123
+ } &
124
+ // Other fields
125
+ {
126
+ [TFieldKey in Extract<TRelationship["fields"][number], string>]:
127
+ TFieldKey extends keyof TData ? TData[TFieldKey] : never;
128
+ };
129
+
130
+ type ContentRelationshipFieldWithData<
131
+ TCustomType extends readonly (prismic.CustomTypeModelFetchCustomTypeLevel1 | string)[] | readonly (prismic.CustomTypeModelFetchCustomTypeLevel2 | string)[],
132
+ TLang extends string = string
133
+ > = {
134
+ [ID in Exclude<TCustomType[number], string>["id"]]:
135
+ prismic.ContentRelationshipField<
136
+ ID,
137
+ TLang,
138
+ PickContentRelationshipFieldData<
139
+ Extract<TCustomType[number], { id: ID }>,
140
+ Extract<prismic.Content.AllDocumentTypes, { type: ID }>["data"],
141
+ TLang
142
+ >
143
+ >
144
+ }[Exclude<TCustomType[number], string>["id"]];
145
+ `,r);let o=[];if(e.customTypeModels){let i=[];for(let a of e.customTypeModels){let s=Zn({model:a,localeIDs:e.localeIDs,fieldConfigs:t,cache:n?$n:void 0});for(let e of s.auxiliaryTypes)r=I(e.code,r);r=I(s.code,r),i.push(s.name),o.push(s.name),o.push(...s.contentTypeNames)}if(e.customTypeModels.length>0){let e=`AllDocumentTypes`;r=I(`export type ${e} = ${Gn(i)};`,r),o.push(e)}}if(e.sharedSliceModels)for(let i of e.sharedSliceModels){let e=Qn({model:i,fieldConfigs:t,cache:n?$n:void 0});for(let t of e.auxiliaryTypes)r=I(t.code,r);r=I(e.code,r),o.push(e.name),o.push(...e.contentTypeNames)}if(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace){let t=``;e.clientIntegration.includeCreateClientInterface&&((e.customTypeModels?.length||0)>0?(t=I(`interface CreateClient {
146
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client<AllDocumentTypes>;
147
+ }`,t),t=I(`interface CreateWriteClient {
148
+ (repositoryNameOrEndpoint: string, options: ${a}.WriteClientConfig): ${a}.WriteClient<AllDocumentTypes>;
149
+ }`,t),t=I(`interface CreateMigration {
150
+ (): ${a}.Migration<AllDocumentTypes>;
151
+ }`,t)):(t=I(`interface CreateClient {
152
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client;
153
+ }`,t),t=I(`interface CreateWriteClient {
154
+ (repositoryNameOrEndpoint: string, options?: ${a}.WriteClientConfig): ${a}.WriteClient;
155
+ }`,t),t=I(`interface CreateMigration {
156
+ (): ${a}.Migration;
157
+ }`,t))),e.clientIntegration.includeContentNamespace&&(t=I(P.source`
158
+ namespace Content {
159
+ export type {
160
+ ${o.join(`,
161
+ `)}
162
+ }
163
+ }
164
+ `,t)),r=I(P.source`
165
+ declare module "@prismicio/client" {
166
+ ${t}
167
+ }
168
+ `,r)}return r}async function tr(){let{values:{help:e,output:t}}=A({args:process.argv.slice(4),options:{output:{type:`string`,short:`o`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Generate TypeScript types from local custom type and slice models.
169
+
170
+ USAGE
171
+ prismic codegen types [flags]
172
+
173
+ FLAGS
174
+ -o, --output string Output file path (default: "prismicio-types.d.ts")
175
+ -h, --help Show help for command
176
+
177
+ EXAMPLES
178
+ prismic codegen types
179
+ prismic codegen types --output custom.d.ts`);return}try{await R({output:t}),console.info(`Generated types written to ${t??`prismicio-types.d.ts`}`)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function R(e){let t=e?.output??`prismicio-types.d.ts`,n=e?.framework??await k();if(!n)throw Error(`No supported framework found`);let[r,i]=await Promise.all([n.getCustomTypes(),n.getSlices()]),a=r.map(e=>e.model),o=i.map(e=>e.model);await ve(t,`// Code generated by prismic-ts-codegen. DO NOT EDIT.
180
+
181
+ `+er({customTypeModels:a,sharedSliceModels:o,typesProvider:`@prismicio/client`,clientIntegration:{includeCreateClientInterface:a.length>0||o.length>0,includeContentNamespace:!0}}))}async function nr(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`types`:await tr();break;default:e&&(console.error(`Unknown codegen subcommand: ${e}\n`),process.exitCode=1),console.info(`Generate code from Prismic models.
182
+
183
+ USAGE
184
+ prismic codegen <command> [flags]
185
+
186
+ COMMANDS
187
+ types Generate TypeScript types from models pushed to Prismic
188
+
189
+ FLAGS
190
+ -h, --help Show help for command
191
+
192
+ LEARN MORE
193
+ Use \`prismic codegen <command> --help\` for more information about a command.`)}}function z(e){let t=e.split(`.`);return t.length===1?{type:`top-level`,fieldId:e}:t.length===2?{type:`nested`,groupId:t[0],nestedFieldId:t[1]}:{type:`nested`,groupId:t[0],nestedFieldId:t.slice(1).join(`.`)}}function B(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Group`&&`config`in e&&typeof e.config==`object`&&e.config!==null&&`fields`in e.config}function V(e,t,n){let r=e[t];return r?B(r)?{ok:!0,group:r}:{ok:!1,error:`Field "${t}" is not a group`}:{ok:!1,error:`Group "${t}" not found in tab "${n}"`}}function H(e,t,n){let r=e[t];return r?B(r)?{ok:!0,group:r}:{ok:!1,error:`Field "${t}" is not a group`}:{ok:!1,error:`Group "${t}" not found in variation "${n}"`}}function U(e){return e.type===`nested`&&e.nestedFieldId.includes(`.`)?{ok:!1,error:`Nested groups not supported. Use: group.field`}:{ok:!0}}async function rr(){let{values:{help:e,tab:t,label:n,default:r,"true-label":i,"false-label":a,types:o},positionals:[s,c]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a boolean (toggle) field to an existing custom type.
194
+
195
+ USAGE
196
+ prismic custom-type add-field boolean <type-id> <field-id> [flags]
197
+
198
+ ARGUMENTS
199
+ type-id Custom type identifier (required)
200
+ field-id Field identifier (required)
201
+
202
+ FLAGS
203
+ -t, --tab string Target tab (default: first existing tab, or "Main")
204
+ -l, --label string Display label for the field (inferred from field-id if omitted)
205
+ --default Set default value to true
206
+ --true-label string Label shown when toggle is on
207
+ --false-label string Label shown when toggle is off
208
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
209
+ -h, --help Show help for command
210
+
211
+ EXAMPLES
212
+ prismic custom-type add-field boolean homepage featured
213
+ prismic custom-type add-field boolean article published --default
214
+ prismic custom-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!s){console.error(`Missing required argument: type-id
215
+ `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
216
+ `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let l=z(c),u=U(l);if(!u.ok){console.error(u.error),process.exitCode=1;return}let d=await k();if(!d)return;let f;try{f=await d.readCustomType(s)}catch{console.error(`Custom type not found: ${s}\n\nCreate it first with: prismic custom-type create ${s}`),process.exitCode=1;return}let p=Object.keys(f.json),m=t??p[0]??`Main`;f.json[m]||(f.json[m]={});let h={type:`Boolean`,config:{label:n??T(l.type===`nested`?l.nestedFieldId:c),...r&&{default_value:!0},...i&&{placeholder_true:i},...a&&{placeholder_false:a}}};if(l.type===`nested`){let e=V(f.json[m],l.groupId,m);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[l.nestedFieldId]){console.error(`Field "${l.nestedFieldId}" already exists in group "${l.groupId}"`),process.exitCode=1;return}e.group.config.fields[l.nestedFieldId]=h}else{for(let[e,t]of Object.entries(f.json)){if(t[c]){console.error(`Field "${c}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[c]){console.error(`Field "${c}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}f.json[m][c]=h}try{await d.updateCustomType(f)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}l.type===`nested`?console.info(`Added field "${l.nestedFieldId}" (Boolean) to group "${l.groupId}" in ${s}`):console.info(`Added field "${c}" (Boolean) to "${m}" tab in ${s}`);try{await R({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ir(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a color picker field to an existing custom type.
217
+
218
+ USAGE
219
+ prismic custom-type add-field color <type-id> <field-id> [flags]
220
+
221
+ ARGUMENTS
222
+ type-id Custom type identifier (required)
223
+ field-id Field identifier (required)
224
+
225
+ FLAGS
226
+ -t, --tab string Target tab (default: first existing tab, or "Main")
227
+ -l, --label string Display label for the field (inferred from field-id if omitted)
228
+ -p, --placeholder string Placeholder text
229
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
230
+ -h, --help Show help for command
231
+
232
+ EXAMPLES
233
+ prismic custom-type add-field color homepage bg_color
234
+ prismic custom-type add-field color homepage accent --tab "Design"
235
+ prismic custom-type add-field color homepage text_color --label "Text Color"`);return}if(!a){console.error(`Missing required argument: type-id
236
+ `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
237
+ `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Custom type not found: ${a}\n\nCreate it first with: prismic custom-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Color`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}try{await l.updateCustomType(u)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Color) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Color) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ar(){let{values:{help:e,tab:t,label:n,placeholder:r,default:i,types:a},positionals:[o,s]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a date field to an existing custom type.
238
+
239
+ USAGE
240
+ prismic custom-type add-field date <type-id> <field-id> [flags]
241
+
242
+ ARGUMENTS
243
+ type-id Custom type identifier (required)
244
+ field-id Field identifier (required)
245
+
246
+ FLAGS
247
+ -t, --tab string Target tab (default: first existing tab, or "Main")
248
+ -l, --label string Display label for the field (inferred from field-id if omitted)
249
+ -p, --placeholder string Placeholder text
250
+ --default string Default date value (YYYY-MM-DD format)
251
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
252
+ -h, --help Show help for command
253
+
254
+ EXAMPLES
255
+ prismic custom-type add-field date homepage publish_date
256
+ prismic custom-type add-field date event start_date --tab "Schedule"
257
+ prismic custom-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!o){console.error(`Missing required argument: type-id
258
+ `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!s){console.error(`Missing required argument: field-id
259
+ `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let c=z(s),l=U(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await k();if(!u)return;let d;try{d=await u.readCustomType(o)}catch{console.error(`Custom type not found: ${o}\n\nCreate it first with: prismic custom-type create ${o}`),process.exitCode=1;return}let f=Object.keys(d.json),p=t??f[0]??`Main`;d.json[p]||(d.json[p]={});let m={type:`Date`,config:{label:n??T(c.type===`nested`?c.nestedFieldId:s),...r&&{placeholder:r},...i&&{default:i}}};if(c.type===`nested`){let e=V(d.json[p],c.groupId,p);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[c.nestedFieldId]){console.error(`Field "${c.nestedFieldId}" already exists in group "${c.groupId}"`),process.exitCode=1;return}e.group.config.fields[c.nestedFieldId]=m}else{for(let[e,t]of Object.entries(d.json)){if(t[s]){console.error(`Field "${s}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[s]){console.error(`Field "${s}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}d.json[p][s]=m}try{await u.updateCustomType(d)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}c.type===`nested`?console.info(`Added field "${c.nestedFieldId}" (Date) to group "${c.groupId}" in ${o}`):console.info(`Added field "${s}" (Date) to "${p}" tab in ${o}`);try{await R({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function or(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add an embed field to an existing custom type.
260
+
261
+ USAGE
262
+ prismic custom-type add-field embed <type-id> <field-id> [flags]
263
+
264
+ ARGUMENTS
265
+ type-id Custom type identifier (required)
266
+ field-id Field identifier (required)
267
+
268
+ FLAGS
269
+ -t, --tab string Target tab (default: first existing tab, or "Main")
270
+ -l, --label string Display label for the field (inferred from field-id if omitted)
271
+ -p, --placeholder string Placeholder text
272
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
273
+ -h, --help Show help for command
274
+
275
+ EXAMPLES
276
+ prismic custom-type add-field embed homepage video
277
+ prismic custom-type add-field embed homepage youtube --tab "Media"
278
+ prismic custom-type add-field embed homepage media --label "Media Embed"`);return}if(!a){console.error(`Missing required argument: type-id
279
+ `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
280
+ `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Custom type not found: ${a}\n\nCreate it first with: prismic custom-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Embed`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}try{await l.updateCustomType(u)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Embed) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Embed) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function sr(){let{values:{help:e,tab:t,label:n,types:r},positionals:[i,a]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a geo-point (location) field to an existing custom type.
281
+
282
+ USAGE
283
+ prismic custom-type add-field geo-point <type-id> <field-id> [flags]
284
+
285
+ ARGUMENTS
286
+ type-id Custom type identifier (required)
287
+ field-id Field identifier (required)
288
+
289
+ FLAGS
290
+ -t, --tab string Target tab (default: first existing tab, or "Main")
291
+ -l, --label string Display label for the field (inferred from field-id if omitted)
292
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
293
+ -h, --help Show help for command
294
+
295
+ EXAMPLES
296
+ prismic custom-type add-field geo-point homepage location
297
+ prismic custom-type add-field geo-point store address --tab "Details"
298
+ prismic custom-type add-field geo-point event venue --label "Event Venue"`);return}if(!i){console.error(`Missing required argument: type-id
299
+ `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
300
+ `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let o=z(a),s=U(o);if(!s.ok){console.error(s.error),process.exitCode=1;return}let c=await k();if(!c)return;let l;try{l=await c.readCustomType(i)}catch{console.error(`Custom type not found: ${i}\n\nCreate it first with: prismic custom-type create ${i}`),process.exitCode=1;return}let u=Object.keys(l.json),d=t??u[0]??`Main`;l.json[d]||(l.json[d]={});let f={type:`GeoPoint`,config:{label:n??T(o.type===`nested`?o.nestedFieldId:a)}};if(o.type===`nested`){let e=V(l.json[d],o.groupId,d);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[o.nestedFieldId]){console.error(`Field "${o.nestedFieldId}" already exists in group "${o.groupId}"`),process.exitCode=1;return}e.group.config.fields[o.nestedFieldId]=f}else{for(let[e,t]of Object.entries(l.json)){if(t[a]){console.error(`Field "${a}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[a]){console.error(`Field "${a}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}l.json[d][a]=f}try{await c.updateCustomType(l)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}o.type===`nested`?console.info(`Added field "${o.nestedFieldId}" (GeoPoint) to group "${o.groupId}" in ${i}`):console.info(`Added field "${a}" (GeoPoint) to "${d}" tab in ${i}`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function cr(){let{values:{help:e,tab:t,label:n,"non-repeatable":r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},"non-repeatable":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a group field to an existing custom type.
301
+
302
+ USAGE
303
+ prismic custom-type add-field group <type-id> <field-id> [flags]
304
+
305
+ ARGUMENTS
306
+ type-id Custom type identifier (required)
307
+ field-id Field identifier (required)
308
+
309
+ FLAGS
310
+ -t, --tab string Target tab (default: first existing tab, or "Main")
311
+ -l, --label string Display label for the field (inferred from field-id if omitted)
312
+ --non-repeatable Make this a non-repeating group (default: repeatable)
313
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
314
+ -h, --help Show help for command
315
+
316
+ EXAMPLES
317
+ prismic custom-type add-field group homepage buttons
318
+ prismic custom-type add-field group article authors --non-repeatable
319
+ prismic custom-type add-field group product variants --tab "Content"`);return}if(!a){console.error(`Missing required argument: type-id
320
+ `),console.error(`Usage: prismic custom-type add-field group <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
321
+ `),console.error(`Usage: prismic custom-type add-field group <type-id> <field-id>`),process.exitCode=1;return}if(o.includes(`.`)){console.error(`Groups cannot be nested inside other groups`),process.exitCode=1;return}let s=await k();if(!s)return;let c;try{c=await s.readCustomType(a)}catch{console.error(`Custom type not found: ${a}\n\nCreate it first with: prismic custom-type create ${a}`),process.exitCode=1;return}let l=Object.keys(c.json),u=t??l[0]??`Main`;c.json[u]||(c.json[u]={});for(let[e,t]of Object.entries(c.json))if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}let d={type:`Group`,config:{label:n??T(o),repeat:!r,fields:{}}};c.json[u][o]=d;try{await s.updateCustomType(c)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${o}" (Group) to "${u}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info(`Next: Add fields to the group with \`prismic custom-type add-field <type> ${a} ${o}.<field-id>\``),console.info(" Run `prismic status` when done to find next steps")}async function lr(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add an image field to an existing custom type.
322
+
323
+ USAGE
324
+ prismic custom-type add-field image <type-id> <field-id> [flags]
325
+
326
+ ARGUMENTS
327
+ type-id Custom type identifier (required)
328
+ field-id Field identifier (required)
329
+
330
+ FLAGS
331
+ -t, --tab string Target tab (default: first existing tab, or "Main")
332
+ -l, --label string Display label for the field (inferred from field-id if omitted)
333
+ -p, --placeholder string Placeholder text
334
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
335
+ -h, --help Show help for command
336
+
337
+ EXAMPLES
338
+ prismic custom-type add-field image homepage hero
339
+ prismic custom-type add-field image article thumbnail --tab "Media"
340
+ prismic custom-type add-field image product photo --label "Product Photo"`);return}if(!a){console.error(`Missing required argument: type-id
341
+ `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
342
+ `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Custom type not found: ${a}\n\nCreate it first with: prismic custom-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Image`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}try{await l.updateCustomType(u)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Image) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Image) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ur(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a key-text (single-line text) field to an existing custom type.
343
+
344
+ USAGE
345
+ prismic custom-type add-field key-text <type-id> <field-id> [flags]
346
+
347
+ ARGUMENTS
348
+ type-id Custom type identifier (required)
349
+ field-id Field identifier (required)
350
+
351
+ FLAGS
352
+ -t, --tab string Target tab (default: first existing tab, or "Main")
353
+ -l, --label string Display label for the field (inferred from field-id if omitted)
354
+ -p, --placeholder string Placeholder text
355
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
356
+ -h, --help Show help for command
357
+
358
+ EXAMPLES
359
+ prismic custom-type add-field key-text homepage title
360
+ prismic custom-type add-field key-text homepage meta_title --tab "SEO"
361
+ prismic custom-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!a){console.error(`Missing required argument: type-id
362
+ `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
363
+ `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Custom type not found: ${a}\n\nCreate it first with: prismic custom-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Text`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}try{await l.updateCustomType(u)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Text) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Text) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function dr(){let{values:{help:e,tab:t,label:n,placeholder:r,variation:i,"allow-text":a,"allow-target-blank":o,repeatable:s,types:c},positionals:[l,u]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a link field to an existing custom type.
364
+
365
+ USAGE
366
+ prismic custom-type add-field link <type-id> <field-id> [flags]
367
+
368
+ ARGUMENTS
369
+ type-id Custom type identifier (required)
370
+ field-id Field identifier (required)
371
+
372
+ FLAGS
373
+ -t, --tab string Target tab (default: first existing tab, or "Main")
374
+ -l, --label string Display label for the field (inferred from field-id if omitted)
375
+ -p, --placeholder string Placeholder text
376
+ --variation string Slice variations (can be used multiple times)
377
+ --allow-text Allow text with link
378
+ --allow-target-blank Allow opening link in new tab
379
+ --repeatable Allow multiple links
380
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
381
+ -h, --help Show help for command
382
+
383
+ EXAMPLES
384
+ prismic custom-type add-field link homepage button
385
+ prismic custom-type add-field link homepage cta --allow-text
386
+ prismic custom-type add-field link homepage cta --variation Primary --variation Secondary
387
+ prismic custom-type add-field link homepage links --repeatable`);return}if(!l){console.error(`Missing required argument: type-id
388
+ `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
389
+ `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let d=z(u),f=U(d);if(!f.ok){console.error(f.error),process.exitCode=1;return}let p=await k();if(!p)return;let m;try{m=await p.readCustomType(l)}catch{console.error(`Custom type not found: ${l}\n\nCreate it first with: prismic custom-type create ${l}`),process.exitCode=1;return}let h=Object.keys(m.json),g=t??h[0]??`Main`;m.json[g]||(m.json[g]={});let _={type:`Link`,config:{label:n??T(d.type===`nested`?d.nestedFieldId:u),...r&&{placeholder:r},...i&&i.length>0&&{variants:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...s&&{repeat:!0}}};if(d.type===`nested`){let e=V(m.json[g],d.groupId,g);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[d.nestedFieldId]){console.error(`Field "${d.nestedFieldId}" already exists in group "${d.groupId}"`),process.exitCode=1;return}e.group.config.fields[d.nestedFieldId]=_}else{for(let[e,t]of Object.entries(m.json)){if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[u]){console.error(`Field "${u}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}m.json[g][u]=_}try{await p.updateCustomType(m)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}d.type===`nested`?console.info(`Added field "${d.nestedFieldId}" (Link) to group "${d.groupId}" in ${l}`):console.info(`Added field "${u}" (Link) to "${g}" tab in ${l}`);try{await R({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function fr(){let{values:{help:e,tab:t,label:n,placeholder:r,min:i,max:a,step:o,types:s},positionals:[c,l]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a number field to an existing custom type.
390
+
391
+ USAGE
392
+ prismic custom-type add-field number <type-id> <field-id> [flags]
393
+
394
+ ARGUMENTS
395
+ type-id Custom type identifier (required)
396
+ field-id Field identifier (required)
397
+
398
+ FLAGS
399
+ -t, --tab string Target tab (default: first existing tab, or "Main")
400
+ -l, --label string Display label for the field (inferred from field-id if omitted)
401
+ -p, --placeholder string Placeholder text
402
+ --min number Minimum value
403
+ --max number Maximum value
404
+ --step number Step increment
405
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
406
+ -h, --help Show help for command
407
+
408
+ EXAMPLES
409
+ prismic custom-type add-field number homepage price
410
+ prismic custom-type add-field number product quantity --min 0 --max 100
411
+ prismic custom-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!c){console.error(`Missing required argument: type-id
412
+ `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
413
+ `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let u=z(l),d=U(u);if(!d.ok){console.error(d.error),process.exitCode=1;return}let f=i===void 0?void 0:Number(i),p=a===void 0?void 0:Number(a),m=o===void 0?void 0:Number(o);if(i!==void 0&&Number.isNaN(f)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(a!==void 0&&Number.isNaN(p)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let h=await k();if(!h)return;let g;try{g=await h.readCustomType(c)}catch{console.error(`Custom type not found: ${c}\n\nCreate it first with: prismic custom-type create ${c}`),process.exitCode=1;return}let _=Object.keys(g.json),v=t??_[0]??`Main`;g.json[v]||(g.json[v]={});let y={type:`Number`,config:{label:n??T(u.type===`nested`?u.nestedFieldId:l),...r&&{placeholder:r},...f!==void 0&&{min:f},...p!==void 0&&{max:p},...m!==void 0&&{step:m}}};if(u.type===`nested`){let e=V(g.json[v],u.groupId,v);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[u.nestedFieldId]){console.error(`Field "${u.nestedFieldId}" already exists in group "${u.groupId}"`),process.exitCode=1;return}e.group.config.fields[u.nestedFieldId]=y}else{for(let[e,t]of Object.entries(g.json)){if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[l]){console.error(`Field "${l}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}g.json[v][l]=y}try{await h.updateCustomType(g)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}u.type===`nested`?console.info(`Added field "${u.nestedFieldId}" (Number) to group "${u.groupId}" in ${c}`):console.info(`Added field "${l}" (Number) to "${v}" tab in ${c}`);try{await R({output:s}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function pr(){let{values:{help:e,tab:t,label:n,placeholder:r,single:i,multi:a,"allow-target-blank":o,types:s},positionals:[c,l]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a rich text field to an existing custom type.
414
+
415
+ USAGE
416
+ prismic custom-type add-field rich-text <type-id> <field-id> [flags]
417
+
418
+ ARGUMENTS
419
+ type-id Custom type identifier (required)
420
+ field-id Field identifier (required)
421
+
422
+ FLAGS
423
+ -t, --tab string Target tab (default: first existing tab, or "Main")
424
+ -l, --label string Display label for the field (inferred from field-id if omitted)
425
+ -p, --placeholder string Placeholder text
426
+ --single string Allowed block types for single-line (comma-separated)
427
+ --multi string Allowed block types for multi-line (comma-separated)
428
+ --allow-target-blank Allow opening links in new tab
429
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
430
+ -h, --help Show help for command
431
+
432
+ BLOCK TYPES
433
+ heading1, heading2, heading3, heading4, heading5, heading6,
434
+ paragraph, strong, em, preformatted, hyperlink, image, embed,
435
+ list-item, o-list-item, rtl
436
+
437
+ EXAMPLES
438
+ prismic custom-type add-field rich-text homepage body
439
+ prismic custom-type add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
440
+ prismic custom-type add-field rich-text page tagline --single "heading1"
441
+ prismic custom-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!c){console.error(`Missing required argument: type-id
442
+ `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
443
+ `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let u=z(l),d=U(u);if(!d.ok){console.error(d.error),process.exitCode=1;return}let f=await k();if(!f)return;let p;try{p=await f.readCustomType(c)}catch{console.error(`Custom type not found: ${c}\n\nCreate it first with: prismic custom-type create ${c}`),process.exitCode=1;return}let m=Object.keys(p.json),h=t??m[0]??`Main`;p.json[h]||(p.json[h]={});let g={type:`StructuredText`,config:{label:n??T(u.type===`nested`?u.nestedFieldId:l),...r&&{placeholder:r},...i&&{single:i},...a&&{multi:a},...o&&{allowTargetBlank:!0}}};if(u.type===`nested`){let e=V(p.json[h],u.groupId,h);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[u.nestedFieldId]){console.error(`Field "${u.nestedFieldId}" already exists in group "${u.groupId}"`),process.exitCode=1;return}e.group.config.fields[u.nestedFieldId]=g}else{for(let[e,t]of Object.entries(p.json)){if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[l]){console.error(`Field "${l}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}p.json[h][l]=g}try{await f.updateCustomType(p)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}u.type===`nested`?console.info(`Added field "${u.nestedFieldId}" (StructuredText) to group "${u.groupId}" in ${c}`):console.info(`Added field "${l}" (StructuredText) to "${h}" tab in ${c}`);try{await R({output:s}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function mr(){let{values:{help:e,tab:t,label:n,placeholder:r,option:i,default:a,types:o},positionals:[s,c]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a select (dropdown) field to an existing custom type.
444
+
445
+ USAGE
446
+ prismic custom-type add-field select <type-id> <field-id> [flags]
447
+
448
+ ARGUMENTS
449
+ type-id Custom type identifier (required)
450
+ field-id Field identifier (required)
451
+
452
+ FLAGS
453
+ -t, --tab string Target tab (default: first existing tab, or "Main")
454
+ -l, --label string Display label for the field (inferred from field-id if omitted)
455
+ -p, --placeholder string Placeholder text
456
+ --option string Add an option (can be used multiple times)
457
+ --default string Default selected value
458
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
459
+ -h, --help Show help for command
460
+
461
+ EXAMPLES
462
+ prismic custom-type add-field select homepage layout --option "full" --option "sidebar"
463
+ prismic custom-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
464
+ prismic custom-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!s){console.error(`Missing required argument: type-id
465
+ `),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
466
+ `),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let l=z(c),u=U(l);if(!u.ok){console.error(u.error),process.exitCode=1;return}let d=await k();if(!d)return;let f;try{f=await d.readCustomType(s)}catch{console.error(`Custom type not found: ${s}\n\nCreate it first with: prismic custom-type create ${s}`),process.exitCode=1;return}let p=Object.keys(f.json),m=t??p[0]??`Main`;f.json[m]||(f.json[m]={});let h={type:`Select`,config:{label:n??T(l.type===`nested`?l.nestedFieldId:c),...r&&{placeholder:r},...i&&i.length>0&&{options:i},...a&&{default_value:a}}};if(l.type===`nested`){let e=V(f.json[m],l.groupId,m);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[l.nestedFieldId]){console.error(`Field "${l.nestedFieldId}" already exists in group "${l.groupId}"`),process.exitCode=1;return}e.group.config.fields[l.nestedFieldId]=h}else{for(let[e,t]of Object.entries(f.json)){if(t[c]){console.error(`Field "${c}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[c]){console.error(`Field "${c}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}f.json[m][c]=h}try{await d.updateCustomType(f)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}l.type===`nested`?console.info(`Added field "${l.nestedFieldId}" (Select) to group "${l.groupId}" in ${s}`):console.info(`Added field "${c}" (Select) to "${m}" tab in ${s}`);try{await R({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function hr(){let{values:{help:e,tab:t,label:n,placeholder:r,default:i,types:a},positionals:[o,s]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a timestamp (date and time) field to an existing custom type.
467
+
468
+ USAGE
469
+ prismic custom-type add-field timestamp <type-id> <field-id> [flags]
470
+
471
+ ARGUMENTS
472
+ type-id Custom type identifier (required)
473
+ field-id Field identifier (required)
474
+
475
+ FLAGS
476
+ -t, --tab string Target tab (default: first existing tab, or "Main")
477
+ -l, --label string Display label for the field (inferred from field-id if omitted)
478
+ -p, --placeholder string Placeholder text
479
+ --default string Default timestamp value (ISO 8601 format)
480
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
481
+ -h, --help Show help for command
482
+
483
+ EXAMPLES
484
+ prismic custom-type add-field timestamp homepage event_time
485
+ prismic custom-type add-field timestamp event start --tab "Schedule"
486
+ prismic custom-type add-field timestamp article published_at --label "Published At"`);return}if(!o){console.error(`Missing required argument: type-id
487
+ `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!s){console.error(`Missing required argument: field-id
488
+ `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let c=z(s),l=U(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await k();if(!u)return;let d;try{d=await u.readCustomType(o)}catch{console.error(`Custom type not found: ${o}\n\nCreate it first with: prismic custom-type create ${o}`),process.exitCode=1;return}let f=Object.keys(d.json),p=t??f[0]??`Main`;d.json[p]||(d.json[p]={});let m={type:`Timestamp`,config:{label:n??T(c.type===`nested`?c.nestedFieldId:s),...r&&{placeholder:r},...i&&{default:i}}};if(c.type===`nested`){let e=V(d.json[p],c.groupId,p);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[c.nestedFieldId]){console.error(`Field "${c.nestedFieldId}" already exists in group "${c.groupId}"`),process.exitCode=1;return}e.group.config.fields[c.nestedFieldId]=m}else{for(let[e,t]of Object.entries(d.json)){if(t[s]){console.error(`Field "${s}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[s]){console.error(`Field "${s}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}d.json[p][s]=m}try{await u.updateCustomType(d)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}c.type===`nested`?console.info(`Added field "${c.nestedFieldId}" (Timestamp) to group "${c.groupId}" in ${o}`):console.info(`Added field "${s}" (Timestamp) to "${p}" tab in ${o}`);try{await R({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function gr(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a UID (unique identifier) field to an existing custom type.
489
+
490
+ USAGE
491
+ prismic custom-type add-field uid <type-id> <field-id> [flags]
492
+
493
+ ARGUMENTS
494
+ type-id Custom type identifier (required)
495
+ field-id Field identifier (required)
496
+
497
+ FLAGS
498
+ -t, --tab string Target tab (default: first existing tab, or "Main")
499
+ -l, --label string Display label for the field (inferred from field-id if omitted)
500
+ -p, --placeholder string Placeholder text
501
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
502
+ -h, --help Show help for command
503
+
504
+ EXAMPLES
505
+ prismic custom-type add-field uid page uid
506
+ prismic custom-type add-field uid article slug --label "URL Slug"
507
+ prismic custom-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!a){console.error(`Missing required argument: type-id
508
+ `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
509
+ `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}if(s.type===`nested`){console.error(`UID fields cannot be nested inside groups`),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Custom type not found: ${a}\n\nCreate it first with: prismic custom-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});for(let[e,t]of Object.entries(u.json))if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}let p={type:`UID`,config:{label:n??T(o),...r&&{placeholder:r}}};u.json[f][o]=p;try{await l.updateCustomType(u)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${o}" (UID) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function _r(){let{positionals:[e]}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`boolean`:await rr();break;case`color`:await ir();break;case`date`:await ar();break;case`embed`:await or();break;case`geo-point`:await sr();break;case`group`:await cr();break;case`image`:await lr();break;case`key-text`:await ur();break;case`link`:await dr();break;case`number`:await fr();break;case`rich-text`:await pr();break;case`select`:await mr();break;case`timestamp`:await hr();break;case`uid`:await gr();break;default:e&&(console.error(`Unknown field type: ${e}\n`),process.exitCode=1),console.info(`Add a field to an existing custom type.
510
+
511
+ USAGE
512
+ prismic custom-type add-field <field-type> <type-id> <field-id> [flags]
513
+
514
+ FIELD TYPES
515
+ boolean Boolean toggle
516
+ color Color picker
517
+ date Date picker
518
+ embed Embed (oEmbed)
519
+ geo-point Geographic coordinates
520
+ group Repeatable group of fields
521
+ image Image
522
+ key-text Single-line text
523
+ link Any link type
524
+ number Number
525
+ rich-text Rich text editor
526
+ select Dropdown select
527
+ timestamp Date and time
528
+ uid Unique identifier
529
+
530
+ FLAGS
531
+ -h, --help Show help for command
532
+
533
+ LEARN MORE
534
+ Use \`prismic custom-type add-field <field-type> --help\` for more information.
535
+
536
+ EXAMPLES
537
+ prismic custom-type add-field key-text homepage meta_title --tab "SEO"
538
+ prismic custom-type add-field link homepage button --allow-text
539
+ prismic custom-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
540
+ prismic custom-type add-field select homepage layout --option "full" --option "sidebar"`)}}async function vr(){let{values:{help:e,"slice-zone":t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Connect a shared slice to a custom type's slice zone.
541
+
542
+ USAGE
543
+ prismic custom-type connect-slice <type-id> <slice-id> [flags]
544
+
545
+ ARGUMENTS
546
+ type-id Custom type identifier (required)
547
+ slice-id Slice identifier (required)
548
+
549
+ FLAGS
550
+ -z, --slice-zone string Target slice zone field ID (default: "slices")
551
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
552
+ -h, --help Show help for command
553
+
554
+ EXAMPLES
555
+ prismic custom-type connect-slice homepage CallToAction
556
+ prismic custom-type connect-slice homepage CallToAction --slice-zone slices
557
+ prismic custom-type connect-slice article HeroSection -z body`);return}if(!r){console.error(`Missing required argument: type-id
558
+ `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: slice-id
559
+ `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let a=await k();if(!a)return;try{await a.readSlice(i)}catch{console.error(`Slice not found: ${i}`),process.exitCode=1;return}let o;try{o=await a.readCustomType(r)}catch{console.error(`Custom type not found: ${r}\n\nCreate it first with: prismic custom-type create ${r}`),process.exitCode=1;return}let s=t??`slices`,c,l;for(let[,e]of Object.entries(o.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===s){c=n,l=t;break}if(c)break}if(!c){if(t){console.error(`Slice zone "${t}" not found in custom type "${r}"`),process.exitCode=1;return}let e=Object.keys(o.json)[0]??`Main`;o.json[e]||(o.json[e]={});let n={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};o.json[e][s]=n,c=n,l=s}if(c.config||={choices:{}},c.config.choices||(c.config.choices={}),i in c.config.choices){console.info(`Slice "${i}" is already connected to slice zone "${l}" in ${r}`);return}let u={type:`SharedSlice`};c.config.choices[i]=u;try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Connected slice "${i}" to slice zone "${l}" in ${r}`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function yr(){let{values:{help:e,name:t,single:n,types:r},positionals:[i]}=A({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Create a new custom type in a Prismic repository.
560
+
561
+ USAGE
562
+ prismic custom-type create <id> [flags]
563
+
564
+ ARGUMENTS
565
+ id Custom type identifier (required)
566
+
567
+ FLAGS
568
+ -n, --name string Display name for the custom type
569
+ --single Create as a singleton (non-repeatable) type
570
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
571
+ -h, --help Show help for command
572
+
573
+ LEARN MORE
574
+ Use \`prismic custom-type <command> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: id`),process.exitCode=1;return}let a=await k();if(!a)return;let o={id:i,label:t??fe(i),repeatable:!n,status:!0,format:`custom`,json:{Main:n?{}:{uid:{type:`UID`,config:{label:`UID`,placeholder:``}}}}};try{await a.createCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to create custom type: ${e.message}`):console.error(`Failed to create custom type`),process.exitCode=1;return}console.info(`Created custom type "${i}"`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic custom-type add-field`")}async function br(){let{values:{help:e,"slice-zone":t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Disconnect a shared slice from a custom type's slice zone.
575
+
576
+ USAGE
577
+ prismic custom-type disconnect-slice <type-id> <slice-id> [flags]
578
+
579
+ ARGUMENTS
580
+ type-id Custom type identifier (required)
581
+ slice-id Slice identifier (required)
582
+
583
+ FLAGS
584
+ -z, --slice-zone string Target slice zone field ID (default: "slices")
585
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
586
+ -h, --help Show help for command
587
+
588
+ EXAMPLES
589
+ prismic custom-type disconnect-slice homepage CallToAction
590
+ prismic custom-type disconnect-slice homepage CallToAction --slice-zone slices
591
+ prismic custom-type disconnect-slice article HeroSection -z body`);return}if(!r){console.error(`Missing required argument: type-id
592
+ `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: slice-id
593
+ `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let a=await k();if(!a)return;let o;try{o=await a.readCustomType(r)}catch{console.error(`Custom type not found: ${r}\n\nCreate it first with: prismic custom-type create ${r}`),process.exitCode=1;return}let s=t??`slices`,c,l;for(let[,e]of Object.entries(o.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===s){c=n,l=t;break}if(c)break}if(!c){console.error(`Slice zone "${s}" not found in custom type "${r}"`),process.exitCode=1;return}if(!c.config?.choices||!(i in c.config.choices)){console.error(`Slice "${i}" is not connected to slice zone "${l}" in ${r}`),process.exitCode=1;return}delete c.config.choices[i];try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Disconnected slice "${i}" from slice zone "${l}" in ${r}`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const xr=u({id:p(),label:p(),repeatable:d(),status:d(),format:f(p()),json:s(p(),s(p(),de()))});async function Sr(){let{values:{help:e,json:t}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`List all custom types in a Prismic project.
594
+
595
+ USAGE
596
+ prismic custom-type list [flags]
597
+
598
+ FLAGS
599
+ --json Output as JSON
600
+ -h, --help Show help for command
601
+
602
+ EXAMPLES
603
+ prismic custom-type list
604
+ prismic custom-type list --json`);return}let n=await se(`package.json`);if(!n){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let r=new URL(`customtypes/`,n),i;try{i=await ge(r,{withFileTypes:!1})}catch{t?console.info(JSON.stringify([])):console.info(`No custom types found.`);return}let a=[];for(let e of i){let t=new URL(`${e}/index.json`,r);try{let e=await he(t,`utf8`),n=c(xr,JSON.parse(e));n.success&&n.output.format!==`page`&&a.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(a.length===0){t?console.info(JSON.stringify([])):console.info(`No custom types found.`);return}if(t)console.info(JSON.stringify(a,null,2));else{console.info(`ID LABEL TYPE`);for(let e of a){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}async function Cr(){let{values:{help:e,y:t,types:n},positionals:[r]}=A({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a custom type from the project.
605
+
606
+ USAGE
607
+ prismic custom-type remove <type-id> [flags]
608
+
609
+ ARGUMENTS
610
+ type-id Custom type identifier (required)
611
+
612
+ FLAGS
613
+ -y Confirm removal
614
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
615
+ -h, --help Show help for command
616
+
617
+ EXAMPLES
618
+ prismic custom-type remove settings
619
+ prismic custom-type remove settings -y`);return}if(!r){console.error(`Missing required argument: type-id
620
+ `),console.error(`Usage: prismic custom-type remove <type-id>`),process.exitCode=1;return}let i=await k();if(!i)return;let a;try{a=await i.readCustomType(r)}catch{console.error(`Custom type not found: ${r}\n\nCreate it first with: prismic custom-type create ${r}`),process.exitCode=1;return}if(a.format===`page`){console.error(`"${r}" is not a custom type (format: page)`),process.exitCode=1;return}if(!t){console.error(`Refusing to remove custom type "${r}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await i.deleteCustomType(r)}catch(e){e instanceof Error?console.error(`Failed to remove custom type: ${e.message}`):console.error(`Failed to remove custom type`),process.exitCode=1;return}console.info(`Removed custom type "${r}"`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function wr(){let{values:{help:e,tab:t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a field from a custom type.
621
+
622
+ USAGE
623
+ prismic custom-type remove-field <type-id> <field-id> [flags]
624
+
625
+ ARGUMENTS
626
+ type-id Custom type identifier (required)
627
+ field-id Field identifier (required)
628
+
629
+ FLAGS
630
+ --tab string Specific tab (searches all tabs if not specified)
631
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
632
+ -h, --help Show help for command
633
+
634
+ EXAMPLES
635
+ prismic custom-type remove-field settings title
636
+ prismic custom-type remove-field settings description --tab "Content"`);return}if(!r){console.error(`Missing required argument: type-id
637
+ `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: field-id
638
+ `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let a=await k();if(!a)return;let o;try{o=await a.readCustomType(r)}catch{console.error(`Custom type not found: ${r}\n\nCreate it first with: prismic custom-type create ${r}`),process.exitCode=1;return}if(o.format===`page`){console.error(`"${r}" is not a custom type (format: page)`),process.exitCode=1;return}let s;if(t){if(!o.json[t]){console.error(`Tab "${t}" not found in custom type "${r}"`),console.error(`Available tabs: ${Object.keys(o.json).join(`, `)}`),process.exitCode=1;return}if(!(i in o.json[t])){console.error(`Field "${i}" not found in tab "${t}"`),process.exitCode=1;return}delete o.json[t][i],s=t}else{for(let[e,t]of Object.entries(o.json))if(i in t){delete t[i],s=e;break}if(!s){console.error(`Field "${i}" not found in any tab of custom type "${r}"`),process.exitCode=1;return}}try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Removed field "${i}" from tab "${s}" in custom type "${r}"`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Tr(){let{values:{help:e,types:t},positionals:[n,r]}=A({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Change a custom type's display name (label).
639
+
640
+ USAGE
641
+ prismic custom-type set-name <type-id> <new-name> [flags]
642
+
643
+ ARGUMENTS
644
+ type-id Custom type identifier (required)
645
+ new-name New display name (required)
646
+
647
+ FLAGS
648
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
649
+ -h, --help Show help for command
650
+
651
+ EXAMPLES
652
+ prismic custom-type set-name settings "Site Settings"
653
+ prismic custom-type set-name menu "Navigation Menu"`);return}if(!n){console.error(`Missing required argument: type-id
654
+ `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!r){console.error(`Missing required argument: new-name
655
+ `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}let i=await k();if(!i)return;let a;try{a=await i.readCustomType(n)}catch{console.error(`Custom type not found: ${n}\n\nCreate it first with: prismic custom-type create ${n}`),process.exitCode=1;return}if(a.format===`page`){console.error(`"${n}" is not a custom type (format: page)`),process.exitCode=1;return}a.label=r;try{await i.updateCustomType(a)}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Renamed custom type "${n}" to "${r}"`);try{await R({output:t}),console.info(`Updated types in ${t??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Er=u({id:p(),label:p(),repeatable:d(),status:d(),format:f(p()),json:s(p(),s(p(),de()))});async function Dr(){let{values:{help:e,json:t},positionals:[n]}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`View details of a specific custom type.
656
+
657
+ USAGE
658
+ prismic custom-type view <type-id> [flags]
659
+
660
+ ARGUMENTS
661
+ type-id Custom type identifier (required)
662
+
663
+ FLAGS
664
+ --json Output as JSON
665
+ -h, --help Show help for command
666
+
667
+ EXAMPLES
668
+ prismic custom-type view settings
669
+ prismic custom-type view settings --json`);return}if(!n){console.error(`Missing required argument: type-id
670
+ `),console.error(`Usage: prismic custom-type view <type-id>`),process.exitCode=1;return}let r=await se(`package.json`);if(!r){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let i=new URL(`customtypes/${n}/index.json`,r),a;try{let e=await he(i,`utf8`),t=c(Er,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${i.href}`),process.exitCode=1;return}a=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${n}\n`),console.error(`Create it first with: prismic custom-type create ${n}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(a.format===`page`){console.error(`"${n}" is not a custom type (format: page)`),process.exitCode=1;return}if(t){console.info(JSON.stringify(a,null,2));return}console.info(`ID: ${a.id}`),console.info(`Label: ${a.label}`),console.info(`Repeatable: ${a.repeatable}`);let o=Object.entries(a.json);console.info(`\nTabs (${o.length}):`);for(let[e,t]of o){let n=Object.keys(t).length;console.info(` - ${e}: ${n} fields`)}}async function Or(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`create`:await yr();break;case`list`:await Sr();break;case`view`:await Dr();break;case`remove`:await Cr();break;case`set-name`:await Tr();break;case`add-field`:await _r();break;case`remove-field`:await wr();break;case`connect-slice`:await vr();break;case`disconnect-slice`:await br();break;default:e&&(console.error(`Unknown custom-type subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage custom types in a Prismic repository.
671
+
672
+ USAGE
673
+ prismic custom-type <command> [flags]
674
+
675
+ COMMANDS
676
+ create Create a new custom type
677
+ list List all custom types
678
+ view View details of a custom type
679
+ remove Remove a custom type
680
+ set-name Change a custom type's display name
681
+ add-field Add a field to a custom type
682
+ remove-field Remove a field from a custom type
683
+ connect-slice Connect a shared slice to a custom type
684
+ disconnect-slice Disconnect a shared slice from a custom type
685
+
686
+ FLAGS
687
+ -h, --help Show help for command
688
+
689
+ LEARN MORE
690
+ Use \`prismic custom-type <command> --help\` for more information about a command.`)}}const kr=`Fetch and display documentation from Prismic's docs site.
691
+
692
+ USAGE
693
+ prismic docs fetch <path> [flags]
694
+
695
+ ARGUMENTS
696
+ path Documentation path with optional anchor (e.g., "nextjs" or "nextjs#set-up-a-prismic-client")
697
+
698
+ FLAGS
699
+ -h, --help Show help for command
700
+
701
+ EXAMPLES
702
+ prismic docs fetch nextjs
703
+ prismic docs fetch nextjs#set-up-a-prismic-client
704
+
705
+ LEARN MORE
706
+ Visit https://prismic.io/docs for the full documentation.`;function Ar(e){let t=e.indexOf(`#`);return t===-1?{path:e}:{path:e.slice(0,t),anchor:e.slice(t+1)}}async function jr(e){try{let t=await fetch(e);return t.status===404?{ok:!1,error:`Documentation not found: ${e}`}:t.ok?{ok:!0,content:await t.text()}:{ok:!1,error:`Failed to fetch documentation: ${t.status}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:String(e)}`}}}function Mr(e){let t=e.split(`-`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`[\\s-]+`);return RegExp(`^(#{1,6})\\s+${t}\\s*$`,`im`)}function Nr(e,t){let n=e.split(`
707
+ `),r=Mr(t),i=-1,a=0;for(let e=0;e<n.length;e++){let t=n[e].match(r);if(t){i=e,a=t[1].length;break}}if(i===-1)return{ok:!1,error:`Anchor not found: #${t}`};let o=n.length;for(let e=i+1;e<n.length;e++){let t=n[e].match(/^(#{1,6})\s/);if(t&&t[1].length<=a){o=e;break}}return{ok:!0,content:n.slice(i,o).join(`
708
+ `).trim()}}async function Pr(){let{positionals:[e],values:{help:t}}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(kr);return}if(!e){console.info(kr);return}let{path:n,anchor:r}=Ar(e),i=await jr(`https://prismic.io/docs/${n}.md`);if(!i.ok){console.error(i.error),process.exitCode=1;return}let a=i.content;if(r){let e=Nr(a,r);if(!e.ok){console.error(e.error),process.exitCode=1;return}a=e.content}console.info(a)}const Fr=`https://prismic.io/docs/sitemap.xml`;function Ir(e){return e.replaceAll(`&amp;`,`&`).replaceAll(`&lt;`,`<`).replaceAll(`&gt;`,`>`).replaceAll(`&quot;`,`"`).replaceAll(`&apos;`,`'`)}function Lr(e){let t=/<loc>(.*?)<\/loc>/g,n=[],r=t.exec(e);for(;r;)n.push(Ir(r[1]).trim()),r=t.exec(e);return n.filter(Boolean)}async function Rr(e){try{let t=await fetch(e);return t.ok?{ok:!0,xml:await t.text()}:{ok:!1,error:`Failed to fetch sitemap: ${t.status} (${e})`}}catch(t){return{ok:!1,error:`Network error while fetching sitemap ${e}: ${t instanceof Error?t.message:String(t)}`}}}function zr(e){try{let t=new URL(e);return t.hostname!==`prismic.io`||!t.pathname.startsWith(`/docs/`)?null:t.pathname.replace(/^\/docs\//,``).replace(/^\/+|\/+$/g,``)}catch{return null}}async function Br(){let{values:{help:e}}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`List documentation pages from Prismic's docs site.
709
+
710
+ USAGE
711
+ prismic docs list [flags]
712
+
713
+ FLAGS
714
+ -h, --help Show help for command
715
+
716
+ EXAMPLES
717
+ prismic docs list`);return}let t=await Rr(Fr);if(!t.ok){console.error(t.error),process.exitCode=1;return}let n=Lr(t.xml);if(n.length===0){console.error(`No nested sitemaps found in ${Fr}`),process.exitCode=1;return}let r=await Promise.all(n.map(e=>Rr(e))),i=r.find(e=>!e.ok);if(i&&!i.ok){console.error(i.error),process.exitCode=1;return}let a=new Set;for(let e of r)if(e.ok)for(let t of Lr(e.xml)){let e=zr(t);e&&a.add(e)}for(let e of[...a].sort((e,t)=>e.localeCompare(t)))console.info(e)}async function Vr(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`fetch`:await Pr();break;case`list`:await Br();break;default:e&&(console.error(`Unknown docs subcommand: ${e}\n`),process.exitCode=1),console.info(`Fetch and list documentation from Prismic's docs site.
718
+
719
+ USAGE
720
+ prismic docs <command> [flags]
721
+
722
+ COMMANDS
723
+ fetch Fetch and display a documentation page
724
+ list List documentation pages
725
+
726
+ FLAGS
727
+ -h, --help Show help for command
728
+
729
+ EXAMPLES
730
+ prismic docs fetch nextjs
731
+ prismic docs fetch nextjs#set-up-a-prismic-client
732
+ prismic docs list
733
+
734
+ LEARN MORE
735
+ Use \`prismic docs <command> --help\` for more information about a command.`)}}const Hr=process.env.PRISMIC_ENV&&process.env.PRISMIC_ENV!==`production`?`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`:`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`;let Ur=!1,Wr=``,Gr=``;const Kr={app:{name:Xe,version:Ze}},qr=[];async function Jr(){try{if(Ur=await $r(),!Ur)return;Wr=xe(),Gr=`Basic ${btoa(Hr+`:`)}`,process.on(`exit`,Zr)}catch{Ur=!1}}function Yr(e){Ur&&qr.push({event:`Prismic CLI Start`,properties:{commandType:e,fullCommand:process.argv.join(` `)}})}function Xr(e,t,n){if(!Ur)return;let r={commandType:e,fullCommand:process.argv.join(` `),success:t};n!==void 0&&(r.error=(n instanceof Error?n.message:String(n)).slice(0,512)),qr.push({event:`Prismic CLI End`,properties:r})}function Zr(){if(qr.length!==0){try{let e=Buffer.from(JSON.stringify({url:`https://api.segment.io/v1/track`,authorization:Gr,events:qr.map(e=>({anonymousId:Wr,event:e.event,properties:{nodeVersion:process.versions.node,...e.properties},context:Kr,timestamp:new Date().toISOString()}))})).toString(`base64`);je(process.execPath,[`--input-type=module`,`-e`,Qr,e],{detached:!0,stdio:`ignore`}).unref()}catch{}qr.length=0}}const Qr=`
736
+ const {url, authorization, events} = JSON.parse(Buffer.from(process.argv[1], "base64"));
737
+ const h = {"Content-Type": "application/json", Authorization: authorization};
738
+ await Promise.allSettled(events.map(e => fetch(url, {method: "POST", headers: h, body: JSON.stringify(e)}).catch(() => {})));
739
+ `;async function $r(){try{return!((await ei(we(Oe(),`.prismicrc`)))?.telemetry===!1||(await ei(we(process.cwd(),`.prismicrc`)))?.telemetry===!1)}catch{return!0}}async function ei(e){try{let t=await he(e,`utf8`);return JSON.parse(t)}catch{return}}const W=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,G=globalThis,ti=`10.42.0`;function ni(){return ri(G),G}function ri(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||ti,t[ti]=t[ti]||{}}function ii(e,t,n=G){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[ti]=r[ti]||{};return i[e]||(i[e]=t())}const ai=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],oi={};function si(e){if(!(`console`in G))return e();let t=G.console,n={},r=Object.keys(oi);r.forEach(e=>{let r=oi[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function ci(){hi().enabled=!0}function li(){hi().enabled=!1}function ui(){return hi().enabled}function di(...e){mi(`log`,...e)}function fi(...e){mi(`warn`,...e)}function pi(...e){mi(`error`,...e)}function mi(e,...t){W&&ui()&&si(()=>{G.console[e](`Sentry Logger [${e}]:`,...t)})}function hi(){return W?ii(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const K={enable:ci,disable:li,isEnabled:ui,log:di,warn:fi,error:pi},gi=/\(error: (.*)\)/,_i=/captureMessage|captureException/;function vi(...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(`
740
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=gi.test(n)?n.replace(gi,`$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 bi(i.slice(r))}}function yi(e){return Array.isArray(e)?vi(...e):e}function bi(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(xi(t).function||``)&&t.pop(),t.reverse(),_i.test(xi(t).function||``)&&(t.pop(),_i.test(xi(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||xi(t).filename,function:e.function||`?`}))}function xi(e){return e[e.length-1]||{}}const Si=`<anonymous>`;function Ci(e){try{return!e||typeof e!=`function`?Si:e.name||Si}catch{return Si}}function wi(e){return`__v_isVNode`in e&&e.__v_isVNode?`[VueVNode]`:`[VueViewModel]`}function Ti(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Ei={},Di={};function Oi(e,t){Ei[e]=Ei[e]||[],Ei[e].push(t)}function ki(e,t){if(!Di[e]){Di[e]=!0;try{t()}catch(t){W&&K.error(`Error while instrumenting ${e}`,t)}}}function Ai(e,t){let n=e&&Ei[e];if(n)for(let r of n)try{r(t)}catch(t){W&&K.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Ci(r)}\nError:`,t)}}let ji=null;function Mi(e){let t=`error`;Oi(t,e),ki(t,Ni)}function Ni(){ji=G.onerror,G.onerror=function(e,t,n,r,i){return Ai(`error`,{column:r,error:i,line:n,msg:e,url:t}),ji?ji.apply(this,arguments):!1},G.onerror.__SENTRY_INSTRUMENTED__=!0}let Pi=null;function Fi(e){let t=`unhandledrejection`;Oi(t,e),ki(t,Ii)}function Ii(){Pi=G.onunhandledrejection,G.onunhandledrejection=function(e){return Ai(`unhandledrejection`,e),Pi?Pi.apply(this,arguments):!0},G.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Li=Object.prototype.toString;function Ri(e){switch(Li.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Xi(e,Error)}}function zi(e,t){return Li.call(e)===`[object ${t}]`}function Bi(e){return zi(e,`ErrorEvent`)}function Vi(e){return zi(e,`String`)}function Hi(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function Ui(e){return e===null||Hi(e)||typeof e!=`object`&&typeof e!=`function`}function Wi(e){return zi(e,`Object`)}function Gi(e){return typeof Event<`u`&&Xi(e,Event)}function Ki(e){return typeof Element<`u`&&Xi(e,Element)}function qi(e){return zi(e,`RegExp`)}function Ji(e){return!!(e?.then&&typeof e.then==`function`)}function Yi(e){return Wi(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function Xi(e,t){try{return e instanceof t}catch{return!1}}function Zi(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue||e.__v_isVNode))}const Qi=G;function $i(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=ea(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 ea(e,t){let n=e,r=[];if(!n?.tagName)return``;if(Qi.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&&Vi(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 ta(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&ra(i,r);try{e[t]=i}catch{W&&K.log(`Failed to replace method "${t}" in object`,e)}}function na(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 ra(e,t){try{e.prototype=t.prototype=t.prototype||{},na(e,`__sentry_original__`,t)}catch{}}function ia(e){return e.__sentry_original__}function aa(e){if(Ri(e))return{message:e.message,name:e.name,stack:e.stack,...sa(e)};if(Gi(e)){let t={type:e.type,target:oa(e.target),currentTarget:oa(e.currentTarget),...sa(e)};return typeof CustomEvent<`u`&&Xi(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function oa(e){try{return Ki(e)?$i(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function sa(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 ca(e){let t=Object.keys(aa(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let la;function ua(e){if(la!==void 0)return la?la(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=G;return t in n&&typeof n[t]==`function`?(la=n[t],la(e)):(la=null,e())}function da(){return ua(()=>Math.random())}function fa(){return ua(()=>Date.now())}function pa(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function ma(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 ha(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{Zi(r)?n.push(wi(r)):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function ga(e,t,n=!1){return Vi(e)?qi(t)?t.test(e):Vi(t)?n?e===t:e.includes(t):!1:!1}function _a(e,t=[],n=!1){return t.some(t=>ga(e,t,n))}function va(){let e=G;return e.crypto||e.msCrypto}let ya;function ba(){return da()*16}function q(e=va()){try{if(e?.randomUUID)return ua(()=>e.randomUUID()).replace(/-/g,``)}catch{}return ya||=`10000000100040008000100000000000`,ya.replace(/[018]/g,e=>(e^(ba()&15)>>e/4).toString(16))}function xa(e){return e.exception?.values?.[0]}function Sa(e){let{message:t,event_id:n}=e;if(t)return t;let r=xa(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Ca(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 wa(e,t){let n=xa(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}const Ta=/^(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 Ea(e){return parseInt(e||``,10)}function Da(e){let t=e.match(Ta)||[],n=Ea(t[1]),r=Ea(t[2]),i=Ea(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 Oa(e){if(ka(e))return!0;try{na(e,`__sentry_captured__`,!0)}catch{}return!1}function ka(e){try{return e.__sentry_captured__}catch{}}const Aa=1e3;function ja(){return fa()/Aa}function Ma(){let{performance:e}=G;if(!e?.now||!e.timeOrigin)return ja;let t=e.timeOrigin;return()=>(t+ua(()=>e.now()))/Aa}let Na;function Pa(){return(Na??=Ma())()}function Fa(e){let t=Pa(),n={sid:q(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Ra(n)};return e&&Ia(n,e),n}function Ia(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||Pa(),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 La(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Ia(e,n)}function Ra(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 za(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]=za(r[e],t[e],n-1));return r}function Ba(){return q()}function Va(){return q().substring(16)}const Ha=`_sentrySpan`;function Ua(e,t){t?na(e,Ha,t):delete e[Ha]}function Wa(e){return e[Ha]}var Ga=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:Ba(),sampleRand:da()}}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,Ua(t,Wa(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&&Ia(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():Wi(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,Ua(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ba(),sampleRand:da()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:ja(),...e,message:e.message?pa(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Wa(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=za(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 Ka(){return ii(`defaultCurrentScope`,()=>new Ga)}function qa(){return ii(`defaultIsolationScope`,()=>new Ga)}var Ja=class{constructor(e,t){let n;n=e||new Ga;let r;r=t||new Ga,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 Ji(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 Ya(){let e=ri(ni());return e.stack=e.stack||new Ja(Ka(),qa())}function Xa(e){return Ya().withScope(e)}function Za(e,t){let n=Ya();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Qa(e){return Ya().withScope(()=>e(Ya().getIsolationScope()))}function $a(){return{withIsolationScope:Qa,withScope:Xa,withSetScope:Za,withSetIsolationScope:(e,t)=>Qa(t),getCurrentScope:()=>Ya().getScope(),getIsolationScope:()=>Ya().getIsolationScope()}}function eo(e){let t=ri(ni());t.acs=e}function to(e){let t=ri(e);return t.acs?t.acs:$a()}function J(){return to(ni()).getCurrentScope()}function no(){return to(ni()).getIsolationScope()}function ro(){return ii(`globalScope`,()=>new Ga)}function io(...e){let t=to(ni());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function ao(...e){let t=to(ni());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function Y(){return J().getClient()}function oo(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Va()};return n&&(i.parent_span_id=n),i}const so=`sentry.profile_id`,co=`sentry.exclusive_time`;function lo(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}function uo(e){let t=e;return{scope:t._sentryScope,isolationScope:lo(t._sentryIsolationScope)}}const fo=/^sentry-/;function po(e){let t=ho(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(fo)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function mo(e){if(e)return _o(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`sentry-${t}`]=n),e),{}))}function ho(e){if(!(!e||!Vi(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=go(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):go(e)}function go(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 _o(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 vo=/^o(\d+)\./,yo=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function bo(e){return e===`http`||e===`https`}function xo(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 So(e){let t=yo.exec(e);if(!t){si(()=>{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 Co({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function Co(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function wo(e){if(!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+$/)?bo(r)?t&&isNaN(parseInt(t,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function To(e){return e.match(vo)?.[1]}function Eo(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=To(n)),r}function Do(e){let t=typeof e==`string`?So(e):Co(e);if(!(!t||!wo(t)))return t}function Oo(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 ko=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Ao(e){if(!e)return;let t=e.match(ko);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 jo(e,t){let n=Ao(e),r=po(t);if(!n?.traceId)return{traceId:Ba(),sampleRand:da()};let i=Po(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 Mo(e=Ba(),t=Va(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function No(e=Ba(),t=Va(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Po(e,t){let n=Oo(t?.sample_rand);if(n!==void 0)return n;let r=Oo(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?da()*r:r+da()*(1-r):da()}function Fo(e,t){let n=Eo(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 Io=!1;function Lo(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Uo(e).parent_span_id,a=uo(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Va():t,trace_id:n}}function Ro(e){let{traceId:t,spanId:n}=e.spanContext();return Mo(t,n,Ko(e))}function zo(e){let{traceId:t,spanId:n}=e.spanContext();return No(t,n,Ko(e))}function Bo(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 Vo(e){return typeof e==`number`?Ho(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Ho(e.getTime()):Pa()}function Ho(e){return e>9999999999?e/1e3:e}function Uo(e){if(Go(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Wo(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:Vo(i),timestamp:Vo(o)||void 0,status:qo(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:Bo(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Wo(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Go(e){return typeof e.getSpanJSON==`function`}function Ko(e){let{traceFlags:t}=e.spanContext();return t===1}function qo(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}function Jo(e){return e._sentryRootSpan||e}function Yo(){let e=to(ni());return e.getActiveSpan?e.getActiveSpan():Wa(J())}function Xo(){Io||=(si(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}let Zo=!1;function Qo(){if(Zo)return;function e(){let e=Yo(),t=e&&Jo(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`,Zo=!0,Mi(e),Fi(e)}function $o(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||Y()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function es(e){K.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ts(e,t){if(!t?.length||!e.description)return!1;for(let n of t){if(rs(n)){if(ga(e.description,n))return W&&es(e),!0;continue}if(!n.name&&!n.op)continue;let t=n.name?ga(e.description,n.name):!0,r=n.op?e.op&&ga(e.op,n.op):!0;if(t&&r)return W&&es(e),!0}return!1}function ns(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 rs(e){return typeof e==`string`||e instanceof RegExp}const is=`production`;function as(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||is,release:n.release,public_key:r,trace_id:e,org_id:Eo(t)};return t.emit(`createDsc`,i),i}function os(e,t){let n=t.getPropagationContext();return n.dsc||as(n.traceId,e)}function ss(e){let t=Y();if(!t)return{};let n=Jo(e),r=Uo(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n._frozenDsc;if(c)return s(c);let l=a?.get(`sentry.dsc`),u=l&&po(l);if(u)return s(u);let d=as(e.spanContext().traceId,t),f=i[`sentry.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),$o()&&(d.sampled=String(Ko(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??uo(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function cs(e,t=100,n=1/0){try{return us(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function ls(e,t=3,n=100*1024){let r=cs(e,t);return ms(r)>n?ls(e,t-1,n):r}function us(e,t,n=1/0,r=1/0,i=hs()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=ds(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 us(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=aa(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]=us(e,t,c-1,r,i),d++}return o(t),u}function ds(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(Zi(t))return wi(t);if(Yi(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Ci(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=fs(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function fs(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function ps(e){return~-encodeURI(e).split(/%..|./).length}function ms(e){return ps(JSON.stringify(e))}function hs(){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 gs(e,t=[]){return[e,t]}function _s(e,t){let[n,r]=e;return[n,[...r,t]]}function vs(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 ys(e,t){return vs(e,(e,n)=>t.includes(n))}function bs(e){let t=ri(G);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function xs(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[bs(r),e]:r.push(typeof e==`string`?bs(e):e)}for(let e of n){let[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(cs(n))}i(e)}}return typeof r==`string`?r:Ss(r)}function Ss(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 Cs(e){let t=typeof e.data==`string`?bs(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const ws={session:`session`,sessions:`session`,attachment:`attachment`,transaction:`transaction`,event:`error`,client_report:`internal`,user_report:`default`,profile:`profile`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,feedback:`feedback`,span:`span`,raw_security:`security`,log:`log_item`,metric:`metric`,trace_metric:`metric`};function Ts(e){return ws[e]}function Es(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Ds(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:xo(r)},...i&&{trace:i}}}function Os(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 ks(e,t,n,r){let i=Es(n);return gs({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:xo(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function As(e,t,n,r){let i=Es(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Os(e,n?.sdk);let o=Ds(e,i,r,t);return delete e.sdkProcessingMetadata,gs(o,[[{type:a},e]])}const js=`__SENTRY_SUPPRESS_TRACING__`,Ms=(e,t)=>{let n=to(ni());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=Y(),o=po(i);return a&&!Fo(a,o?.org_id)?Fs(t):io(e=>{let n=jo(r,i);return e.setPropagationContext(n),Ua(e,void 0),t()})};function Ns(e,t){let n=Is();return n.withActiveSpan?n.withActiveSpan(e,t):io(n=>(Ua(n,e||void 0),t(n)))}function Ps(e){let t=Is();return t.suppressTracing?t.suppressTracing(e):io(t=>{t.setSDKProcessingMetadata({[js]:!0});let n=e();return t.setSDKProcessingMetadata({[js]:void 0}),n})}function Fs(e){return io(t=>(t.setPropagationContext({traceId:Ba(),sampleRand:da()}),W&&K.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),Ns(null,e)))}function Is(){return to(ni())}function Ls(e){return new zs(t=>{t(e)})}function Rs(e){return new zs((t,n)=>{n(e)})}var zs=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(Ji(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 Bs(e,t,n,r=0){try{let i=Vs(t,n,e,r);return Ji(i)?i:Ls(i)}catch(e){return Rs(e)}}function Vs(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`),Ji(a)?a.then(e=>Vs(e,t,n,r+1)):Vs(a,t,n,r+1)}let Hs,Us,Ws,Gs;function Ks(e){let t=G._sentryDebugIds,n=G._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Gs&&r.length===Us&&i.length===Ws)return Gs;Us=r.length,Ws=i.length,Gs={},Hs||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Hs?.[r];if(i&&Gs&&t)Gs[i[0]]=t,Hs&&(Hs[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&&Gs&&Hs){Gs[i]=t,Hs[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Gs}function qs(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Zs(e,t),r&&ec(e,r),tc(e,n),Qs(e,i),$s(e,a)}function Js(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;Ys(e,`extra`,n),Ys(e,`tags`,r),Ys(e,`attributes`,i),Ys(e,`user`,a),Ys(e,`contexts`,o),e.sdkProcessingMetadata=za(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 Ys(e,t,n){e[t]=za(e[t],n,1)}function Xs(e,t){let n=ro().getScopeData();return e&&Js(n,e.getScopeData()),t&&Js(n,t.getScopeData()),n}function Zs(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 Qs(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function $s(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function ec(e,t){e.contexts={trace:Lo(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ss(t),...e.sdkProcessingMetadata};let n=Uo(Jo(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function tc(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 nc(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||ja()},l=n.integrations||e.integrations.map(e=>e.name);rc(c,e),oc(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&ic(c,e.stackParser);let u=cc(r,n.captureContext);n.mechanism&&wa(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Xs(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),qs(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Ls(c):Bs(m,c,n)).then(e=>(e&&ac(e),typeof o==`number`&&o>0?sc(e,o,s):e))}function rc(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||is,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=pa(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=pa(e.value,a)})}function ic(e,t){let n=Ks(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function ac(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 oc(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function sc(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:cs(e.data,t,n)}}))},...e.user&&{user:cs(e.user,t,n)},...e.contexts&&{contexts:cs(e.contexts,t,n)},...e.extra&&{extra:cs(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=cs(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:cs(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=cs(e.contexts.flags,3,n)),r}function cc(e,t){if(!t)return e;let n=e?e.clone():new Ga;return n.update(t),n}function lc(e){if(e)return uc(e)||fc(e)?{captureContext:e}:e}function uc(e){return e instanceof Ga||typeof e==`function`}const dc=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function fc(e){return Object.keys(e).some(e=>dc.includes(e))}function pc(e,t){return J().captureException(e,lc(t))}function mc(e,t){no().setContext(e,t)}async function hc(e){let t=Y();return t?t.flush(e):(W&&K.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function gc(){let e=Y();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function _c(e){let t=no(),{user:n}=Xs(t,J()),{userAgent:r}=G.navigator||{},i=Fa({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Ia(a,{status:`exited`}),vc(),t.setSession(i),i}function vc(){let e=no(),t=J().getSession()||e.getSession();t&&La(t),yc(),e.setSession()}function yc(){let e=no(),t=Y(),n=e.getSession();n&&t&&t.captureSession(n)}function bc(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function xc(e){return`${bc(e)}${e.projectId}/envelope/`}function Sc(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 Cc(e,t,n){return t||`${xc(e)}?${Sc(e,n)}`}const wc=[];function Tc(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 Ec(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 Tc(r)}function Dc(e,t){let n={};return t.forEach(t=>{t&&kc(e,t,n)}),n}function Oc(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function kc(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,!wc.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),wc.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 X(e){return e}function Ac(e,t){return t?io(t,()=>{let n=Yo(),r=n?Lo(n):oo(t);return[n?ss(n):os(e,t),r]}):[void 0,void 0]}function jc(e){return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{items:e}]}function Mc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=xo(r)),gs(i,[jc(e)])}function Nc(e,t){let n=t??Pc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Mc(n,r._metadata,r.tunnel,e.getDsn());Fc().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Pc(e){return Fc().get(e)}function Fc(){return ii(`clientToLogBufferMap`,()=>new WeakMap)}function Ic(e){return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{items:e}]}function Lc(e,t,n,r){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=xo(r)),gs(i,[Ic(e)])}function Rc(e,t){let n=t??zc(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Lc(n,r._metadata,r.tunnel,e.getDsn());Bc().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function zc(e){return Bc().get(e)}function Bc(){return ii(`clientToMetricBufferMap`,()=>new WeakMap)}function Vc(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}const Hc=Symbol.for(`SentryBufferFullError`);function Uc(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Rs(Hc);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Ls(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Vc(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function Wc(e,t=fa()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function Gc(e,t){return e[t]||e.all||0}function Kc(e,t,n=fa()){return Gc(e,t)>n}function qc(e,{statusCode:t,headers:n},r=fa()){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+Wc(o,r):t===429&&(i.all=r+60*1e3);return i}function Jc(e,t,n=Uc(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(vs(i,(t,n)=>{let i=Ts(n);Kc(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=gs(i[0],a),s=t=>{if(ys(o,[`client_report`])){W&&K.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}vs(o,(n,r)=>{e.recordDroppedEvent(t,Ts(r))})};return n.add(()=>t({body:xs(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=qc(r,e),e),e=>{throw s(`network_error`),W&&K.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===Hc)return W&&K.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Yc(e,t,n){let r=[{type:`client_report`},{timestamp:n||ja(),discarded_events:e}];return gs(t?{dsn:t}:{},[r])}function Xc(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 Zc(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?.[so],exclusive_time:o?.[co],measurements:e.measurements,is_segment:!0}}function Qc(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&&{[so]:e.profile_id},...e.exclusive_time&&{[co]:e.exclusive_time}}}},measurements:e.measurements}}const $c=`Not capturing exception because it's already been captured.`,el=`Discarded session because of missing or non-string release`,tl=Symbol.for(`SentryInternalError`),nl=Symbol.for(`SentryDoNotSendEventError`);function rl(e){return{message:e,[tl]:!0}}function il(e){return{message:e,[nl]:!0}}function al(e){return!!e&&typeof e==`object`&&tl in e}function ol(e){return!!e&&typeof e==`object`&&nl in e}function sl(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=Vc(setTimeout(()=>{i(e)},5e3)))}),e.on(`flush`,()=>{i(e)})}var cl=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Uc(e.transportOptions?.bufferSize??64),e.dsn?this._dsn=Do(e.dsn):W&&K.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Cc(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&&sl(this,`afterCaptureLog`,`flushLogs`,hl,Nc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&sl(this,`afterCaptureMetric`,`flushMetrics`,ml,Rc)}captureException(e,t,n){let r=q();if(Oa(e))return W&&K.log($c),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=Hi(e)?e:String(e),o=Ui(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&&Oa(t.originalException))return W&&K.log($c),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=ll(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Ia(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){Nc(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];kc(this,e,this._integrations),t||Oc(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=As(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=_s(n,Cs(e));this.sendEnvelope(n).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=is}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){W&&K.warn(el);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){W&&K.warn(el);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=ks(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=Dc(this,e),Oc(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)&&(Ia(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),nc(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:oo(n),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:os(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=J(),r=no()){return W&&fl(e)&&K.log(`Captured error event \`${Xc(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{W&&(ol(e)?K.log(e.message):al(e)?K.warn(e.message):K.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=pl(e),s=fl(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Oo(a);if(s&&typeof l==`number`&&da()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Rs(il(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=ll(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),il("An event processor returned `null`, will not send event.");return t.data&&t.data.__sentry__===!0?e:ul(dl(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 il(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw ol(e)||al(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),rl(`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===Hc&&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=Yc(e,this._options.tunnel&&xo(this._dsn));this.sendEnvelope(t)}};function ll(e){return e===`replay_event`?`replay`:e||`error`}function ul(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Ji(e))return e.then(e=>{if(!Wi(e)&&e!==null)throw rl(n);return e},e=>{throw rl(`${t} rejected with ${e}`)});if(!Wi(e)&&e!==null)throw rl(n);return e}function dl(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:o,ignoreSpans:s}=t,c=n;if(fl(c)&&i)return i(c,r);if(pl(c)){if(o||s){let t=Zc(c);if(s?.length&&ts(t,s))return null;if(o){let e=o(t);e?c=za(n,Qc(e)):Xo()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(s?.length&&ts(e,s)){ns(n,e);continue}if(o){let n=o(e);n?t.push(n):(Xo(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function fl(e){return e.type===void 0}function pl(e){return e.type===`transaction`}function ml(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+gl(e.attributes)}function hl(e){let t=0;return e.message&&(t+=e.message.length*2),t+gl(e.attributes)}function gl(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*_l(e[0]):Ui(e)?t+=_l(e):t+=100}),t}function _l(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function vl(e,t,n,r,i){let a={sent_at:new Date().toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=xo(i)),t&&(a.trace=t),gs(a,[yl(e)])}function yl(e){return[{type:`check_in`},e]}function bl(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 xl(e,t){return e(t.stack||``,1)}function Sl(e){return Ri(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Cl(e){return Sl(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function wl(e,t){let n={type:t.name||t.constructor.name,value:Cl(t)},r=xl(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Tl(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(n instanceof Error)return n}}function El(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=ca(e);if(Bi(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Dl(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Dl(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Ol(e,t,n,r){if(Ri(n))return[n,void 0];if(t.synthetic=!0,Wi(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:ls(n,t)},a=Tl(n);if(a)return[a,i];let o=El(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 kl(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Ol(e,i,n,r),s={exception:{values:[wl(t,a)]}};return o&&(s.extra=o),Ca(s,void 0,void 0),wa(s,i),{...s,event_id:r?.event_id}}function Al(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=xl(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},wa(a,{synthetic:!0}))}if(Hi(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 jl=class extends cl{constructor(e){Qo(),bl(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,t){let n=kl(this,this._options.stackParser,e,t);return n.level=`error`,Ls(n)}eventFromMessage(e,t=`info`,n){return Ls(Al(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Ml(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Ml(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]=Ac(this,n);l&&(s.contexts={trace:l});let u=vl(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=Uc(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 Ml(e){let t=no().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}const Nl=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),Pl=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function Fl(e,t){let n=String(e).toLowerCase();return Nl.has(n)?!1:Pl.has(n)?!0:t?.strict?null:!!e}function Il(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 Ll(e){return e.split(/[?#]/,1)[0]}function Rl(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function zl(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:ti})),i.version=ti)}function Bl(e={}){let t=e.client||Y();if(!gc()||!t)return{};let n=to(ni());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||J(),i=e.span||Yo(),a=i?Ro(i):Vl(r),o=mo(i?ss(i):os(t,r));if(!ko.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?zo(i):Hl(r)),s}function Vl(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Mo(t,r,n)}function Hl(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return No(t,r,n)}const Ul=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Wl(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return W&&!r&&K.log(Ul,e),r;let i=_a(e,t);return n?.set(e,i),W&&!i&&K.log(Ul,e),i}function Gl(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`&&(t[e]=n)})}catch{}return t}function Kl(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=ql({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Jl(i),headers:Gl(t),cookies:s,data:o}}function ql({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Jl(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}function Yl(e,t){let n=Y(),r=no();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=100}=n.getOptions();if(a<=0)return;let o={timestamp:ja(),...e},s=i?si(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}let Xl;const Zl=new WeakMap,Ql=X((()=>({name:`FunctionToString`,setupOnce(){Xl=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=ia(this),n=Zl.has(Y())&&t!==void 0?t:this;return Xl.apply(n,e)}}catch{}},setup(e){Zl.set(e,!0)}}))),$l=[/^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$/],eu=X((e={})=>{let t;return{name:`EventFilters`,setup(n){t=tu(e,n.getOptions())},processEvent(n,r,i){return t||=tu(e,i.getOptions()),nu(n,t)?null:n}}});function tu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:$l],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function nu(e,t){if(e.type){if(e.type===`transaction`&&iu(e,t.ignoreTransactions))return W&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Sa(e)}`),!0}else{if(ru(e,t.ignoreErrors))return W&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Sa(e)}`),!0;if(lu(e))return W&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Sa(e)}`),!0;if(au(e,t.denyUrls))return W&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Sa(e)}.\nUrl: ${cu(e)}`),!0;if(!ou(e,t.allowUrls))return W&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Sa(e)}.\nUrl: ${cu(e)}`),!0}return!1}function ru(e,t){return t?.length?Xc(e).some(e=>_a(e,t)):!1}function iu(e,t){if(!t?.length)return!1;let n=e.transaction;return n?_a(n,t):!1}function au(e,t){if(!t?.length)return!1;let n=cu(e);return n?_a(n,t):!1}function ou(e,t){if(!t?.length)return!0;let n=cu(e);return n?_a(n,t):!0}function su(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 cu(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?su(t):null}catch{return W&&K.error(`Cannot extract url for event ${Sa(e)}`),null}}function lu(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function uu(e,t,n,r,i,a){if(!i.exception?.values||!a||!Xi(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=du(e,t,r,a.originalException,n,i.exception.values,o,0))}function du(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Xi(r[i],Error)){pu(o,s,r);let a=e(t,r[i]),l=c.length;mu(a,i,l,s),c=du(e,t,n,r[i],i,[a,...c],a,l)}return fu(r)&&r.errors.forEach((a,l)=>{if(Xi(a,Error)){pu(o,s,r);let u=e(t,a),d=c.length;mu(u,`errors[${l}]`,d,s),c=du(e,t,n,a,i,[u,...c],u,d)}}),c}function fu(e){return Array.isArray(e.errors)}function pu(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...fu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function mu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}const hu=X(((e={})=>{let t=e.limit||5,n=e.key||`cause`;return{name:`LinkedErrors`,preprocessEvent(e,r,i){uu(wl,i.getOptions().stackParser,n,t,e,r)}}}));function gu(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 _u=[`X-Client-IP`,`X-Forwarded-For`,`Fly-Client-IP`,`CF-Connecting-IP`,`Fastly-Client-Ip`,`True-Client-Ip`,`X-Real-IP`,`X-Cluster-Client-IP`,`X-Forwarded`,`Forwarded-For`,`Forwarded`,`X-Vercel-Forwarded-For`];function vu(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return _u.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?yu(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&bu(e))||null}function yu(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function bu(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 xu={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Su=X(((e={})=>{let t={...xu,...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&&Cu(e,a,{ipAddress:o},s),e}}}));function Cu(e,t,n,r){if(e.request={...e.request,...wu(t,r)},r.ip){let r=t.headers&&vu(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function wu(e,t){let n={},r={...e.headers};return t.headers&&(n.headers=r,t.cookies||delete r.cookie,t.ip||_u.forEach(e=>{delete r[e]})),n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?gu(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Tu(e){let t=`console`;Oi(t,e),ki(t,Eu)}function Eu(){`console`in G&&ai.forEach(function(e){e in G.console&&ta(G.console,e,function(t){return oi[e]=t,function(...t){Ai(`console`,{args:t,level:e}),oi[e]?.apply(G.console,t)}})})}function Du(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}const Ou=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function ku(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=Ou.exec(t);return n?n.slice(1):[]}function Au(e){let t=ku(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}const ju=X((e={})=>{let t=new Set(e.levels||ai);return{name:`Console`,setup(e){Tu(({args:n,level:r})=>{Y()!==e||!t.has(r)||Mu(r,n)})}}});function Mu(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Du(e),message:Nu(t)};if(e===`assert`)if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Nu(e)}`:`Assertion failed`,n.data.arguments=e}else return;Yl(n,{input:t,level:e})}function Nu(e){return`util`in G&&typeof G.util.format==`function`?G.util.format(...e):ha(e,` `)}function Pu(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function Fu(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 Iu(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=Ti(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?zu(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:Ru(o[3]),colno:Ru(o[4]),in_app:Fu(s||``,c)}}if(i.match(t))return{filename:i}}}function Lu(e){return[90,Iu(e)]}function Ru(e){return parseInt(e||``,10)||void 0}function zu(e){try{return decodeURI(e)}catch{return}}var Bu=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}};const Z=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var Vu=class extends jl{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};zl(n,`node-light`,[`node-core`]),K.log(`Initializing Sentry: process: ${process.pid}, thread: ${Me?`main`:`worker-${Ne}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Nc(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener))}async flush(e){return this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener),super.close(e)}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Z&&K.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??6e4).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}};const Hu=X((e={})=>({name:`ChildProcess`,setup(){Pe.channel(`child_process`).subscribe(t=>{t&&typeof t==`object`&&`process`in t&&Uu(t.process,e)}),Pe.channel(`worker_threads`).subscribe(t=>{t&&typeof t==`object`&&`worker`in t&&Wu(t.worker,e)})}}));function Uu(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&&Yl({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Yl({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function Wu(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Yl({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):pc(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}const Gu=me(Re),Ku=me(Be),qu=X(((e={})=>{let t,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function r(e){t===void 0&&(t=i());let n=Ju(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 Yu()),n.app&&(e.app=Zu()),n.device&&(e.device=Qu(n.device)),n.culture){let t=Xu();t&&(e.culture=t)}return n.cloudResource&&(e.cloud_resource=od()),e}return{name:`Context`,processEvent(e){return r(e)}}}));function Ju(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 Yu(){let e=j.platform();switch(e){case`darwin`:return rd();case`linux`:return ad();default:return{name:$u[e]||e,version:j.release()}}}function Xu(){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 Zu(){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 Qu(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 $u={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},ed=[{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`]}],td={alpine:e=>e,arch:e=>nd(/distrib_release=(.*)/,e),centos:e=>nd(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>nd(/release (..)/,e),mint:e=>nd(/distrib_release=(.*)/,e),red:e=>nd(/release ([^ ]+)/,e),suse:e=>nd(/VERSION = (.*)\n/,e),ubuntu:e=>nd(/distrib_release=(.*)/,e)};function nd(e,t){let n=e.exec(t);return n?n[1]:void 0}async function rd(){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)=>{Ae(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=nd(/^ProductName:\s+(.*)$/m,t),e.version=nd(/^ProductVersion:\s+(.*)$/m,t),e.build=nd(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function id(e){return e.split(` `)[0].toLowerCase()}async function ad(){let e={kernel_version:j.release(),name:`Linux`};try{let t=await Ku(`/etc`),n=ed.find(e=>t.includes(e.name));if(!n)return e;let r=(await Gu(we(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(id(e))>=0)||i[0],e.version=td[id(e.name)]?.(r)}catch{}return e}function od(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}const sd=new Bu(10),cd=new Bu(20);function ld(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function ud(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function dd(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function fd(e,t){let n=sd.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 pd(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=xd(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=xd(r,t)),n++}return a}function md(e,t,n){return new Promise((r,i)=>{let a=Ie(e),o=Ve({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){cd.set(e,1),Z&&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]=ma(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 hd(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`||ud(i)||dd(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(cd.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=pd(r,t);if(a.every(t=>fd(e,t)))continue;let o=ld(sd,e,{});i.push(md(e,a,o))}if(await Promise.all(i).catch(()=>{Z&&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&&gd(n.stacktrace.frames,t,sd);return e}function gd(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;vd(r.lineno,r,t,e)}}function _d(e){delete e.pre_context,delete e.context_line,delete e.post_context}function vd(e,t,n,r){if(t.lineno===void 0||r===void 0){Z&&K.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=yd(e,n);i<e;i++){let e=r[i];if(e===void 0){_d(t),Z&&K.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){_d(t),Z&&K.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=bd(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 yd(e,t){return Math.max(1,e-t)}function bd(e,t){return e+t}function xd(e,t){return[yd(e,t),bd(e,t)]}const Sd=X(((e={})=>{let t=e.frameContextLines===void 0?7:e.frameContextLines;return{name:`ContextLines`,processEvent(e){return hd(e,t)}}})),Cd=Da(process.versions.node),wd=Cd.major;Cd.minor;let Td;async function Ed(){if(Td===void 0)try{Td=!!(await import(`node:inspector`)).url()}catch{Td=!1}return Td}const Dd=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Od(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 kd(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function Ad(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||kd(e)&&kd(t)}function jd(...e){K.log(`[LocalVariables]`,...e)}const Md=X(((e={})=>{function t(t,n){let r=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<r.length;t++){let i=r.length-t-1,a=n[t],o=r[i];if(!o||!a)break;a.vars===void 0||o.in_app===!1&&e.includeOutOfAppFrames!==!0||!Ad(o.function,a.function)||(o.vars=a.vars)}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&Dd in n.originalException&&Array.isArray(n.originalException[Dd])){for(let r of e.exception?.values||[])t(r,n.originalException[Dd]);n.originalException[Dd]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new He(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=>{jd(`Worker error`,e)}),t.once(`exit`,e=>{jd(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await Ed()){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 Nd(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Pd(e,t){if(t!==void 0)return Nd(e(t,1))}function Fd(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 Id=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}=Fd(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 Ld=X(((e={},t)=>{let n=new Bu(20),r,i=!1;function a(t){let r=Nd(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||!Ad(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=Y()?.getOptions();if(a?.includeLocalVariables){if(wd<18){K.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Ed()){K.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Id.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Pd(e,i.description);if(c==null){s();return}let{add:l,next:u}=Fd(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=Od(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]}}})),Rd=(e={})=>Cd.major<19?Ld(e):Md(e);function zd(){try{return typeof module<`u`&&module.exports!==void 0}catch{return!1}}let Bd;const Vd=typeof __SENTRY_SERVER_MODULES__>`u`?{}:__SENTRY_SERVER_MODULES__,Hd=(()=>({name:`Modules`,processEvent(e){return e.modules={...e.modules,...Kd()},e},getModules:Kd}));function Ud(){try{return g.cache?Object.keys(g.cache):[]}catch{return[]}}function Wd(){return{...Vd,...Jd(),...zd()?Gd():{}}}function Gd(){let e=g.main?.paths||[],t=Ud(),n={},r=new Set;return t.forEach(t=>{let i=t,a=()=>{let t=i;if(i=Se(t),!i||t===i||r.has(t))return;if(e.indexOf(i)<0)return a();let o=we(t,`package.json`);if(r.add(t),!Le(o))return a();try{let e=JSON.parse(ze(o,`utf8`));n[e.name]=e.version}catch{}};a()}),n}function Kd(){return Bd||=Wd(),Bd}function qd(){try{let e=we(process.cwd(),`package.json`);return JSON.parse(ze(e,`utf8`))}catch{return{}}}function Jd(){let e=qd();return{...e.dependencies,...e.devDependencies}}function Yd(e){si(()=>{console.error(e)});let t=Y();if(t===void 0){Z&&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||Z&&K.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{Z&&K.error(e)})}const Xd=X((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:`OnUncaughtException`,setup(e){Me&&global.process.on(`uncaughtException`,Zd(e,t))}}});function Zd(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=Yd;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e.tag!==`sentry_tracingErrorCallback`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(Z&&K.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Yd(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,Y()===e&&pc(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}const Qd=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],$d=X(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Qd,...e.ignore??[]]};return{name:`OnUnhandledRejection`,setup(e){global.process.on(`unhandledRejection`,rf(e,t))}}}));function ef(e){if(typeof e!=`object`||!e)return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function tf(e,t){let n=e.name===void 0||ga(t.name,e.name,!0),r=e.message===void 0||ga(t.message,e.message);return n&&r}function nf(e,t){let n=ef(t);return e.some(e=>tf(e,n))}function rf(e,t){return function(n,r){if(Y()!==e||nf(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=n&&typeof n==`object`?n._sentry_active_span:void 0;(a?e=>Ns(a,e):e=>e())(()=>{pc(n,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),af(n,t.mode)}}function af(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`?si(()=>{console.warn(n),console.error(e&&typeof e==`object`&&`stack`in e?e.stack:e)}):t===`strict`&&(si(()=>{console.warn(n)}),Yd(e))}const of=X(()=>({name:`ProcessSession`,setupOnce(){_c(),process.on(`beforeExit`,()=>{no().getSession()?.status!==`ok`&&vc()})}})),sf=`Spotlight`,cf=X(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:sf,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{}lf(e,t)}}}));function lf(e,t){let n=uf(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=xs(e);Ps(()=>{let e=De.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 uf(e){try{return new URL(`${e}`)}catch{K.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}function df(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`?!1:pe.getSystemErrorMap().has(e.errno)}const ff=X((e={})=>({name:`NodeSystemError`,processEvent:(t,n,r)=>{if(!df(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 pf(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function mf(e=process.argv[1]?Au(process.argv[1]):process.cwd(),t=Ee===`\\`){let n=t?pf(e):e;return e=>{if(!e)return;let r=t?pf(e):e,{dir:i,base:a,ext:o}=Te.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 hf(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 gf=vi(Lu(mf())),_f=Symbol(`AgentBaseInternalState`);var vf=class extends De.Agent{constructor(e){super(e),this[_f]={}}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(`
741
+ `).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 De.Agent)return i.addRequest(e,r);this[_f].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[_f].currentSocket;if(this[_f].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[_f].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[_f]&&(this[_f].defaultPort=e)}get protocol(){return this[_f].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[_f]&&(this[_f].protocol=e)}};function yf(...e){K.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function bf(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(),yf(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),yf(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
742
+ \r
743
+ `);if(l===-1){yf(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
744
+ `),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}yf(`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 xf(...e){K.log(`[https-proxy-agent]`,...e)}var Sf=class extends vf{static __initStatic(){this.protocols=[`http`,`https`]}constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},xf(`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?wf(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:`){xf("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=qe.connect({...this.connectOpts,servername:e&&Ke.isIP(e)?void 0:e})}else xf("Creating `net.Socket`: %o",this.connectOpts),r=Ke.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=Ke.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=bf(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`,Cf),t.secureEndpoint){xf(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return qe.connect({...wf(t,`host`,`path`,`port`),socket:r,servername:Ke.isIP(e)?void 0:e})}return r}r.destroy();let u=new Ke.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{xf(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};Sf.__initStatic();function Cf(e){e.resume()}function wf(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}function Tf(e){return new We({read(){this.push(e),this.push(null)}})}function Ef(e){let t;try{t=new URL(e.url)}catch{return si(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),Jc(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=Df(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?Ue:De,a=e.keepAlive===void 0?!1:e.keepAlive,o=r?new Sf(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return Jc(e,Of(e,e.httpModule??i,o))}function Df(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function Of(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)=>{Ps(()=>{let d=Tf(c.body),f={...e.headers};c.body.length>32768&&(f[`content-encoding`]=`gzip`,d=d.pipe(Ge()));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 kf(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=Fl(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 Af(){let e=new Je;function t(){return e.getStore()||{scope:Ka(),isolationScope:qa()}}function n(n){let r=t().scope.clone(),i=t().isolationScope;return e.run({scope:r,isolationScope:i},()=>n(r))}function r(n,r){let i=t().isolationScope.clone();return e.run({scope:n,isolationScope:i},()=>r(n))}function i(n){let r=t().scope.clone(),i=t().isolationScope.clone();return e.run({scope:r,isolationScope:i},()=>n(i))}function a(n,r){let i=t().scope.clone();return e.run({scope:i,isolationScope:n},()=>r(n))}function o(e){return n(t=>(t.setSDKProcessingMetadata({__SENTRY_SUPPRESS_TRACING__:!0}),e()))}eo({suppressTracing:o,withScope:n,withSetScope:r,withIsolationScope:i,withSetIsolationScope:a,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}function jf(e,t,n,r){let i=0,a=[];Z&&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`){Z&&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):Z&&K.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{Z&&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){Z&&K.error(r,`Error building captured request body`,e)}})}catch(e){Z&&K.error(r,`Error patching request to capture body`,e)}}function Mf(e,t){if(!e)return t;let n=ho(e),r=ho(t);if(!r)return e;let i={...n};return Object.entries(r).forEach(([e,t])=>{i[e]||(i[e]=t)}),_o(i)}const Nf=`@sentry/instrumentation-http`;function Pf(e,t){let n=If(e),r=t?.statusCode,i=Pu(r);Yl({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Ff(e,t){let n=Rf(e),{tracePropagationTargets:r,propagateTraceparent:i}=Y()?.getOptions()||{},a=Wl(n,r,t)?Bl({propagateTraceparent:i}):void 0;if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o&&!e.getHeader(`sentry-trace`))try{e.setHeader(`sentry-trace`,o),Z&&K.log(Nf,`Added sentry-trace header to outgoing request`)}catch(e){Z&&K.error(Nf,`Failed to add sentry-trace header to outgoing request:`,Ri(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),Z&&K.log(Nf,`Added traceparent header to outgoing request`)}catch(e){Z&&K.error(Nf,`Failed to add traceparent header to outgoing request:`,Ri(e)?e.message:`Unknown error`)}if(s){let t=Mf(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),Z&&K.log(Nf,`Added baggage header to outgoing request`)}catch(e){Z&&K.error(Nf,`Failed to add baggage header to outgoing request:`,Ri(e)?e.message:`Unknown error`)}}}function If(e){try{let t=e.getHeader(`host`)||e.host,n=Il(new URL(e.path,`${e.protocol}//${t}`).toString()),r={url:Rl(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 Lf(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Rf(e){let t=e.getHeader(`host`)||e.host;return`${e.protocol}//${t}${e.path}`}const zf=`Http`,Bf=new WeakSet,Vf=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??`medium`,ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Bu(100),r=new WeakMap;return{name:zf,setupOnce(){Fe(`http.server.request.start`,(e=>{Hf(e.server,t)})),Fe(`http.client.request.created`,(e=>{Uf(e.request,t,n,r)})),Fe(`http.client.response.finish`,(e=>{let n=e;Wf(n.request,n.response,t,r)})),Fe(`http.client.request.error`,(e=>{Wf(e.request,void 0,t,r)}))}}});function Hf(e,{ignoreRequestBody:t,maxRequestBodySize:n}){let r=e.emit;if(Bf.has(r))return;let i=new Proxy(r,{apply(e,r,i){if(i[0]!==`request`||!J().getClient())return e.apply(r,i);Z&&K.log(zf,`Handling incoming request`);let a=no().clone(),o=i[1],s=Kl(o),c=o.ip||o.socket?.remoteAddress,l=o.url||`/`;n!==`none`&&!t?.(l,o)&&jf(o,a,n,zf),a.setSDKProcessingMetadata({normalizedRequest:s,ipAddress:c});let u=`${(o.method||`GET`).toUpperCase()} ${Ll(l)}`;return a.setTransactionName(u),ao(a,()=>{let t=s.headers?.[`sentry-trace`],n=s.headers?.baggage;return Ms({sentryTrace:Array.isArray(t)?t[0]:t,baggage:Array.isArray(n)?n[0]:n},()=>(J().getPropagationContext().propagationSpanId=Va(),e.apply(r,i)))})}});Bf.add(i),e.emit=i}function Uf(e,t,n,r){let i=Gf(e,t);r.set(e,i),!i&&Ff(e,n)}function Wf(e,t,n,r){n.breadcrumbs&&((r.get(e)??Gf(e,n))||Pf(e,t))}function Gf(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}`,Lf(e)):!1}const Kf=`sentry-trace`,qf=`baggage`,Jf=/baggage: (.*)\r\n/;function Yf(e,t){let n=Qf(e.origin,e.path),{tracePropagationTargets:r,propagateTraceparent:i}=Y()?.getOptions()||{},a=Wl(n,r,t)?Bl({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(Kf)&&t.push(Kf,o),c&&!t.includes(`traceparent`)&&t.push(`traceparent`,c);let n=t.findIndex(e=>e===qf);if(s&&n===-1)t.push(qf,s);else if(s){let e=t[n+1],r=Mf(e,s);r&&(t[n+1]=r)}}else{let t=e.headers;o&&!t.includes(`${Kf}:`)&&(e.headers+=`${Kf}: ${o}\r\n`),c&&!t.includes(`traceparent:`)&&(e.headers+=`traceparent: ${c}\r\n`);let n=e.headers.match(Jf)?.[1];if(s&&!n)e.headers+=`${qf}: ${s}\r\n`;else if(s){let t=Mf(n,s);t&&(e.headers=e.headers.replace(Jf,`baggage: ${t}\r\n`))}}}function Xf(e,t){let n=Zf(e),r=t.statusCode,i=Pu(r);Yl({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function Zf(e){try{let t=Il(Qf(e.origin,e.path)),n={url:Rl(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 Qf(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 $f=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},n=new Bu(100),r=new WeakMap;return{name:`NodeFetch`,setupOnce(){Fe(`undici:request:create`,(e=>{ep(e.request,t,n,r)})),Fe(`undici:request:headers`,(e=>{let n=e;tp(n.request,n.response,t,r)}))}}});function ep(e,t,n,r){let i=np(e,t);r.set(e,i),!i&&Yf(e,n)}function tp(e,t,n,r){n.breadcrumbs&&(r.get(e)||Xf(e,t))}function np(e,t){if(J().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:n}=t;return n?n(Qf(e.origin,e.path)):!1}function rp(){return[eu(),Ql(),hu(),Su(),ff(),ju(),Vf(),$f(),Xd(),$d(),Sd(),Rd(),qu(),Hu(),of(),Hd()]}function ip(e={}){return ap(e,rp)}function ap(e={},t){let n=op(e,t);n.debug===!0&&(Z?K.enable():si(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Af(),J().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===sf)&&n.integrations.push(cf({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),zl(n,`node-light`,[`node-core`]);let r=new Vu(n);return J().setClient(r),r.init(),K.log(`SDK initialized from ${zd()?`CommonJS`:`ESM`} (light mode)`),r.startClientReportTracking(),lp(),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function op(e,t){let n=sp(e.release),r=kf(e.spotlight),i=cp(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??Ef,stackParser:yi(e.stackParser||gf),release:n,tracesSampleRate:i,spotlight:r,debug:Fl(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=e.defaultIntegrations??t(a);return{...a,integrations:Ec({defaultIntegrations:s,integrations:o})}}function sp(e){if(e!==void 0)return e;let t=hf();if(t!==void 0)return t}function cp(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 lp(){if(Fl(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=jo(e,t);J().setPropagationContext(n)}}function up(){return!0}function dp(){try{if(!up())return;ip({dsn:`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`,release:Ze,environment:`production`,defaultIntegrations:!1,integrations:[],maxValueLength:2500}),mc(`Process`,{command:process.argv.join(` `),cwd:process.cwd()})}catch{}}async function fp(e){try{if(!up())return;pc(e,e instanceof Error?{extra:{cause:e.cause,fullCommand:process.argv.join(` `)}}:{}),await hc()}catch{}}function pp(e){ke(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function Q(e,t={}){let{credentials:n=`include`}=t,r=new Headers(t.headers);if(r.set(`Accept`,`application/json`),n===`include`){let e=await h();e&&r.set(`Cookie`,`SESSION=fake_session; prismic-auth=${e}`)}!r.has(`Content-Type`)&&t.body&&r.set(`Content-Type`,`application/json`),t.body instanceof FormData&&r.delete(`Content-Type`);let i=r.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,o=await fetch(e,{...t,body:i,headers:r}),s=await o.clone().json().catch(()=>o.clone().text());if(o.ok){if(!t?.schema)return{ok:!0,value:s};try{return{ok:!0,value:a(t.schema,s)}}catch(e){if(w(e))return{ok:!1,value:s,error:e};throw e}}else if(o.status===401)return{ok:!1,value:s,error:new hp(o)};else if(o.status===403)return{ok:!1,value:s,error:new $(o)};else return{ok:!1,value:s,error:new mp(o)}}var mp=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},$=class extends mp{},hp=class extends mp{};const gp=u({id:p(),type:e(`SharedSlice`),name:p(),description:f(p()),variations:r(u({id:p(),name:p(),description:f(p()),docURL:f(p()),version:f(p()),imageUrl:f(p()),primary:f(s(p(),de())),items:f(s(p(),de()))}))}),_p=u({id:p(),label:f(p()),repeatable:d(),status:d(),format:f(p()),json:s(p(),de())});async function vp(){let e=await ce();return e.hostname=`customtypes.${e.hostname}`,e}async function yp(e){let t=await h();if(!t)return{ok:!1,error:`Not authenticated`};let n=await vp(),i=new URL(`customtypes`,n);try{let n=await fetch(i,{headers:{Authorization:`Bearer ${t}`,repository:e}});if(!n.ok)return n.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:n.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${n.status} ${n.statusText}`};let a=await n.json(),o=c(r(_p),a);return o.success?{ok:!0,value:o.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function bp(e){let t=await h();if(!t)return{ok:!1,error:`Not authenticated`};let n=await vp(),i=new URL(`slices`,n);try{let n=await fetch(i,{headers:{Authorization:`Bearer ${t}`,repository:e}});if(!n.ok)return n.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:n.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${n.status} ${n.statusText}`};let a=await n.json(),o=c(r(gp),a);return o.success?{ok:!0,value:o.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function xp(e,t){let n=await h();if(!n)return{ok:!1,error:`Not authenticated`};let r=await vp(),i=new URL(`customtypes/insert`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Sp(e,t){let n=await h();if(!n)return{ok:!1,error:`Not authenticated`};let r=await vp(),i=new URL(`customtypes/update`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Cp(e,t){let n=await h();if(!n)return{ok:!1,error:`Not authenticated`};let r=await vp(),i=new URL(`customtypes/${encodeURIComponent(t)}`,r);try{let t=await fetch(i,{method:`DELETE`,headers:{Authorization:`Bearer ${n}`,repository:e}});return t.ok?{ok:!0,value:void 0}:t.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:t.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${t.status} ${t.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function wp(e,t){let n=await h();if(!n)return{ok:!1,error:`Not authenticated`};let r=await vp(),i=new URL(`slices/insert`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Tp(e,t){let n=await h();if(!n)return{ok:!1,error:`Not authenticated`};let r=await vp(),i=new URL(`slices/update`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Ep(e,t){let n=await h();if(!n)return{ok:!1,error:`Not authenticated`};let r=await vp(),i=new URL(`slices/${encodeURIComponent(t)}`,r);try{let t=await fetch(i,{method:`DELETE`,headers:{Authorization:`Bearer ${n}`,repository:e}});return t.ok?{ok:!0,value:void 0}:t.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:t.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${t.status} ${t.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}const Dp=5e3,Op=6e4;async function kp(){let{values:{help:e,repo:t=await E(),watch:r}}=A({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},watch:{type:`boolean`,short:`w`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Sync slices, page types, and custom types from Prismic to local files.
745
+
746
+ Remote models are the source of truth. Local files are created, updated,
747
+ or deleted to match.
748
+
749
+ USAGE
750
+ prismic sync [flags]
751
+
752
+ FLAGS
753
+ -r, --repo string Repository domain
754
+ -w, --watch Watch for changes and sync continuously
755
+ -h, --help Show help for command`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}let i=await re();if(!i){console.error(`Could not detect a supported framework (Next.js, Nuxt, or SvelteKit).`),process.exitCode=1;return}console.info(`Syncing from repository: ${t}`),r?await Ap(t,i):(await jp(t,i),await Mp(t,i),console.info(`Sync complete`))}async function Ap(e,t){let n=await bp(e);if(!n.ok){console.error(`Failed to fetch remote slices: ${n.error}`),process.exitCode=1;return}let r=n.value,i=await yp(e);if(!i.ok){console.error(`Failed to fetch remote custom types: ${i.error}`),process.exitCode=1;return}let a=i.value;await jp(e,t),await Mp(e,t),console.info(ee`
756
+ Initial sync completed!
757
+
758
+ Watching for changes (polling every ${Dp/1e3}s),
759
+ Press Ctrl+C to stop
760
+ `);let o=Fp(r),s=Fp(a),c=0;for(process.on(`SIGINT`,Np),process.on(`SIGTERM`,Np),process.on(`SIGHUP`,Np),process.on(`SIGQUIT`,Np),process.platform===`win32`&&process.on(`SIGBREAK`,Np);;){await Ye(Pp(c));try{let n=await bp(e);if(!n.ok)continue;let r=Fp(n.value),i=r!==o,a=await yp(e);if(!a.ok)continue;let l=Fp(a.value),u=l!==s;(i||u)&&(i&&(await jp(e,t),o=r),u&&(await Mp(e,t),s=l)),c=0}catch(e){c++;let t=e instanceof Error?e.message:`Unknown error`,n=Math.min(Dp*2**(c-1),Op);if(console.error(`Error checking for changes: ${t}. Retrying in ${n/1e3}s...`),c>=10)throw Error(`Too many consecutive errors (10), stopping watch.`)}}}async function jp(e,t){let n=await bp(e);if(!n.ok){console.error(`Failed to fetch remote slices: ${n.error}`),process.exitCode=1;return}let r=n.value,i=await t.getSlices();for(let e of r)i.find(t=>t.model.id===e.id)&&await t.updateSlice(e);for(let e of i)r.some(t=>t.id===e.model.id)||await t.deleteSlice(e.model.id);let a=await t.getDefaultSliceLibrary();for(let e of r)i.some(t=>t.model.id===e.id)||await t.createSlice(e,a)}async function Mp(e,t){let n=await yp(e);if(!n.ok){console.error(`Failed to fetch remote custom types: ${n.error}`),process.exitCode=1;return}let r=n.value,i=await t.getCustomTypes();for(let e of r)i.find(t=>t.model.id===e.id)&&await t.updateCustomType(e);for(let e of i)r.some(t=>t.id===e.model.id)||await t.deleteCustomType(e.model.id);for(let e of r)i.some(t=>t.model.id===e.id)||await t.createCustomType(e)}function Np(){console.info(`Watch stopped. Goodbye!`),Xr(`sync`,!0),process.exit(0)}function Pp(e){return e===0?Dp:Math.min(Dp*2**(e-1),Op)}function Fp(e){return be(`sha256`).update(JSON.stringify(e)).digest(`hex`)}const Ip=u({repositories:r(u({domain:p(),name:f(p())}))});async function Lp(){let{values:e}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}}});if(e.help){console.info(`Initialize a Prismic project by creating a prismic.config.json file.
761
+
762
+ Detects the project framework, installs dependencies, and syncs models
763
+ from Prismic. If a slicemachine.config.json exists, it will be migrated.
764
+
765
+ USAGE
766
+ prismic init [flags]
767
+
768
+ FLAGS
769
+ -r, --repo string Repository name
770
+ -h, --help Show help for command
771
+
772
+ EXAMPLES
773
+ prismic init --repo my-repo
774
+
775
+ LEARN MORE
776
+ Use \`prismic <command> --help\` for more information about a command.`);return}if((await oe()).ok){console.error(`A prismic.config.json file already exists.`),process.exitCode=1;return}let t=await se(`slicemachine.config.json`,{stop:`package.json`}),r,i;if(t)try{let e=await he(t,`utf8`),n=JSON.parse(e);r=n.repositoryName,i=n.libraries}catch{console.warn(`Could not read slicemachine.config.json, ignoring.`)}let a=e.repo??r;if(!a){console.error(`Missing required flag: --repo`),process.exitCode=1;return}if(!await n()){console.info(`Not logged in. Starting login...`);let{email:e}=await m({onReady:e=>{console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),pp(e)}});console.info(`Logged in as ${e}`)}let o=await Q(new URL(`profile`,await le()),{schema:Ip});if(!o.ok){console.error(`Failed to fetch user profile.`),process.exitCode=1;return}if(!o.value.repositories.find(e=>e.domain===a)){console.error(`Repository "${a}" not found in your account. Check the name or create it with \`prismic repo create\`.`),process.exitCode=1;return}let s=await re();if(!s){console.error(`Could not detect a supported framework (Next.js, Nuxt, or SvelteKit).`),process.exitCode=1;return}let c={repositoryName:a};i?.length&&(c.libraries=i);let l=await ne(c);if(!l.ok){l.error instanceof te?console.error(`Could not find a package.json file. Run this command from a project directory.`):console.error(`Failed to create config file.`),process.exitCode=1;return}t&&(await _e(t),console.info(`Migrated slicemachine.config.json to prismic.config.json`)),await s.initProject(),await jp(a,s),await Mp(a,s),console.info(`Initialized Prismic for repository "${a}". Run \`npm install\` to install new dependencies.`)}async function Rp(){let{values:{help:e,name:t,repo:r=await E()},positionals:[i]}=A({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a new locale to a Prismic repository.
777
+
778
+ By default, this command reads the repository from prismic.config.json at the
779
+ project root.
780
+
781
+ USAGE
782
+ prismic locale add <code> [flags]
783
+
784
+ ARGUMENTS
785
+ <code> Locale code (e.g. fr-fr, es-es)
786
+
787
+ FLAGS
788
+ -n, --name string Custom display name (creates custom locale)
789
+ -r, --repo string Repository domain
790
+ -h, --help Show help for command
791
+
792
+ LEARN MORE
793
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Vp();return}let a=t?await Bp(r,i,t):await zp(r,i);if(!a.ok){if(typeof a.value==`string`&&a.value.includes(`already existing languages`))return;a.error instanceof $?Vp():(console.error(`Failed to add locale: ${S(a.value)}`),process.exitCode=1);return}console.info(`Locale added: ${i}`)}async function zp(e,t){return await Q(new URL(`/app/settings/multilanguages`,await x(e)),{method:`POST`,body:{languages:[t]}})}async function Bp(e,t,n){let[r,i]=t.split(`-`);return await Q(new URL(`/app/settings/multilanguages/custom`,await x(e)),{method:`POST`,body:{lang:{label:n,id:r||t},region:{label:n,id:i||r||t}}})}function Vp(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Hp(){let{values:{help:e,repo:t=await E(),json:r}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`List all locales in a Prismic repository.
794
+
795
+ By default, this command reads the repository from prismic.config.json at the
796
+ project root.
797
+
798
+ USAGE
799
+ prismic locale list [flags]
800
+
801
+ FLAGS
802
+ --json Output as JSON
803
+ -r, --repo string Repository domain
804
+ -h, --help Show help for command
805
+
806
+ LEARN MORE
807
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Gp();return}let i=await Wp(t);if(!i.ok){i.error instanceof $?Gp():w(i.error)?(console.error(`Failed to list locales: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list locales: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(S(a));else for(let e of a){let t=e.isMaster?` (default)`:``;console.info(`${e.id} ${e.label}${t}`)}}const Up=u({results:r(u({id:p(),label:p(),customName:ie(p()),isMaster:d()}))});async function Wp(e){let t=new URL(`/locale/repository/locales`,await ue());return t.searchParams.set(`repository`,e),await Q(t,{schema:Up})}function Gp(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Kp(){let{values:{repo:e=await E(),help:t},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a locale from a Prismic repository.
808
+
809
+ By default, this command reads the repository from prismic.config.json at the
810
+ project root.
811
+
812
+ USAGE
813
+ prismic locale remove <code> [flags]
814
+
815
+ ARGUMENTS
816
+ <code> Locale code (e.g. en-us, fr-fr)
817
+
818
+ FLAGS
819
+ -r, --repo string Repository domain
820
+ -h, --help Show help for command
821
+
822
+ LEARN MORE
823
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!e){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Jp();return}let i=await qp(e,r);if(!i.ok){i.error instanceof $?Jp():(console.error(`Failed to remove locale: ${S(i.value)}`),process.exitCode=1);return}console.info(`Removed locale: ${r}`)}async function qp(e,t){let n=new URL(`/locale/repository/locales/${t}`,await ue());return n.searchParams.set(`repository`,e),await Q(n,{method:`DELETE`})}function Jp(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Yp(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set the default locale for a Prismic repository.
824
+
825
+ By default, this command reads the repository from prismic.config.json at the
826
+ project root.
827
+
828
+ USAGE
829
+ prismic locale set-default <code> [flags]
830
+
831
+ ARGUMENTS
832
+ <code> Locale code (e.g. en-us, fr-fr)
833
+
834
+ FLAGS
835
+ -r, --repo string Repository domain
836
+ -h, --help Show help for command
837
+
838
+ LEARN MORE
839
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Zp();return}let i=await Wp(t);if(!i.ok){i.error instanceof $?Zp():w(i.error)?(console.error(`Failed to set default locale: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set default locale: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.results,o=a.find(e=>e.id===r);if(!o){console.error(`Locale "${r}" not found in repository. Available locales: ${a.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(o.isMaster){console.error(`Locale "${r}" is already the default.`),process.exitCode=1;return}let s=await Xp(t,o);if(!s.ok){s.error instanceof $?Zp():(console.error(`Failed to set default locale: ${S(s.value)}`),process.exitCode=1);return}console.info(`Default locale set: ${r}`)}async function Xp(e,t){let n=new URL(`/locale/repository/locales`,await ue());return n.searchParams.set(`repository`,e),await Q(n,{method:`POST`,body:{id:t.id,label:t.label,customName:t.customName,isMaster:!0}})}function Zp(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Qp(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`add`:await Rp();break;case`list`:await Hp();break;case`remove`:await Kp();break;case`set-default`:await Yp();break;default:e&&(console.error(`Unknown locale subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage locales in a Prismic repository.
840
+
841
+ USAGE
842
+ prismic locale <command> [flags]
843
+
844
+ COMMANDS
845
+ add Add a locale to a repository
846
+ list List locales in a repository
847
+ remove Remove a locale from a repository
848
+ set-default Set the default locale for a repository
849
+
850
+ FLAGS
851
+ -h, --help Show help for command
852
+
853
+ LEARN MORE
854
+ Use \`prismic locale <command> --help\` for more information about a command.`)}}async function $p(){let{values:e}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(e.help){console.info(`Log in to Prismic via browser.
855
+
856
+ USAGE
857
+ prismic login [flags]
858
+
859
+ FLAGS
860
+ -h, --help Show help for command
861
+
862
+ LEARN MORE
863
+ Use \`prismic <command> --help\` for more information about a command.`);return}let{email:t}=await m({onReady:e=>{console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${e}`),em(e)}});console.info(`Logged in to Prismic as ${t}`)}function em(e){ke(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function tm(){let{values:e}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(e.help){console.info(`Log out of Prismic.
864
+
865
+ USAGE
866
+ prismic logout [flags]
867
+
868
+ FLAGS
869
+ -h, --help Show help for command
870
+
871
+ LEARN MORE
872
+ Use \`prismic <command> --help\` for more information about a command.`);return}await i()?console.info(`Logged out of Prismic`):(console.error(`Logout failed. You can log out manually by deleting the file.`),process.exitCode=1)}async function nm(){let{values:{help:e,tab:t,label:n,default:r,"true-label":i,"false-label":a,types:o},positionals:[s,c]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a boolean (toggle) field to an existing page type.
873
+
874
+ USAGE
875
+ prismic page-type add-field boolean <type-id> <field-id> [flags]
876
+
877
+ ARGUMENTS
878
+ type-id Page type identifier (required)
879
+ field-id Field identifier (required)
880
+
881
+ FLAGS
882
+ -t, --tab string Target tab (default: first existing tab, or "Main")
883
+ -l, --label string Display label for the field (inferred from field-id if omitted)
884
+ --default Set default value to true
885
+ --true-label string Label shown when toggle is on
886
+ --false-label string Label shown when toggle is off
887
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
888
+ -h, --help Show help for command
889
+
890
+ EXAMPLES
891
+ prismic page-type add-field boolean homepage featured
892
+ prismic page-type add-field boolean article published --default
893
+ prismic page-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!s){console.error(`Missing required argument: type-id
894
+ `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
895
+ `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let l=z(c),u=U(l);if(!u.ok){console.error(u.error),process.exitCode=1;return}let d=await k();if(!d)return;let f;try{f=await d.readCustomType(s)}catch{console.error(`Page type not found: ${s}\n\nCreate it first with: prismic page-type create ${s}`),process.exitCode=1;return}let p=Object.keys(f.json),m=t??p[0]??`Main`;f.json[m]||(f.json[m]={});let h={type:`Boolean`,config:{label:n??T(l.type===`nested`?l.nestedFieldId:c),...r&&{default_value:!0},...i&&{placeholder_true:i},...a&&{placeholder_false:a}}};if(l.type===`nested`){let e=V(f.json[m],l.groupId,m);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[l.nestedFieldId]){console.error(`Field "${l.nestedFieldId}" already exists in group "${l.groupId}"`),process.exitCode=1;return}e.group.config.fields[l.nestedFieldId]=h}else{for(let[e,t]of Object.entries(f.json)){if(t[c]){console.error(`Field "${c}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[c]){console.error(`Field "${c}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}f.json[m][c]=h}await d.updateCustomType(f),l.type===`nested`?console.info(`Added field "${l.nestedFieldId}" (Boolean) to group "${l.groupId}" in ${s}`):console.info(`Added field "${c}" (Boolean) to "${m}" tab in ${s}`);try{await R({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),d){let e=O(d.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function rm(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a color picker field to an existing page type.
896
+
897
+ USAGE
898
+ prismic page-type add-field color <type-id> <field-id> [flags]
899
+
900
+ ARGUMENTS
901
+ type-id Page type identifier (required)
902
+ field-id Field identifier (required)
903
+
904
+ FLAGS
905
+ -t, --tab string Target tab (default: first existing tab, or "Main")
906
+ -l, --label string Display label for the field (inferred from field-id if omitted)
907
+ -p, --placeholder string Placeholder text
908
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
909
+ -h, --help Show help for command
910
+
911
+ EXAMPLES
912
+ prismic page-type add-field color homepage bg_color
913
+ prismic page-type add-field color homepage accent --tab "Design"
914
+ prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!a){console.error(`Missing required argument: type-id
915
+ `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
916
+ `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Page type not found: ${a}\n\nCreate it first with: prismic page-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Color`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}await l.updateCustomType(u),s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Color) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Color) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),l){let e=O(l.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function im(){let{values:{help:e,tab:t,label:n,placeholder:r,default:i,types:a},positionals:[o,s]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a date field to an existing page type.
917
+
918
+ USAGE
919
+ prismic page-type add-field date <type-id> <field-id> [flags]
920
+
921
+ ARGUMENTS
922
+ type-id Page type identifier (required)
923
+ field-id Field identifier (required)
924
+
925
+ FLAGS
926
+ -t, --tab string Target tab (default: first existing tab, or "Main")
927
+ -l, --label string Display label for the field (inferred from field-id if omitted)
928
+ -p, --placeholder string Placeholder text
929
+ --default string Default date value (YYYY-MM-DD format)
930
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
931
+ -h, --help Show help for command
932
+
933
+ EXAMPLES
934
+ prismic page-type add-field date homepage publish_date
935
+ prismic page-type add-field date event start_date --tab "Schedule"
936
+ prismic page-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!o){console.error(`Missing required argument: type-id
937
+ `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!s){console.error(`Missing required argument: field-id
938
+ `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let c=z(s),l=U(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await k();if(!u)return;let d;try{d=await u.readCustomType(o)}catch{console.error(`Page type not found: ${o}\n\nCreate it first with: prismic page-type create ${o}`),process.exitCode=1;return}let f=Object.keys(d.json),p=t??f[0]??`Main`;d.json[p]||(d.json[p]={});let m={type:`Date`,config:{label:n??T(c.type===`nested`?c.nestedFieldId:s),...r&&{placeholder:r},...i&&{default:i}}};if(c.type===`nested`){let e=V(d.json[p],c.groupId,p);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[c.nestedFieldId]){console.error(`Field "${c.nestedFieldId}" already exists in group "${c.groupId}"`),process.exitCode=1;return}e.group.config.fields[c.nestedFieldId]=m}else{for(let[e,t]of Object.entries(d.json)){if(t[s]){console.error(`Field "${s}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[s]){console.error(`Field "${s}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}d.json[p][s]=m}await u.updateCustomType(d),c.type===`nested`?console.info(`Added field "${c.nestedFieldId}" (Date) to group "${c.groupId}" in ${o}`):console.info(`Added field "${s}" (Date) to "${p}" tab in ${o}`);try{await R({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),u){let e=O(u.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function am(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add an embed field to an existing page type.
939
+
940
+ USAGE
941
+ prismic page-type add-field embed <type-id> <field-id> [flags]
942
+
943
+ ARGUMENTS
944
+ type-id Page type identifier (required)
945
+ field-id Field identifier (required)
946
+
947
+ FLAGS
948
+ -t, --tab string Target tab (default: first existing tab, or "Main")
949
+ -l, --label string Display label for the field (inferred from field-id if omitted)
950
+ -p, --placeholder string Placeholder text
951
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
952
+ -h, --help Show help for command
953
+
954
+ EXAMPLES
955
+ prismic page-type add-field embed homepage video
956
+ prismic page-type add-field embed homepage youtube --tab "Media"
957
+ prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!a){console.error(`Missing required argument: type-id
958
+ `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
959
+ `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Page type not found: ${a}\n\nCreate it first with: prismic page-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Embed`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}await l.updateCustomType(u),s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Embed) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Embed) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),l){let e=O(l.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function om(){let{values:{help:e,tab:t,label:n,types:r},positionals:[i,a]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a geo-point (location) field to an existing page type.
960
+
961
+ USAGE
962
+ prismic page-type add-field geo-point <type-id> <field-id> [flags]
963
+
964
+ ARGUMENTS
965
+ type-id Page type identifier (required)
966
+ field-id Field identifier (required)
967
+
968
+ FLAGS
969
+ -t, --tab string Target tab (default: first existing tab, or "Main")
970
+ -l, --label string Display label for the field (inferred from field-id if omitted)
971
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
972
+ -h, --help Show help for command
973
+
974
+ EXAMPLES
975
+ prismic page-type add-field geo-point homepage location
976
+ prismic page-type add-field geo-point store address --tab "Details"
977
+ prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!i){console.error(`Missing required argument: type-id
978
+ `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
979
+ `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let o=z(a),s=U(o);if(!s.ok){console.error(s.error),process.exitCode=1;return}let c=await k();if(!c)return;let l;try{l=await c.readCustomType(i)}catch{console.error(`Page type not found: ${i}\n\nCreate it first with: prismic page-type create ${i}`),process.exitCode=1;return}let u=Object.keys(l.json),d=t??u[0]??`Main`;l.json[d]||(l.json[d]={});let f={type:`GeoPoint`,config:{label:n??T(o.type===`nested`?o.nestedFieldId:a)}};if(o.type===`nested`){let e=V(l.json[d],o.groupId,d);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[o.nestedFieldId]){console.error(`Field "${o.nestedFieldId}" already exists in group "${o.groupId}"`),process.exitCode=1;return}e.group.config.fields[o.nestedFieldId]=f}else{for(let[e,t]of Object.entries(l.json)){if(t[a]){console.error(`Field "${a}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[a]){console.error(`Field "${a}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}l.json[d][a]=f}await c.updateCustomType(l),o.type===`nested`?console.info(`Added field "${o.nestedFieldId}" (GeoPoint) to group "${o.groupId}" in ${i}`):console.info(`Added field "${a}" (GeoPoint) to "${d}" tab in ${i}`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),c){let e=O(c.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function sm(){let{values:{help:e,tab:t,label:n,"non-repeatable":r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},"non-repeatable":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a group field to an existing page type.
980
+
981
+ USAGE
982
+ prismic page-type add-field group <type-id> <field-id> [flags]
983
+
984
+ ARGUMENTS
985
+ type-id Page type identifier (required)
986
+ field-id Field identifier (required)
987
+
988
+ FLAGS
989
+ -t, --tab string Target tab (default: first existing tab, or "Main")
990
+ -l, --label string Display label for the field (inferred from field-id if omitted)
991
+ --non-repeatable Make this a non-repeating group (default: repeatable)
992
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
993
+ -h, --help Show help for command
994
+
995
+ EXAMPLES
996
+ prismic page-type add-field group homepage buttons
997
+ prismic page-type add-field group article authors --non-repeatable
998
+ prismic page-type add-field group product variants --tab "Content"`);return}if(!a){console.error(`Missing required argument: type-id
999
+ `),console.error(`Usage: prismic page-type add-field group <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1000
+ `),console.error(`Usage: prismic page-type add-field group <type-id> <field-id>`),process.exitCode=1;return}if(o.includes(`.`)){console.error(`Groups cannot be nested inside other groups`),process.exitCode=1;return}let s=await k();if(!s)return;let c;try{c=await s.readCustomType(a)}catch{console.error(`Page type not found: ${a}\n\nCreate it first with: prismic page-type create ${a}`),process.exitCode=1;return}let l=Object.keys(c.json),u=t??l[0]??`Main`;c.json[u]||(c.json[u]={});for(let[e,t]of Object.entries(c.json))if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}let d={type:`Group`,config:{label:n??T(o),repeat:!r,fields:{}}};c.json[u][o]=d,await s.updateCustomType(c),console.info(`Added field "${o}" (Group) to "${u}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info(`Next: Add fields to the group with \`prismic page-type add-field <type> ${a} ${o}.<field-id>\``),s){let e=O(s.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function cm(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add an image field to an existing page type.
1001
+
1002
+ USAGE
1003
+ prismic page-type add-field image <type-id> <field-id> [flags]
1004
+
1005
+ ARGUMENTS
1006
+ type-id Page type identifier (required)
1007
+ field-id Field identifier (required)
1008
+
1009
+ FLAGS
1010
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1011
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1012
+ -p, --placeholder string Placeholder text
1013
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1014
+ -h, --help Show help for command
1015
+
1016
+ EXAMPLES
1017
+ prismic page-type add-field image homepage hero
1018
+ prismic page-type add-field image article thumbnail --tab "Media"
1019
+ prismic page-type add-field image product photo --label "Product Photo"`);return}if(!a){console.error(`Missing required argument: type-id
1020
+ `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1021
+ `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Page type not found: ${a}\n\nCreate it first with: prismic page-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Image`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}await l.updateCustomType(u),s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Image) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Image) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),l){let e=O(l.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function lm(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a key-text (single-line text) field to an existing page type.
1022
+
1023
+ USAGE
1024
+ prismic page-type add-field key-text <type-id> <field-id> [flags]
1025
+
1026
+ ARGUMENTS
1027
+ type-id Page type identifier (required)
1028
+ field-id Field identifier (required)
1029
+
1030
+ FLAGS
1031
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1032
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1033
+ -p, --placeholder string Placeholder text
1034
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1035
+ -h, --help Show help for command
1036
+
1037
+ EXAMPLES
1038
+ prismic page-type add-field key-text homepage title
1039
+ prismic page-type add-field key-text homepage meta_title --tab "SEO"
1040
+ prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!a){console.error(`Missing required argument: type-id
1041
+ `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1042
+ `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Page type not found: ${a}\n\nCreate it first with: prismic page-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});let p={type:`Text`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=V(u.json[f],s.groupId,f);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=p}else{for(let[e,t]of Object.entries(u.json)){if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[o]){console.error(`Field "${o}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}u.json[f][o]=p}await l.updateCustomType(u),s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Text) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Text) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),l){let e=O(l.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function um(){let{values:{help:e,tab:t,label:n,placeholder:r,variation:i,"allow-text":a,"allow-target-blank":o,repeatable:s,types:c},positionals:[l,u]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a link field to an existing page type.
1043
+
1044
+ USAGE
1045
+ prismic page-type add-field link <type-id> <field-id> [flags]
1046
+
1047
+ ARGUMENTS
1048
+ type-id Page type identifier (required)
1049
+ field-id Field identifier (required)
1050
+
1051
+ FLAGS
1052
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1053
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1054
+ -p, --placeholder string Placeholder text
1055
+ --variation string Slice variations (can be used multiple times)
1056
+ --allow-text Allow text with link
1057
+ --allow-target-blank Allow opening link in new tab
1058
+ --repeatable Allow multiple links
1059
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1060
+ -h, --help Show help for command
1061
+
1062
+ EXAMPLES
1063
+ prismic page-type add-field link homepage button
1064
+ prismic page-type add-field link homepage cta --allow-text
1065
+ prismic page-type add-field link homepage cta --variation Primary --variation Secondary
1066
+ prismic page-type add-field link homepage links --repeatable`);return}if(!l){console.error(`Missing required argument: type-id
1067
+ `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1068
+ `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let d=z(u),f=U(d);if(!f.ok){console.error(f.error),process.exitCode=1;return}let p=await k();if(!p)return;let m;try{m=await p.readCustomType(l)}catch{console.error(`Page type not found: ${l}\n\nCreate it first with: prismic page-type create ${l}`),process.exitCode=1;return}let h=Object.keys(m.json),g=t??h[0]??`Main`;m.json[g]||(m.json[g]={});let _={type:`Link`,config:{label:n??T(d.type===`nested`?d.nestedFieldId:u),...r&&{placeholder:r},...i&&i.length>0&&{variants:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...s&&{repeat:!0}}};if(d.type===`nested`){let e=V(m.json[g],d.groupId,g);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[d.nestedFieldId]){console.error(`Field "${d.nestedFieldId}" already exists in group "${d.groupId}"`),process.exitCode=1;return}e.group.config.fields[d.nestedFieldId]=_}else{for(let[e,t]of Object.entries(m.json)){if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[u]){console.error(`Field "${u}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}m.json[g][u]=_}await p.updateCustomType(m),d.type===`nested`?console.info(`Added field "${d.nestedFieldId}" (Link) to group "${d.groupId}" in ${l}`):console.info(`Added field "${u}" (Link) to "${g}" tab in ${l}`);try{await R({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),p){let e=O(p.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function dm(){let{values:{help:e,tab:t,label:n,placeholder:r,min:i,max:a,step:o,types:s},positionals:[c,l]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a number field to an existing page type.
1069
+
1070
+ USAGE
1071
+ prismic page-type add-field number <type-id> <field-id> [flags]
1072
+
1073
+ ARGUMENTS
1074
+ type-id Page type identifier (required)
1075
+ field-id Field identifier (required)
1076
+
1077
+ FLAGS
1078
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1079
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1080
+ -p, --placeholder string Placeholder text
1081
+ --min number Minimum value
1082
+ --max number Maximum value
1083
+ --step number Step increment
1084
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1085
+ -h, --help Show help for command
1086
+
1087
+ EXAMPLES
1088
+ prismic page-type add-field number homepage price
1089
+ prismic page-type add-field number product quantity --min 0 --max 100
1090
+ prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!c){console.error(`Missing required argument: type-id
1091
+ `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1092
+ `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let u=z(l),d=U(u);if(!d.ok){console.error(d.error),process.exitCode=1;return}let f=i===void 0?void 0:Number(i),p=a===void 0?void 0:Number(a),m=o===void 0?void 0:Number(o);if(i!==void 0&&Number.isNaN(f)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(a!==void 0&&Number.isNaN(p)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let h=await k();if(!h)return;let g;try{g=await h.readCustomType(c)}catch{console.error(`Page type not found: ${c}\n\nCreate it first with: prismic page-type create ${c}`),process.exitCode=1;return}let _=Object.keys(g.json),v=t??_[0]??`Main`;g.json[v]||(g.json[v]={});let y={type:`Number`,config:{label:n??T(u.type===`nested`?u.nestedFieldId:l),...r&&{placeholder:r},...f!==void 0&&{min:f},...p!==void 0&&{max:p},...m!==void 0&&{step:m}}};if(u.type===`nested`){let e=V(g.json[v],u.groupId,v);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[u.nestedFieldId]){console.error(`Field "${u.nestedFieldId}" already exists in group "${u.groupId}"`),process.exitCode=1;return}e.group.config.fields[u.nestedFieldId]=y}else{for(let[e,t]of Object.entries(g.json)){if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[l]){console.error(`Field "${l}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}g.json[v][l]=y}await h.updateCustomType(g),u.type===`nested`?console.info(`Added field "${u.nestedFieldId}" (Number) to group "${u.groupId}" in ${c}`):console.info(`Added field "${l}" (Number) to "${v}" tab in ${c}`);try{await R({output:s}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),h){let e=O(h.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function fm(){let{values:{help:e,tab:t,label:n,placeholder:r,single:i,multi:a,"allow-target-blank":o,types:s},positionals:[c,l]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a rich text field to an existing page type.
1093
+
1094
+ USAGE
1095
+ prismic page-type add-field rich-text <type-id> <field-id> [flags]
1096
+
1097
+ ARGUMENTS
1098
+ type-id Page type identifier (required)
1099
+ field-id Field identifier (required)
1100
+
1101
+ FLAGS
1102
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1103
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1104
+ -p, --placeholder string Placeholder text
1105
+ --single string Allowed block types for single-line (comma-separated)
1106
+ --multi string Allowed block types for multi-line (comma-separated)
1107
+ --allow-target-blank Allow opening links in new tab
1108
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1109
+ -h, --help Show help for command
1110
+
1111
+ BLOCK TYPES
1112
+ heading1, heading2, heading3, heading4, heading5, heading6,
1113
+ paragraph, strong, em, preformatted, hyperlink, image, embed,
1114
+ list-item, o-list-item, rtl
1115
+
1116
+ EXAMPLES
1117
+ prismic page-type add-field rich-text homepage body
1118
+ prismic page-type add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
1119
+ prismic page-type add-field rich-text page tagline --single "heading1"
1120
+ prismic page-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!c){console.error(`Missing required argument: type-id
1121
+ `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1122
+ `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let u=z(l),d=U(u);if(!d.ok){console.error(d.error),process.exitCode=1;return}let f=await k();if(!f)return;let p;try{p=await f.readCustomType(c)}catch{console.error(`Page type not found: ${c}\n\nCreate it first with: prismic page-type create ${c}`),process.exitCode=1;return}let m=Object.keys(p.json),h=t??m[0]??`Main`;p.json[h]||(p.json[h]={});let g={type:`StructuredText`,config:{label:n??T(u.type===`nested`?u.nestedFieldId:l),...r&&{placeholder:r},...i&&{single:i},...a&&{multi:a},...o&&{allowTargetBlank:!0}}};if(u.type===`nested`){let e=V(p.json[h],u.groupId,h);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[u.nestedFieldId]){console.error(`Field "${u.nestedFieldId}" already exists in group "${u.groupId}"`),process.exitCode=1;return}e.group.config.fields[u.nestedFieldId]=g}else{for(let[e,t]of Object.entries(p.json)){if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[l]){console.error(`Field "${l}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}p.json[h][l]=g}await f.updateCustomType(p),u.type===`nested`?console.info(`Added field "${u.nestedFieldId}" (StructuredText) to group "${u.groupId}" in ${c}`):console.info(`Added field "${l}" (StructuredText) to "${h}" tab in ${c}`);try{await R({output:s}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),f){let e=O(f.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function pm(){let{values:{help:e,tab:t,label:n,placeholder:r,option:i,default:a,types:o},positionals:[s,c]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a select (dropdown) field to an existing page type.
1123
+
1124
+ USAGE
1125
+ prismic page-type add-field select <type-id> <field-id> [flags]
1126
+
1127
+ ARGUMENTS
1128
+ type-id Page type identifier (required)
1129
+ field-id Field identifier (required)
1130
+
1131
+ FLAGS
1132
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1133
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1134
+ -p, --placeholder string Placeholder text
1135
+ --option string Add an option (can be used multiple times)
1136
+ --default string Default selected value
1137
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1138
+ -h, --help Show help for command
1139
+
1140
+ EXAMPLES
1141
+ prismic page-type add-field select homepage layout --option "full" --option "sidebar"
1142
+ prismic page-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
1143
+ prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!s){console.error(`Missing required argument: type-id
1144
+ `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1145
+ `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let l=z(c),u=U(l);if(!u.ok){console.error(u.error),process.exitCode=1;return}let d=await k();if(!d)return;let f;try{f=await d.readCustomType(s)}catch{console.error(`Page type not found: ${s}\n\nCreate it first with: prismic page-type create ${s}`),process.exitCode=1;return}let p=Object.keys(f.json),m=t??p[0]??`Main`;f.json[m]||(f.json[m]={});let h={type:`Select`,config:{label:n??T(l.type===`nested`?l.nestedFieldId:c),...r&&{placeholder:r},...i&&i.length>0&&{options:i},...a&&{default_value:a}}};if(l.type===`nested`){let e=V(f.json[m],l.groupId,m);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[l.nestedFieldId]){console.error(`Field "${l.nestedFieldId}" already exists in group "${l.groupId}"`),process.exitCode=1;return}e.group.config.fields[l.nestedFieldId]=h}else{for(let[e,t]of Object.entries(f.json)){if(t[c]){console.error(`Field "${c}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[c]){console.error(`Field "${c}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}f.json[m][c]=h}await d.updateCustomType(f),l.type===`nested`?console.info(`Added field "${l.nestedFieldId}" (Select) to group "${l.groupId}" in ${s}`):console.info(`Added field "${c}" (Select) to "${m}" tab in ${s}`);try{await R({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),d){let e=O(d.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function mm(){let{values:{help:e,tab:t,label:n,placeholder:r,default:i,types:a},positionals:[o,s]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a timestamp (date and time) field to an existing page type.
1146
+
1147
+ USAGE
1148
+ prismic page-type add-field timestamp <type-id> <field-id> [flags]
1149
+
1150
+ ARGUMENTS
1151
+ type-id Page type identifier (required)
1152
+ field-id Field identifier (required)
1153
+
1154
+ FLAGS
1155
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1156
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1157
+ -p, --placeholder string Placeholder text
1158
+ --default string Default timestamp value (ISO 8601 format)
1159
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1160
+ -h, --help Show help for command
1161
+
1162
+ EXAMPLES
1163
+ prismic page-type add-field timestamp homepage event_time
1164
+ prismic page-type add-field timestamp event start --tab "Schedule"
1165
+ prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!o){console.error(`Missing required argument: type-id
1166
+ `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!s){console.error(`Missing required argument: field-id
1167
+ `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let c=z(s),l=U(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await k();if(!u)return;let d;try{d=await u.readCustomType(o)}catch{console.error(`Page type not found: ${o}\n\nCreate it first with: prismic page-type create ${o}`),process.exitCode=1;return}let f=Object.keys(d.json),p=t??f[0]??`Main`;d.json[p]||(d.json[p]={});let m={type:`Timestamp`,config:{label:n??T(c.type===`nested`?c.nestedFieldId:s),...r&&{placeholder:r},...i&&{default:i}}};if(c.type===`nested`){let e=V(d.json[p],c.groupId,p);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[c.nestedFieldId]){console.error(`Field "${c.nestedFieldId}" already exists in group "${c.groupId}"`),process.exitCode=1;return}e.group.config.fields[c.nestedFieldId]=m}else{for(let[e,t]of Object.entries(d.json)){if(t[s]){console.error(`Field "${s}" already exists in tab "${e}"`),process.exitCode=1;return}for(let[n,r]of Object.entries(t))if(B(r)&&r.config.fields[s]){console.error(`Field "${s}" already exists in group "${n}" in tab "${e}"`),process.exitCode=1;return}}d.json[p][s]=m}await u.updateCustomType(d),c.type===`nested`?console.info(`Added field "${c.nestedFieldId}" (Timestamp) to group "${c.groupId}" in ${o}`):console.info(`Added field "${s}" (Timestamp) to "${p}" tab in ${o}`);try{await R({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),u){let e=O(u.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function hm(){let{values:{help:e,tab:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a UID (unique identifier) field to an existing page type.
1168
+
1169
+ USAGE
1170
+ prismic page-type add-field uid <type-id> <field-id> [flags]
1171
+
1172
+ ARGUMENTS
1173
+ type-id Page type identifier (required)
1174
+ field-id Field identifier (required)
1175
+
1176
+ FLAGS
1177
+ -t, --tab string Target tab (default: first existing tab, or "Main")
1178
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1179
+ -p, --placeholder string Placeholder text
1180
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1181
+ -h, --help Show help for command
1182
+
1183
+ EXAMPLES
1184
+ prismic page-type add-field uid page uid
1185
+ prismic page-type add-field uid article slug --label "URL Slug"
1186
+ prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!a){console.error(`Missing required argument: type-id
1187
+ `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1188
+ `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}if(s.type===`nested`){console.error(`UID fields cannot be nested inside groups`),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readCustomType(a)}catch{console.error(`Page type not found: ${a}\n\nCreate it first with: prismic page-type create ${a}`),process.exitCode=1;return}let d=Object.keys(u.json),f=t??d[0]??`Main`;u.json[f]||(u.json[f]={});for(let[e,t]of Object.entries(u.json))if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}let p={type:`UID`,config:{label:n??T(o),...r&&{placeholder:r}}};u.json[f][o]=p,await l.updateCustomType(u),console.info(`Added field "${o}" (UID) to "${f}" tab in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),l){let e=O(l.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function gm(){let{positionals:[e]}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`boolean`:await nm();break;case`color`:await rm();break;case`date`:await im();break;case`embed`:await am();break;case`geo-point`:await om();break;case`group`:await sm();break;case`image`:await cm();break;case`key-text`:await lm();break;case`link`:await um();break;case`number`:await dm();break;case`rich-text`:await fm();break;case`select`:await pm();break;case`timestamp`:await mm();break;case`uid`:await hm();break;default:e&&(console.error(`Unknown field type: ${e}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
1189
+
1190
+ USAGE
1191
+ prismic page-type add-field <field-type> <type-id> <field-id> [flags]
1192
+
1193
+ FIELD TYPES
1194
+ boolean Boolean toggle
1195
+ color Color picker
1196
+ date Date picker
1197
+ embed Embed (oEmbed)
1198
+ geo-point Geographic coordinates
1199
+ group Repeatable group of fields
1200
+ image Image
1201
+ key-text Single-line text
1202
+ link Any link type
1203
+ number Number
1204
+ rich-text Rich text editor
1205
+ select Dropdown select
1206
+ timestamp Date and time
1207
+ uid Unique identifier
1208
+
1209
+ FLAGS
1210
+ -h, --help Show help for command
1211
+
1212
+ LEARN MORE
1213
+ Use \`prismic page-type add-field <field-type> --help\` for more information.
1214
+
1215
+ EXAMPLES
1216
+ prismic page-type add-field key-text homepage meta_title --tab "SEO"
1217
+ prismic page-type add-field link homepage button --allow-text
1218
+ prismic page-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
1219
+ prismic page-type add-field select homepage layout --option "full" --option "sidebar"`)}}async function _m(){let{values:{help:e,"slice-zone":t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Connect a shared slice to a page type's slice zone.
1220
+
1221
+ USAGE
1222
+ prismic page-type connect-slice <type-id> <slice-id> [flags]
1223
+
1224
+ ARGUMENTS
1225
+ type-id Page type identifier (required)
1226
+ slice-id Slice identifier (required)
1227
+
1228
+ FLAGS
1229
+ -z, --slice-zone string Target slice zone field ID (default: "slices")
1230
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1231
+ -h, --help Show help for command
1232
+
1233
+ EXAMPLES
1234
+ prismic page-type connect-slice homepage CallToAction
1235
+ prismic page-type connect-slice homepage CallToAction --slice-zone slices
1236
+ prismic page-type connect-slice article HeroSection -z body`);return}if(!r){console.error(`Missing required argument: type-id
1237
+ `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: slice-id
1238
+ `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let a=await k();if(!a)return;try{await a.readSlice(i)}catch{console.error(`Slice not found: ${i}\n\nCreate it first with: prismic slice create ${i}`),process.exitCode=1;return}let o;try{o=await a.readCustomType(r)}catch{console.error(`Page type not found: ${r}\n\nCreate it first with: prismic page-type create ${r}`),process.exitCode=1;return}let s=t??`slices`,c,l;for(let[,e]of Object.entries(o.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===s){c=n,l=t;break}if(c)break}if(!c){if(t){console.error(`Slice zone "${t}" not found in page type "${r}"`),process.exitCode=1;return}let e=Object.keys(o.json)[0]??`Main`;o.json[e]||(o.json[e]={});let n={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};o.json[e][s]=n,c=n,l=s}if(c.config||={choices:{}},c.config.choices||(c.config.choices={}),i in c.config.choices){console.info(`Slice "${i}" is already connected to slice zone "${l}" in ${r}`);return}let u={type:`SharedSlice`};c.config.choices[i]=u;try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Connected slice "${i}" to slice zone "${l}" in ${r}`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function vm(){let{values:{help:e,name:t,single:n,types:r},positionals:[i]}=A({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Create a new page type in a Prismic repository.
1239
+
1240
+ USAGE
1241
+ prismic page-type create <id> [flags]
1242
+
1243
+ ARGUMENTS
1244
+ id Page type identifier (required)
1245
+
1246
+ FLAGS
1247
+ -n, --name string Display name for the page type
1248
+ --single Create as a singleton (non-repeatable) type
1249
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1250
+ -h, --help Show help for command
1251
+
1252
+ LEARN MORE
1253
+ Use \`prismic page-type <command> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: id`),process.exitCode=1;return}let a=await k();if(!a)return;let o={id:i,label:t??fe(i),repeatable:!n,status:!0,format:`page`,json:{Main:n?{}:{uid:{type:`UID`,config:{label:`UID`,placeholder:``}}},"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:[]}}}}};try{let{modelPath:e}=await a.createCustomType(o);console.info(`Created page type at ${e.href}`)}catch(e){e instanceof Error?console.error(`Failed to create page type: ${e.message}`):console.error(`Failed to create page type`),process.exitCode=1;return}try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add fields with `prismic page-type add-field`"),a){let e=O(a.id);console.info(` Run \`prismic docs fetch ${e}#write-page-components\` to learn how to implement a page file`)}}async function ym(){let{values:{help:e,"slice-zone":t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Disconnect a shared slice from a page type's slice zone.
1254
+
1255
+ USAGE
1256
+ prismic page-type disconnect-slice <type-id> <slice-id> [flags]
1257
+
1258
+ ARGUMENTS
1259
+ type-id Page type identifier (required)
1260
+ slice-id Slice identifier (required)
1261
+
1262
+ FLAGS
1263
+ -z, --slice-zone string Target slice zone field ID (default: "slices")
1264
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1265
+ -h, --help Show help for command
1266
+
1267
+ EXAMPLES
1268
+ prismic page-type disconnect-slice homepage CallToAction
1269
+ prismic page-type disconnect-slice homepage CallToAction --slice-zone slices
1270
+ prismic page-type disconnect-slice article HeroSection -z body`);return}if(!r){console.error(`Missing required argument: type-id
1271
+ `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: slice-id
1272
+ `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let a=await k();if(!a)return;let o;try{o=await a.readCustomType(r)}catch{console.error(`Page type not found: ${r}\n\nCreate it first with: prismic page-type create ${r}`),process.exitCode=1;return}let s=t??`slices`,c,l;for(let[,e]of Object.entries(o.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===s){c=n,l=t;break}if(c)break}if(!c){console.error(`Slice zone "${s}" not found in page type "${r}"`),process.exitCode=1;return}if(!c.config?.choices||!(i in c.config.choices)){console.error(`Slice "${i}" is not connected to slice zone "${l}" in ${r}`),process.exitCode=1;return}delete c.config.choices[i];try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Disconnected slice "${i}" from slice zone "${l}" in ${r}`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const bm=u({id:p(),label:p(),repeatable:d(),status:d(),format:f(p()),json:s(p(),s(p(),de()))});async function xm(){let{values:{help:e,json:t}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`List all page types in a Prismic project.
1273
+
1274
+ USAGE
1275
+ prismic page-type list [flags]
1276
+
1277
+ FLAGS
1278
+ --json Output as JSON
1279
+ -h, --help Show help for command
1280
+
1281
+ EXAMPLES
1282
+ prismic page-type list
1283
+ prismic page-type list --json`);return}let n=await se(`package.json`);if(!n){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let r=new URL(`customtypes/`,n),i;try{i=await ge(r,{withFileTypes:!1})}catch{t?console.info(JSON.stringify([])):console.info(`No page types found.`);return}let a=[];for(let e of i){let t=new URL(`${e}/index.json`,r);try{let e=await he(t,`utf8`),n=c(bm,JSON.parse(e));n.success&&n.output.format===`page`&&a.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(a.length===0){t?console.info(JSON.stringify([])):console.info(`No page types found.`);return}if(t)console.info(JSON.stringify(a,null,2));else{console.info(`ID LABEL TYPE`);for(let e of a){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}async function Sm(){let{values:{help:e,y:t,types:n},positionals:[r]}=A({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a page type from the project.
1284
+
1285
+ USAGE
1286
+ prismic page-type remove <type-id> [flags]
1287
+
1288
+ ARGUMENTS
1289
+ type-id Page type identifier (required)
1290
+
1291
+ FLAGS
1292
+ -y Confirm removal
1293
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1294
+ -h, --help Show help for command
1295
+
1296
+ EXAMPLES
1297
+ prismic page-type remove homepage
1298
+ prismic page-type remove homepage -y`);return}if(!r){console.error(`Missing required argument: type-id
1299
+ `),console.error(`Usage: prismic page-type remove <type-id>`),process.exitCode=1;return}let i=await k();if(!i)return;let a;try{a=await i.readCustomType(r)}catch{console.error(`Page type not found: ${r}\n\nCreate it first with: prismic page-type create ${r}`),process.exitCode=1;return}if(a.format!==`page`){console.error(`"${r}" is not a page type (format: ${a.format??`custom`})`),process.exitCode=1;return}if(!t){console.error(`Refusing to remove page type "${r}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await i.deleteCustomType(r)}catch(e){e instanceof Error?console.error(`Failed to remove page type: ${e.message}`):console.error(`Failed to remove page type`),process.exitCode=1;return}console.info(`Removed page type "${r}"`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Cm(){let{values:{help:e,tab:t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a field from a page type.
1300
+
1301
+ USAGE
1302
+ prismic page-type remove-field <type-id> <field-id> [flags]
1303
+
1304
+ ARGUMENTS
1305
+ type-id Page type identifier (required)
1306
+ field-id Field identifier (required)
1307
+
1308
+ FLAGS
1309
+ --tab string Specific tab (searches all tabs if not specified)
1310
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1311
+ -h, --help Show help for command
1312
+
1313
+ EXAMPLES
1314
+ prismic page-type remove-field homepage title
1315
+ prismic page-type remove-field homepage meta_title --tab "SEO & Metadata"`);return}if(!r){console.error(`Missing required argument: type-id
1316
+ `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: field-id
1317
+ `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let a=await k();if(!a)return;let o;try{o=await a.readCustomType(r)}catch{console.error(`Page type not found: ${r}\n\nCreate it first with: prismic page-type create ${r}`),process.exitCode=1;return}if(o.format!==`page`){console.error(`"${r}" is not a page type (format: ${o.format??`custom`})`),process.exitCode=1;return}let s;if(t){if(!o.json[t]){console.error(`Tab "${t}" not found in page type "${r}"`),console.error(`Available tabs: ${Object.keys(o.json).join(`, `)}`),process.exitCode=1;return}if(!(i in o.json[t])){console.error(`Field "${i}" not found in tab "${t}"`),process.exitCode=1;return}delete o.json[t][i],s=t}else{for(let[e,t]of Object.entries(o.json))if(i in t){delete t[i],s=e;break}if(!s){console.error(`Field "${i}" not found in any tab of page type "${r}"`),process.exitCode=1;return}}try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Removed field "${i}" from tab "${s}" in page type "${r}"`);try{await R({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function wm(){let{values:{help:e,types:t},positionals:[n,r]}=A({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Change a page type's display name (label).
1318
+
1319
+ USAGE
1320
+ prismic page-type set-name <type-id> <new-name> [flags]
1321
+
1322
+ ARGUMENTS
1323
+ type-id Page type identifier (required)
1324
+ new-name New display name (required)
1325
+
1326
+ FLAGS
1327
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1328
+ -h, --help Show help for command
1329
+
1330
+ EXAMPLES
1331
+ prismic page-type set-name homepage "Home Page"
1332
+ prismic page-type set-name blog_post "Blog Post"`);return}if(!n){console.error(`Missing required argument: type-id
1333
+ `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!r){console.error(`Missing required argument: new-name
1334
+ `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}let i=await k();if(!i)return;let a;try{a=await i.readCustomType(n)}catch{console.error(`Page type not found: ${n}\n\nCreate it first with: prismic page-type create ${n}`),process.exitCode=1;return}if(a.format!==`page`){console.error(`"${n}" is not a page type (format: ${a.format??`custom`})`),process.exitCode=1;return}a.label=r;try{await i.updateCustomType(a)}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Renamed page type "${n}" to "${r}"`);try{await R({output:t}),console.info(`Updated types in ${t??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Tm(){let{values:{help:e,types:t},positionals:[n,r]}=A({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set whether a page type is repeatable.
1335
+
1336
+ USAGE
1337
+ prismic page-type set-repeatable <type-id> <true|false> [flags]
1338
+
1339
+ ARGUMENTS
1340
+ type-id Page type identifier (required)
1341
+ true|false Repeatable value (required)
1342
+
1343
+ FLAGS
1344
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1345
+ -h, --help Show help for command
1346
+
1347
+ EXAMPLES
1348
+ prismic page-type set-repeatable homepage true
1349
+ prismic page-type set-repeatable settings false`);return}if(!n){console.error(`Missing required argument: type-id
1350
+ `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(!r){console.error(`Missing required argument: true|false
1351
+ `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(r!==`true`&&r!==`false`){console.error(`Invalid value: "${r}". Must be "true" or "false".`),process.exitCode=1;return}let i=r===`true`,a=await k();if(!a)return;let o;try{o=await a.readCustomType(n)}catch{console.error(`Page type not found: ${n}\n\nCreate it first with: prismic page-type create ${n}`),process.exitCode=1;return}if(o.format!==`page`){console.error(`"${n}" is not a page type (format: ${o.format??`custom`})`),process.exitCode=1;return}o.repeatable=i;try{await a.updateCustomType(o)}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}let s=i?`repeatable`:`singleton`;console.info(`Set page type "${n}" to ${s}`);try{await R({output:t}),console.info(`Updated types in ${t??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Em=u({id:p(),label:p(),repeatable:d(),status:d(),format:f(p()),json:s(p(),s(p(),de()))});async function Dm(){let{values:{help:e,json:t},positionals:[n]}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`View details of a specific page type.
1352
+
1353
+ USAGE
1354
+ prismic page-type view <type-id> [flags]
1355
+
1356
+ ARGUMENTS
1357
+ type-id Page type identifier (required)
1358
+
1359
+ FLAGS
1360
+ --json Output as JSON
1361
+ -h, --help Show help for command
1362
+
1363
+ EXAMPLES
1364
+ prismic page-type view homepage
1365
+ prismic page-type view homepage --json`);return}if(!n){console.error(`Missing required argument: type-id
1366
+ `),console.error(`Usage: prismic page-type view <type-id>`),process.exitCode=1;return}let r=await se(`package.json`);if(!r){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let i=new URL(`customtypes/${n}/index.json`,r),a;try{let e=await he(i,`utf8`),t=c(Em,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${i.href}`),process.exitCode=1;return}a=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${n}\n`),console.error(`Create it first with: prismic page-type create ${n}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(a.format!==`page`){console.error(`"${n}" is not a page type (format: ${a.format??`custom`})`),process.exitCode=1;return}if(t){console.info(JSON.stringify(a,null,2));return}console.info(`ID: ${a.id}`),console.info(`Label: ${a.label}`),console.info(`Repeatable: ${a.repeatable}`);let o=Object.entries(a.json);console.info(`\nTabs (${o.length}):`);for(let[e,t]of o){let n=Object.keys(t).length;console.info(` - ${e}: ${n} fields`)}}async function Om(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`create`:await vm();break;case`list`:await xm();break;case`view`:await Dm();break;case`remove`:await Sm();break;case`set-name`:await wm();break;case`set-repeatable`:await Tm();break;case`add-field`:await gm();break;case`remove-field`:await Cm();break;case`connect-slice`:await _m();break;case`disconnect-slice`:await ym();break;default:e&&(console.error(`Unknown page-type subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage page types in a Prismic repository.
1367
+
1368
+ USAGE
1369
+ prismic page-type <command> [flags]
1370
+
1371
+ COMMANDS
1372
+ create Create a new page type
1373
+ list List all page types
1374
+ view View details of a page type
1375
+ remove Remove a page type
1376
+ set-name Change a page type's display name
1377
+ set-repeatable Set whether a page type is repeatable
1378
+ add-field Add a field to a page type
1379
+ remove-field Remove a field from a page type
1380
+ connect-slice Connect a shared slice to a page type
1381
+ disconnect-slice Disconnect a shared slice from a page type
1382
+
1383
+ FLAGS
1384
+ -h, --help Show help for command
1385
+
1386
+ LEARN MORE
1387
+ Use \`prismic page-type <command> --help\` for more information about a command.`)}}async function km(){let{values:{help:e,name:t,repo:r=await E()},positionals:[i]}=A({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a preview configuration to a Prismic repository.
1388
+
1389
+ By default, this command reads the repository from prismic.config.json at the
1390
+ project root.
1391
+
1392
+ USAGE
1393
+ prismic preview add <url> [flags]
1394
+
1395
+ ARGUMENTS
1396
+ <url> Preview URL (e.g. https://example.com/api/preview)
1397
+
1398
+ FLAGS
1399
+ -n, --name string Display name (defaults to hostname)
1400
+ -r, --repo string Repository domain
1401
+ -h, --help Show help for command
1402
+
1403
+ LEARN MORE
1404
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Mm();return}let a=Am(i);if(!a){console.error(`Invalid URL: ${i}`),process.exitCode=1;return}let o=await jm(r,{name:t||a.hostname,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!o.ok){o.error instanceof $?Mm():(console.error(`Failed to add preview: ${S(o.value)}`),process.exitCode=1);return}console.info(`Preview added: ${i}`)}function Am(e){try{let t=new URL(e);return{websiteURL:`${t.protocol}//${t.host}`,resolverPath:t.pathname===`/`?void 0:t.pathname,hostname:t.hostname}}catch{return}}async function jm(e,t){return await Q(new URL(`/previews/new`,await x(e)),{method:`POST`,body:{name:t.name,websiteURL:t.websiteURL,resolverPath:t.resolverPath}})}function Mm(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Nm(){let{values:{help:e,repo:t=await E(),json:r}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Show the slice simulator URL for a Prismic repository.
1405
+
1406
+ By default, this command reads the repository from prismic.config.json at the
1407
+ project root.
1408
+
1409
+ USAGE
1410
+ prismic preview get-simulator [flags]
1411
+
1412
+ FLAGS
1413
+ --json Output as JSON
1414
+ -r, --repo string Repository domain
1415
+ -h, --help Show help for command
1416
+
1417
+ LEARN MORE
1418
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Im();return}let i=await Fm(t);if(!i.ok){i.error instanceof $?Im():w(i.error)?(console.error(`Failed to get simulator URL: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to get simulator URL: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.simulator_url;if(!a){r?console.info(S({simulator_url:null})):console.info(`No simulator URL configured.`);return}r?console.info(S({simulator_url:a})):console.info(a)}const Pm=u({simulator_url:f(p())});async function Fm(e){return await Q(new URL(`/core/repository`,await x(e)),{schema:Pm})}function Im(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Lm(){let{values:{help:e,repo:t=await E(),json:r}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`List all preview configurations in a Prismic repository.
1419
+
1420
+ By default, this command reads the repository from prismic.config.json at the
1421
+ project root.
1422
+
1423
+ USAGE
1424
+ prismic preview list [flags]
1425
+
1426
+ FLAGS
1427
+ --json Output as JSON
1428
+ -r, --repo string Repository domain
1429
+ -h, --help Show help for command
1430
+
1431
+ LEARN MORE
1432
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Bm();return}let i=await zm(t);if(!i.ok){i.error instanceof $?Bm():w(i.error)?(console.error(`Failed to list previews: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list previews: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(S(a));else for(let e of a)console.info(`${e.url} ${e.label}`)}const Rm=u({results:r(u({id:p(),label:p(),url:p()}))});async function zm(e){return await Q(new URL(`/core/repository/preview_configs`,await x(e)),{schema:Rm})}function Bm(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Vm(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a preview configuration from a Prismic repository.
1433
+
1434
+ By default, this command reads the repository from prismic.config.json at the
1435
+ project root.
1436
+
1437
+ USAGE
1438
+ prismic preview remove <url> [flags]
1439
+
1440
+ ARGUMENTS
1441
+ <url> Preview URL to remove
1442
+
1443
+ FLAGS
1444
+ -r, --repo string Repository domain
1445
+ -h, --help Show help for command
1446
+
1447
+ LEARN MORE
1448
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Um();return}let i=await zm(t);if(!i.ok){i.error instanceof $?Um():(console.error(`Failed to fetch previews: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.results.find(e=>e.url===r);if(!a){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let o=await Hm(t,a.id);if(!o.ok){o.error instanceof $?Um():(console.error(`Failed to remove preview: ${S(o.value)}`),process.exitCode=1);return}console.info(`Preview removed: ${r}`)}async function Hm(e,t){return await Q(new URL(`/previews/delete/${t}`,await x(e)),{method:`POST`,body:{}})}function Um(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Wm(){let{values:{help:e,repo:t=await E()}}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Remove the slice simulator URL from a Prismic repository.
1449
+
1450
+ By default, this command reads the repository from prismic.config.json at the
1451
+ project root.
1452
+
1453
+ USAGE
1454
+ prismic preview remove-simulator [flags]
1455
+
1456
+ FLAGS
1457
+ -r, --repo string Repository domain
1458
+ -h, --help Show help for command
1459
+
1460
+ LEARN MORE
1461
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Km();return}let r=await Gm(t);if(!r.ok){r.error instanceof $?Km():(console.error(`Failed to remove simulator URL: ${S(r.value)}`),process.exitCode=1);return}console.info(`Simulator URL removed.`)}async function Gm(e){return await Q(new URL(`/core/repository`,await x(e)),{method:`PATCH`,body:{simulator_url:``}})}function Km(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function qm(){let{values:{help:e,repo:t=await E()},positionals:[r,i]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Update the name of a preview configuration.
1462
+
1463
+ By default, this command reads the repository from prismic.config.json at the
1464
+ project root.
1465
+
1466
+ USAGE
1467
+ prismic preview set-name <url> <name> [flags]
1468
+
1469
+ ARGUMENTS
1470
+ <url> Preview URL to update
1471
+ <name> New display name
1472
+
1473
+ FLAGS
1474
+ -r, --repo string Repository domain
1475
+ -h, --help Show help for command
1476
+
1477
+ LEARN MORE
1478
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Ym();return}let a=Am(r);if(!a){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let o=await zm(t);if(!o.ok){o.error instanceof $?Ym():(console.error(`Failed to fetch previews: ${S(o.value)}`),process.exitCode=1);return}let s=o.value.results.find(e=>e.url===r);if(!s){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let c=await Jm(t,s.id,{name:i,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!c.ok){c.error instanceof $?Ym():(console.error(`Failed to update preview: ${S(c.value)}`),process.exitCode=1);return}console.info(`Preview updated: ${r}`)}async function Jm(e,t,n){return await Q(new URL(`/previews/save/${t}`,await x(e)),{method:`POST`,body:{name:n.name,websiteURL:n.websiteURL,resolverPath:n.resolverPath}})}function Ym(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Xm(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set the slice simulator URL for a Prismic repository.
1479
+
1480
+ If the URL pathname does not end with /slice-simulator, it is appended
1481
+ automatically.
1482
+
1483
+ By default, this command reads the repository from prismic.config.json at the
1484
+ project root.
1485
+
1486
+ USAGE
1487
+ prismic preview set-simulator <url> [flags]
1488
+
1489
+ ARGUMENTS
1490
+ <url> Simulator URL (e.g. https://example.com/slice-simulator)
1491
+
1492
+ FLAGS
1493
+ -r, --repo string Repository domain
1494
+ -h, --help Show help for command
1495
+
1496
+ EXAMPLES
1497
+ prismic preview set-simulator https://my-site.com
1498
+ prismic preview set-simulator http://localhost:3000/slice-simulator
1499
+
1500
+ LEARN MORE
1501
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){$m();return}let i=Zm(r);if(!i){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let a=await Qm(t,i);if(!a.ok){a.error instanceof $?$m():(console.error(`Failed to set simulator URL: ${S(a.value)}`),process.exitCode=1);return}console.info(`Simulator URL set: ${i}`)}function Zm(e){try{let t=new URL(e);return t.pathname.endsWith(`/slice-simulator`)||(t.pathname=t.pathname.replace(/\/+$/,``)+`/slice-simulator`),t.toString()}catch{return}}async function Qm(e,t){return await Q(new URL(`/core/repository`,await x(e)),{method:`PATCH`,body:{simulator_url:t}})}function $m(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function eh(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`add`:await km();break;case`list`:await Lm();break;case`remove`:await Vm();break;case`set-name`:await qm();break;case`set-simulator`:await Xm();break;case`get-simulator`:await Nm();break;case`remove-simulator`:await Wm();break;default:e&&(console.error(`Unknown preview subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage preview configurations in a Prismic repository.
1502
+
1503
+ USAGE
1504
+ prismic preview <command> [flags]
1505
+
1506
+ COMMANDS
1507
+ add Add a preview configuration
1508
+ list List preview configurations
1509
+ remove Remove a preview configuration
1510
+ set-name Update a preview's name
1511
+ set-simulator Set the slice simulator URL
1512
+ get-simulator Show the slice simulator URL
1513
+ remove-simulator Remove the slice simulator URL
1514
+
1515
+ FLAGS
1516
+ -h, --help Show help for command
1517
+
1518
+ LEARN MORE
1519
+ Use \`prismic preview <command> --help\` for more information about a command.`)}}async function th(){let{values:{help:e,repo:t=await E(),"dry-run":r,"types-only":i,"slices-only":a,json:o,types:s}}=A({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},json:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Pull custom types and slices from Prismic to local files.
1520
+
1521
+ By default, this command reads the repository from prismic.config.json at the
1522
+ project root.
1523
+
1524
+ USAGE
1525
+ prismic pull [flags]
1526
+
1527
+ FLAGS
1528
+ -r, --repo string Repository domain
1529
+ --dry-run Show what would be pulled without writing files
1530
+ --types-only Only pull custom types
1531
+ --slices-only Only pull slices
1532
+ --json Output as JSON
1533
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1534
+ -h, --help Show help for command
1535
+
1536
+ EXAMPLES
1537
+ prismic pull
1538
+ prismic pull --repo my-repo
1539
+ prismic pull --dry-run
1540
+ prismic pull --types-only`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}o||console.info(`Pulling from repository: ${t}\n`);let c=!a,l=!i,[u,d]=await Promise.all([c?yp(t):Promise.resolve({ok:!0,value:[]}),l?bp(t):Promise.resolve({ok:!0,value:[]})]);if(!u.ok){console.error(`Failed to fetch custom types: ${u.error}`),process.exitCode=1;return}if(!d.ok){console.error(`Failed to fetch slices: ${d.error}`),process.exitCode=1;return}let f=u.value,p=d.value;o||(c&&console.info(`Fetching custom types... ${f.length} types`),l&&console.info(`Fetching slices... ${p.length} slices`));let m=await k();if(!m)return;if(r){if(o)console.info(S({customTypes:f,slices:p}));else{if(console.info(``),c&&f.length>0){console.info(`Would write custom types:`);for(let e of f)console.info(` customtypes/${e.id}/index.json`)}if(l&&p.length>0){let e=nh(await m.getDefaultSliceLibrary());console.info(`Would write slices:`);for(let t of p)console.info(` ${e}${fe(t.name)}/model.json`)}console.info(`\nDry run complete: ${f.length} custom types, ${p.length} slices`)}return}let h=await m.getSlices(),g=new Set(h.map(e=>e.model.id)),_=await m.getDefaultSliceLibrary(),v=[],y=[];if(c&&f.length>0){o||console.info(`
1541
+ Writing custom types:`);for(let e of f)try{await m.updateCustomType(e);let t=`customtypes/${e.id}/index.json`;v.push(t),o||console.info(` ${t}`)}catch(t){console.error(`Failed to write custom type ${e.id}: ${t instanceof Error?t.message:t}`),process.exitCode=1;return}}if(l&&p.length>0){o||console.info(`
1542
+ Writing slices:`);let e=await m.getDefaultSliceLibrary();for(let t of p)try{g.has(t.id)?await m.updateSlice(t):await m.createSlice(t,_);let n=`${nh(e)}${fe(t.name)}/model.json`;y.push(n),o||console.info(` ${n}`)}catch(e){console.error(`Failed to write slice ${t.name}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}if(o?console.info(S({writtenTypes:v,writtenSlices:y})):console.info(`\nPull complete: ${v.length} custom types, ${y.length} slices`),!o)try{await R({output:s,framework:m}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}function nh(e){let t=process.cwd(),n=e.pathname;return n.startsWith(t)?n.slice(t.length+1):n}function rh(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[],a=[],o=[];for(let t of e){let e=r.get(t.id);e?JSON.stringify(t)!==JSON.stringify(e)&&a.push(t):i.push(t)}for(let e of t)n.has(e.id)||o.push(e.id);return{toInsert:i,toUpdate:a,toDelete:o}}async function ih(){let{values:{help:e,repo:t=await E(),"dry-run":r,"types-only":i,"slices-only":a,delete:o,json:s}}=A({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},delete:{type:`boolean`},json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Push custom types and slices to Prismic from local files.
1543
+
1544
+ By default, this command reads the repository from prismic.config.json at the
1545
+ project root.
1546
+
1547
+ USAGE
1548
+ prismic push [flags]
1549
+
1550
+ FLAGS
1551
+ -r, --repo string Repository domain
1552
+ --dry-run Show what would be pushed without making changes
1553
+ --types-only Only push custom types
1554
+ --slices-only Only push slices
1555
+ --delete Delete remote models that don't exist locally (dangerous)
1556
+ --json Output as JSON
1557
+ -h, --help Show help for command
1558
+
1559
+ EXAMPLES
1560
+ prismic push
1561
+ prismic push --repo my-repo
1562
+ prismic push --dry-run
1563
+ prismic push --types-only
1564
+ prismic push --delete`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}s||console.info(`Pushing to repository: ${t}\n`);let c=!a,l=!i,u=await k();if(!u)return;let d,f;try{let[e,t]=await Promise.all([c?u.getCustomTypes():Promise.resolve([]),l?u.getSlices():Promise.resolve([])]);d=e.map(e=>e.model),f=t.map(e=>e.model)}catch(e){console.error(`Failed to read local models: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}let[p,m]=await Promise.all([c?yp(t):Promise.resolve({ok:!0,value:[]}),l?bp(t):Promise.resolve({ok:!0,value:[]})]);if(!p.ok){console.error(`Failed to fetch remote custom types: ${p.error}`),process.exitCode=1;return}if(!m.ok){console.error(`Failed to fetch remote slices: ${m.error}`),process.exitCode=1;return}let h=p.value,g=m.value;s||(c&&(console.info(`Local custom types: ${d.length}`),console.info(`Remote custom types: ${h.length}`)),l&&(console.info(`Local slices: ${f.length}`),console.info(`Remote slices: ${g.length}`)));let _=c?rh([...d],[...h]):{toInsert:[],toUpdate:[],toDelete:[]},v=l?rh([...f],[...g]):{toInsert:[],toUpdate:[],toDelete:[]};o||(_.toDelete=[],v.toDelete=[]);let y=_.toInsert.length+_.toUpdate.length+_.toDelete.length+v.toInsert.length+v.toUpdate.length+v.toDelete.length;if(y===0){s?console.info(S({customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}})):console.info(`
1565
+ No changes to push.`);return}if(r){if(s)console.info(S({customTypes:{toInsert:_.toInsert.map(e=>e.id),toUpdate:_.toUpdate.map(e=>e.id),toDelete:_.toDelete},slices:{toInsert:v.toInsert.map(e=>e.id),toUpdate:v.toUpdate.map(e=>e.id),toDelete:v.toDelete}}));else{if(console.info(``),c){if(_.toInsert.length>0){console.info(`Would insert custom types:`);for(let e of _.toInsert)console.info(` + ${e.id}`)}if(_.toUpdate.length>0){console.info(`Would update custom types:`);for(let e of _.toUpdate)console.info(` ~ ${e.id}`)}if(_.toDelete.length>0){console.info(`Would delete custom types:`);for(let e of _.toDelete)console.info(` - ${e}`)}}if(l){if(v.toInsert.length>0){console.info(`Would insert slices:`);for(let e of v.toInsert)console.info(` + ${e.id}`)}if(v.toUpdate.length>0){console.info(`Would update slices:`);for(let e of v.toUpdate)console.info(` ~ ${e.id}`)}if(v.toDelete.length>0){console.info(`Would delete slices:`);for(let e of v.toDelete)console.info(` - ${e}`)}}console.info(`\nDry run complete: ${y} changes would be made`)}return}let b={customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}};if(c){!s&&(_.toInsert.length>0||_.toUpdate.length>0||_.toDelete.length>0)&&console.info(`
1566
+ Pushing custom types:`);for(let e of _.toInsert){let n=await xp(t,e);if(!n.ok){console.error(`Failed to insert custom type ${e.id}: ${n.error}`),process.exitCode=1;return}b.customTypes.inserted.push(e.id),s||console.info(` + ${e.id}`)}for(let e of _.toUpdate){let n=await Sp(t,e);if(!n.ok){console.error(`Failed to update custom type ${e.id}: ${n.error}`),process.exitCode=1;return}b.customTypes.updated.push(e.id),s||console.info(` ~ ${e.id}`)}for(let e of _.toDelete){let n=await Cp(t,e);if(!n.ok){console.error(`Failed to delete custom type ${e}: ${n.error}`),process.exitCode=1;return}b.customTypes.deleted.push(e),s||console.info(` - ${e}`)}}if(l){!s&&(v.toInsert.length>0||v.toUpdate.length>0||v.toDelete.length>0)&&console.info(`
1567
+ Pushing slices:`);for(let e of v.toInsert){let n=await wp(t,e);if(!n.ok){console.error(`Failed to insert slice ${e.id}: ${n.error}`),process.exitCode=1;return}b.slices.inserted.push(e.id),s||console.info(` + ${e.id}`)}for(let e of v.toUpdate){let n=await Tp(t,e);if(!n.ok){console.error(`Failed to update slice ${e.id}: ${n.error}`),process.exitCode=1;return}b.slices.updated.push(e.id),s||console.info(` ~ ${e.id}`)}for(let e of v.toDelete){let n=await Ep(t,e);if(!n.ok){console.error(`Failed to delete slice ${e}: ${n.error}`),process.exitCode=1;return}b.slices.deleted.push(e),s||console.info(` - ${e}`)}}if(s)console.info(S(b));else{let e=b.customTypes.inserted.length+b.customTypes.updated.length+b.customTypes.deleted.length+b.slices.inserted.length+b.slices.updated.length+b.slices.deleted.length;console.info(`\nPush complete: ${e} changes`)}}const ah=/^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/;async function oh(){let{values:{help:e,name:t,"no-config":r,replace:i},positionals:[a]}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},name:{type:`string`,short:`n`},"no-config":{type:`boolean`},replace:{type:`boolean`}},allowPositionals:!0});if(e){console.info(`Create a new Prismic repository.
1568
+
1569
+ Creates prismic.config.json in the current directory. If a config file already
1570
+ exists, use --replace to update it with the new repository.
1571
+
1572
+ USAGE
1573
+ prismic repo create <domain> [flags]
1574
+
1575
+ ARGUMENTS
1576
+ domain Repository domain (required). Must be at least 4 characters,
1577
+ start and end with alphanumeric, and contain only alphanumerics and hyphens.
1578
+
1579
+ FLAGS
1580
+ -n, --name string Display name for the repository (defaults to domain)
1581
+ --no-config Skip creating or updating prismic.config.json
1582
+ --replace Replace existing repositoryName in prismic.config.json
1583
+ -h, --help Show help for command
1584
+
1585
+ LEARN MORE
1586
+ Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!a){console.error(`Missing required argument: domain`),process.exitCode=1;return}if(!ah.test(a)){console.error(`Invalid domain format.`),console.error(`Must be at least 4 characters, start and end with alphanumeric, and contain only alphanumerics and hyphens.`),process.exitCode=1;return}if(!await n()){lh();return}let o=await oe();if(!r&&o.ok&&!i){console.error(`This project already has a repository: ${o.config.repositoryName}`),console.error(`Use --replace to replace it, or --no-config to skip config creation.`),process.exitCode=1;return}let s=await sh(a);if(!s.ok){s.error instanceof $?lh():(console.error(`Failed to check domain availability: ${S(s.error)}`),process.exitCode=1);return}if(!s.value){console.error(`Repository name "${a}" is already taken.`),process.exitCode=1;return}let c=await ch(a,t);if(!c.ok){c.error instanceof $?lh():(console.error(`Failed to create repository: ${S(c.error)}`),process.exitCode=1);return}if(!r)if(o.ok){let e=await C({repositoryName:a});e.ok?console.info(`Updated prismic.config.json`):console.warn(`Could not update prismic.config.json: `+e.error.message)}else{let e=await ne({repositoryName:a});e.ok?console.info(`Created prismic.config.json`):console.warn(`Could not create prismic.config.json: `+e.error.message)}console.info(`Repository created: ${a}`),console.info(`URL: ${await x(a)}`);let l=await re();if(l){let e=O(l.id),t=ae(l.id),n=await l.getClientFilePath(),r=n?`creating ${n}`:`configuring Prismic`;console.info(),console.info(`Next: Run \`prismic docs fetch ${e}${t}\` for instructions on ${r}`)}}async function sh(e){let t=await Q(new URL(`/app/dashboard/repositories/${e}/exists`,await ce()));return t.ok?{ok:!0,value:t.value===`true`}:t}async function ch(e,t=e){return await Q(new URL(`/app/dashboard/repositories`,await ce()),{method:`POST`,body:{domain:e,name:t,framework:`next`,plan:`personal`,usageIntent:`Exploring Prismic's features for future projects.`,usageIntentIndex:0}})}function lh(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const uh=u({repository:u({api_access:p()})});async function dh(){let{values:{help:e,repo:t=await E()}}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Get the Content API access level of a Prismic repository.
1587
+
1588
+ By default, this command reads the repository from prismic.config.json at the
1589
+ project root.
1590
+
1591
+ USAGE
1592
+ prismic repo get-access [flags]
1593
+
1594
+ FLAGS
1595
+ -r, --repo string Repository domain
1596
+ -h, --help Show help for command
1597
+
1598
+ LEARN MORE
1599
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){ph();return}let r=await fh(t);if(!r.ok){r.error instanceof $?ph():(console.error(`Failed to get repository access: ${S(r.value)}`),process.exitCode=1);return}console.info(r.value.repository.api_access)}async function fh(e){let t=await x(e);return await Q(new URL(`syncState`,t),{schema:uh})}function ph(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const mh=u({repositories:r(u({domain:p(),name:f(p()),role:p()}))});async function hh(){let{values:{help:e,json:t}}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},json:{type:`boolean`}}});if(e){console.info(`List all Prismic repositories.
1600
+
1601
+ USAGE
1602
+ prismic repo list [flags]
1603
+
1604
+ FLAGS
1605
+ --json Output as JSON
1606
+ -h, --help Show help for command
1607
+
1608
+ LEARN MORE
1609
+ Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!await n()){_h();return}let r=await gh();if(!r.ok){r.error instanceof $?_h():(console.error(`Failed to fetch repositories: ${S(r.value)}`),process.exitCode=1);return}let i=r.value.repositories;if(t){let e=await Promise.all(i.map(async e=>({domain:e.domain,name:e.name||null,role:e.role,url:(await x(e.domain)).toString()})));console.info(S(e));return}if(i.length===0){console.info(`No repositories found.`);return}for(let e of i){let t=e.name||`(no name)`;console.info(`${e.domain} ${t} ${e.role}`)}}async function gh(){return await Q(new URL(`profile`,await le()),{schema:mh})}function _h(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const vh=[`private`,`public`,`open`];async function yh(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set the Content API access level of a Prismic repository.
1610
+
1611
+ By default, this command reads the repository from prismic.config.json at the
1612
+ project root.
1613
+
1614
+ USAGE
1615
+ prismic repo set-access <level> [flags]
1616
+
1617
+ ARGUMENTS
1618
+ <level> The access level to set (private, public, open)
1619
+
1620
+ FLAGS
1621
+ -r, --repo string Repository domain
1622
+ -h, --help Show help for command
1623
+
1624
+ LEARN MORE
1625
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <level>`),process.exitCode=1;return}if(!vh.includes(r)){console.error(`Invalid access level: ${r}. Must be one of: ${vh.join(`, `)}`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){xh();return}let i=await bh(t,r);if(!i.ok){i.error instanceof $?xh():(console.error(`Failed to set repository access: ${S(i.value)}`),process.exitCode=1);return}console.info(`Repository access set to: ${r}`)}async function bh(e,t){let n=await x(e);return await Q(new URL(`settings/security/apiaccess`,n),{method:`POST`,body:{api_access:t}})}function xh(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Sh(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set the display name of a Prismic repository.
1626
+
1627
+ By default, this command reads the repository from prismic.config.json at the
1628
+ project root.
1629
+
1630
+ USAGE
1631
+ prismic repo set-name <name> [flags]
1632
+
1633
+ ARGUMENTS
1634
+ <name> The new display name for the repository
1635
+
1636
+ FLAGS
1637
+ -r, --repo string Repository domain
1638
+ -h, --help Show help for command
1639
+
1640
+ LEARN MORE
1641
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){wh();return}let i=await Ch(t,r);if(!i.ok){i.error instanceof $?wh():w(i.error)?(console.error(`Failed to set repository name: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set repository name: ${S(i.value)}`),process.exitCode=1);return}console.info(`Repository name set to: ${i.value.repository.name}`)}async function Ch(e,t){let n=await x(e),r=new URL(`app/settings/repository`,n),i=new FormData;return i.set(`displayname`,t),await Q(r,{method:`POST`,body:i,schema:u({repository:u({name:p()})})})}function wh(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Th=u({repositories:r(u({domain:p(),name:f(p())}))});async function Eh(){let{values:{help:e,repo:t=await E(),web:r}}=A({args:process.argv.slice(4),options:{web:{type:`boolean`,short:`w`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}}});if(e){console.info(`View a Prismic repository.
1642
+
1643
+ By default, this command reads the repository from prismic.config.json at the
1644
+ project root.
1645
+
1646
+ USAGE
1647
+ prismic repo view [flags]
1648
+
1649
+ FLAGS
1650
+ -w, --web Open repository in browser
1651
+ -r, --repo string Repository domain
1652
+ -h, --help Show help for command
1653
+
1654
+ LEARN MORE
1655
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}let i=await x(t);if(r){Oh(i.toString()),console.info(`Opening ${i}`);return}if(!await n()){kh();return}let a=await Dh();if(!a.ok){a.error instanceof $?kh():(console.error(`Failed to fetch repository info: ${S(a.value)}`),process.exitCode=1);return}let o=a.value.repositories.find(e=>e.domain===t);if(!o){console.error(`Repository not found: ${t}`),process.exitCode=1;return}let s=o.name||`(no name)`;console.info(`Name: ${s}`),console.info(`URL: ${i}`)}async function Dh(){return await Q(new URL(`profile`,await le()),{schema:Th})}function Oh(e){ke(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e}"`)}function kh(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Ah(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`create`:await oh();break;case`list`:await hh();break;case`view`:await Eh();break;case`get-access`:await dh();break;case`set-access`:await yh();break;case`set-name`:await Sh();break;default:e&&(console.error(`Unknown repo subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage Prismic repositories.
1656
+
1657
+ USAGE
1658
+ prismic repo <command> [flags]
1659
+
1660
+ COMMANDS
1661
+ create Create a new Prismic repository
1662
+ list List all repositories
1663
+ view View repository details
1664
+ get-access Get Content API access level
1665
+ set-access Set Content API access level
1666
+ set-name Set repository display name
1667
+
1668
+ FLAGS
1669
+ -h, --help Show help for command
1670
+
1671
+ LEARN MORE
1672
+ Use \`prismic repo <command> --help\` for more information about a command.`)}}async function jh(){let{values:{help:e,variation:t,label:n,default:r,"true-label":i,"false-label":a,types:o},positionals:[s,c]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a boolean (toggle) field to an existing slice.
1673
+
1674
+ USAGE
1675
+ prismic slice add-field boolean <slice-id> <field-id> [flags]
1676
+
1677
+ ARGUMENTS
1678
+ slice-id Slice identifier (required)
1679
+ field-id Field identifier (required)
1680
+
1681
+ FLAGS
1682
+ -v, --variation string Target variation (default: first variation)
1683
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1684
+ --default Set default value to true
1685
+ --true-label string Label shown when toggle is on
1686
+ --false-label string Label shown when toggle is off
1687
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1688
+ -h, --help Show help for command
1689
+
1690
+ EXAMPLES
1691
+ prismic slice add-field boolean my_slice featured
1692
+ prismic slice add-field boolean hero show_overlay --default
1693
+ prismic slice add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!s){console.error(`Missing required argument: slice-id
1694
+ `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1695
+ `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let l=z(c),u=U(l);if(!u.ok){console.error(u.error),process.exitCode=1;return}let d=await k();if(!d)return;let f;try{f=await d.readSlice(s)}catch{console.error(`Slice not found: ${s}\n\nCreate it first with: prismic slice create ${s}`),process.exitCode=1;return}if(f.variations.length===0){console.error(`Slice "${s}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=t?f.variations.find(e=>e.id===t):f.variations[0];if(!p){console.error(`Variation "${t}" not found in slice "${s}"\n`),console.error(`Available variations: ${f.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};let m={type:`Boolean`,config:{label:n??T(l.type===`nested`?l.nestedFieldId:c),...r&&{default_value:!0},...i&&{placeholder_true:i},...a&&{placeholder_false:a}}};if(l.type===`nested`){let e=H(p.primary,l.groupId,p.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[l.nestedFieldId]){console.error(`Field "${l.nestedFieldId}" already exists in group "${l.groupId}"`),process.exitCode=1;return}e.group.config.fields[l.nestedFieldId]=m}else{for(let e of f.variations){if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[c]){console.error(`Field "${c}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}p.primary[c]=m}try{await d.updateSlice(f)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}l.type===`nested`?console.info(`Added field "${l.nestedFieldId}" (Boolean) to group "${l.groupId}" in ${s}`):console.info(`Added field "${c}" (Boolean) to "${p.id}" variation in ${s}`);try{await R({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),d){let e=O(d.id),t=D(d.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Mh(){let{values:{help:e,variation:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a color picker field to an existing slice.
1696
+
1697
+ USAGE
1698
+ prismic slice add-field color <slice-id> <field-id> [flags]
1699
+
1700
+ ARGUMENTS
1701
+ slice-id Slice identifier (required)
1702
+ field-id Field identifier (required)
1703
+
1704
+ FLAGS
1705
+ -v, --variation string Target variation (default: first variation)
1706
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1707
+ -p, --placeholder string Placeholder text
1708
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1709
+ -h, --help Show help for command
1710
+
1711
+ EXAMPLES
1712
+ prismic slice add-field color my_slice background_color
1713
+ prismic slice add-field color hero accent --label "Accent Color"
1714
+ prismic slice add-field color banner theme_color --variation "dark"`);return}if(!a){console.error(`Missing required argument: slice-id
1715
+ `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1716
+ `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(u.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=t?u.variations.find(e=>e.id===t):u.variations[0];if(!d){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};let f={type:`Color`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=H(d.primary,s.groupId,d.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=f}else{for(let e of u.variations){if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[o]){console.error(`Field "${o}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}d.primary[o]=f}try{await l.updateSlice(u)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Color) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Color) to "${d.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),l){let e=O(l.id),t=D(l.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Nh(){let{values:{help:e,variation:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a date picker field to an existing slice.
1717
+
1718
+ USAGE
1719
+ prismic slice add-field date <slice-id> <field-id> [flags]
1720
+
1721
+ ARGUMENTS
1722
+ slice-id Slice identifier (required)
1723
+ field-id Field identifier (required)
1724
+
1725
+ FLAGS
1726
+ -v, --variation string Target variation (default: first variation)
1727
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1728
+ -p, --placeholder string Placeholder text
1729
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1730
+ -h, --help Show help for command
1731
+
1732
+ EXAMPLES
1733
+ prismic slice add-field date my_slice publish_date
1734
+ prismic slice add-field date event start_date --label "Start Date"
1735
+ prismic slice add-field date promo end_date --variation "countdown"`);return}if(!a){console.error(`Missing required argument: slice-id
1736
+ `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1737
+ `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(u.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=t?u.variations.find(e=>e.id===t):u.variations[0];if(!d){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};let f={type:`Date`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=H(d.primary,s.groupId,d.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=f}else{for(let e of u.variations){if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[o]){console.error(`Field "${o}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}d.primary[o]=f}try{await l.updateSlice(u)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Date) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Date) to "${d.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),l){let e=O(l.id),t=D(l.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Ph(){let{values:{help:e,variation:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add an embed (oEmbed) field to an existing slice.
1738
+
1739
+ USAGE
1740
+ prismic slice add-field embed <slice-id> <field-id> [flags]
1741
+
1742
+ ARGUMENTS
1743
+ slice-id Slice identifier (required)
1744
+ field-id Field identifier (required)
1745
+
1746
+ FLAGS
1747
+ -v, --variation string Target variation (default: first variation)
1748
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1749
+ -p, --placeholder string Placeholder text
1750
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1751
+ -h, --help Show help for command
1752
+
1753
+ EXAMPLES
1754
+ prismic slice add-field embed my_slice video
1755
+ prismic slice add-field embed gallery media --label "Media Embed"
1756
+ prismic slice add-field embed social tweet --variation "twitter"`);return}if(!a){console.error(`Missing required argument: slice-id
1757
+ `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1758
+ `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(u.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=t?u.variations.find(e=>e.id===t):u.variations[0];if(!d){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};let f={type:`Embed`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=H(d.primary,s.groupId,d.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=f}else{for(let e of u.variations){if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[o]){console.error(`Field "${o}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}d.primary[o]=f}try{await l.updateSlice(u)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Embed) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Embed) to "${d.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),l){let e=O(l.id),t=D(l.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Fh(){let{values:{help:e,variation:t,label:n,types:r},positionals:[i,a]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a geographic coordinates field to an existing slice.
1759
+
1760
+ USAGE
1761
+ prismic slice add-field geo-point <slice-id> <field-id> [flags]
1762
+
1763
+ ARGUMENTS
1764
+ slice-id Slice identifier (required)
1765
+ field-id Field identifier (required)
1766
+
1767
+ FLAGS
1768
+ -v, --variation string Target variation (default: first variation)
1769
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1770
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1771
+ -h, --help Show help for command
1772
+
1773
+ EXAMPLES
1774
+ prismic slice add-field geo-point my_slice location
1775
+ prismic slice add-field geo-point store coordinates --label "Store Location"
1776
+ prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!i){console.error(`Missing required argument: slice-id
1777
+ `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
1778
+ `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let o=z(a),s=U(o);if(!s.ok){console.error(s.error),process.exitCode=1;return}let c=await k();if(!c)return;let l;try{l=await c.readSlice(i)}catch{console.error(`Slice not found: ${i}\n\nCreate it first with: prismic slice create ${i}`),process.exitCode=1;return}if(l.variations.length===0){console.error(`Slice "${i}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let u=t?l.variations.find(e=>e.id===t):l.variations[0];if(!u){console.error(`Variation "${t}" not found in slice "${i}"\n`),console.error(`Available variations: ${l.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}u.primary||={};let d={type:`GeoPoint`,config:{label:n??T(o.type===`nested`?o.nestedFieldId:a)}};if(o.type===`nested`){let e=H(u.primary,o.groupId,u.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[o.nestedFieldId]){console.error(`Field "${o.nestedFieldId}" already exists in group "${o.groupId}"`),process.exitCode=1;return}e.group.config.fields[o.nestedFieldId]=d}else{for(let e of l.variations){if(e.primary?.[a]){console.error(`Field "${a}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[a]){console.error(`Field "${a}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}u.primary[a]=d}try{await c.updateSlice(l)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}o.type===`nested`?console.info(`Added field "${o.nestedFieldId}" (GeoPoint) to group "${o.groupId}" in ${i}`):console.info(`Added field "${a}" (GeoPoint) to "${u.id}" variation in ${i}`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),c){let e=O(c.id),t=D(c.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Ih(){let{values:{help:e,variation:t,label:n,"non-repeatable":r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},"non-repeatable":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a group field to an existing slice.
1779
+
1780
+ USAGE
1781
+ prismic slice add-field group <slice-id> <field-id> [flags]
1782
+
1783
+ ARGUMENTS
1784
+ slice-id Slice identifier (required)
1785
+ field-id Field identifier (required)
1786
+
1787
+ FLAGS
1788
+ -v, --variation string Target variation (default: first variation)
1789
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1790
+ --non-repeatable Make this a non-repeating group (default: repeatable)
1791
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1792
+ -h, --help Show help for command
1793
+
1794
+ EXAMPLES
1795
+ prismic slice add-field group my_slice buttons
1796
+ prismic slice add-field group hero ctas --non-repeatable
1797
+ prismic slice add-field group product variants --variation "withImage"`);return}if(!a){console.error(`Missing required argument: slice-id
1798
+ `),console.error(`Usage: prismic slice add-field group <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1799
+ `),console.error(`Usage: prismic slice add-field group <slice-id> <field-id>`),process.exitCode=1;return}if(o.includes(`.`)){console.error(`Groups cannot be nested inside other groups`),process.exitCode=1;return}let s=await k();if(!s)return;let c;try{c=await s.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(c.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let l=t?c.variations.find(e=>e.id===t):c.variations[0];if(!l){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}l.primary||={};for(let e of c.variations)if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}let u={type:`Group`,config:{label:n??T(o),repeat:!r,fields:{}}};l.primary[o]=u;try{await s.updateSlice(c)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${o}" (Group) to "${l.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info(`Next: Add fields to the group with \`prismic slice add-field <type> ${a} ${o}.<field-id>\``),s){let e=O(s.id),t=D(s.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Lh(){let{values:{help:e,variation:t,label:n,types:r},positionals:[i,a]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add an image field to an existing slice.
1800
+
1801
+ USAGE
1802
+ prismic slice add-field image <slice-id> <field-id> [flags]
1803
+
1804
+ ARGUMENTS
1805
+ slice-id Slice identifier (required)
1806
+ field-id Field identifier (required)
1807
+
1808
+ FLAGS
1809
+ -v, --variation string Target variation (default: first variation)
1810
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1811
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1812
+ -h, --help Show help for command
1813
+
1814
+ EXAMPLES
1815
+ prismic slice add-field image my_slice background
1816
+ prismic slice add-field image hero banner --label "Hero Banner"
1817
+ prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!i){console.error(`Missing required argument: slice-id
1818
+ `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
1819
+ `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let o=z(a),s=U(o);if(!s.ok){console.error(s.error),process.exitCode=1;return}let c=await k();if(!c)return;let l;try{l=await c.readSlice(i)}catch{console.error(`Slice not found: ${i}\n\nCreate it first with: prismic slice create ${i}`),process.exitCode=1;return}if(l.variations.length===0){console.error(`Slice "${i}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let u=t?l.variations.find(e=>e.id===t):l.variations[0];if(!u){console.error(`Variation "${t}" not found in slice "${i}"\n`),console.error(`Available variations: ${l.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}u.primary||={};let d={type:`Image`,config:{label:n??T(o.type===`nested`?o.nestedFieldId:a)}};if(o.type===`nested`){let e=H(u.primary,o.groupId,u.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[o.nestedFieldId]){console.error(`Field "${o.nestedFieldId}" already exists in group "${o.groupId}"`),process.exitCode=1;return}e.group.config.fields[o.nestedFieldId]=d}else{for(let e of l.variations){if(e.primary?.[a]){console.error(`Field "${a}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[a]){console.error(`Field "${a}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}u.primary[a]=d}try{await c.updateSlice(l)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}o.type===`nested`?console.info(`Added field "${o.nestedFieldId}" (Image) to group "${o.groupId}" in ${i}`):console.info(`Added field "${a}" (Image) to "${u.id}" variation in ${i}`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),c){let e=O(c.id),t=D(c.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Rh(){let{values:{help:e,variation:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a key-text (single-line text) field to an existing slice.
1820
+
1821
+ USAGE
1822
+ prismic slice add-field key-text <slice-id> <field-id> [flags]
1823
+
1824
+ ARGUMENTS
1825
+ slice-id Slice identifier (required)
1826
+ field-id Field identifier (required)
1827
+
1828
+ FLAGS
1829
+ -v, --variation string Target variation (default: first variation)
1830
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1831
+ -p, --placeholder string Placeholder text
1832
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1833
+ -h, --help Show help for command
1834
+
1835
+ EXAMPLES
1836
+ prismic slice add-field key-text my_slice title
1837
+ prismic slice add-field key-text hero heading --label "Heading"
1838
+ prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!a){console.error(`Missing required argument: slice-id
1839
+ `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1840
+ `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(u.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=t?u.variations.find(e=>e.id===t):u.variations[0];if(!d){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};let f={type:`Text`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=H(d.primary,s.groupId,d.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=f}else{for(let e of u.variations){if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[o]){console.error(`Field "${o}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}d.primary[o]=f}try{await l.updateSlice(u)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Text) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Text) to "${d.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),l){let e=O(l.id),t=D(l.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function zh(){let{values:{help:e,variation:t,label:n,placeholder:r,"allow-text":i,"allow-target-blank":a,repeatable:o,types:s},positionals:[c,l]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a link field to an existing slice.
1841
+
1842
+ USAGE
1843
+ prismic slice add-field link <slice-id> <field-id> [flags]
1844
+
1845
+ ARGUMENTS
1846
+ slice-id Slice identifier (required)
1847
+ field-id Field identifier (required)
1848
+
1849
+ FLAGS
1850
+ -v, --variation string Target variation (default: first variation)
1851
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1852
+ -p, --placeholder string Placeholder text
1853
+ --allow-text Allow text with link
1854
+ --allow-target-blank Allow opening link in new tab
1855
+ --repeatable Allow multiple links
1856
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1857
+ -h, --help Show help for command
1858
+
1859
+ EXAMPLES
1860
+ prismic slice add-field link my_slice button
1861
+ prismic slice add-field link cta primary_link --allow-text
1862
+ prismic slice add-field link navigation links --repeatable
1863
+ prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!c){console.error(`Missing required argument: slice-id
1864
+ `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1865
+ `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let u=z(l),d=U(u);if(!d.ok){console.error(d.error),process.exitCode=1;return}let f=await k();if(!f)return;let p;try{p=await f.readSlice(c)}catch{console.error(`Slice not found: ${c}\n\nCreate it first with: prismic slice create ${c}`),process.exitCode=1;return}if(p.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let m=t?p.variations.find(e=>e.id===t):p.variations[0];if(!m){console.error(`Variation "${t}" not found in slice "${c}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}m.primary||={};let h={type:`Link`,config:{label:n??T(u.type===`nested`?u.nestedFieldId:l),...r&&{placeholder:r},...i&&{allowText:!0},...a&&{allowTargetBlank:!0},...o&&{repeat:!0}}};if(u.type===`nested`){let e=H(m.primary,u.groupId,m.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[u.nestedFieldId]){console.error(`Field "${u.nestedFieldId}" already exists in group "${u.groupId}"`),process.exitCode=1;return}e.group.config.fields[u.nestedFieldId]=h}else{for(let e of p.variations){if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[l]){console.error(`Field "${l}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}m.primary[l]=h}try{await f.updateSlice(p)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}u.type===`nested`?console.info(`Added field "${u.nestedFieldId}" (Link) to group "${u.groupId}" in ${c}`):console.info(`Added field "${l}" (Link) to "${m.id}" variation in ${c}`);try{await R({output:s}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),f){let e=O(f.id),t=D(f.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Bh(){let{values:{help:e,variation:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a number field to an existing slice.
1866
+
1867
+ USAGE
1868
+ prismic slice add-field number <slice-id> <field-id> [flags]
1869
+
1870
+ ARGUMENTS
1871
+ slice-id Slice identifier (required)
1872
+ field-id Field identifier (required)
1873
+
1874
+ FLAGS
1875
+ -v, --variation string Target variation (default: first variation)
1876
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1877
+ -p, --placeholder string Placeholder text
1878
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1879
+ -h, --help Show help for command
1880
+
1881
+ EXAMPLES
1882
+ prismic slice add-field number my_slice price
1883
+ prismic slice add-field number product quantity --label "Quantity"
1884
+ prismic slice add-field number stats count --variation "detailed"`);return}if(!a){console.error(`Missing required argument: slice-id
1885
+ `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1886
+ `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(u.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=t?u.variations.find(e=>e.id===t):u.variations[0];if(!d){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};let f={type:`Number`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=H(d.primary,s.groupId,d.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=f}else{for(let e of u.variations){if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[o]){console.error(`Field "${o}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}d.primary[o]=f}try{await l.updateSlice(u)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Number) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Number) to "${d.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),l){let e=O(l.id),t=D(l.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Vh(){let{values:{help:e,variation:t,label:n,placeholder:r,single:i,multi:a,"allow-target-blank":o,types:s},positionals:[c,l]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a rich text field to an existing slice.
1887
+
1888
+ USAGE
1889
+ prismic slice add-field rich-text <slice-id> <field-id> [flags]
1890
+
1891
+ ARGUMENTS
1892
+ slice-id Slice identifier (required)
1893
+ field-id Field identifier (required)
1894
+
1895
+ FLAGS
1896
+ -v, --variation string Target variation (default: first variation)
1897
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1898
+ -p, --placeholder string Placeholder text
1899
+ --single string Allowed block types for single-line (comma-separated)
1900
+ --multi string Allowed block types for multi-line (comma-separated)
1901
+ --allow-target-blank Allow opening links in new tab
1902
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1903
+ -h, --help Show help for command
1904
+
1905
+ BLOCK TYPES
1906
+ heading1, heading2, heading3, heading4, heading5, heading6,
1907
+ paragraph, strong, em, preformatted, hyperlink, image, embed,
1908
+ list-item, o-list-item, rtl
1909
+
1910
+ EXAMPLES
1911
+ prismic slice add-field rich-text my_slice body
1912
+ prismic slice add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
1913
+ prismic slice add-field rich-text hero tagline --single "heading1"
1914
+ prismic slice add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!c){console.error(`Missing required argument: slice-id
1915
+ `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1916
+ `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let u=z(l),d=U(u);if(!d.ok){console.error(d.error),process.exitCode=1;return}let f=await k();if(!f)return;let p;try{p=await f.readSlice(c)}catch{console.error(`Slice not found: ${c}\n\nCreate it first with: prismic slice create ${c}`),process.exitCode=1;return}if(p.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let m=t?p.variations.find(e=>e.id===t):p.variations[0];if(!m){console.error(`Variation "${t}" not found in slice "${c}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}m.primary||={};let h={type:`StructuredText`,config:{label:n??T(u.type===`nested`?u.nestedFieldId:l),...r&&{placeholder:r},...i&&{single:i},...a&&{multi:a},...o&&{allowTargetBlank:!0}}};if(u.type===`nested`){let e=H(m.primary,u.groupId,m.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[u.nestedFieldId]){console.error(`Field "${u.nestedFieldId}" already exists in group "${u.groupId}"`),process.exitCode=1;return}e.group.config.fields[u.nestedFieldId]=h}else{for(let e of p.variations){if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[l]){console.error(`Field "${l}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}m.primary[l]=h}try{await f.updateSlice(p)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}u.type===`nested`?console.info(`Added field "${u.nestedFieldId}" (StructuredText) to group "${u.groupId}" in ${c}`):console.info(`Added field "${l}" (StructuredText) to "${m.id}" variation in ${c}`);try{await R({output:s}),console.info(`Updated types in ${s??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),f){let e=O(f.id),t=D(f.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Hh(){let{values:{help:e,variation:t,label:n,placeholder:r,option:i,default:a,types:o},positionals:[s,c]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a select (dropdown) field to an existing slice.
1917
+
1918
+ USAGE
1919
+ prismic slice add-field select <slice-id> <field-id> [flags]
1920
+
1921
+ ARGUMENTS
1922
+ slice-id Slice identifier (required)
1923
+ field-id Field identifier (required)
1924
+
1925
+ FLAGS
1926
+ -v, --variation string Target variation (default: first variation)
1927
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1928
+ -p, --placeholder string Placeholder text
1929
+ --option string Add an option (can be used multiple times)
1930
+ --default string Default selected value
1931
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1932
+ -h, --help Show help for command
1933
+
1934
+ EXAMPLES
1935
+ prismic slice add-field select my_slice layout --option "full" --option "sidebar"
1936
+ prismic slice add-field select hero style --option "light" --option "dark" --default "light"
1937
+ prismic slice add-field select product size --option "small" --option "medium" --option "large" --label "Size"`);return}if(!s){console.error(`Missing required argument: slice-id
1938
+ `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1939
+ `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let l=z(c),u=U(l);if(!u.ok){console.error(u.error),process.exitCode=1;return}let d=await k();if(!d)return;let f;try{f=await d.readSlice(s)}catch{console.error(`Slice not found: ${s}\n\nCreate it first with: prismic slice create ${s}`),process.exitCode=1;return}if(f.variations.length===0){console.error(`Slice "${s}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=t?f.variations.find(e=>e.id===t):f.variations[0];if(!p){console.error(`Variation "${t}" not found in slice "${s}"\n`),console.error(`Available variations: ${f.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};let m={type:`Select`,config:{label:n??T(l.type===`nested`?l.nestedFieldId:c),...r&&{placeholder:r},...i&&i.length>0&&{options:i},...a&&{default_value:a}}};if(l.type===`nested`){let e=H(p.primary,l.groupId,p.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[l.nestedFieldId]){console.error(`Field "${l.nestedFieldId}" already exists in group "${l.groupId}"`),process.exitCode=1;return}e.group.config.fields[l.nestedFieldId]=m}else{for(let e of f.variations){if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[c]){console.error(`Field "${c}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}p.primary[c]=m}try{await d.updateSlice(f)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}l.type===`nested`?console.info(`Added field "${l.nestedFieldId}" (Select) to group "${l.groupId}" in ${s}`):console.info(`Added field "${c}" (Select) to "${p.id}" variation in ${s}`);try{await R({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),d){let e=O(d.id),t=D(d.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Uh(){let{values:{help:e,variation:t,label:n,placeholder:r,types:i},positionals:[a,o]}=A({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a timestamp (date and time) field to an existing slice.
1940
+
1941
+ USAGE
1942
+ prismic slice add-field timestamp <slice-id> <field-id> [flags]
1943
+
1944
+ ARGUMENTS
1945
+ slice-id Slice identifier (required)
1946
+ field-id Field identifier (required)
1947
+
1948
+ FLAGS
1949
+ -v, --variation string Target variation (default: first variation)
1950
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1951
+ -p, --placeholder string Placeholder text
1952
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1953
+ -h, --help Show help for command
1954
+
1955
+ EXAMPLES
1956
+ prismic slice add-field timestamp my_slice created_at
1957
+ prismic slice add-field timestamp event start_time --label "Event Start"
1958
+ prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!a){console.error(`Missing required argument: slice-id
1959
+ `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1960
+ `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let s=z(o),c=U(s);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await k();if(!l)return;let u;try{u=await l.readSlice(a)}catch{console.error(`Slice not found: ${a}\n\nCreate it first with: prismic slice create ${a}`),process.exitCode=1;return}if(u.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=t?u.variations.find(e=>e.id===t):u.variations[0];if(!d){console.error(`Variation "${t}" not found in slice "${a}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};let f={type:`Timestamp`,config:{label:n??T(s.type===`nested`?s.nestedFieldId:o),...r&&{placeholder:r}}};if(s.type===`nested`){let e=H(d.primary,s.groupId,d.id);if(!e.ok){console.error(e.error),process.exitCode=1;return}if(e.group.config.fields[s.nestedFieldId]){console.error(`Field "${s.nestedFieldId}" already exists in group "${s.groupId}"`),process.exitCode=1;return}e.group.config.fields[s.nestedFieldId]=f}else{for(let e of u.variations){if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}for(let[t,n]of Object.entries(e.primary??{}))if(B(n)&&n.config.fields[o]){console.error(`Field "${o}" already exists in group "${t}" in variation "${e.id}"`),process.exitCode=1;return}}d.primary[o]=f}try{await l.updateSlice(u)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}s.type===`nested`?console.info(`Added field "${s.nestedFieldId}" (Timestamp) to group "${s.groupId}" in ${a}`):console.info(`Added field "${o}" (Timestamp) to "${d.id}" variation in ${a}`);try{await R({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}if(console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),l){let e=O(l.id),t=D(l.id);console.info(` Run \`prismic docs fetch ${e}${t}\` to learn how to implement the slice's component`)}}async function Wh(){let{positionals:[e]}=A({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`boolean`:await jh();break;case`color`:await Mh();break;case`date`:await Nh();break;case`embed`:await Ph();break;case`geo-point`:await Fh();break;case`group`:await Ih();break;case`image`:await Lh();break;case`key-text`:await Rh();break;case`link`:await zh();break;case`number`:await Bh();break;case`rich-text`:await Vh();break;case`select`:await Hh();break;case`timestamp`:await Uh();break;default:e&&(console.error(`Unknown field type: ${e}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
1961
+
1962
+ USAGE
1963
+ prismic slice add-field <field-type> <slice-id> <field-id> [flags]
1964
+
1965
+ FIELD TYPES
1966
+ boolean Boolean toggle
1967
+ color Color picker
1968
+ date Date picker
1969
+ embed Embed (oEmbed)
1970
+ geo-point Geographic coordinates
1971
+ group Repeatable group of fields
1972
+ image Image
1973
+ key-text Single-line text
1974
+ link Any link type
1975
+ number Number
1976
+ rich-text Rich text editor
1977
+ select Dropdown select
1978
+ timestamp Date and time
1979
+
1980
+ FLAGS
1981
+ -h, --help Show help for command
1982
+
1983
+ LEARN MORE
1984
+ Use \`prismic slice add-field <field-type> --help\` for more information.
1985
+
1986
+ EXAMPLES
1987
+ prismic slice add-field key-text my_slice title --label "Title"
1988
+ prismic slice add-field link my_slice cta --allow-text
1989
+ prismic slice add-field rich-text my_slice body --multi "paragraph,heading2,strong,em"
1990
+ prismic slice add-field select my_slice layout --option "full" --option "sidebar"`)}}async function Gh(){let{values:{help:e,name:t,"copy-from":n,types:r},positionals:[i,a]}=A({args:process.argv.slice(4),options:{name:{type:`string`},"copy-from":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a new variation to a slice.
1991
+
1992
+ USAGE
1993
+ prismic slice add-variation <slice-id> <variation-id> [flags]
1994
+
1995
+ ARGUMENTS
1996
+ slice-id Slice identifier (required)
1997
+ variation-id New variation identifier (required)
1998
+
1999
+ FLAGS
2000
+ --name string Display name for the variation
2001
+ --copy-from string Copy fields from an existing variation
2002
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2003
+ -h, --help Show help for command
2004
+
2005
+ EXAMPLES
2006
+ prismic slice add-variation MySlice withImage
2007
+ prismic slice add-variation MySlice withImage --name "With Image"
2008
+ prismic slice add-variation MySlice withImage --copy-from default`);return}if(!i){console.error(`Missing required argument: slice-id
2009
+ `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: variation-id
2010
+ `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}let o=await k();if(!o)return;let s;try{s=await o.readSlice(i)}catch{console.error(`Slice not found: ${i}\n\nCreate it first with: prismic slice create ${i}`),process.exitCode=1;return}if(s.variations.some(e=>e.id===a)){console.error(`Variation "${a}" already exists in slice "${i}"`),process.exitCode=1;return}let c;if(n){let e=s.variations.find(e=>e.id===n);if(!e){console.error(`Source variation not found: ${n}`),console.error(`Available variations: ${s.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}c={...structuredClone(e),id:a,name:t??fe(a)}}else c={id:a,name:t??fe(a),description:a,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}};let l={...s,variations:[...s.variations,c]};try{await o.updateSlice(l)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added variation "${a}" to slice "${i}"`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Kh=u({uploadEndpoint:p(),requiredFormDataFields:s(p(),p()),imgixEndpoint:p()});async function qh(e){let{data:t,repo:n,sliceId:r,variationId:i,filename:a}=e,o=await Q(`https://acl-provider.prismic.io/create`,{method:`POST`,body:{},schema:Kh});if(!o.ok)throw Error(`Failed to get upload credentials from Prismic`);let{uploadEndpoint:s,requiredFormDataFields:c,imgixEndpoint:l}=o.value,u=be(`md5`).update(t).digest(`hex`),d=Ce(a).toLowerCase().slice(1)||`png`,f=`${n}/shared-slices/${r}/${i}/${u}.${d}`,p=new FormData;for(let[e,t]of Object.entries(c))p.append(e,t);p.append(`key`,f),p.append(`Content-Type`,Jh(d)),p.append(`file`,new Blob([new Uint8Array(t)],{type:Jh(d)}),a);let m=await fetch(s,{method:`POST`,body:p});if(!m.ok){let e=await m.text();throw Error(`Failed to upload screenshot: ${e}`)}return`${l}/${f}?auto=compress,format`}function Jh(e){switch(e){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`gif`:return`image/gif`;case`webp`:return`image/webp`;default:return`image/png`}}async function Yh(){let{values:{help:e,variation:t,repo:r},positionals:[i,a]}=A({args:process.argv.slice(4),options:{variation:{type:`string`,short:`v`,default:`default`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set a screenshot for a slice variation.
2011
+
2012
+ USAGE
2013
+ prismic slice set-screenshot <slice-id> <image-path> [flags]
2014
+
2015
+ ARGUMENTS
2016
+ slice-id Slice identifier (required)
2017
+ image-path Path to the image file (required)
2018
+
2019
+ FLAGS
2020
+ -v, --variation string Variation ID (default: "default")
2021
+ -r, --repo string Repository name (uses config if not provided)
2022
+ -h, --help Show help for command
2023
+
2024
+ EXAMPLES
2025
+ prismic slice set-screenshot MySlice ./screenshot.png
2026
+ prismic slice set-screenshot MySlice ./screenshot.png --variation dark
2027
+ prismic slice set-screenshot MySlice ./screenshot.png --repo my-repo`);return}if(!i){console.error(`Missing required argument: slice-id
2028
+ `),console.error(`Usage: prismic slice set-screenshot <slice-id> <image-path>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: image-path
2029
+ `),console.error(`Usage: prismic slice set-screenshot <slice-id> <image-path>`),process.exitCode=1;return}if(!await n()){console.error(`You must be logged in to set a screenshot.`),console.error("Run `prismic login` to authenticate."),process.exitCode=1;return}let o=r??await E();if(!o){console.error(`Could not determine repository.`),console.error(`Use --repo flag or run from a directory with prismic.config.json`),process.exitCode=1;return}let s=await k();if(!s)return;let c;try{c=await s.readSlice(i)}catch{console.error(`Slice not found: ${i}\n\nCreate it first with: prismic slice create ${i}`),process.exitCode=1;return}let l=c.variations.findIndex(e=>e.id===t);if(l===-1){console.error(`Variation "${t}" not found in slice "${i}"`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}let u;try{u=await he(a)}catch(e){e instanceof Error?console.error(`Failed to read image file: ${e.message}`):console.error(`Failed to read image file`),process.exitCode=1;return}let d;try{d=await qh({data:u,repo:o,sliceId:i,variationId:t??`default`,filename:a})}catch(e){e instanceof Error?console.error(`Failed to upload screenshot: ${e.message}`):console.error(`Failed to upload screenshot`),process.exitCode=1;return}c.variations[l].imageUrl=d;try{await s.updateSlice(c)}catch(e){e instanceof Error?console.error(`Failed to update slice model: ${e.message}`):console.error(`Failed to update slice model`),process.exitCode=1;return}console.info(`Screenshot set for slice "${i}" variation "${t}"`),console.info(`URL: ${d}`)}async function Xh(){let{values:{help:e,name:t,types:r,screenshot:i,repo:a},positionals:[o]}=A({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},screenshot:{type:`string`},repo:{type:`string`,short:`r`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Create a new slice in a Prismic project.
2030
+
2031
+ USAGE
2032
+ prismic slice create <id> [flags]
2033
+
2034
+ ARGUMENTS
2035
+ id Slice identifier (required)
2036
+
2037
+ FLAGS
2038
+ -n, --name string Display name for the slice
2039
+ --screenshot string Path to screenshot image for default variation
2040
+ -r, --repo string Repository name (required for screenshot)
2041
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2042
+ -h, --help Show help for command
2043
+
2044
+ LEARN MORE
2045
+ Use \`prismic slice <command> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: id`),process.exitCode=1;return}let s=await k();if(!s)return;let c;if(i){if(!await n()){console.error(`You must be logged in to upload a screenshot.`),console.error("Run `prismic login` to authenticate."),process.exitCode=1;return}let e=a??await E();if(!e){console.error(`Could not determine repository for screenshot upload.`),console.error(`Use --repo flag or run from a directory with prismic.config.json`),process.exitCode=1;return}let t;try{t=await he(i)}catch(e){e instanceof Error?console.error(`Failed to read screenshot file: ${e.message}`):console.error(`Failed to read screenshot file`),process.exitCode=1;return}try{c=await qh({data:t,repo:e,sliceId:o,variationId:`default`,filename:i})}catch(e){e instanceof Error?console.error(`Failed to upload screenshot: ${e.message}`):console.error(`Failed to upload screenshot`),process.exitCode=1;return}}let{pascalCase:l}=await import(`./dist-DT8CtumB.mjs`),u={id:o,type:`SharedSlice`,name:t??l(o),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:c??``,docURL:``,version:`initial`,primary:{},items:{}}]},d=await s.getDefaultSliceLibrary();try{let{modelPath:e}=await s.createSlice(u,d);console.info(`Created slice at ${e.href}`)}catch(e){e instanceof Error?console.error(`Failed to create slice: ${e.message}`):console.error(`Failed to create slice`),process.exitCode=1;return}try{await R({output:r,framework:s}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic slice add-field`")}async function Zh(){let{values:{help:e,json:t}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`List all slices in a Prismic project.
2046
+
2047
+ USAGE
2048
+ prismic slice list [flags]
2049
+
2050
+ FLAGS
2051
+ --json Output as JSON
2052
+ -h, --help Show help for command
2053
+
2054
+ EXAMPLES
2055
+ prismic slice list
2056
+ prismic slice list --json`);return}let n=await k();if(!n)return;let r=(await n.getSlices()).map(e=>({id:e.model.id,name:e.model.name}));if(r.length===0){t?console.info(JSON.stringify([])):console.info(`No slices found.`);return}if(t)console.info(JSON.stringify(r,null,2));else{console.info(`ID NAME`);for(let e of r)console.info(`${e.id}\t${e.name}`)}}async function Qh(){let{values:{help:e,json:t},positionals:[n]}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`List all variations for a slice.
2057
+
2058
+ USAGE
2059
+ prismic slice list-variations <slice-id> [flags]
2060
+
2061
+ ARGUMENTS
2062
+ slice-id Slice identifier (required)
2063
+
2064
+ FLAGS
2065
+ --json Output as JSON
2066
+ -h, --help Show help for command
2067
+
2068
+ EXAMPLES
2069
+ prismic slice list-variations MySlice
2070
+ prismic slice list-variations MySlice --json`);return}if(!n){console.error(`Missing required argument: slice-id
2071
+ `),console.error(`Usage: prismic slice list-variations <slice-id>`),process.exitCode=1;return}let r=await k();if(!r)return;let i;try{i=await r.readSlice(n)}catch{console.error(`Slice not found: ${n}\n\nCreate it first with: prismic slice create ${n}`),process.exitCode=1;return}let a=i.variations.map(e=>({id:e.id,name:e.name}));if(t){console.info(JSON.stringify(a,null,2));return}console.info(`ID NAME`);for(let e of a)console.info(`${e.id}\t${e.name}`)}async function $h(){let{values:{help:e,y:t,types:n},positionals:[r]}=A({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a slice from the project.
2072
+
2073
+ USAGE
2074
+ prismic slice remove <slice-id> [flags]
2075
+
2076
+ ARGUMENTS
2077
+ slice-id Slice identifier (required)
2078
+
2079
+ FLAGS
2080
+ -y Confirm removal
2081
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2082
+ -h, --help Show help for command
2083
+
2084
+ EXAMPLES
2085
+ prismic slice remove MySlice
2086
+ prismic slice remove MySlice -y`);return}if(!r){console.error(`Missing required argument: slice-id
2087
+ `),console.error(`Usage: prismic slice remove <slice-id>`),process.exitCode=1;return}let i=await k();if(i){try{await i.readSlice(r)}catch{console.error(`Slice not found: ${r}\n\nCreate it first with: prismic slice create ${r}`),process.exitCode=1;return}if(!t){console.error(`Refusing to remove slice "${r}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await i.deleteSlice(r)}catch(e){e instanceof Error?console.error(`Failed to remove slice: ${e.message}`):console.error(`Failed to remove slice`),process.exitCode=1;return}console.info(`Removed slice "${r}"`);try{await R({output:n,framework:i}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}}async function eg(){let{values:{help:e,variation:t,zone:n,types:r},positionals:[i,a]}=A({args:process.argv.slice(4),options:{variation:{type:`string`,default:`default`},zone:{type:`string`,default:`primary`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a field from a slice variation.
2088
+
2089
+ USAGE
2090
+ prismic slice remove-field <slice-id> <field-id> [flags]
2091
+
2092
+ ARGUMENTS
2093
+ slice-id Slice identifier (required)
2094
+ field-id Field identifier (required)
2095
+
2096
+ FLAGS
2097
+ --variation string Target variation (default: "default")
2098
+ --zone string Field zone: "primary" or "items" (default: "primary")
2099
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2100
+ -h, --help Show help for command
2101
+
2102
+ EXAMPLES
2103
+ prismic slice remove-field MySlice title
2104
+ prismic slice remove-field MySlice title --variation withImage
2105
+ prismic slice remove-field MySlice item_title --zone items`);return}if(!i){console.error(`Missing required argument: slice-id
2106
+ `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
2107
+ `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(n!==`primary`&&n!==`items`){console.error(`Invalid zone: ${n}. Must be "primary" or "items".`),process.exitCode=1;return}let o=await k();if(!o)return;let s;try{s=await o.readSlice(i)}catch{console.error(`Slice not found: ${i}\n\nCreate it first with: prismic slice create ${i}`),process.exitCode=1;return}let c=s.variations.find(e=>e.id===t);if(!c){console.error(`Variation not found: ${t}`),console.error(`Available variations: ${s.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}let l=n===`primary`?c.primary:c.items;if(!l||!(a in l)){console.error(`Field "${a}" not found in ${n} zone of variation "${t}"`),process.exitCode=1;return}delete l[a];try{await o.updateSlice(s)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Removed field "${a}" from ${n} zone in variation "${t}" of slice "${i}"`);try{await R({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function tg(){let{values:{help:e,types:t},positionals:[n,r]}=A({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a variation from a slice.
2108
+
2109
+ USAGE
2110
+ prismic slice remove-variation <slice-id> <variation-id> [flags]
2111
+
2112
+ ARGUMENTS
2113
+ slice-id Slice identifier (required)
2114
+ variation-id Variation to remove (required)
2115
+
2116
+ FLAGS
2117
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2118
+ -h, --help Show help for command
2119
+
2120
+ EXAMPLES
2121
+ prismic slice remove-variation MySlice withImage`);return}if(!n){console.error(`Missing required argument: slice-id
2122
+ `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!r){console.error(`Missing required argument: variation-id
2123
+ `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}let i=await k();if(!i)return;let a;try{a=await i.readSlice(n)}catch{console.error(`Slice not found: ${n}\n\nCreate it first with: prismic slice create ${n}`),process.exitCode=1;return}if(!a.variations.some(e=>e.id===r)){console.error(`Variation not found: ${r}`),console.error(`Available variations: ${a.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(a.variations.length===1){console.error(`Cannot remove the last variation from a slice.`),process.exitCode=1;return}let o={...a,variations:a.variations.filter(e=>e.id!==r)};try{await i.updateSlice(o)}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Removed variation "${r}" from slice "${n}"`);try{await R({output:t}),console.info(`Updated types in ${t??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function ng(){let{values:{help:e,id:t,types:n},positionals:[r,i]}=A({args:process.argv.slice(4),options:{id:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Rename a slice (updates name field, optionally id and directory).
2124
+
2125
+ USAGE
2126
+ prismic slice rename <slice-id> <new-name> [flags]
2127
+
2128
+ ARGUMENTS
2129
+ slice-id Current slice identifier (required)
2130
+ new-name New display name (required)
2131
+
2132
+ FLAGS
2133
+ --id string Also change the slice ID (renames directory)
2134
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2135
+ -h, --help Show help for command
2136
+
2137
+ EXAMPLES
2138
+ prismic slice rename MySlice "My New Name"
2139
+ prismic slice rename MySlice "My New Name" --id NewSliceId`);return}if(!r){console.error(`Missing required argument: slice-id
2140
+ `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: new-name
2141
+ `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}let a=await k();if(!a)return;let o;try{o=await a.readSlice(r)}catch{console.error(`Slice not found: ${r}\n\nCreate it first with: prismic slice create ${r}`),process.exitCode=1;return}o.name=i,t&&(o.id=t);try{t?(await a.renameSlice(o),console.info(`Renamed slice "${r}" to "${t}" (${i})`)):(await a.updateSlice(o),console.info(`Renamed slice "${r}" to "${i}"`))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}try{await R({output:n,framework:a}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function rg(){let{values:{help:e,json:t},positionals:[n]}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`View details of a specific slice.
2142
+
2143
+ USAGE
2144
+ prismic slice view <slice-id> [flags]
2145
+
2146
+ ARGUMENTS
2147
+ slice-id Slice identifier (required)
2148
+
2149
+ FLAGS
2150
+ --json Output as JSON
2151
+ -h, --help Show help for command
2152
+
2153
+ EXAMPLES
2154
+ prismic slice view MySlice
2155
+ prismic slice view MySlice --json`);return}if(!n){console.error(`Missing required argument: slice-id
2156
+ `),console.error(`Usage: prismic slice view <slice-id>`),process.exitCode=1;return}let r=await k();if(!r)return;let i;try{i=await r.readSlice(n)}catch{console.error(`Slice not found: ${n}\n\nCreate it first with: prismic slice create ${n}`),process.exitCode=1;return}if(t){console.info(JSON.stringify(i,null,2));return}console.info(`ID: ${i.id}`),console.info(`Name: ${i.name}`),i.description&&console.info(`Description: ${i.description}`),console.info(`Variations: ${i.variations.length}`),console.info(`
2157
+ Variations:`);for(let e of i.variations){let t=Object.keys(e.primary??{}).length,n=Object.keys(e.items??{}).length;console.info(` - ${e.id} (${e.name}): ${t} primary fields, ${n} items fields`),e.imageUrl&&console.info(` Screenshot: ${e.imageUrl}`)}}async function ig(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`create`:await Xh();break;case`list`:await Zh();break;case`view`:await rg();break;case`rename`:await ng();break;case`remove`:await $h();break;case`add-field`:await Wh();break;case`remove-field`:await eg();break;case`add-variation`:await Gh();break;case`remove-variation`:await tg();break;case`list-variations`:await Qh();break;case`set-screenshot`:await Yh();break;default:e&&(console.error(`Unknown slice subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage slices in a Prismic project.
2158
+
2159
+ USAGE
2160
+ prismic slice <command> [flags]
2161
+
2162
+ COMMANDS
2163
+ create Create a new slice
2164
+ list List all slices
2165
+ view View details of a slice
2166
+ rename Rename a slice
2167
+ remove Remove a slice
2168
+ add-field Add a field to a slice
2169
+ remove-field Remove a field from a slice
2170
+ add-variation Add a variation to a slice
2171
+ remove-variation Remove a variation from a slice
2172
+ list-variations List all variations of a slice
2173
+ set-screenshot Set a screenshot for a slice variation
2174
+
2175
+ FLAGS
2176
+ -h, --help Show help for command
2177
+
2178
+ LEARN MORE
2179
+ Use \`prismic slice <command> --help\` for more information about a command.`)}}const ag={documentsPublished:`document.published`,documentsUnpublished:`document.unpublished`,releasesCreated:`release.created`,releasesUpdated:`release.updated`,tagsCreated:`tag.created`,tagsDeleted:`tag.deleted`};async function og(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`View details of a webhook in a Prismic repository.
2180
+
2181
+ By default, this command reads the repository from prismic.config.json at the
2182
+ project root.
2183
+
2184
+ USAGE
2185
+ prismic webhook view <url> [flags]
2186
+
2187
+ ARGUMENTS
2188
+ <url> Webhook URL
2189
+
2190
+ FLAGS
2191
+ -r, --repo string Repository domain
2192
+ -h, --help Show help for command
2193
+
2194
+ LEARN MORE
2195
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){sg();return}let i=await lg(t);if(!i.ok){i.error instanceof $?sg():(console.error(`Failed to view webhook: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let{config:o}=a;console.info(`URL: ${o.url}`),console.info(`Name: ${o.name||`(none)`}`),console.info(`Status: ${o.active?`enabled`:`disabled`}`),console.info(`Secret: ${o.secret?`(set)`:`(none)`}`);let s=[];for(let[e,t]of Object.entries(ag))o[e]&&s.push(t);if(console.info(`Triggers: ${s.length>0?s.join(`, `):`(none)`}`),Object.keys(o.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(o.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}function sg(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const cg=u({config:u({_id:p(),url:p(),active:d(),name:ie(p()),secret:ie(p()),headers:s(p(),p()),documentsPublished:d(),documentsUnpublished:d(),releasesCreated:d(),releasesUpdated:d(),tagsCreated:d(),tagsDeleted:d()})});async function lg(e){return await Q(new URL(`/app/settings/webhooks`,await x(e)),{schema:r(cg)})}function ug(e,t){return e?`\`prismic docs fetch ${t?`${e}${t}`:e}\``:``}function dg(e,t){let n=[],r=O(t.id),i=e.filter(e=>!e.done&&e.hint===`not installed`);if(i.length>0){let e=i.map(e=>e.label).join(` `);n.push({action:`Install dependencies: Run \`npm install ${e}\``})}if(e.find(e=>!e.done&&e.hint?.includes(`client`))){let e=ug(r,ae(t.id));n.push({action:`Create Prismic client file: Run ${e} and create the file as shown`})}return n}function fg(e){let t=[],n=e.some(e=>e.status===`to_push`),r=e.some(e=>e.status===`to_pull`);return n&&t.push({action:"Push local models to Prismic: Run `prismic push`"}),r&&t.push({action:"Pull remote models from Prismic: Run `prismic pull`"}),t}function pg(e,t,n,r){let i=[],a=O(r.id);if(t.length>0){let e=ug(a,D(r.id));i.push({action:`Implement slice components: Run ${e} and create each component file`})}let o=e.some(e=>e.status===`to_pull`),s=e.some(e=>e.status===`to_push`);if(o&&i.push({action:"Pull remote models from Prismic: Run `prismic pull`"}),n.length>0){let e=[...n].sort()[0];i.push({action:`Connect slice to page type: Run \`prismic page-type connect-slice <type-id> ${e}\``})}return s&&i.push({action:"Push local models to Prismic: Run `prismic push`"}),i}function mg(e,t){let n=[],r=O(t.id);if(e.find(e=>e.label===`/slice-simulator route`&&!e.done)){let e=ug(r,`#set-up-live-previewing`);n.push({action:`Create /slice-simulator route: Run ${e} and create the route file as shown`})}e.find(e=>e.label===`Slice simulator URL`&&!e.done)&&n.push({action:"Configure slice simulator URL: Run `prismic preview set-simulator`"});let i=e.find(e=>e.label===`/api/preview endpoint`&&!e.done),a=e.find(e=>e.label===`/api/exit-preview endpoint`&&!e.done);if(i||a){let e=ug(r,b(t.id));n.push({action:`Create preview endpoints: Run ${e} and create the endpoint files as shown`})}return e.find(e=>e.label===`Preview environment`&&!e.done)&&n.push({action:"Add preview environment: Run `prismic preview add`"}),n}function hg(e,t){let n=[],r=O(t.id);if(e.find(e=>e.label===`/api/revalidate endpoint`&&!e.done)){let e=ug(r,`#handle-content-changes`);n.push({action:`Create /api/revalidate endpoint: Run ${e} and create the endpoint as shown`})}return e.find(e=>e.label===`Revalidation webhook`&&!e.done)&&n.push({action:"Create revalidation webhook: Run `prismic webhook create`"}),n}async function gg(){let{values:{help:e,repo:t=await E()}}=A({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`Show the status of the current Prismic project.
2196
+
2197
+ Each section with incomplete items includes "Next steps:" with actionable
2198
+ instructions.
2199
+
2200
+ By default, this command reads the repository from prismic.config.json at the
2201
+ project root.
2202
+
2203
+ USAGE
2204
+ prismic status [flags]
2205
+
2206
+ FLAGS
2207
+ -r, --repo string Repository domain
2208
+ -h, --help Show help for command
2209
+
2210
+ LEARN MORE
2211
+ Use \`prismic <command> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}let r=await k();if(!r)return;let i=await r.getProjectRoot(),[a,o,s,c,l,u,d,f]=await Promise.all([yg(t),xg(t),lg(t),r.getCustomTypes(),yp(t),r.getSlices(),bp(t),Cg(i)]),p={ok:!0,value:c.map(e=>e.model)},m={ok:!0,value:u.map(e=>e.model)},h=await x(t);console.info(`Repository: ${t}`),console.info(`URL: ${h.href}`),console.info(``);let g=[],_=await wg(r,f);if(_.nextSteps=dg(_.items,r),g.push(_),p.ok&&l.ok){let{pageTypes:e,customTypes:t,pageTypeStatuses:n,customTypeStatuses:r}=Dg(p.value,l.value);e.nextSteps=fg(n),t.nextSteps=fg(r),g.push(e),g.push(t)}if(m.ok&&d.ok){let{section:e,statuses:t,missingComponents:n,slicesReadyToConnect:i}=await jg(m.value,d.value,r,p.ok?p.value:[]);e.nextSteps=pg(t,n,i,r),g.push(e)}let v=await Pg(r,o.ok?o.value:void 0,a.ok?a.value.simulator_url:void 0);if(v.nextSteps=mg(v.items,r),g.push(v),r.id===`next`){let e=await Ig(r,s.ok?s.value:[]);e.nextSteps=hg(e.items,r),g.push(e)}for(let e of g)_g(e)}function _g(e){let t=e.items.filter(e=>!e.done).length,n=t>0?`${e.title} (${t} remaining)`:e.title;console.info(n);let r=e.items.filter(e=>e.done),i=e.items.filter(e=>!e.done);if(r.length>0)if(r.length===1){let e=r[0],t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ✓ ${e.label}${t}`)}else{let e=r.map(e=>e.label).join(`, `),t=r.every(e=>e.hint===r[0].hint)&&r[0].hint?` \u2014 ${r[0].hint}`:``;console.info(` ✓ ${e}${t}`)}for(let e of i){let t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ○ ${e.label}${t}`)}if(e.nextSteps&&e.nextSteps.length>0){console.info(``),console.info(` Next steps:`);for(let t of e.nextSteps)console.info(` - ${t.action}`)}console.info(``)}const vg=u({simulator_url:f(p())});async function yg(e){let t=await Q(new URL(`/core/repository`,await x(e)),{schema:vg});return t.ok?{ok:!0,value:t.value}:{ok:!1}}const bg=u({results:r(u({id:p(),label:p(),url:p()}))});async function xg(e){let t=await Q(new URL(`/core/repository/preview_configs`,await x(e)),{schema:bg});return t.ok?{ok:!0,value:t.value.results}:{ok:!1}}const Sg=u({dependencies:f(s(p(),p())),devDependencies:f(s(p(),p()))});async function Cg(e){let t=new URL(`package.json`,e);try{let e=await he(t,`utf8`),{dependencies:n={},devDependencies:r={}}=a(Sg,JSON.parse(e));return new Set([...Object.keys(n),...Object.keys(r)])}catch{return new Set}}async function wg(e,t){let n=[],r=Object.keys(await e.getDependencies());for(let e of r)n.push({done:t.has(e),label:e,hint:t.has(e)?`installed`:`not installed`});let i=await e.getProjectRoot(),a=await e.getClientFilePath();if(a){let e=await y(new URL(a,i));n.push({done:e,label:a,hint:e?void 0:`create Prismic client file`})}else if(e.id===`nuxt`){let e=await Tg(i);n.push({done:e,label:`nuxt.config.ts`,hint:e?`prismic configured`:`add @nuxtjs/prismic to modules`})}return{title:`Setup`,items:n}}async function Tg(e){let t=new URL(`nuxt.config.ts`,e);try{let e=await he(t,`utf8`);return e.includes(`@nuxtjs/prismic`)||e.includes(`prismic:`)}catch{return!1}}function Eg(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[];for(let t of e){let e=t.label||t.id,n=r.get(t.id);n&&JSON.stringify(t)===JSON.stringify(n)?i.push({id:t.id,label:e,status:`in_sync`}):i.push({id:t.id,label:e,status:`to_push`})}for(let e of t)if(!n.has(e.id)){let t=e.label||e.id;i.push({id:e.id,label:t,status:`to_pull`})}return i}function Dg(e,t){let n=Eg(e,t),r=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return a&&a.format===`page`}),i=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return!a||a.format!==`page`}),a=r.map(e=>({done:e.status===`in_sync`,label:e.label,hint:Og(e.status)})),o=i.map(e=>({done:e.status===`in_sync`,label:e.label,hint:Og(e.status)}));return{pageTypes:{title:`Page Types`,items:a},customTypes:{title:`Custom Types`,items:o},pageTypeStatuses:r,customTypeStatuses:i}}function Og(e){switch(e){case`in_sync`:return`in sync`;case`to_push`:return`to push`;case`to_pull`:return`to pull`}}function kg(e){for(let t of e.variations){let e=Object.keys(t.primary??{}),n=Object.keys(t.items??{});if(e.length>0||n.length>0)return!0}return!1}function Ag(e,t){for(let n of t)for(let t of Object.values(n.json))for(let n of Object.values(t)){let t=n;if(t.type===`Slices`&&t.config?.choices?.[e])return!0}return!1}async function jg(e,t,n,r){let i=Eg(e,t),a=[],o=[],s=[],c=await n.getProjectRoot(),l=await n.getSlicesDirectoryPath(),u=n.getSliceComponentExtensions();for(let t of i){let n=e.find(e=>e.id===t.id);if(n){let e=kg(n),i=Ag(t.id,r);e&&!i&&s.push(t.label)}let i=await Mg(c,l,t.id,u);t.status===`in_sync`&&i?a.push({done:!0,label:t.label,hint:`component implemented`}):t.status===`in_sync`&&!i?(a.push({done:!1,label:t.label,hint:`missing component`}),o.push(t.label)):a.push({done:!1,label:t.label,hint:Og(t.status)})}return{section:{title:`Slices`,items:a},statuses:i,missingComponents:o,slicesReadyToConnect:s}}async function Mg(e,t,n,r){let i=Ng(n);for(let n of r)if(await y(new URL(`${t}${i}/index${n}`,e)))return!0;return!1}function Ng(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function Pg(e,t,n){let r=[],i=await e.getProjectRoot();r.push({done:!!n,label:`Slice simulator URL`,hint:n?`configured`:"run `prismic preview set-simulator`"});let a=await e.getRoutePath(`/slice-simulator`);if(a){let e=await Fg(i,a);r.push({done:e,label:`/slice-simulator route`,hint:e?void 0:`create route for Page Builder`})}let o=t&&t.length>0;if(r.push({done:!!o,label:`Preview environment`,hint:o?void 0:"run `prismic preview add`"}),e.id!==`nuxt`){let t=await e.getRoutePath(`/api/preview`);if(t){let e=await Fg(i,t);r.push({done:e,label:`/api/preview endpoint`,hint:e?void 0:`create preview endpoint`})}}if(e.id===`next`){let t=await e.getRoutePath(`/api/exit-preview`);if(t){let e=await Fg(i,t);r.push({done:e,label:`/api/exit-preview endpoint`,hint:e?void 0:`create exit-preview endpoint`})}}return{title:`Preview`,items:r}}async function Fg(e,t){for(let n of t.extensions)if(await y(new URL(`${t.path}${n}`,e)))return!0;return!1}async function Ig(e,t){let n=[],r=await e.getProjectRoot(),i=await e.getRoutePath(`/api/revalidate`);if(i){let e=await Fg(r,i);n.push({done:e,label:`/api/revalidate endpoint`,hint:e?void 0:`create for ISR`})}let a=t.some(e=>e.config.active&&e.config.url.toLowerCase().includes(`revalidate`));return n.push({done:a,label:`Revalidation webhook`,hint:a?`configured`:"run `prismic webhook create`"}),{title:`Deployment`,items:n}}async function Lg(){let{values:{help:e,repo:t=await E(),json:r}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`List all API tokens for a Prismic repository.
2212
+
2213
+ By default, this command reads the repository from prismic.config.json at the
2214
+ project root.
2215
+
2216
+ USAGE
2217
+ prismic token list [flags]
2218
+
2219
+ FLAGS
2220
+ --json Output as JSON
2221
+ -r, --repo string Repository domain
2222
+ -h, --help Show help for command
2223
+
2224
+ LEARN MORE
2225
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){Jg();return}let[i,a]=await Promise.all([Wg(t),Gg(t)]);if(!i.ok){i.error instanceof $||i.error instanceof hp?Jg():w(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${S(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof $||a.error instanceof hp?Jg():w(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${S(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${S(a.value)}`),process.exitCode=1);return}let o=i.value.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,appId:e.id,authId:t.id,scope:t.scope,token:t.token,createdAt:t.created_at.$date}))),s=a.value.tokens;if(r)console.info(S({accessTokens:o,writeTokens:s}));else{if(o.length>0){console.info(`ACCESS TOKENS`);for(let e of o){let t=Kg(e.token),n=qg(e.createdAt);console.info(` ${e.name} ${e.scope} ${t} ${n}`)}}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),s.length>0){console.info(`WRITE TOKENS`);for(let e of s){let t=Kg(e.token),n=qg(e.timestamp);console.info(` ${e.app_name} ${t} ${n}`)}}else console.info(`WRITE TOKENS (none)`)}}const Rg=u({$date:l()}),zg=u({id:p(),origin:p(),domain:p(),app:p(),scope:p(),expired_at:Rg,created_at:Rg,owner:ie(p()),token:p()}),Bg=u({id:p(),secret:p(),name:p(),owner:p(),created_at:Rg,authorized_domains:r(p()),wroom_auths:r(zg)}),Vg=u({app_name:p(),token:p(),timestamp:l()}),Hg=u({max_tokens:l(),tokens:r(Vg)}),Ug=r(Bg);async function Wg(e){return await Q(new URL(`settings/security/contentapi`,await x(e)),{schema:Ug})}async function Gg(e){return await Q(new URL(`settings/security/customtypesapi`,await x(e)),{schema:Hg})}function Kg(e){return e.length<=12?e:`${e.slice(0,8)}...${e.slice(-4)}`}function qg(e){let t=typeof e==`number`?e*1e3:e.$date;return new Date(t).toISOString().split(`T`)[0]}function Jg(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Yg(){let{values:{help:e,repo:t=await E(),json:r,write:i,name:a=`Prismic CLI`,"allow-releases":o}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`},write:{type:`boolean`,short:`w`},name:{type:`string`,short:`n`},"allow-releases":{type:`boolean`}},allowPositionals:!1});if(e){console.info(`Create a new API token for a Prismic repository.
2226
+
2227
+ By default, this command reads the repository from prismic.config.json at the
2228
+ project root.
2229
+
2230
+ USAGE
2231
+ prismic token create [flags]
2232
+
2233
+ FLAGS
2234
+ -w, --write Create a write token (Custom Types/Migration API)
2235
+ -n, --name string Token name (default: "Prismic CLI")
2236
+ --allow-releases Allow access to releases (access tokens only)
2237
+ --json Output as JSON
2238
+ -r, --repo string Repository domain
2239
+ -h, --help Show help for command
2240
+
2241
+ LEARN MORE
2242
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(i&&o){console.error(`--allow-releases is only valid for access tokens (not with --write)`),process.exitCode=1;return}if(!await n()){Qg();return}if(i){let e=await Xg(t,a);if(!e.ok){e.error instanceof $||e.error instanceof hp?Qg():w(e.error)?(console.error(`Failed to create write token: Invalid response: ${S(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create write token: ${S(e.value)}`),process.exitCode=1);return}r?console.info(S(e.value)):console.info(`Token created: ${e.value.token}`)}else{let e=await Zg(t,a,o?`master+releases`:`master`);if(!e.ok){e.error instanceof $||e.error instanceof hp?Qg():w(e.error)?(console.error(`Failed to create access token: Invalid response: ${S(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create access token: ${S(e.value)}`),process.exitCode=1);return}r?console.info(S(e.value)):console.info(`Token created: ${e.value.token}`)}}async function Xg(e,t){return await Q(new URL(`settings/security/token`,await x(e)),{method:`POST`,body:{app_name:t},schema:Vg})}async function Zg(e,t,n){let r=await Wg(e);if(!r.ok)return r;let i=r.value.find(e=>e.name===t);if(!i){let n=await Q(new URL(`settings/security/oauthapp`,await x(e)),{method:`POST`,body:{app_name:t},schema:Bg});if(!n.ok)return n;i=n.value}return await Q(new URL(`settings/security/authorizations`,await x(e)),{method:`POST`,body:{app:i.id,scope:n},schema:zg})}function Qg(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function $g(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Delete a token from a Prismic repository.
2243
+
2244
+ By default, this command reads the repository from prismic.config.json at the
2245
+ project root.
2246
+
2247
+ USAGE
2248
+ prismic token delete <token> [flags]
2249
+
2250
+ ARGUMENTS
2251
+ token The token value (or partial match)
2252
+
2253
+ FLAGS
2254
+ -r, --repo string Repository domain
2255
+ -h, --help Show help for command
2256
+
2257
+ LEARN MORE
2258
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){e_();return}let[i,a]=await Promise.all([Wg(t),Gg(t)]);if(!i.ok){i.error instanceof $||i.error instanceof hp?e_():w(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${S(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof $||a.error instanceof hp?e_():w(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${S(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${S(a.value)}`),process.exitCode=1);return}let o;for(let e of i.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){o=t;break}if(o)break}if(o){let e=await Q(new URL(`settings/security/authorizations/${o.id}`,await x(t)),{method:`DELETE`});if(!e.ok){e.error instanceof $||e.error instanceof hp?e_():(console.error(`Failed to delete token: ${S(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}let s=a.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r));if(s){let e=await Q(new URL(`settings/security/token/${s.token}`,await x(t)),{method:`DELETE`});if(!e.ok){e.error instanceof $||e.error instanceof hp?e_():(console.error(`Failed to delete token: ${S(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}console.error(`Token not found: ${r}`),process.exitCode=1}function e_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function t_(){let{values:{help:e,repo:t=await E()},positionals:[r,i]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Set the name of a token in a Prismic repository.
2259
+
2260
+ Note: Only access tokens can be renamed. Write tokens cannot be renamed without
2261
+ changing the token value.
2262
+
2263
+ By default, this command reads the repository from prismic.config.json at the
2264
+ project root.
2265
+
2266
+ USAGE
2267
+ prismic token set-name <token> <name> [flags]
2268
+
2269
+ ARGUMENTS
2270
+ token The token value (or partial match)
2271
+ name New name for the token
2272
+
2273
+ FLAGS
2274
+ -r, --repo string Repository domain
2275
+ -h, --help Show help for command
2276
+
2277
+ LEARN MORE
2278
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: name`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){n_();return}let[a,o]=await Promise.all([Wg(t),Gg(t)]);if(!a.ok){a.error instanceof $||a.error instanceof hp?n_():w(a.error)?(console.error(`Failed to list access tokens: Invalid response: ${S(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${S(a.value)}`),process.exitCode=1);return}if(!o.ok){o.error instanceof $||o.error instanceof hp?n_():w(o.error)?(console.error(`Failed to list write tokens: Invalid response: ${S(o.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${S(o.value)}`),process.exitCode=1);return}let s;for(let e of a.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){s=e;break}if(s)break}if(s){let e=await Q(new URL(`settings/security/oauthapp/${s.id}`,await x(t)),{method:`POST`,body:{name:i},schema:Bg});if(!e.ok){e.error instanceof $||e.error instanceof hp?n_():w(e.error)?(console.error(`Failed to rename token: Invalid response: ${S(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to rename token: ${S(e.value)}`),process.exitCode=1);return}console.info(`Token renamed to: ${i}`);return}if(o.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r))){console.error(`Write tokens cannot be renamed. Delete and create a new token with the desired name.`),process.exitCode=1;return}console.error(`Token not found: ${r}`),process.exitCode=1}function n_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function r_(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`list`:await Lg();break;case`create`:await Yg();break;case`set-name`:await t_();break;case`delete`:await $g();break;default:e&&(console.error(`Unknown token subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage API tokens for a Prismic repository.
2279
+
2280
+ USAGE
2281
+ prismic token <command> [flags]
2282
+
2283
+ COMMANDS
2284
+ list List all tokens
2285
+ create Create a new token
2286
+ set-name Set token name (access tokens only)
2287
+ delete Delete a token
2288
+
2289
+ FLAGS
2290
+ -h, --help Show help for command
2291
+
2292
+ LEARN MORE
2293
+ Use \`prismic token <command> --help\` for more information about a command.`)}}async function i_(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Enable a webhook in a Prismic repository.
2294
+
2295
+ By default, this command reads the repository from prismic.config.json at the
2296
+ project root.
2297
+
2298
+ USAGE
2299
+ prismic webhook enable <url> [flags]
2300
+
2301
+ ARGUMENTS
2302
+ <url> Webhook URL
2303
+
2304
+ FLAGS
2305
+ -r, --repo string Repository domain
2306
+ -h, --help Show help for command
2307
+
2308
+ LEARN MORE
2309
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){o_();return}let i=await lg(t);if(!i.ok){i.error instanceof $?o_():(console.error(`Failed to enable webhook: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(a.config.active){console.info(`Webhook already enabled: ${r}`);return}let o=structuredClone(a.config);o.active=!0;let s=await a_(t,a.config._id,o);if(!s.ok){s.error instanceof $?o_():(console.error(`Failed to enable webhook: ${S(s.value)}`),process.exitCode=1);return}console.info(`Webhook enabled: ${r}`)}async function a_(e,t,n){let r=new URL(`/app/settings/webhooks/${t}`,await x(e)),i=new FormData;return i.set(`url`,n.url),i.set(`name`,n.name??``),i.set(`secret`,n.secret??``),i.set(`headers`,JSON.stringify(n.headers??{})),i.set(`active`,n.active?`on`:`off`),i.set(`documentsPublished`,n.documentsUnpublished.toString()),i.set(`documentsUnpublished`,n.documentsUnpublished.toString()),i.set(`releasesCreated`,n.documentsUnpublished.toString()),i.set(`releasesUpdated`,n.documentsUnpublished.toString()),i.set(`tagsCreated`,n.documentsUnpublished.toString()),i.set(`documentsPublished`,n.documentsUnpublished.toString()),await Q(r,{method:`POST`,body:i})}function o_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function s_(){let{values:{help:e,repo:t=await E()},positionals:[r,i,a]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Add a custom HTTP header to a webhook.
2310
+
2311
+ By default, this command reads the repository from prismic.config.json at the
2312
+ project root.
2313
+
2314
+ USAGE
2315
+ prismic webhook add-header <url> <key> <value> [flags]
2316
+
2317
+ ARGUMENTS
2318
+ <url> Webhook URL
2319
+ <key> Header name
2320
+ <value> Header value
2321
+
2322
+ FLAGS
2323
+ -r, --repo string Repository domain
2324
+ -h, --help Show help for command
2325
+
2326
+ LEARN MORE
2327
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: <value>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){c_();return}let o=await lg(t);if(!o.ok){o.error instanceof $?c_():(console.error(`Failed to add header: ${S(o.value)}`),process.exitCode=1);return}let s=o.value.find(e=>e.config.url===r);if(!s){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let c=structuredClone(s.config);c.headers[i]=a;let l=await a_(t,s.config._id,c);if(!l.ok){l.error instanceof $?c_():(console.error(`Failed to add header: ${S(l.value)}`),process.exitCode=1);return}console.info(`Header added: ${i}`)}function c_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const l_=Object.values(ag);async function u_(){let{values:{help:e,repo:t=await E(),name:r,secret:i,trigger:a=[]},positionals:[o]}=A({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},secret:{type:`string`,short:`s`},trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Create a new webhook in a Prismic repository.
2328
+
2329
+ By default, this command reads the repository from prismic.config.json at the
2330
+ project root.
2331
+
2332
+ USAGE
2333
+ prismic webhook create <url> [flags]
2334
+
2335
+ ARGUMENTS
2336
+ <url> Webhook URL to receive events
2337
+
2338
+ FLAGS
2339
+ -n, --name string Webhook name
2340
+ -s, --secret string Secret for webhook signature
2341
+ -t, --trigger string Trigger events (can be repeated)
2342
+ -r, --repo string Repository domain
2343
+ -h, --help Show help for command
2344
+
2345
+ TRIGGERS
2346
+ document.published When documents are published
2347
+ document.unpublished When documents are unpublished
2348
+ release.created When a release is created
2349
+ release.updated When a release is edited or deleted
2350
+ tag.created When a tag is created
2351
+ tag.deleted When a tag is deleted
2352
+
2353
+ If no triggers specified, all are enabled.
2354
+
2355
+ LEARN MORE
2356
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}for(let e of a)if(!l_.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${l_.join(`, `)}`),process.exitCode=1;return}if(!await n()){f_();return}let s=!(a.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of a){let[t]=Object.entries(ag).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await d_(t,{url:o,name:r??null,secret:i??null,...c});if(!l.ok){l.error instanceof $?f_():(console.error(`Failed to create webhook: ${S(l.value)}`),process.exitCode=1);return}console.info(`Webhook created: ${o}`)}async function d_(e,t){let n=new URL(`/app/settings/webhooks/create`,await x(e)),r=new FormData;return r.set(`url`,t.url),r.set(`name`,t.name??``),r.set(`secret`,t.secret??``),r.set(`headers`,JSON.stringify({})),r.set(`active`,`on`),r.set(`documentsPublished`,t.documentsUnpublished.toString()),r.set(`documentsUnpublished`,t.documentsUnpublished.toString()),r.set(`releasesCreated`,t.documentsUnpublished.toString()),r.set(`releasesUpdated`,t.documentsUnpublished.toString()),r.set(`tagsCreated`,t.documentsUnpublished.toString()),r.set(`documentsPublished`,t.documentsUnpublished.toString()),await Q(n,{method:`POST`,body:r})}function f_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function p_(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Disable a webhook in a Prismic repository.
2357
+
2358
+ By default, this command reads the repository from prismic.config.json at the
2359
+ project root.
2360
+
2361
+ USAGE
2362
+ prismic webhook disable <url> [flags]
2363
+
2364
+ ARGUMENTS
2365
+ <url> Webhook URL
2366
+
2367
+ FLAGS
2368
+ -r, --repo string Repository domain
2369
+ -h, --help Show help for command
2370
+
2371
+ LEARN MORE
2372
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){m_();return}let i=await lg(t);if(!i.ok){i.error instanceof $?m_():(console.error(`Failed to disable webhook: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!a.config.active){console.info(`Webhook already disabled: ${r}`);return}let o=structuredClone(a.config);o.active=!1;let s=await a_(t,a.config._id,o);if(!s.ok){s.error instanceof $?m_():(console.error(`Failed to disable webhook: ${S(s.value)}`),process.exitCode=1);return}console.info(`Webhook disabled: ${r}`)}function m_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function h_(){let{values:{help:e,repo:t=await E(),json:r}}=A({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(e){console.info(`List all webhooks in a Prismic repository.
2373
+
2374
+ By default, this command reads the repository from prismic.config.json at the
2375
+ project root.
2376
+
2377
+ USAGE
2378
+ prismic webhook list [flags]
2379
+
2380
+ FLAGS
2381
+ --json Output as JSON
2382
+ -r, --repo string Repository domain
2383
+ -h, --help Show help for command
2384
+
2385
+ LEARN MORE
2386
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){g_();return}let i=await lg(t);if(!i.ok){i.error instanceof $?g_():w(i.error)?(console.error(`Failed to list webhooks: Invalid response: ${S(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list webhooks: ${S(i.value)}`),process.exitCode=1);return}let a=i.value;if(r)console.info(S(a.map(e=>e.config)));else{if(a.length===0){console.info(`No webhooks configured.`);return}for(let e of a){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}}function g_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function __(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Delete a webhook from a Prismic repository.
2387
+
2388
+ By default, this command reads the repository from prismic.config.json at the
2389
+ project root.
2390
+
2391
+ USAGE
2392
+ prismic webhook remove <url> [flags]
2393
+
2394
+ ARGUMENTS
2395
+ <url> Webhook URL
2396
+
2397
+ FLAGS
2398
+ -r, --repo string Repository domain
2399
+ -h, --help Show help for command
2400
+
2401
+ LEARN MORE
2402
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){y_();return}let i=await lg(t);if(!i.ok){i.error instanceof $?y_():(console.error(`Failed to remove webhook: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await v_(t,a.config._id);if(!o.ok){o.error instanceof $?y_():(console.error(`Failed to remove webhook: ${S(o.value)}`),process.exitCode=1);return}console.info(`Webhook removed: ${r}`)}async function v_(e,t){return await Q(new URL(`/app/settings/webhooks/${t}/delete`,await x(e)),{method:`POST`})}function y_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function b_(){let{values:{help:e,repo:t=await E()},positionals:[r,i]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Remove a custom HTTP header from a webhook.
2403
+
2404
+ By default, this command reads the repository from prismic.config.json at the
2405
+ project root.
2406
+
2407
+ USAGE
2408
+ prismic webhook remove-header <url> <key> [flags]
2409
+
2410
+ ARGUMENTS
2411
+ <url> Webhook URL
2412
+ <key> Header name
2413
+
2414
+ FLAGS
2415
+ -r, --repo string Repository domain
2416
+ -h, --help Show help for command
2417
+
2418
+ LEARN MORE
2419
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){x_();return}let a=await lg(t);if(!a.ok){a.error instanceof $?x_():(console.error(`Failed to remove header: ${S(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===r);if(!o){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!(i in o.config.headers)){console.error(`Header not found: ${i}`),process.exitCode=1;return}let s=structuredClone(o.config);delete s.headers[i];let c=await a_(t,o.config._id,s);if(!c.ok){c.error instanceof $?x_():(console.error(`Failed to remove header: ${S(c.value)}`),process.exitCode=1);return}console.info(`Header removed: ${i}`)}function x_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const S_=Object.values(ag);async function C_(){let{values:{help:e,repo:t=await E(),trigger:r},positionals:[i]}=A({args:process.argv.slice(4),options:{trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Update which events trigger a webhook.
2420
+
2421
+ By default, this command reads the repository from prismic.config.json at the
2422
+ project root.
2423
+
2424
+ USAGE
2425
+ prismic webhook set-triggers <url> [flags]
2426
+
2427
+ ARGUMENTS
2428
+ <url> Webhook URL
2429
+
2430
+ FLAGS
2431
+ -t, --trigger string Trigger events (can be repeated, at least one required)
2432
+ -r, --repo string Repository domain
2433
+ -h, --help Show help for command
2434
+
2435
+ TRIGGERS
2436
+ document.published When documents are published
2437
+ document.unpublished When documents are unpublished
2438
+ release.created When a release is created
2439
+ release.updated When a release is edited or deleted
2440
+ tag.created When a tag is created
2441
+ tag.deleted When a tag is deleted
2442
+
2443
+ LEARN MORE
2444
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!r||r.length===0){console.error(`Missing required option: --trigger`),process.exitCode=1;return}for(let e of r)if(!S_.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${S_.join(`, `)}`),process.exitCode=1;return}if(!await n()){w_();return}let a=await lg(t);if(!a.ok){a.error instanceof $?w_():(console.error(`Failed to update webhook triggers: ${S(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===i);if(!o){console.error(`Webhook not found: ${i}`),process.exitCode=1;return}let s=!(r.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of r){let[t]=Object.entries(ag).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await a_(t,o.config._id,{...o.config,...c});if(!l.ok){l.error instanceof $?w_():(console.error(`Failed to update webhook triggers: ${S(l.value)}`),process.exitCode=1);return}console.info(`Webhook triggers updated: ${r.join(`, `)}`)}function w_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function T_(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Show the enabled/disabled status of a webhook.
2445
+
2446
+ By default, this command reads the repository from prismic.config.json at the
2447
+ project root.
2448
+
2449
+ USAGE
2450
+ prismic webhook status <url> [flags]
2451
+
2452
+ ARGUMENTS
2453
+ <url> Webhook URL
2454
+
2455
+ FLAGS
2456
+ -r, --repo string Repository domain
2457
+ -h, --help Show help for command
2458
+
2459
+ LEARN MORE
2460
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){E_();return}let i=await lg(t);if(!i.ok){i.error instanceof $?E_():(console.error(`Failed to get webhook status: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=a.config.active?`enabled`:`disabled`;console.info(o)}function E_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function D_(){let{values:{help:e,repo:t=await E()},positionals:[r]}=A({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(e){console.info(`Trigger a test webhook in a Prismic repository.
2461
+
2462
+ By default, this command reads the repository from prismic.config.json at the
2463
+ project root.
2464
+
2465
+ USAGE
2466
+ prismic webhook test <url> [flags]
2467
+
2468
+ ARGUMENTS
2469
+ <url> Webhook URL
2470
+
2471
+ FLAGS
2472
+ -r, --repo string Repository domain
2473
+ -h, --help Show help for command
2474
+
2475
+ LEARN MORE
2476
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await n()){k_();return}let i=await lg(t);if(!i.ok){i.error instanceof $?k_():(console.error(`Failed to test webhook: ${S(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await O_(t,a.config._id);if(!o.ok){o.error instanceof $?k_():(console.error(`Failed to test webhook: ${S(o.value)}`),process.exitCode=1);return}console.info(`Test webhook triggered: ${r}`)}async function O_(e,t){return await Q(new URL(`/app/settings/webhooks/${t}/trigger`,await x(e)),{method:`POST`})}function k_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function A_(){let{positionals:[e]}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(e){case`list`:await h_();break;case`create`:await u_();break;case`view`:await og();break;case`remove`:await __();break;case`test`:await D_();break;case`enable`:await i_();break;case`disable`:await p_();break;case`status`:await T_();break;case`add-header`:await s_();break;case`remove-header`:await b_();break;case`set-triggers`:await C_();break;default:e&&(console.error(`Unknown webhook subcommand: ${e}\n`),process.exitCode=1),console.info(`Manage webhooks in a Prismic repository.
2477
+
2478
+ USAGE
2479
+ prismic webhook <command> [flags]
2480
+
2481
+ COMMANDS
2482
+ list List all webhooks
2483
+ create Create a new webhook
2484
+ view View webhook details
2485
+ remove Delete a webhook
2486
+ test Trigger a test webhook
2487
+ enable Enable a webhook
2488
+ disable Disable a webhook
2489
+ status Show webhook enabled/disabled status
2490
+ add-header Add a custom HTTP header
2491
+ remove-header Remove a custom HTTP header
2492
+ set-triggers Update webhook triggers
2493
+
2494
+ FLAGS
2495
+ -h, --help Show help for command
2496
+
2497
+ LEARN MORE
2498
+ Use \`prismic webhook <command> --help\` for more information about a command.`)}}async function j_(){let{values:{help:e}}=A({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(e){console.info(`Show the currently logged in user.
2499
+
2500
+ USAGE
2501
+ prismic whoami [flags]
2502
+
2503
+ FLAGS
2504
+ -h, --help Show help for command
2505
+
2506
+ LEARN MORE
2507
+ Use \`prismic <command> --help\` for more information about a command.`);return}if(!await n()){N_();return}let t=await M_();if(!t.ok){t.error instanceof $?N_():console.error(`Failed to fetch user profile.`),process.exitCode=1;return}console.info(t.value.email)}async function M_(){return await Q(new URL(`profile`,await le()),{schema:u({email:p()})})}function N_(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const{positionals:P_,values:{version:F_}}=A({options:{help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`v`}},allowPositionals:!0,strict:!1});if(dp(),await Jr(),F_)console.info(Ze);else{let e=P_[0];Yr(e);try{switch(e){case`init`:await Lp();break;case`sync`:await kp();break;case`login`:await $p();break;case`logout`:await tm();break;case`whoami`:await j_();break;case`status`:await gg();break;case`repo`:await Ah();break;case`locale`:await Qp();break;case`page-type`:await Om();break;case`custom-type`:await Or();break;case`slice`:await ig();break;case`pull`:await th();break;case`push`:await ih();break;case`codegen`:await nr();break;case`docs`:await Vr();break;case`preview`:await eh();break;case`token`:await r_();break;case`webhook`:await A_();break;default:e&&(console.error(`Unknown command: ${e}`),process.exitCode=1),console.info(`Prismic CLI for managing repositories and configurations.
2508
+
2509
+ USAGE
2510
+ prismic <command> [flags]
2511
+
2512
+ COMMANDS
2513
+ init Initialize a Prismic project
2514
+ sync Sync types and slices from Prismic
2515
+ login Log in to Prismic
2516
+ logout Log out of Prismic
2517
+ whoami Show the currently logged in user
2518
+ status Show the status of the current project
2519
+ repo Manage Prismic repositories
2520
+ locale Manage locales in a repository
2521
+ page-type Manage page types in a repository
2522
+ custom-type Manage custom types in a repository
2523
+ slice Manage slices in a project
2524
+ pull Pull types and slices from Prismic
2525
+ push Push types and slices to Prismic
2526
+ codegen Generate code from Prismic models
2527
+ docs Fetch and list documentation from Prismic
2528
+ preview Manage preview configurations
2529
+ token Manage API tokens in a repository
2530
+ webhook Manage webhooks in a repository
2531
+
2532
+ FLAGS
2533
+ -v, --version Show CLI version
2534
+ -h, --help Show help for command
2535
+
2536
+ LEARN MORE
2537
+ Use \`prismic <command> --help\` for more information about a command.`)}Xr(e,process.exitCode!==1)}catch(t){throw await fp(t),Xr(e,!1,t),process.exitCode=1,t}}export{};