Files
e-tib.com/.next/server/chunks/ssr/16097_payload_dist_index_4a2611c5.js
Marc Mintel d14122005d Initial commit: E-TIB production hardening & E2E foundation
Former-commit-id: ef04fca3d76375630c05aac117bf586953f3b657
2026-04-28 19:11:38 +02:00

168 lines
44 KiB
JavaScript

;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="fd81393a-aaa2-03b2-b9e3-8e49735cf60c")}catch(e){}}();
module.exports=[723860,a=>{"use strict";var b=a.i(488582),c=a.i(481353),d=a.i(861845),e=a.i(226969),f=a.i(353243),g=a.i(988209),h=a.i(943716),i=a.i(829874),j=a.i(813270),k=a.i(48380),l=a.i(997626),m=a.i(102880),n=a.i(128242),o=a.i(507045),p=a.i(154103);a.s([],781292),a.i(781292);var q=a.i(51723),r=a.i(503027),s=a.i(692400);a.s(["extractJWT",()=>r.extractJWT,"generateCookie",()=>q.generateCookie,"generateExpiredPayloadCookie",()=>q.generateExpiredPayloadCookie,"generatePayloadCookie",()=>q.generatePayloadCookie,"getCookieExpiration",()=>q.getCookieExpiration,"hasWhereAccessResult",()=>s.hasWhereAccessResult,"parseCookies",()=>q.parseCookies],311260),a.i(311260);var t=a.i(979379),u=a.i(195770),v=a.i(994208),w=a.i(446054),x=a.i(689715),y=a.i(281774),z=a.i(861126),A=a.i(609334),B=a.i(150540),C=a.i(147548),D=a.i(493543),E=a.i(223429),F=a.i(176140),G=a.i(285522),H=a.i(313264),I=a.i(240180),J=a.i(101805),K=a.i(539596);let L={loggerDestination:K.prettySyncLoggerDestination,loggerOptions:{}},M="Available commands: migrate, migrate:create, migrate:down, migrate:refresh, migrate:reset, migrate:status, migrate:fresh",N=async({config:a,migrationDir:c,parsedArgs:d})=>{let{_:e,file:f,forceAcceptWarning:g,help:h}=d,i=Object.keys(d).map(a=>{let b=a.replace(/^[-_]+/,"");return b?b.split("-").map((a,b)=>0===b?a.toLowerCase():a.charAt(0).toUpperCase()+a.slice(1)).join(""):null}).filter(Boolean),j=g||i.includes("forceAcceptWarning"),k=i.includes("skipEmpty");h&&(console.log(`
${M}
`),process.exit(0)),process.env.PAYLOAD_MIGRATING="true",await b.default.init({config:a,disableDBConnect:"migrate:create"===e[0],disableOnInit:!0,...L});let l=b.default.db;if(!l)throw Error("No database adapter found");switch(c&&(l.migrationDir=c),!e.length&&(b.default.logger.error({msg:`No migration command provided. ${M}`}),process.exit(1)),e[0]){case"migrate":await l.migrate();break;case"migrate:create":try{await l.createMigration({file:f,forceAcceptWarning:j,migrationName:e[1],payload:b.default,skipEmpty:k})}catch(b){let a=b instanceof Error?b.message:"Unknown error";throw Error(`Error creating migration: ${a}`)}break;case"migrate:down":await l.migrateDown();break;case"migrate:fresh":await l.migrateFresh({forceAcceptWarning:j});break;case"migrate:refresh":await l.migrateRefresh();break;case"migrate:reset":await l.migrateReset();break;case"migrate:status":await l.migrateStatus();break;default:b.default.logger.error({msg:`Unknown migration command: ${e[0]}. ${M}`}),process.exit(1)}b.default.logger.info("Done.")};var O=a.i(79275),P=a.i(1562),Q=a.i(856069),R=a.i(721296),S=a.i(549343),T=a.i(808234),U=a.i(679326),V=a.i(213729),W=a.i(567062),X=a.i(699331),Y=a.i(745016),Z=a.i(990098),$=a.i(628018),_=a.i(312806),aa=a.i(786627),ab=a.i(579903),ac=a.i(241323),ad=a.i(662018),ae=a.i(590606),af=a.i(8616),ag=a.i(726050),ah=a.i(424783),ai=a.i(682556),aj=a.i(728761),ak=a.i(517707),al=a.i(705888),am=a.i(217277),an=a.i(935362),ao=a.i(410935),ap=a.i(316609),aq=a.i(98874),ar=a.i(843270),as=a.i(453680),at=a.i(365007),au=a.i(259702),av=a.i(38429),aw=a.i(492067),ax=a.i(85631),ay=a.i(725404),az=a.i(701473),aA=a.i(926386),aB=a.i(441634),aC=ay;class aD extends aC.APIError{constructor(a){super(`Global label "${a.label}" is already in use`)}}var aE=a.i(763529),aF=a.i(753738),aG=a.i(914930),aH=a.i(505639),aI=a.i(66266),aJ=a.i(916168),aK=a.i(99038),aL=a.i(103910),aM=a.i(950032),aN=ay;class aO extends aN.APIError{constructor(){super("payload.config.collection object is missing label")}}var aP=a.i(497328),aQ=ay;class aR extends aQ.APIError{constructor(a){super(`Field ${a.label} is missing options.`)}}var aS=a.i(560053),aT=a.i(407847),aU=a.i(366198),aV=a.i(546373),aW=a.i(314746),aX=a.i(54067),aY=a.i(252871),aZ=a.i(92214),a$=a.i(661119),a_=a.i(953023),a0=a.i(118670);let a1=async a=>{let b,{collectionSlug:c,globalSlug:d,parentID:e,req:f}=a,g={parent:{equals:e}};return c&&(b=()=>f.payload.countVersions({collection:c,where:g})),d&&(b=()=>f.payload.countGlobalVersions({global:d,where:g})),b&&await b()?.then(a=>a.totalDocs||0)||0},a2=({customSlugify:a,data:b,req:c,valueToSlugify:d})=>a?a({data:b,req:c,valueToSlugify:d}):(0,a0.slugify)(d);var a3=a.i(692785),a4=a.i(23422),a5=a.i(769206),a6=a.i(401107),a7=a.i(172449),a8=a.i(545858),a9=a.i(528261),ba=a.i(5406),bb=a.i(918014),bc=a.i(287195),bd=a.i(167126),be=a.i(625724),bf=a.i(485116),bg=a.i(230784),bh=a.i(619659),bi=a.i(489089),bj=a.i(43401),bk=a.i(489837);class bl{store=new Map;async clear(){this.store.clear()}async delete(a){this.store.delete(a)}async get(a){let b=this.store.get(a);return void 0===b?null:b}async has(a){return this.store.has(a)}async keys(){return Array.from(this.store.keys())}async set(a,b){this.store.set(a,b)}}let bm=()=>({init:()=>new bl});a.s(["InMemoryKVAdapter",()=>bl,"inMemoryKVAdapter",0,bm],794992),a.i(794992),a.s([],297246),a.i(297246);var bn=a.i(264289),bo=a.i(178842),bp=a.i(309868),bq=a.i(352241),br=a.i(172337),bs=a.i(872754),bt=a.i(167776),bu=a.i(528441),bv=a.i(151579),bw=a.i(271648),bx=a.i(355130),by=a.i(831413),bz=a.i(766547),bA=a.i(882304),bB=a.i(742394),bC=a.i(491574),bD=a.i(674980),bE=a.i(88710),bF=a.i(126817),bG=a.i(170268),bH=a.i(687607);let bI=async({canSetHeaders:a,config:c,params:d,payloadInstanceCacheKey:e,request:f})=>{let g=(0,bH.parseCookies)(f.headers),h=await (0,b.getPayload)({config:c,cron:!0,key:e}),{config:i}=h,j=i.localization,k=new URL(f.url),{pathname:m,searchParams:n}=k,o=!i.graphQL.disable&&m===(0,bF.formatAdminURL)({apiRoute:i.routes.api,path:i.routes.graphQL}),p=(0,bG.getRequestLanguage)({config:i,cookies:g,headers:f.headers}),q=await (0,bD.initI18n)({config:i.i18n,context:"api",language:p}),r=n.get("locale"),{search:s}=k,t=s?bE.parse(s,{arrayLimit:1e3,depth:10,ignoreQueryPrefix:!0}):{},u=t.fallbackLocale||n.get("fallback-locale")||n.get("fallbackLocale");if(j){let a=(0,bx.sanitizeLocales)({fallbackLocale:u,locale:r,localization:j});u=a.fallbackLocale,r=a.locale}let v=Object.assign(f,{context:{},fallbackLocale:u,hash:k.hash,host:k.host,href:k.href,i18n:q,locale:r,origin:k.origin,pathname:k.pathname,payload:h,payloadAPI:o?"GraphQL":"REST",payloadDataLoader:void 0,payloadUploadSizes:{},port:k.port,protocol:k.protocol,query:t,routeParams:d||{},search:k.search,searchParams:k.searchParams,t:q.t,transactionID:void 0,user:null});v.payloadDataLoader=(0,P.getDataLoader)(v);let{responseHeaders:w,user:x}=await (0,l.executeAuthStrategies)({canSetHeaders:a,headers:v.headers,isGraphQL:o,payload:h});return v.user=x,w&&(v.responseHeaders=w),v};var bJ=a.i(426574),bK=a.i(953174),bL=a.i(588947),bM=a.i(814747),bN=a.i(792509),bO=a.i(522734),bP=a.i(845725),bQ=a.i(362562);process.platform;let bR=bO.default.realpathSync.native,bS={get url(){return`file://${a.P("node_modules/.pnpm/payload@3.81.0_graphql@16.13.2_typescript@5.9.3/node_modules/payload/dist/utilities/dependencies/resolveFrom.js")}`}},bT=(0,bN.fileURLToPath)({get url(){return`file://${a.P("node_modules/.pnpm/payload@3.81.0_graphql@16.13.2_typescript@5.9.3/node_modules/payload/dist/utilities/dependencies/getDependencies.js")}`}}.url),bU=bM.default.dirname(bT),bV=bM.default.resolve(bU,"../../../"),bW=bM.default.resolve(process.cwd());async function bX(b,c){let d=new Map,e=[];return await Promise.all(c.map(async c=>{try{let f=await bO.promises.realpath(((b,c,d)=>{if("string"!=typeof b)throw TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof b}\``);if("string"!=typeof c)throw TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof c}\``);try{b=bR(b)}catch(a){if("object"==typeof a&&null!==a&&"name"in a&&"message"in a&&"ENOENT"===a.code)b=bM.default.resolve(b);else if(0)return;else throw a}let e=bM.default.join(b,"noop.js");(0,bQ.createRequire)(bS.url);let f=a.r(362562);return f._resolveFilename(c,{id:e,filename:e,paths:f._nodeModulePaths(b)})})(b,c)),g=bM.default.dirname(f),h=null,i=await (0,bP.findUp)({dir:g,fileNames:["package.json"]});if(i){let a=bM.default.resolve(i);(a.startsWith(bW)||a.startsWith(bV))&&(h=a)}if(!h)return e.push(c);{let a=JSON.parse(await bO.promises.readFile(h,"utf8")).version;d.set(c,{path:h,version:a})}}catch(a){return e.push(c)}})),{missing:e,resolved:d}}function bY(a){let[b,...c]=a.split("-");return{parts:b.split(".").map(Number),preReleases:c}}function bZ(a){return(a.match(/\d+/g)||[]).map(Number)}let b$=(0,bN.fileURLToPath)({get url(){return`file://${a.P("node_modules/.pnpm/payload@3.81.0_graphql@16.13.2_typescript@5.9.3/node_modules/payload/dist/utilities/dependencies/dependencyChecker.js")}`}}.url),b_=bM.default.dirname(b$);async function b0({dependencyGroups:a,dependencyVersions:b}){if(a?.length)for(let b of a){let a=await bX(b_,b.dependencies),c={};for(let[b,{version:d}]of a.resolved)Object.keys(c).includes(d)||(c[d]=b);if(Object.keys(c).length>1){let d=b.targetVersion??a.resolved.get(b.targetVersionDependency)?.version;if(d){let a=Object.entries(c).filter(([a])=>a!==d).map(([a,b])=>`${b}@${a} (Please change this to ${d})`).join(", ");throw Error(`Mismatching "${b.name}" dependency versions found: ${a}. All "${b.name}" packages must have the same version. This is an error with your set-up, not a bug in Payload. Please go to your package.json and ensure all "${b.name}" packages have the same version.`)}{let a=Object.entries(c).map(([a,b])=>`${b}@${a}`).join(", ");throw Error(`Mismatching "${b.name}" dependency versions found: ${a}. All "${b.name}" packages must have the same version. This is an error with your set-up, not a bug in Payload. Please go to your package.json and ensure all "${b.name}" packages have the same version.`)}}}if(b&&Object.keys(b).length){let a=await bX(b_,Object.keys(b));for(let[c,d]of Object.entries(b)){let b=a.resolved.get(c);if(!b){if(!d.required)continue;throw Error(`Dependency ${c} not found. Please ensure it is installed.`)}if(d.version){let a=d.version.startsWith(">=")?d.version.slice(2):d.version,e=function(a,b,c){let{parts:d,preReleases:e}=c?c(a):bY(a),{parts:f,preReleases:g}=c?c(b):bY(b);for(let a=0;a<Math.max(d.length,f.length);a++){if((d[a]||0)>(f[a]||0))return"greater";if((d[a]||0)<(f[a]||0))return"lower"}if(e?.length||g?.length)for(let a=0;a<Math.max(e.length,g.length);a++){if(!e[a])return"greater";if(!g[a])return"lower";let b=function(a,b){let c=bZ(a),d=bZ(b);for(let a=0;a<Math.max(c.length,d.length);a++){if((c[a]||0)<(d[a]||0))return -1;if((c[a]||0)>(d[a]||0))return 1}return a<b?-1:+(a>b)}(e[a],g[a]);if(0!==b)return 1===b?"greater":"lower"}return"equal"}(b.version,a,d.customVersionParser);if(d.version.startsWith(">=")){if("lower"===e)throw Error(`Dependency ${c} is on version ${b.version}, but ${d.version} or greater is required. Please update this dependency.`)}else if("lower"===e||"greater"===e)throw Error(`Dependency ${c} is on version ${b.version}, but ${d.version} is required. Please update this dependency.`)}}}}var b1=a.i(695052),b2=a.i(142638),b3=a.i(894703),b4=a.i(659242),b5=a.i(310219),b6=a.i(887825),b7=a.i(121858),b8=a.i(939241);a.i(129712);var b9=a.i(545331),ca=a.i(683783),cb=a.i(7506),cc=a.i(406902),cd=a.i(614517),ce=a.i(504107);let cf=async({collection:a,config:c,err:d,req:e})=>{if("payloadInitError"in d&&!0===d.payloadInitError)return console.error(d),Response.json({message:"There was an error initializing Payload"},{status:b9.status.INTERNAL_SERVER_ERROR});let f=e&&"payload"in e&&e?.payload;if(!f)try{f=await (0,b.getPayload)({config:c,cron:!0})}catch(a){return Response.json({message:"There was an error initializing Payload"},{status:b9.status.INTERNAL_SERVER_ERROR})}let g=(0,b4.formatErrors)(d),h=d.status||b9.status.INTERNAL_SERVER_ERROR;(0,ce.logError)({err:d,payload:f}),e.payload=f;let i=(0,cb.headersWithCors)({headers:new Headers,req:e}),{config:j}=f;return(0,cd.isErrorPublic)(d,j)||(g=(0,b4.formatErrors)(new ay.APIError("Something went wrong."))),j.debug&&!0===j.debug&&(g.stack=d.stack),a&&await a.config.hooks.afterError?.reduce(async(b,c)=>{await b;let f=await c({collection:a.config,context:e.context,error:d,req:e,result:g});f&&(g=f.response||g,h=f.status||h)},Promise.resolve()),await j.hooks.afterError?.reduce(async(b,c)=>{await b;let f=await c({collection:a?.config,context:e.context,error:d,req:e,result:g});f&&(g=f.response||g,h=f.status||h)},Promise.resolve()),Response.json(g,{headers:e.responseHeaders?(0,cc.mergeHeaders)(e.responseHeaders,i):i,status:h})},cg=(a,b)=>Response.json({message:`Route not found "${b??new URL(a.url).pathname}"`},{headers:(0,cb.headersWithCors)({headers:new Headers,req:a}),status:b9.status.NOT_FOUND}),ch=async({basePath:a="",config:b,path:c,payloadInstanceCacheKey:d,request:e})=>{let f,g,h;if("post"===e.method.toLowerCase()&&("GET"===e.headers.get("X-Payload-HTTP-Method-Override")||"GET"===e.headers.get("X-HTTP-Method-Override"))){let f,g=e.url;if("application/x-www-form-urlencoded"===e.headers.get("Content-Type")){let a=await e.text();g=`${e.url}?${a}`}else"application/json"===e.headers.get("Content-Type")&&(f=await e.json(),f?.locale&&(g+=`?locale=${f.locale}`),f?.fallbackLocale&&(g+=`&fallbackLocale=${f.depth}`));let h=new Request(g,{cache:e.cache,credentials:e.credentials,headers:e.headers,method:"GET",signal:e.signal});return f&&(h.data=f),await ch({basePath:a,config:b,path:c,payloadInstanceCacheKey:d,request:h})}try{let a,{payload:i}=g=await bI({canSetHeaders:!0,config:b,payloadInstanceCacheKey:d,request:e}),{config:j}=i,k=c??new URL(g.url).pathname,l=(0,bF.formatAdminURL)({apiRoute:j.routes.api,path:""});if(!k.startsWith(l))return cg(g,k);let m=k.replace(l,""),n=!1;m.startsWith("/globals")&&(n=!0,m=m.replace("/globals",""));let o=m.split("/");o.shift();let p=o[0];p&&(n?a=i.globals.config.find(a=>a.slug===p):i.collections[p]&&(h=i.collections[p]));let q=j.endpoints;if(h?(q=h.config.endpoints,m=m.replace(`/${h.config.slug}`,"")):a&&(m=m.replace(`/${a.slug}`,""),q=a.endpoints),""===m&&(m="/"),!1===q)return Response.json({message:`Cannot ${g.method?.toUpperCase()} ${g.url}`},{headers:(0,cb.headersWithCors)({headers:new Headers,req:g}),status:b9.status.NOT_IMPLEMENTED});let r=q?.find(b=>{if(b.method!==g.method?.toLowerCase())return!1;let c=(0,ca.match)(b.path,{decode:decodeURIComponent})(m);return!!c&&(g.routeParams=c.params,h?g.routeParams.collection=h.config.slug:a&&(g.routeParams.global=a.slug),!0)});if(r&&(f=r.handler),!f){if(g.method?.toLowerCase()==="options")return Response.json({},{headers:(0,cb.headersWithCors)({headers:new Headers,req:g}),status:200});return cg(g,k)}let s=await f(g);return new Response(s.body,{headers:(0,cb.headersWithCors)({headers:(0,cc.mergeHeaders)(g.responseHeaders??new Headers,s.headers),req:g}),status:s.status,statusText:s.statusText})}catch(a){return cf({collection:h,config:b,err:a,req:g})}};var ci=a.i(718156),cj=a.i(309528),ck=a.i(58568),cl=a.i(654229),cm=a.i(505711),cn=a.i(671907),co=a.i(739861),cp=a.i(388885),cq=a.i(79471),cr=a.i(981316),cs=a.i(466427),ct=a.i(412945),cu=a.i(625620),cv=a.i(2469),cw=a.i(330114),cx=a.i(377266),cy=a.i(266180),cz=a.i(639119),cA=a.i(360441),cB=a.i(79915),cC=a.i(800664),cD=a.i(268341),cE=a.i(55801),cF=a.i(441605);let cG=a=>a.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"").replace(/-/g,"_");function cH(a,b,c){c.logger.info({msg:`Processing ${a.length} version records`});let d=new Map,e=new Map;for(let c of a){let a=c.id,f=c.parent,g=c._status,h=c.published_locale||c.publishedLocale,i=!0===c.snapshot;if(!d.has(f)){let a=new Map;for(let c of b)a.set(c,"draft");d.set(f,a)}let j=d.get(f),k=new Map;if(i)for(let[a,b]of j.entries())k.set(a,b);else if("published"===g)if(h)for(let[a,b]of(j.set(h,"published"),j.entries()))k.set(a,b);else for(let a of b)j.set(a,"published"),k.set(a,"published");else for(let a of b)j.set(a,"draft"),k.set(a,"draft");e.set(a,k)}return e}let cI=async function(a){let{collectionSlug:b,globalSlug:c,payload:d}=a;if(!b&&!c)throw Error("Either collectionSlug or globalSlug must be provided");if(b&&c)throw Error("Cannot provide both collectionSlug and globalSlug");let e=b||c,f=`_${e}_versions`.toLowerCase();if(!d.config.localization)throw Error("Localization is not enabled in payload config");let g=b?d.config.collections.find(a=>a.slug===b):d.config.globals.find(a=>a.slug===c);if(!g)throw Error(`${b?"Collection":"Global"} not found: ${b||c}`);if((0,a_.hasLocalizeStatusEnabled)(g))throw Error(`${e} has localizeStatus enabled, cannot run down migration. Please disable localizeStatus in your config before rolling back this migration.`);let h=d.config.localization.defaultLocale;d.logger.info({msg:`Rolling back _status localization migration for ${b?"collection":"global"}: ${e}`});let i=d.db.connection;d.logger.info({msg:"Fetching all version documents..."});let j=await i.collection(f).find({}).toArray();d.logger.info({msg:`Found ${j.length} version documents`});let k=0;for(let a of j){let b=a.version?._status;if(!b||"string"==typeof b)continue;let c="object"==typeof b&&b[h]||"draft";await i.collection(f).updateOne({_id:a._id},{$set:{"version._status":c}}),k++}if(d.logger.info({msg:`Updated ${k} version documents`}),b){let a=await i.collection(b).findOne({});if(a&&"_status"in a&&"object"==typeof a._status){d.logger.info({msg:`Rolling back main collection documents for: ${b}`});let a=await i.collection(b).find({}).toArray();for(let c of a)if("object"==typeof c._status&&!Array.isArray(c._status)){let a=c._status[h]||"draft";await i.collection(b).updateOne({_id:c._id},{$set:{_status:a}})}d.logger.info({msg:`Rolled back ${a.length} collection documents`})}}else if(c){let a=await i.collection("globals").findOne({globalType:c});if(a&&"_status"in a&&"object"==typeof a.status){d.logger.info({msg:`Rolling back main global document for: ${c}`});let b="object"==typeof a._status&&!Array.isArray(a._status)&&a._status[h]||"draft";await i.collection("globals").updateOne({_id:a._id,globalType:c},{$set:{_status:b}}),d.logger.info({msg:"Rolled back global document"})}}d.logger.info({msg:"Rollback completed successfully"})},cJ=async function(a){let b,{collectionSlug:c,globalSlug:d,payload:e,req:f}=a;if(!c&&!d)throw Error("Either collectionSlug or globalSlug must be provided");if(c&&d)throw Error("Cannot provide both collectionSlug and globalSlug");let g=c||d,h=`_${g}_versions`.toLowerCase();if(!e.config.localization)throw Error("Localization is not enabled in payload config");if(c){let a=e.config.collections.find(a=>a.slug===c);a&&(b=a)}else if(d){let a=e.config.globals.find(a=>a.slug===d);a&&(b=a)}if(!b)throw Error(`${c?"Collection":"Global"} not found: ${c||d}`);if(e.logger.info({msg:`Starting _status localization migration for ${c?"collection":"global"}: ${g}`}),!b.versions)return void e.logger.info({msg:`Skipping migration for ${c?"collection":"global"}: ${g} - versions not enabled`});let i=e.db.connection,j=e.config.localization.localeCodes;"function"==typeof e.config.localization.filterAvailableLocales&&(j=(await e.config.localization.filterAvailableLocales({locales:e.config.localization.locales,req:f})).map(a=>a.code)),e.logger.info({msg:`Locales: ${j.join(", ")}`});let k=await i.collection(h).findOne({});if(!k)return void e.logger.info({msg:"No version documents found, nothing to migrate"});if(k.version?._status&&"object"==typeof k.version._status&&!Array.isArray(k.version._status))return void e.logger.info({msg:"version._status is already localized, migration already completed"});if(!k.version||"string"!=typeof k.version._status||Array.isArray(k.version._status))throw Error(`Migration aborted: version._status field not found or has unexpected format in ${h}. This migration should only run on schemas that have NOT yet been migrated to per-locale status.`);e.logger.info({msg:"Fetching all version documents..."});let l=await i.collection(h).find({}).sort({createdAt:1,parent:1}).toArray();e.logger.info({msg:`Found ${l.length} version documents`});let m=cH(l.map(a=>({id:a._id.toString(),_status:a.version._status,createdAt:a.createdAt,parent:a.parent?.toString(),publishedLocale:a.publishedLocale,snapshot:a.snapshot||!1})),j,e);e.logger.info({msg:"Updating version documents with per-locale status..."});let n=0;for(let a of l){let b=a._id.toString(),c=m.get(b);if(!c){e.logger.warn({msg:`No status map found for version ${b}, skipping`});continue}let d={};for(let[a,b]of c.entries())d[a]=b;await i.collection(h).updateOne({_id:a._id},{$set:{"version._status":d}}),n++}if(e.logger.info({msg:`Updated ${n} version documents`}),c){let a=await i.collection(c).findOne({});if(a&&"_status"in a){e.logger.info({msg:`Migrating main collection documents for: ${c}`});let a=await i.collection(c).find({}).toArray();for(let b of a){if(!b._id)continue;let a=await i.collection(h).find({parent:b._id}).sort({createdAt:-1}).limit(1).toArray(),d={};if(a.length>0&&a[0]?.version?._status)d=a[0].version._status;else for(let a of j)d[a]="draft";await i.collection(c).updateOne({_id:b._id},{$set:{_status:d}})}e.logger.info({msg:`Migrated ${a.length} collection documents`})}else e.logger.info({msg:"Skipping main document status migration (no status field found)"})}else if(d){let a=await i.collection("globals").findOne({globalType:d});if(a&&"_status"in a&&a._id){e.logger.info({msg:`Migrating main global document for: ${d}`});let b=await i.collection(h).find({}).sort({createdAt:-1}).limit(1).toArray(),c={};if(b.length>0&&b[0]?.version?._status)c=b[0].version._status;else for(let a of j)c[a]="draft";await i.collection("globals").updateOne({_id:a._id,globalType:d},{$set:{_status:c}}),e.logger.info({msg:"Migrated global document"})}else e.logger.info({msg:"Skipping main document status migration (no status field found)"})}e.logger.info({msg:"Migration completed successfully"})};async function cK({collectionSlug:a,db:b,locales:c,payload:d,sql:e,versionsTable:f}){let g=cG(a),h=`${g}_locales`;d.logger.info({msg:`Migrating main collection locales for: ${h}`});let i=await b.execute({drizzle:b.drizzle,sql:e`
SELECT DISTINCT id
FROM ${e.identifier(g)}
`});for(let a of i.rows)for(let d of c){let c=await b.execute({drizzle:b.drizzle,sql:e`
SELECT l.version__status as _status
FROM ${e.identifier(f)} v
JOIN ${e.raw(`${f}_locales`)} l ON l._parent_id = v.id
WHERE v.parent_id = ${a.id}
AND l._locale = ${d}
ORDER BY v.created_at DESC
LIMIT 1
`}),g=c.rows[0]?._status||"draft";await b.execute({drizzle:b.drizzle,sql:e`
UPDATE ${e.identifier(h)}
SET _status = ${g}
WHERE _parent_id = ${a.id}
AND _locale = ${d}
`})}d.logger.info({msg:`Migrated ${i.rows.length} collection documents`})}async function cL({db:a,globalSlug:b,locales:c,payload:d,sql:e,versionsTable:f}){let g=cG(b),h=`${g}_locales`;for(let i of(d.logger.info({msg:`Migrating main global locales for: ${h}`}),c)){let c=await a.execute({drizzle:a.drizzle,sql:e`
SELECT l.version__status as _status
FROM ${e.identifier(f)} v
JOIN ${e.raw(`${f}_locales`)} l ON l._parent_id = v.id
WHERE l._locale = ${i}
ORDER BY v.created_at DESC
LIMIT 1
`}),j=c.rows[0]?._status||"draft",k=await a.execute({drizzle:a.drizzle,sql:e`
SELECT id FROM ${e.identifier(g)} LIMIT 1
`});if(0===k.rows.length){d.logger.warn({msg:`No global document found for ${b}, skipping`});continue}let l=k.rows[0].id;await a.execute({drizzle:a.drizzle,sql:e`
UPDATE ${e.identifier(h)}
SET _status = ${j}
WHERE _parent_id = ${l}
AND _locale = ${i}
`})}d.logger.info({msg:"Migrated global document"})}let cM=async function(a){let{collectionSlug:b,db:c,globalSlug:d,payload:e,sql:f}=a;if(!b&&!d)throw Error("Either collectionSlug or globalSlug must be provided");if(b&&d)throw Error("Cannot provide both collectionSlug and globalSlug");let g=b||d,h=b?`_${cG(b)}_v`:`_${cG(d)}_v`,i=`${h}_locales`;if(!e.config.localization)throw Error("Localization is not enabled in payload config");let j=b?e.config.collections.find(a=>a.slug===b):e.config.globals.find(a=>a.slug===d);if(!j)throw Error(`${b?"Collection":"Global"} not found: ${b||d}`);if((0,a_.hasLocalizeStatusEnabled)(j))throw Error(`${g} has localizeStatus enabled, cannot run down migration. Please disable localizeStatus in your config before rolling back this migration.`);let k=e.config.localization.defaultLocale;e.logger.info({msg:`Rolling back _status localization migration for ${b?"collection":"global"}: ${g}`}),e.logger.info({msg:`Restoring version__status column to ${h}`}),await c.execute({drizzle:c.drizzle,sql:f`
ALTER TABLE ${f.identifier(h)} ADD COLUMN version__status VARCHAR
`}),e.logger.info({msg:`Copying status from default locale (${k}) back to main table`}),await c.execute({drizzle:c.drizzle,sql:f`
UPDATE ${f.identifier(h)} pv
SET version__status = pl.version__status
FROM ${f.identifier(i)} pl
WHERE pv.id = pl._parent_id
AND pl._locale = ${k}
`});let l=await c.execute({drizzle:c.drizzle,sql:f`
SELECT COUNT(*) as count
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = ${i}
AND column_name NOT IN ('id', '_locale', '_parent_id', 'version__status')
`});Number(l.rows[0]?.count)>0?(e.logger.info({msg:`Dropping version__status column from ${i}`}),await c.execute({drizzle:c.drizzle,sql:f`
ALTER TABLE ${f.identifier(i)} DROP COLUMN version__status
`})):(e.logger.info({msg:`Dropping entire locales table: ${i}`}),await c.execute({drizzle:c.drizzle,sql:f`DROP TABLE ${f.identifier(i)} CASCADE`}));let m=b?cG(b):cG(d),n=`${m}_locales`,o=await c.execute({drizzle:c.drizzle,sql:f`
SELECT EXISTS (
SELECT FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = ${m}
AND column_name = '_status'
) as exists
`});if(!o.rows[0]?.exists){let a=await c.execute({drizzle:c.drizzle,sql:f`
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = ${n}
) as exists
`});if(a.rows[0]?.exists){let a=await c.execute({drizzle:c.drizzle,sql:f`
SELECT EXISTS (
SELECT FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = ${n}
AND column_name = '_status'
) as exists
`});a.rows[0]?.exists&&(e.logger.info({msg:`Restoring _status column to ${m}`}),await c.execute({drizzle:c.drizzle,sql:f`
ALTER TABLE ${f.identifier(m)} ADD COLUMN _status VARCHAR
`}),await c.execute({drizzle:c.drizzle,sql:f`
UPDATE ${f.identifier(m)} m
SET _status = l._status
FROM ${f.identifier(n)} l
WHERE m.id = l._parent_id
AND l._locale = ${k}
`}),e.logger.info({msg:`Dropping _status column from ${n}`}),await c.execute({drizzle:c.drizzle,sql:f`
ALTER TABLE ${f.identifier(n)} DROP COLUMN _status
`}))}else{e.logger.info({msg:`Restoring _status column to ${m} (no locales table exists)`}),await c.execute({drizzle:c.drizzle,sql:f`
ALTER TABLE ${f.identifier(m)} ADD COLUMN _status VARCHAR
`});let a=await c.execute({drizzle:c.drizzle,sql:f`
SELECT DISTINCT id
FROM ${f.identifier(m)}
`});for(let b of a.rows){let a=await c.execute({drizzle:c.drizzle,sql:f`
SELECT version__status
FROM ${f.identifier(h)}
WHERE parent_id = ${b.id}
ORDER BY created_at DESC
LIMIT 1
`}),d=a.rows[0]?.version__status||"draft";await c.execute({drizzle:c.drizzle,sql:f`
UPDATE ${f.identifier(m)}
SET _status = ${d}
WHERE id = ${b.id}
`})}e.logger.info({msg:`Restored _status for ${a.rows.length} documents`})}}e.logger.info({msg:"Rollback completed successfully"})},cN=async function(a){let b,{collectionSlug:c,db:d,globalSlug:e,payload:f,req:g,sql:h}=a;if(!c&&!e)throw Error("Either collectionSlug or globalSlug must be provided");if(c&&e)throw Error("Cannot provide both collectionSlug and globalSlug");let i=c||e,j=c?`_${cG(c)}_v`:`_${cG(e)}_v`,k=`${j}_locales`;if(!f.config.localization)throw Error("Localization is not enabled in payload config");if(c){let a=f.config.collections.find(a=>a.slug===c);a&&(b=a)}else if(e){let a=f.config.globals.find(a=>a.slug===e);a&&(b=a)}if(!b)throw Error(`${c?"Collection":"Global"} not found: ${c||e}`);f.logger.info({msg:`Starting _status localization migration for ${c?"collection":"global"}: ${i}`});let l=f.config.localization.localeCodes;if("function"==typeof f.config.localization.filterAvailableLocales&&(l=(await f.config.localization.filterAvailableLocales({locales:f.config.localization.locales,req:g})).map(a=>a.code)),f.logger.info({msg:`Locales: ${l.join(", ")}`}),!b.versions)return void f.logger.info({msg:`Skipping migration for ${c?"collection":"global"}: ${i} - versions not enabled`});let m=await d.execute({drizzle:d.drizzle,sql:h`
SELECT EXISTS (
SELECT FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = ${j}
AND column_name = 'version__status'
) as exists
`});if(!m.rows[0]?.exists)throw Error(`Migration aborted: version__status column not found in ${j} table. This migration should only run on schemas that have NOT yet been migrated to per-locale status. If you've already run this migration, no action is needed.`);let n=await d.execute({drizzle:d.drizzle,sql:h`
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = ${k}
) as exists
`});if(n.rows[0]?.exists){f.logger.info({msg:`Adding version__status column to existing table: ${k}`}),await d.execute({drizzle:d.drizzle,sql:h`
ALTER TABLE ${h.identifier(k)} ADD COLUMN version__status VARCHAR
`}),f.logger.info({msg:"Processing version history to determine status per locale..."});let a=(await d.execute({drizzle:d.drizzle,sql:h`
SELECT DISTINCT _locale
FROM ${h.identifier(k)}
ORDER BY _locale
`})).rows.map(a=>a._locale);f.logger.info({msg:`Found existing locales in table: ${a.join(", ")}`});let b=cH((await d.execute({drizzle:d.drizzle,sql:h`
SELECT id, parent_id as parent, version__status as _status, published_locale, snapshot, created_at
FROM ${h.identifier(j)}
ORDER BY parent_id, created_at ASC
`})).rows,a,f);f.logger.info({msg:"Updating locales table with calculated statuses..."});let c=0;for(let[a,e]of b.entries())for(let[b,f]of e.entries())await d.execute({drizzle:d.drizzle,sql:h`
UPDATE ${h.identifier(k)}
SET version__status = ${f}
WHERE _parent_id = ${a}
AND _locale = ${b}
`}),c++;f.logger.info({msg:`Updated ${c} locale rows with status`})}else for(let a of(f.logger.info({msg:`Creating new locales table: ${k}`}),await d.execute({drizzle:d.drizzle,sql:h`
CREATE TABLE ${h.identifier(k)} (
id SERIAL PRIMARY KEY,
_locale VARCHAR NOT NULL,
_parent_id INTEGER NOT NULL,
version__status VARCHAR,
UNIQUE(_locale, _parent_id),
FOREIGN KEY (_parent_id) REFERENCES ${h.identifier(j)}(id) ON DELETE CASCADE
)
`}),l)){let b=await d.execute({drizzle:d.drizzle,sql:h`
INSERT INTO ${h.identifier(k)} (_locale, _parent_id, version__status)
SELECT ${a}, id, version__status
FROM ${h.identifier(j)}
RETURNING id
`});f.logger.info({msg:`Inserted ${b.length} rows for locale: ${a}`})}await d.execute({drizzle:d.drizzle,sql:h`
ALTER TABLE ${h.identifier(j)} DROP COLUMN version__status
`});let o=c?cG(c):cG(e),p=`${o}_locales`,q=await d.execute({drizzle:d.drizzle,sql:h`
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = ${p}
) as exists
`});if(q.rows[0]?.exists){let a=await d.execute({drizzle:d.drizzle,sql:h`
SELECT EXISTS (
SELECT FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = ${p}
AND column_name = '_status'
) as exists
`});a.rows[0]?.exists||await d.execute({drizzle:d.drizzle,sql:h`
ALTER TABLE ${h.identifier(p)}
ADD COLUMN _status VARCHAR DEFAULT 'draft'
`}),c?await cK({collectionSlug:c,db:d,locales:l,payload:f,sql:h,versionsTable:j}):e&&await cL({db:d,globalSlug:e,locales:l,payload:f,sql:h,versionsTable:j})}else f.logger.info({msg:`No locales table found: ${p} (collection/global not localized)`});let r=await d.execute({drizzle:d.drizzle,sql:h`
SELECT EXISTS (
SELECT FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = ${o}
AND column_name = '_status'
) as exists
`});r.rows[0]?.exists&&await d.execute({drizzle:d.drizzle,sql:h`
ALTER TABLE ${h.identifier(o)} DROP COLUMN _status
`}),f.logger.info({msg:"Migration completed successfully"})};var cO=a.i(646294),cP=a.i(16216);a.s(["APIError",()=>ay.APIError,"APIErrorName",()=>ay.APIErrorName,"AuthenticationError",()=>az.AuthenticationError,"BasePayload",()=>b.BasePayload,"DatabaseKVAdapter",()=>bk.DatabaseKVAdapter,"DuplicateCollection",()=>aA.DuplicateCollection,"DuplicateFieldName",()=>aB.DuplicateFieldName,"DuplicateGlobal",()=>aD,"EntityType",()=>c.EntityType,"ErrorDeletingFile",()=>aE.ErrorDeletingFile,"FileRetrievalError",()=>aF.FileRetrievalError,"FileUploadError",()=>aG.FileUploadError,"Forbidden",()=>aH.Forbidden,"InMemoryKVAdapter",()=>bl,"InvalidConfiguration",()=>aI.InvalidConfiguration,"InvalidFieldName",()=>aJ.InvalidFieldName,"InvalidFieldRelationship",()=>aK.InvalidFieldRelationship,"JWTAuthentication",()=>F.JWTAuthentication,"JobCancelledError",()=>bo.JobCancelledError,"Locked",()=>aL.Locked,"LockedAuth",()=>aM.LockedAuth,"MissingCollectionLabel",()=>aO,"MissingEditorProp",()=>aP.MissingEditorProp,"MissingFieldInputOptions",()=>aR,"MissingFieldType",()=>aS.MissingFieldType,"MissingFile",()=>aT.MissingFile,"NotFound",()=>aU.NotFound,"QueryError",()=>aV.QueryError,"UnauthorizedError",()=>aW.UnauthorizedError,"UnverifiedEmail",()=>aX.UnverifiedEmail,"ValidationError",()=>aY.ValidationError,"ValidationErrorName",()=>aY.ValidationErrorName,"_internal_jobSystemGlobals",()=>br._internal_jobSystemGlobals,"_internal_resetJobSystemGlobals",()=>br._internal_resetJobSystemGlobals,"_internal_safeFetchGlobal",()=>bv._internal_safeFetchGlobal,"accessOperation",()=>u.accessOperation,"addDataAndFileToRequest",()=>bw.addDataAndFileToRequest,"addLocalesToRequestFromData",()=>bx.addLocalesToRequestFromData,"afterChangeTraverseFields",()=>a6.traverseFields,"afterReadPromise",()=>a7.promise,"afterReadTraverseFields",()=>a8.traverseFields,"appendVersionToQueryKey",()=>cB.appendVersionToQueryKey,"baseAPIKeyFields",()=>e.apiKeyFields,"baseAccountLockFields",()=>d.accountLockFields,"baseAuthFields",()=>f.baseAuthFields,"baseBlockFields",()=>aZ.baseBlockFields,"baseEmailField",()=>g.emailFieldConfig,"baseIDField",()=>a$.baseIDField,"baseSessionsField",()=>h.sessionsFieldConfig,"baseUsernameField",()=>i.usernameFieldConfig,"baseVerificationFields",()=>j.verificationFields,"beforeChangeTraverseFields",()=>a9.traverseFields,"beforeValidateTraverseFields",()=>ba.traverseFields,"buildConfig",()=>ab.buildConfig,"buildVersionCollectionFields",()=>cw.buildVersionCollectionFields,"buildVersionCompoundIndexes",()=>cy.buildVersionCompoundIndexes,"buildVersionGlobalFields",()=>cx.buildVersionGlobalFields,"canAccessAdmin",()=>by.canAccessAdmin,"checkDependencies",()=>b0,"checkLoginPermission",()=>x.checkLoginPermission,"combineQueries",()=>af.combineQueries,"commitTransaction",()=>bz.commitTransaction,"configToJSONSchema",()=>bA.configToJSONSchema,"countOperation",()=>Q.countOperation,"countRunnableOrActiveJobsForQueue",()=>bp.countRunnableOrActiveJobsForQueue,"createArrayFromCommaDelineated",()=>bB.createArrayFromCommaDelineated,"createClientBlocks",()=>a3.createClientBlocks,"createClientCollectionConfig",()=>O.createClientCollectionConfig,"createClientCollectionConfigs",()=>O.createClientCollectionConfigs,"createClientConfig",()=>ac.createClientConfig,"createClientField",()=>a3.createClientField,"createClientFields",()=>a3.createClientFields,"createClientGlobalConfig",()=>bd.createClientGlobalConfig,"createClientGlobalConfigs",()=>bd.createClientGlobalConfigs,"createDatabaseAdapter",()=>ag.createDatabaseAdapter,"createDataloaderCacheKey",()=>P.createDataloaderCacheKey,"createLocalReq",()=>bC.createLocalReq,"createMigration",()=>aj.createMigration,"createOperation",()=>R.createOperation,"createPayloadRequest",0,bI,"createUnauthenticatedClientConfig",()=>ac.createUnauthenticatedClientConfig,"databaseKVAdapter",()=>bk.databaseKVAdapter,"deepCopyObject",()=>bJ.deepCopyObject,"deepCopyObjectComplex",()=>bJ.deepCopyObjectComplex,"deepCopyObjectSimple",()=>bJ.deepCopyObjectSimple,"deepMerge",()=>bK.deepMerge,"deepMergeSimple",()=>cP.deepMergeSimple,"deepMergeWithCombinedArrays",()=>bL.deepMergeWithCombinedArrays,"deepMergeWithReactComponents",()=>bL.deepMergeWithReactComponents,"deepMergeWithSourceArrays",()=>bL.deepMergeWithSourceArrays,"default",()=>b.default,"defaultBeginTransaction",()=>ah.defaultBeginTransaction,"defaultLoggerOptions",()=>K.defaultLoggerOptions,"defaults",()=>ad.defaults,"deleteByIDOperation",()=>T.deleteByIDOperation,"deleteCollectionVersions",()=>cA.deleteCollectionVersions,"deleteOperation",()=>S.deleteOperation,"docAccessOperation",()=>U.docAccessOperation,"docAccessOperationGlobal",()=>be.docAccessOperation,"docHasTimestamps",()=>bt.docHasTimestamps,"duplicateOperation",()=>V.duplicateOperation,"dynamicImport",()=>b1.dynamicImport,"enforceMaxVersions",()=>cD.enforceMaxVersions,"entityToJSONSchema",()=>bA.entityToJSONSchema,"escapeRegExp",0,a=>a.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),"executeAccess",()=>k.executeAccess,"executeAuthStrategies",()=>l.executeAuthStrategies,"extractAccessFromPermission",()=>m.extractAccessFromPermission,"extractJWT",()=>r.extractJWT,"fieldsToJSONSchema",()=>bA.fieldsToJSONSchema,"findByIDOperation",()=>X.findByIDOperation,"findMigrationDir",()=>ak.findMigrationDir,"findOneOperation",()=>bf.findOneOperation,"findOperation",()=>W.findOperation,"findUp",()=>bP.findUp,"findUpSync",()=>bP.findUpSync,"findVersionByIDOperation",()=>Y.findVersionByIDOperation,"findVersionByIDOperationGlobal",()=>bg.findVersionByIDOperation,"findVersionsOperation",()=>Z.findVersionsOperation,"findVersionsOperationGlobal",()=>bh.findVersionsOperation,"flattenAllFields",()=>b2.flattenAllFields,"flattenTopLevelFields",()=>b3.flattenTopLevelFields,"flattenWhereToOperators",()=>function a(b){let c=[];for(let[d,e]of Object.entries(b))if(("and"===d||"or"===d)&&Array.isArray(e))for(let b of e){let d=a(b);c.push(...d)}else c.push(e);return c},"forgotPasswordOperation",()=>v.forgotPasswordOperation,"formatErrors",()=>b4.formatErrors,"formatLabels",()=>b5.formatLabels,"formatNames",()=>b5.formatNames,"genImportMapIterateFields",()=>J.genImportMapIterateFields,"generateCookie",()=>q.generateCookie,"generateExpiredPayloadCookie",()=>q.generateExpiredPayloadCookie,"generateImportMap",()=>I.generateImportMap,"generatePayloadCookie",()=>q.generatePayloadCookie,"getAccessResults",()=>n.getAccessResults,"getBlockSelect",()=>b6.getBlockSelect,"getCollectionIDFieldTypes",()=>b7.getCollectionIDFieldTypes,"getCookieExpiration",()=>q.getCookieExpiration,"getCurrentDate",()=>br.getCurrentDate,"getDataLoader",()=>P.getDataLoader,"getDefaultValue",()=>a5.getDefaultValue,"getDependencies",()=>bX,"getFieldByPath",()=>b8.getFieldByPath,"getFieldsToSign",()=>o.getFieldsToSign,"getFileByPath",()=>bu.getFileByPath,"getFolderData",()=>bc.getFolderData,"getLatestCollectionVersion",()=>cE.getLatestCollectionVersion,"getLatestGlobalVersion",()=>cF.getLatestGlobalVersion,"getLocalI18n",()=>bs.getLocalI18n,"getLocalizedPaths",()=>ai.getLocalizedPaths,"getLoginOptions",()=>p.getLoginOptions,"getMigrations",()=>al.getMigrations,"getObjectDotNotation",0,(a,b,c)=>{if(!b||!a)return c;let d=b.split(".").reduce((a,b)=>a?.[b],a);return void 0===d?c:d},"getPayload",()=>b.getPayload,"getPredefinedMigration",()=>am.getPredefinedMigration,"getQueryDraftsSort",()=>cC.getQueryDraftsSort,"getRequestLanguage",()=>bG.getRequestLanguage,"handleEndpoints",0,ch,"hasWhereAccessResult",()=>s.hasWhereAccessResult,"headersWithCors",()=>cb.headersWithCors,"importHandlerPath",()=>bq.importHandlerPath,"inMemoryKVAdapter",0,bm,"incrementLoginAttempts",()=>G.incrementLoginAttempts,"initOperation",()=>w.initOperation,"initTransaction",()=>ci.initTransaction,"isEntityHidden",()=>cj.isEntityHidden,"isPlainObject",()=>cl.isPlainObject,"isValidID",()=>cm.isValidID,"isolateObjectProperty",()=>ck.isolateObjectProperty,"jobAfterRead",()=>bn.jobAfterRead,"jwtSign",()=>t.jwtSign,"killTransaction",()=>cn.killTransaction,"localizeStatus",0,{async up(a){if("db"in a&&"sql"in a)return cN(a);if("payload"in a&&!("db"in a))return cJ(a);throw Error("Unable to detect database type. Expected either { db, sql } for SQL databases or { payload } for MongoDB.")},async down(a){if("db"in a&&"sql"in a)return cM(a);if("payload"in a&&!("db"in a))return cI(a);throw Error("Unable to detect database type. Expected either { db, sql } for SQL databases or { payload } for MongoDB.")}},"logError",()=>ce.logError,"loginOperation",()=>x.loginOperation,"logoutOperation",()=>y.logoutOperation,"mapAsync",()=>co.mapAsync,"meOperation",()=>z.meOperation,"mergeHeaders",()=>cc.mergeHeaders,"migrate",()=>an.migrate,"migrateCLI",0,N,"migrateDown",()=>ao.migrateDown,"migrateRefresh",()=>ap.migrateRefresh,"migrateReset",()=>aq.migrateReset,"migrateStatus",()=>ar.migrateStatus,"migrationTemplate",()=>at.migrationTemplate,"migrationsCollection",()=>as.migrationsCollection,"parseCookies",()=>q.parseCookies,"parseDocumentID",()=>cp.parseDocumentID,"pathExistsAndIsAccessible",()=>bP.pathExistsAndIsAccessible,"pathExistsAndIsAccessibleSync",()=>bP.pathExistsAndIsAccessibleSync,"readMigrationFiles",()=>au.readMigrationFiles,"refreshOperation",()=>A.refreshOperation,"registerFirstUserOperation",()=>B.registerFirstUserOperation,"reload",()=>b.reload,"resetLoginAttempts",()=>H.resetLoginAttempts,"resetPasswordOperation",()=>C.resetPasswordOperation,"restoreVersionOperation",()=>$.restoreVersionOperation,"restoreVersionOperationGlobal",()=>bi.restoreVersionOperation,"sanitizeConfig",()=>ae.sanitizeConfig,"sanitizeFallbackLocale",()=>cq.sanitizeFallbackLocale,"sanitizeFields",()=>a4.sanitizeFields,"sanitizeJoinParams",()=>cr.sanitizeJoinParams,"sanitizeLocales",()=>bx.sanitizeLocales,"sanitizePopulateParam",()=>cs.sanitizePopulateParam,"sanitizeSelectParam",()=>ct.sanitizeSelectParam,"saveVersion",()=>cO.saveVersion,"serverOnlyAdminConfigProperties",()=>ac.serverOnlyAdminConfigProperties,"serverOnlyConfigProperties",()=>ac.serverOnlyConfigProperties,"slugField",0,({name:a="slug",checkboxName:b="generateSlug",disableUnique:c=!1,fieldToUse:d,localized:e,overrides:f,position:g="sidebar",required:h=!0,slugify:i,useAsSlug:j="title"}={})=>{let k=d||j,l={type:"row",admin:{position:g},fields:[{name:b,type:"checkbox",admin:{description:"When enabled, the slug will auto-generate from the title field on save and autosave.",disableBulkEdit:!0,disableGroupBy:!0,disableListColumn:!0,disableListFilter:!0,hidden:!0},defaultValue:!0,hooks:{beforeChange:[(({slugFieldName:a,slugify:b,useAsSlug:c})=>async({collection:d,data:e,global:f,operation:g,originalDoc:h,req:i,value:j})=>{if("create"===g)return e&&(e[a]=a2({customSlugify:b,data:e,req:i,valueToSlugify:e?.[a]||e?.[c]})),!e?.[a];if("update"===g){if(!j)return!1;if(!(0,a_.hasAutosaveEnabled)(d||f))return e&&(e[a]=a2({customSlugify:b,data:e,req:i,valueToSlugify:e?.[c]})),!e?.[a];{let g=e?._status==="published",j=e?.[a]!==h?.[a];return!j&&e&&(e[a]=e?.[c]?a2({customSlugify:b,data:e,req:i,valueToSlugify:e?.[c]}):null),!g&&!j&&await a1({collectionSlug:d?.slug,globalSlug:f?.slug,parentID:h?.id,req:i})<=2}}})({slugFieldName:a,slugify:i,useAsSlug:k})]},localized:e},{name:a,type:"text",admin:{components:{Field:{clientProps:{useAsSlug:k},path:"@payloadcms/next/client#SlugField"}},width:"100%"},custom:{slugify:i},index:!0,localized:e,required:h,unique:!c}]};return"function"==typeof f?f(l):l},"sortableFieldTypes",0,["text","textarea","code","json","number","email","radio","select","date"],"stripUnselectedFields",()=>cu.stripUnselectedFields,"toWords",()=>b5.toWords,"traverseFields",()=>cv.traverseFields,"unlockOperation",()=>D.unlockOperation,"updateByIDOperation",()=>aa.updateByIDOperation,"updateOperation",()=>_.updateOperation,"updateOperationGlobal",()=>bj.updateOperation,"validateBlocksFilterOptions",()=>bb.validateBlocksFilterOptions,"validateQueryPaths",()=>aw.validateQueryPaths,"validateSearchParam",()=>ax.validateSearchParam,"validations",()=>bb.validations,"verifyEmailOperation",()=>E.verifyEmailOperation,"versionDefaults",()=>cz.versionDefaults,"withNullableJSONSchemaType",()=>bA.withNullableJSONSchemaType,"writeMigrationIndex",()=>av.writeMigrationIndex],723860)}];
//# debugId=fd81393a-aaa2-03b2-b9e3-8e49735cf60c
//# sourceMappingURL=16097_payload_dist_index_4a2611c5.js.map