strapi-plugin-navigation
Version:
Strapi - Navigation plugin
2 lines • 253 kB
JavaScript
"use strict";const B=require("lodash"),Qr=require("zod"),C=require("lodash/fp"),Uu=require("crypto"),Gu=require("child_process"),qu=require("lodash/has"),Ku=require("lodash/mapValues"),Wu=require("lodash/snakeCase"),zu=require("lodash/camelCase"),Yu=require("lodash/mapKeys"),Qu=require("os"),Vu=require("path"),Xu=require("fs"),Zu=require("assert"),Ju=require("events"),ec=require("buffer"),tc=require("stream"),nc=require("util"),rc=require("constants");require("node:stream");const ic=require("@sindresorhus/slugify"),oc=require("zod/v4"),ac=require("pluralize"),ue=e=>e&&e.__esModule?e:{default:e};function ca(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 me=ue(B),y=ca(Qr),ki=ue(Uu),fn=ue(Gu),pn=ue(qu),la=ue(Ku),Di=ue(Wu),sc=ue(zu),uc=ue(Yu),Ln=ue(Qu),Se=ue(Vu),We=ue(Xu),fa=ue(Zu),cc=ue(Ju),lc=ue(ec),kn=ue(tc),it=ue(nc),fc=ue(rc),pc=ue(ic),z=ca(oc),dc=ue(ac),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()}),hc=Vr.extend({type:y.literal("select"),multi:y.boolean(),options:y.array(y.string(),{required_error:"requiredError"}).min(1,{message:"requiredError"})}),mc=Vr.extend({type:y.enum(["boolean","string"]),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),gc=Vr.extend({type:y.literal("media"),multi:y.literal(!1).optional(),options:y.array(y.string()).max(0).optional()}),pa=y.discriminatedUnion("type",[mc,gc,hc]),da=y.union([y.literal("audience"),pa]),yc=y.object({additionalFields:y.array(da),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()}),ha=y.object({id:y.number(),documentId:y.string(),name:y.string(),key:y.string()}),vc=y.enum(["INTERNAL","EXTERNAL","WRAPPER"]),Xr=y.object({id:y.number(),documentId:y.string(),title:y.string(),type:vc,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(ha).or(y.null()).optional(),autoSync:y.boolean().or(y.null()).optional()}),wc=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()}),Mi=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()}),Ec=Ve(!1).omit({items:!0,id:!0,documentId:!0,slug:!0,locale:!0}).extend({documentId:y.string().optional(),id:y.undefined().optional()}),bc=Xr.omit({id:!0,documentId:!0}).extend({id:y.number().optional(),documentId:y.string().optional(),items:y.lazy(()=>ma).or(y.null()).optional(),updated:y.boolean().optional(),removed:y.boolean().optional()}),ma=y.array(bc),Sc=Ve(!1).extend({items:ma}).partial().required({id:!0,documentId:!0}),xc=y.enum(["collectionType","singleType"]),_c=y.object({singularName:y.string(),pluralName:y.string(),displayName:y.string(),description:y.string().optional(),name:y.string().optional()}),ga=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()}),Ac=y.enum(["string","text","richtext","blocks","email","password","date","time","datetime","timestamp","boolean","integer","biginteger","float","decimal","json","relation","media"]),Tc=ga.extend({type:Ac}),Cc=ga.extend({type:y.literal("enumeration"),enum:y.string().array()}),Rc=y.object({type:y.literal("component"),component:y.string(),repeatable:y.boolean().optional()}),Fc=y.object({type:y.literal("dynamiczone"),components:y.string().array()}),$c=y.object({type:y.literal("uid")}),Ic=y.object({type:y.literal("media"),allowedTypes:y.enum(["images","videos","audios","files"]).array(),required:y.boolean().optional()}),Oc=y.enum(["oneToOne","oneToMany","manyToOne","manyToMany","morphToMany","manyToMorph"]),Nc=y.object({type:y.literal("relation"),relation:Oc,target:y.string(),mappedBy:y.string().optional(),inversedBy:y.string().optional()}),Pc=y.record(y.string(),y.union([Tc,Cc,Rc,Fc,Nc,Ic,$c])),Tr=y.object({kind:xc,collectionName:y.string(),info:_c,options:y.object({draftAndPublish:y.boolean().optional(),hidden:y.boolean().optional(),templateName:y.string().optional()}).optional(),attributes:Pc,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=yc;const Lc=jt(()=>Cr,e=>{Cr=e});let Rr=da;const kc=jt(()=>Rr,e=>{Rr=e});let Fr=pa;const Dc=jt(()=>Fr,e=>{Fr=e});let $r=Ec;const Mc=jt(()=>$r,e=>{$r=e});let Ir=Sc;const jc=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}},Hc=/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,Bc=["beforeCreate","beforeCreateMany","afterCreate","afterCreateMany","beforeUpdate","beforeUpdateMany","afterUpdate","afterUpdateMany","beforeDelete","beforeDeleteMany","afterDelete","afterDeleteMany","beforeCount","afterCount","beforeFindOne","afterFindOne","beforeFindMany","afterFindMany"],Uc="$",ya=["api::","plugin::"],va=["admin::","plugin::content-releases","plugin::i18n.locale","plugin::navigation","plugin::review-workflows","plugin::users-permissions","plugin::upload.folder"],Gc=["title","subject","name"],ji={SINGLE:"singleType"},Hi=["title","type","path","externalPath","uiRouterKey","menuAttached","order","collapsed","related","parent","master","audience","additionalFields"],qc=e=>e.filter(t=>t!=="audience"),wa=e=>{const t=qc(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(Hi,n.name))))throw new Error(`Name of custom field cannot be one of: ${Hi.join(", ")}`)},Ea=(e,t)=>{if(e==null)throw t??new Error("Non-empty value expected, empty given")},Kc=(e="")=>{const t=a=>a.split("-").map(o=>B.capitalize(o)).join(""),[n,r,i]=Wc(e);return n==="api"?t(i):`${t(r)}${t(i)}`},Wc=(e="")=>e.split(Hc).filter(t=>t&&t.length>0),zc=(e,t)=>n=>[n,async r=>{await ne(t,"common").runLifeCycleHook({contentTypeName:e,hookName:n,event:r})}],ba=(e,t)=>Object.fromEntries(Bc.map(zc(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 ne({strapi:e},t){return e.plugin("navigation").service(t)}const Qt=e=>e==="*"?"*":typeof e=="string"?[e]:e===!1?[]:e===!0?"*":e,Yc=(e="")=>{const t=!!ya.find(r=>e.includes(r)),n=!va.find(r=>e.includes(r)||e===r);return!!e&&t&&n},Qc=(e="")=>B.last(e)==="s"?e.substr(0,e.length-1):e,Vc=B.once(e=>({find(t,n){const{audienceModel:{uid:r}}=we(e);return e.strapi.query(r).findMany({where:t,limit:n}).then(ha.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(Mi.parse).then(s=>s.map(dn))},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(Mi.parse)}})),Xc=["id","publishedAt","createdAt","updatedAt","locale"],dn=({related:e,items:t=[],...n})=>({...n,items:t.map(dn),related:e?B.omit(e,Xc):void 0}),Or=({related:e,...t})=>({...t,related:e?.[0]});class St extends Error{constructor(t,n){super(t),this.additionalInfo=n,this.type="NavigationError"}}class rr extends St{constructor(){super(...arguments),this.type="FillNavigationError"}}class Zc extends St{constructor(){super(...arguments),this.type="InvalidParamNavigationError"}}const Bi=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(dn)}))).then(s=>Ve(Bi(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(Bi(r)).parse(a)).then(a=>({...a,items:a.items?.map(dn)}))},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 St("Document id is required.");return e.strapi.documents(n.uid).delete({documentId:t.documentId,locale:t.locale})}})),Jc=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})}))},Sa=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=el(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")},tl(a,{strapi:e}),wa(a.additionalFields),await n.set({key:"config",value:a}),a},el=(e,t)=>n=>{const r=e?.[n]??t(n);return Ea(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(Kc);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}},nl="Navigation",rl="navigation",il=async e=>{const t=ne(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:nl,visible:!0,locale:n,slug:rl}));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"}},ol=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)},al="I18NLocaleCode",sl=({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:al})},type:n(r("NavigationItem")),resolve(u,{navigationIdOrSlug:f,type:c,menuOnly:l,path:p,locale:d}){const h=Qr.z.string().parse(f);return ne({strapi:e},"client").render({idOrSlug:h,type:c,rootPath:p,locale:d,menuOnly:l,wrapRelated:!0})}}},ul=({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 ne({strapi:e},"client").renderChildren({idOrSlug:p,childUIKey:f,type:c,menuOnly:l,wrapRelated:!0})}}},cl=e=>{const t={renderNavigationChild:ul,renderNavigation:sl};return e.nexus.extendType({type:"Query",definition(n){for(const[r,i]of Object.entries(t)){const a=i(e);n.field(r,a)}}})},ll=()=>({"Query.renderNavigationChild":{auth:!1},"Query.renderNavigation":{auth:!1}}),fl=({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")}}),pl=({nexus:e,strapi:t})=>e.objectType({name:"ContentTypesNameFields",async definition(n){n.nonNull.list.nonNull.string("default");const i=await ne({strapi:t},"common").getPluginStore(),o=Fe.configSchema.parse(await i.get({key:"config"})).contentTypesNameFields;Object.keys(o||{}).forEach(s=>n.nonNull.list.string(s))}}),dl=({nexus:e})=>e.inputObjectType({name:"CreateNavigation",definition(t){t.nonNull.string("name"),t.nonNull.list.field("items",{type:"CreateNavigationItem"})}}),hl=({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"})}}),ml=({nexus:e})=>e.inputObjectType({name:"CreateNavigationRelated",definition(t){t.nonNull.string("ref"),t.nonNull.string("field"),t.nonNull.string("refId")}}),gl=({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")}}),yl=({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"})}}),vl=({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"})}}),wl=({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")}}),El=({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`)}})}}),bl=({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")}})},Sl=({nexus:e})=>e.enumType({name:"NavigationItemType",members:["INTERNAL","EXTERNAL","WRAPPER"]}),xl=({nexus:e})=>e.enumType({name:"NavigationRenderType",members:["FLAT","TREE"]}),_l=[El,bl,wl,xl,gl,vl,pl,fl,yl,ml,hl,dl,Sl],Al=e=>_l.map(t=>t(e)),Tl=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 ne({strapi:e},"common").getPluginStore(),i=Fe.configSchema.parse(await r.get({key:"config"}));t.use(({strapi:a,nexus:o})=>{const s=Al({strapi:a,nexus:o,config:i}),u=cl({strapi:a,nexus:o}),f=ll();return{types:[s,u],resolversConfig:f}})},Cl=async({strapi:e})=>{!!e.plugin("graphql")&&await Tl({strapi:e})},Rl=async e=>{await Jc(e),await Sa(e),await il(e),await ol(e),await Cl(e),await strapi.service("plugin::navigation.migrate").migrateRelatedIdToDocumentId(),strapi.db.lifecycles.subscribe({models:["plugin::i18n.locale"],async afterCreate(t){await ne(e,"admin").refreshNavigationLocale(t.result?.code)}})},Fl=({strapi:e})=>{},$l=({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=ba("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=ba("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},xa=y.enum(["true","false"]),Vt=y.string(),Hl=y.object({locale:y.string().optional(),orderBy:y.string().optional(),orderDirection:y.enum(["DESC","ASC"]).optional()}),_a=y.enum(["FLAT","TREE","RFR"]),Aa=y.enum(["draft","published"]),Ta=y.union([y.boolean(),y.string(),y.string().array(),y.undefined()]),Bl=y.object({type:_a.optional(),menu:xa.optional(),path:y.string().optional(),locale:y.string().optional(),populate:Ta.optional(),status:Aa.optional()}),Ul=y.object({type:_a.optional(),menu:xa.optional(),locale:y.string().optional(),status:Aa.optional()}),Gl=y.object({source:y.string().min(1),target:y.string().min(1),documentId:y.string().min(1)});function ql(e){return{getAdminService(){return ne(e,"admin")},getCommonService(){return ne(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}=Gl.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()}}}const Kl=e=>{if(!(!e||e===!0||e==="*")&&typeof e!="object")return Array.isArray(e),e};function Wl(e){return{getService(){return ne(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"}=Bl.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:Kl(Ta.parse(u==="true"?!0:u==="false"?!1:Array.isArray(u)?u.map(l=>l==="true"?!0:l==="false"?!1:u):u)),status:f})},async renderChild(t){const{params:n,query:r={}}=t,{type:i,menu:a,locale:o,status:s="published"}=Ul.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:ql,client:Wl},Yl={},Ql={},Vl={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")]}}]}}]},Xl={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:[]}}]},Zl={admin:Vl,"content-api":Xl};function Jl(e,t){return me.default.has(process.env,e)?process.env[e]:t}function st(e){return process.env[e]??""}const ef={int(e,t){return me.default.has(process.env,e)?parseInt(st(e),10):t},float(e,t){return me.default.has(process.env,e)?parseFloat(st(e)):t},bool(e,t){return me.default.has(process.env,e)?st(e)==="true":t},json(e,t){if(!me.default.has(process.env,e))return t;try{return JSON.parse(st(e))}catch(n){throw n instanceof Error?new Error(`Invalid json environment variable ${e}: ${n.message}`):n}},array(e,t){if(!me.default.has(process.env,e))return t;let n=st(e);return n.startsWith("[")&&n.endsWith("]")&&(n=n.substring(1,n.length-1)),n.split(",").map(r=>me.default.trim(me.default.trim(r," "),'"'))},date(e,t){return me.default.has(process.env,e)?new Date(st(e)):t},oneOf(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=tf(e,n);return t.includes(r)?r:n}},tf=Object.assign(Jl,ef),nf="id",rf="documentId",of={ID_ATTRIBUTE:nf,DOC_ID_ATTRIBUTE:rf},af=e=>C.union(strapi?.config?.get("api.responses.privateAttributes",[])??[],C.getOr([],"options.privateAttributes",e)),sf=(e,t)=>e?.attributes?.[t]?.private===!0?!0:af(e).includes(t),Ca=e=>e&&!["media","component","relation","dynamiczone"].includes(e.type),uf=e=>e?.type==="media",Ra=e=>e?.type==="relation",cf=e=>!!e&&e.type==="dynamiczone",Fa=e=>!!e&&Ra(e)&&e.relation?.startsWith?.("morphTo"),ht=async(e,t,n)=>{const{path:r={raw:null,attribute:null,rawWithIndices:null},schema:i,getModel:a}=t;let o=t.parent;const s=async(m,g,E)=>{const T={schema:a(E.__type),path:g,getModel:a,parent:o};return ht(m,T,E)},u=m=>async(g,E,S)=>ht(g,{schema:m,path:E,getModel:a,parent:o},S),f=async(m,g,E)=>{const A={schema:a("plugin::upload.file"),path:g,getModel:a,parent:o};return ht(m,A,E)},c=async(m,g,E,S)=>ht(m,{schema:E,path:g,getModel:a,parent:o},S),l=async(m,g,E)=>{const T={schema:a(E.__component),path:g,getModel:a,parent:o};return ht(m,T,E)};if(!C.isObject(n)||C.isNil(i))return n;const p=C.clone(n),d=lf({data:p}),h=Object.keys(p);for(let m=0;m<h.length;m+=1){const g=h[m],E=i.attributes[g],S={...r};S.raw=C.isNil(r.raw)?g:`${r.raw}.${g}`,S.rawWithIndices=C.isNil(r.rawWithIndices)?g:`${r.rawWithIndices}.${g}`,C.isNil(E)||(S.attribute=C.isNil(r.attribute)?g:`${r.attribute}.${g}`);const T={data:p,schema:i,key:g,value:p[g],attribute:E,path:S,getModel:a,parent:o};await e(T,d);const A=p[g];if(!(C.isNil(A)||C.isNil(E))){if(Ra(E)){o={schema:i,key:g,attribute:E,path:S};const F=E.relation.toLowerCase().startsWith("morph")?s:u(a(E.target));if(C.isArray(A)){const D=new Array(A.length);for(let x=0;x<A.length;x+=1){const _={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${x}`:`${S.rawWithIndices}.${x}`};D[x]=await F(e,_,A[x])}p[g]=D}else p[g]=await F(e,S,A);continue}if(uf(E)){if(o={schema:i,key:g,attribute:E,path:S},C.isArray(A)){const R=new Array(A.length);for(let F=0;F<A.length;F+=1){const D={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${F}`:`${S.rawWithIndices}.${F}`};R[F]=await f(e,D,A[F])}p[g]=R}else p[g]=await f(e,S,A);continue}if(E.type==="component"){o={schema:i,key:g,attribute:E,path:S};const R=a(E.component);if(C.isArray(A)){const F=new Array(A.length);for(let D=0;D<A.length;D+=1){const x={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${D}`:`${S.rawWithIndices}.${D}`};F[D]=await c(e,x,R,A[D])}p[g]=F}else p[g]=await c(e,S,R,A);continue}if(E.type==="dynamiczone"&&C.isArray(A)){o={schema:i,key:g,attribute:E,path:S};const R=new Array(A.length);for(let F=0;F<A.length;F+=1){const D={...S,rawWithIndices:C.isNil(S.rawWithIndices)?`${F}`:`${S.rawWithIndices}.${F}`};R[F]=await l(e,D,A[F])}p[g]=R;continue}}}return p},lf=({data:e})=>({remove(t){delete e[t]},set(t,n){e[t]=n}});var ff=C.curry(ht),Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pf={exports:{}};(function(e,t){(function(n,r){e.exports=r(fn.default,ki.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,E,S,T=d&p.F,A=d&p.G,R=d&p.S,F=d&p.P,D=d&p.B,x=d&p.W,_=A?u:u[h]||(u[h]={}),N=_[l],v=A?s:R?s[h]:(s[h]||{})[l];A&&(m=h);for(g in m)E=!T&&v&&v[g]!==void 0,E&&g in _||(S=E?v[g]:m[g],_[g]=A&&typeof v[g]!="function"?m[g]:D&&E?f(S,s):x&&v[g]==S?(function(j){var H=function(K,w,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,w)}return new j(K,w,b)}return j.apply(this,arguments)};return H[l]=j[l],H})(S):F&&typeof S=="function"?f(Function.call,S):S,F&&((_.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"),E=!([].keys&&"next"in[].keys()),S="@@iterator",T="keys",A="values",R=function(){return this};i.exports=function(F,D,x,_,N,v,j){d(x,D,_);var H,K,w,b=function(k){if(!E&&k in W)return W[k];switch(k){case T:return function(){return new x(this,k)};case A:return function(){return new x(this,k)}}return function(){return new x(this,k)}},I=D+" Iterator",M=N==A,U=!1,W=F.prototype,Q=W[g]||W[S]||N&&W[N],ee=Q||b(N),Ce=N?M?b("entries"):ee:void 0,$=D=="Array"&&W.entries||Q;if($&&(w=m($.call(new F)),w!==Object.prototype&&(h(w,I,!0),s||l(w,g)||c(w,g,R))),M&&Q&&Q.name!==A&&(U=!0,ee=function(){return Q.call(this)}),s&&!j||!E&&!U&&W[g]||c(W,g,ee),p[D]=ee,p[I]=R,N)if(H={values:M?ee:b(A),keys:v?ee:b(T),entries:Ce},j)for(K in H)K in W||f(W,K,H[K]);else u(u.P+u.F*(E||U),D,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,E=h.clearImmediate,S=h.MessageChannel,T=0,A={},R="onreadystatechange",F=function(){var x=+this;if(A.hasOwnProperty(x)){var _=A[x];delete A[x],_()}},D=function(x){F.call(x.data)};g&&E||(g=function(x){for(var _=[],N=1;arguments.length>N;)_.push(arguments[N++]);return A[++T]=function(){l(typeof x=="function"?x:Function(x),_)},s(T),T},E=function(x){delete A[x]},o(11)(m)=="process"?s=function(x){m.nextTick(c(F,x,1))}:S?(u=new S,f=u.port2,u.port1.onmessage=D,s=c(f.postMessage,f,1)):h.addEventListener&&typeof postMessage=="function"&&!h.importScripts?(s=function(x){h.postMessage(x+"","*")},h.addEventListener("message",D,!1)):s=R in d("script")?function(x){p.appendChild(d("script"))[R]=function(){p.removeChild(this),F.call(x)}}:function(x){setTimeout(c(F,x,1),0)}),i.exports={set:g,clear:E}},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(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(S){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 F=c((0,m.execSync)(A[S]).toString());return R?F:f(F)}function p(R){return new h.default(function(F,D){return(0,m.exec)(A[S],{},function(x,_,N){if(x)return D(new Error("Error while obtaining machine id: "+x.stack));var v=c(_.toString());return F(R?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),E=process,S=E.platform,T={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},A={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:T[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),E=f(d,g);if(c&&p!=p){for(;g>E;)if(h=m[E++],h!=h)return!0}else for(;g>E;E++)if((c||E in m)&&m[E]===p)return c||E||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,E,S,T,A){var R,F,D,x,_=A?function(){return g}:p(g),N=s(S,T,E?2:1),v=0;if(typeof _!="function")throw TypeError(g+" is not iterable!");if(f(_)){for(R=l(g.length);R>v;v++)if(x=E?N(c(F=g[v])[0],F[1]):N(g[v]),x===d||x===h)return x}else for(D=_.call(g);!(F=D.next()).done;)if(x=u(D,N,F.value,E),x===d||x===h)return x};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 A,R;for(p&&(A=c.domain)&&A.exit();d;){R=d.fn,d=d.next;try{R()}catch(F){throw d?m():h=void 0,F}}h=void 0,A&&A.enter()};if(p)m=function(){c.nextTick(g)};else if(f){var E=!0,S=document.createTextNode("");new f(g).observe(S,{characterData:!0}),m=function(){S.data=E=!E}}else if(l&&l.resolve){var T=l.resolve();m=function(){T.then(g)}}else m=function(){u.call(s,g)};return function(A){var R={fn:A,next:void 0};h&&(h.next=R),d||(d=R,m()),h=R}}},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,E=">";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"+E),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)),E=o(38),S=o(40),T=(o(58).set,o(60)),A=o(30).set,R=o(48)(),F="Promise",D=l.TypeError,_=l.process,x=l[F],_=l.process,N=d(_)=="process",v=function(){},j=!!(function(){try{var $=x.resolve(1),k=($.constructor={})[o(1)("species")]=function(P){P(v,v)};return(N||typeof PromiseRejectionEvent=="function")&&$.then(v)instanceof k}catch{}})(),H=function($,k){return $===k||$===x&&k===f},K=function($){var k;return!(!m($)||typeof(k=$.then)!="function")&&k},w=function($){return H(x,$)?new b($):new u($)},b=u=function($){var k,P;this.promise=new $(function(V,ce){if(k!==void 0||P!==void 0)throw D("Bad Promise constructor");k=V,P=ce}),this.resolve=g(k),this.reject=g(P)},I=function($){try{$()}catch(k){return{error:k}}},M=function($,k){if(!$._n){$._n=!0;var P=$._c;R(function(){for(var V=$._v,ce=$._s==1,L=0,Y=function(O){var q,X,oe=ce?O.ok:O.fail,Z=O.resolve,Ne=O.reject,je=O.domain;try{oe?(ce||($._h==2&&Q($),$._h=1),oe===!0?q=V:(je&&je.enter(),q=oe(V),je&&je.exit()),q===O.promise?Ne(D("Promise-chain cycle")):(X=K(q))?X.call(q,Z,Ne):Z(q)):Ne(V)}catch(Bu){Ne(Bu)}};P.length>L;)Y(P[L++]);$._c=[],$._n=!1,k&&!$._h&&U($)})}},U=function($){A.call(l,function(){var k,P,V,ce=$._v;if(W($)&&(k=I(function(){N?_.emit("unhandledRejection",ce,$):(P=l.onunhandledrejection)?P({promise:$,reason:ce}):(V=l.console)&&V.error&&V.error("Unhandled promise rejection",ce)}),$._h=N||W($)?2:1),$._a=void 0,k)throw k.error})},W=function($){