strapi-plugin-navigation
Version:
Strapi - Navigation plugin
2 lines • 254 kB
JavaScript
"use strict";const Wr=require("zod"),H=require("lodash"),S=require("lodash/fp"),Zu=require("crypto"),Ju=require("child_process"),ec=require("lodash/has"),tc=require("lodash/mapValues"),nc=require("lodash/snakeCase"),rc=require("lodash/camelCase"),ic=require("lodash/mapKeys"),oc=require("os"),sc=require("path"),ac=require("fs"),uc=require("assert"),cc=require("events"),lc=require("buffer"),fc=require("stream"),pc=require("util"),dc=require("constants");require("node:stream");const hc=require("@sindresorhus/slugify"),mc=require("pluralize"),ae=e=>e&&e.__esModule?e:{default:e};function gc(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 y=gc(Wr),fe=ae(H),Hi=ae(Zu),mn=ae(Ju),gn=ae(ec),Es=ae(tc),Ui=ae(nc),yc=ae(rc),vc=ae(ic),Bn=ae(oc),Ee=ae(sc),Ye=ae(ac),ws=ae(uc),Ec=ae(cc),wc=ae(lc),Hn=ae(fc),ut=ae(pc),bc=ae(dc),_c=ae(hc),Gi=ae(mc),Yr=y.object({name:y.string().refine(e=>!e.includes(" "),{message:"No space allowed"}),label:y.string(),required:y.boolean().optional(),enabled:y.boolean().optional()}),xc=Yr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string())}),Sc=Yr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),Ac=Yr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),Tc=y.union([Sc,Ac,xc]),Cc=y.union([y.literal("audience"),Tc]),De=y.object({additionalFields:y.array(Cc),allowedLevels:y.number(),contentTypes:y.array(y.string()),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()}),Rc=y.enum(["collectionType","singleType"]),$c=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),bs=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()}),Fc=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Ic=bs.extend({type:Fc}),Oc=bs.extend({type:y.literal("enumeration"),enum:y.string().array()}),Nc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),Pc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),Lc=y.object({type:y.literal("uid")}),Dc=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),kc=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Mc=y.object({type:y.literal("relation"),relation:kc,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),jc=y.record(y.string(),y.union([Ic,Oc,Nc,Pc,Mc,Dc,Lc])),Rr=y.object({kind:Rc,collectionName:y.string(),info:$c,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:jc,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()});Rr.pick({info:!0,kind:!0,attributes:!0,options:!0});const _s=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),Bc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Vr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:Bc,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(),additionalFields:y.record(y.string(),y.unknown()).or(y.null()).optional(),audience:y.array(_s).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),Hc=Vr.omit({related:!0}).pick({path:!0,type:!0,uiRouterKey:!0,title:!0,externalPath:!0}).extend({related:y.unknown()}),Ht=Vr.extend({parent:y.lazy(()=>Ht.or(y.null())).optional(),items:y.lazy(()=>Ht.array()).optional(),master:y.lazy(()=>et(!1)).optional()}),qi=y.array(Ht),et=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(Ht):Ht.array().optional()}),Uc=et(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),Gc=Vr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>xs).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),xs=y.array(Gc),qc=et(!1).extend({items:xs}).partial().required({id:!0,documentId:!0}),zc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Kc=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Wc="$",Ss=["api::","plugin::"],As=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Yc=["title","subject","name"],zi={SINGLE:"singleType"},Ki=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],Vc=e=>e.filter(t=>t!=="audience"),Ts=e=>{const t=Vc(e);if(t.length!==H.uniqBy(t,"name").length)throw new Error("All names of custom fields must be unique.");if(!H.isNil(H.find(t,n=>typeof n=="object"&&H.includes(Ki,n.name))))throw new Error(`Name of custom field cannot be one of: ${Ki.join(", ")}`)},Cs=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},Qc=(e="")=>{const t=s=>s.split("-").map(o=>H.capitalize(o)).join(""),[n,r,i]=Xc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Xc=(e="")=>e.split(zc).filter(t=>t&&t.length>0),Zc=(e,t)=>n=>[n,async r=>{await oe(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],Rs=(e,t)=>Object.fromEntries(Kc.map(Zc(e,t))),be=({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 oe({strapi:e},t){return e.plugin("navigation").service(t)}const Zt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,Jc=(e="")=>{const t=!!Ss.find(r=>e.includes(r)),n=!As.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Wi=(e="")=>H.last(e)==="s"?e.substr(0,e.length-1):e,$s=async({strapi:e,forceDefault:t=!1})=>{const n=e.store({type:"plugin",name:"navigation"}),r=await e.plugin("navigation").config,i=t?{}:{...$r.default,...await n.get({key:"config"})??$r.default};let s=H.isEmpty(i)?i:De.parse(i);const o=el(s,r);return s={additionalFields:o("additionalFields"),contentTypes:o("contentTypes"),contentTypesNameFields:o("contentTypesNameFields"),contentTypesPopulate:o("contentTypesPopulate"),allowedLevels:o("allowedLevels"),gql:o("gql"),pathDefaultFields:o("pathDefaultFields"),cascadeMenuAttached:o("cascadeMenuAttached"),preferCustomContentTypes:o("preferCustomContentTypes"),isCacheEnabled:o("isCacheEnabled")},tl(s,{strapi:e}),Ts(s.additionalFields),await n.set({key:"config",value:s}),s},el=(e,t)=>n=>{const r=e?.[n]??t(n);return Cs(r,new Error(`[Navigation] Config "${n}" is undefined`)),r},tl=(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))},$r={default:{additionalFields:[],allowedLevels:2,contentTypes:[],contentTypesNameFields:{},contentTypesPopulate:{},gql:{navigationItemRelated:[]},i18nEnabled:!1,pathDefaultFields:{},pruneObsoleteI18nNavigations:!1,cascadeMenuAttached:!0,preferCustomContentTypes:!1,isCacheEnabled:!1}},nl=H.once(e=>({find(t,n){const{audienceModel:{uid:r}}=be(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(_s.array().parse)}})),yn=(e,t)=>({findFirst(n,r,i={}){return e.strapi.documents(t).findFirst({populate:Zt(n),status:r,...i})},findById(n,r,i,s={}){return e.strapi.documents(t).findOne({documentId:n,populate:Zt(r),status:i,...s})},findManyById(n,r,i){return e.strapi.documents(t).findMany({where:{documentId:{$in:n}},populate:Zt(r),status:i})},findMany(n,r,i,s){return e.strapi.documents(t).findMany({where:n,populate:Zt(r),status:i,locale:s})},count(n,r){return e.strapi.documents(t).count({where:n,status:r})}}),Pe=H.once(e=>({async save({item:t,locale:n}){const{itemModel:r}=be(e),{__type:i,documentId:s}=t?.related??{},o=i?yn(e,i):void 0,a=i&&o?s?await o.findById(s,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:a?{...a,__type:i}:void 0},locale:n})}else return e.strapi.documents(r.uid).create({data:{...t,related:a?{...a,__type:i}:void 0},locale:n})},find({filters:t,locale:n,limit:r,order:i,populate:s}){const{itemModel:o}=be(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:s,orderBy:i}).then(a=>a.map(Fr)).then(qi.parse).then(a=>a.map(vn))},count(t){const{itemModel:n}=be(e);return e.strapi.query(n.uid).count({where:t})},remove(t){const{itemModel:n}=be(e);return e.strapi.query(n.uid).delete({where:{documentId:t.documentId}})},removeForIds(t){const{itemModel:n}=be(e);return e.strapi.query(n.uid).deleteMany({where:{documentId:t}})},findForMasterIds(t){const{itemModel:n}=be(e);return e.strapi.query(n.uid).findMany({where:{$or:t.map(r=>({master:r}))},limit:Number.MAX_SAFE_INTEGER}).then(qi.parse)}})),rl=["id","publishedAt","createdAt","updatedAt","locale"],vn=({related:e,items:t=[],...n})=>({...n,items:t.map(vn),related:e?H.omit(e,rl):void 0}),Fr=({related:e,...t})=>({...t,related:e?.[0]});class At extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class sr extends At{constructor(){super(...arguments),this.type="FillNavigationError"}}class il extends At{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Yi=e=>e===!0?!0:Array.isArray(e)?e.includes("items"):!1,Ne=H.once(e=>({find({filters:t,locale:n,limit:r,orderBy:i,populate:s}){const{masterModel:o}=be(e);return e.strapi.documents(o.uid).findMany({filters:t,locale:n,limit:r,populate:s,orderBy:i}).then(a=>a.map(({items:u,...f})=>({...f,items:u?.map(Fr)}))).then(a=>a.map(({items:u,...f})=>({...f,items:u?.map(vn)}))).then(a=>et(Yi(s)).array().parse(a))},findOne({locale:t,filters:n,populate:r}){const{masterModel:i}=be(e);return e.strapi.documents(i.uid).findOne({documentId:n.documentId,locale:t,populate:r}).then(s=>s&&{...s,items:s.items?.map(Fr)}).then(s=>et(Yi(r)).parse(s)).then(s=>({...s,items:s.items?.map(vn)}))},async save(t){const{masterModel:n}=be(e),{documentId:r,locale:i,...s}=t;return r?e.strapi.documents(n.uid).update({locale:i,documentId:r,data:H.omit(s,["id","documentId"]),populate:["items"]}).then(et(!1).parse):e.strapi.documents(n.uid).create({locale:i,data:{...s,populate:["items"]}}).then(et(!1).parse)},remove(t){const{masterModel:n}=be(e);if(!t.documentId&&!t.id)throw new At("Some kind of id required. None given.");return e.strapi.query(n.uid).deleteMany({where:t})}})),ol="Navigation",sl="navigation",al=async e=>{const t=oe(e,"common"),{defaultLocale:n,restLocale:r=[]}=await t.readLocale(),i=Ne(e),s=await i.find({limit:Number.MAX_SAFE_INTEGER,filters:{},locale:"*"});s.length===0&&s.push(await i.save({name:ol,visible:!0,locale:n,slug:sl}));const o=s.filter(({locale:a})=>a===n);for(const a of o)for(const u of r)!s.find(({locale:c,documentId:l})=>l===a.documentId&&u===c)&&await i.save({documentId:a.documentId,name:a.name,locale:u,visible:a.visible,slug:a.slug})},he={render:function(e){return`plugin::navigation.${e}`},navigation:{read:"read",update:"update",settings:"settings"}},ul=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)},cl=({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")}}),ll=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await oe({strapi:t},"common").getPluginStore(),o=De.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(a=>n.nonNull.list.string(a))}}),fl=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),pl=({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"})}}),dl=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),hl=({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")}}),ml=({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"})}}),gl=({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"})}}),yl=({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")}}),vl=({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(s){s.members(...r)},resolveType:s=>e.contentTypes[s.__type]?.globalId}):t.objectType({name:i,definition(s){s.int("id"),s.string("documentId"),s.string("title"),s.string("name")}})},wl=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),bl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),_l=[vl,El,yl,bl,hl,gl,ll,cl,ml,dl,pl,fl,wl],xl=e=>_l.map(t=>t(e)),Sl="I18NLocaleCode",Al=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:s}=t;return{args:{navigationIdOrSlug:n(i()),type:"NavigationRenderType",menuOnly:s(),path:i(),locale:t.arg({type:Sl})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Wr.z.string().parse(f);return oe({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},Tl=({strapi:e,nexus:t})=>{const{nonNull:n,list:r,stringArg:i,booleanArg:s}=t;return{type:n(r("NavigationItem")),args:{documentId:n(i()),childUiKey:n(i()),type:"NavigationRenderType",menuOnly:s()},resolve(o,a){const{documentId:u,childUIKey:f,type:c,menuOnly:l}=a,p=Wr.z.string().parse(u);return oe({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},Cl=e=>{const t={renderNavigationChild:Tl,renderNavigation:Al};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const s=i(e);n.field(r,s)}}})},Rl=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),$l=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 oe({strapi:e},"common").getPluginStore(),i=De.parse(await r.get({key:"config"}));t.use(({strapi:s,nexus:o})=>{const a=xl({strapi:s,nexus:o,config:i}),u=Cl({strapi:s,nexus:o}),f=Rl();return{types:[a,u],resolversConfig:f}})},Fl=async({strapi:e})=>{!!e.plugin("graphql")&&await $l({strapi:e})},Il=async e=>{await $s(e),await al(e),await ul(e),await Fl(e)},Ol=({strapi:e})=>{},Nl=({strapi:e})=>{},Pl={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"}}},Ll={schema:Pl},Dl=Rs("navigation",{strapi}),kl={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"}}},Ml={schema:kl,lifecycles:Dl},jl=Rs("navigation-item",{strapi}),Bl={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:{}}}},Hl={schema:Bl,lifecycles:jl},Ul={audience:Ll,navigation:Ml,"navigation-item":Hl},Fs=y.enum(["true","false"]),Jt=y.string(),Gl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),Is=y.enum(["FLAT","TREE","RFR"]),Os=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),ql=y.object({type:Is.optional(),menu:Fs.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Os.optional()}),zl=y.object({type:Is.optional(),menu:Fs.optional(),locale:y.string().optional()}),Kl=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function Wl(e){return{getAdminService(){return oe(e,"admin")},getCommonService(){return oe(e,"common")},async get(){return await this.getAdminService().get({})},post(t){const{auditLog:n}=t;return this.getAdminService().post({payload:Uc.parse(t.request.body),auditLog:n})},put(t){const{params:{documentId:n},auditLog:r}=t,i=y.record(y.string(),y.unknown()).parse(t.request.body);return this.getAdminService().put({auditLog:r,payload:qc.parse({...i,documentId:n})})},async delete(t){const{auditLog:n,params:{documentId:r}}=t;return await this.getAdminService().delete({documentId:Jt.parse(r),auditLog:n}),{}},config(){return this.getAdminService().config({viaSettingsPage:!1})},async updateConfig(t){return await this.getAdminService().updateConfig({config:De.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:Jt.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:s,documentId:o}=Kl.parse(n);return await this.getAdminService().fillFromOtherLocale({source:i,target:s,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:Jt.parse(n),target:Jt.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()}}}const Yl=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Vl(e){return{getService(){return oe(e,"client")},async readAll(t){try{const{query:n={}}=t,{locale:r,orderBy:i,orderDirection:s}=Gl.parse(n);return await this.getService().readAll({locale:r,orderBy:i,orderDirection:s})}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:s,path:o,locale:a,populate:u}=ql.parse(r),f=y.string().parse(n.idOrSlug);return await this.getService().render({idOrSlug:f,type:i,menuOnly:s==="true",rootPath:o,locale:a,populate:Yl(Os.parse(u==="true"?!0:u==="false"?!1:Array.isArray(u)?u.map(c=>c==="true"?!0:c==="false"?!1:u):u))})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:s,locale:o}=zl.parse(r),a=y.string().parse(n.documentId),u=y.string().parse(n.childUIKey);return await this.getService().renderChildren({idOrSlug:a,childUIKey:u,type:i,menuOnly:s==="true",locale:o})}}}const Ql={admin:Wl,client:Vl},Xl={},Zl={},Jl={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")]}}]}}]},ef={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:[]}}]},tf={admin:Jl,"content-api":ef};var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ns(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nf={exports:{}};(function(e,t){(function(n,r){e.exports=r(mn.default,Hi.default)})(ye,function(n,r){return function(i){function s(a){if(o[a])return o[a].exports;var u=o[a]={exports:{},id:a,loaded:!1};return i[a].call(u.exports,u,u.exports,s),u.loaded=!0,u.exports}var o={};return s.m=i,s.c=o,s.p="",s(0)}([function(i,s,o){i.exports=o(34)},function(i,s,o){var a=o(29)("wks"),u=o(33),f=o(2).Symbol,c=typeof f=="function",l=i.exports=function(p){return a[p]||(a[p]=c&&f[p]||(c?f:u)("Symbol."+p))};l.store=a},function(i,s){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,s,o){var a=o(9);i.exports=function(u){if(!a(u))throw TypeError(u+" is not an object!");return u}},function(i,s,o){i.exports=!o(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,s,o){var a=o(12),u=o(17);i.exports=o(4)?function(f,c,l){return a.f(f,c,u(1,l))}:function(f,c,l){return f[c]=l,f}},function(i,s){var o=i.exports={version:"2.4.0"};typeof __e=="number"&&(__e=o)},function(i,s,o){var a=o(14);i.exports=function(u,f,c){if(a(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,s){var o={}.hasOwnProperty;i.exports=function(a,u){return o.call(a,u)}},function(i,s){i.exports=function(o){return typeof o=="object"?o!==null:typeof o=="function"}},function(i,s){i.exports={}},function(i,s){var o={}.toString;i.exports=function(a){return o.call(a).slice(8,-1)}},function(i,s,o){var a=o(3),u=o(26),f=o(32),c=Object.defineProperty;s.f=o(4)?Object.defineProperty:function(l,p,d){if(a(l),p=f(p,!0),a(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,s,o){var a=o(42),u=o(15);i.exports=function(f){return a(u(f))}},function(i,s){i.exports=function(o){if(typeof o!="function")throw TypeError(o+" is not a function!");return o}},function(i,s){i.exports=function(o){if(o==null)throw TypeError("Can't call method on "+o);return o}},function(i,s,o){var a=o(9),u=o(2).document,f=a(u)&&a(u.createElement);i.exports=function(c){return f?u.createElement(c):{}}},function(i,s){i.exports=function(o,a){return{enumerable:!(1&o),configurable:!(2&o),writable:!(4&o),value:a}}},function(i,s,o){var a=o(12).f,u=o(8),f=o(1)("toStringTag");i.exports=function(c,l,p){c&&!u(c=p?c:c.prototype,f)&&a(c,f,{configurable:!0,value:l})}},function(i,s,o){var a=o(29)("keys"),u=o(33);i.exports=function(f){return a[f]||(a[f]=u(f))}},function(i,s){var o=Math.ceil,a=Math.floor;i.exports=function(u){return isNaN(u=+u)?0:(u>0?a:o)(u)}},function(i,s,o){var a=o(11),u=o(1)("toStringTag"),f=a(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?a(p):(h=a(p))=="Object"&&typeof p.callee=="function"?"Arguments":h}},function(i,s){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,s,o){var a=o(2),u=o(6),f=o(7),c=o(5),l="prototype",p=function(d,h,m){var g,b,x,C=d&p.F,T=d&p.G,R=d&p.S,$=d&p.P,M=d&p.B,_=d&p.W,A=T?u:u[h]||(u[h]={}),O=A[l],E=T?a:R?a[h]:(a[h]||{})[l];T&&(m=h);for(g in m)b=!C&&E&&E[g]!==void 0,b&&g in A||(x=b?E[g]:m[g],A[g]=T&&typeof E[g]!="function"?m[g]:M&&b?f(x,a):_&&E[g]==x?function(L){var B=function(z,w,v){if(this instanceof L){switch(arguments.length){case 0:return new L;case 1:return new L(z);case 2:return new L(z,w)}return new L(z,w,v)}return L.apply(this,arguments)};return B[l]=L[l],B}(x):$&&typeof x=="function"?f(Function.call,x):x,$&&((A.virtual||(A.virtual={}))[g]=x,d&p.R&&O&&!O[g]&&c(O,g,x)))};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,s){i.exports=function(o){try{return!!o()}catch{return!0}}},function(i,s,o){i.exports=o(2).document&&document.documentElement},function(i,s,o){i.exports=!o(4)&&!o(24)(function(){return Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,s,o){var a=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"),b=!([].keys&&"next"in[].keys()),x="@@iterator",C="keys",T="values",R=function(){return this};i.exports=function($,M,_,A,O,E,L){d(_,M,A);var B,z,w,v=function(k){if(!b&&k in K)return K[k];switch(k){case C:return function(){return new _(this,k)};case T:return function(){return new _(this,k)}}return function(){return new _(this,k)}},j=M+" Iterator",D=O==T,U=!1,K=$.prototype,V=K[g]||K[x]||O&&K[O],ee=V||v(O),Ce=O?D?v("entries"):ee:void 0,I=M=="Array"&&K.entries||V;if(I&&(w=m(I.call(new $)),w!==Object.prototype&&(h(w,j,!0),a||l(w,g)||c(w,g,R))),D&&V&&V.name!==T&&(U=!0,ee=function(){return V.call(this)}),a&&!L||!b&&!U&&K[g]||c(K,g,ee),p[M]=ee,p[j]=R,O)if(B={values:D?ee:v(T),keys:E?ee:v(C),entries:Ce},L)for(z in B)z in K||f(K,z,B[z]);else u(u.P+u.F*(b||U),M,B);return B}},function(i,s){i.exports=!0},function(i,s,o){var a=o(2),u="__core-js_shared__",f=a[u]||(a[u]={});i.exports=function(c){return f[c]||(f[c]={})}},function(i,s,o){var a,u,f,c=o(7),l=o(41),p=o(25),d=o(16),h=o(2),m=h.process,g=h.setImmediate,b=h.clearImmediate,x=h.MessageChannel,C=0,T={},R="onreadystatechange",$=function(){var _=+this;if(T.hasOwnProperty(_)){var A=T[_];delete T[_],A()}},M=function(_){$.call(_.data)};g&&b||(g=function(_){for(var A=[],O=1;arguments.length>O;)A.push(arguments[O++]);return T[++C]=function(){l(typeof _=="function"?_:Function(_),A)},a(C),C},b=function(_){delete T[_]},o(11)(m)=="process"?a=function(_){m.nextTick(c($,_,1))}:x?(u=new x,f=u.port2,u.port1.onmessage=M,a=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(a=function(_){h.postMessage(_+"","*")},h.addEventListener("message",M,!1)):a=R in d("script")?function(_){p.appendChild(d("script"))[R]=function(){p.removeChild(this),$.call(_)}}:function(_){setTimeout(c($,_,1),0)}),i.exports={set:g,clear:b}},function(i,s,o){var a=o(20),u=Math.min;i.exports=function(f){return f>0?u(a(f),9007199254740991):0}},function(i,s,o){var a=o(9);i.exports=function(u,f){if(!a(u))return u;var c,l;if(f&&typeof(c=u.toString)=="function"&&!a(l=c.call(u))||typeof(c=u.valueOf)=="function"&&!a(l=c.call(u))||!f&&typeof(c=u.toString)=="function"&&!a(l=c.call(u)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,s){var o=0,a=Math.random();i.exports=function(u){return"Symbol(".concat(u===void 0?"":u,")_",(++o+a).toString(36))}},function(i,s,o){function a(R){return R&&R.__esModule?R:{default:R}}function u(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function f(R){return(0,g.createHash)("sha256").update(R).digest("hex")}function c(R){switch(x){case"darwin":return R.split("IOPlatformUUID")[1].split(`
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return R.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return R.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return R.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(R){var $=c((0,m.execSync)(T[x]).toString());return R?$:f($)}function p(R){return new h.default(function($,M){return(0,m.exec)(T[x],{},function(_,A,O){if(_)return M(new Error("Error while obtaining machine id: "+_.stack));var E=c(A.toString());return $(R?E:f(E))})})}Object.defineProperty(s,"__esModule",{value:!0});var d=o(35),h=a(d);s.machineIdSync=l,s.machineId=p;var m=o(70),g=o(71),b=process,x=b.platform,C={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},T={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:C[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,s,o){i.exports={default:o(36),__esModule:!0}},function(i,s,o){o(66),o(68),o(69),o(67),i.exports=o(6).Promise},function(i,s){i.exports=function(){}},function(i,s){i.exports=function(o,a,u,f){if(!(o instanceof a)||f!==void 0&&f in o)throw TypeError(u+": incorrect invocation!");return o}},function(i,s,o){var a=o(13),u=o(31),f=o(62);i.exports=function(c){return function(l,p,d){var h,m=a(l),g=u(m.length),b=f(d,g);if(c&&p!=p){for(;g>b;)if(h=m[b++],h!=h)return!0}else for(;g>b;b++)if((c||b in m)&&m[b]===p)return c||b||0;return!c&&-1}}},function(i,m,o){var a=o(7),u=o(44),f=o(43),c=o(3),l=o(31),p=o(64),d={},h={},m=i.exports=function(g,b,x,C,T){var R,$,M,_,A=T?function(){return g}:p(g),O=a(x,C,b?2:1),E=0;if(typeof A!="function")throw TypeError(g+" is not iterable!");if(f(A)){for(R=l(g.length);R>E;E++)if(_=b?O(c($=g[E])[0],$[1]):O(g[E]),_===d||_===h)return _}else for(M=A.call(g);!($=M.next()).done;)if(_=u(M,O,$.value,b),_===d||_===h)return _};m.BREAK=d,m.RETURN=h},function(i,s){i.exports=function(o,a,u){var f=u===void 0;switch(a.length){case 0:return f?o():o.call(u);case 1:return f?o(a[0]):o.call(u,a[0]);case 2:return f?o(a[0],a[1]):o.call(u,a[0],a[1]);case 3:return f?o(a[0],a[1],a[2]):o.call(u,a[0],a[1],a[2]);case 4:return f?o(a[0],a[1],a[2],a[3]):o.call(u,a[0],a[1],a[2],a[3])}return o.apply(u,a)}},function(i,s,o){var a=o(11);i.exports=Object("z").propertyIsEnumerable(0)?Object:function(u){return a(u)=="String"?u.split(""):Object(u)}},function(i,s,o){var a=o(10),u=o(1)("iterator"),f=Array.prototype;i.exports=function(c){return c!==void 0&&(a.Array===c||f[u]===c)}},function(i,s,o){var a=o(3);i.exports=function(u,f,c,l){try{return l?f(a(c)[0],c[1]):f(c)}catch(d){var p=u.return;throw p!==void 0&&a(p.call(u)),d}}},function(i,s,o){var a=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=a(c,{next:u(1,d)}),f(l,p+" Iterator")}},function(i,s,o){var a=o(1)("iterator"),u=!1;try{var f=[7][a]();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[a]();h.next=function(){return{done:p=!0}},d[a]=function(){return h},c(d)}catch{}return p}},function(i,s){i.exports=function(o,a){return{value:a,done:!!o}}},function(i,s,o){var a=o(2),u=o(30).set,f=a.MutationObserver||a.WebKitMutationObserver,c=a.process,l=a.Promise,p=o(11)(c)=="process";i.exports=function(){var d,h,m,g=function(){var T,R;for(p&&(T=c.domain)&&T.exit();d;){R=d.fn,d=d.next;try{R()}catch($){throw d?m():h=void 0,$}}h=void 0,T&&T.enter()};if(p)m=function(){c.nextTick(g)};else if(f){var b=!0,x=document.createTextNode("");new f(g).observe(x,{characterData:!0}),m=function(){x.data=b=!b}}else if(l&&l.resolve){var C=l.resolve();m=function(){C.then(g)}}else m=function(){u.call(a,g)};return function(T){var R={fn:T,next:void 0};h&&(h.next=R),d||(d=R,m()),h=R}}},function(i,s,o){var a=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,b=">";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"+b),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]=a(h),g=new l,l[p]=null,g[c]=h):g=d(),m===void 0?g:u(g,m)}},function(i,s,o){var a=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;)a.f(c,p=d[m++],l[p]);return c}},function(i,s,o){var a=o(55),u=o(17),f=o(13),c=o(32),l=o(8),p=o(26),d=Object.getOwnPropertyDescriptor;s.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(!a.f.call(h,m),h[m])}},function(i,s,o){var a=o(8),u=o(63),f=o(19)("IE_PROTO"),c=Object.prototype;i.exports=Object.getPrototypeOf||function(l){return l=u(l),a(l,f)?l[f]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(i,s,o){var a=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&&a(h,d)&&g.push(d);for(;p.length>m;)a(h,d=p[m++])&&(~f(g,d)||g.push(d));return g}},function(i,s,o){var a=o(53),u=o(22);i.exports=Object.keys||function(f){return a(f,u)}},function(i,s){s.f={}.propertyIsEnumerable},function(i,s,o){var a=o(5);i.exports=function(u,f,c){for(var l in f)c&&u[l]?u[l]=f[l]:a(u,l,f[l]);return u}},function(i,s,o){i.exports=o(5)},function(i,s,o){var a=o(9),u=o(3),f=function(c,l){if(u(c),!a(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,s,o){var a=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]:a[p];c&&d&&!d[l]&&f.f(d,l,{configurable:!0,get:function(){return this}})}},function(i,s,o){var a=o(3),u=o(14),f=o(1)("species");i.exports=function(c,l){var p,d=a(c).constructor;return d===void 0||(p=a(d)[f])==null?l:u(p)}},function(i,s,o){var a=o(20),u=o(15);i.exports=function(f){return function(c,l){var p,d,h=String(u(c)),m=a(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,s,o){var a=o(20),u=Math.max,f=Math.min;i.exports=function(c,l){return c=a(c),c<0?u(c+l,0):f(c,l)}},function(i,s,o){var a=o(15);i.exports=function(u){return Object(a(u))}},function(i,s,o){var a=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[a(c)]}},function(i,s,o){var a=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,a("keys"),a("values"),a("entries")},function(i,s){},function(i,s,o){var a,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)),b=o(38),x=o(40),C=(o(58).set,o(60)),T=o(30).set,R=o(48)(),$="Promise",M=l.TypeError,A=l.process,_=l[$],A=l.process,O=d(A)=="process",E=function(){},L=!!function(){try{var I=_.resolve(1),k=(I.constructor={})[o(1)("species")]=function(N){N(E,E)};return(O||typeof PromiseRejectionEvent=="function")&&I.then(E)instanceof k}catch{}}(),B=function(I,k){return I===k||I===_&&k===f},z=function(I){var k;return!(!m(I)||typeof(k=I.then)!="function")&&k},w=function(I){return B(_,I)?new v(I):new u(I)},v=u=function(I){var k,N;this.promise=new I(function(Y,ue){if(k!==void 0||N!==void 0)throw M("Bad Promise constructor");k=Y,N=ue}),this.resolve=g(k),this.reject=g(N)},j=function(I){try{I()}catch(k){return{error:k}}},D=function(I,k){if(!I._n){I._n=!0;var N=I._c;R(function(){for(var Y=I._v,ue=I._s==1,P=0,W=function(F){var q,Q,re=ue?F.ok:F.fail,X=F.resolve,Ie=F.reject,Be=F.domain;try{re?(ue||(I._h==2&&V(I),I._h=1),re===!0?q=Y:(Be&&Be.enter(),q=re(Y),Be&&Be.exit()),q===F.promise?Ie(M("Promise-chain cycle")):(Q=z(q))?Q.call(q,X,Ie):X(q)):Ie(Y)}catch(Xu){Ie(Xu)}};N.length>P;)W(N[P++]);I._c=[],I._n=!1,k&&!I._h&&U(I)})}},U=function(I){T.call(l,function(){var k,N,Y,ue=I._v;if(K(I)&&(k=j(function(){O?A.emit("unhandledRejection",ue,I):(N=l.onunhandledrejection)?N({promise:I,reason:ue}):(Y=l.console)&&Y.error&&Y.error("Unhandled promise rejection",ue)}),I._h=O||K(I)?2:1),I._a=void 0,k)throw k.error})},K=function(I){if(I._h==1)return!1;for(var k,N=I._a||I._c,Y=0;N.length>Y;)if(k=N[Y++],k.fail||!K(k.promise))return!1;return!0},V=function(I){T.call(l,function(){var k;O?A.emit("rejectionHandled",I):(k=l.onrejectionhandled)&&k({promise:I,reason:I._v})})},ee=function(I){var k=this;k._d||(k._d=!0,k=k._w||k,k._v=I,k._s=2,k._a||(k._a=k._c.slice()),D(k,!0))},Ce=function(I){var k,N=this;if(!N._d){N._d=!0,N=N._w||N;try{if(N===I)throw M("Promise can't be resolved itself");(k=z(I))?R(function(){var Y={_w:N,_d:!1};try{k.call(I,p(Ce,Y,1),p(ee,Y,1))}catch(ue){ee.call(Y,ue)}}):(N._v=I,N._s=1,D(N,!1))}catch(Y){ee.call({_w:N,_d:!1},Y)}}};L||(_=function(I){b(this,_,$,"_h"),g(I),a.call(this);try{I(p(Ce,this,1),p(ee,this,1))}catch(k){ee.call(this,k)}},a=function(I){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},a.prototype=o(56)(_.prototype,{then:function(I,k){var N=w(C(this,_));return N.ok=typeof I!="function"||I,N.fail=typeof k=="function"&&k,N.domain=O?A.domain:void 0,this._c.push(N),this._a&&this._a.push(N),this._s&&D(this,!1),N.promise},catch:function(I){return this.then(void 0,I)}}),v=function(){var I=new a;this.promise=I,this.resolve=p(Ce,I,1),this.reject=p(ee,I,1)}),h(h.G+h.W+h.F*!L,{Promise:_}),o(18)(_,$),o(59)($),f=o(6)[$],h(h.S+h.F*!L,$,{reject:function(I){var k=w(this),N=k.reject;return N(I),k.promise}}),h(h.S+h.F*(c||!L),$,{resolve:function(I){if(I instanceof _&&B(I.constructor,this))return I;var k=w(this),N=k.resolve;return N(I),k.promise}}),h(h.S+h.F*!(L&&o(46)(function(I){_.all(I).catch(E)})),$,{all:function(I){var k=this,N=w(k),Y=N.resolve,ue=N.reject,P=j(function(){var W=[],F=0,q=1;x(I,!1,function(Q){var re=F++,X=!1;W.push(void 0),q++,k.resolve(Q).then(function(Ie){X||(X=!0,W[re]=Ie,--q||Y(W))},ue)}),--q||Y(W)});return P&&ue(P.error),N.promise},race:function(I){var k=this,N=w(k),Y=N.reject,ue=j(function(){x(I,!1,function(P){k.resolve(P).then(N.resolve,Y)})});return ue&&Y(ue.error),N.promise}})},function(i,s,o){var a=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=a(f,c),this._i+=u.length,{value:u,done:!1})})},function(i,s,o){o(65);for(var a=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=a[d],m=h&&h.prototype;m&&!m[c]&&u(m,c,d),f[d]=f.Array}},function(i,s){i.exports=mn.default},function(i,s){i.exports=Hi.default}])})})(nf);var Ir;try{Ir=Map}catch{}var Or;try{Or=Set}catch{}function Ps(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(Nr);if(Ir&&e instanceof Ir)return new Map(Array.from(e.entries()));if(Or&&e instanceof Or)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 s=t.findIndex(function(o){return o===e[i]});r[i]=s>-1?n[s]:Ps(e[i],t,n)}return r}return e}function Nr(e){return Ps(e,[],[])}const rf=Object.prototype.toString,of=Error.prototype.toString,sf=RegExp.prototype.toString,af=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",uf=/^Symbol\((.*)\)(.*)$/;function cf(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Vi(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const n=typeof e;if(n==="number")return cf(e);if(n==="string")return t?`"${e}"`:e;if(n==="function")return"[Function "+(e.name||"anonymous")+"]";if(n==="symbol")return af.call(e).replace(uf,"Symbol($1)");const r=rf.call(e).slice(8,-1);return r==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):r==="Error"||e instanceof Error?"["+of.call(e)+"]":r==="RegExp"?sf.call(e):null}function Tt(e,t){let n=Vi(e,t);return n!==null?n:JSON.stringify(e,function(r,i){let s=Vi(this[r],t);return s!==null?s:i},2)}let Qe={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,s=`${e} must be a \`${t}\` type, but the final value was: \`${Tt(n,!0)}\``+(i?` (cast from the value \`${Tt(r,!0)}\`).`:".");return n===null&&(s+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),s},defined:"${path} must be defined"},Re={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"},lf={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"},Pr={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},ff={isValue:"${path} field must be ${value}"},Lr={noUnknown:"${path} field has unspecified keys: ${unknown}"},un={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 pf=Object.assign(Object.create(null),{mixed:Qe,string:Re,number:lf,date:Pr,object:Lr,array:un,boolean:ff}),Un=e=>e&&e.__isYupSchema__;class df{constructor(t,n){if(this.refs=t,this.refs=t,typeof n=="function"){this.fn=n;return}if(!gn.default(n,"is"))throw new TypeError("`is:` is required for `when()` conditi