prismic 1.27.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters-_6OwtgCL.mjs +197 -0
- package/dist/index.mjs +96 -96
- package/dist/{nextjs-C5Tecr6K.mjs → nextjs-CiU-wONg.mjs} +52 -52
- package/dist/{nuxt-Dv-vPR1I.mjs → nuxt-BNM57THK.mjs} +7 -7
- package/dist/package-DPO7tnYd.mjs +1 -0
- package/dist/packageJson-Du_fIYqH.mjs +32 -0
- package/dist/{segment-B4vS06Kb.mjs → segment-BW5d22g2.mjs} +1 -1
- package/dist/subprocesses/sendSegmentEvents.mjs +1 -1
- package/dist/subprocesses/updateVersionState.mjs +1 -1
- package/dist/{sveltekit-CuRs_Ytj.mjs → sveltekit-BvwbM55F.mjs} +26 -26
- package/dist/sveltekit-C5og1T-S.mjs +1 -0
- package/dist/{sveltekit2-C_afy31M.mjs → sveltekit2-CVfxQ2tH.mjs} +7 -7
- package/dist/update-notifier-CaPWDsNo.mjs +1 -0
- package/package.json +9 -6
- package/dist/adapters-CH12Bn8O.mjs +0 -189
- package/dist/auth-dqtuCJNc.mjs +0 -2
- package/dist/package-DruwThDN.mjs +0 -1
- package/dist/packageJson-uZy38HFJ.mjs +0 -2
- package/dist/request-BlAQgJGK.mjs +0 -31
- package/dist/subprocesses/refreshToken.mjs +0 -1
- package/dist/sveltekit-DJ5rpjcZ.mjs +0 -1
- package/dist/update-notifier-DUA88jNO.mjs +0 -1
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import{h as e,r as t}from"./auth-dqtuCJNc.mjs";import{C as n,F as r,I as i,M as a,N as o,P as s,_ as c,b as l,c as u,d,f,h as p,k as m,l as h,m as g,s as _,u as v,v as y,w as b,z as x}from"./request-BlAQgJGK.mjs";import{a as S,l as C,r as w,t as ee}from"./packageJson-uZy38HFJ.mjs";import"node:module";import{parseArgs as T}from"node:util";import{readFile as E,realpath as D,rm as O,writeFile as te}from"node:fs/promises";import{sep as ne}from"node:path";import{fileURLToPath as k,pathToFileURL as A}from"node:url";import*as re from"node:crypto";import{createHash as ie}from"node:crypto";import*as j from"fs";import{readdir as M,readdirSync as N,realpath as P,realpathSync as F,stat as I,statSync as L}from"fs";import{basename as R,dirname as z,isAbsolute as B,normalize as V,posix as H,relative as ae,resolve as oe,sep as U}from"path";import{fileURLToPath as W}from"url";import{createRequire as G}from"module";var se=Object.create,ce=Object.defineProperty,le=Object.getOwnPropertyDescriptor,ue=Object.getOwnPropertyNames,de=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,pe=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),me=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ue(t),a=0,o=i.length,s;a<o;a++)s=i[a],!fe.call(e,s)&&s!==n&&ce(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=le(t,s))||r.enumerable});return e},he=(e,t,n)=>(n=e==null?{}:se(de(e)),me(t||!e||!e.__esModule||!fe.call(e,`default`)?ce(n,`default`,{value:e,enumerable:!0}):n,e));const ge=/([\p{Ll}\d])(\p{Lu})/gu,_e=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,ve=/(\d)\p{Ll}|(\p{L})\d/u,ye=/[^\p{L}\d]+/giu,be=`$1\0$2`;function xe(e){let t=e.trim();t=t.replace(ge,be).replace(_e,be),t=t.replace(ye,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}function Se(e){let t=xe(e);for(let e=0;e<t.length;e++){let n=t[e],r=ve.exec(n);if(r){let i=r.index+(r[1]??r[2]).length;t.splice(e,1,n.slice(0,i),n.slice(i))}}return t}function Ce(e,t){let[n,r,i]=Me(e,t);return n+r.map(Oe(t?.locale)).join(t?.delimiter??` `)+i}function we(e,t){let[n,r,i]=Me(e,t),a=Oe(t?.locale),o=ke(t?.locale),s=t?.mergeAmbiguousCharacters?Ae(a,o):je(a,o);return n+r.map((e,t)=>t===0?a(e):s(e,t)).join(t?.delimiter??``)+i}function Te(e,t){let[n,r,i]=Me(e,t),a=Oe(t?.locale),o=ke(t?.locale),s=t?.mergeAmbiguousCharacters?Ae(a,o):je(a,o);return n+r.map(s).join(t?.delimiter??``)+i}function Ee(e,t){let[n,r,i]=Me(e,t),a=Oe(t?.locale),o=ke(t?.locale);return n+r.map(Ae(a,o)).join(t?.delimiter??` `)+i}function De(e,t){return Ce(e,{delimiter:`_`,...t})}function Oe(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function ke(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function Ae(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function je(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function Me(e,t={}){let n=t.split??(t.separateNumbers?Se:xe),r=t.prefixCharacters??``,i=t.suffixCharacters??``,a=0,o=e.length;for(;a<e.length;){let t=e.charAt(a);if(!r.includes(t))break;a++}for(;o>a;){let t=o-1,n=e.charAt(t);if(!i.includes(n))break;o=t}return[e.slice(0,a),n(e.slice(a,o)),e.slice(o)]}function Ne(e,t){return(!e||e.endsWith(`
|
|
2
|
-
`))&&!t?.force?e:e+`
|
|
3
|
-
`}function K(e,t){return Ne(t)+e}function Pe(e,t){return(!e||e.endsWith(`
|
|
4
|
-
|
|
5
|
-
`))&&!t?.force?e:Ne(e)+`
|
|
6
|
-
`}function q(e,t){return Pe(t)+e}function Fe(e){return e.filter(Boolean).join(` | `)||`never`}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ie(Object(n),!0).forEach(function(t){Re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Re(e,t,n){return t=ze(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ze(e){var t=Be(e,`string`);return typeof t==`symbol`?t:String(t)}function Be(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}const Ve=He({});function He(e){return t.withOptions=t=>He(Le(Le({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Ue(n[e],s):n[e];s+=t}}let c=s.split(`
|
|
7
|
-
`),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
|
|
8
|
-
`)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
|
|
9
|
-
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Ue(e,t){if(typeof e!=`string`||!e.includes(`
|
|
10
|
-
`))return e;let n=t.slice(t.lastIndexOf(`
|
|
11
|
-
`)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}const We=Ve.withOptions({alignValues:!0}),J=(e,...t)=>{let n=Array.from(e);return We(Object.assign(n,{raw:n}),...t)},Ge=`https://prismic.io/docs/slices`,Ke={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`},Y=(...e)=>{let t=Te(e.filter(Boolean).join(` `).replace(/[^A-Z0-9]+/gi,` `),{mergeAmbiguousCharacters:!0});return/^[0-9]/.test(t)&&(t=`_${t}`),t},qe=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 Je(e){return e.path.map(e=>e.label?e.label:e.model?qe({model:e.model,name:e.name}):e.name).join(` → `)}function Ye(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}function Xe(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 Ze(e){switch(e.field.type){case`Link`:{let t=Ke.Link;switch(e.field.config?.select){case`document`:return t.contentRelationship;case`media`:return t.linkToMedia;default:return t.link}}default:{let t=Ke[e.field.type];if(typeof t==`string`)return t}}}function Qe(e){let t=`/**`,n=qe({model:e.field,name:e.name}),r=Je({path:e.path}),i=Xe({field:e.field});t=K(` * ${n} field in *${r}*`,t),t=K(` *`,t),t=K(` * - **Field Type**: ${i}`,t),t=K(` * - **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=K(` * - **Default Value**: ${typeof a==`boolean`?`${a}`:a}`,t)),t=K(` * - **API ID Path**: ${Ye({path:[...e.path,{name:e.name,model:e.field}]})}`,t),e.tabName&&(t=K(` * - **Tab**: ${e.tabName}`,t));let o=Ze({field:e.field});return o&&(t=K(` * - **Documentation**: ${o}`,t)),t=K(` */`,t),t}const $e={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 et(e){let t=Qe({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=K(`${i}: prismic.BooleanField;`,t);break;case`Color`:t=K(`${i}: prismic.ColorField;`,t);break;case`Date`:t=K(`${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=Fe(n);t=n.length>0?K(`${i}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${r})>`,t):K(`${i}: prismic.EmbedField`,t);break}case`GeoPoint`:t=K(`${i}: prismic.GeoPointField;`,t);break;case`Image`:t=e.field.config?.thumbnails&&e.field.config.thumbnails.length>0?K(`${i}: prismic.ImageField<${Fe(e.field.config.thumbnails.map(e=>`"${e.name}"`))}>;`,t):K(`${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=K(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?K(`${i}: ${Fe(e.field.config.customtypes.map(e=>typeof e==`string`?`prismic.ContentRelationshipField<"${e}">`:`ContentRelationshipFieldWithData<${JSON.stringify([e])}>`))};`,t):K(`${i}: prismic.ContentRelationshipField;`,t);break;case`media`:t=K(`${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=K(`${i}: ${r};`,t);break}}break}case`Number`:t=K(`${i}: prismic.NumberField;`,t);break;case`StructuredText`:t=K(`${i}: prismic.RichTextField;`,t);break;case`Select`:{let n=e.field.config?.options?.map(e=>`"${e}"`)||[],r=n.length?Fe(n):`string`;t=e.field.config?.default_value?K(`${i}: prismic.SelectField<${r}, "filled">;`,t):K(`${i}: prismic.SelectField${n.length>0?`<${r}>`:``};`,t);break}case`Table`:t=K(`${i}: prismic.TableField;`,t);break;case`Text`:t=K(`${i}: prismic.KeyTextField;`,t);break;case`Timestamp`:t=K(`${i}: prismic.TimestampField;`,t);break;case`Group`:{let a=e.path.filter(e=>e.model!==void 0&&`type`in e.model&&e.model.type===$e.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=Y(t.name,`Slice`,n.name,r.name,...a.map(e=>e.name),e.name,`Item`)}else s=Y(e.path[0].name,`Document`,`Data`,...a.map(e=>e.name),e.name,`Item`);let c=[...e.path,{name:i,model:e.field}],l=Je({path:c}),u=tt({fields:e.field.config?.fields||{},fieldConfigs:e.fieldConfigs,path:c});n.push(...u.auxiliaryTypes),r.push(...u.contentTypeNames),n.push({name:s,code:J`
|
|
12
|
-
/**
|
|
13
|
-
* Item in *${l}*
|
|
14
|
-
*/
|
|
15
|
-
export interface ${s} {
|
|
16
|
-
${u.code}
|
|
17
|
-
}
|
|
18
|
-
`}),r.push(s),t=K(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(Y(t,`Slice`));else if(i.type===`Slice`){let o=Y(e.path[0].name,`Document`,`Data`,e.name,t,`Slice`),s;if(i[`non-repeat`]&&Object.keys(i[`non-repeat`]).length>0){s=Y(o,`Primary`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`primary`,label:`Primary`}],c=Je({path:a}),l=tt({fields:i[`non-repeat`],fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=J`
|
|
19
|
-
/**
|
|
20
|
-
* Primary content in *${c}*
|
|
21
|
-
*/
|
|
22
|
-
`;u=l.code?K(J`
|
|
23
|
-
export interface ${s} {
|
|
24
|
-
${l.code}
|
|
25
|
-
}
|
|
26
|
-
`,u):K(`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=Y(o,`Item`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`items`,label:`Items`}],s=Je({path:a}),l=tt({fields:i.repeat,fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=J`
|
|
27
|
-
/**
|
|
28
|
-
* Item content in *${s}*
|
|
29
|
-
*/
|
|
30
|
-
`;u=l.code?K(J`
|
|
31
|
-
export interface ${c} {
|
|
32
|
-
${l.code}
|
|
33
|
-
}
|
|
34
|
-
`,u):K(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:J`
|
|
35
|
-
/**
|
|
36
|
-
* Slice for *${Je({path:[...e.path,{name:e.name,model:e.field}]})}*
|
|
37
|
-
*/
|
|
38
|
-
export type ${o} = prismic.Slice<"${t}", ${s?`Simplify<${s}>`:`Record<string, never>`}, ${c?`Simplify<${c}>`:`never`}>
|
|
39
|
-
`}),a.push(o)}}let o=Y(e.path[0].name,`Document`,`Data`,e.name,`Slice`),s=Fe(a);n.push({name:o,code:`type ${o} = ${s}`}),r.push(o),t=K(`${i}: prismic.SliceZone<${o}>;`,t);break}default:t=K(`${i}: unknown;`,t)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function tt(e){let t=``,n=[],r=[];for(let i in e.fields){let a=e.fields[i],o=et({name:i,field:a,path:e.path,fieldConfigs:e.fieldConfigs,tabName:e.tabName});t=q(o.code,t),n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function nt(e){let t=``,n=[],r=[],i=Y(e.model.id,`Document`,`Data`),a=qe({name:e.model.id,model:e.model}),o=``;for(let t in e.model.json){let{uid:i,...a}=e.model.json[t],s=tt({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?J`
|
|
40
|
-
/**
|
|
41
|
-
* Content for ${a} documents
|
|
42
|
-
*/
|
|
43
|
-
interface ${i} {
|
|
44
|
-
${o}
|
|
45
|
-
}
|
|
46
|
-
`:`interface ${i} {}`,{name:i,code:t,auxiliaryTypes:n,contentTypeNames:r}}function rt(e){return`uid`in Object.assign({},...Object.values(e.json))}const it=e=>re.createHash(`sha1`).update(JSON.stringify(e)).digest(`hex`);function at(e){if(e.cache){let t=it(e.model),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=Y(e.model.id,`Document`),a=e.localeIDs&&e.localeIDs.length>0?Fe(e.localeIDs.map(e=>`"${e}"`)):`string`,o=rt(e.model)?`PrismicDocumentWithUID`:`PrismicDocumentWithoutUID`,s=qe({name:e.model.id,model:e.model}),c=nt({model:e.model,fieldConfigs:e.fieldConfigs});n.push(...c.auxiliaryTypes),r.push(c.name),r.push(...c.contentTypeNames),t=q(c.code,t),t=q(J`
|
|
47
|
-
/**
|
|
48
|
-
* ${s} document from Prismic
|
|
49
|
-
*
|
|
50
|
-
* - **API ID**: \`${e.model.id}\`
|
|
51
|
-
* - **Repeatable**: \`${e.model.repeatable.toString()}\`
|
|
52
|
-
* - **Documentation**: ${`https://prismic.io/docs/content-modeling`}
|
|
53
|
-
*
|
|
54
|
-
* @typeParam Lang - Language API ID of the document.
|
|
55
|
-
*/
|
|
56
|
-
export type ${i}<Lang extends string = ${a}> = prismic.${o}<Simplify<${c.name}>, "${e.model.id}", Lang>;
|
|
57
|
-
`,t);let l={name:i,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=it(e.model);e.cache.set(t,l)}return l}function ot(e){if(e.cache){let t=it([e.model,e.fieldConfigs]),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=Y(e.model.id,`Slice`),a=qe({name:e.model.id,model:e.model}),o=[];for(let s of e.model.variations){let c=Y(i,s.id),l;if(s.primary&&Object.keys(s.primary).length>0){l=Y(c,`Primary`);let i=[{name:e.model.id,model:e.model},{name:s.id,label:s.name},{name:`primary`,label:`Primary`}],a=Je({path:i}),o=tt({fields:s.primary,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(l);let u=J`
|
|
58
|
-
/**
|
|
59
|
-
* Primary content in *${a}*
|
|
60
|
-
*/
|
|
61
|
-
`;t=q(o.code?J`
|
|
62
|
-
${u}
|
|
63
|
-
export interface ${l} {
|
|
64
|
-
${o.code}
|
|
65
|
-
}
|
|
66
|
-
`:J`
|
|
67
|
-
${u}
|
|
68
|
-
export interface ${l} {}
|
|
69
|
-
`,t)}let u;if(s.items&&Object.keys(s.items).length>0){u=Y(c,`Item`);let i=[{name:e.model.id,model:e.model},{name:`items`,label:`Items`}],a=Je({path:i}),o=tt({fields:s.items,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(u);let l=J`
|
|
70
|
-
/**
|
|
71
|
-
* Primary content in *${a}*
|
|
72
|
-
*/
|
|
73
|
-
`;t=q(o.code?J`
|
|
74
|
-
${l}
|
|
75
|
-
export interface ${u} {
|
|
76
|
-
${o.code}
|
|
77
|
-
}
|
|
78
|
-
`:J`
|
|
79
|
-
${l}
|
|
80
|
-
export interface ${u} {}
|
|
81
|
-
`,t)}t=q(J`
|
|
82
|
-
/**
|
|
83
|
-
* ${s.name} variation for ${a} Slice
|
|
84
|
-
*
|
|
85
|
-
* - **API ID**: \`${s.id}\`
|
|
86
|
-
* - **Description**: ${s.description||`*None*`}
|
|
87
|
-
* - **Documentation**: ${Ge}
|
|
88
|
-
*/
|
|
89
|
-
export type ${c} = prismic.SharedSliceVariation<"${s.id}", ${l?`Simplify<${l}>`:`Record<string, never>`}, ${u?`Simplify<${u}>`:`never`}>;
|
|
90
|
-
`,t),o.push(c)}let s=Y(i,`Variation`),c=Fe(o);r.push(s),r.push(...o),t=q(J`
|
|
91
|
-
/**
|
|
92
|
-
* Slice variation for *${a}*
|
|
93
|
-
*/
|
|
94
|
-
type ${s} = ${o.length>0?c:`never`}
|
|
95
|
-
`,t),t=q(J`
|
|
96
|
-
/**
|
|
97
|
-
* ${a} Shared Slice
|
|
98
|
-
*
|
|
99
|
-
* - **API ID**: \`${e.model.id}\`
|
|
100
|
-
* - **Description**: ${e.model.description||`*None*`}
|
|
101
|
-
* - **Documentation**: ${Ge}
|
|
102
|
-
*/
|
|
103
|
-
export type ${i} = prismic.SharedSlice<"${e.model.id}", ${s}>;
|
|
104
|
-
`,t);let l={name:i,variationNames:o,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=it([e.model,e.fieldConfigs]);e.cache.set(t,l)}return l}const st=new class extends Map{#e=0;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r;#i;#a;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.#r=e.maxSize,this.#i=e.maxAge||1/0,this.#a=e.onEviction}get __oldCache(){return this.#n}#o(e){if(typeof this.#a==`function`)for(let[t,n]of e)this.#a(t,n.value)}#s(e,t){return typeof t.expiry==`number`&&t.expiry<=Date.now()&&(typeof this.#a==`function`&&this.#a(e,t.value),this.delete(e))}#c(e,t){if(this.#s(e,t)===!1)return t.value}#l(e,t){return t.expiry?this.#c(e,t):t.value}#u(e,t){let n=t.get(e);return this.#l(e,n)}#d(e,t){this.#t.set(e,t),this.#e++,this.#e>=this.#r&&(this.#e=0,this.#o(this.#n),this.#n=this.#t,this.#t=/* @__PURE__ */ new Map)}#f(e,t){this.#n.delete(e),this.#d(e,t)}*#p(){for(let e of this.#n){let[t,n]=e;this.#t.has(t)||this.#s(t,n)===!1&&(yield e)}for(let e of this.#t){let[t,n]=e;this.#s(t,n)===!1&&(yield e)}}get(e){if(this.#t.has(e)){let t=this.#t.get(e);return this.#l(e,t)}if(this.#n.has(e)){let t=this.#n.get(e);if(this.#s(e,t)===!1)return this.#f(e,t),t.value}}set(e,t,{maxAge:n=this.#i}={}){let r=typeof n==`number`&&n!==1/0?Date.now()+n:void 0;return this.#t.has(e)?this.#t.set(e,{value:t,expiry:r}):this.#d(e,{value:t,expiry:r}),this}has(e){return this.#t.has(e)?!this.#s(e,this.#t.get(e)):this.#n.has(e)?!this.#s(e,this.#n.get(e)):!1}peek(e){if(this.#t.has(e))return this.#u(e,this.#t);if(this.#n.has(e))return this.#u(e,this.#n)}expiresIn(e){let t=this.#t.get(e)??this.#n.get(e);if(t)return t.expiry?t.expiry-Date.now():1/0}delete(e){let t=this.#t.delete(e);return t&&this.#e--,this.#n.delete(e)||t}clear(){this.#t.clear(),this.#n.clear(),this.#e=0}resize(e){if(!(e&&e>0))throw TypeError("`maxSize` must be a number greater than 0");let t=[...this.#p()],n=t.length-e;n<0?(this.#t=new Map(t),this.#n=/* @__PURE__ */ new Map,this.#e=t.length):(n>0&&this.#o(t.slice(0,n)),this.#n=new Map(t.slice(n)),this.#t=/* @__PURE__ */ new Map,this.#e=0),this.#r=e}evict(e=1){let t=Number(e);if(!t||t<=0)return;let n=[...this.#p()],r=Math.trunc(Math.min(t,Math.max(n.length-1,0)));r<=0||(this.#o(n.slice(0,r)),this.#n=new Map(n.slice(r)),this.#t=/* @__PURE__ */ new Map,this.#e=0)}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.#t){let[t,n]=e;this.#s(t,n)===!1&&(yield[t,n.value])}for(let e of this.#n){let[t,n]=e;this.#t.has(t)||this.#s(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.#t];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.#s(n,r)===!1&&(yield[n,r.value])}e=[...this.#n];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.#t.has(n)||this.#s(n,r)===!1&&(yield[n,r.value])}}*entriesAscending(){for(let[e,t]of this.#p())yield[e,t.value]}get size(){if(!this.#e)return this.#n.size;let e=0;for(let t of this.#n.keys())this.#t.has(t)||e++;return Math.min(this.#e+e,this.#r)}get maxSize(){return this.#r}get maxAge(){return this.#i}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`QuickLRU`}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}}({maxSize:1e3});function ct(e={}){let t=e.fieldConfigs||{},n=e.cache??!0,r=``,i=e.typesProvider||`@prismicio/types`,a=`prismic`;r=K(`import type * as prismic from "${i}";`,r),(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace)&&i!==`@prismicio/client`&&(a=`prismicClient`,r=K(`import type * as ${a} from "@prismicio/client";`,r)),r=q(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`,r),r=q(`
|
|
105
|
-
type PickContentRelationshipFieldData<
|
|
106
|
-
TRelationship extends prismic.CustomTypeModelFetchCustomTypeLevel1 | prismic.CustomTypeModelFetchCustomTypeLevel2 | prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2,
|
|
107
|
-
TData extends Record<string, prismic.AnyRegularField | prismic.GroupField | prismic.NestedGroupField | prismic.SliceZone>,
|
|
108
|
-
TLang extends string
|
|
109
|
-
> = |
|
|
110
|
-
// Content relationship fields
|
|
111
|
-
{
|
|
112
|
-
[TSubRelationship in Extract<
|
|
113
|
-
TRelationship["fields"][number], prismic.CustomTypeModelFetchContentRelationshipLevel1
|
|
114
|
-
> as TSubRelationship["id"]]:
|
|
115
|
-
ContentRelationshipFieldWithData<TSubRelationship["customtypes"], TLang>;
|
|
116
|
-
} &
|
|
117
|
-
// Group
|
|
118
|
-
{
|
|
119
|
-
[TGroup in Extract<
|
|
120
|
-
TRelationship["fields"][number], prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2
|
|
121
|
-
> as TGroup["id"]]:
|
|
122
|
-
TData[TGroup["id"]] extends prismic.GroupField<infer TGroupData>
|
|
123
|
-
? prismic.GroupField<PickContentRelationshipFieldData<TGroup, TGroupData, TLang>>
|
|
124
|
-
: never
|
|
125
|
-
} &
|
|
126
|
-
// Other fields
|
|
127
|
-
{
|
|
128
|
-
[TFieldKey in Extract<TRelationship["fields"][number], string>]:
|
|
129
|
-
TFieldKey extends keyof TData ? TData[TFieldKey] : never;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
type ContentRelationshipFieldWithData<
|
|
133
|
-
TCustomType extends readonly (prismic.CustomTypeModelFetchCustomTypeLevel1 | string)[] | readonly (prismic.CustomTypeModelFetchCustomTypeLevel2 | string)[],
|
|
134
|
-
TLang extends string = string
|
|
135
|
-
> = {
|
|
136
|
-
[ID in Exclude<TCustomType[number], string>["id"]]:
|
|
137
|
-
prismic.ContentRelationshipField<
|
|
138
|
-
ID,
|
|
139
|
-
TLang,
|
|
140
|
-
PickContentRelationshipFieldData<
|
|
141
|
-
Extract<TCustomType[number], { id: ID }>,
|
|
142
|
-
Extract<prismic.Content.AllDocumentTypes, { type: ID }>["data"],
|
|
143
|
-
TLang
|
|
144
|
-
>
|
|
145
|
-
>
|
|
146
|
-
}[Exclude<TCustomType[number], string>["id"]];
|
|
147
|
-
`,r);let o=[];if(e.customTypeModels){let i=[];for(let a of e.customTypeModels){let s=at({model:a,localeIDs:e.localeIDs,fieldConfigs:t,cache:n?st:void 0});for(let e of s.auxiliaryTypes)r=q(e.code,r);r=q(s.code,r),i.push(s.name),o.push(s.name),o.push(...s.contentTypeNames)}if(e.customTypeModels.length>0){let e=`AllDocumentTypes`;r=q(`export type ${e} = ${Fe(i)};`,r),o.push(e)}}if(e.sharedSliceModels)for(let i of e.sharedSliceModels){let e=ot({model:i,fieldConfigs:t,cache:n?st:void 0});for(let t of e.auxiliaryTypes)r=q(t.code,r);r=q(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=q(`interface CreateClient {
|
|
148
|
-
(repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client<AllDocumentTypes>;
|
|
149
|
-
}`,t),t=q(`interface CreateWriteClient {
|
|
150
|
-
(repositoryNameOrEndpoint: string, options: ${a}.WriteClientConfig): ${a}.WriteClient<AllDocumentTypes>;
|
|
151
|
-
}`,t),t=q(`interface CreateMigration {
|
|
152
|
-
(): ${a}.Migration<AllDocumentTypes>;
|
|
153
|
-
}`,t)):(t=q(`interface CreateClient {
|
|
154
|
-
(repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client;
|
|
155
|
-
}`,t),t=q(`interface CreateWriteClient {
|
|
156
|
-
(repositoryNameOrEndpoint: string, options?: ${a}.WriteClientConfig): ${a}.WriteClient;
|
|
157
|
-
}`,t),t=q(`interface CreateMigration {
|
|
158
|
-
(): ${a}.Migration;
|
|
159
|
-
}`,t))),e.clientIntegration.includeContentNamespace&&(t=q(J`
|
|
160
|
-
namespace Content {
|
|
161
|
-
export type {
|
|
162
|
-
${o.join(`,
|
|
163
|
-
`)}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
`,t)),r=q(J`
|
|
167
|
-
declare module "@prismicio/client" {
|
|
168
|
-
${t}
|
|
169
|
-
}
|
|
170
|
-
`,r)}return r}var lt=/* @__PURE__ */ G(import.meta.url);function ut(e){let t=V(e);return t.length>1&&t[t.length-1]===U&&(t=t.substring(0,t.length-1)),t}const dt=/[\\/]/g;function ft(e,t){return e.replace(dt,t)}const pt=/^[a-z]:[\\/]$/i;function mt(e){return e===`/`||pt.test(e)}function ht(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=oe(e)),(r||a)&&(e=ut(e)),e===`.`?``:ft(e[e.length-1]===i?e:e+i,i)}function gt(e,t){return t+e}function _t(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:ft(ae(e,r),t.pathSeparator)+t.pathSeparator+n}}function vt(e){return e}function yt(e,t,n){return t+e+n}function bt(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?_t(e,t):r?gt:vt}function xt(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function St(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const Ct=(e,t)=>{t.push(e||`.`)},wt=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},Tt=()=>{};function Et(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?St(e):xt(e):r&&r.length?wt:Ct:Tt}const Dt=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},Ot=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},kt=(e,t,n,r)=>{n.files++},At=(e,t)=>{t.push(e)},jt=()=>{};function Mt(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?jt:n&&n.length?r?Dt:Ot:r?kt:At}const Nt=e=>e,Pt=()=>[``].slice(0,0);function Ft(e){return e.group?Pt:Nt}const It=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},Lt=()=>{};function Rt(e){return e.group?It:Lt}const zt=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue(),i.realpath(e,(o,s)=>{if(o)return r.dequeue(a?null:o,t);i.stat(s,(i,o)=>{if(i)return r.dequeue(a?null:i,t);if(o.isDirectory()&&Ht(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},Bt=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue();try{let r=i.realpathSync(e),a=i.statSync(r);if(a.isDirectory()&&Ht(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function Vt(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?Bt:zt}function Ht(e,t,n){if(n.options.useRealPaths)return Ut(t,n);let r=z(e),i=1;for(;r!==n.root&&i<2;){let e=n.symlinks.get(r);e&&(e===t||e.startsWith(t)||t.startsWith(e))?i++:r=z(r)}return n.symlinks.set(e,t),i>1}function Ut(e,t){return t.visited.includes(e+t.options.pathSeparator)}const Wt=e=>e.counts,Gt=e=>e.groups,Kt=e=>e.paths,qt=e=>e.paths.slice(0,e.options.maxFiles),Jt=(e,t,n)=>(Qt(t,n,e.counts,e.options.suppressErrors),null),Yt=(e,t,n)=>(Qt(t,n,e.paths,e.options.suppressErrors),null),Xt=(e,t,n)=>(Qt(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),Zt=(e,t,n)=>(Qt(t,n,e.groups,e.options.suppressErrors),null);function Qt(e,t,n,r){t(e&&!r?e:null,n)}function $t(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?Wt:Jt:r?t?Gt:Zt:i?t?qt:Xt:t?Kt:Yt}const en={withFileTypes:!0},tn=(e,t,n,r,i)=>{if(e.queue.enqueue(),r<0)return e.queue.dequeue(null,e);let{fs:a}=e;e.visited.push(t),e.counts.directories++,a.readdir(t||`.`,en,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},nn=(e,t,n,r,i)=>{let{fs:a}=e;if(r<0)return;e.visited.push(t),e.counts.directories++;let o=[];try{o=a.readdirSync(t||`.`,en)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function rn(e){return e?nn:tn}var an=class{count=0;constructor(e){this.onQueueEmpty=e}enqueue(){return this.count++,this.count}dequeue(e,t){this.onQueueEmpty&&(--this.count<=0||e)&&(this.onQueueEmpty(e,t),e&&(t.controller.abort(),this.onQueueEmpty=void 0))}},on=class{_files=0;_directories=0;set files(e){this._files=e}get files(){return this._files}set directories(e){this._directories=e}get directories(){return this._directories}
|
|
171
|
-
/* c8 ignore next 3 */
|
|
172
|
-
get dirs(){return this._directories}},sn=class{aborted=!1;abort(){this.aborted=!0}},cn=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=$t(t,this.isSynchronous),this.root=ht(e,t),this.state={root:mt(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new on,options:t,queue:new an((e,t)=>this.callbackInvoker(t,e,n)),symlinks:/* @__PURE__ */ new Map,visited:[``].slice(0,0),controller:new sn,fs:t.fs||j},this.joinPath=bt(this.root,t),this.pushDirectory=Et(this.root,t),this.pushFile=Mt(t),this.getArray=Ft(t),this.groupFiles=Rt(t),this.resolveSymlink=Vt(t,this.isSynchronous),this.walkDirectory=rn(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,t,n)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:o,exclude:s,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&r.length>c)return;let p=this.getArray(this.state.paths);for(let c=0;c<e.length;++c){let l=e[c];if(l.isFile()||l.isSymbolicLink()&&!a&&!o){let e=this.joinPath(l.name,t);this.pushFile(e,p,this.state.counts,i)}else if(l.isDirectory()){let e=yt(l.name,t,this.state.options.pathSeparator);if(s&&s(l.name,e))continue;this.pushDirectory(e,r,i),this.walkDirectory(this.state,e,e,n-1,this.walk)}else if(this.resolveSymlink&&l.isSymbolicLink()){let e=gt(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=ht(r,this.state.options),s&&s(l.name,u?r:e+d))return;this.walkDirectory(this.state,r,u?r:e+d,n-1,this.walk)}else{r=u?r:e;let t=R(r),n=ht(z(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,p)}};function ln(e,t){return new Promise((n,r)=>{un(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function un(e,t,n){new cn(e,t,n).start()}function dn(e,t){return new cn(e,t).start()}var fn=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return ln(this.root,this.options)}withCallback(e){un(this.root,this.options,e)}sync(){return dn(this.root,this.options)}};let pn=null;
|
|
173
|
-
/* c8 ignore next 6 */
|
|
174
|
-
try{lt.resolve(`picomatch`),pn=lt(`picomatch`)}catch{}var mn=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:U,filters:[]};globFunction;constructor(e){this.options={...this.options,...e},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(e){return this.options.pathSeparator=e,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(e){return this.options.maxDepth=e,this}withMaxFiles(e){return this.options.maxFiles=e,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:e=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=e,this.withFullPaths()}withAbortSignal(e){return this.options.signal=e,this}normalize(){return this.options.normalizePath=!0,this}filter(e){return this.options.filters.push(e),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(e){return this.options.exclude=e,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(e){return new fn(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}
|
|
175
|
-
/* c8 ignore next 4 */
|
|
176
|
-
crawlWithOptions(e,t){return this.options={...this.options,...t},new fn(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||pn;
|
|
177
|
-
/* c8 ignore next 5 */
|
|
178
|
-
if(!n)throw Error(`Please specify a glob function to use glob matching.`);var r=this.globCache[e.join(`\0`)];return r||(r=n(e,...t),this.globCache[e.join(`\0`)]=r),this.options.filters.push(e=>r(e)),this}},hn=/* @__PURE__ */ pe(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),gn=/* @__PURE__ */ pe((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=hn();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),_n=/* @__PURE__ */ pe(((e,t)=>{let n=gn(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=hn(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.tokens===!0||b.scanToEnd===!0,C=[],w=[],ee=[],T=e,E=-1,D=0,O=0,te=!1,ne=!1,k=!1,A=!1,re=!1,ie=!1,j=!1,M=!1,N=!1,P=!1,F=0,I,L,R={value:``,depth:0,isGlob:!1},z=()=>E>=x,B=()=>T.charCodeAt(E+1),V=()=>(I=L,T.charCodeAt(++E));for(;E<x;){L=V();let e;if(L===a)j=R.backslashes=!0,L=V(),L===u&&(ie=!0);else{if(ie===!0||L===u){for(F++;z()!==!0&&(L=V());)if(L===a)j=R.backslashes=!0,V();else if(L===u)F++;else{if(ie!==!0&&L===s&&(L=V())===s||ie!==!0&&L===o){if(te=R.isBrace=!0,k=R.isGlob=!0,P=!0,S===!0)continue;break}if(L===h&&(F--,F===0)){ie=!1,te=R.isBrace=!0,P=!0;break}}if(S===!0)continue;break}if(L===l){if(C.push(E),w.push(R),R={value:``,depth:0,isGlob:!1},P===!0)continue;if(I===s&&E===D+1){D+=2;continue}O=E+1}else{if(b.noext!==!0&&(L===p||L===i||L===r||L===m||L===c)&&B()===d){if(k=R.isGlob=!0,A=R.isExtglob=!0,P=!0,L===c&&E===D&&(N=!0),S===!0){let e=0;for(;z()!==!0&&(L=V());)if(L===a)j=R.backslashes=!0,V();else if(L===d)e++;else if(L===g&&--e===0){P=!0;break}continue}break}if(L===r){if(I===r&&(re=R.isGlobstar=!0),k=R.isGlob=!0,P=!0,S===!0)continue;break}if(L===m){if(k=R.isGlob=!0,P=!0,S===!0)continue;break}if(L===f){for(;z()!==!0&&(e=V());)if(e===a)j=R.backslashes=!0,V();else if(e===_){ne=R.isBracket=!0,k=R.isGlob=!0,P=!0;break}if(S===!0)continue;break}if(b.nonegate!==!0&&L===c&&E===D)M=R.negated=!0,D++;else{if(b.noparen!==!0&&L===d){if(k=R.isGlob=!0,S===!0){let e=1;for(;z()!==!0&&(L=V());)if(L===a)j=R.backslashes=!0,V();else if(L===d)e++;else if(L===g&&--e===0){P=!0;break}continue}break}if(k===!0){if(P=!0,S===!0)continue;break}}}}}b.noext===!0&&(A=!1,k=!1);let H=T,ae=``,oe=``;D>0&&(ae=T.slice(0,D),T=T.slice(D),O-=D),H&&k===!0&&O>0?(H=T.slice(0,O),oe=T.slice(O)):k===!0?(H=``,oe=T):H=T,H&&H!==``&&H!==`/`&&H!==T&&v(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),b.unescape===!0&&(oe&&=n.removeBackslashes(oe),H&&j===!0&&(H=n.removeBackslashes(H)));let U={prefix:ae,input:e,start:D,base:H,glob:oe,isBrace:te,isBracket:ne,isGlob:k,isExtglob:A,isGlobstar:re,negated:M,negatedExtglob:N};if(b.tokens===!0&&(U.maxDepth=0,v(L)||w.push(R),U.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t===void 0?D:t+1,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&D!==0?(w[n].isPrefix=!0,w[n].value=ae):w[n].value=a,y(w[n]),U.maxDepth+=w[n].depth),i>=D&&(ee.push(a),t=i)}let n=t===void 0?D:t+1,r=e.slice(n);ee.push(r),b.tokens&&t&&t+1<e.length&&(w[w.length-1].value=r,y(w[w.length-1]),U.maxDepth+=w[w.length-1].depth),U.slashes=C,U.parts=ee}return U}})),vn=/* @__PURE__ */ pe(((e,t)=>{let n=hn(),r=gn(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e)if(o===!0)a+=s,o=!1;else if(s===`\\`)a+=s,o=!0;else if(s===`"`)i=i===1?0:1,a+=s;else{if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e)if(t===!0)t=!1;else if(n===`\\`)t=!0;else if(/[?*+@!()[\]{}]/.test(n))return!1;return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(a&&r===a.repeat(r.length)&&i===a.repeat(i.length)&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0)a=!1;else if(s===`\\`)a=!0;else if(s===`"`)i=i===1?0:1;else if(i!==1){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(!(n>0)){if(s===`(`)r++;else if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>`${e.length===1?r.escapeRegex(e[0]):`[${e.map(e=>r.escapeRegex(e)).join(``)}]`}*`,_=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},v=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},y=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of i){let t=_(e);if(t){o=!0,a.push(...t);continue}let n=p(e);if(n&&n.length===1)a.push(n);else if(s=!1,v(e)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:g([...new Set(a)])}:{risky:!0}:{risky:!1}},b=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),v=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:ee,NO_DOT:T,NO_DOT_SLASH:E,NO_DOTS_SLASH:D,QMARK:O,QMARK_NO_DOT:te,STAR:ne,START_ANCHOR:k}=_,A=e=>`(${g}(?:(?!${k}${e.dot?ee:x}).)*?)`,re=d.dot?``:T,ie=d.dot?O:te,j=d.bash===!0?A(d):ne;d.capture&&(j=`(${j})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let M={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,M),p=e.length;let N=[],P=[],F=[],I=m,L,R=()=>M.index===p-1,z=M.peek=(t=1)=>e[M.index+t],B=M.advance=()=>e[++M.index]||``,V=()=>e.slice(M.index+1),H=(e=``,t=0)=>{M.consumed+=e,M.index+=t},ae=e=>{M.output+=e.output==null?e.value:e.output,H(e.value)},oe=()=>{let e=1;for(;z()===`!`&&(z(2)!==`(`||z(3)===`?`);)B(),M.start++,e++;return e%2!=0&&(M.negated=!0,M.start++,!0)},U=e=>{M[e]++,F.push(e)},W=e=>{M[e]--,F.pop()},G=e=>{if(I.type===`globstar`){let t=M.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||N.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(M.output=M.output.slice(0,-I.output.length),I.type=`star`,I.value=`*`,I.output=j,M.output+=I.output)}N.length&&e.type!==`paren`&&(N[N.length-1].inner+=e.value),(e.value||e.output)&&ae(e),I&&I.type===`text`&&e.type===`text`?(I.output=(I.output||I.value)+e.value,I.value+=e.value):(e.prev=I,h.push(e),I=e)},se=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=I,n.parens=M.parens,n.output=M.output,n.startIndex=M.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;U(`parens`),G({type:e,value:t,output:M.output?``:w}),G({type:`paren`,extglob:!0,value:B(),output:r}),N.push(n)},ce=n=>{let i=e.slice(n.startIndex,M.index+1),a=e.slice(n.startIndex+2,M.index),o=y(a,d);if((n.type===`plus`||n.type===`star`)&&o.risky){let e=o.safeOutput?(n.output?``:w)+(d.capture?`(${o.safeOutput})`:o.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;M.output=n.output+t.output,M.backtrack=!0,G({type:`paren`,extglob:!0,value:L,output:``}),W(`parens`);return}let s=n.close+(d.capture?`)`:``),c;if(n.type===`negate`){let e=j;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=A(d)),(e!==j||R()||/^\)+$/.test(V()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=V())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${b(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(M.negatedExtglob=!0)}G({type:`paren`,extglob:!0,value:L,output:s}),W(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?O.repeat(a.length):``):o===0?ie+(a?O.repeat(a.length):``):O.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?j:``):j:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(M.output=e,M):(M.output=r.wrapOutput(i,M,t),M)}for(;!R();){if(L=B(),L===`\0`)continue;if(L===`\\`){let e=z();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){L+=`\\`,G({type:`text`,value:L});continue}let t=/^\\+/.exec(V()),n=0;if(t&&t[0].length>2&&(n=t[0].length,M.index+=n,n%2!=0&&(L+=`\\`)),d.unescape===!0?L=B():L+=B(),M.brackets===0){G({type:`text`,value:L});continue}}if(M.brackets>0&&(L!==`]`||I.value===`[`||I.value===`[^`)){if(d.posix!==!1&&L===`:`){let e=I.value.slice(1);if(e.includes(`[`)&&(I.posix=!0,e.includes(`:`))){let e=I.value.lastIndexOf(`[`),t=I.value.slice(0,e),n=I.value.slice(e+2),r=a[n];if(r){I.value=t+r,M.backtrack=!0,B(),!m.output&&h.indexOf(I)===1&&(m.output=w);continue}}}(L===`[`&&z()!==`:`||L===`-`&&z()===`]`)&&(L=`\\${L}`),L===`]`&&(I.value===`[`||I.value===`[^`)&&(L=`\\${L}`),d.posix===!0&&L===`!`&&I.value===`[`&&(L=`^`),I.value+=L,ae({value:L});continue}if(M.quotes===1&&L!==`"`){L=r.escapeRegex(L),I.value+=L,ae({value:L});continue}if(L===`"`){M.quotes=M.quotes===1?0:1,d.keepQuotes===!0&&G({type:`text`,value:L});continue}if(L===`(`){U(`parens`),G({type:`paren`,value:L});continue}if(L===`)`){if(M.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=N[N.length-1];if(e&&M.parens===e.parens+1){ce(N.pop());continue}G({type:`paren`,value:L,output:M.parens?`)`:`\\)`}),W(`parens`);continue}if(L===`[`){if(d.nobracket===!0||!V().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L=`\\${L}`}else U(`brackets`);G({type:`bracket`,value:L});continue}if(L===`]`){if(d.nobracket===!0||I&&I.type===`bracket`&&I.value.length===1){G({type:`text`,value:L,output:`\\${L}`});continue}if(M.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));G({type:`text`,value:L,output:`\\${L}`});continue}W(`brackets`);let e=I.value.slice(1);if(I.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(L=`/${L}`),I.value+=L,ae({value:L}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(I.value);if(M.output=M.output.slice(0,-I.value.length),d.literalBrackets===!0){M.output+=t,I.value=t;continue}I.value=`(${g}${t}|${I.value})`,M.output+=I.value;continue}if(L===`{`&&d.nobrace!==!0){U(`braces`);let e={type:`brace`,value:L,output:`(`,outputIndex:M.output.length,tokensIndex:M.tokens.length};P.push(e),G(e);continue}if(L===`}`){let e=P[P.length-1];if(d.nobrace===!0||!e){G({type:`text`,value:L,output:L});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),M.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=M.output.slice(0,e.outputIndex),r=M.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,L=t=`\\}`,M.output=n;for(let e of r)M.output+=e.output||e.value}G({type:`brace`,value:L,output:t}),W(`braces`),P.pop();continue}if(L===`|`){N.length>0&&N[N.length-1].conditions++,G({type:`text`,value:L});continue}if(L===`,`){let e=L,t=P[P.length-1];t&&F[F.length-1]===`braces`&&(t.comma=!0,e=`|`),G({type:`comma`,value:L,output:e});continue}if(L===`/`){if(I.type===`dot`&&M.index===M.start+1){M.start=M.index+1,M.consumed=``,M.output=``,h.pop(),I=m;continue}G({type:`slash`,value:L,output:C});continue}if(L===`.`){if(M.braces>0&&I.type===`dot`){I.value===`.`&&(I.output=x);let e=P[P.length-1];I.type=`dots`,I.output+=L,I.value+=L,e.dots=!0;continue}if(M.braces+M.parens===0&&I.type!==`bos`&&I.type!==`slash`){G({type:`text`,value:L,output:x});continue}G({type:`dot`,value:L,output:x});continue}if(L===`?`){if(!(I&&I.value===`(`)&&d.noextglob!==!0&&z()===`(`&&z(2)!==`?`){se(`qmark`,L);continue}if(I&&I.type===`paren`){let e=z(),t=L;(I.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(V()))&&(t=`\\${L}`),G({type:`text`,value:L,output:t});continue}if(d.dot!==!0&&(I.type===`slash`||I.type===`bos`)){G({type:`qmark`,value:L,output:te});continue}G({type:`qmark`,value:L,output:O});continue}if(L===`!`){if(d.noextglob!==!0&&z()===`(`&&(z(2)!==`?`||!/[!=<:]/.test(z(3)))){se(`negate`,L);continue}if(d.nonegate!==!0&&M.index===0){oe();continue}}if(L===`+`){if(d.noextglob!==!0&&z()===`(`&&z(2)!==`?`){se(`plus`,L);continue}if(I&&I.value===`(`||d.regex===!1){G({type:`plus`,value:L,output:S});continue}if(I&&(I.type===`bracket`||I.type===`paren`||I.type===`brace`)||M.parens>0){G({type:`plus`,value:L});continue}G({type:`plus`,value:S});continue}if(L===`@`){if(d.noextglob!==!0&&z()===`(`&&z(2)!==`?`){G({type:`at`,extglob:!0,value:L,output:``});continue}G({type:`text`,value:L});continue}if(L!==`*`){(L===`$`||L===`^`)&&(L=`\\${L}`);let e=o.exec(V());e&&(L+=e[0],M.index+=e[0].length),G({type:`text`,value:L});continue}if(I&&(I.type===`globstar`||I.star===!0)){I.type=`star`,I.star=!0,I.value+=L,I.output=j,M.backtrack=!0,M.globstar=!0,H(L);continue}let t=V();if(d.noextglob!==!0&&/^\([^?]/.test(t)){se(`star`,L);continue}if(I.type===`star`){if(d.noglobstar===!0){H(L);continue}let n=I.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){G({type:`star`,value:L,output:``});continue}let o=M.braces>0&&(n.type===`comma`||n.type===`brace`),s=N.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){G({type:`star`,value:L,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[M.index+4];if(n&&n!==`/`)break;t=t.slice(3),H(`/**`,3)}let c=R()||M.parens>0&&t===`)`.repeat(M.parens)&&!N.some(e=>e.type===`negate`);if(n.type===`bos`&&R()){I.type=`globstar`,I.value+=L,I.output=A(d),M.output=I.output,M.globstar=!0,H(L);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&c){M.output=M.output.slice(0,-(n.output+I.output).length),n.output=`(?:${n.output}`,I.type=`globstar`,I.output=A(d)+(d.strictSlashes?`)`:`|$)`),I.value+=L,M.globstar=!0,M.output+=n.output+I.output,H(L);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;M.output=M.output.slice(0,-(n.output+I.output).length),n.output=`(?:${n.output}`,I.type=`globstar`,I.output=`${A(d)}${C}|${C}${e})`,I.value+=L,M.output+=n.output+I.output,M.globstar=!0,H(L+B()),G({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){I.type=`globstar`,I.value+=L,I.output=`(?:^|${C}|${A(d)}${C})`,M.output=I.output,M.globstar=!0,H(L+B()),G({type:`slash`,value:`/`,output:``});continue}M.output=M.output.slice(0,-I.output.length),I.type=`globstar`,I.output=A(d),I.value+=L,M.output+=I.output,M.globstar=!0,H(L);continue}let n={type:`star`,value:L,output:j};d.bash===!0?(n.output=`.*?`,(I.type===`bos`||I.type===`slash`)&&(n.output=re+n.output),G(n)):I&&(I.type===`bracket`||I.type===`paren`)&&d.regex===!0?(n.output=L,G(n)):((M.index===M.start||I.type===`slash`||I.type===`dot`)&&(I.type===`dot`?(M.output+=E,I.output+=E):d.dot===!0?(M.output+=D,I.output+=D):(M.output+=re,I.output+=re),z()!==`*`&&(M.output+=w,I.output+=w)),G(n))}for(;M.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));M.output=r.escapeLast(M.output,`[`),W(`brackets`)}for(;M.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));M.output=r.escapeLast(M.output,`(`),W(`parens`)}for(;M.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));M.output=r.escapeLast(M.output,`{`),W(`braces`)}if(d.strictSlashes!==!0&&(I.type===`star`||I.type===`bracket`)&&G({type:`maybe_slash`,value:``,output:`${C}?`}),M.backtrack===!0){M.output=``;for(let e of M.tokens)M.output+=e.output==null?e.value:e.output,e.suffix&&(M.output+=e.suffix)}return M};b.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},ee=w(r.removePrefix(e,x));return ee&&a.strictSlashes!==!0&&(ee+=`${u}?`),ee},t.exports=b})),yn=/* @__PURE__ */ pe(((e,t)=>{let n=_n(),r=vn(),i=gn(),a=hn(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),!r||p)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e,{windows:r})),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),bn=/* @__PURE__ */ he((/* @__PURE__ */ pe(((e,t)=>{let n=yn(),r=gn();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})))(),1);const xn=Array.isArray,Sn=/\\/g,Cn=/^[A-Za-z]:$/,wn=process.platform===`win32`,Tn=/^(\/?\.\.)+$/;function En(e,t={}){let n=e.length,r=Array(n),i=Array(n),a,o;for(a=0;a<n;a++){let n=Nn(e[a]);r[a]=n;let s=n.length,c=Array(s);for(o=0;o<s;o++)c[o]=(0,bn.default)(n[o],t);i[a]=c}return e=>{let s=e.split(`/`);if(s[0]===`..`&&Tn.test(e))return!0;for(a=0;a<n;a++){let e=r[a],n=i[a],c=s.length,l=Math.min(c,e.length);for(o=0;o<l;){let r=e[o];if(r.includes(`/`))return!0;if(!n[o](s[o]))break;if(!t.noglobstar&&r===`**`)return!0;o++}if(o===c)return!0}return!1}}
|
|
179
|
-
/* node:coverage ignore next 2 */
|
|
180
|
-
const Dn=/^[A-Z]:\/$/i,On=wn?e=>Dn.test(e):e=>e===`/`;function kn(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=e.length+ +!On(e);return(e,n)=>e.slice(t,n?-1:void 0)||`.`}let r=t.slice(e.length+1);return r?(e,t)=>{if(e===`.`)return r;let n=`${r}/${e}`;return t?n.slice(0,-1):n}:(e,t)=>t&&e!==`.`?e.slice(0,-1):e}return n?t=>H.relative(e,t)||`.`:n=>H.relative(e,`${t}/${n}`)||`.`}function An(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=H.relative(e,`${t}/${n}`);return n[n.length-1]===`/`&&r!==``?`${r}/`:r||`.`}}function jn(e){return e.replace(Cn,e=>`${e}/`)}const Mn={parts:!0};function Nn(e){let t=bn.default.scan(e,Mn);return t.parts?.length?t.parts:[e]}const Pn=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Fn=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,In=wn?e=>e.replace(Fn,`\\$&`):e=>e.replace(Pn,`\\$&`);function Ln(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=bn.default.scan(e);return n.isGlob||n.negated}function Rn(...e){console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString(`es`)}]`,...e)}function zn(e){return typeof e==`string`?[e]:e??[]}const Bn=/^(\/?\.\.)+/,Vn=/\\(?=[()[\]{}!*+?@|])/g;function Hn(e,t,n,r){let i=t.cwd,a=e;e[e.length-1]===`/`&&(a=e.slice(0,-1)),a[a.length-1]!==`*`&&t.expandDirectories&&(a+=`/**`);let o=In(i);a=B(a.replace(Vn,``))?H.relative(o,a):H.normalize(a);let s=Bn.exec(a)?.[0],c=Nn(a);if(s){let e=(s.length+1)/3,t=0,r=o.split(`/`);for(;t<e&&c[t+e]===r[r.length+t-e];)a=a.slice(0,(e-t-1)*3)+a.slice((e-t)*3+c[t+e].length+1)||`.`,t++;let l=H.join(i,s.slice(t*3));l[0]!==`.`&&n.root.length>l.length&&(n.root=jn(l),n.depthOffset=-e+t)}if(!r&&n.depthOffset>=0){n.commonPath??=c;let e=[],t=Math.min(n.commonPath.length,c.length);for(let r=0;r<t;r++){let t=c[r];if(t===`**`&&!c[r+1]){e.pop();break}if(r===c.length-1||t!==n.commonPath[r]||Ln(t))break;e.push(t)}n.depthOffset=e.length,n.commonPath=e,n.root=jn(e.length>0?H.join(i,...e):i)}return a}function Un(e,t,n){let r=[],i=[];for(let t of e.ignore)t&&(t[0]!==`!`||t[1]===`(`)&&i.push(Hn(t,e,n,!0));for(let a of t)a&&(a[0]!==`!`||a[1]===`(`?r.push(Hn(a,e,n,!1)):(a[1]!==`!`||a[2]===`(`)&&i.push(Hn(a.slice(1),e,n,!0)));return{match:r,ignore:i}}function Wn(e,t){let n=e.cwd,r={root:n,depthOffset:0},i=Un(e,t,r);e.debug&&Rn(`internal processing patterns:`,i);let{absolute:a,caseSensitiveMatch:o,debug:s,dot:c,followSymbolicLinks:l,onlyDirectories:u}=e,d=r.root.replace(Sn,``),f={dot:c,nobrace:e.braceExpansion===!1,nocase:!o,noextglob:e.extglob===!1,noglobstar:e.globstar===!1,posix:!0},p=(0,bn.default)(i.match,f),m=(0,bn.default)(i.ignore,f),h=En(i.match,f),g=kn(n,d,a),_=a?g:kn(n,d,!0),v=(e,t)=>{let n=_(t,!0);return n!==`.`&&!h(n)||m(n)},y;e.deep!==void 0&&(y=Math.round(e.deep-r.depthOffset));let b=new mn({filters:[s?(e,t)=>{let n=g(e,t),r=p(n)&&!m(n);return r&&Rn(`matched ${n}`),r}:(e,t)=>{let n=g(e,t);return p(n)&&!m(n)}],exclude:s?(e,t)=>{let n=v(e,t);return Rn(`${n?`skipped`:`crawling`} ${t}`),n}:v,fs:e.fs,pathSeparator:`/`,relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!e.onlyFiles,maxDepth:y,signal:e.signal}).crawl(d);return e.debug&&Rn(`internal properties:`,{...r,root:d}),[b,n!==d&&!a&&An(n,d)]}function Gn(e,t){if(t)for(let n=e.length-1;n>=0;n--)e[n]=t(e[n]);return e}const Kn={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function qn(e){let t=Object.assign({},e);for(let e in Kn)t[e]===void 0&&Object.assign(t,{[e]:Kn[e]});return t.cwd=(t.cwd instanceof URL?W(t.cwd):oe(t.cwd||process.cwd())).replace(Sn,`/`),t.ignore=zn(t.ignore),t.fs&&={readdir:t.fs.readdir||M,readdirSync:t.fs.readdirSync||N,realpath:t.fs.realpath||P,realpathSync:t.fs.realpathSync||F,stat:t.fs.stat||I,statSync:t.fs.statSync||L},t.debug&&Rn(`globbing with options:`,t),t}function Jn(e,t={}){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=xn(e)||typeof e==`string`,r=zn((n?e:e.patterns)??`**/*`),i=qn(n?t:e);return r.length>0?Wn(i,r):[]}async function Yn(e,t){let[n,r]=Jn(e,t);return n?Gn(await n.withPromise(),r):[]}const Xn=Ve.withOptions({alignValues:!0});function Zn(e,...t){if(typeof e==`string`)return Xn(e);let n=Array.from(e);return Xn(Object.assign(n,{raw:n}),...t)}function Qn(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}function $n(e,t){let n=t?.headers?[t.headers,...e]:e,r=[];for(let e of n)for(let t=0;t<e.length;t++)r[t]=Math.max(r[t]??0,e[t].length);return n.map(e=>e.map((t,n)=>n<e.length-1?t.padEnd(r[n]):t).join(` `).trimEnd()).join(`
|
|
181
|
-
`)}const er=e()!==void 0,tr={"user-intent":{type:`string`,description:`The user's overall task in one short US English sentence. Paraphrase their original request, not what this command does. Pass the same value on every command for the same task. Analytics only — no effect on behavior.`},"task-id":{type:`string`,description:"Groups the commands of one user request. One id covers the whole request, not one per command: a slice's create, field and push commands share it. Run `prismic task-id` when the user asks for something new. Analytics only — no effect on behavior."},"analytics-intent":{type:`string`,hidden:!0,description:`Renamed to --user-intent.`},"analytics-task-id":{type:`string`,hidden:!0,description:`Renamed to --task-id.`}};function nr(e,t){return async function(){let{positionals:n={},options:r={}}=e,i;try{i=T({args:process.argv.slice(1+e.name.split(` `).length),options:{...r,...tr,help:{type:`boolean`,short:`h`}},allowPositionals:Object.keys(n).length>0,strict:!0})}catch(e){throw e instanceof TypeError&&`code`in e&&typeof e.code==`string`&&e.code.startsWith(`ERR_PARSE_ARGS_`)?new X(e.message):e}if(i.values.help){let t=Object.keys(n),i={USAGE:` ${[e.name,...t.map(e=>`<${e}>`),`[options]`].join(` `)}`};t.length>0&&(i.ARGUMENTS=$n(Object.entries(n).map(([e,t])=>[` <${e}>`,t.description+(t.required?` (required)`:``)]))),i.OPTIONS=$n(ir(r)),console.info(ar(e.description,i,e.name.split(` `)[0],e.sections))}else{for(let[e,[t,r]]of Object.entries(n).entries())if(r.required&&!i.positionals[e])throw new X(`Missing required argument: <${t}>`);for(let[e,t]of Object.entries(r)){if(t.required&&!(e in i.values))throw new X(`Missing required option: --${e}`);if(e in i.values&&(t.deprecated&&console.warn(`--${e} is deprecated. ${t.deprecated}`),t.dependsOn&&!(t.dependsOn in i.values)))throw new X(`--${e} can only be used with --${t.dependsOn}.`)}await t(i)}}}function rr(e){return async function(){let{positionals:[t]}=T({args:process.argv.slice(1+e.name.split(` `).length),options:{...tr,help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});if(t){let n=e.commands[t];if(!n)throw new X(`Unknown command: ${t}`);await n.handler();return}let n={USAGE:` ${e.name} <command> [options]`,COMMANDS:$n(Object.entries(e.commands).filter(([,e])=>!e.hidden).map(([e,t])=>[` ${e}`,t.description])),OPTIONS:$n(ir({}))},r=er?{...e.sections,AGENTS:`
|
|
182
|
-
--task-id and --user-intent group the commands of one user request together.
|
|
183
|
-
Run \`prismic task-id\` when the user asks for something, then pass that id on
|
|
184
|
-
every command until they ask for something else — creating a slice, adding its
|
|
185
|
-
fields and pushing them are one request, and the next slice is another. Pass
|
|
186
|
-
what the user asked for as --user-intent. Analytics only — no effect on behavior.
|
|
187
|
-
`}:e.sections;console.info(ar(e.description,n,e.name,r))}}function ir(e){let t=er?{...e,...tr}:e,n=[];for(let[e,r]of Object.entries(t)){if(r.deprecated||r.hidden)continue;let t=r.short?`-${r.short}, `:` `,i=r.type===`string`?` string`:``,a=r.description+(r.required?` (required)`:``);n.push([` ${t}--${e}${i}`,a])}return n.push([` -h, --help`,`Show help for command`]),n}function ar(e,t,n,r={}){let i=[Zn(e)];for(let[e,n]of Object.entries(t))i.push(``,e,n);for(let[e,t]of Object.entries(r))i.push(``,e,...Zn(t).split(`
|
|
188
|
-
`).map(e=>e?` ${e}`:``));return i.push(``,`LEARN MORE`,` Use \`${n} <command> --help\` for more information about a command.`),i.join(`
|
|
189
|
-
`)}function or(e,t){let n=t.filter(t=>t in e),r=t.map(e=>`--${String(e)}`).join(` or `);if(n.length>1)throw new X(`Only one of ${r} can be specified.`);if(n.length===0)throw new X(`Specify one of ${r}.`);return{key:n[0],value:e[n[0]]}}function sr(e,t){let n=t.filter(t=>t in e),r=t.map(e=>`--${String(e)}`).join(` or `);if(n.length>1)throw new X(`Only one of ${r} can be specified.`)}var X=class extends Error{name=`CommandError`};const cr=o({id:i(),label:i(),url:i()}),lr=o({results:b(cr)});async function ur(e){let{repo:t,host:n}=e;return(await Z(new URL(`core/repository/preview_configs`,Q(t,n)),e,{schema:lr,unknownErrorMessage:`Failed to load previews`})).results}async function dr(e,t){let{repo:n,host:r}=t;await Z(new URL(`previews/new`,Q(n,r)),t,{method:`POST`,json:{name:e.name,websiteURL:e.websiteURL,resolverPath:e.resolverPath},unknownErrorMessage:`Failed to add preview`})}async function fr(e,t){let{repo:n,host:r}=t;await Z(new URL(`previews/delete/${encodeURIComponent(e)}`,Q(n,r)),t,{method:`POST`,json:{},notFoundMessage:`Preview not found: ${e}`,unknownErrorMessage:`Failed to remove preview`})}const pr=o({kind:n([`prod`,`stage`,`dev`]),name:i(),domain:i(),users:b(o({id:i()}))});async function mr(e){let{repo:t,host:n}=e;return(await Z(new URL(`core/environments`,Q(t,n)),e,{schema:o({results:b(pr)})})).results}const hr=o({simulator_url:s(i())});async function gr(e){let{repo:t,host:n}=e;return(await Z(new URL(`core/repository`,Q(t,n)),e,{schema:hr,unknownErrorMessage:`Failed to load simulator URL`})).simulator_url}async function _r(e,t){let{repo:n,host:r}=t;await Z(new URL(`core/repository`,Q(n,r)),t,{method:`PATCH`,json:{simulator_url:e},unknownErrorMessage:`Failed to set simulator URL`})}const vr=o({total:a()});async function yr(e,t){let{repo:n,host:r}=t;return(await Z(new URL(`core/documents/search`,Q(n,r)),t,{method:`POST`,json:{customTypes:[e],limit:0},schema:vr})).total}async function br(e,t){let{repo:n,host:r}=t;return(await Z(new URL(`core/releases`,Q(n,r)),t,{method:`POST`,json:e,schema:m({id:i()}),unknownErrorMessage:`Failed to create a release`})).id}async function xr(e,t){let{repo:n,host:r}=t;await Z(new URL(`core/releases/${encodeURIComponent(e)}`,Q(n,r)),t,{method:`DELETE`,notFoundMessage:`Release not found: ${e}`,unknownErrorMessage:`Failed to delete the release`})}function Z(e,t,n={}){return _(e,{credentials:{"prismic-auth":t.token},notFoundMessage:`Repository not found: ${t.repo}`,...n})}function Q(e,t){return new URL(`https://${e}.${t}/`)}function Sr(e,t,n){let{getKey:r,equals:i=(e,t)=>JSON.stringify(e)===JSON.stringify(t)}=n,a={insert:[],update:[],delete:[]};for(let n of e){let e=t.find(e=>r(e)===r(n));e?i(n,e)||a.update.push(n):a.insert.push(n)}for(let n of t)e.some(e=>r(e)===r(n))||a.delete.push(n);return a}function Cr(e){return e.insert.length+e.update.length+e.delete.length>0}function wr(e){return Mr(new URL(`customtypes`,Pr(e.host)),e)}function Tr(e){return Mr(new URL(`slices`,Pr(e.host)),e)}async function Er(e,t){await Mr(new URL(`bulk-update`,Pr(t.host)),t,{method:`POST`,json:{changes:e},unknownErrorMessage:`Failed to update models`})}const Dr=o({values:o({url:i(),fields:r(i(),i())}),imgixEndpoint:i()}),Or={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`};async function kr(e,t){await Nr(new URL(`delete`,Fr(t.host)),t,{method:`POST`,json:{sliceId:e}})}async function Ar(e,t){let{sliceId:n,variationId:r,repo:i,host:a}=t,o=e.type;if(!(o in Or))throw new jr(o);let s=await Nr(new URL(`presigned-url`,Fr(a)),t,{schema:Dr}),c=Or[o],l=`${i}/shared-slices/${n}/${r}/${ie(`sha1`).update(new Uint8Array(await e.arrayBuffer())).digest(`hex`)}${c}`,u=new FormData;for(let[e,t]of Object.entries(s.values.fields))u.append(e,t);u.set(`key`,l),u.set(`Content-Type`,o),u.set(`file`,e),await _(s.values.url,{method:`POST`,body:u});let d=new URL(l,y(s.imgixEndpoint));return d.searchParams.set(`auto`,`compress,format`),d}var jr=class extends Error{name=`UnsupportedFileTypeError`;constructor(e){let t=Object.keys(Or);super(`Unsupported file type: ${e||`unknown`}. Supported: ${t.join(`, `)}`)}};function Mr(e,t,n={}){return t.releaseId&&e.searchParams.set(`release`,t.releaseId),_(e,{headers:{repository:t.repo,Authorization:`Bearer ${t.token}`},notFoundMessage:`Repository not found: ${t.repo}`,...n})}function Nr(e,t,n={}){let r=new URL(e);return r.searchParams.set(`repository`,t.repo),_(r,{headers:{repository:t.repo,Authorization:`Bearer ${t.token}`},...n})}function Pr(e){return new URL(`https://customtypes.${e}/`)}function Fr(e){return new URL(`https://api.internal.${e}/screenshot/`)}const Ir=[`Slices`,`UID`,`Choice`];function Lr(e,t,n){if(t in e)throw new Qr(t);e[t]=n}function Rr(e,t){let n=e[t];if(!n)throw new $r(t);return n}function zr(e,t,n){let r=new Map(n.map(e=>[e.id,e])),i=r.get(t);if(!i)throw new $(`Custom type "${t}" does not exist.`);let a=(e,t,n,i)=>{let o=/* @__PURE__ */ new Map;for(let t of e){let[e,...n]=t.split(`.`),r=o.get(e)??[];r.push(n.join(`.`)),o.set(e,r)}return Array.from(o,([e,o])=>{let s=t[e];if(!s)throw new $(`Field "${e}" does not exist on type "${n}".`);let c=o.filter(Boolean);if(c.length===0){if(Ir.includes(s.type)||e===`uid`)throw new $(`Field "${e}" cannot be fetched from a content relationship.`);if(s.type===`Group`)throw new $(`Field "${e}" is a group. Select specific subfields.`);return e}if(c.length!==o.length)throw new $(`Field "${e}" cannot be selected both directly and through its subfields.`);if(s.type===`Group`)return{id:e,fields:a(c,s.config?.fields??{},n,i)};if(s.type===`Link`&&s.config?.select===`document`){if(!i)throw new $(`Content relationships cannot be nested more than once.`);let t=s.config?.customtypes;if(!t||t.length!==1)throw new $(`Field "${e}" must target exactly one custom type to select its fields.`);let n=typeof t[0]==`string`?t[0]:t[0].id,o=r.get(n);if(!o)throw new $(`Custom type "${n}" does not exist.`);let l=Object.assign({},...Object.values(o.json));return{id:e,customtypes:[{id:n,fields:a(c,l,n,!1)}]}}throw new $(`Field "${e}" is not a group or content relationship field.`)})};return a(e,Object.assign({},...Object.values(i.json)),i.id,!0)}function Br(e,t,n){let r;if(n){if(r=t.json[n],!r)throw new ti(n,t.id)}else{let[n]=e.split(`.`);if(r=Object.values(t.json).find(e=>n in e),!r)throw new $r(n)}return Xr(e,r)}function Vr(e,t,n){let r=t.variations.find(e=>e.id===n);if(!r)throw new ni(n,t.id);return r.primary??={},Xr(e,r.primary)}async function Hr(e){let[t,n]=await Promise.all([wr(e),Tr(e)]);return{customTypes:t,slices:n}}async function Ur({customTypes:e,slices:t},n){let r=(e,t)=>({type:e,id:t.id,payload:t}),i=[...e.insert.map(e=>r(`CUSTOM_TYPE_INSERT`,e)),...e.update.map(e=>r(`CUSTOM_TYPE_UPDATE`,e)),...e.delete.map(({id:e})=>r(`CUSTOM_TYPE_DELETE`,{id:e})),...t.insert.map(e=>r(`SLICE_INSERT`,e)),...t.update.map(e=>r(`SLICE_UPDATE`,e)),...t.delete.map(({id:e})=>r(`SLICE_DELETE`,{id:e}))];i.length>0&&await Er(i,n)}function Wr(e,t,n={}){let{treatNonCanonicalAsChanged:r=!1}=n;return{customTypes:Sr(e.customTypes,t.customTypes,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(Gr(e))===JSON.stringify(r?t:Gr(t))}),slices:Sr(e.slices,t.slices,{getKey:e=>e.id,equals:(e,t)=>JSON.stringify(Kr(e))===JSON.stringify(r?t:Kr(t))})}}function Gr(e){return{...Yr(e),json:Object.fromEntries(Object.entries(e.json).map(([e,t])=>[e,qr(t)]))}}function Kr(e){return{...Yr(e),variations:e.variations.map(e=>{let t=Yr(e);return e.primary&&(t.primary=qr(e.primary)),e.items&&(t.items=qr(e.items)),t})}}function qr(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=Yr(t);return t.type===`Group`&&t.config?.fields&&n.type===`Group`&&n.config?.fields&&(n.config.fields=qr(t.config.fields)),t.type===`Slices`&&t.config?.choices&&n.type===`Slices`&&n.config?.choices&&(n.config.choices=Jr(t.config.choices)),[e,n]}))}function Jr(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=Yr(t);return t.type===`Slice`&&n.type===`Slice`&&(t[`non-repeat`]&&(n[`non-repeat`]=qr(t[`non-repeat`])),t.repeat&&(n.repeat=qr(t.repeat))),[e,n]}))}function Yr(e){return Array.isArray(e)?e.map(Yr):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,Yr(t)]))}function Xr(e,t){let[n,...r]=e.split(`.`);if(r.length===0)return{fields:t,fieldId:n};let i=Rr(t,n);if(i.type!==`Group`)throw new ei(n);return i.config??={},i.config.fields??={},Xr(r.join(`.`),i.config.fields)}function Zr(e){return e.flatMap(e=>Object.values(e.json).flatMap(t=>Object.entries(t).flatMap(([t,n])=>n.type===`Slices`?Object.entries(n.config?.choices??{}).flatMap(([r,i])=>i.type===`SharedSlice`?[]:[{id:r,customTypeId:e.id,sliceZoneId:t,sliceZone:n,model:i}]):[])))}var Qr=class extends Error{name=`FieldExistsError`;constructor(e){super(`Field "${e}" already exists.`)}},$r=class extends Error{name=`FieldNotFoundError`;constructor(e){super(`Field "${e}" does not exist.`)}},ei=class extends Error{name=`UnsupportedNestedFieldError`;constructor(e){super(`Field "${e}" does not support nested fields.`)}},$=class extends Error{name=`FieldSelectionError`},ti=class extends Error{name=`TabNotFoundError`;constructor(e,t){super(`Tab "${e}" does not exist on type "${t}".`)}},ni=class extends Error{name=`SliceVariationNotFoundError`;constructor(e,t){super(`Variation "${e}" does not exist on slice "${t}".`)}};const ri=`prismic.config.json`,ii=o({type:i(),path:i(),uid:s(i()),lang:s(i()),resolvers:s(r(i(),i()))}),ai=o({repositoryName:i(),documentAPIEndpoint:s(x()),libraries:s(b(i())),routes:s(b(ii))});async function oi(e){let t=await fi();return await te(t,u(e)),t}async function si(){let e=await ui();try{return await f(e,{schema:ai})}catch{throw new ci}}var ci=class extends Error{name=`InvalidPrismicConfigError`;message=`${ri} is invalid. Run \`prismic init\` to re-create a config.`};async function li(e){let t=await ui(),n={...await si(),...e};return await te(t,u(n)),n}async function ui(){let e=await v(ri,{stop:`package.json`});if(!e)throw new di;return e}var di=class extends Error{name=`MissingPrismicConfigError`;message=`Could not find a ${ri} file. Run \`prismic init\` to create a config.`};async function fi(){try{let e=await w();return new URL(ri,e)}catch(e){throw e instanceof ee?new pi({cause:e}):e}}var pi=class extends Error{name=`UnknownProjectRootError`;constructor(e){super(`Could not find your project root.`,e)}};async function mi(e){let{routes:t=[]}=await si();if(t.some(t=>t.type===e.id))return;let n=vi(e),r={type:e.id,path:n};await li({routes:[...t,r].sort((e,t)=>e.type.localeCompare(t.type))})}async function hi(e){e.format===`page`?await mi(e):await gi(e.id)}async function gi(e){let{routes:t=[]}=await si(),n=t.filter(t=>t.type!==e);t.length!==n.length&&await li({routes:n})}function _i(e,t){return e.find(e=>e.type===t&&!e.uid&&!/[?*+]/.test(e.path))}function vi(e){let{id:t,repeatable:n}=e,r=t.replaceAll(`_`,`-`).toLowerCase();return n?t===`page`?`/:uid`:`/${r}/:uid`:t===`homepage`?`/`:`/${r}`}const yi=`slicemachine.config.json`,bi=o({repositoryName:i(),libraries:s(b(i()))});async function xi(){let e=await wi();try{return await f(e,{schema:bi})}catch{throw new Si}}var Si=class extends Error{name=`InvalidLegacySliceMachineConfigError`;message=`${yi} is invalid.`};async function Ci(){let e=await wi();await O(e)}async function wi(){let e=await v(yi,{stop:`package.json`});if(!e)throw new Ti;return e}var Ti=class extends Error{name=`MissingLegacySliceMachineConfigError`;message=`Could not find a ${yi} file.`};async function Ei(){let e;try{e=await ui()}catch(t){if(t instanceof di)e=await fi();else throw t}let t=new URL(`.`,e);return y(A(await D(k(t))))}async function Di(){try{return(await si()).repositoryName}catch(e){if(e instanceof di)try{return(await xi()).repositoryName}catch{}throw e}}async function Oi(){let e=(await si()).libraries;if(!e||e.length<1)return;let t=await Ei();return e.map(e=>y(new URL(e.replace(/^\//,``),t)))}async function ki(){let e=await Ei();return h(new URL(`tsconfig.json`,e))}const Ai=[`next`,`nuxt`,`sveltekit`];async function ji(){let{dependencies:e,devDependencies:t,peerDependencies:n}=await C(),r={...e,...t,...n};if(`next`in r){let{NextJsAdapter:e}=await import(`./nextjs-C5Tecr6K.mjs`);return new e}if(`nuxt`in r){let{NuxtAdapter:e}=await import(`./nuxt-Dv-vPR1I.mjs`);return new e}if(`@sveltejs/kit`in r){if(await S(`@sveltejs/kit`)<3){let{SvelteKit2Adapter:e}=await import(`./sveltekit2-C_afy31M.mjs`);return new e}let{SvelteKitAdapter:e}=await import(`./sveltekit-DJ5rpjcZ.mjs`);return new e}throw new Mi}var Mi=class extends Error{name=`NoSupportedFrameworkError`;message=`No supported framework found. Run this command in a Next.js, Nuxt, or SvelteKit project.`},Ni=class extends Error{name=`ModelExistsError`},Pi=class extends Error{name=`SliceNotFoundError`;constructor(e){super(`Slice "${e}" does not exist. Run \`prismic slice list\` to see available IDs.`)}},Fi=class extends Error{name=`CustomTypeNotFoundError`;constructor(e){super(`Type "${e}" does not exist. Run \`prismic type list\` to see available IDs.`)}};async function Ii(e,t,n,r){let i=r.find(e=>e.model.id===t||e.directory.href===n.href);if(!i&&!await h(n))return;let a=l(await Ei(),i?.directory??n),o=i?` (id: ${i.model.id})`:``;throw new Ni(`A ${e} already exists at ${a}${ne}${o}.`)}async function Li(){return await(await ji()).getEnvironment()??await Di()}async function Ri(e){let t=await Yn(`**/*.{js,jsx,mjs,ts,tsx,mts,svelte}`,{cwd:k(await Ei()),absolute:!0,ignore:`**/{node_modules,build,dist,out}/**`});for(let n of t)try{if((await E(n,`utf8`)).includes(e))return!0}catch{}return!1}async function zi(e,t){await h(e)||await c(e,t)}async function Bi(){return await ki()?`ts`:`js`}var Vi=class{get localPreviewUrl(){return new URL(this.localPreviewConfig.resolverPath,this.localPreviewConfig.websiteURL).href}get localSimulatorUrl(){return new URL(`slice-simulator`,this.localPreviewConfig.websiteURL).href}async initProject({setup:e}){for(let e of await this.getSliceLibraries())await this.createSliceIndexFile(e);e&&await this.setupProject();let n={repo:await Di(),...await t()};await gr(n)||await _r(this.localSimulatorUrl,n),(await ur(n)).length===0&&await dr(this.localPreviewConfig,n)}async getSliceLibraries(){return await Oi()??[await this.getDefaultSliceLibrary()]}async getSlices(){return Ui(await this.getSliceLibraries(),`*/model.json`)}async getSlice(e){let t=(await this.getSlices()).find(t=>t.model.id===e);if(t)return t;let n=Zr((await this.getCustomTypes()).map(e=>e.model)).find(t=>t.id===e);if(n){let{customTypeId:t,sliceZoneId:r}=n;throw new X(`"${e}" is a legacy slice in "${t}". Upgrade it first: \`prismic slice upgrade-legacy ${e} --from ${t}${r===`body`?``:` --slice-zone ${r}`}\`.`)}throw new Pi(e)}async createSlice(e){let[t]=await this.getSliceLibraries(),n=y(new URL(Te(e.name),y(t)));await Ii(`slice`,e.id,n,await this.getSlices()),await c(new URL(`model.json`,n),u(Kr(e))),await this.createSliceIndexFile(t),await this.createSliceComponent(e,n)}async updateSlice(e){let t=await this.getSlice(e.id);await c(t.modelPath,u(Kr(e))),await this.createSliceIndexFile(t.library)}async deleteSlice(e){let t=await this.getSlice(e);await O(t.directory,{recursive:!0}),await this.createSliceIndexFile(t.library)}async getCustomTypeLibraries(){return[new URL(`customtypes/`,await Ei())]}async getCustomTypes(){return Ui(await this.getCustomTypeLibraries(),`*/index.json`)}async getCustomType(e){let t=(await this.getCustomTypes()).find(t=>t.model.id===e);if(!t)throw new Fi(e);return t}async createCustomType(e){let[t]=await this.getCustomTypeLibraries(),n=y(new URL(e.id,y(t)));if(await Ii(`type`,e.id,n,await this.getCustomTypes()),await c(new URL(`index.json`,n),u(Gr(e))),e.format!==`page`)return[];await mi(e);let r=await Ei();return(await this.writePageFiles(e)).map(({path:t})=>`Skipped ${l(r,t)} (already exists). Run \`prismic gen page ${e.id}\` to get the code.`)}async writePageFiles(e){let{routes:t=[]}=await si(),n=(_i(t,e.id)?.path??vi(e)).split(`/`).filter(Boolean).map(e=>e.startsWith(`:`)?`[${e.slice(1)}]`:e).join(`/`),r=[];for(let t of await this.getPageFiles(e,n))await h(t.path)?r.push(t):await c(t.path,t.contents);return r}async updateCustomType(e){let t=await this.getCustomType(e.id);await c(t.modelPath,u(Gr(e))),await hi(e)}async deleteCustomType(e){let t=await this.getCustomType(e);await O(t.directory,{recursive:!0}),await gi(e)}async getModels(){let[e,t]=await Promise.all([this.getCustomTypes(),this.getSlices()]);return{customTypes:e.map(e=>e.model),slices:t.map(e=>e.model)}}async writeModels(e){for(let t of e.slices.update)await this.updateSlice(t);for(let t of e.slices.delete)await this.deleteSlice(t.id);for(let t of e.slices.insert)await this.createSlice(t);for(let t of e.customTypes.update)await this.updateCustomType(t);for(let t of e.customTypes.delete)await this.deleteCustomType(t.id);let t=[];for(let n of e.customTypes.insert)t.push(...await this.createCustomType(n));return t}async generateTypes(){let e=new URL(`prismicio-types.d.ts`,await Ei()),t=ct({customTypeModels:(await this.getCustomTypes()).map(({model:e})=>({...e,label:e.label??null})),sharedSliceModels:(await this.getSlices()).map(e=>e.model),clientIntegration:{includeContentNamespace:!0,includeCreateClientInterface:!0},cache:!0,typesProvider:`@prismicio/client`});return await c(e,t),e}async getEnvironment(){let e=await Hi();if(await h(e))return(await d(e))[this.environmentEnvVarName]||void 0}async setEnvironment(e){await g(await Hi(),this.environmentEnvVarName,e)}async unsetEnvironment(){await p(await Hi(),this.environmentEnvVarName)}};async function Hi(){return new URL(`.env.local`,await Ei())}async function Ui(e,t){let n=[];for(let r of e){let e=await Yn(t,{absolute:!0,cwd:r}),i=await Promise.all(e.map(async e=>{let t=A(e),n=await f(t);return{library:r,directory:new URL(`.`,t),modelPath:t,model:n}}));n.push(...i)}return n.sort((e,t)=>e.model.id.toLowerCase().localeCompare(t.model.id.toLowerCase()))}export{fr as $,ti as A,Vr as B,si as C,$r as D,Qr as E,Wr as F,Cr as G,jr as H,Zr as I,xr as J,dr as K,Hr as L,Lr as M,Gr as N,$ as O,Kr as P,gr as Q,zr as R,Di as S,li as T,kr as U,Ur as V,Ar as W,mr as X,yr as Y,ur as Z,ki as _,Mi as a,sr as at,_i as b,Li as c,$n as ct,zi as d,Te as dt,_r as et,Si as f,De as ft,vi as g,pi as h,Ni as i,or as it,ei as j,ni as k,ji as l,we as lt,di as m,Fi as n,nr as nt,Pi as o,Zn as ot,ci as p,br as q,Ai as r,rr as rt,Ri as s,Qn as st,Vi as t,X as tt,Bi as u,Ee as ut,oi as v,xi as w,Ei as x,Ci as y,Br as z};
|
package/dist/auth-dqtuCJNc.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{B as e,D as t,H as n,I as r,L as i,M as a,N as o,O as s,P as c,R as ee,S as l,T as u,U as d,V as te,_ as f,c as p,f as m,k as h,l as ne,s as g,v as _,x as re}from"./request-BlAQgJGK.mjs";import{i as v,r as y,t as ie}from"./segment-B4vS06Kb.mjs";import{readFile as ae,rm as b}from"node:fs/promises";import{fileURLToPath as oe,pathToFileURL as x}from"node:url";import{spawn as S}from"node:child_process";import{createServer as C}from"node:http";import{homedir as w}from"node:os";import{existsSync as T}from"node:fs";// @__NO_SIDE_EFFECTS__
|
|
2
|
-
function E(t){return e(re,t)}const se=`prismic.io`,ce=o({PROD:i(),PRISMIC_SENTRY_DSN:l(t(),`https://e1886b1775bd397cd1afc60bfd2ebfc8@o146123.ingest.us.sentry.io/4510445143588864`),PRISMIC_SENTRY_ENVIRONMENT:c(r()),PRISMIC_SENTRY_ENABLED:c(i()),PRISMIC_TELEMETRY_ENABLED:c(i()),PRISMIC_HOST:c(r()),PRISMIC_TOKEN:c(r()),PRISMIC_DOCS_HOST:c(r()),PRISMIC_CONFIG_DIR:c(r()),PRISMIC_TYPE_BUILDER_ENABLED:c(i()),PRISMIC_SYNC_POLL_MS:c((/* @__PURE__ */ E()).check(te(100)))}),D=d(ce,{...process.env,PROD:`true`});function le(e,t){if(t)return _(x(t));if(process.platform===`win32`){let t=process.env.APPDATA;if(t)return new URL(`${e}/`,_(x(t)))}if(process.platform!==`darwin`){let t=process.env.XDG_CONFIG_HOME;if(t)return new URL(`${e}/`,_(x(t)))}let n=_(x(w()));return new URL(`.config/${e}/`,n)}const O=le(`prismic`,D.PRISMIC_CONFIG_DIR),k=new URL(`credentials.json`,O),ue=new URL(`update-notifier.json`,O),A=new URL(`analytics.json`,O);async function de(e,t){let n=new URL(`refreshtoken`,j(t.host));return n.searchParams.set(`token`,e),g(n,{schema:r()})}const fe=ee([o({type:s(`USER`),email:r(),shortId:r()}),o({type:s(`Machine2Machine`),domain:r(),appName:r()})]);async function pe(e,t){let n=new URL(`validate`,j(t.host));return e&&n.searchParams.set(`token`,e),g(n,{schema:fe})}function j(e){return new URL(`https://auth.${e}/`)}function M(){if(process.env.AI_AGENT?.toLowerCase().startsWith(`claude-code_`))return`claude-code`;if(process.env.AI_AGENT!==void 0)return process.env.AI_AGENT.toLowerCase()||void 0;if(process.env.CLAUDE_CODE_IS_COWORK===`1`||process.env.CLAUDE_CODE_IS_COWORK===`true`)return`claude-cowork`;if(process.env.CLAUDECODE===`1`||process.env.CLAUDE_CODE)return`claude-code`;if(process.env.CODEX_CI===`1`||process.env.CODEX_SANDBOX||process.env.CODEX_THREAD_ID)return`codex`;if(process.env.CURSOR_AGENT===`1`||process.env.CURSOR_EXTENSION_HOST_ROLE===`agent-exec`)return`cursor`;if(process.env.CLINE_ACTIVE===`true`)return`cline`;if(process.env.ANTIGRAVITY_AGENT)return`antigravity`;if(process.env.AUGMENT_AGENT===`1`)return`augment`;if(process.env.OPENCODE_CLIENT===`1`)return`opencode`;if(process.env.GEMINI_CLI===`1`)return`gemini-cli`;if(process.env.TRAE_AI_SHELL_ID)return`trae`;if(process.env.REPL_ID)return`replit`;if(process.env.COPILOT_MODEL||process.env.COPILOT_ALLOW_ALL||process.env.COPILOT_GITHUB_TOKEN)return`github-copilot`;let e=process.env.AGENT?.toLowerCase();if(e===`goose`||e===`amp`)return e;if(process.platform===`linux`&&T(`/opt/.devin`))return`devin`;if(process.env.IS_SANDBOX===`yes`)return`unknown-sandbox`}const me=h({exp:c(a()),type:c(r())});function N(e){try{let[,t]=e.split(`.`);if(!t)return;let n=JSON.parse(Buffer.from(t,`base64url`).toString());return d(me,n)}catch{return}}const P=o({anonymousId:r(),userId:c(r())}),F=!D.PRISMIC_TOKEN;let I=!1,L,R,z,B,V,H,U,W;async function he(e){let{host:t,repo:n}=e;n&&(L=n),H=e.userIntent,U=e.taskId;let r=t===`prismic.io`?`cGjidifKefYb6EPaGaqpt8rQXkv5TD6P`:`Ng5oKJHCGpSWplZ9ymB7Pu7rm0sTDeiG`;R=M(),z=ve(e.token),{runtime:B,runtimeProvider:V}=ye();let i=await q();W=i??{anonymousId:crypto.randomUUID()},i||await J(W),ie({writeKey:r,anonymousId:W.anonymousId,userId:G()})}function ge(e){v({userId:e.shortId,intercomHash:e.intercomHash}),F&&!I&&W&&(W.userId=e.shortId,J(W))}function G(){return F?W?.userId:void 0}function _e(){if(!W)return{};let e=G();return{"Prismic-Anonymous-Id":W.anonymousId,...e?{"Prismic-User-Id":e}:{}}}async function K(){I=!0;let e=await q();e?.userId&&await J({anonymousId:e.anonymousId})}function ve(e){if(!e)return`none`;if(!D.PRISMIC_TOKEN)return`login`;let t=N(e);return t?t.type===`machine2machine`?`write-token`:`user-token`:`unknown-token`}function ye(){let e=be();if(e)return{runtime:`cloud`,runtimeProvider:e};let t=xe();return t||process.env.CI?{runtime:`ci`,runtimeProvider:t}:T(`/.dockerenv`)||T(`/run/.containerenv`)||process.env.KUBERNETES_SERVICE_HOST?{runtime:`container`}:process.platform!==`linux`||process.env.WSL_DISTRO_NAME?{runtime:`local`}:{runtime:`unknown`}}function be(){if(process.env.CLAUDE_CODE_REMOTE===`true`)return`claude-code`;if(process.env.CODEX_EXEC_SERVER_REMOTE_BASE_URL)return`codex`;if(process.env.CURSOR_AGENT&&process.env.CLOUD_AGENT_ALL_SECRET_NAMES!==void 0)return`cursor`;if(process.env.CODESPACES===`true`)return`codespaces`;if(process.env.GITPOD_WORKSPACE_ID)return`gitpod`;if(process.versions.webcontainer)return`stackblitz`;if(process.env.REPL_ID)return`replit`;if(process.env.CODESANDBOX_HOST)return`codesandbox`;if(process.env.MODAL_SANDBOX_ID)return`modal`;if(process.env.E2B_SANDBOX)return`e2b`;if(T(`/opt/.devin`))return`devin`}function xe(){if(process.env.GITHUB_ACTIONS===`true`)return`github-actions`;if(process.env.GITLAB_CI)return`gitlab`;if(process.env.CIRCLECI)return`circleci`;if(process.env.BITBUCKET_BUILD_NUMBER)return`bitbucket`;if(process.env.TF_BUILD)return`azure-pipelines`;if(process.env.JENKINS_URL)return`jenkins`;if(process.env.BUILDKITE)return`buildkite`;if(process.env.CODEBUILD_BUILD_ID)return`codebuild`;if(process.env.TEAMCITY_VERSION)return`teamcity`;if(process.env.VERCEL&&process.env.CI)return`vercel`;if(process.env.NETLIFY)return`netlify`;if(process.env.CF_PAGES)return`cloudflare-pages`}async function q(){return m(A,{schema:P}).catch(()=>void 0)}async function J(e){await f(A,p(e)).catch(()=>{})}function Se(e,t={}){let{watch:n}=t;y(`Prismic CLI Start`,{properties:{commandType:e,fullCommand:process.argv.join(` `),repository:L,watch:n,agent:R,auth:z,runtime:B,runtimeProvider:V,userIntent:H,taskId:U},groupId:L?{Repository:L}:void 0})}function Ce(e,t={}){let{watch:n,error:r}=t,i=r?r instanceof Error?r.message:String(r):void 0;y(`Prismic CLI End`,{properties:{commandType:e,fullCommand:process.argv.join(` `),success:!process.exitCode,repository:L,watch:n,error:i?.slice(0,512),agent:R,auth:z,runtime:B,runtimeProvider:V,userIntent:H,taskId:U},groupId:L?{Repository:L}:void 0})}const we=o({telemetry:u()});async function Te(){try{return!(await Y(w())||await Y(process.cwd()))}catch{return!0}}async function Y(e){return(await m(new URL(`.prismicrc`,_(x(e))),{schema:we}).catch(()=>void 0))?.telemetry===!1}const Ee=h({token:c(r().check(n(1))),host:c(r().check(n(1)))});async function X(){let e=await Oe();return{token:D.PRISMIC_TOKEN||e?.token,host:D.PRISMIC_HOST||e?.host||`prismic.io`}}async function Z(){if(D.PRISMIC_TOKEN)return;let{token:e,host:t}=await X();if(!e)return;let n=await de(e,{host:t});return await Q({token:n,host:t}),n}async function De(){if(!await ne(k))return!0;try{return await b(k,{force:!0}),await K(),!0}catch{return!1}}async function Oe(){return m(k,{schema:Ee}).catch(()=>void 0)}async function Q(e){await f(k,p(e))}async function ke(e){let{host:t}=await X(),n=`https://${t}`;return new Promise((r,i)=>{let a=C((e,i)=>{if(e.method===`OPTIONS`)i.writeHead(204,{"Access-Control-Allow-Origin":n,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),i.end();else if(e.method===`POST`){let s=(e,t)=>{i.writeHead(e,{"Access-Control-Allow-Origin":n,"Content-Type":`application/json`}),i.end(JSON.stringify(t))},c=``;e.on(`data`,e=>{c+=e.toString()}),e.on(`end`,async()=>{try{let{cookies:e,email:n}=JSON.parse(c),i=e.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!i){s(400,{error:`Invalid request`});return}await Q({token:i,host:t}),await K(),s(200,{success:!0}),clearTimeout(o),a.close(),r({email:n})}catch{s(400,{error:`Invalid request`})}})}else i.writeHead(404),i.end()}),o=setTimeout(()=>{a.close(),i(/* @__PURE__ */ Error(`Login timed out. Please try again.`))},18e4),s=async()=>{let n=a.address();if(!n||typeof n==`string`){clearTimeout(o),a.close(),i(/* @__PURE__ */ Error(`Failed to start login server`));return}let r=await je(t,n.port);e.onReady(r)};a.on(`error`,e=>{e.code===`EADDRINUSE`&&a.listening===!1?a.listen(0,`0.0.0.0`,s):(clearTimeout(o),i(e))}),a.listen(5555,`0.0.0.0`,s)})}const $=new URL(`.prismic`,_(x(w())));async function Ae(){let e;try{e=await ae($,`utf-8`)}catch{return}try{let t=JSON.parse(e);if(!t||t.latestKnownVersion===void 0&&t.lastUpdateCheckAt===void 0)return}catch{return}try{await b($,{force:!0})}catch{}}async function je(e,t){let n=new URL(`dashboard/cli/login`,`https://${e}/`);return n.searchParams.set(`source`,`prismic-cli`),n.searchParams.set(`port`,t.toString()),n}function Me(){try{let e=oe(new URL(`./subprocesses/refreshToken.mjs`,import.meta.url));S(process.execPath,[e],{detached:!0,stdio:`ignore`}).unref()}catch{}}export{O as _,Z as a,D as b,G as c,Ce as d,Se as f,pe as g,M as h,De as i,he as l,N as m,ke as n,Me as o,ge as p,X as r,_e as s,Ae as t,Te as u,ue as v,se as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`prismic`,t=`1.27.0`;export{t as n,e as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{F as e,I as t,N as n,P as r,f as i,l as a,s as o,u as s}from"./request-BlAQgJGK.mjs";import{createRequire as c}from"node:module";import{readFile as l,writeFile as u}from"node:fs/promises";import{basename as d,delimiter as f,dirname as p,normalize as m,resolve as h}from"node:path";import{fileURLToPath as g}from"node:url";import{spawn as ee}from"node:child_process";import{closeSync as te,openSync as ne,readSync as _,statSync as v}from"node:fs";import{cwd as y}from"node:process";import{pipeline as b}from"node:stream/promises";import{PassThrough as x}from"node:stream";import S from"node:readline";const re=/^(?:( )+|\t+)/,C=`space`;function w(e,t,n){return e&&t===C&&n===1}function T(e,t){let n=/* @__PURE__ */ new Map,r=0,i,a;for(let o of e.split(/\n/g)){if(!o)continue;let e=o.match(re);if(e===null)r=0,i=``;else{let o=e[0].length,s=e[1]?C:`tab`;if(w(t,s,o))continue;s!==i&&(r=0),i=s;let c=1,l=0,u=o-r;if(r=o,u===0)c=0,l=1;else{let e=Math.abs(u);if(w(t,s,e))continue;a=ie(s,e)}let d=n.get(a);n.set(a,d===void 0?[1,0]:[d[0]+c,d[1]+l])}}return n}function ie(e,t){return(e===C?`s`:`t`)+String(t)}function ae(e){return{type:e[0]===`s`?C:`tab`,amount:Number(e.slice(1))}}function oe(e){let t,n=0,r=0;for(let[i,[a,o]]of e)(a>n||a===n&&o>r)&&(n=a,r=o,t=i);return t}function se(e,t){return(e===C?` `:` `).repeat(t)}function ce(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);let t=T(e,!0);t.size===0&&(t=T(e,!1));let n=oe(t),r,i=0,a=``;return n!==void 0&&({type:r,amount:i}=ae(n),a=se(r,i)),{amount:i,type:r,indent:a}}const le=/^path$/i,E={key:`PATH`,value:``};function D(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!le.test(t))continue;let n=e[t];return n?{key:t,value:n}:E}return E}function O(e,t){let n=t.value.split(f),r=[],i=typeof e==`string`?e:g(e,{windows:!1}),a;do r.push(h(i,`node_modules`,`.bin`)),a=i,i=p(i);while(i!==a);r.push(p(process.execPath));let o=r.concat(n).join(f);return{key:t.key,value:o}}function k(e,t,n=!0){let r={...process.env,...t};if(!n)return r;let i=O(e,D(r));return r[i.key]=i.value,r}const A=e=>{let t=e.length,n=new x,r=()=>{--t===0&&n.end()};for(let t of e)b(t,n,{end:!1}).then(r).catch(r);return n},j=/([()\][%!^"`<>&|;, *?])/g,M=/^#!\s*(.+)/,N=/\.(?:com|exe)$/i,P=/node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i,F=process.platform===`win32`,I=[`.EXE`,`.CMD`,`.BAT`,`.COM`],L=[``];function R(e,t=[],n={}){if(n.shell===!0||!F)return{command:e,args:t,options:n};let r=z(e,n),i=null;if(r!==null){let e=Buffer.alloc(150),t=null;try{t=ne(r,`r`),_(t,e,0,150,0)}catch{}finally{t!==null&&te(t)}let n=e.toString().match(M);if(n!==null){let e=n[1].trim(),t=e.indexOf(` `),r=t===-1?e:e.slice(0,t),a=t===-1?``:e.slice(t+1),o=d(r);i=o===`env`?a||null:o}}if(i!==null&&r!==null&&(t=[r,...t],e=i,r=z(e,n)),r===null||!N.test(r)){let i=r!==null&&P.test(r);e=m(e),e=e.replace(j,`^$1`),t=t.map(e=>(e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(j,`^$1`),i&&(e=e.replace(j,`^$1`)),e)),t=[`/d`,`/s`,`/c`,`"${[e,...t].join(` `)}"`],e=n.env?.comspec??`cmd.exe`,n={...n,windowsVerbatimArguments:!0}}return{command:e,args:t,options:n}}function z(e,t){let n=(t.cwd??y()).toString(),r=t.env??process.env,i=D(r).value,a=e.includes(`/`)||e.includes(`\\`)?[``]:[n,...i.split(f)],o=r.PATHEXT?r.PATHEXT.split(f):I;e.includes(`.`)&&o[0]!==``&&(o=[``,...o]);for(let t of[o,L])for(let r of a){let i=r.startsWith(`"`)&&r.endsWith(`"`)&&r.length>1?r.slice(1,-1):r,a=h(n,i,e);for(let e of t){let t=a+e;try{if(v(t).isFile())return t}catch{}}}return null}var B=class extends Error{result;output;exitCode;get signalCode(){return this.result.signalCode}constructor(e,t,n,r){let i=`The process`;n&&(i=`The command \`${r?.length?`${n} ${r.map(e=>/[ "'`()]/.test(e)?JSON.stringify(e):e).join(` `)}`:n}\``);let a=e.exitCode??1;super(e.signalCode===null?`${i} exited with a non-zero status (${a})`:`${i} was killed by the signal ${e.signalCode}`),this.result=e,this.output=t,this.exitCode=a,Object.defineProperty(this,"result",{enumerable:!1,writable:!1,configurable:!1})}};const V={timeout:void 0,persist:!1},H={windowsHide:!0};function U(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function W(e){let t=``;try{for await(let n of e)t+=n.toString()}catch{}return t}var ue=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}get signalCode(){return this._process?.signalCode??null}constructor(e,t,n){this._options={...V,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return de(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=A(t),r=S.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&(this.exitCode!==0&&this.exitCode!==void 0||this.signalCode!==null))throw new B(this,void 0,this._command,this._args)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?W(this._streamOut):``,this._streamErr?W(this._streamErr):``]);await this._processClosed;let{stdin:r}=this._options;if(r&&typeof r!=`string`&&await r,e.removeAllListeners(),this._thrownError)throw this._thrownError;let i={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&(this.exitCode!==0&&this.exitCode!==void 0||this.signalCode!==null))throw new B(this,i,this._command,this._args);return i}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=this._options,t={...H,...e.nodeOptions},n=t?.cwd??y(),r=[];this._resetState(),e.timeout!==void 0&&r.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&r.push(e.signal),e.persist===!0&&(t.detached=!0),r.length>0&&(t.signal=U(r)),t.env=k(n,t.env,e.nodePath);let i=R(this._command,this._args,t),a=ee(i.command,i.args,i.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once(`error`,this._onError),a.once(`close`,this._onClose),a.stdin){let{stdin:t}=e;typeof t==`string`?a.stdin.end(t):t?.process?.stdout?.pipe(a.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)?this._aborted=!0:this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const G=(e,t,n)=>{let r=new ue(e,t,n);return r.spawn(),r},de=G,fe=n({name:r(t()),dependencies:r(e(t(),t())),devDependencies:r(e(t(),t())),peerDependencies:r(e(t(),t())),packageManager:r(t())});async function K(){let e=await q();return await i(e,{schema:fe})}async function q(){let e=await s(`package.json`);if(!e)throw new J;return e}var J=class extends Error{name=`MissingPackageJson`;message=`Could not find a package.json file.`};async function Y(e){let t=await q(),n=await l(t,`utf8`),r=ce(n).indent||` `,i=JSON.parse(n);e(i);let a=JSON.stringify(i,null,r)+`
|
|
2
|
-
`;await u(t,a)}async function pe(e){await Y(t=>{let n={...t.dependencies};for(let[r,i]of Object.entries(e))t.devDependencies?.[r]?t.devDependencies[r]=i:n[r]=i;t.dependencies=Object.fromEntries(Object.entries(n).sort(([e],[t])=>e.localeCompare(t)))})}async function me(e){let t=c(await q());try{let{version:n}=t(`${e}/package.json`),r=Number.parseInt(n.split(`.`)[0]);return Number.isNaN(r)?1/0:r}catch{let{dependencies:t,devDependencies:n,peerDependencies:r}=await K(),i={...r,...t,...n}[e]??``,a=/^[\^~]?(\d+)/.exec(i)?.[1];return a?Number(a):1/0}}function he(e,t){let n={...e.dependencies,...e.devDependencies},r={...t.dependencies,...t.devDependencies},i=e=>/\d+/.exec(e)?.[0];return Object.entries(r).filter(([e,t])=>{let r=e in n?i(n[e]):void 0;return r!==void 0&&r!==i(t)}).map(([e,t])=>({name:e,from:n[e],to:t}))}async function ge(e){await Y(t=>{for(let n of[`dependencies`,`devDependencies`,`peerDependencies`]){let r=t[n];if(r)for(let t of e)delete r[t]}})}async function X(e){await Y(t=>{t.name=e})}async function _e(e){let r=new URL(`${e}/latest`,`https://registry.npmjs.org/`),{version:i}=await o(r,{schema:n({version:t()})});return i}const Z={npm:[`npm`,`install`],yarn:[`yarn`,`install`],pnpm:[`pnpm`,`install`],bun:[`bun`,`install`]};async function ve(){return Z[await $()].join(` `)}async function ye(){let e=await q(),t=new URL(`.`,e),n=await $(),[r,...i]=Z[n];await G(r,i,{nodeOptions:{cwd:g(t),stdio:`inherit`},throwOnError:!0})}const Q={"bun.lock":`bun`,"bun.lockb":`bun`,"pnpm-lock.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`};async function $(){let e=await be();if(e)return e;let t=await q();for(let e in Q){let n=Q[e];if(await a(new URL(e,t)))return n}return`npm`}async function be(){try{let e=await K();if(!e.packageManager)return;let t=e.packageManager.split(`@`)[0];return t in Z?t:void 0}catch{return}}export{me as a,ye as c,X as d,G as f,ve as i,K as l,pe as n,he as o,q as r,_e as s,J as t,ge as u};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import{parseEnv as e}from"node:util";import{access as t,mkdir as n,readFile as r,writeFile as i}from"node:fs/promises";import{isAbsolute as a,relative as o}from"node:path";import{fileURLToPath as s,pathToFileURL as c}from"node:url";import{existsSync as l,watch as u}from"node:fs";import{setTimeout as d}from"node:timers/promises";function f(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function p(e,t){return typeof t==`bigint`?t.toString():t}var ee=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function te(e){return new ee(e)}function ne(e){return e==null}function m(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function re(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function g(e){return re(e._zod.def)??e._zod.def.shape}function ie(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return h(this,t,e),e},enumerable:!0,configurable:!0})}function ae(e,t,n){t in e?h(e,t,n):e[t]=n}function oe(e,t,n,r){let i=g(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ie(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ae(e,a,r?r(n.value,a):n.value))}}function se(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ie(e,n,()=>t[n]):ae(e,n,r.value))}}function ce(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}const le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){if(_(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return _(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ue(e){return v(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const de=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function pe(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function me(e,t){if(!v(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=g(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fe(e,ce(e._zod.def,{shape:he(e,t)}))}function he(e,t){let n={};return oe(n,e,Reflect.ownKeys(g(e))),se(n,t),n}function x(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function S(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function C(e){return typeof e==`string`?e:e?.message}function w(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function T(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function E(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:C(e.inst?._zod.def?.error?.(e))??C(a?.(e))??C(t?.error?.(e))??C(n.customError?.(e))??C(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const _e=/[\uD800-\uDBFF]/;function ve(e){let t=e.length;if(!_e.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function ye(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function be(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Se(e,n,r.value)}}function D(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function xe(e,t,n){return D(e,t,n,!1)}function Se(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:D(this,t,n.bind(this))},set(e){D(this,t,e)}})}function Ce(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let O,k=!1;const we={configurable:!0,get(){k=!0}};function A(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&O!==e._zod?O=void 0:(O=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,we);let e=k;k=!1;try{let r=n(this);return k?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),k||=e,r}catch(n){throw delete this[t],k||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Te(e,t,n,r){let i=Ce(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ee;const j={value:void 0,enumerable:!1};let De=`captureStackTrace`in Error?Error:null;function Oe(e){let t=De;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return De=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
|
|
2
|
-
function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){j.value=new a(r);try{Object.defineProperty(n,"_zod",j)}finally{j.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),be(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Oe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var N=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(Ee=globalThis).__zod_globalConfig??(Ee.__zod_globalConfig={});const P=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(P,e),P}function ke(){let e=this._zod;return e.message??=JSON.stringify(e.def,p,2),e.message}function Ae(e){this._zod.message=e}const je={get:ke,set:Ae,enumerable:!0,configurable:!0},I={value:void 0,enumerable:!1},L=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),R=/* @__PURE__ */ M(`$ZodError`,(e,t)=>{e.name=`$ZodError`,I.value=t,Object.defineProperty(e,"issues",I),I.value=void 0,Object.defineProperty(e,"message",je);let n=Object.getPrototypeOf(e);L.has(n)||(L.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},void 0,{Parent:Error}),z=/* @__PURE__*/ (e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new N;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>E(e,o,F())));throw le(n,a?.callee??t),n}return s.value};return t})(R),Me=/* @__PURE__*/ (e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>E(e,o,F())));throw le(n,a?.callee??t),n}return s.value};return t})(R),Ne=/* @__PURE__*/ (e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new N;return a.issues.length?Pe(e,a.issues,i):{success:!0,data:a.value}})(R);function Pe(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>E(e,n,F()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Fe=/* @__PURE__*/ (e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Pe(e,a.issues,i):{success:!0,data:a.value}})(R),Ie=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Le=/^https?$/,Re=/^[\s\S]{0,}$/,ze=/^-?\d+(?:\.\d+)?$/,Be=/^(?:true|false)$/i,B=/*@__PURE__*/ M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ve=e=>{let t=e.value;return!ne(t)&&t.length!==void 0},He={number:`number`,bigint:`bigint`,object:`date`},Ue=/*@__PURE__*/ M(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=He[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:He[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),We=/*@__PURE__*/ M(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=Ve),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ve(r):i)>=t.minimum)return;let a=ye(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ge=/*@__PURE__*/ M(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ke={major:4,minor:6,patch:7},V=/*@__PURE__*/ M(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ke;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=x(t),a;for(let o of n){if(o._zod.def.when){if(ge(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new N;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(T(t.issues,n,e),i||=x(t,n))});else{if(t.issues.length===n)continue;T(t.issues,n,e),i||=x(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(x(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new N;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new N;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return xe(this,`~standard`,Je(this))},set"~standard"(e){D(this,`~standard`,e)}}),H=(e,t)=>e.issues.length?{issues:e.issues.map(e=>E(e,t,F()))}:{value:e.value};async function qe(e,t){let n={async:!0};return H(await e._zod.run({value:t,issues:[]},n),n)}function Je(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return H(r,n)}catch{}return qe(e,t)},vendor:`zod`,version:1}}const U=/*@__PURE__*/ M(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=t.pattern??Re,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),W=/*@__PURE__*/ M(`$ZodStringFormat`,(e,t)=>{Ge.init(e,t),U.init(e,t)});function Ye(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Xe(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ye(e)||2:Ze(e,t)}function Ze(e,t){if(!t.normalize&&t.protocol?.source===Le.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const Qe=/[\t\n\r]/g;function $e(e){return e.replace(Qe,``)}function et(e,t){return t.lastIndex=0,t.test(e.hostname)}function tt(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const nt=/*@__PURE__*/ M(`$ZodURL`,(e,t)=>{W.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Xe(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=$e(r);return}t.hostname&&!et(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!tt(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:$e(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),rt=/*@__PURE__*/ M(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=ze,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),it=/*@__PURE__*/ M(`$ZodBoolean`,(e,t)=>{V.init(e,t),e._zod.pattern=Be,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),at=/*@__PURE__*/ M(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e});function ot(e,t){let n=w(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of w(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,T(n.issues,t,e),n}}return i(n,a)}}const st=e=>Array.isArray(e)?e.length:-1;function ct(e,t,n){e.issues.length&&t.issues.push(...S(n,e.issues)),t.value[n]=e.value}const lt=/*@__PURE__*/ M(`$ZodArray`,(e,t)=>{V.init(e,t);let n=P.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>ct(t,r,e)));else if(ct(c,r,e),s&&c.issues.length!==0&&x(c))break}return o.length?Promise.all(o).then(()=>r):r},ot(e,st)});function G(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...S(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const ut=[];function dt(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ut,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=pe(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ft(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(x(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>G(e,n,i,t,d,f))):G(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const pt=/*@__PURE__*/ M(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=te(()=>dt(t));A(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||h(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=_,o=t.catchall,s,c=P.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(x(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>G(n,t,e,r,a,o))):G(s,t,e,r,a,o)}return o?ft(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}});function mt(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!x(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>E(e,r,F())))}),t)}const ht=/*@__PURE__*/ M(`$ZodUnion`,(e,t)=>{V.init(e,t),A(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),A(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),A(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),A(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>m(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>mt(t,r,e,i)):mt(o,r,e,i)}}),gt=/*@__PURE__*/ M(`$ZodRecord`,(e,t)=>{V.init(e,t);let n=P.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!v(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>E(e,i,F())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...S(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...S(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&ze.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>E(e,i,F())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...S(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...S(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),_t=/*@__PURE__*/ M(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=f(t.entries),r=new Set(n);e._zod.values=r,A(e,`pattern`,e=>{let t=f(e.def.entries).filter(e=>de.has(typeof e));return RegExp(t.length?`^(${t.map(e=>y(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),vt=/*@__PURE__*/ M(`$ZodLiteral`,(e,t)=>{V.init(e,t);let n=new Set(t.values);e._zod.values=n,A(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?y(e):e?y(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}});function yt(e,t){return e.value=t.issues.length?void 0:t.value,e}const bt=/*@__PURE__*/ M(`$ZodOptional`,(e,t)=>{V.init(e,t),A(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,A(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),A(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${m(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>yt(e,t)):yt(e,r)}return t.innerType._zod.run(e,n)}}),xt=/*@__PURE__*/ M(`$ZodNullable`,(e,t)=>{V.init(e,t),A(e,`optin`,e=>e.def.innerType._zod.optin),A(e,`optout`,e=>e.def.innerType._zod.optout),A(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${m(t.source)}|null)$`):void 0}),A(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),St=/*@__PURE__*/ M(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`defaulted`,A(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ct(e,t)):Ct(r,t)}});function Ct(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const wt=/*@__PURE__*/ M(`$ZodPipe`,(e,t)=>{V.init(e,t),A(e,`values`,e=>e.def.in._zod.values),A(e,`optin`,e=>e.def.in._zod.optin),A(e,`optout`,e=>e.def.out._zod.optout),A(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>K(e,t.in,n)):K(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>K(e,t.out,n)):K(r,t.out,n)}});function K(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Tt=/*@__PURE__*/ M(`$ZodCodec`,(e,t)=>{V.init(e,t),A(e,`values`,e=>e.def.in._zod.values),A(e,`optin`,e=>e.def.in._zod.optin),A(e,`optout`,e=>e.def.out._zod.optout),A(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>q(e,t,n)):q(r,t,n)}{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>q(e,t,n)):q(r,t,n)}}});function q(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>J(e,r,t.out,n)):J(e,r,t.out,n)}{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>J(e,r,t.in,n)):J(e,r,t.in,n)}}function J(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}function Y(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
3
|
-
function Et(e,t){return new e(Y({type:`string`,...b(t)}))}// @__NO_SIDE_EFFECTS__
|
|
4
|
-
function Dt(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}// @__NO_SIDE_EFFECTS__
|
|
5
|
-
function Ot(e,t){return new e(Y({type:`number`,checks:[],...b(t)}))}// @__NO_SIDE_EFFECTS__
|
|
6
|
-
function kt(e,t){return new e(Y({type:`number`,coerce:!0,checks:[],...b(t)}))}// @__NO_SIDE_EFFECTS__
|
|
7
|
-
function At(e,t){return new e({type:`boolean`,...b(t)})}// @__NO_SIDE_EFFECTS__
|
|
8
|
-
function jt(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
|
|
9
|
-
function Mt(e,t){return new Ue({check:`greater_than`,...b(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
10
|
-
function Nt(e,t){return new We({check:`min_length`,...b(t),minimum:e})}// @__NO_SIDE_EFFECTS__
|
|
11
|
-
function Pt(e,t){let n=b(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??Tt,c=e.Boolean??it,l=new s({type:`pipe`,in:new(e.String??U)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:!o.has(r)&&(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l._zod.bag.truthy=r,l._zod.bag.falsy=i,l._zod.bag.case=n.case??`insensitive`,l}const X=/*@__PURE__*/ M(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){D(this,`with`,e)},parse(e,t){return z(this,e,t,{callee:this.parse})},parseAsync(e,t){return Me(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Ne(this,e,t)},safeParseAsync(e,t){return Fe(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Z=/*@__PURE__*/ M(`ZodMiniString`,(e,t)=>{U.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
12
|
-
function Ft(e){return/* @__PURE__ */ Et(Z,e)}const It=/*@__PURE__*/ M(`ZodMiniStringFormat`,(e,t)=>{W.init(e,t),Z.init(e,t)}),Lt=/*@__PURE__*/ M(`ZodMiniURL`,(e,t)=>{nt.init(e,t),It.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
13
|
-
function Rt(e){return/* @__PURE__ */ Dt(Lt,e)}// @__NO_SIDE_EFFECTS__
|
|
14
|
-
function zt(e){return/* @__PURE__ */ Dt(Lt,{protocol:Le,hostname:Ie,...b(e)})}const Bt=/*@__PURE__*/ M(`ZodMiniNumber`,(e,t)=>{rt.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
15
|
-
function Vt(e){return/* @__PURE__ */ Ot(Bt,e)}const Ht=/*@__PURE__*/ M(`ZodMiniBoolean`,(e,t)=>{it.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
16
|
-
function Ut(e){return/* @__PURE__ */ At(Ht,e)}const Wt=/*@__PURE__*/ M(`ZodMiniUnknown`,(e,t)=>{at.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
17
|
-
function Gt(){return/* @__PURE__ */ jt(Wt)}const Kt=/*@__PURE__*/ M(`ZodMiniArray`,(e,t)=>{lt.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
18
|
-
function qt(e,t){return new Kt({type:`array`,element:e,...b(t)})}const Jt=/*@__PURE__*/ M(`ZodMiniObject`,(e,t)=>{pt.init(e,t),X.init(e,t),Te(e,`shape`,e=>e._zod.def.shape,!1)});// @__NO_SIDE_EFFECTS__
|
|
19
|
-
function Yt(e,t){let n={type:`object`,shape:e??{},...b(t)};return new Jt(n)}// @__NO_SIDE_EFFECTS__
|
|
20
|
-
function Xt(e,t){return new Jt({type:`object`,shape:e,catchall:/* @__PURE__ */ Gt(),...b(t)})}// @__NO_SIDE_EFFECTS__
|
|
21
|
-
function Zt(e,t){return me(e,t)}const Qt=/*@__PURE__*/ M(`ZodMiniUnion`,(e,t)=>{ht.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
22
|
-
function $t(e,t){return new Qt({type:`union`,options:e,...b(t)})}const en=/*@__PURE__*/ M(`ZodMiniRecord`,(e,t)=>{gt.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
23
|
-
function tn(e,t,n){return!t||!t._zod?new en({type:`record`,keyType:/* @__PURE__ */ Ft(),valueType:e,...b(t)}):new en({type:`record`,keyType:e,valueType:t,...b(n)})}const nn=/*@__PURE__*/ M(`ZodMiniEnum`,(e,t)=>{_t.init(e,t),X.init(e,t),e.options=[...e._zod.values]});// @__NO_SIDE_EFFECTS__
|
|
24
|
-
function rn(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new nn({type:`enum`,entries:n,...b(t)})}const an=/*@__PURE__*/ M(`ZodMiniLiteral`,(e,t)=>{vt.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
25
|
-
function on(e,t){return new an({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}const sn=/*@__PURE__*/ M(`ZodMiniOptional`,(e,t)=>{bt.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
26
|
-
function cn(e){return new sn({type:`optional`,innerType:e})}const ln=/*@__PURE__*/ M(`ZodMiniNullable`,(e,t)=>{xt.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
27
|
-
function un(e){return new ln({type:`nullable`,innerType:e})}// @__NO_SIDE_EFFECTS__
|
|
28
|
-
function dn(e){return/* @__PURE__ */ cn(/* @__PURE__ */ un(e))}const fn=/*@__PURE__*/ M(`ZodMiniDefault`,(e,t)=>{St.init(e,t),X.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
29
|
-
function pn(e,t){return new fn({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}const mn=/*@__PURE__*/ M(`ZodMiniPipe`,(e,t)=>{wt.init(e,t),X.init(e,t)}),hn=/*@__PURE__*/ M(`ZodMiniCodec`,(e,t)=>{mn.init(e,t),Tt.init(e,t)}),gn=(...e)=>/* @__PURE__ */ Pt({Codec:hn,Boolean:Ht,String:Z},...e);function _n(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}function vn(e,t){return o(s(e),s(t))}function yn(e){let t=e.pathname.lastIndexOf(`.`);if(t!==-1)return e.pathname.slice(t+1).toLowerCase()||void 0}function bn(e,t){let n=o(s(e),s(t));return!(!n||n.startsWith(`..`)||a(n))}async function xn(e,t={}){let{stop:n}=t,r=_n(c(process.cwd()));for(;;){let t=new URL(e,r);if(await Q(t))return t;if(n&&await Q(new URL(n,r)))return;let i=new URL(`..`,r);if(i.href===r.href)return;r=i}}async function Q(e){try{return await t(e),!0}catch{return!1}}function Sn(e,t){let n=Promise.withResolvers(),r;for(let i of e)l(i)&&u(i,{recursive:!0,signal:t},()=>{clearTimeout(r),r=setTimeout(()=>n.resolve(),100)}).on(`error`,()=>{});return async e=>{await Promise.race([n.promise,d(e,void 0,{signal:t})]).catch(()=>{}),n=Promise.withResolvers()}}async function Cn(e,t){let r=new URL(`.`,e);await n(r,{recursive:!0}),await i(e,t)}async function wn(e,t={}){let{schema:n}=t,i=await r(e,`utf8`),a;try{a=JSON.parse(i)}catch(t){throw SyntaxError(`${o(process.cwd(),s(e))} is not valid JSON.`,{cause:t})}return n?z(n,a):a}const Tn={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`};async function En(e){if(e.protocol===`http:`||e.protocol===`https:`){let t=await fetch(e);if(!t.ok)throw Error(`Failed to download file from "${e.toString()}" (HTTP ${t.status}).`);return await t.blob()}if(e.protocol===`file:`){let t=await r(e),n=yn(e),i=n&&Tn[n]||`application/octet-stream`;return new Blob([t],{type:i})}throw Error(`Unsupported file protocol: ${e.protocol}`)}async function Dn(t){let n=await r(t,`utf8`);return e(n)}async function On(e,t,n){let a=await Q(e),o=``;a&&(o=await r(e,`utf8`));let s=RegExp(`^${t}=.*$`,`mg`),c=`${t}=${n}`;s.test(o)?o=o.replace(s,c):(o&&!o.endsWith(`
|
|
30
|
-
`)&&(o+=`
|
|
31
|
-
`),o+=`${c}\n`),await i(e,o)}async function kn(e,t){if(!await Q(e))return;let n=await r(e,`utf8`),a=RegExp(`^${t}=.*$\n?`,`mg`);n=n.replace(a,``),await i(e,n)}function An(e){return JSON.stringify(e,null,2)}async function jn(e,t={}){let{credentials:n,json:r,notFoundMessage:i,unknownErrorMessage:a,schema:o,...s}=t,c=new Headers(t.headers);if(c.has(`Accept`)||c.set(`Accept`,`application/json`),c.has(`User-Agent`)||c.set(`User-Agent`,`prismic-cli`),n){let e=[];for(let t in n)e.push(`${t}=${n[t]??``}`);c.set(`Cookie`,e.join(`; `))}`json`in t&&!c.has(`Content-Type`)&&c.set(`Content-Type`,`application/json`);let l=`json`in t?JSON.stringify(r):t.body,u=await fetch(e,{...s,body:l,headers:c}),d=await u.text(),f;if(d)try{f=JSON.parse(d)}catch{f=d}if(u.ok)return o?z(o,f):f;switch(u.status){case 400:throw new Nn(u,f);case 401:throw new In(u,f);case 403:throw new Fn(u,f);case 404:throw new Pn(u,f,i);default:throw new Mn(u,f,a)}}var $=class extends Error{response;body;constructor(e,t,n){super(n),this.response=e,this.body=t}get status(){return this.response.status}get statusText(){return this.response.statusText}},Mn=class extends ${name=`UnknownRequestError`},Nn=class extends ${name=`BadRequestError`},Pn=class extends ${name=`NotFoundRequestError`;constructor(e,t,n=`The requested resource was not found.`){super(e,t,n)}},Fn=class extends ${name=`ForbiddenRequestError`},In=class extends ${name=`UnauthorizedRequestError`};export{un as A,kt as B,rn as C,zt as D,Zt as E,tn as F,Nt as H,Ft as I,gn as L,Vt as M,Yt as N,on as O,cn as P,$t as R,pn as S,Ut as T,z as U,Mt as V,Ne as W,Cn as _,In as a,vn as b,An as c,Dn as d,wn as f,Sn as g,kn as h,$ as i,dn as j,Xt as k,Q as l,On as m,Fn as n,Mn as o,En as p,Pn as r,jn as s,Nn as t,xn as u,_n as v,qt as w,Bt as x,bn as y,Rt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"../auth-dqtuCJNc.mjs";try{await e()}catch{}export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{t as SvelteKitAdapter}from"./sveltekit-CuRs_Ytj.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./package-DruwThDN.mjs";import{I as t,M as n,P as r,_ as i,c as a,f as o,k as s}from"./request-BlAQgJGK.mjs";import{s as c}from"./packageJson-uZy38HFJ.mjs";import{fileURLToPath as l}from"node:url";import{spawn as u}from"node:child_process";const d=s({latestKnownVersion:r(t()),lastUpdateCheckAt:r(n())});async function f(t){try{if(p())return;let n=await m(t.statePath),r=e;if(n?.latestKnownVersion&&h(n.latestKnownVersion,r)){let e=`Update available: ${r} → ${n.latestKnownVersion}. Run \`npx ${t.npmPackageName}@latest --version\` to update.`;process.on(`exit`,()=>{try{console.error(`\n${e}`)}catch{}})}(!n?.lastUpdateCheckAt||Date.now()-n.lastUpdateCheckAt>864e5)&&process.on(`exit`,()=>{_(t.npmPackageName,t.statePath)})}catch{}}function p(){return process.env.NO_UPDATE_NOTIFIER!==`0`&&!(process.env.NO_UPDATE_NOTIFIER!==`1`&&!process.env.CI&&process.stderr.isTTY)}async function m(e){return o(e,{schema:d}).catch(()=>void 0)}function h(e,t){if(e.includes(`-`)||t.includes(`-`))return!1;let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);if(n.length!==3||r.length!==3||n.some(e=>!Number.isFinite(e))||r.some(e=>!Number.isFinite(e)))return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}async function g(e,t){let n=await c(e);await i(t,a({latestKnownVersion:n,lastUpdateCheckAt:Date.now()}))}function _(e,t){try{let n=l(new URL(`./subprocesses/updateVersionState.mjs`,import.meta.url));u(process.execPath,[n,e,t.href],{detached:!0,stdio:`ignore`}).unref()}catch{}}export{g as n,f as t};
|