strapi-plugin-navigation 3.3.3-beta.2 → 3.3.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const B=require("lodash"),Qr=require("zod"),C=require("lodash/fp"),Bu=require("crypto"),Uu=require("child_process"),Gu=require("lodash/has"),qu=require("lodash/mapValues"),Ku=require("lodash/snakeCase"),Wu=require("lodash/camelCase"),zu=require("lodash/mapKeys"),Yu=require("os"),Qu=require("path"),Vu=require("fs"),Xu=require("assert"),Zu=require("events"),Ju=require("buffer"),ec=require("stream"),tc=require("util"),nc=require("constants");require("node:stream");const rc=require("@sindresorhus/slugify"),ic=require("zod/v4"),oc=require("pluralize"),ue=e=>e&&e.__esModule?e:{default:e};function sa(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ge=ue(B),y=sa(Qr),Li=ue(Bu),pn=ue(Uu),dn=ue(Gu),ua=ue(qu),ki=ue(Ku),ac=ue(Wu),sc=ue(zu),kn=ue(Yu),Se=ue(Qu),We=ue(Vu),ca=ue(Xu),uc=ue(Zu),cc=ue(Ju),Dn=ue(ec),it=ue(tc),lc=ue(nc),fc=ue(rc),z=sa(ic),pc=ue(oc),Vr=y.object({name:y.string({required_error:"requiredError"}).nonempty("requiredError").refine(e=>!e.includes(" "),{message:"noSpaceError"}),label:y.string({required_error:"requiredError"}).nonempty("requiredError"),description:y.string().optional(),placeholder:y.string().optional(),required:y.boolean().optional(),enabled:y.boolean().optional()}),dc=Vr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string(),{required_error:"requiredError"}).min(1,{message:"requiredError"})}),hc=Vr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),mc=Vr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),la=y.discriminatedUnion("type",[hc,mc,dc]),fa=y.union([y.literal("audience"),la]),gc=y.object({additionalFields:y.array(fa),allowedLevels:y.number(),contentTypes:y.array(y.string()),defaultContentType:y.string().optional(),contentTypesNameFields:y.record(y.string(),y.array(y.string())),contentTypesPopulate:y.record(y.string(),y.array(y.string())),gql:y.object({navigationItemRelated:y.array(y.string())}),pathDefaultFields:y.record(y.string(),y.any()),cascadeMenuAttached:y.boolean(),preferCustomContentTypes:y.boolean(),isCacheEnabled:y.boolean().optional()}),pa=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),yc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Xr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:yc,path:y.string().or(y.null()).optional(),slug:y.string().or(y.null()).optional(),externalPath:y.string().or(y.null()).optional(),uiRouterKey:y.string(),menuAttached:y.boolean(),order:y.number().int(),collapsed:y.boolean(),related:y.object({documentId:y.string().optional(),__type:y.string()}).catchall(y.unknown()).nullish().optional(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(pa).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),vc=Xr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown().optional()}),Lt=Xr.extend({parent:y.lazy(()=>Lt.or(y.null())).optional(),items:y.lazy(()=>Lt.array()).optional(),master:y.lazy(()=>Ve(!1)).optional()}),Di=y.array(Lt),Ve=e=>y.object({id:y.number(),documentId:y.string(),name:y.string(),slug:y.string(),locale:y.string(),visible:y.boolean(),items:e?y.array(Lt):Lt.array().optional()}),wc=Ve(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),Ec=Xr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>da).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),da=y.array(Ec),bc=Ve(!1).extend({items:da}).partial().required({id:!0,documentId:!0}),Sc=y.enum(["collectionType","singleType"]),xc=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),ha=y.object({required:y.boolean().optional(),max:y.number().optional(),min:y.number().optional(),minLength:y.number().optional(),maxLength:y.number().optional(),private:y.boolean().optional(),configurable:y.boolean().optional(),default:y.any().optional()}),_c=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Ac=ha.extend({type:_c}),Tc=ha.extend({type:y.literal("enumeration"),enum:y.string().array()}),Cc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),Rc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),Fc=y.object({type:y.literal("uid")}),$c=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),Ic=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Oc=y.object({type:y.literal("relation"),relation:Ic,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),Nc=y.record(y.string(),y.union([Ac,Tc,Cc,Rc,Oc,$c,Fc])),Tr=y.object({kind:Sc,collectionName:y.string(),info:xc,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:Nc,actions:y.record(y.string(),y.any()).optional(),lifecycles:y.record(y.string(),y.any()).optional(),uid:y.string(),apiName:y.string().optional(),associations:y.object({model:y.string(),alias:y.string()}).array().optional(),modelName:y.string().optional(),plugin:y.string().optional(),pluginOptions:y.record(y.string(),y.any()).optional(),isSingle:y.boolean().optional()});Tr.pick({info:!0,kind:!0,attributes:!0,options:!0});const jt=(e,t)=>n=>{t(n(e()))};let Cr=gc;const Pc=jt(()=>Cr,e=>{Cr=e});let Rr=fa;const Lc=jt(()=>Rr,e=>{Rr=e});let Fr=la;const kc=jt(()=>Fr,e=>{Fr=e});let $r=wc;const Dc=jt(()=>$r,e=>{$r=e});let Ir=bc;const Mc=jt(()=>Ir,e=>{Ir=e}),Fe={get configSchema(){return Cr},get navigationItemAdditionalField(){return Rr},get navigationItemCustomField(){return Fr},get createNavigationSchema(){return $r},get updateNavigationSchema(){return Ir}},jc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Hc=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Bc="$",ma=["api::","plugin::"],ga=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Uc=["title","subject","name"],Mi={SINGLE:"singleType"},ji=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Gc=e=>e.filter(t=>t!=="audience"),ya=e=>{const t=Gc(e);if(t.length!==B.uniqBy(t,"name").length)throw new Error("All names of custom fields must be unique.");if(!B.isNil(B.find(t,n=>typeof n=="object"&&B.includes(ji,n.name))))throw new Error(`Name of custom field cannot be one of: ${ji.join(", ")}`)},va=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},qc=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=Kc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Kc=(e="")=>e.split(jc).filter(t=>t&&t.length>0),Wc=(e,t)=>n=>[n,async r=>{await re(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],wa=(e,t)=>Object.fromEntries(Hc.map(Wc(e,t))),we=({strapi:e})=>{const t=e.plugin("navigation");return{masterModel:t.contentType("navigation"),itemModel:t.contentType("navigation-item"),relatedModel:t.contentType("navigations-items-related"),audienceModel:t.contentType("audience")}};function re({strapi:e},t){return e.plugin("navigation").service(t)}const Qt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,zc=(e="")=>{const t=!!ma.find(r=>e.includes(r)),n=!ga.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Yc=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,Qc=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=we(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(pa.array().parse)}})),kt=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Qt(n),status:r,...i})},findById(n,r,i,a={}){return e.strapi.documents(t).findOne({documentId:n,populate:Qt(r),status:i,...a})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Qt(r),status:i})},findMany(n,r,i,a){return e.strapi.documents(t).findMany({where:n,populate:Qt(r),status:i,locale:a})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Le=B.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=we(e),{__type:i,documentId:a}=t?.related??{},o=i?kt(e,i):void 0,s=i&&o?a?await o.findById(a,void 0,void 0,{locale:n}):await o.findFirst(void 0,void 0,{locale:n}):void 0;if(typeof t.documentId=="string"){const{documentId:u,...f}=t;return e.strapi.documents(r.uid).update({documentId:t.documentId,data:{...f,related:s?{...s,__type:i}:void 0},locale:n})}else return e.strapi.documents(r.uid).create({data:{...t,related:s?{...s,__type:i}:void 0},locale:n})},find({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Or)).then(Di.parse).then(s=>s.map(hn))},findV4({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i})},count(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=we(e);return e.strapi.documents(n.uid).delete({documentId:t.documentId,populate:"*"})},removeForIds(t){const{itemModel:n}=we(e);return t.map(r=>e.strapi.documents(n.uid).delete({documentId:r,populate:"*"}))},findForMasterIds(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(Di.parse)}})),Vc=["id","publishedAt","createdAt","updatedAt","locale"],hn=({related:e,items:t=[],...n})=>({...n,items:t.map(hn),related:e?B.omit(e,Vc):void 0}),Or=({related:e,...t})=>({...t,related:e?.[0]});class Et extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class ir extends Et{constructor(){super(...arguments),this.type="FillNavigationError"}}class Xc extends Et{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Hi=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,_e=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(Or)}))).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(hn)}))).then(s=>Ve(Hi(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=we(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Or)}).then(a=>Ve(Hi(r)).parse(a)).then(a=>({...a,items:a.items?.map(hn)}))},async save(t){const{masterModel:n}=we(e),{documentId:r,locale:i,...a}=t;return r?e.strapi.documents(n.uid).update({locale:i,documentId:r,data:B.omit(a,["id","documentId"]),populate:["items"]}).then(Ve(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...a,populate:["items"]}}).then(Ve(!1).parse)},remove(t){const{masterModel:n}=we(e);if(!t.documentId)throw new Et("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId,locale:t.locale})}})),Zc=async e=>{const t=await _e(e).find({locale:"*",limit:Number.MAX_SAFE_INTEGER}),n=await e.strapi.plugin("i18n").service("locales").getDefaultLocale();await Promise.all(t.map(async r=>{t.find(({documentId:a,locale:o})=>a===r.documentId&&o===n)||await _e(e).remove({documentId:r.documentId,locale:r.locale})}))},Ea=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Nr.default,...await n.get({key:"config"})??Nr.default};let a=B.isEmpty(i)?i:Fe.configSchema.parse(i);const o=Jc(a,r);return a={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),defaultContentType:o("defaultContentType"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},el(a,{strapi:e}),ya(a.additionalFields),await n.set({key:"config",value:a}),a},Jc=(e,t)=>n=>{const r=e?.[n]??t(n);return va(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},el=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(qc);e.contentTypes=e.contentTypes.filter(i=>!n.includes(i)),e.contentTypesNameFields=Object.fromEntries(Object.entries(e.contentTypesNameFields).filter(([i])=>!n.includes(i))),e.gql.navigationItemRelated=e.gql.navigationItemRelated.filter(i=>!r.includes(i))},Nr={default:{additionalFields:[],allowedLevels:2,contentTypes:[],defaultContentType:"",contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},tl="Navigation",nl="navigation",rl=async e=>{const t=re(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=_e(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:tl,visible:!0,locale:n,slug:nl}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const u of r)!a.find(({locale:c,documentId:l})=>l===s.documentId&&u===c)&&await i.save({documentId:s.documentId,name:s.name,locale:u,visible:s.visible,slug:s.slug})},he={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},il=async({strapi:e})=>{const t=[{section:"plugins",displayName:"Read",uid:he.navigation.read,pluginName:"navigation"},{section:"plugins",displayName:"Update",uid:he.navigation.update,pluginName:"navigation"},{section:"plugins",displayName:"Settings",uid:he.navigation.settings,pluginName:"navigation"}];await e.admin.services.permission.actionProvider.registerMany(t)},ol="I18NLocaleCode",al=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{args:{navigationIdOrSlug:n(i()),type:"NavigationRenderType",menuOnly:a(),path:i(),locale:t.arg({type:ol})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Qr.z.string().parse(f);return re({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},sl=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{type:n(r("NavigationItem")),args:{documentId:n(i()),childUiKey:n(i()),type:"NavigationRenderType",menuOnly:a()},resolve(o,s){const{documentId:u,childUIKey:f,type:c,menuOnly:l}=s,p=Qr.z.string().parse(u);return re({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},ul=e=>{const t={renderNavigationChild:sl,renderNavigation:al};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},cl=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),ll=({nexus:e})=>e.objectType({name:"ContentTypes",definition(t){t.nonNull.string("uid"),t.nonNull.string("name"),t.nonNull.boolean("isSingle"),t.nonNull.string("collectionName"),t.nonNull.string("contentTypeName"),t.nonNull.string("label"),t.nonNull.string("relatedField"),t.nonNull.string("labelSingular"),t.nonNull.string("endpoint"),t.nonNull.boolean("available"),t.nonNull.boolean("visible")}}),fl=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await re({strapi:t},"common").getPluginStore(),o=Fe.configSchema.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),pl=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),dl=({nexus:e})=>e.inputObjectType({name:"CreateNavigationItem",definition(t){t.nonNull.string("title"),t.nonNull.field("type",{type:"NavigationItemType"}),t.string("path"),t.string("externalPath"),t.nonNull.string("uiRouterKey"),t.nonNull.boolean("menuAttached"),t.nonNull.int("order"),t.string("parent"),t.string("master"),t.list.field("items",{type:"CreateNavigationItem"}),t.list.string("audience"),t.field("related",{type:"CreateNavigationRelated"})}}),hl=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),ml=({nexus:e})=>e.objectType({name:"Navigation",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible")}}),gl=({nexus:e})=>e.objectType({name:"NavigationConfig",definition(t){t.int("allowedLevels"),t.nonNull.list.string("additionalFields"),t.field("contentTypesNameFields",{type:"ContentTypesNameFields"}),t.list.field("contentTypes",{type:"ContentTypes"})}}),yl=({nexus:e})=>e.objectType({name:"NavigationDetails",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible"),t.nonNull.list.field("items",{type:"NavigationItem"})}}),vl=({nexus:e,config:t})=>e.objectType({name:"NavigationItem",definition(n){n.nonNull.int("id"),n.nonNull.string("documentId"),n.nonNull.string("title"),n.nonNull.field("type",{type:"NavigationItemType"}),n.string("path"),n.string("externalPath"),n.nonNull.string("uiRouterKey"),n.nonNull.boolean("menuAttached"),n.nonNull.int("order"),n.field("parent",{type:"NavigationItem"}),n.string("master"),n.list.field("items",{type:"NavigationItem"}),n.field("related",{type:"NavigationItemRelated"}),t.additionalFields.find(r=>r==="audience")&&n.list.string("audience"),n.field("additionalFields",{type:"NavigationItemAdditionalFields"}),n.string("created_at"),n.string("updated_at"),n.string("created_by"),n.string("updated_by"),n.string("createdAt"),n.string("updatedAt"),n.string("createdBy"),n.string("updatedBy")}}),wl=({nexus:e,config:t})=>e.objectType({name:"NavigationItemAdditionalFields",definition(n){t.additionalFields.forEach(r=>{if(r!=="audience"&&r.enabled)switch(r.type){case"media":n.field(r.name,{type:"UploadFile"});break;case"string":n.string(r.name);break;case"boolean":n.boolean(r.name);break;case"select":r.multi?n.list.string(r.name):n.string(r.name);break;default:throw new Error(`Type "${JSON.stringify(r.type)}" is unsupported by custom fields`)}})}}),El=({strapi:e,nexus:t,config:n})=>{const r=n.gql?.navigationItemRelated,i="NavigationItemRelated";return r?.length?t.unionType({name:i,definition(a){a.members(...r)},resolveType:a=>e.contentTypes[a.__type]?.globalId}):t.objectType({name:i,definition(a){a.int("id"),a.string("documentId"),a.string("title"),a.string("name")}})},bl=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),Sl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),xl=[wl,El,vl,Sl,ml,yl,fl,ll,gl,hl,dl,pl,bl],_l=e=>xl.map(t=>t(e)),Al=async({strapi:e})=>{const t=e.plugin("graphql").service("extension");t.shadowCRUD("plugin::navigation.audience").disable(),t.shadowCRUD("plugin::navigation.navigation").disable(),t.shadowCRUD("plugin::navigation.navigation-item").disable(),t.shadowCRUD("plugin::navigation.navigations-items-related").disable();const r=await re({strapi:e},"common").getPluginStore(),i=Fe.configSchema.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=_l({strapi:a,nexus:o,config:i}),u=ul({strapi:a,nexus:o}),f=cl();return{types:[s,u],resolversConfig:f}})},Tl=async({strapi:e})=>{!!e.plugin("graphql")&&await Al({strapi:e})},Cl=async e=>{await Zc(e),await Ea(e),await rl(e),await il(e),await Tl(e),await strapi.service("plugin::navigation.migrate").migrateRelatedIdToDocumentId()},Rl=({strapi:e})=>{},Fl=({strapi:e})=>{const t=e.plugin("navigation").service("admin");return async(n,r)=>{if(await r(),!(n.method==="POST"&&n.path==="/i18n/locales"))return;const a=n.body?.code;if(!(!a||typeof a!="string"))try{await t.refreshNavigationLocale(a)}catch(o){e.log.error(`Failed to refresh navigation for new locale ${a}`,o)}}},ba={localeMiddleware:Fl},$l=({strapi:e})=>{e.server.use(ba.localeMiddleware({strapi:e}))},Il={collectionName:"audience",info:{singularName:"audience",pluralName:"audiences",displayName:"Audience",name:"audience"},options:{increments:!0,comment:"Audience"},attributes:{name:{type:"string",required:!0},key:{type:"uid",targetField:"name"}}},Ol={schema:Il},Nl=wa("navigation",{strapi}),Pl={collectionName:"navigations",info:{singularName:"navigation",pluralName:"navigations",displayName:"Navigation",name:"navigation"},options:{comment:""},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!0}},attributes:{name:{type:"text",configurable:!1,required:!0},slug:{type:"uid",target:"name",configurable:!1,required:!0},visible:{type:"boolean",default:!1,configurable:!1},items:{type:"relation",relation:"oneToMany",target:"plugin::navigation.navigation-item",configurable:!1,mappedBy:"master"}}},Ll={schema:Pl,lifecycles:Nl},kl=wa("navigation-item",{strapi}),Dl={collectionName:"navigations_items",info:{singularName:"navigation-item",pluralName:"navigation-items",displayName:"Navigation Item",name:"navigation-item"},options:{increments:!0,timestamps:!0,comment:"Navigation Item"},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!1}},attributes:{title:{type:"text",configurable:!1,required:!0,pluginOptions:{i18n:{localized:!1}}},type:{type:"enumeration",enum:["INTERNAL","EXTERNAL","WRAPPER"],default:"INTERNAL",configurable:!1},path:{type:"text",targetField:"title",configurable:!1},externalPath:{type:"text",configurable:!1},uiRouterKey:{type:"string",configurable:!1},menuAttached:{type:"boolean",default:!1,configurable:!1},order:{type:"integer",default:0,configurable:!1},collapsed:{type:"boolean",default:!1,configurable:!1},autoSync:{type:"boolean",default:!0,configurable:!1},related:{type:"relation",relation:"morphToMany",required:!0,configurable:!1},parent:{type:"relation",relation:"oneToOne",target:"plugin::navigation.navigation-item",configurable:!1,default:null},master:{type:"relation",relation:"manyToOne",target:"plugin::navigation.navigation",configurable:!1,inversedBy:"items"},audience:{type:"relation",relation:"oneToMany",target:"plugin::navigation.audience"},additionalFields:{type:"json",require:!1,default:{}}}},Ml={schema:Dl,lifecycles:kl},jl={audience:Ol,navigation:Ll,"navigation-item":Ml},Sa=y.enum(["true","false"]),Vt=y.string(),Hl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),xa=y.enum(["FLAT","TREE","RFR"]),_a=y.string().transform(e=>e==="published"?"published":"draft").pipe(y.enum(["draft","published"])),Bl=e=>{if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return e},Aa=y.lazy(()=>y.preprocess(Bl,y.union([y.boolean(),y.string(),y.string().array(),y.undefined(),y.record(Aa)]))),Ul=y.object({type:xa.optional(),menu:Sa.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Aa.optional(),status:_a.optional()}),Gl=y.object({type:xa.optional(),menu:Sa.optional(),locale:y.string().optional(),status:_a.optional()}),ql=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function Kl(e){return{getAdminService(){return re(e,"admin")},getCommonService(){return re(e,"common")},async get(){return await this.getAdminService().get({})},async post(t){const{auditLog:n}=t;try{return await this.getAdminService().post({payload:Fe.createNavigationSchema.parse(t.request.body),auditLog:n})}catch(r){const i=r instanceof Error?{name:r.name,message:r.message}:{};return t.internalServerError("Unable to create",{originalError:i})}},async put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);try{return await this.getAdminService().put({auditLog:r,payload:Fe.updateNavigationSchema.parse({...i,documentId:n})})}catch(a){const o=a instanceof Error?{name:a.name,message:a.message}:{};return t.internalServerError("Unable to update",{originalError:o})}},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:Vt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:Fe.configSchema.parse(t.request.body)}),{}},async restoreConfig(){return await this.getAdminService().restoreConfig(),{}},settingsConfig(){return this.getAdminService().config({viaSettingsPage:!0})},async settingsRestart(){return await this.getAdminService().restart(),{}},getById(t){const{params:{documentId:n}}=t;return this.getAdminService().getById({documentId:Vt.parse(n)})},getContentTypeItems(t){const{params:{model:n},query:r={}}=t;return this.getAdminService().getContentTypeItems({query:y.record(y.string(),y.unknown()).parse(r),uid:y.string().parse(n)})},async fillFromOtherLocale(t){const{params:n,auditLog:r}=t,{source:i,target:a,documentId:o}=ql.parse(n);return await this.getAdminService().fillFromOtherLocale({source:i,target:a,documentId:o,auditLog:r})},readNavigationItemFromLocale(t){const{params:{source:n,target:r},query:{path:i}}=t;return this.getAdminService().readNavigationItemFromLocale({path:y.string().parse(i),source:Vt.parse(n),target:Vt.parse(r)})},getSlug(t){const{query:{q:n}}=t;return this.getCommonService().getSlug({query:y.string().parse(n)}).then(r=>({slug:r}))},settingsLocale(){return this.getCommonService().readLocale()}}}function Wl(e){return{getService(){return re(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=Hl.parse(n);return await this.getService().readAll({locale:r,orderBy:i,orderDirection:a})}catch(n){if(n instanceof Error)return t.badRequest(n.message);throw n}},async render(t){const{params:n,query:r={}}=t,{type:i,menu:a,path:o,locale:s,populate:u,status:f="published"}=Ul.parse(r),c=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:c,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:u,status:f})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o,status:s="published"}=Gl.parse(r),u=y.string().parse(n.idOrSlug),f=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:u,childUIKey:f,type:i,menuOnly:a==="true",locale:o,status:s})}}}const zl={admin:Kl,client:Wl},Yl={},Ql={type:"admin",routes:[{method:"GET",path:"/",handler:"admin.get",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"POST",path:"/",handler:"admin.post",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/config",handler:"admin.config",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"PUT",path:"/config",handler:"admin.updateConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"DELETE",path:"/config",handler:"admin.restoreConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"GET",path:"/slug",handler:"admin.getSlug",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/:documentId",handler:"admin.getById",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"PUT",path:"/:documentId",handler:"admin.put",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"DELETE",path:"/:documentId",handler:"admin.delete",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/content-type-items/:model",handler:"admin.getContentTypeItems",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/locale",handler:"admin.settingsLocale",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/config",handler:"admin.settingsConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"GET",path:"/settings/restart",handler:"admin.settingsRestart",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"PUT",path:"/i18n/copy/:documentId/:source/:target",handler:"admin.fillFromOtherLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/i18n/item/read/:source/:target",handler:"admin.readNavigationItemFromLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}}]},Vl={type:"content-api",routes:[{method:"GET",path:"/render/:idOrSlug",handler:"client.render",config:{policies:[]}},{method:"GET",path:"/render/:idOrSlug/:childUIKey",handler:"client.renderChild",config:{policies:[]}},{method:"GET",path:"/",handler:"client.readAll",config:{policies:[]}}]},Xl={admin:Ql,"content-api":Vl};function Zl(e,t){return ge.default.has(process.env,e)?process.env[e]:t}function At(e){return process.env[e]??""}function Jl(e,t){return ge.default.has(process.env,e)?parseInt(At(e),10):t}function ef(e,t){return ge.default.has(process.env,e)?parseFloat(At(e)):t}function tf(e,t){return ge.default.has(process.env,e)?At(e)==="true":t}function nf(e,t){if(!ge.default.has(process.env,e))return t;try{return JSON.parse(At(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}}function rf(e,t){if(!ge.default.has(process.env,e))return t;let n=At(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>ge.default.trim(ge.default.trim(r," "),'"'))}function of(e,t){return ge.default.has(process.env,e)?new Date(At(e)):t}function af(e,t,n){if(!t)throw new Error("env.oneOf requires expectedValues");if(n&&!t.includes(n))throw new Error("env.oneOf requires defaultValue to be included in expectedValues");const r=uf(e,n);return r!==void 0&&t.includes(r)?r:n}const sf={int:Jl,float:ef,bool:tf,json:nf,array:rf,date:of,oneOf:af},uf=Object.assign(Zl,sf),cf="id",lf="documentId",ff={ID_ATTRIBUTE:cf,DOC_ID_ATTRIBUTE:lf},pf=e=>C.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],C.getOr([],"options.privateAttributes",e)),df=(e,t)=>e?.attributes?.[t]?.private===!0?!0:pf(e).includes(t),Ta=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),hf=e=>e?.type==="media",Ca=e=>e?.type==="relation",mf=e=>!!e&&e.type==="dynamiczone",Ra=e=>!!e&&Ca(e)&&e.relation?.startsWith?.("morphTo"),Xt=async e=>{const t=await Promise.allSettled(e);for(let n=0;n<t.length;n+=1){const r=t[n];if(r.status==="rejected")throw r.reason}return t.map(n=>n.value)},pt=async(e,t,n)=>{const{path:r={raw:null,attribute:null,rawWithIndices:null},schema:i,getModel:a,allowedExtraRootKeys:o}=t;let s=t.parent;const u=async(g,w,S)=>{const R={schema:a(S.__type),path:w,getModel:a,parent:s,allowedExtraRootKeys:o};return pt(g,R,S)},f=g=>async(w,S,x)=>pt(w,{schema:g,path:S,getModel:a,parent:s,allowedExtraRootKeys:o},x),c=async(g,w,S)=>{const T={schema:a("plugin::upload.file"),path:w,getModel:a,parent:s,allowedExtraRootKeys:o};return pt(g,T,S)},l=async(g,w,S,x)=>pt(g,{schema:S,path:w,getModel:a,parent:s,allowedExtraRootKeys:o},x),p=async(g,w,S)=>{const R={schema:a(S.__component),path:w,getModel:a,parent:s,allowedExtraRootKeys:o};return pt(g,R,S)};if(!C.isObject(n)||C.isNil(i))return n;const d=C.clone(n),h=gf({data:d}),m=Object.keys(d);for(let g=0;g<m.length;g+=1){const w=m[g],S=i.attributes[w],x={...r};x.raw=C.isNil(r.raw)?w:`${r.raw}.${w}`,x.rawWithIndices=C.isNil(r.rawWithIndices)?w:`${r.rawWithIndices}.${w}`,C.isNil(S)||(x.attribute=C.isNil(r.attribute)?w:`${r.attribute}.${w}`);const R={data:d,schema:i,key:w,value:d[w],attribute:S,path:x,getModel:a,parent:s,allowedExtraRootKeys:o};await e(R,h);const T=d[w];if(!(C.isNil(T)||C.isNil(S))){if(Ca(S)){s={schema:i,key:w,attribute:S,path:x};const M=S.relation.toLowerCase().startsWith("morph")?u:f(a(S.target));C.isArray(T)?d[w]=await Xt(T.map((A,_)=>{const N={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${_}`:`${x.rawWithIndices}.${_}`};return M(e,N,A)})):d[w]=await M(e,x,T);continue}if(hf(S)){s={schema:i,key:w,attribute:S,path:x},C.isArray(T)?d[w]=await Xt(T.map((O,M)=>{const A={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${M}`:`${x.rawWithIndices}.${M}`};return c(e,A,O)})):d[w]=await c(e,x,T);continue}if(S.type==="component"){s={schema:i,key:w,attribute:S,path:x};const O=a(S.component);C.isArray(T)?d[w]=await Xt(T.map((M,A)=>{const _={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${A}`:`${x.rawWithIndices}.${A}`};return l(e,_,O,M)})):d[w]=await l(e,x,O,T);continue}if(S.type==="dynamiczone"&&C.isArray(T)){s={schema:i,key:w,attribute:S,path:x},d[w]=await Xt(T.map((O,M)=>{const A={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${M}`:`${x.rawWithIndices}.${M}`};return p(e,A,O)}));continue}}}return d},gf=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var yf=C.curry(pt),Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vf={exports:{}};(function(e,t){(function(n,r){e.exports=r(pn.default,Li.default)})(Ee,function(n,r){return(function(i){function a(s){if(o[s])return o[s].exports;var u=o[s]={exports:{},id:s,loaded:!1};return i[s].call(u.exports,u,u.exports,a),u.loaded=!0,u.exports}var o={};return a.m=i,a.c=o,a.p="",a(0)})([function(i,a,o){i.exports=o(34)},function(i,a,o){var s=o(29)("wks"),u=o(33),f=o(2).Symbol,c=typeof f=="function",l=i.exports=function(p){return s[p]||(s[p]=c&&f[p]||(c?f:u)("Symbol."+p))};l.store=s},function(i,a){var o=i.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=o)},function(i,a,o){var s=o(9);i.exports=function(u){if(!s(u))throw TypeError(u+" is not an object!");return u}},function(i,a,o){i.exports=!o(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(12),u=o(17);i.exports=o(4)?function(f,c,l){return s.f(f,c,u(1,l))}:function(f,c,l){return f[c]=l,f}},function(i,a){var o=i.exports={version:"2.4.0"};typeof __e=="number"&&(__e=o)},function(i,a,o){var s=o(14);i.exports=function(u,f,c){if(s(u),f===void 0)return u;switch(c){case 1:return function(l){return u.call(f,l)};case 2:return function(l,p){return u.call(f,l,p)};case 3:return function(l,p,d){return u.call(f,l,p,d)}}return function(){return u.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,u){return o.call(s,u)}},function(i,a){i.exports=function(o){return typeof o=="object"?o!==null:typeof o=="function"}},function(i,a){i.exports={}},function(i,a){var o={}.toString;i.exports=function(s){return o.call(s).slice(8,-1)}},function(i,a,o){var s=o(3),u=o(26),f=o(32),c=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(l,p,d){if(s(l),p=f(p,!0),s(d),u)try{return c(l,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(l[p]=d.value),l}},function(i,a,o){var s=o(42),u=o(15);i.exports=function(f){return s(u(f))}},function(i,a){i.exports=function(o){if(typeof o!="function")throw TypeError(o+" is not a function!");return o}},function(i,a){i.exports=function(o){if(o==null)throw TypeError("Can't call method on "+o);return o}},function(i,a,o){var s=o(9),u=o(2).document,f=s(u)&&s(u.createElement);i.exports=function(c){return f?u.createElement(c):{}}},function(i,a){i.exports=function(o,s){return{enumerable:!(1&o),configurable:!(2&o),writable:!(4&o),value:s}}},function(i,a,o){var s=o(12).f,u=o(8),f=o(1)("toStringTag");i.exports=function(c,l,p){c&&!u(c=p?c:c.prototype,f)&&s(c,f,{configurable:!0,value:l})}},function(i,a,o){var s=o(29)("keys"),u=o(33);i.exports=function(f){return s[f]||(s[f]=u(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(u){return isNaN(u=+u)?0:(u>0?s:o)(u)}},function(i,a,o){var s=o(11),u=o(1)("toStringTag"),f=s((function(){return arguments})())=="Arguments",c=function(l,p){try{return l[p]}catch{}};i.exports=function(l){var p,d,h;return l===void 0?"Undefined":l===null?"Null":typeof(d=c(p=Object(l),u))=="string"?d:f?s(p):(h=s(p))=="Object"&&typeof p.callee=="function"?"Arguments":h}},function(i,a){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,a,o){var s=o(2),u=o(6),f=o(7),c=o(5),l="prototype",p=function(d,h,m){var g,w,S,x=d&p.F,R=d&p.G,T=d&p.S,O=d&p.P,M=d&p.B,A=d&p.W,_=R?u:u[h]||(u[h]={}),N=_[l],v=R?s:T?s[h]:(s[h]||{})[l];R&&(m=h);for(g in m)w=!x&&v&&v[g]!==void 0,w&&g in _||(S=w?v[g]:m[g],_[g]=R&&typeof v[g]!="function"?m[g]:M&&w?f(S,s):A&&v[g]==S?(function(j){var H=function(K,E,b){if(this instanceof j){switch(arguments.length){case 0:return new j;case 1:return new j(K);case 2:return new j(K,E)}return new j(K,E,b)}return j.apply(this,arguments)};return H[l]=j[l],H})(S):O&&typeof S=="function"?f(Function.call,S):S,O&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&N&&!N[g]&&c(N,g,S)))};p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,i.exports=p},function(i,a){i.exports=function(o){try{return!!o()}catch{return!0}}},function(i,a,o){i.exports=o(2).document&&document.documentElement},function(i,a,o){i.exports=!o(4)&&!o(24)(function(){return Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(28),u=o(23),f=o(57),c=o(5),l=o(8),p=o(10),d=o(45),h=o(18),m=o(52),g=o(1)("iterator"),w=!([].keys&&"next"in[].keys()),S="@@iterator",x="keys",R="values",T=function(){return this};i.exports=function(O,M,A,_,N,v,j){d(A,M,_);var H,K,E,b=function(k){if(!w&&k in W)return W[k];switch(k){case x:return function(){return new A(this,k)};case R:return function(){return new A(this,k)}}return function(){return new A(this,k)}},$=M+" Iterator",D=N==R,U=!1,W=O.prototype,Q=W[g]||W[S]||N&&W[N],ee=Q||b(N),Ce=N?D?b("entries"):ee:void 0,F=M=="Array"&&W.entries||Q;if(F&&(E=m(F.call(new O)),E!==Object.prototype&&(h(E,$,!0),s||l(E,g)||c(E,g,T))),D&&Q&&Q.name!==R&&(U=!0,ee=function(){return Q.call(this)}),s&&!j||!w&&!U&&W[g]||c(W,g,ee),p[M]=ee,p[$]=T,N)if(H={values:D?ee:b(R),keys:v?ee:b(x),entries:Ce},j)for(K in H)K in W||f(W,K,H[K]);else u(u.P+u.F*(w||U),M,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),u="__core-js_shared__",f=s[u]||(s[u]={});i.exports=function(c){return f[c]||(f[c]={})}},function(i,a,o){var s,u,f,c=o(7),l=o(41),p=o(25),d=o(16),h=o(2),m=h.process,g=h.setImmediate,w=h.clearImmediate,S=h.MessageChannel,x=0,R={},T="onreadystatechange",O=function(){var A=+this;if(R.hasOwnProperty(A)){var _=R[A];delete R[A],_()}},M=function(A){O.call(A.data)};g&&w||(g=function(A){for(var _=[],N=1;arguments.length>N;)_.push(arguments[N++]);return R[++x]=function(){l(typeof A=="function"?A:Function(A),_)},s(x),x},w=function(A){delete R[A]},o(11)(m)=="process"?s=function(A){m.nextTick(c(O,A,1))}:S?(u=new S,f=u.port2,u.port1.onmessage=M,s=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(A){h.postMessage(A+"","*")},h.addEventListener("message",M,!1)):s=T in d("script")?function(A){p.appendChild(d("script"))[T]=function(){p.removeChild(this),O.call(A)}}:function(A){setTimeout(c(O,A,1),0)}),i.exports={set:g,clear:w}},function(i,a,o){var s=o(20),u=Math.min;i.exports=function(f){return f>0?u(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(u,f){if(!s(u))return u;var c,l;if(f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u))||typeof(c=u.valueOf)=="function"&&!s(l=c.call(u))||!f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(u){return"Symbol(".concat(u===void 0?"":u,")_",(++o+s).toString(36))}},function(i,a,o){function s(T){return T&&T.__esModule?T:{default:T}}function u(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(T){return(0,g.createHash)("sha256").update(T).digest("hex")}function c(T){switch(S){case"darwin":return T.split("IOPlatformUUID")[1].split(`
|
|
1
|
+
"use strict";const B=require("lodash"),Qr=require("zod"),C=require("lodash/fp"),Bu=require("crypto"),Uu=require("child_process"),Gu=require("lodash/has"),qu=require("lodash/mapValues"),Ku=require("lodash/snakeCase"),Wu=require("lodash/camelCase"),zu=require("lodash/mapKeys"),Yu=require("os"),Qu=require("path"),Vu=require("fs"),Xu=require("assert"),Zu=require("events"),Ju=require("buffer"),ec=require("stream"),tc=require("util"),nc=require("constants");require("node:stream");const rc=require("@sindresorhus/slugify"),ic=require("zod/v4"),oc=require("pluralize"),ue=e=>e&&e.__esModule?e:{default:e};function sa(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ge=ue(B),y=sa(Qr),Li=ue(Bu),pn=ue(Uu),dn=ue(Gu),ua=ue(qu),ki=ue(Ku),ac=ue(Wu),sc=ue(zu),kn=ue(Yu),Se=ue(Qu),We=ue(Vu),ca=ue(Xu),uc=ue(Zu),cc=ue(Ju),Dn=ue(ec),it=ue(tc),lc=ue(nc),fc=ue(rc),z=sa(ic),pc=ue(oc),Vr=y.object({name:y.string({required_error:"requiredError"}).nonempty("requiredError").refine(e=>!e.includes(" "),{message:"noSpaceError"}),label:y.string({required_error:"requiredError"}).nonempty("requiredError"),description:y.string().optional(),placeholder:y.string().optional(),required:y.boolean().optional(),enabled:y.boolean().optional()}),dc=Vr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string(),{required_error:"requiredError"}).min(1,{message:"requiredError"})}),hc=Vr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),mc=Vr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),la=y.discriminatedUnion("type",[hc,mc,dc]),fa=y.union([y.literal("audience"),la]),gc=y.object({additionalFields:y.array(fa),allowedLevels:y.number(),contentTypes:y.array(y.string()),defaultContentType:y.string().optional(),contentTypesNameFields:y.record(y.string(),y.array(y.string())),contentTypesPopulate:y.record(y.string(),y.array(y.string())),gql:y.object({navigationItemRelated:y.array(y.string())}),pathDefaultFields:y.record(y.string(),y.any()),cascadeMenuAttached:y.boolean(),preferCustomContentTypes:y.boolean(),isCacheEnabled:y.boolean().optional()}),pa=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),yc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Xr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:yc,path:y.string().or(y.null()).optional(),slug:y.string().or(y.null()).optional(),externalPath:y.string().or(y.null()).optional(),uiRouterKey:y.string(),menuAttached:y.boolean(),order:y.number().int(),collapsed:y.boolean(),related:y.object({documentId:y.string().optional(),__type:y.string()}).catchall(y.unknown()).nullish().optional(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(pa).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),vc=Xr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown().optional()}),Lt=Xr.extend({parent:y.lazy(()=>Lt.or(y.null())).optional(),items:y.lazy(()=>Lt.array()).optional(),master:y.lazy(()=>Ve(!1)).optional()}),Di=y.array(Lt),Ve=e=>y.object({id:y.number(),documentId:y.string(),name:y.string(),slug:y.string(),locale:y.string(),visible:y.boolean(),items:e?y.array(Lt):Lt.array().optional()}),wc=Ve(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),Ec=Xr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>da).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),da=y.array(Ec),bc=Ve(!1).extend({items:da}).partial().required({id:!0,documentId:!0}),Sc=y.enum(["collectionType","singleType"]),xc=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),ha=y.object({required:y.boolean().optional(),max:y.number().optional(),min:y.number().optional(),minLength:y.number().optional(),maxLength:y.number().optional(),private:y.boolean().optional(),configurable:y.boolean().optional(),default:y.any().optional()}),_c=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Ac=ha.extend({type:_c}),Tc=ha.extend({type:y.literal("enumeration"),enum:y.string().array()}),Cc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),Rc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),Fc=y.object({type:y.literal("uid")}),$c=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),Ic=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Oc=y.object({type:y.literal("relation"),relation:Ic,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),Nc=y.record(y.string(),y.union([Ac,Tc,Cc,Rc,Oc,$c,Fc])),Tr=y.object({kind:Sc,collectionName:y.string(),info:xc,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:Nc,actions:y.record(y.string(),y.any()).optional(),lifecycles:y.record(y.string(),y.any()).optional(),uid:y.string(),apiName:y.string().optional(),associations:y.object({model:y.string(),alias:y.string()}).array().optional(),modelName:y.string().optional(),plugin:y.string().optional(),pluginOptions:y.record(y.string(),y.any()).optional(),isSingle:y.boolean().optional()});Tr.pick({info:!0,kind:!0,attributes:!0,options:!0});const jt=(e,t)=>n=>{t(n(e()))};let Cr=gc;const Pc=jt(()=>Cr,e=>{Cr=e});let Rr=fa;const Lc=jt(()=>Rr,e=>{Rr=e});let Fr=la;const kc=jt(()=>Fr,e=>{Fr=e});let $r=wc;const Dc=jt(()=>$r,e=>{$r=e});let Ir=bc;const Mc=jt(()=>Ir,e=>{Ir=e}),Fe={get configSchema(){return Cr},get navigationItemAdditionalField(){return Rr},get navigationItemCustomField(){return Fr},get createNavigationSchema(){return $r},get updateNavigationSchema(){return Ir}},jc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Hc=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Bc="$",ma=["api::","plugin::"],ga=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Uc=["title","subject","name"],Mi={SINGLE:"singleType"},ji=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Gc=e=>e.filter(t=>t!=="audience"),ya=e=>{const t=Gc(e);if(t.length!==B.uniqBy(t,"name").length)throw new Error("All names of custom fields must be unique.");if(!B.isNil(B.find(t,n=>typeof n=="object"&&B.includes(ji,n.name))))throw new Error(`Name of custom field cannot be one of: ${ji.join(", ")}`)},va=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},qc=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=Kc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Kc=(e="")=>e.split(jc).filter(t=>t&&t.length>0),Wc=(e,t)=>n=>[n,async r=>{await re(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],wa=(e,t)=>Object.fromEntries(Hc.map(Wc(e,t))),we=({strapi:e})=>{const t=e.plugin("navigation");return{masterModel:t.contentType("navigation"),itemModel:t.contentType("navigation-item"),relatedModel:t.contentType("navigations-items-related"),audienceModel:t.contentType("audience")}};function re({strapi:e},t){return e.plugin("navigation").service(t)}const Qt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,zc=(e="")=>{const t=!!ma.find(r=>e.includes(r)),n=!ga.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Yc=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,Qc=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=we(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(pa.array().parse)}})),kt=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Qt(n),status:r,...i})},findById(n,r,i,a={}){return e.strapi.documents(t).findOne({documentId:n,populate:Qt(r),status:i,...a})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Qt(r),status:i})},findMany(n,r,i,a){return e.strapi.documents(t).findMany({where:n,populate:Qt(r),status:i,locale:a})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Le=B.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=we(e),{__type:i,documentId:a}=t?.related??{},o=i?kt(e,i):void 0,s=i&&o?a?await o.findById(a,void 0,void 0,{locale:n}):await o.findFirst(void 0,void 0,{locale:n}):void 0;if(typeof t.documentId=="string"){const{documentId:u,...f}=t;return e.strapi.documents(r.uid).update({documentId:t.documentId,data:{...f,related:s?{...s,__type:i}:void 0},locale:n})}else return e.strapi.documents(r.uid).create({data:{...t,related:s?{...s,__type:i}:void 0},locale:n})},find({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(Or)).then(Di.parse).then(s=>s.map(hn))},findV4({filters:t,locale:n,limit:r,order:i,populate:a}){const{itemModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i})},count(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=we(e);return e.strapi.documents(n.uid).delete({documentId:t.documentId,populate:"*"})},removeForIds(t){const{itemModel:n}=we(e);return t.map(r=>e.strapi.documents(n.uid).delete({documentId:r,populate:"*"}))},findForMasterIds(t){const{itemModel:n}=we(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(Di.parse)}})),Vc=["id","publishedAt","createdAt","updatedAt","locale"],hn=({related:e,items:t=[],...n})=>({...n,items:t.map(hn),related:e?B.omit(e,Vc):void 0}),Or=({related:e,...t})=>({...t,related:e?.[0]});class Et extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class ir extends Et{constructor(){super(...arguments),this.type="FillNavigationError"}}class Xc extends Et{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Hi=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,_e=B.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:a}){const{masterModel:o}=we(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:a,orderBy:i}).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(Or)}))).then(s=>s.map(({items:u,...f})=>({...f,items:u?.map(hn)}))).then(s=>Ve(Hi(a)).array().parse(s))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=we(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(a=>a&&{...a,items:a.items?.map(Or)}).then(a=>Ve(Hi(r)).parse(a)).then(a=>({...a,items:a.items?.map(hn)}))},async save(t){const{masterModel:n}=we(e),{documentId:r,locale:i,...a}=t;return r?e.strapi.documents(n.uid).update({locale:i,documentId:r,data:B.omit(a,["id","documentId"]),populate:["items"]}).then(Ve(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...a,populate:["items"]}}).then(Ve(!1).parse)},remove(t){const{masterModel:n}=we(e);if(!t.documentId)throw new Et("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId,locale:t.locale})}})),Zc=async e=>{const t=await _e(e).find({locale:"*",limit:Number.MAX_SAFE_INTEGER}),n=await e.strapi.plugin("i18n").service("locales").getDefaultLocale();n&&await Promise.all(t.map(async r=>{t.find(({documentId:a,locale:o})=>a===r.documentId&&o===n)||await _e(e).remove({documentId:r.documentId,locale:r.locale})}))},Ea=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...Nr.default,...await n.get({key:"config"})??Nr.default};let a=B.isEmpty(i)?i:Fe.configSchema.parse(i);const o=Jc(a,r);return a={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),defaultContentType:o("defaultContentType"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},el(a,{strapi:e}),ya(a.additionalFields),await n.set({key:"config",value:a}),a},Jc=(e,t)=>n=>{const r=e?.[n]??t(n);return va(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},el=(e,{strapi:t})=>{const n=e.contentTypes.filter(i=>!t.contentTypes[i]);if(n.length===0)return;const r=n.map(qc);e.contentTypes=e.contentTypes.filter(i=>!n.includes(i)),e.contentTypesNameFields=Object.fromEntries(Object.entries(e.contentTypesNameFields).filter(([i])=>!n.includes(i))),e.gql.navigationItemRelated=e.gql.navigationItemRelated.filter(i=>!r.includes(i))},Nr={default:{additionalFields:[],allowedLevels:2,contentTypes:[],defaultContentType:"",contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},tl="Navigation",nl="navigation",rl=async e=>{const t=re(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=_e(e),a=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});a.length===0&&a.push(await i.save({name:tl,visible:!0,locale:n,slug:nl}));const o=a.filter(({locale:s})=>s===n);for(const s of o)for(const u of r)!a.find(({locale:c,documentId:l})=>l===s.documentId&&u===c)&&await i.save({documentId:s.documentId,name:s.name,locale:u,visible:s.visible,slug:s.slug})},he={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},il=async({strapi:e})=>{const t=[{section:"plugins",displayName:"Read",uid:he.navigation.read,pluginName:"navigation"},{section:"plugins",displayName:"Update",uid:he.navigation.update,pluginName:"navigation"},{section:"plugins",displayName:"Settings",uid:he.navigation.settings,pluginName:"navigation"}];await e.admin.services.permission.actionProvider.registerMany(t)},ol="I18NLocaleCode",al=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{args:{navigationIdOrSlug:n(i()),type:"NavigationRenderType",menuOnly:a(),path:i(),locale:t.arg({type:ol})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Qr.z.string().parse(f);return re({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},sl=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:a}=t;return{type:n(r("NavigationItem")),args:{documentId:n(i()),childUiKey:n(i()),type:"NavigationRenderType",menuOnly:a()},resolve(o,s){const{documentId:u,childUIKey:f,type:c,menuOnly:l}=s,p=Qr.z.string().parse(u);return re({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},ul=e=>{const t={renderNavigationChild:sl,renderNavigation:al};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},cl=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),ll=({nexus:e})=>e.objectType({name:"ContentTypes",definition(t){t.nonNull.string("uid"),t.nonNull.string("name"),t.nonNull.boolean("isSingle"),t.nonNull.string("collectionName"),t.nonNull.string("contentTypeName"),t.nonNull.string("label"),t.nonNull.string("relatedField"),t.nonNull.string("labelSingular"),t.nonNull.string("endpoint"),t.nonNull.boolean("available"),t.nonNull.boolean("visible")}}),fl=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await re({strapi:t},"common").getPluginStore(),o=Fe.configSchema.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),pl=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),dl=({nexus:e})=>e.inputObjectType({name:"CreateNavigationItem",definition(t){t.nonNull.string("title"),t.nonNull.field("type",{type:"NavigationItemType"}),t.string("path"),t.string("externalPath"),t.nonNull.string("uiRouterKey"),t.nonNull.boolean("menuAttached"),t.nonNull.int("order"),t.string("parent"),t.string("master"),t.list.field("items",{type:"CreateNavigationItem"}),t.list.string("audience"),t.field("related",{type:"CreateNavigationRelated"})}}),hl=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),ml=({nexus:e})=>e.objectType({name:"Navigation",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible")}}),gl=({nexus:e})=>e.objectType({name:"NavigationConfig",definition(t){t.int("allowedLevels"),t.nonNull.list.string("additionalFields"),t.field("contentTypesNameFields",{type:"ContentTypesNameFields"}),t.list.field("contentTypes",{type:"ContentTypes"})}}),yl=({nexus:e})=>e.objectType({name:"NavigationDetails",definition(t){t.nonNull.string("id"),t.nonNull.string("documentId"),t.nonNull.string("name"),t.nonNull.string("slug"),t.nonNull.boolean("visible"),t.nonNull.list.field("items",{type:"NavigationItem"})}}),vl=({nexus:e,config:t})=>e.objectType({name:"NavigationItem",definition(n){n.nonNull.int("id"),n.nonNull.string("documentId"),n.nonNull.string("title"),n.nonNull.field("type",{type:"NavigationItemType"}),n.string("path"),n.string("externalPath"),n.nonNull.string("uiRouterKey"),n.nonNull.boolean("menuAttached"),n.nonNull.int("order"),n.field("parent",{type:"NavigationItem"}),n.string("master"),n.list.field("items",{type:"NavigationItem"}),n.field("related",{type:"NavigationItemRelated"}),t.additionalFields.find(r=>r==="audience")&&n.list.string("audience"),n.field("additionalFields",{type:"NavigationItemAdditionalFields"}),n.string("created_at"),n.string("updated_at"),n.string("created_by"),n.string("updated_by"),n.string("createdAt"),n.string("updatedAt"),n.string("createdBy"),n.string("updatedBy")}}),wl=({nexus:e,config:t})=>e.objectType({name:"NavigationItemAdditionalFields",definition(n){t.additionalFields.forEach(r=>{if(r!=="audience"&&r.enabled)switch(r.type){case"media":n.field(r.name,{type:"UploadFile"});break;case"string":n.string(r.name);break;case"boolean":n.boolean(r.name);break;case"select":r.multi?n.list.string(r.name):n.string(r.name);break;default:throw new Error(`Type "${JSON.stringify(r.type)}" is unsupported by custom fields`)}})}}),El=({strapi:e,nexus:t,config:n})=>{const r=n.gql?.navigationItemRelated,i="NavigationItemRelated";return r?.length?t.unionType({name:i,definition(a){a.members(...r)},resolveType:a=>e.contentTypes[a.__type]?.globalId}):t.objectType({name:i,definition(a){a.int("id"),a.string("documentId"),a.string("title"),a.string("name")}})},bl=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),Sl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),xl=[wl,El,vl,Sl,ml,yl,fl,ll,gl,hl,dl,pl,bl],_l=e=>xl.map(t=>t(e)),Al=async({strapi:e})=>{const t=e.plugin("graphql").service("extension");t.shadowCRUD("plugin::navigation.audience").disable(),t.shadowCRUD("plugin::navigation.navigation").disable(),t.shadowCRUD("plugin::navigation.navigation-item").disable(),t.shadowCRUD("plugin::navigation.navigations-items-related").disable();const r=await re({strapi:e},"common").getPluginStore(),i=Fe.configSchema.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=_l({strapi:a,nexus:o,config:i}),u=ul({strapi:a,nexus:o}),f=cl();return{types:[s,u],resolversConfig:f}})},Tl=async({strapi:e})=>{!!e.plugin("graphql")&&await Al({strapi:e})},Cl=async e=>{await Zc(e),await Ea(e),await rl(e),await il(e),await Tl(e),await strapi.service("plugin::navigation.migrate").migrateRelatedIdToDocumentId()},Rl=({strapi:e})=>{},Fl=({strapi:e})=>{const t=e.plugin("navigation").service("admin");return async(n,r)=>{if(await r(),!(n.method==="POST"&&n.path==="/i18n/locales"))return;const a=n.body?.code;if(!(!a||typeof a!="string"))try{await t.refreshNavigationLocale(a)}catch(o){e.log.error(`Failed to refresh navigation for new locale ${a}`,o)}}},ba={localeMiddleware:Fl},$l=({strapi:e})=>{e.server.use(ba.localeMiddleware({strapi:e}))},Il={collectionName:"audience",info:{singularName:"audience",pluralName:"audiences",displayName:"Audience",name:"audience"},options:{increments:!0,comment:"Audience"},attributes:{name:{type:"string",required:!0},key:{type:"uid",targetField:"name"}}},Ol={schema:Il},Nl=wa("navigation",{strapi}),Pl={collectionName:"navigations",info:{singularName:"navigation",pluralName:"navigations",displayName:"Navigation",name:"navigation"},options:{comment:""},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!0}},attributes:{name:{type:"text",configurable:!1,required:!0},slug:{type:"uid",target:"name",configurable:!1,required:!0},visible:{type:"boolean",default:!1,configurable:!1},items:{type:"relation",relation:"oneToMany",target:"plugin::navigation.navigation-item",configurable:!1,mappedBy:"master"}}},Ll={schema:Pl,lifecycles:Nl},kl=wa("navigation-item",{strapi}),Dl={collectionName:"navigations_items",info:{singularName:"navigation-item",pluralName:"navigation-items",displayName:"Navigation Item",name:"navigation-item"},options:{increments:!0,timestamps:!0,comment:"Navigation Item"},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1},i18n:{localized:!1}},attributes:{title:{type:"text",configurable:!1,required:!0,pluginOptions:{i18n:{localized:!1}}},type:{type:"enumeration",enum:["INTERNAL","EXTERNAL","WRAPPER"],default:"INTERNAL",configurable:!1},path:{type:"text",targetField:"title",configurable:!1},externalPath:{type:"text",configurable:!1},uiRouterKey:{type:"string",configurable:!1},menuAttached:{type:"boolean",default:!1,configurable:!1},order:{type:"integer",default:0,configurable:!1},collapsed:{type:"boolean",default:!1,configurable:!1},autoSync:{type:"boolean",default:!0,configurable:!1},related:{type:"relation",relation:"morphToMany",required:!1,configurable:!1},parent:{type:"relation",relation:"oneToOne",target:"plugin::navigation.navigation-item",configurable:!1,default:null},master:{type:"relation",relation:"manyToOne",target:"plugin::navigation.navigation",configurable:!1,inversedBy:"items"},audience:{type:"relation",relation:"oneToMany",target:"plugin::navigation.audience"},additionalFields:{type:"json",require:!1,default:{}}}},Ml={schema:Dl,lifecycles:kl},jl={audience:Ol,navigation:Ll,"navigation-item":Ml},Sa=y.enum(["true","false"]),Vt=y.string(),Hl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),xa=y.enum(["FLAT","TREE","RFR"]),_a=y.string().transform(e=>e==="published"?"published":"draft").pipe(y.enum(["draft","published"])),Bl=e=>{if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return e},Aa=y.lazy(()=>y.preprocess(Bl,y.union([y.boolean(),y.string(),y.string().array(),y.undefined(),y.record(Aa)]))),Ul=y.object({type:xa.optional(),menu:Sa.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Aa.optional(),status:_a.optional()}),Gl=y.object({type:xa.optional(),menu:Sa.optional(),locale:y.string().optional(),status:_a.optional()}),ql=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function Kl(e){return{getAdminService(){return re(e,"admin")},getCommonService(){return re(e,"common")},async get(){return await this.getAdminService().get({})},async post(t){const{auditLog:n}=t;try{return await this.getAdminService().post({payload:Fe.createNavigationSchema.parse(t.request.body),auditLog:n})}catch(r){const i=r instanceof Error?{name:r.name,message:r.message}:{};return t.internalServerError("Unable to create",{originalError:i})}},async put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);try{return await this.getAdminService().put({auditLog:r,payload:Fe.updateNavigationSchema.parse({...i,documentId:n})})}catch(a){const o=a instanceof Error?{name:a.name,message:a.message}:{};return t.internalServerError("Unable to update",{originalError:o})}},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:Vt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:Fe.configSchema.parse(t.request.body)}),{}},async restoreConfig(){return await this.getAdminService().restoreConfig(),{}},settingsConfig(){return this.getAdminService().config({viaSettingsPage:!0})},async settingsRestart(){return await this.getAdminService().restart(),{}},getById(t){const{params:{documentId:n}}=t;return this.getAdminService().getById({documentId:Vt.parse(n)})},getContentTypeItems(t){const{params:{model:n},query:r={}}=t;return this.getAdminService().getContentTypeItems({query:y.record(y.string(),y.unknown()).parse(r),uid:y.string().parse(n)})},async fillFromOtherLocale(t){const{params:n,auditLog:r}=t,{source:i,target:a,documentId:o}=ql.parse(n);return await this.getAdminService().fillFromOtherLocale({source:i,target:a,documentId:o,auditLog:r})},readNavigationItemFromLocale(t){const{params:{source:n,target:r},query:{path:i}}=t;return this.getAdminService().readNavigationItemFromLocale({path:y.string().parse(i),source:Vt.parse(n),target:Vt.parse(r)})},getSlug(t){const{query:{q:n}}=t;return this.getCommonService().getSlug({query:y.string().parse(n)}).then(r=>({slug:r}))},settingsLocale(){return this.getCommonService().readLocale()}}}function Wl(e){return{getService(){return re(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:a}=Hl.parse(n);return await this.getService().readAll({locale:r,orderBy:i,orderDirection:a})}catch(n){if(n instanceof Error)return t.badRequest(n.message);throw n}},async render(t){const{params:n,query:r={}}=t,{type:i,menu:a,path:o,locale:s,populate:u,status:f="published"}=Ul.parse(r),c=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:c,type:i,menuOnly:a==="true",rootPath:o,locale:s,populate:u,status:f})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o,status:s="published"}=Gl.parse(r),u=y.string().parse(n.idOrSlug),f=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:u,childUIKey:f,type:i,menuOnly:a==="true",locale:o,status:s})}}}const zl={admin:Kl,client:Wl},Yl={},Ql={type:"admin",routes:[{method:"GET",path:"/",handler:"admin.get",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"POST",path:"/",handler:"admin.post",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/config",handler:"admin.config",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"PUT",path:"/config",handler:"admin.updateConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"DELETE",path:"/config",handler:"admin.restoreConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"GET",path:"/slug",handler:"admin.getSlug",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/:documentId",handler:"admin.getById",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}},{method:"PUT",path:"/:documentId",handler:"admin.put",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"DELETE",path:"/:documentId",handler:"admin.delete",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/content-type-items/:model",handler:"admin.getContentTypeItems",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/locale",handler:"admin.settingsLocale",config:{policies:["admin::isAuthenticatedAdmin"]}},{method:"GET",path:"/settings/config",handler:"admin.settingsConfig",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"GET",path:"/settings/restart",handler:"admin.settingsRestart",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("settings")]}}]}},{method:"PUT",path:"/i18n/copy/:documentId/:source/:target",handler:"admin.fillFromOtherLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("update")]}}]}},{method:"GET",path:"/i18n/item/read/:source/:target",handler:"admin.readNavigationItemFromLocale",config:{policies:[{name:"admin::hasPermissions",config:{actions:[he.render("read")]}}]}}]},Vl={type:"content-api",routes:[{method:"GET",path:"/render/:idOrSlug",handler:"client.render",config:{policies:[]}},{method:"GET",path:"/render/:idOrSlug/:childUIKey",handler:"client.renderChild",config:{policies:[]}},{method:"GET",path:"/",handler:"client.readAll",config:{policies:[]}}]},Xl={admin:Ql,"content-api":Vl};function Zl(e,t){return ge.default.has(process.env,e)?process.env[e]:t}function At(e){return process.env[e]??""}function Jl(e,t){return ge.default.has(process.env,e)?parseInt(At(e),10):t}function ef(e,t){return ge.default.has(process.env,e)?parseFloat(At(e)):t}function tf(e,t){return ge.default.has(process.env,e)?At(e)==="true":t}function nf(e,t){if(!ge.default.has(process.env,e))return t;try{return JSON.parse(At(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}}function rf(e,t){if(!ge.default.has(process.env,e))return t;let n=At(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>ge.default.trim(ge.default.trim(r," "),'"'))}function of(e,t){return ge.default.has(process.env,e)?new Date(At(e)):t}function af(e,t,n){if(!t)throw new Error("env.oneOf requires expectedValues");if(n&&!t.includes(n))throw new Error("env.oneOf requires defaultValue to be included in expectedValues");const r=uf(e,n);return r!==void 0&&t.includes(r)?r:n}const sf={int:Jl,float:ef,bool:tf,json:nf,array:rf,date:of,oneOf:af},uf=Object.assign(Zl,sf),cf="id",lf="documentId",ff={ID_ATTRIBUTE:cf,DOC_ID_ATTRIBUTE:lf},pf=e=>C.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],C.getOr([],"options.privateAttributes",e)),df=(e,t)=>e?.attributes?.[t]?.private===!0?!0:pf(e).includes(t),Ta=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),hf=e=>e?.type==="media",Ca=e=>e?.type==="relation",mf=e=>!!e&&e.type==="dynamiczone",Ra=e=>!!e&&Ca(e)&&e.relation?.startsWith?.("morphTo"),Xt=async e=>{const t=await Promise.allSettled(e);for(let n=0;n<t.length;n+=1){const r=t[n];if(r.status==="rejected")throw r.reason}return t.map(n=>n.value)},pt=async(e,t,n)=>{const{path:r={raw:null,attribute:null,rawWithIndices:null},schema:i,getModel:a,allowedExtraRootKeys:o}=t;let s=t.parent;const u=async(g,w,S)=>{const R={schema:a(S.__type),path:w,getModel:a,parent:s,allowedExtraRootKeys:o};return pt(g,R,S)},f=g=>async(w,S,x)=>pt(w,{schema:g,path:S,getModel:a,parent:s,allowedExtraRootKeys:o},x),c=async(g,w,S)=>{const T={schema:a("plugin::upload.file"),path:w,getModel:a,parent:s,allowedExtraRootKeys:o};return pt(g,T,S)},l=async(g,w,S,x)=>pt(g,{schema:S,path:w,getModel:a,parent:s,allowedExtraRootKeys:o},x),p=async(g,w,S)=>{const R={schema:a(S.__component),path:w,getModel:a,parent:s,allowedExtraRootKeys:o};return pt(g,R,S)};if(!C.isObject(n)||C.isNil(i))return n;const d=C.clone(n),h=gf({data:d}),m=Object.keys(d);for(let g=0;g<m.length;g+=1){const w=m[g],S=i.attributes[w],x={...r};x.raw=C.isNil(r.raw)?w:`${r.raw}.${w}`,x.rawWithIndices=C.isNil(r.rawWithIndices)?w:`${r.rawWithIndices}.${w}`,C.isNil(S)||(x.attribute=C.isNil(r.attribute)?w:`${r.attribute}.${w}`);const R={data:d,schema:i,key:w,value:d[w],attribute:S,path:x,getModel:a,parent:s,allowedExtraRootKeys:o};await e(R,h);const T=d[w];if(!(C.isNil(T)||C.isNil(S))){if(Ca(S)){s={schema:i,key:w,attribute:S,path:x};const M=S.relation.toLowerCase().startsWith("morph")?u:f(a(S.target));C.isArray(T)?d[w]=await Xt(T.map((A,_)=>{const N={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${_}`:`${x.rawWithIndices}.${_}`};return M(e,N,A)})):d[w]=await M(e,x,T);continue}if(hf(S)){s={schema:i,key:w,attribute:S,path:x},C.isArray(T)?d[w]=await Xt(T.map((O,M)=>{const A={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${M}`:`${x.rawWithIndices}.${M}`};return c(e,A,O)})):d[w]=await c(e,x,T);continue}if(S.type==="component"){s={schema:i,key:w,attribute:S,path:x};const O=a(S.component);C.isArray(T)?d[w]=await Xt(T.map((M,A)=>{const _={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${A}`:`${x.rawWithIndices}.${A}`};return l(e,_,O,M)})):d[w]=await l(e,x,O,T);continue}if(S.type==="dynamiczone"&&C.isArray(T)){s={schema:i,key:w,attribute:S,path:x},d[w]=await Xt(T.map((O,M)=>{const A={...x,rawWithIndices:C.isNil(x.rawWithIndices)?`${M}`:`${x.rawWithIndices}.${M}`};return p(e,A,O)}));continue}}}return d},gf=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var yf=C.curry(pt),Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vf={exports:{}};(function(e,t){(function(n,r){e.exports=r(pn.default,Li.default)})(Ee,function(n,r){return(function(i){function a(s){if(o[s])return o[s].exports;var u=o[s]={exports:{},id:s,loaded:!1};return i[s].call(u.exports,u,u.exports,a),u.loaded=!0,u.exports}var o={};return a.m=i,a.c=o,a.p="",a(0)})([function(i,a,o){i.exports=o(34)},function(i,a,o){var s=o(29)("wks"),u=o(33),f=o(2).Symbol,c=typeof f=="function",l=i.exports=function(p){return s[p]||(s[p]=c&&f[p]||(c?f:u)("Symbol."+p))};l.store=s},function(i,a){var o=i.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=o)},function(i,a,o){var s=o(9);i.exports=function(u){if(!s(u))throw TypeError(u+" is not an object!");return u}},function(i,a,o){i.exports=!o(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(12),u=o(17);i.exports=o(4)?function(f,c,l){return s.f(f,c,u(1,l))}:function(f,c,l){return f[c]=l,f}},function(i,a){var o=i.exports={version:"2.4.0"};typeof __e=="number"&&(__e=o)},function(i,a,o){var s=o(14);i.exports=function(u,f,c){if(s(u),f===void 0)return u;switch(c){case 1:return function(l){return u.call(f,l)};case 2:return function(l,p){return u.call(f,l,p)};case 3:return function(l,p,d){return u.call(f,l,p,d)}}return function(){return u.apply(f,arguments)}}},function(i,a){var o={}.hasOwnProperty;i.exports=function(s,u){return o.call(s,u)}},function(i,a){i.exports=function(o){return typeof o=="object"?o!==null:typeof o=="function"}},function(i,a){i.exports={}},function(i,a){var o={}.toString;i.exports=function(s){return o.call(s).slice(8,-1)}},function(i,a,o){var s=o(3),u=o(26),f=o(32),c=Object.defineProperty;a.f=o(4)?Object.defineProperty:function(l,p,d){if(s(l),p=f(p,!0),s(d),u)try{return c(l,p,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported!");return"value"in d&&(l[p]=d.value),l}},function(i,a,o){var s=o(42),u=o(15);i.exports=function(f){return s(u(f))}},function(i,a){i.exports=function(o){if(typeof o!="function")throw TypeError(o+" is not a function!");return o}},function(i,a){i.exports=function(o){if(o==null)throw TypeError("Can't call method on "+o);return o}},function(i,a,o){var s=o(9),u=o(2).document,f=s(u)&&s(u.createElement);i.exports=function(c){return f?u.createElement(c):{}}},function(i,a){i.exports=function(o,s){return{enumerable:!(1&o),configurable:!(2&o),writable:!(4&o),value:s}}},function(i,a,o){var s=o(12).f,u=o(8),f=o(1)("toStringTag");i.exports=function(c,l,p){c&&!u(c=p?c:c.prototype,f)&&s(c,f,{configurable:!0,value:l})}},function(i,a,o){var s=o(29)("keys"),u=o(33);i.exports=function(f){return s[f]||(s[f]=u(f))}},function(i,a){var o=Math.ceil,s=Math.floor;i.exports=function(u){return isNaN(u=+u)?0:(u>0?s:o)(u)}},function(i,a,o){var s=o(11),u=o(1)("toStringTag"),f=s((function(){return arguments})())=="Arguments",c=function(l,p){try{return l[p]}catch{}};i.exports=function(l){var p,d,h;return l===void 0?"Undefined":l===null?"Null":typeof(d=c(p=Object(l),u))=="string"?d:f?s(p):(h=s(p))=="Object"&&typeof p.callee=="function"?"Arguments":h}},function(i,a){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,a,o){var s=o(2),u=o(6),f=o(7),c=o(5),l="prototype",p=function(d,h,m){var g,w,S,x=d&p.F,R=d&p.G,T=d&p.S,O=d&p.P,M=d&p.B,A=d&p.W,_=R?u:u[h]||(u[h]={}),N=_[l],v=R?s:T?s[h]:(s[h]||{})[l];R&&(m=h);for(g in m)w=!x&&v&&v[g]!==void 0,w&&g in _||(S=w?v[g]:m[g],_[g]=R&&typeof v[g]!="function"?m[g]:M&&w?f(S,s):A&&v[g]==S?(function(j){var H=function(K,E,b){if(this instanceof j){switch(arguments.length){case 0:return new j;case 1:return new j(K);case 2:return new j(K,E)}return new j(K,E,b)}return j.apply(this,arguments)};return H[l]=j[l],H})(S):O&&typeof S=="function"?f(Function.call,S):S,O&&((_.virtual||(_.virtual={}))[g]=S,d&p.R&&N&&!N[g]&&c(N,g,S)))};p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,i.exports=p},function(i,a){i.exports=function(o){try{return!!o()}catch{return!0}}},function(i,a,o){i.exports=o(2).document&&document.documentElement},function(i,a,o){i.exports=!o(4)&&!o(24)(function(){return Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,a,o){var s=o(28),u=o(23),f=o(57),c=o(5),l=o(8),p=o(10),d=o(45),h=o(18),m=o(52),g=o(1)("iterator"),w=!([].keys&&"next"in[].keys()),S="@@iterator",x="keys",R="values",T=function(){return this};i.exports=function(O,M,A,_,N,v,j){d(A,M,_);var H,K,E,b=function(k){if(!w&&k in W)return W[k];switch(k){case x:return function(){return new A(this,k)};case R:return function(){return new A(this,k)}}return function(){return new A(this,k)}},$=M+" Iterator",D=N==R,U=!1,W=O.prototype,Q=W[g]||W[S]||N&&W[N],ee=Q||b(N),Ce=N?D?b("entries"):ee:void 0,F=M=="Array"&&W.entries||Q;if(F&&(E=m(F.call(new O)),E!==Object.prototype&&(h(E,$,!0),s||l(E,g)||c(E,g,T))),D&&Q&&Q.name!==R&&(U=!0,ee=function(){return Q.call(this)}),s&&!j||!w&&!U&&W[g]||c(W,g,ee),p[M]=ee,p[$]=T,N)if(H={values:D?ee:b(R),keys:v?ee:b(x),entries:Ce},j)for(K in H)K in W||f(W,K,H[K]);else u(u.P+u.F*(w||U),M,H);return H}},function(i,a){i.exports=!0},function(i,a,o){var s=o(2),u="__core-js_shared__",f=s[u]||(s[u]={});i.exports=function(c){return f[c]||(f[c]={})}},function(i,a,o){var s,u,f,c=o(7),l=o(41),p=o(25),d=o(16),h=o(2),m=h.process,g=h.setImmediate,w=h.clearImmediate,S=h.MessageChannel,x=0,R={},T="onreadystatechange",O=function(){var A=+this;if(R.hasOwnProperty(A)){var _=R[A];delete R[A],_()}},M=function(A){O.call(A.data)};g&&w||(g=function(A){for(var _=[],N=1;arguments.length>N;)_.push(arguments[N++]);return R[++x]=function(){l(typeof A=="function"?A:Function(A),_)},s(x),x},w=function(A){delete R[A]},o(11)(m)=="process"?s=function(A){m.nextTick(c(O,A,1))}:S?(u=new S,f=u.port2,u.port1.onmessage=M,s=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(A){h.postMessage(A+"","*")},h.addEventListener("message",M,!1)):s=T in d("script")?function(A){p.appendChild(d("script"))[T]=function(){p.removeChild(this),O.call(A)}}:function(A){setTimeout(c(O,A,1),0)}),i.exports={set:g,clear:w}},function(i,a,o){var s=o(20),u=Math.min;i.exports=function(f){return f>0?u(s(f),9007199254740991):0}},function(i,a,o){var s=o(9);i.exports=function(u,f){if(!s(u))return u;var c,l;if(f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u))||typeof(c=u.valueOf)=="function"&&!s(l=c.call(u))||!f&&typeof(c=u.toString)=="function"&&!s(l=c.call(u)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,a){var o=0,s=Math.random();i.exports=function(u){return"Symbol(".concat(u===void 0?"":u,")_",(++o+s).toString(36))}},function(i,a,o){function s(T){return T&&T.__esModule?T:{default:T}}function u(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(T){return(0,g.createHash)("sha256").update(T).digest("hex")}function c(T){switch(S){case"darwin":return T.split("IOPlatformUUID")[1].split(`
|
|
2
2
|
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return T.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return T.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return T.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(T){var O=c((0,m.execSync)(R[S]).toString());return T?O:f(O)}function p(T){return new h.default(function(O,M){return(0,m.exec)(R[S],{},function(A,_,N){if(A)return M(new Error("Error while obtaining machine id: "+A.stack));var v=c(_.toString());return O(T?v:f(v))})})}Object.defineProperty(a,"__esModule",{value:!0});var d=o(35),h=s(d);a.machineIdSync=l,a.machineId=p;var m=o(70),g=o(71),w=process,S=w.platform,x={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},R={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:x[u()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(i,a,o){i.exports={default:o(36),__esModule:!0}},function(i,a,o){o(66),o(68),o(69),o(67),i.exports=o(6).Promise},function(i,a){i.exports=function(){}},function(i,a){i.exports=function(o,s,u,f){if(!(o instanceof s)||f!==void 0&&f in o)throw TypeError(u+": incorrect invocation!");return o}},function(i,a,o){var s=o(13),u=o(31),f=o(62);i.exports=function(c){return function(l,p,d){var h,m=s(l),g=u(m.length),w=f(d,g);if(c&&p!=p){for(;g>w;)if(h=m[w++],h!=h)return!0}else for(;g>w;w++)if((c||w in m)&&m[w]===p)return c||w||0;return!c&&-1}}},function(i,m,o){var s=o(7),u=o(44),f=o(43),c=o(3),l=o(31),p=o(64),d={},h={},m=i.exports=function(g,w,S,x,R){var T,O,M,A,_=R?function(){return g}:p(g),N=s(S,x,w?2:1),v=0;if(typeof _!="function")throw TypeError(g+" is not iterable!");if(f(_)){for(T=l(g.length);T>v;v++)if(A=w?N(c(O=g[v])[0],O[1]):N(g[v]),A===d||A===h)return A}else for(M=_.call(g);!(O=M.next()).done;)if(A=u(M,N,O.value,w),A===d||A===h)return A};m.BREAK=d,m.RETURN=h},function(i,a){i.exports=function(o,s,u){var f=u===void 0;switch(s.length){case 0:return f?o():o.call(u);case 1:return f?o(s[0]):o.call(u,s[0]);case 2:return f?o(s[0],s[1]):o.call(u,s[0],s[1]);case 3:return f?o(s[0],s[1],s[2]):o.call(u,s[0],s[1],s[2]);case 4:return f?o(s[0],s[1],s[2],s[3]):o.call(u,s[0],s[1],s[2],s[3])}return o.apply(u,s)}},function(i,a,o){var s=o(11);i.exports=Object("z").propertyIsEnumerable(0)?Object:function(u){return s(u)=="String"?u.split(""):Object(u)}},function(i,a,o){var s=o(10),u=o(1)("iterator"),f=Array.prototype;i.exports=function(c){return c!==void 0&&(s.Array===c||f[u]===c)}},function(i,a,o){var s=o(3);i.exports=function(u,f,c,l){try{return l?f(s(c)[0],c[1]):f(c)}catch(d){var p=u.return;throw p!==void 0&&s(p.call(u)),d}}},function(i,a,o){var s=o(49),u=o(17),f=o(18),c={};o(5)(c,o(1)("iterator"),function(){return this}),i.exports=function(l,p,d){l.prototype=s(c,{next:u(1,d)}),f(l,p+" Iterator")}},function(i,a,o){var s=o(1)("iterator"),u=!1;try{var f=[7][s]();f.return=function(){u=!0},Array.from(f,function(){throw 2})}catch{}i.exports=function(c,l){if(!l&&!u)return!1;var p=!1;try{var d=[7],h=d[s]();h.next=function(){return{done:p=!0}},d[s]=function(){return h},c(d)}catch{}return p}},function(i,a){i.exports=function(o,s){return{value:s,done:!!o}}},function(i,a,o){var s=o(2),u=o(30).set,f=s.MutationObserver||s.WebKitMutationObserver,c=s.process,l=s.Promise,p=o(11)(c)=="process";i.exports=function(){var d,h,m,g=function(){var R,T;for(p&&(R=c.domain)&&R.exit();d;){T=d.fn,d=d.next;try{T()}catch(O){throw d?m():h=void 0,O}}h=void 0,R&&R.enter()};if(p)m=function(){c.nextTick(g)};else if(f){var w=!0,S=document.createTextNode("");new f(g).observe(S,{characterData:!0}),m=function(){S.data=w=!w}}else if(l&&l.resolve){var x=l.resolve();m=function(){x.then(g)}}else m=function(){u.call(s,g)};return function(R){var T={fn:R,next:void 0};h&&(h.next=T),d||(d=T,m()),h=T}}},function(i,a,o){var s=o(3),u=o(50),f=o(22),c=o(19)("IE_PROTO"),l=function(){},p="prototype",d=function(){var h,m=o(16)("iframe"),g=f.length,w=">";for(m.style.display="none",o(25).appendChild(m),m.src="javascript:",h=m.contentWindow.document,h.open(),h.write("<script>document.F=Object<\/script"+w),h.close(),d=h.F;g--;)delete d[p][f[g]];return d()};i.exports=Object.create||function(h,m){var g;return h!==null?(l[p]=s(h),g=new l,l[p]=null,g[c]=h):g=d(),m===void 0?g:u(g,m)}},function(i,a,o){var s=o(12),u=o(3),f=o(54);i.exports=o(4)?Object.defineProperties:function(c,l){u(c);for(var p,d=f(l),h=d.length,m=0;h>m;)s.f(c,p=d[m++],l[p]);return c}},function(i,a,o){var s=o(55),u=o(17),f=o(13),c=o(32),l=o(8),p=o(26),d=Object.getOwnPropertyDescriptor;a.f=o(4)?d:function(h,m){if(h=f(h),m=c(m,!0),p)try{return d(h,m)}catch{}if(l(h,m))return u(!s.f.call(h,m),h[m])}},function(i,a,o){var s=o(8),u=o(63),f=o(19)("IE_PROTO"),c=Object.prototype;i.exports=Object.getPrototypeOf||function(l){return l=u(l),s(l,f)?l[f]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(i,a,o){var s=o(8),u=o(13),f=o(39)(!1),c=o(19)("IE_PROTO");i.exports=function(l,p){var d,h=u(l),m=0,g=[];for(d in h)d!=c&&s(h,d)&&g.push(d);for(;p.length>m;)s(h,d=p[m++])&&(~f(g,d)||g.push(d));return g}},function(i,a,o){var s=o(53),u=o(22);i.exports=Object.keys||function(f){return s(f,u)}},function(i,a){a.f={}.propertyIsEnumerable},function(i,a,o){var s=o(5);i.exports=function(u,f,c){for(var l in f)c&&u[l]?u[l]=f[l]:s(u,l,f[l]);return u}},function(i,a,o){i.exports=o(5)},function(i,a,o){var s=o(9),u=o(3),f=function(c,l){if(u(c),!s(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};i.exports={set:Object.setPrototypeOf||("__proto__"in{}?(function(c,l,p){try{p=o(7)(Function.call,o(51).f(Object.prototype,"__proto__").set,2),p(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(d,h){return f(d,h),l?d.__proto__=h:p(d,h),d}})({},!1):void 0),check:f}},function(i,a,o){var s=o(2),u=o(6),f=o(12),c=o(4),l=o(1)("species");i.exports=function(p){var d=typeof u[p]=="function"?u[p]:s[p];c&&d&&!d[l]&&f.f(d,l,{configurable:!0,get:function(){return this}})}},function(i,a,o){var s=o(3),u=o(14),f=o(1)("species");i.exports=function(c,l){var p,d=s(c).constructor;return d===void 0||(p=s(d)[f])==null?l:u(p)}},function(i,a,o){var s=o(20),u=o(15);i.exports=function(f){return function(c,l){var p,d,h=String(u(c)),m=s(l),g=h.length;return m<0||m>=g?f?"":void 0:(p=h.charCodeAt(m),p<55296||p>56319||m+1===g||(d=h.charCodeAt(m+1))<56320||d>57343?f?h.charAt(m):p:f?h.slice(m,m+2):(p-55296<<10)+(d-56320)+65536)}}},function(i,a,o){var s=o(20),u=Math.max,f=Math.min;i.exports=function(c,l){return c=s(c),c<0?u(c+l,0):f(c,l)}},function(i,a,o){var s=o(15);i.exports=function(u){return Object(s(u))}},function(i,a,o){var s=o(21),u=o(1)("iterator"),f=o(10);i.exports=o(6).getIteratorMethod=function(c){if(c!=null)return c[u]||c["@@iterator"]||f[s(c)]}},function(i,a,o){var s=o(37),u=o(47),f=o(10),c=o(13);i.exports=o(27)(Array,"Array",function(l,p){this._t=c(l),this._i=0,this._k=p},function(){var l=this._t,p=this._k,d=this._i++;return!l||d>=l.length?(this._t=void 0,u(1)):p=="keys"?u(0,d):p=="values"?u(0,l[d]):u(0,[d,l[d]])},"values"),f.Arguments=f.Array,s("keys"),s("values"),s("entries")},function(i,a){},function(i,a,o){var s,u,f,c=o(28),l=o(2),p=o(7),d=o(21),h=o(23),m=o(9),g=(o(3),o(14)),w=o(38),S=o(40),x=(o(58).set,o(60)),R=o(30).set,T=o(48)(),O="Promise",M=l.TypeError,_=l.process,A=l[O],_=l.process,N=d(_)=="process",v=function(){},j=!!(function(){try{var F=A.resolve(1),k=(F.constructor={})[o(1)("species")]=function(P){P(v,v)};return(N||typeof PromiseRejectionEvent=="function")&&F.then(v)instanceof k}catch{}})(),H=function(F,k){return F===k||F===A&&k===f},K=function(F){var k;return!(!m(F)||typeof(k=F.then)!="function")&&k},E=function(F){return H(A,F)?new b(F):new u(F)},b=u=function(F){var k,P;this.promise=new F(function(V,ce){if(k!==void 0||P!==void 0)throw M("Bad Promise constructor");k=V,P=ce}),this.resolve=g(k),this.reject=g(P)},$=function(F){try{F()}catch(k){return{error:k}}},D=function(F,k){if(!F._n){F._n=!0;var P=F._c;T(function(){for(var V=F._v,ce=F._s==1,L=0,Y=function(I){var q,X,oe=ce?I.ok:I.fail,Z=I.resolve,Ne=I.reject,je=I.domain;try{oe?(ce||(F._h==2&&Q(F),F._h=1),oe===!0?q=V:(je&&je.enter(),q=oe(V),je&&je.exit()),q===I.promise?Ne(M("Promise-chain cycle")):(X=K(q))?X.call(q,Z,Ne):Z(q)):Ne(V)}catch(Hu){Ne(Hu)}};P.length>L;)Y(P[L++]);F._c=[],F._n=!1,k&&!F._h&&U(F)})}},U=function(F){R.call(l,function(){var k,P,V,ce=F._v;if(W(F)&&(k=$(function(){N?_.emit("unhandledRejection",ce,F):(P=l.onunhandledrejection)?P({promise:F,reason:ce}):(V=l.console)&&V.error&&V.error("Unhandled promise rejection",ce)}),F._h=N||W(F)?2:1),F._a=void 0,k)throw k.error})},W=function(F){if(F._h==1)return!1;for(var k,P=F._a||F._c,V=0;P.length>V;)if(k=P[V++],k.fail||!W(k.promise))return!1;return!0},Q=function(F){R.call(l,function(){var k;N?_.emit("rejectionHandled",F):(k=l.onrejectionhandled)&&k({promise:F,reason:F._v})})},ee=function(F){var k=this;k._d||(k._d=!0,k=k._w||k,k._v=F,k._s=2,k._a||(k._a=k._c.slice()),D(k,!0))},Ce=function(F){var k,P=this;if(!P._d){P._d=!0,P=P._w||P;try{if(P===F)throw M("Promise can't be resolved itself");(k=K(F))?T(function(){var V={_w:P,_d:!1};try{k.call(F,p(Ce,V,1),p(ee,V,1))}catch(ce){ee.call(V,ce)}}):(P._v=F,P._s=1,D(P,!1))}catch(V){ee.call({_w:P,_d:!1},V)}}};j||(A=function(F){w(this,A,O,"_h"),g(F),s.call(this);try{F(p(Ce,this,1),p(ee,this,1))}catch(k){ee.call(this,k)}},s=function(F){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},s.prototype=o(56)(A.prototype,{then:function(F,k){var P=E(x(this,A));return P.ok=typeof F!="function"||F,P.fail=typeof k=="function"&&k,P.domain=N?_.domain:void 0,this._c.push(P),this._a&&this._a.push(P),this._s&&D(this,!1),P.promise},catch:function(F){return this.then(void 0,F)}}),b=function(){var F=new s;this.promise=F,this.resolve=p(Ce,F,1),this.reject=p(ee,F,1)}),h(h.G+h.W+h.F*!j,{Promise:A}),o(18)(A,O),o(59)(O),f=o(6)[O],h(h.S+h.F*!j,O,{reject:function(F){var k=E(this),P=k.reject;return P(F),k.promise}}),h(h.S+h.F*(c||!j),O,{resolve:function(F){if(F instanceof A&&H(F.constructor,this))return F;var k=E(this),P=k.resolve;return P(F),k.promise}}),h(h.S+h.F*!(j&&o(46)(function(F){A.all(F).catch(v)})),O,{all:function(F){var k=this,P=E(k),V=P.resolve,ce=P.reject,L=$(function(){var Y=[],I=0,q=1;S(F,!1,function(X){var oe=I++,Z=!1;Y.push(void 0),q++,k.resolve(X).then(function(Ne){Z||(Z=!0,Y[oe]=Ne,--q||V(Y))},ce)}),--q||V(Y)});return L&&ce(L.error),P.promise},race:function(F){var k=this,P=E(k),V=P.reject,ce=$(function(){S(F,!1,function(L){k.resolve(L).then(P.resolve,V)})});return ce&&V(ce.error),P.promise}})},function(i,a,o){var s=o(61)(!0);o(27)(String,"String",function(u){this._t=String(u),this._i=0},function(){var u,f=this._t,c=this._i;return c>=f.length?{value:void 0,done:!0}:(u=s(f,c),this._i+=u.length,{value:u,done:!1})})},function(i,a,o){o(65);for(var s=o(2),u=o(5),f=o(10),c=o(1)("toStringTag"),l=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],p=0;p<5;p++){var d=l[p],h=s[d],m=h&&h.prototype;m&&!m[c]&&u(m,c,d),f[d]=f.Array}},function(i,a){i.exports=pn.default},function(i,a){i.exports=Li.default}])})})(vf);var Pr;try{Pr=Map}catch{}var Lr;try{Lr=Set}catch{}function $a(e,t,n){if(!e||typeof e!="object"||typeof e=="function")return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(kr);if(Pr&&e instanceof Pr)return new Map(Array.from(e.entries()));if(Lr&&e instanceof Lr)return new Set(Array.from(e.values()));if(e instanceof Object){t.push(e);var r=Object.create(e);n.push(r);for(var i in e){var a=t.findIndex(function(o){return o===e[i]});r[i]=a>-1?n[a]:$a(e[i],t,n)}return r}return e}function kr(e){return $a(e,[],[])}const wf=Object.prototype.toString,Ef=Error.prototype.toString,bf=RegExp.prototype.toString,Sf=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",xf=/^Symbol\((.*)\)(.*)$/;function _f(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Bi(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const n=typeof e;if(n==="number")return _f(e);if(n==="string")return t?`"${e}"`:e;if(n==="function")return"[Function "+(e.name||"anonymous")+"]";if(n==="symbol")return Sf.call(e).replace(xf,"Symbol($1)");const r=wf.call(e).slice(8,-1);return r==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):r==="Error"||e instanceof Error?"["+Ef.call(e)+"]":r==="RegExp"?bf.call(e):null}function bt(e,t){let n=Bi(e,t);return n!==null?n:JSON.stringify(e,function(r,i){let a=Bi(this[r],t);return a!==null?a:i},2)}let Ye={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{let i=r!=null&&r!==n,a=`${e} must be a \`${t}\` type, but the final value was: \`${bt(n,!0)}\``+(i?` (cast from the value \`${bt(r,!0)}\`).`:".");return n===null&&(a+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),a},defined:"${path} must be defined"},Ie={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Af={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Dr={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Tf={isValue:"${path} field must be ${value}"},Mr={noUnknown:"${path} field has unspecified keys: ${unknown}"},an={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"};const Cf=Object.assign(Object.create(null),{mixed:Ye,string:Ie,number:Af,date:Dr,object:Mr,array:an,boolean:Tf}),Mn=(e=>e&&e.__isYupSchema__);class Rf{constructor(t,n){if(this.refs=t,this.refs=t,typeof n=="function"){this.fn=n;return}if(!dn.default(n,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:i,otherwise:a}=n,o=typeof r=="function"?r:(...s)=>s.every(u=>u===r);this.fn=function(...s){let u=s.pop(),f=s.pop(),c=o(...s)?i:a;if(c)return typeof c=="function"?c(f):f.concat(c.resolve(u))}}resolve(t,n){let r=this.refs.map(a=>a.getValue(n?.value,n?.parent,n?.context)),i=this.fn.apply(t,r.concat(t,n));if(i===void 0||i===t)return t;if(!Mn(i))throw new TypeError("conditions must return a schema object");return i.resolve(n)}}function Ia(e){return e==null?[]:[].concat(e)}function jr(){return jr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jr.apply(this,arguments)}let Ff=/\$\{\s*(\w+)\s*\}/g;class me extends Error{static formatError(t,n){const r=n.label||n.path||"this";return r!==n.path&&(n=jr({},n,{path:r})),typeof t=="string"?t.replace(Ff,(i,a)=>bt(n[a])):typeof t=="function"?t(n):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,n,r,i){super(),this.name="ValidationError",this.value=n,this.path=r,this.type=i,this.errors=[],this.inner=[],Ia(t).forEach(a=>{me.isError(a)?(this.errors.push(...a.errors),this.inner=this.inner.concat(a.inner.length?a.inner:a)):this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,me)}}const $f=e=>{let t=!1;return(...n)=>{t||(t=!0,e(...n))}};function mn(e,t){let{endEarly:n,tests:r,args:i,value:a,errors:o,sort:s,path:u}=e,f=$f(t),c=r.length;const l=[];if(o=o||[],!c)return o.length?f(new me(o,a,u)):f(null,a);for(let p=0;p<r.length;p++){const d=r[p];d(i,function(m){if(m){if(!me.isError(m))return f(m,a);if(n)return m.value=a,f(m,a);l.push(m)}if(--c<=0){if(l.length&&(s&&l.sort(s),o.length&&l.push(...o),o=l),o.length){f(new me(o,a,u),a);return}f(null,a)}})}}function Tt(e){this._maxSize=e,this.clear()}Tt.prototype.clear=function(){this._size=0,this._values=Object.create(null)};Tt.prototype.get=function(e){return this._values[e]};Tt.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var If=/[^.^\]^[]+|(?=\[\]|\.\.)/g,Of=/^\d+$/,Nf=/^\d/,Pf=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Lf=/^\s*(['"]?)(.*?)(\1)\s*$/,Zr=512,Ui=new Tt(Zr);new Tt(Zr);var Gi=new Tt(Zr),jn={split:Hr,getter:function(e,t){var n=kf(e);return Gi.get(e)||Gi.set(e,function(i){for(var a=0,o=n.length;a<o;)if(i!=null||!t)i=i[n[a++]];else return;return i})},forEach:function(e,t,n){Df(Array.isArray(e)?e:Hr(e),t,n)}};function kf(e){return Ui.get(e)||Ui.set(e,Hr(e).map(function(t){return t.replace(Lf,"$2")}))}function Hr(e){return e.match(If)||[""]}function Df(e,t,n){var r=e.length,i,a,o,s;for(a=0;a<r;a++)i=e[a],i&&(Hf(i)&&(i='"'+i+'"'),s=Oa(i),o=!s&&/^\d+$/.test(i),t.call(n,i,s,o,a,e))}function Oa(e){return typeof e=="string"&&e&&["'",'"'].indexOf(e.charAt(0))!==-1}function Mf(e){return e.match(Nf)&&!e.match(Of)}function jf(e){return Pf.test(e)}function Hf(e){return!Oa(e)&&(Mf(e)||jf(e))}const Zt={context:"$",value:"."};class tt{constructor(t,n={}){if(typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Zt.context,this.isValue=this.key[0]===Zt.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Zt.context:this.isValue?Zt.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&jn.getter(this.path,!0),this.map=n.map}getValue(t,n,r){let i=this.isContext?r:this.isValue?t:n;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,n){return this.getValue(t,n?.parent,n?.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}tt.prototype.__isYupRef=!0;function gn(){return gn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gn.apply(this,arguments)}function Bf(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Jt(e){function t(n,r){let{value:i,path:a="",label:o,options:s,originalValue:u,sync:f}=n,c=Bf(n,["value","path","label","options","originalValue","sync"]);const{name:l,test:p,params:d,message:h}=e;let{parent:m,context:g}=s;function w(O){return tt.isRef(O)?O.getValue(i,m,g):O}function S(O={}){const M=ua.default(gn({value:i,originalValue:u,label:o,path:O.path||a},d,O.params),w),A=new me(me.formatError(O.message||h,M),i,M.path,O.type||l);return A.params=M,A}let x=gn({path:a,parent:m,type:l,createError:S,resolve:w,options:s,originalValue:u},c);if(!f){try{Promise.resolve(p.call(x,i,x)).then(O=>{me.isError(O)?r(O):O?r(null,O):r(S())})}catch(O){r(O)}return}let R;try{var T;if(R=p.call(x,i,x),typeof((T=R)==null?void 0:T.then)=="function")throw new Error(`Validation test of type: "${x.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(O){r(O);return}me.isError(R)?r(R):R?r(null,R):r(S())}return t.OPTIONS=e,t}let Uf=e=>e.substr(0,e.length-1).substr(1);function Gf(e,t,n,r=n){let i,a,o;return t?(jn.forEach(t,(s,u,f)=>{let c=u?Uf(s):s;if(e=e.resolve({context:r,parent:i,value:n}),e.innerType){let l=f?parseInt(c,10):0;if(n&&l>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${s}, in the path: ${t}. because there is no value at that index. `);i=n,n=n&&n[l],e=e.innerType}if(!f){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e._type}")`);i=n,n=n&&n[c],e=e.fields[c]}a=c,o=u?"["+s+"]":"."+s}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}class yn{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const t=[];for(const n of this.list)t.push(n);for(const[,n]of this.refs)t.push(n.describe());return t}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(t){tt.isRef(t)?this.refs.set(t.key,t):this.list.add(t)}delete(t){tt.isRef(t)?this.refs.delete(t.key):this.list.delete(t)}has(t,n){if(this.list.has(t))return!0;let r,i=this.refs.values();for(;r=i.next(),!r.done;)if(n(r.value)===t)return!0;return!1}clone(){const t=new yn;return t.list=new Set(this.list),t.refs=new Map(this.refs),t}merge(t,n){const r=this.clone();return t.list.forEach(i=>r.add(i)),t.refs.forEach(i=>r.add(i)),n.list.forEach(i=>r.delete(i)),n.refs.forEach(i=>r.delete(i)),r}}function Re(){return Re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Re.apply(this,arguments)}class ye{constructor(t){this.deps=[],this.conditions=[],this._whitelist=new yn,this._blacklist=new yn,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Ye.notType)}),this.type=t?.type||"mixed",this.spec=Re({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},t?.spec)}get _type(){return this.type}_typeCheck(t){return!0}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeError=this._typeError,n._whitelistError=this._whitelistError,n._blacklistError=this._blacklistError,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.exclusiveTests=Re({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=kr(Re({},this.spec,t)),n}label(t){var n=this.clone();return n.spec.label=t,n}meta(...t){if(t.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},t[0]),n}withMutation(t){let n=this._mutate;this._mutate=!0;let r=t(this);return this._mutate=n,r}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let n=this,r=t.clone();const i=Re({},n.spec,r.spec);return r.spec=i,r._typeError||(r._typeError=n._typeError),r._whitelistError||(r._whitelistError=n._whitelistError),r._blacklistError||(r._blacklistError=n._blacklistError),r._whitelist=n._whitelist.merge(t._whitelist,t._blacklist),r._blacklist=n._blacklist.merge(t._blacklist,t._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(a=>{t.tests.forEach(o=>{a.test(o.OPTIONS)})}),r}isType(t){return this.spec.nullable&&t===null?!0:this._typeCheck(t)}resolve(t){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((i,a)=>a.resolve(i,t),n),n=n.resolve(t)}return n}cast(t,n={}){let r=this.resolve(Re({value:t},n)),i=r._cast(t,n);if(t!==void 0&&n.assert!==!1&&r.isType(i)!==!0){let a=bt(t),o=bt(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r._type}".
|
|
3
3
|
|
|
4
4
|
attempted value: ${a}
|
package/dist/server/index.mjs
CHANGED
|
@@ -529,7 +529,7 @@ const ao = (e) => e === !0 ? !0 : Array.isArray(e) ? e.includes("items") : !1, S
|
|
|
529
529
|
locale: "*",
|
|
530
530
|
limit: Number.MAX_SAFE_INTEGER
|
|
531
531
|
}), n = await e.strapi.plugin("i18n").service("locales").getDefaultLocale();
|
|
532
|
-
await Promise.all(
|
|
532
|
+
n && await Promise.all(
|
|
533
533
|
t.map(async (r) => {
|
|
534
534
|
t.find(
|
|
535
535
|
({ documentId: a, locale: o }) => a === r.documentId && o === n
|
|
@@ -1017,7 +1017,7 @@ const ao = (e) => e === !0 ? !0 : Array.isArray(e) ? e.includes("items") : !1, S
|
|
|
1017
1017
|
related: {
|
|
1018
1018
|
type: "relation",
|
|
1019
1019
|
relation: "morphToMany",
|
|
1020
|
-
required: !
|
|
1020
|
+
required: !1,
|
|
1021
1021
|
configurable: !1
|
|
1022
1022
|
},
|
|
1023
1023
|
parent: {
|