@communecter/cocolight-api-client 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/cocolight-api-client.browser.js +7 -6
- package/dist/cocolight-api-client.browser.js.LICENSE.txt +1 -0
- package/dist/cocolight-api-client.cjs +2 -1
- package/dist/cocolight-api-client.cjs.LICENSE.txt +1 -0
- package/dist/cocolight-api-client.mjs.js +2 -1
- package/dist/cocolight-api-client.mjs.js.LICENSE.txt +1 -0
- package/package.json +12 -4
- package/src/Api.js +157 -0
- package/src/ApiClient.js +105 -8
- package/src/api/EntityMixin.js +249 -0
- package/src/api/NewsMixin.js +168 -0
- package/src/api/Organization.js +131 -0
- package/src/api/Project.js +131 -0
- package/src/api/User.js +226 -0
- package/src/api/UserApi.js +48 -0
- package/src/api/UserMixin.js +59 -0
- package/src/api/UtilMixin.js +82 -0
- package/src/endpoints.module.js +2 -2
- package/src/error.js +51 -3
- package/src/index.js +5 -0
|
@@ -1 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>h});const o=require("events"),n=require("ajv"),r=require("ajv-formats"),i=require("axios"),a=require("axios-retry"),s=require("ejson");class m extends Error{}m.prototype.name="InvalidTokenError";const c=require("pino"),p={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class{constructor(e){if(e){if(e=e.toLowerCase(),!p._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof p.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new p.ObjectID(this._str)}typeName(){return"oid"}getTimestamp(){return Number.parseInt(this._str.substr(0,8),16)}valueOf(){return this._str}toJSONValue(){return this.valueOf()}toHexString(){return this.valueOf()}}},d=p,l={common1:{type:"string"},common2:{format:"email",type:"string"},common3:{type:"boolean"},common4:{default:"@userId",type:"string"},common5:{id:{default:"@userId",type:"string"}},common6:{default:"",type:"string"},common7:{const:"citoyens"},common8:{properties:{value:{type:"boolean"}}},common9:{value:{type:"boolean"}},common10:{},common11:{if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{default:"@userId",type:"string"}}}},common12:{properties:{typeElement:{const:"citoyens"}}},common13:{typeElement:{const:"citoyens"}},common14:{properties:{id:{default:"@userId",type:"string"}}},common15:{not:{type:"null"}},common16:{type:"null"},common17:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common18:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common19:{items:{type:"string"},type:"array"},common20:{enum:[""],type:"string"},common21:{format:"uri",type:"string"},common22:{properties:{name:{not:{type:"null"}}},required:["name"]},common23:{name:{not:{type:"null"}}},common24:{properties:{url:{not:{type:"null"}}},required:["url"]},common25:{url:{not:{type:"null"}}},common26:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common27:{tags:{not:{type:"null"}}},common28:{properties:{email:{not:{type:"null"}}},required:["email"]},common29:{email:{not:{type:"null"}}},common30:{const:"info",default:"info",type:"string"},common31:{$ref:"#/$defs/sharedFields/email"},common32:{$ref:"#/$defs/sharedFields/name"},common33:{$ref:"#/$defs/sharedFields/tags"},common34:{$ref:"#/$defs/sharedFields/url"},common35:{const:"projects"},common36:{const:"organizations"},common37:{$ref:"#/$defs/socialField"},common38:{minLength:0,type:"string"},common39:{type:["string","number"]},common40:{type:"number"},common41:{const:!0,default:!0,type:"boolean"},common42:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common43:{properties:{type:{const:"citoyens"}}},common44:{type:{const:"citoyens"}},common45:{additionalProperties:!1,allOf:[{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}}],properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],type:"object"},common46:{if:{properties:{folder:{const:"citoyens"}}},then:{properties:{ownerId:{default:"@userId"}}}},common47:{properties:{folder:{const:"citoyens"}}},common48:{folder:{const:"citoyens"}},common49:{properties:{ownerId:{default:"@userId"}}},common50:{ownerId:{default:"@userId"}},common51:{default:"@userId"},common52:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common53:{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{default:"@userId"}}}},common54:{properties:{id:{default:"@userId"}}},common55:{id:{default:"@userId"}},common56:{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{parentId:{default:"@userId",type:"string"}}}},common57:{properties:{parentType:{const:"citoyens"}}},common58:{parentType:{const:"citoyens"}},common59:{properties:{parentId:{default:"@userId",type:"string"}}},common60:{parentId:{default:"@userId",type:"string"}},common61:{default:!0,type:"boolean"},common62:{required:["text"]},common63:{required:["mediaImg"]},common64:{required:["mediaFile"]},common65:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common66:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common67:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common68:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common69:{additionalProperties:!1,patternProperties:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},type:"object"},common70:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},common71:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common72:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common73:{default:"public",enum:["public","private","restricted"],type:"string"},common74:{const:"news",default:"news",type:"string"},common75:{additionalProperties:!1,properties:{id:{type:"string"}},required:["id"],type:"object"},common76:{id:{type:"string"}},common77:{default:!1,type:"boolean"},common78:{additionalProperties:!1,properties:{id:{type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common79:{id:{type:"string"},type:{default:"news",enum:["news"],type:"string"}},common80:{default:"news",enum:["news"],type:"string"},common81:{items:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},type:"array"},common82:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common83:{const:!1,default:!1,type:"boolean"},common84:{const:"",default:"",type:"string"},common85:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common86:{indexMax:{type:"number"},indexMin:{type:"number"}},common87:{default:0,minimum:0,type:"integer"},common88:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common89:{enum:["projects"],type:"string"},common90:{$exists:!0},common91:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common92:{$exists:{const:!0}},common93:{const:!0},common94:{default:30,type:"integer"},common95:{additionalProperties:!1,allOf:[{if:{properties:{type:{const:"citoyens"}}},then:{properties:{id:{default:"@userId"}}}}],properties:{id:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},required:["type","id"],type:"object"},common96:{id:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common97:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common98:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common99:{enum:["poi"],type:"string"},common100:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common101:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common102:{$exists:!1},common103:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common104:{$exists:{const:!1}},common105:{const:!1},common106:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common107:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common108:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common109:{$exists:{default:!1,type:"boolean"}},common110:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common111:{$in:{items:{type:"string"},minItems:1,type:"array"}},common112:{items:{type:"string"},minItems:1,type:"array"},common113:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common114:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common115:{pattern:"^[a-f0-9]{24}$",type:"string"},common116:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},required:["id"],type:"object"},common117:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},common118:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common119:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common120:{enum:["citoyens"],type:"string"},common121:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},type:"array"},common122:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common123:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common124:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common125:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common126:{"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"}},common127:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common128:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common129:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common130:{properties:{id:{pattern:"^@userId$"}}},common131:{id:{pattern:"^@userId$"}},common132:{pattern:"^@userId$"},common133:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common134:{enum:["badges"],type:"string"},common135:{const:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common136:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common137:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common138:{$exists:{const:!0,type:"boolean"}},common139:{const:!0,type:"boolean"},common140:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common141:{$exists:{const:!1,type:"boolean"}},common142:{const:!1,type:"boolean"},common143:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"}},common144:{indexMax:30,indexMin:0},common145:{additionalProperties:!1,allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}}],properties:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},required:["childId","childType","parentType","parentId","connectType"],type:"object"},common146:{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},common147:{properties:{connectType:{const:"friend",default:"friend"}}},common148:{connectType:{const:"friend",default:"friend"}},common149:{const:"friend",default:"friend"},common150:{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},common151:{properties:{parentType:{const:"organizations"}}},common152:{parentType:{const:"organizations"}},common153:{properties:{connectType:{enum:["admin","member"]}}},common154:{connectType:{enum:["admin","member"]}},common155:{enum:["admin","member"]},common156:{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},common157:{properties:{parentType:{const:"projects"}}},common158:{parentType:{const:"projects"}},common159:{properties:{connectType:{enum:["admin","contributor"]}}},common160:{connectType:{enum:["admin","contributor"]}},common161:{enum:["admin","contributor"]},common162:{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}},common163:{properties:{parentType:{const:"events"}}},common164:{parentType:{const:"events"}},common165:{const:"events"},common166:{properties:{connectType:{const:"attendee",default:"attendee"}}},common167:{connectType:{const:"attendee",default:"attendee"}},common168:{const:"attendee",default:"attendee"},common169:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},common170:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common171:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common172:{enum:["admin","member","contributor","attendee","friend"],type:"string"},common173:{enum:["citoyens","organizations","projects","events"],type:"string"}},u=[{auth:"none",constant:"PERSON_REGISTER",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/person/register",request:{additionalProperties:!1,properties:{app:l.common1,email:l.common2,isInvitation:l.common3,mode:l.common1,name:l.common1,pendingUserId:l.common1,pwd:l.common1,username:l.common1},required:["name","username","email","pwd"],type:"object"}},{auth:"none",constant:"AUTHENTICATE_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/authenticate",postActions:[{path:"accessToken",type:"setToken"},{path:"refreshToken",type:"setRefreshToken"},{event:"userLoggedIn",payloadPath:"user",type:"emitEvent"}],request:{additionalProperties:!1,properties:{email:l.common2,password:l.common1},required:["email","password"],type:"object"}},{auth:"none",constant:"REFRESH_TOKEN_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/refreshtoken",request:{additionalProperties:!1,properties:{refreshToken:l.common1},required:["refreshToken"],type:"object"}},{auth:"bearer",constant:"ME_INFO_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/me"},{auth:"none",constant:"PASSWORD_RECOVERY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/person/sendemail",request:{additionalProperties:!1,properties:{email:l.common2,type:{const:"password",default:"password",type:"string"}},required:["email","type"],type:"object"}},{auth:"bearer",constant:"SERVER_EXCHANGE_TOKEN",contentType:"application/json",method:"POST",path:"/api/cocolight/exchangetoken",request:{additionalProperties:!1,properties:{serverUrl:l.common1},required:["serverUrl"],type:"object"}},{auth:"bearer",constant:"CHANGE_PASSWORD",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/person/changepassword",request:{additionalProperties:!1,properties:{mode:{const:"changePassword",default:"changePassword",type:"string"},newPassword:l.common1,newPassword2:l.common1,oldPassword:l.common1,scope:{default:"",type:["string"]},userId:l.common4},required:["mode","userId","oldPassword","newPassword","newPassword2"],type:"object"}},{auth:"bearer",constant:"DELETE_ACCOUNT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/id/{id}/type/citoyens",pathParams:{additionalProperties:!1,properties:l.common5,required:["id"],type:"object"},postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:{additionalProperties:!1,properties:{reason:l.common6},required:["reason"],type:"object"}},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{if:{properties:{typeEntity:l.common7}},then:{properties:{idEntity:l.common4}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:l.common7}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:l.common7}},then:l.common8},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","private","feedback"]},typeEntity:{not:l.common7}}},then:l.common8}],properties:{idEntity:l.common1,type:l.common1,typeEntity:{default:"citoyens",type:"string"},value:l.common10},required:["type","value","typeEntity","idEntity"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_DESCRIPTION",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{additionalProperties:!1,allOf:[l.common11,{anyOf:[{properties:{description:l.common15},required:["description"]},{properties:{shortDescription:l.common15},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:l.common6,description:l.common1,id:l.common1,scope:{default:"",type:["string","null"]},shortDescription:l.common1,typeElement:l.common17},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_INFO",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{sharedFields:{email:l.common2,name:l.common1,tags:l.common18,url:l.common21}},allOf:[{if:l.common12,then:{additionalProperties:!1,anyOf:[l.common22,{properties:{birthDate:l.common15},required:["birthDate"]},{properties:{fixe:l.common15},required:["fixe"]},{properties:{mobile:l.common15},required:["mobile"]},l.common24,l.common26,l.common28],properties:{birthDate:{format:"date",type:"string"},block:l.common30,email:l.common31,fixe:l.common1,id:l.common4,mobile:l.common1,name:l.common32,scope:l.common6,tags:l.common33,typeElement:l.common17,url:l.common34}}},{if:{properties:{typeElement:l.common35}},then:{additionalProperties:!1,anyOf:[l.common22,l.common24,l.common26,l.common28,{properties:{avancement:l.common15},required:["avancement"]},{properties:{parent:l.common15},required:["parent"]}],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:l.common30,email:l.common31,id:l.common1,name:l.common32,parent:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:l.common1,type:l.common1},required:["type","name"],type:"object"}},type:"object"},scope:l.common6,tags:l.common33,typeElement:l.common17,url:l.common34}}},{if:{properties:{typeElement:l.common36}},then:{additionalProperties:!1,anyOf:[l.common22,l.common24,l.common26,l.common28,{properties:{type:l.common15},required:["type"]}],properties:{block:l.common30,email:l.common31,id:l.common1,name:l.common32,scope:l.common6,tags:l.common33,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:l.common17,url:l.common34}}}],properties:{block:l.common30,id:l.common1,scope:l.common6,typeElement:l.common17},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SOCIAL",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{socialField:{anyOf:[l.common20,l.common21]}},allOf:[l.common11,{anyOf:[{properties:{gitlab:l.common15},required:["gitlab"]},{properties:{github:l.common15},required:["github"]},{properties:{twitter:l.common15},required:["twitter"]},{properties:{facebook:l.common15},required:["facebook"]},{properties:{instagram:l.common15},required:["instagram"]},{properties:{diaspora:l.common15},required:["diaspora"]},{properties:{mastodon:l.common15},required:["mastodon"]},{properties:{telegram:l.common15},required:["telegram"]},{properties:{signal:l.common15},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:l.common37,facebook:l.common37,github:l.common37,gitlab:l.common37,id:l.common1,instagram:l.common37,mastodon:l.common37,scope:l.common6,signal:l.common37,telegram:l.common37,twitter:l.common37,typeElement:l.common17},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_LOCALITY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{allOf:[l.common11],properties:{address:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:l.common1,addressLocality:l.common1,codeInsee:l.common1,level1:l.common1,level1Name:l.common1,level3:l.common38,level3Name:l.common38,level4:l.common38,level4Name:l.common38,localityId:l.common1,postalCode:l.common1,streetAddress:l.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},block:{const:"localities",default:"localities",type:"string"},geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:l.common39,longitude:l.common39},required:["latitude","longitude"],type:"object"},geoPosition:{additionalProperties:!0,properties:{coordinates:{items:l.common40,maxItems:2,minItems:2,type:"array"},float:l.common41,type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},id:l.common1,scope:l.common6,typeElement:l.common17},required:["block","typeElement","id","address"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{allOf:[l.common11],properties:{block:l.common30,id:l.common1,scope:l.common6,slug:l.common42,typeElement:l.common17},required:["block","typeElement","id","slug"],type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,allOf:[{if:l.common43,then:l.common14}],properties:{block:l.common30,id:l.common1,slug:l.common42,type:l.common17},required:["block","type","id","slug"],type:"object"}},{auth:"bearer",constant:"PROFIL_IMAGE",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/profil_avatar/contentKey/profil/docType/image",pathParams:l.common45,request:{additionalProperties:!1,properties:{profil_avatar:l.common10},required:["profil_avatar"],type:"object"}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:{additionalProperties:!1,allOf:[l.common53],properties:{id:l.common1,type:l.common17},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{tpl:{const:"ficheInfoElement",default:"ficheInfoElement",type:"string"}},required:["tpl"],type:"object"}},{auth:"bearer",constant:"MULTICONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,allOf:[l.common56],properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:l.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:l.common1,parentType:l.common17},required:["parentId","parentType","listInvite"],type:"object"}},{auth:"none",constant:"GET_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/get/type/{type}/id/{id}/isLive/{isLive}/json/{json}",pathParams:{additionalProperties:!1,allOf:[l.common53],properties:{id:l.common1,isLive:l.common61,json:l.common61,type:l.common17},required:["isLive","type","id","json"],type:"object"},request:{additionalProperties:!1,properties:{dateLimit:{default:0,type:"integer"},indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:l.common6},required:["name"],type:"object"}},required:["dateLimit","indexStep"],type:"object"}},{auth:"none",constant:"GET_NEWS_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/getbyids",request:{additionalProperties:!1,properties:{ids:l.common19},required:["ids"],type:"object"}},{auth:"bearer",constant:"ADD_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/save",request:{additionalProperties:!1,allOf:[l.common56],anyOf:[l.common62,l.common63,l.common64],properties:{json:l.common41,markdownActive:l.common61,mediaFile:l.common65,mediaImg:l.common67,mentions:l.common69,parentId:l.common1,parentType:l.common17,scope:l.common73,tags:l.common18,text:l.common1,type:l.common74},required:["scope","markdownActive","parentId","parentType","type","json"],type:"object"}},{auth:"bearer",constant:"ADD_IMAGE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/newsImage/docType/image/contentKey/slider",pathParams:l.common45,request:{additionalProperties:!1,properties:{newsImage:l.common10},required:["newsImage"],type:"object"}},{auth:"bearer",constant:"ADD_FILE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}}/input/newsFile/docType/file",pathParams:l.common45,request:{additionalProperties:!1,properties:{newsFile:l.common10},required:["newsFile"],type:"object"}},{auth:"bearer",constant:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/delete/id/{id}",pathParams:l.common75,request:{additionalProperties:!1,properties:{isLive:l.common77},required:["isLive"],type:"object"}},{auth:"bearer",constant:"UPDATE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/update",request:{additionalProperties:!1,allOf:[l.common56],anyOf:[l.common62,l.common63,l.common64],properties:{idNews:l.common1,markdownActive:l.common61,mediaFile:l.common65,mediaImg:l.common67,mentions:l.common69,parentId:l.common1,parentType:l.common17,scope:l.common73,tags:l.common18,text:l.common1,type:l.common74},required:["idNews","scope","markdownActive","parentId","parentType","type"],type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,allOf:[{if:{properties:{childType:l.common7}},then:{properties:{childId:l.common4}}}],properties:{childId:l.common1,childType:l.common17,comment:l.common1,connectType:{const:"share",default:"share",type:"string"},parentId:l.common1,parentType:l.common74},required:["parentId","parentType","childId","childType","connectType"],type:"object"}},{auth:"none",constant:"GET_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/index/type/{type}/id/{id}/json/true",pathParams:l.common78},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:l.common6,contextId:l.common1,contextType:l.common80,mentions:l.common81,parentCommentId:l.common6,path:l.common6,text:l.common1},required:["text","contextId","contextType"],type:"object"}},{auth:"bearer",constant:"DELETE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/delete/id/{id}",pathParams:l.common75},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:l.common1,params:{properties:{mentions:l.common81,text:l.common1},required:["text"],type:"object"}},required:["id","params"],type:"object"}},{auth:"none",constant:"SEARCH_TAGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/tags/search?q={q}",pathParams:{additionalProperties:!1,properties:{q:l.common1},required:["q"],type:"object"}},{auth:"none",constant:"SHOW_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/list/type/{type}/id/{id}/actionType/vote/json/true",pathParams:l.common78},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:{const:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:l.common82,type:"array"},fediverse:l.common83,filters:l.common84,indexMin:{const:0,default:0,type:"number"},indexStep:l.common40,initType:l.common84,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:l.common1,type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},name:l.common1,notSourceKey:l.common41,ranges:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":l.common85},type:"object"},searchTags:l.common19,searchType:{items:l.common82,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"}},{auth:"none",constant:"CITY_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:{minimum:0,type:"integer"},locality:l.common84,name:l.common1,searchBy:{const:"ALL",default:"ALL",type:"string"},searchType:{const:["cities"],default:["cities"],items:{enum:["cities"],type:"string"},type:"array"}},required:["name","locality","searchType"],type:"object"}},{auth:"none",constant:"SUGGESTION_INPUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{default:20,minimum:20,type:"integer"},indexMin:l.common87,name:l.common1,searchType:{items:{enum:["organizations","projects","poi"],type:"string"},type:"array"}},required:["name","searchType","indexMin","indexMax"],type:"object"}},{auth:"none",constant:"GET_PROJECTS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common88,fediverse:l.common83,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":l.common90,"parent.@userId":l.common90},"links.contributors.@userId":l.common90},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91},type:"object"}},required:["$or"],type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common88},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_PROJECTS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:l.common95,request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common88,fediverse:l.common83,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":l.common90,"parent.@{pathParams.id}":l.common90},"links.contributors.@{pathParams.id}":l.common90},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91},type:"object"}},required:["$or"],type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common88},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_POIS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common98,fediverse:l.common83,filters:{additionalProperties:!1,default:{"parent.@userId":l.common90},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common98},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_POIS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:l.common95,request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common98,fediverse:l.common83,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":l.common90},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common98},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_ORGANIZATIONS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common100,fediverse:l.common83,filters:{additionalProperties:!1,default:{"links.members.@userId":l.common90,"links.members.@userId.isInviting":l.common102,"links.members.@userId.toBeValidated":l.common102},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":l.common103,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":l.common103},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common100},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_ORGANIZATIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[l.common53],properties:{id:l.common97,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common100,fediverse:l.common83,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":l.common90,"links.members.@{pathParams.id}.isInviting":l.common102,"links.members.@{pathParams.id}.toBeValidated":l.common102},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":l.common103,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":l.common103},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common100},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_MEMBERS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common106,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":l.common91,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":l.common108,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":l.common110,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":l.common103},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_MEMBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/organizations/id/{id}/canSee/true",pathParams:l.common113,request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common106,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.memberOf.@{pathParams.id}":l.common90,"links.memberOf.@{pathParams.id}.isInviting":l.common102,"links.memberOf.@{pathParams.id}.toBeValidated":l.common102},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":l.common91,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":l.common108,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":l.common110,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":l.common108},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_FRIENDS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:l.common116,request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common119,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.friends.@{pathParams.id}":l.common90,"links.friends.@{pathParams.id}.isInviting":l.common102,"links.friends.@{pathParams.id}.toBeValidated":l.common102},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":l.common108,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":l.common108},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common119},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIPTIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common121,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[l.common123],default:{"links.followers.@userId":l.common90,"links.followers.@{userId}.isInviting":l.common102,"links.followers.@{userId}.toBeValidated":l.common102},patternProperties:l.common126,type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIPTIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:l.common116,request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common121,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[l.common123],default:{"links.followers.@{pathParams.id}":l.common90,"links.followers.@{pathParams.id}.isInviting":l.common102,"links.followers.@{pathParams.id}.toBeValidated":l.common102},patternProperties:l.common126,type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIBERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common119,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[l.common127],default:{"links.follows.@userId":l.common90,"links.follows.@{userId}.isInviting":l.common102,"links.follows.@{userId}.toBeValidated":l.common102},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":l.common103,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":l.common103},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common119},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[l.common53,{if:{properties:{type:l.common36}},then:l.common130},{if:{properties:{type:l.common35}},then:l.common130}],properties:{id:l.common97,type:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common119,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[l.common127],default:{"links.follows.@{pathParams.id}":l.common90},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common119},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_CONTRIBUTORS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common106,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":l.common91,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":l.common108,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":l.common110,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":l.common103},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_CONTRIBUTORS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/projects/id/{id}/canSee/true",pathParams:l.common113,request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common106,fediverse:l.common83,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.projects.@{pathParams.id}":l.common90,"links.projects.@{pathParams.id}.isInviting":l.common102,"links.projects.@{pathParams.id}.toBeValidated":l.common102},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":l.common91,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":l.common91,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":l.common108,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":l.common110,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":l.common108},type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common133,fediverse:l.common83,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":l.common91},type:"object"},isParcours:l.common3,"preferences.private":l.common83},required:["preferences.private"],type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,searchType:l.common133},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES_FILTERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:l.common41,countType:l.common135,fediverse:l.common83,fields:l.common133,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":l.common137}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":l.common137,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":l.common140,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":l.common140}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:l.common143},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:l.common143,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":l.common139}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":l.common137}}],type:"object"},indexMin:l.common87,indexStep:l.common94,initType:l.common84,locality:l.common84,name:l.common1,notSourceKey:l.common41,ranges:{additionalProperties:!1,default:{Cooperative:l.common144,GovernmentOrganization:l.common144,Group:l.common144,LocalBusiness:l.common144,NGO:l.common144,citoyens:l.common144,projects:l.common144},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":l.common85},type:"object"},searchType:l.common135},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"CONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/connect",request:l.common145},{auth:"bearer",constant:"DISCONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/disconnect",request:l.common145}];class y extends Error{constructor(e,t,o){super(e),this.name="ApiClientError",this.status=t,this.details=o}}class f extends Error{constructor(e){super(e),this.name="CircuitBreakerError"}}s.addType("oid",(e=>new d.ObjectID(e)));class h extends o.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:s="/api/cocolight/refreshtoken",endpoints:m=u,timeout:p=3e4,debug:d=!1,maxRetries:l=0,circuitBreakerThreshold:f=5,circuitBreakerResetTime:h=6e4,fromJSONValue:g=!0}={}){if(super(),!e)throw new y('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshToken=o,this._refreshUrl=s,this._endpoints=m,this._debug=d;let b=null;this._fromJSONValue=g,Object.defineProperty(this,"userId",{get:()=>b,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{b=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new n({strict:!1,useDefaults:!0}),r(this._ajv),this._logger=c({transport:{target:"pino-pretty",options:{colorize:!0}},level:d?"debug":"info"}),this._client=i.create({baseURL:e,timeout:p}),l>0&&(a(this._client,{retries:l,retryDelay:a.exponentialDelay,retryCondition:e=>a.isNetworkError(e)||a.isRetryableError(e)}),this._logger.info(`[ApiClient] Retry activé : ${l} max`)),this._breakerThreshold=f,this._breakerResetTime=h,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,t&&this.setToken(t),this._client.interceptors.response.use((e=>e),(async e=>{if(e.response&&401===e.response.status&&this._refreshToken)try{if(await this._refreshAccessToken())return this._client.request(e.config)}catch(e){throw new y(e.message,401,e)}throw e}))}setToken(e){this._accessToken=e,this._client.defaults.headers.common.Authorization="Bearer "+e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait et défini : ${t}`)),this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){this._refreshToken=e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait depuis refreshToken : ${t}`)),this._logger.debug(`[ApiClient] setRefreshToken: ${e}`)}getRefreshToken(){return this._refreshToken}_getIdFromToken(e){if(!e)return null;try{const t=function(e,t){if("string"!=typeof e)throw new m("Invalid token specified: must be a string");t||(t={});const o=!0===t.header?0:1,n=e.split(".")[o];if("string"!=typeof n)throw new m(`Invalid token specified: missing part #${o+1}`);let r;try{r=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let o=t.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o})))}(t)}catch(e){return atob(t)}}(n)}catch(e){throw new m(`Invalid token specified: invalid base64 for part #${o+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new m(`Invalid token specified: invalid json for part #${o+1} (${e.message})`)}}(e);return this._logger.log("[ApiClient] Payload décodé :",t),t.id||t.userId||null}catch(e){return this._logger.error("[ApiClient] Erreur lors du décodage du token :",e.message),null}}async _refreshAccessToken(){if(!this._refreshToken)return!1;try{const e=await this._client.post(this._refreshUrl,{refreshToken:this._refreshToken},{headers:{"Content-Type":"application/json"}});return!(!e.data||!e.data.accessToken||(this.setToken(e.data.accessToken),e.data.refreshToken&&this.setRefreshToken(e.data.refreshToken),this.emit("refreshSuccess",e.data),0))}catch(e){return this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),!0)}_updateCircuitBreakerError(){this._breakerErrorCount+=1,this._logger.warn(`[ApiClient] Erreur #${this._breakerErrorCount} sur ${this._breakerThreshold}`),this._breakerErrorCount>=this._breakerThreshold&&(this._breakerOpen=!0,this._lastBreakerOpenTime=Date.now(),this._logger.error("[ApiClient] Circuit breaker ACTIVÉ - L'API est considérée indisponible"))}_resetCircuitBreakerSuccess(){this._breakerErrorCount=0,this._breakerOpen&&(this._breakerOpen=!1,this._logger.warn("[ApiClient] Circuit breaker refermé suite à un succès"))}static stripNullsInPlace(e){if(e&&"object"==typeof e&&e.value&&"function"==typeof e.value.pipe)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)null===e[t]||void 0===e[t]?e.splice(t,1):"object"==typeof e[t]&&h.stripNullsInPlace(e[t]);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(null===e[t]||void 0===e[t]?delete e[t]:"object"==typeof e[t]&&h.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,r=e=>"string"!=typeof e?e:e.replace(n,((t,n,r)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=o.pathParams(e);return null!=t?t:`@{${n}}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(r){if(r.startsWith("pathParams.")){const e=r.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],i=o.pathParams(t);return null!=i?i+n:`@${r}`}return`@${r}`}{const e=o[r];if("function"==typeof e){const t=e();return null!=t?t:`@${r}`}return`@${r}`}}return e})),i=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(i);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,n]of Object.entries(e))t[r(o)]=i(n);return t}return"string"==typeof e?r(e):e};return i(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const n of Object.keys(e)){const r=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof r&&t.test(r))continue;if(r&&"object"==typeof r){const e=this._cleanSchemaLeftoverAlias(r);Object.keys(e).length>0&&(o[n]=e);continue}}"string"==typeof r&&t.test(r)||(o[n]=this._cleanSchemaLeftoverAlias(r))}}return o}return e}async callEndpoint(e,t={},o=!0,n=!0){if(!this._checkCircuitBreaker())throw new f("Le circuit breaker est activé, impossible d'appeler l'API");const r=this._endpoints.find((t=>t.constant===e));if(!r)throw new y(`Endpoint introuvable : ${e}`,404);const{path:i,method:a,contentType:s,auth:m,pathParams:c,request:p,responses:d}=r,l=(a||"GET").toLowerCase(),u=s||"application/json",g={"Content-Type":u};if(this._accessToken)"bearer"===m?g.Authorization=`Bearer ${this._accessToken}`:m&&"none"!==m||g.Authorization||(g.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===m)throw new y(`Token requis pour l'endpoint sécurisé : ${e}`,401);let b,T=i,w={};if(c){let e=c;"none"===m&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(c));const o=t.pathParams||{},n=this._ajv.compile(e);if(!n(o))throw this.emit("validationError",{stage:"pathParams",errors:n.errors}),new y("Path parameter validation failed.",400,n.errors);w=this._resolveSpecialValuesInPlace(o),T=T.replace(/\{(\w+)\}/g,((e,t)=>{const o=w[t];if(void 0!==o)return encodeURIComponent(o);throw new y(`Path param manquant ou non résolu : {${t}}`,400)}))}if(p){let e=p;"none"===m&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(p));const o={...t};delete o.pathParams;const n=h.stripNullsInPlace(o),r=this._ajv.compile(e);if(!r(n))throw this.emit("validationError",{stage:"request",errors:r.errors}),new y("Request validation failed.",400,r.errors);t=this._resolveSpecialValuesInPlace(n,w)}"application/json"===u||"multipart/form-data"===u?b=t:"application/x-www-form-urlencoded"===u&&(b=h.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${T}, method=${l}`);try{const e=await this._client.request({url:T,method:l,headers:g,["get"===l?"params":"data"]:b});if(n){const t=e.status.toString(),o=d?.[t];if(o){const n=this._ajv.compile(o);if(!n(e.data))throw this.emit("validationError",{stage:"response",errors:n.errors}),new y("Response validation failed.",t,n.errors)}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(r.postActions)&&r.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(e){throw this._updateCircuitBreakerError(),e}}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),delete this._client.defaults.headers.common.Authorization,this._logger.info("[ApiClient] Session utilisateur réinitialisée."),this.emit("sessionReset")}_getValueByPath(e,t){if(t)return t.split(".").reduce(((e,t)=>e&&e[t]),e)}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:r=!1,metaTokens:i=!0}=o,a=[];function s(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function m(e){return e.endsWith("[]")?e.slice(0,-2):e}function c(e,t,o=!1){return e?e.concat(t).map(((e,t)=>(e=m(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function p(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,d=[]){null==o||a.includes(o)||(a.push(o),Object.entries(o).forEach((([o,a])=>{void 0!==a&&function(e,o,a){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=i?o:o.slice(0,-2),t.append(c(a,o,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(s)||o.endsWith("[]"))return o=m(o),e.forEach(((e,i)=>{if(null!=e){const s=r?c(a.concat(o),i,n):`${c(a,o,n)}[]`;t.append(s,p(e))}})),!1}return!!s(e)||(t.append(c(a,o,n),p(e)),!1)}(a,o.trim(),d)&&e(a,d.concat(m(o)))})),a.pop())}(e),t}_transformData(e){if(e&&"object"==typeof e)if(e.resultGoods?.msg)e=this._normalizeJsonData({msg:e.resultGoods.msg,...e});else if(e.resultErrors?.msg)e=this._normalizeJsonData({msg:e.resultErrors.msg,...e});else if(e.results&&"object"==typeof e.results&&!Array.isArray(e.results))e.results=Object.keys(e.results).map((t=>this._normalizeJsonData({id:t,...e.results[t]})));else if(Array.isArray(e.results))e.results=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?s.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let n=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(n=this._normalizeDate(n)),this._imageFields.includes(o)&&(n=this._normalizeImage(n)),"content"===o&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[o]=n})),this._normalizeId(t)}return e}}module.exports=t})();
|
|
1
|
+
/*! For license information please see cocolight-api-client.cjs.LICENSE.txt */
|
|
2
|
+
(()=>{var e={251:(e,t)=>{t.L=function(e,t,o,n,i){var r,a,s=8*i-n-1,c=(1<<s)-1,m=c>>1,p=-7,l=o?i-1:0,d=o?-1:1,u=e[t+l];for(l+=d,r=u&(1<<-p)-1,u>>=-p,p+=s;p>0;r=256*r+e[t+l],l+=d,p-=8);for(a=r&(1<<-p)-1,r>>=-p,p+=n;p>0;a=256*a+e[t+l],l+=d,p-=8);if(0===r)r=1-m;else{if(r===c)return a?NaN:1/0*(u?-1:1);a+=Math.pow(2,n),r-=m}return(u?-1:1)*a*Math.pow(2,r-n)},t.M=function(e,t,o,n,i,r){var a,s,c,m=8*r-i-1,p=(1<<m)-1,l=p>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,u=n?0:r-1,f=n?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=p):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?d/c:d*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=p?(s=0,a=p):a+l>=1?(s=(t*c-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[o+u]=255&s,u+=f,s/=256,i-=8);for(a=a<<i|s,m+=i;m>0;e[o+u]=255&a,u+=f,a/=256,m-=8);e[o+u-f]|=128*h}},585:e=>{var t=1e3,o=60*t,n=60*o,i=24*n,r=7*i;function a(e,t,o,n){var i=t>=1.5*o;return Math.round(e/o)+" "+n+(i?"s":"")}e.exports=function(e,s){s=s||{};var c,m,p=typeof e;if("string"===p&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var s=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return s*r;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*o;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===p&&isFinite(e))return s.long?(c=e,(m=Math.abs(c))>=i?a(c,m,i,"day"):m>=n?a(c,m,n,"hour"):m>=o?a(c,m,o,"minute"):m>=t?a(c,m,t,"second"):c+" ms"):function(e){var r=Math.abs(e);return r>=i?Math.round(e/i)+"d":r>=n?Math.round(e/n)+"h":r>=o?Math.round(e/o)+"m":r>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},736:(e,t,o)=>{e.exports=function(e){function t(e){let o,i,r,a=null;function s(...e){if(!s.enabled)return;const n=s,i=Number(new Date),r=i-(o||i);n.diff=r,n.prev=o,n.curr=i,o=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((o,i)=>{if("%%"===o)return"%";a++;const r=t.formatters[i];if("function"==typeof r){const t=e[a];o=r.call(n,t),e.splice(a,1),a--}return o})),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,r=t.enabled(e)),r),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,o){const n=t(this.namespace+(void 0===o?":":o)+e);return n.log=this.log,n}function i(e,t){let o=0,n=0,i=-1,r=0;for(;o<e.length;)if(n<t.length&&(t[n]===e[o]||"*"===t[n]))"*"===t[n]?(i=n,r=o,n++):(o++,n++);else{if(-1===i)return!1;n=i+1,r++,o=r}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const o=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of o)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const o of t.skips)if(i(e,o))return!1;for(const o of t.names)if(i(e,o))return!0;return!1},t.humanize=o(585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((o=>{t[o]=e[o]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let o=0;for(let t=0;t<e.length;t++)o=(o<<5)-o+e.charCodeAt(t),o|=0;return t.colors[Math.abs(o)%t.colors.length]},t.enable(t.load()),t}},833:(e,t,o)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;t.splice(1,0,o,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,o)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=o(736)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}},t={};function o(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,o),r.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{default:()=>et});var e={};o.r(e),o.d(e,{ApiAuthenticationError:()=>c,ApiClientError:()=>i,ApiError:()=>t,ApiResponseError:()=>s,ApiValidationError:()=>r,CircuitBreakerError:()=>a});class t extends Error{constructor(e,t,o){super(e),this.name="ApiError",this.status=t,this.details=o}}class i extends t{constructor(e,t,o){super(e,t,o),this.name="ApiClientError"}}class r extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiValidationError",this.status=t,this.messages=o,this.details=n}}class a extends t{constructor(e){super(e,503),this.name="CircuitBreakerError"}}class s extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiResponseError",this.status=t,this.responseData=o,this.details=n}}class c extends t{constructor(e,t,o){super(e,t,o),this.name="ApiAuthenticationError"}}const m={async resolveId(e){if(!this.id&&this.slug)try{const t=await this._getElementsKey({pathParams:{slug:this.slug}});if(!t?.contextId||t?.contextType!==e)throw new s(`Le slug ${this.slug} ne correspond pas à un ${e}`,200,t);this._id(t.contextId)}catch(t){throw t instanceof s?t?.responseData?.contextType!==e?t:new s(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.responseData):t}return this.id},async getPublicProfile(){return await this.resolveId(this.getEntityType()),this._getElementsAbout({pathParams:{id:this.id,type:this.getEntityType()}})},async _getElementsAbout(e={}){return this.call("GET_ELEMENTS_ABOUT",e)},async _getElementsKey(e={}){return this.call("GET_ELEMENTS_KEY",e)},async _profilImage(e={}){return this.callIsConnected("PROFIL_IMAGE",e)},async _updateSettings(e={}){return this.callIsConnected("UPDATE_SETTINGS",e)},async _updateBlockDescription(e={}){return this.callIsConnected("UPDATE_BLOCK_DESCRIPTION",e)},async _updateBlockInfo(e={}){return this.callIsConnected("UPDATE_BLOCK_INFO",e)},async _updateBlockSocial(e={}){return this.callIsConnected("UPDATE_BLOCK_SOCIAL",e)},async _updateBlockLocality(e={}){return this.callIsConnected("UPDATE_BLOCK_LOCALITY",e)},async _updateBlockSlug(e={}){return this.callIsConnected("UPDATE_BLOCK_SLUG",e)},async _check(e={}){return this.callIsConnected("CHECK",e)}},p={async _getNews(e={}){return this.call("GET_NEWS",e)},async _getNewsById(e={}){return this.call("GET_NEWS_BY_ID",e)},async _addNews(e={}){return this.callIsConnected("ADD_NEWS",e)},async _addImageNews(e={}){return this.callIsConnected("ADD_IMAGE_NEWS",e)},async _addFileNews(e={}){return this.callIsConnected("ADD_FILE_NEWS",e)},async _deleteNews(e={}){return this.callIsConnected("DELETE_NEWS",e)},async _updateNews(e={}){return this.callIsConnected("UPDATE_NEWS",e)},async _shareNews(e={}){return this.callIsConnected("SHARE_NEWS",e)}};function l(e){return new DataView(e.buffer,e.byteOffset)}o(251);const d={len:1,get:(e,t)=>l(e).getUint8(t),put:(e,t,o)=>(l(e).setUint8(t,o),t+1)},u={len:2,get:(e,t)=>l(e).getUint16(t,!0),put:(e,t,o)=>(l(e).setUint16(t,o,!0),t+2)},f={len:2,get:(e,t)=>l(e).getUint16(t),put:(e,t,o)=>(l(e).setUint16(t,o),t+2)},h={len:4,get:(e,t)=>l(e).getUint32(t,!0),put:(e,t,o)=>(l(e).setUint32(t,o,!0),t+4)},y={len:4,get:(e,t)=>l(e).getUint32(t),put:(e,t,o)=>(l(e).setUint32(t,o),t+4)},g={len:4,get:(e,t)=>l(e).getInt32(t),put:(e,t,o)=>(l(e).setInt32(t,o),t+4)},w={len:8,get:(e,t)=>l(e).getBigUint64(t,!0),put:(e,t,o)=>(l(e).setBigUint64(t,o,!0),t+8)};class b{constructor(e,t){this.len=e,this.encoding=t,this.textDecoder=new TextDecoder(t)}get(e,t){return this.textDecoder.decode(e.subarray(t,t+this.len))}}class x extends Error{constructor(){super("End-Of-Stream"),this.name="EndOfStreamError"}}class k extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}class v{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){const o=await this.read(e,t);return this.peekQueue.push(e.subarray(0,o)),o}async read(e,t=!1){if(0===e.length)return 0;let o=this.readFromPeekBuffer(e);if(this.endOfStream||(o+=await this.readRemainderFromStream(e.subarray(o),t)),0===o)throw new x;return o}readFromPeekBuffer(e){let t=e.length,o=0;for(;this.peekQueue.length>0&&t>0;){const n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");const i=Math.min(n.length,t);e.set(n.subarray(0,i),o),o+=i,t-=i,i<n.length&&this.peekQueue.push(n.subarray(i))}return o}async readRemainderFromStream(e,t){let o=0;for(;o<e.length&&!this.endOfStream;){if(this.interrupted)throw new k;const n=await this.readFromStream(e.subarray(o),t);if(0===n)break;o+=n}if(!t&&o<e.length)throw new x;return o}}class T extends v{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class P extends T{async readFromStream(e,t){if(0===e.length)return 0;const o=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return o.done&&(this.endOfStream=o.done),o.value?(e.set(o.value),o.value.length):0}}class _ extends v{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){const o=Math.min(t.length,e.length);return e.set(t.subarray(0,o)),o<t.length?this.buffer=t.subarray(o):this.buffer=null,o}async readFromStream(e,t){if(0===e.length)return 0;let o=0;for(this.buffer&&(o+=this.writeChunk(e,this.buffer));o<e.length&&!this.endOfStream;){const t=await this.reader.read();if(t.done){this.endOfStream=!0;break}t.value&&(o+=this.writeChunk(e.subarray(o),t.value))}if(0===o&&this.endOfStream)throw new x;return o}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}class S{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",(()=>{this.abort()}))}async readToken(e,t=this.position){const o=new Uint8Array(e.len);if(await this.readBuffer(o,{position:t})<e.len)throw new x;return e.get(o,0)}async peekToken(e,t=this.position){const o=new Uint8Array(e.len);if(await this.peekBuffer(o,{position:t})<e.len)throw new x;return e.get(o,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new x;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new x;return e.get(this.numBuffer,0)}async ignore(e){if(void 0!==this.fileInfo.size){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await(this.onClose?.())}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&void 0!==t.position&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}}class I extends S{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){const o=this.normalizeOptions(e,t),n=o.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===o.length)return 0;const i=await this.streamReader.read(e.subarray(0,o.length),o.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i<o.length)throw new x;return i}async peekBuffer(e,t){const o=this.normalizeOptions(e,t);let n=0;if(o.position){const t=o.position-this.position;if(t>0){const i=new Uint8Array(o.length+t);return n=await this.peekBuffer(i,{mayBeLess:o.mayBeLess}),e.set(i.subarray(t)),n-t}if(t<0)throw new Error("Cannot peek from a negative offset in a stream")}if(o.length>0){try{n=await this.streamReader.peek(e.subarray(0,o.length),o.mayBeLess)}catch(e){if(t?.mayBeLess&&e instanceof x)return 0;throw e}if(!o.mayBeLess&&n<o.length)throw new x}return n}async ignore(e){const t=Math.min(256e3,e),o=new Uint8Array(t);let n=0;for(;n<e;){const i=e-n,r=await this.readBuffer(o,{length:Math.min(t,i)});if(r<0)return r;n+=r}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class A extends S{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);const o=await this.peekBuffer(e,t);return this.position+=o,o}async peekBuffer(e,t){const o=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-o.position,o.length);if(!o.mayBeLess&&n<o.length)throw new x;return e.set(this.uint8Array.subarray(o.position,o.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}var C=Uint8Array,E=Uint16Array,j=Int32Array,O=new C([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$=new C([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),z=new C([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),q=function(e,t){for(var o=new E(31),n=0;n<31;++n)o[n]=t+=1<<e[n-1];var i=new j(o[30]);for(n=1;n<30;++n)for(var r=o[n];r<o[n+1];++r)i[r]=r-o[n]<<5|n;return{b:o,r:i}},N=q(O,2),M=N.b,B=N.r;M[28]=258,B[258]=28;for(var L=q($,0),F=L.b,D=(L.r,new E(32768)),U=0;U<32768;++U){var R=(43690&U)>>1|(21845&U)<<1;R=(61680&(R=(52428&R)>>2|(13107&R)<<2))>>4|(3855&R)<<4,D[U]=((65280&R)>>8|(255&R)<<8)>>1}var G=function(e,t,o){for(var n=e.length,i=0,r=new E(t);i<n;++i)e[i]&&++r[e[i]-1];var a,s=new E(t);for(i=1;i<t;++i)s[i]=s[i-1]+r[i-1]<<1;if(o){a=new E(1<<t);var c=15-t;for(i=0;i<n;++i)if(e[i])for(var m=i<<4|e[i],p=t-e[i],l=s[e[i]-1]++<<p,d=l|(1<<p)-1;l<=d;++l)a[D[l]>>c]=m}else for(a=new E(n),i=0;i<n;++i)e[i]&&(a[i]=D[s[e[i]-1]++]>>15-e[i]);return a},Z=new C(288);for(U=0;U<144;++U)Z[U]=8;for(U=144;U<256;++U)Z[U]=9;for(U=256;U<280;++U)Z[U]=7;for(U=280;U<288;++U)Z[U]=8;var V=new C(32);for(U=0;U<32;++U)V[U]=5;var K=G(Z,9,1),W=G(V,5,1),J=function(e){for(var t=e[0],o=1;o<e.length;++o)e[o]>t&&(t=e[o]);return t},H=function(e,t,o){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&o},Y=function(e,t){var o=t/8|0;return(e[o]|e[o+1]<<8|e[o+2]<<16)>>(7&t)},Q=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],X=function(e,t,o){var n=new Error(t||Q[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,X),!o)throw n;return n},ee=function(e,t,o,n){var i=e.length,r=n?n.length:0;if(!i||t.f&&!t.l)return o||new C(0);var a=!o,s=a||2!=t.i,c=t.i;a&&(o=new C(3*i));var m,p=function(e){var t=o.length;if(e>t){var n=new C(Math.max(2*t,e));n.set(o),o=n}},l=t.f||0,d=t.p||0,u=t.b||0,f=t.l,h=t.d,y=t.m,g=t.n,w=8*i;do{if(!f){l=H(e,d,1);var b=H(e,d+1,3);if(d+=3,!b){var x=e[(m=d,(q=4+((m+7)/8|0))-4)]|e[q-3]<<8,k=q+x;if(k>i){c&&X(0);break}s&&p(u+x),o.set(e.subarray(q,k),u),t.b=u+=x,t.p=d=8*k,t.f=l;continue}if(1==b)f=K,h=W,y=9,g=5;else if(2==b){var v=H(e,d,31)+257,T=H(e,d+10,15)+4,P=v+H(e,d+5,31)+1;d+=14;for(var _=new C(P),S=new C(19),I=0;I<T;++I)S[z[I]]=H(e,d+3*I,7);d+=3*T;var A=J(S),E=(1<<A)-1,j=G(S,A,1);for(I=0;I<P;){var q,N=j[H(e,d,E)];if(d+=15&N,(q=N>>4)<16)_[I++]=q;else{var B=0,L=0;for(16==q?(L=3+H(e,d,3),d+=2,B=_[I-1]):17==q?(L=3+H(e,d,7),d+=3):18==q&&(L=11+H(e,d,127),d+=7);L--;)_[I++]=B}}var D=_.subarray(0,v),U=_.subarray(v);y=J(D),g=J(U),f=G(D,y,1),h=G(U,g,1)}else X(1);if(d>w){c&&X(0);break}}s&&p(u+131072);for(var R=(1<<y)-1,Z=(1<<g)-1,V=d;;V=d){var Q=(B=f[Y(e,d)&R])>>4;if((d+=15&B)>w){c&&X(0);break}if(B||X(2),Q<256)o[u++]=Q;else{if(256==Q){V=d,f=null;break}var ee=Q-254;if(Q>264){var te=O[I=Q-257];ee=H(e,d,(1<<te)-1)+M[I],d+=te}var oe=h[Y(e,d)&Z],ne=oe>>4;if(oe||X(3),d+=15&oe,U=F[ne],ne>3&&(te=$[ne],U+=Y(e,d)&(1<<te)-1,d+=te),d>w){c&&X(0);break}s&&p(u+131072);var ie=u+ee;if(u<U){var re=r-U,ae=Math.min(U,ie);for(re+u<0&&X(3);u<ae;++u)o[u]=n[re+u]}for(;u<ie;++u)o[u]=o[u-U]}}t.l=f,t.p=V,t.b=u,t.f=l,f&&(l=1,t.m=y,t.d=h,t.n=g)}while(!l);return u!=o.length&&a?function(e,t,o){return(null==t||t<0)&&(t=0),(null==o||o>e.length)&&(o=e.length),new C(e.subarray(t,o))}(o,0,u):o.subarray(0,u)},te=new C(0);function oe(e,t){var o,n,i=function(e){31==e[0]&&139==e[1]&&8==e[2]||X(6,"invalid gzip data");var t=e[3],o=10;4&t&&(o+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[o++]);return o+(2&t)}(e);return i+8>e.length&&X(6,"invalid gzip data"),ee(e.subarray(i,-8),{i:2},t&&t.out||new C((n=(o=e).length,(o[n-4]|o[n-3]<<8|o[n-2]<<16|o[n-1]<<24)>>>0)),t&&t.dictionary)}function ne(e,t){return ee(e.subarray((o=e,n=t&&t.dictionary,(8!=(15&o[0])||o[0]>>4>7||(o[0]<<8|o[1])%31)&&X(6,"invalid zlib data"),(o[1]>>5&1)==+!n&&X(6,"invalid zlib data: "+(32&o[1]?"need":"unexpected")+" dictionary"),2+(o[1]>>3&4)),-4),{i:2},t&&t.out,t&&t.dictionary);var o,n}var ie="undefined"!=typeof TextDecoder&&new TextDecoder;try{ie.decode(te,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var re=o(833);const ae=67324752,se=33639248,ce={get:e=>(u.get(e,6),{signature:h.get(e,0),compressedSize:h.get(e,8),uncompressedSize:h.get(e,12)}),len:16},me={get(e){const t=u.get(e,6);return{signature:h.get(e,0),minVersion:u.get(e,4),dataDescriptor:!!(8&t),compressedMethod:u.get(e,8),compressedSize:h.get(e,18),uncompressedSize:h.get(e,22),filenameLength:u.get(e,26),extraFieldLength:u.get(e,28),filename:null}},len:30},pe={get:e=>({signature:h.get(e,0),nrOfThisDisk:u.get(e,4),nrOfThisDiskWithTheStart:u.get(e,6),nrOfEntriesOnThisDisk:u.get(e,8),nrOfEntriesOfSize:u.get(e,10),sizeOfCd:h.get(e,12),offsetOfStartOfCd:h.get(e,16),zipFileCommentLength:u.get(e,20)}),len:22},le={get(e){const t=u.get(e,8);return{signature:h.get(e,0),minVersion:u.get(e,6),dataDescriptor:!!(8&t),compressedMethod:u.get(e,10),compressedSize:h.get(e,20),uncompressedSize:h.get(e,24),filenameLength:u.get(e,28),extraFieldLength:u.get(e,30),fileCommentLength:u.get(e,32),relativeOffsetOfLocalHeader:h.get(e,42),filename:null}},len:46};function de(e){const t=new Uint8Array(h.len);return h.put(t,0,e),t}const ue=re("tokenizer:inflate"),fe=262144,he=de(134695760),ye=de(101010256);class ge{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(fe)}async isZip(){return await this.peekSignature()===ae}peekSignature(){return this.tokenizer.peekToken(h)}async findEndOfCentralDirectoryLocator(){const e=this.tokenizer,t=Math.min(16384,e.fileInfo.size),o=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(o,{position:e.fileInfo.size-t});for(let n=o.length-4;n>=0;n--)if(o[n]===ye[0]&&o[n+1]===ye[1]&&o[n+2]===ye[2]&&o[n+3]===ye[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess())return void ue("Cannot reading central-directory without random-read support");ue("Reading central-directory...");const e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){ue("Central-directory 32-bit signature found");const o=await this.tokenizer.readToken(pe,t),n=[];this.tokenizer.setPosition(o.offsetOfStartOfCd);for(let e=0;e<o.nrOfEntriesOfSize;++e){const t=await this.tokenizer.readToken(le);if(t.signature!==se)throw new Error("Expected Central-File-Header signature");t.filename=await this.tokenizer.readToken(new b(t.filenameLength,"utf-8")),await this.tokenizer.ignore(t.extraFieldLength),await this.tokenizer.ignore(t.fileCommentLength),n.push(t),ue(`Add central-directory file-entry: n=${e+1}/${n.length}: filename=${n[e].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){const t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let o=!1;do{const t=await this.readLocalFileHeader();if(!t)break;const n=e(t);let i;if(o=!!n.stop,await this.tokenizer.ignore(t.extraFieldLength),t.dataDescriptor&&0===t.compressedSize){const e=[];let o=fe;ue("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let i=-1;for(;i<0&&o===fe;){o=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),i=we(this.syncBuffer.subarray(0,o),he);const t=i>=0?i:o;if(n.handler){const o=new Uint8Array(t);await this.tokenizer.readBuffer(o),e.push(o)}else await this.tokenizer.ignore(t)}ue(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),n.handler&&await this.inflate(t,be(e),n.handler)}else n.handler?(ue(`Reading compressed-file-data: ${t.compressedSize} bytes`),i=new Uint8Array(t.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(t,i,n.handler)):(ue(`Ignoring compressed-file-data: ${t.compressedSize} bytes`),await this.tokenizer.ignore(t.compressedSize));if(ue(`Reading data-descriptor at pos=${this.tokenizer.position}`),t.dataDescriptor&&134695760!==(await this.tokenizer.readToken(ce)).signature)throw new Error("Expected data-descriptor-signature at position "+(this.tokenizer.position-ce.len))}while(!o)}async iterateOverCentralDirectory(e,t){for(const o of e){const e=t(o);if(e.handler){this.tokenizer.setPosition(o.relativeOffsetOfLocalHeader);const t=await this.readLocalFileHeader();if(t){await this.tokenizer.ignore(t.extraFieldLength);const n=new Uint8Array(o.compressedSize);await this.tokenizer.readBuffer(n),await this.inflate(t,n,e.handler)}}if(e.stop)break}}inflate(e,t,o){return 0===e.compressedMethod?o(t):(ue(`Decompress filename=${e.filename}, compressed-size=${t.length}`),o(31==(n=t)[0]&&139==n[1]&&8==n[2]?oe(n,i):8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31?function(e,t){return ee(e,{i:2},t&&t.out,t&&t.dictionary)}(n,i):ne(n,i)));var n,i}async readLocalFileHeader(){const e=await this.tokenizer.peekToken(h);if(e===ae){const e=await this.tokenizer.readToken(me);return e.filename=await this.tokenizer.readToken(new b(e.filenameLength,"utf-8")),e}if(e===se)return!1;if(3759263696===e)throw new Error("Encrypted ZIP");throw new Error("Unexpected signature")}}function we(e,t){const o=e.length,n=t.length;if(n>o)return-1;for(let i=0;i<=o-n;i++){let o=!0;for(let r=0;r<n;r++)if(e[i+r]!==t[r]){o=!1;break}if(o)return i}return-1}function be(e){const t=e.reduce(((e,t)=>e+t.length),0),o=new Uint8Array(t);let n=0;for(const t of e)o.set(t,n),n+=t.length;return o}function xe(e){const{byteLength:t}=e;return 6===t?e.getUint16(0)*2**32+e.getUint32(2):5===t?e.getUint8(0)*2**32+e.getUint32(1):4===t?e.getUint32(0):3===t?65536*e.getUint8(0)+e.getUint16(1):2===t?e.getUint16(0):1===t?e.getUint8(0):void 0}Object.prototype.toString,new globalThis.TextDecoder("utf8"),new globalThis.TextEncoder,Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const ke={get:(e,t)=>127&e[t+3]|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},ve=4100;function Te(e){switch(e){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:"application/vnd.oasis.opendocument.text-template"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:"application/vnd.oasis.opendocument.spreadsheet-template"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:"application/vnd.oasis.opendocument.presentation-template"};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:"application/vnd.oasis.opendocument.graphics"};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:"application/vnd.oasis.opendocument.graphics-template"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};case"application/vnd.ms-excel.sheet.macroEnabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.template"};case"application/vnd.ms-excel.template.macroEnabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"application/vnd.ms-word.document.macroEnabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.template"};case"application/vnd.ms-word.template.macroEnabledTemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:"application/vnd.openxmlformats-officedocument.presentationml.template"};case"application/vnd.ms-powerpoint.template.macroEnabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroEnabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"application/vnd.ms-powerpoint.presentation.macroEnabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroEnabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function Pe(e,t,o){o={offset:0,...o};for(const[n,i]of t.entries())if(o.mask){if(i!==(o.mask[n]&e[n+o.offset]))return!1}else if(i!==e[n+o.offset])return!1;return!0}class _e{constructor(e){this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){const t=e.position;for(const o of this.detectors){const n=await o.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);var o,n;if(t?.length>1)return this.fromTokenizer((o=t,n=this.tokenizerOptions,new A(o,n)))}async fromBlob(e){return this.fromStream(e.stream())}async fromStream(e){const t=await function(e,t){const o=function(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new _(t):new P(t)}catch(t){if(t instanceof TypeError)return new _(e.getReader());throw t}}(e),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await o.close(),i)return i()},new I(o,n)}(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){const{sampleSize:o=ve}=t;let n,i;const r=e.getReader({mode:"byob"});try{const{value:e,done:t}=await r.read(new Uint8Array(o));if(i=e,!t&&e)try{n=await this.fromBuffer(e.slice(0,o))}catch(e){if(!(e instanceof x))throw e;n=void 0}i=e}finally{r.releaseLock()}const a=new TransformStream({async start(e){e.enqueue(i)},transform(e,t){t.enqueue(e)}}),s=e.pipeThrough(a);return s.fileType=n,s}check(e,t){return Pe(this.buffer,e,t)}checkString(e,t){return this.check((o=e,[...o].map((e=>e.charCodeAt(0)))),t);var o}detectConfident=async e=>{if(this.buffer=new Uint8Array(ve),void 0===e.fileInfo.size&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const t=await e.readToken(ke);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===this.buffer[0]||70===this.buffer[0])&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let o;return await new ge(e).unzip((e=>{switch(e.filename){case"META-INF/mozilla.rsa":return o={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return o={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(e){const t=new TextDecoder("utf-8").decode(e).trim();o=Te(t)},stop:!0};case"[Content_Types].xml":return{async handler(e){let t=new TextDecoder("utf-8").decode(e);const n=t.indexOf('.main+xml"');if(-1===n){const e="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";t.includes(`ContentType="${e}"`)&&(o=Te(e))}else{t=t.slice(0,Math.max(0,n));const e=t.lastIndexOf('"'),i=t.slice(Math.max(0,e+1));o=Te(i)}},stop:!0};default:return/classes\d*\.dex/.test(e.filename)?(o={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})),o??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const n=new Uint8Array(8);return await e.readBuffer(n),Pe(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Pe(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Pe(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Pe(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Pe(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Pe(n,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(3===this.buffer[2]||5===this.buffer[2]||7===this.buffer[2])&&(4===this.buffer[3]||6===this.buffer[3]||8===this.buffer[3]))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{const i=1350;if(i===await e.ignore(i)){const r=10485760,a=new Uint8Array(Math.min(r,e.fileInfo.size-i));if(await e.readBuffer(a,{mayBeLess:!0}),-1!==function(e,t){const o=e.length,n=t.length;if(0===n)return-1;if(n>o)return-1;const i=o-n;for(let o=0;o<=i;o++){let i=!0;for(let r=0;r<n;r++)if(e[o+r]!==t[r]){i=!1;break}if(i)return o}return-1}(a,(new TextEncoder).encode("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}}catch(s){if(!(s instanceof x))throw s}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const c=await this.readTiffHeader(!1);if(c)return c}if(this.check([77,77])){const m=await this.readTiffHeader(!0);if(m)return m}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function p(){const t=await e.peekNumber(d);let o=128,n=0;for(;!(t&o)&&0!==o;)++n,o>>=1;const i=new Uint8Array(n+1);return await e.readBuffer(i),i}async function l(){const e=await p(),t=await p();t[0]^=128>>t.length-1;const o=Math.min(6,t.length),n=new DataView(e.buffer),i=new DataView(t.buffer,t.length-o,o);return{id:xe(n),len:xe(i)}}async function u(t){for(;t>0;){const o=await l();if(17026===o.id)return(await e.readToken(new b(o.len))).replaceAll(/\00.*$/g,"");await e.ignore(o.len),--t}}const f=await l();switch(await u(f.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(0===this.buffer[6]||1===this.buffer[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const h=new b(4,"latin1").get(this.buffer,2);if(h.match("^d*")&&h>=1e3&&h<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),"debian-binary"===await e.readToken(new b(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&["\n","\r","\t"," ","\0"].some((e=>this.checkString(e,{offset:6}))))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){async function y(){return{length:await e.readToken(g),type:await e.readToken(new b(4,"latin1"))}}await e.ignore(8);do{const k=await y();if(k.length<0)return;switch(k.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(k.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&96&this.buffer[8]){const v=new b(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(v){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return v.startsWith("3g")?v.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function T(){const t=new Uint8Array(16);return await e.readBuffer(t),{id:t,size:Number(await e.readToken(w))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const P=await T();let _=P.size-24;if(Pe(P.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const S=new Uint8Array(16);if(_-=await e.readBuffer(S),Pe(S,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(Pe(S,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(_)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new b(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const I=new DataView(this.buffer.buffer).getUint32(12,!0);if(I>12&&this.buffer.length>=I+16)try{const A=(new TextDecoder).decode(this.buffer.slice(16,I+16));if(JSON.parse(A).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}return this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2])?{ext:"mxf",mime:"application/mxf"}:this.checkString("SCRM",{offset:44})?{ext:"s3m",mime:"audio/x-s3m"}:this.check([71])&&this.check([71],{offset:188})||this.check([71],{offset:4})&&this.check([71],{offset:196})?{ext:"mts",mime:"video/mp2t"}:this.check([66,79,79,75,77,79,66,73],{offset:60})?{ext:"mobi",mime:"application/x-mobipocket-ebook"}:this.check([68,73,67,77],{offset:128})?{ext:"dcm",mime:"application/dicom"}:this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70])?{ext:"lnk",mime:"application/x.ms.shortcut"}:this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0])?{ext:"alias",mime:"application/x.apple.alias"}:this.checkString("Kaydara FBX Binary \0")?{ext:"fbx",mime:"application/x.autodesk.fbx"}:this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8}))?{ext:"eot",mime:"application/vnd.ms-fontobject"}:this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29])?{ext:"indd",mime:"application/x-indesign"}:(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),function(e,t=0){const o=Number.parseInt(new b(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(o))return!1;let n=256;for(let o=t;o<t+148;o++)n+=e[o];for(let o=t+156;o<t+512;o++)n+=e[o];return o===n}(this.buffer)?{ext:"tar",mime:"application/x-tar"}:this.check([255,254])?this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0:this.checkString("-----BEGIN PGP MESSAGE-----")?{ext:"pgp",mime:"application/pgp-encrypted"}:void 0)};detectImprecise=async e=>{if(this.buffer=new Uint8Array(ve),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}};async readTiffTag(e){const t=await this.tokenizer.readToken(e?f:u);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?f:u);for(let o=0;o<t;++o){const t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){const t=(e?f:u).get(this.buffer,2),o=(e?y:h).get(this.buffer,4);if(42===t){if(o>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(o>=8){const t=(e?f:u).get(this.buffer,8),o=(e?f:u).get(this.buffer,10);if(28===t&&254===o||31===t&&11===o)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(o),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(43===t)return{ext:"tif",mime:"image/tiff"}}}new Set(["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm"]),new Set(["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-word.template.macroEnabled.12","application/vnd.ms-powerpoint.template.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12","application/java-archive","application/vnd.rn-realmedia"]);const Se={async call(e,t={}){return this.apiClient.safeCall((async()=>{const o=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(o),o.data}))},async callNoConnected(e,t={}){if(this.isConnected)throw new c("Vous devez ne devez pas être connecté pour faire cette action.");return this.call(e,t)},async callIsConnected(e,t={}){if(!this.isConnected)throw new c("Vous devez être connecté pour faire cette action.");return"function"==typeof e?await e():this.call(e,t)},async callIsMe(e,t={}){if(!this.isMe)throw new c("Vous devez être vous-même pour faire cette action.");return"function"==typeof e?await e():await this.callIsConnected(e,t)},async validateImage(e){if(!e)throw new r("Le fichier est requis.");let t="";if("undefined"!=typeof File&&e instanceof File){if(t=e.type,!t||!t.startsWith("image/")||!["image/jpg","image/jpeg","image/png"].includes(t))throw new r("Le fichier doit être une image valide.")}else if("undefined"!=typeof Blob&&e instanceof Blob){t=e.type;const o=`${Date.now()}.${t.split("/")[1]}`;if(e=new File([e],o,{type:t}),console.log(o),!t||!t.startsWith("image/")||!["image/jpg","image/jpeg","image/png"].includes(t))throw new r("Le fichier doit être une image valide (jpg ou png).")}else{if("undefined"==typeof Buffer||!Buffer.isBuffer(e))throw new r("Le fichier doit être de type File (navigateur) ou Buffer (Node).");{const o=await async function(e){return(new _e).fromBuffer(e)}(e);if(!o||!o.mime.startsWith("image/")||!["image/jpg","image/jpeg","image/png"].includes(o.mime))throw new r("Le fichier doit être une image valide.");t=o.mime}}return e}};class Ie{#e;#t;#o=null;constructor(e,{id:t,slug:o}={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null}get id(){return this.#e}_id(e){this.#e=e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}getEntityType(){return"organizations"}async getProfil(){return this.apiClient.safeCall((async()=>{const e=await this.getPublicProfile();return this._setData(e),e}))}async getNews(e={}){return e.pathParams={type:this.getEntityType(),id:this.id},this._getNews(e)}async addNews(e={}){return e.parentId=this.id,e.parentType=this.getEntityType(),this.callIsConnected((()=>this._addNews(e)))}}Object.assign(Ie.prototype,m,Se,p);class Ae{#e;#t;#o=null;constructor(e,{id:t,slug:o}={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null}get id(){return this.#e}_id(e){this.#e=e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}getEntityType(){return"projects"}async getProfil(){return this.apiClient.safeCall((async()=>{const e=await this.getPublicProfile();return this._setData(e),e}))}async getNews(e={}){return e.pathParams={type:this.getEntityType(),id:this.id},this._getNews(e)}async addNews(e={}){return e.parentId=this.id,e.parentType=this.getEntityType(),this.callIsConnected((()=>this._addNews(e)))}}Object.assign(Ae.prototype,m,Se,p);const Ce={async _meInfoUrl(){return this.callIsConnected("ME_INFO_URL")},async _changePassword(e={}){return e.userId&&delete e.userId,e.mode&&delete e.mode,this.callIsConnected("CHANGE_PASSWORD",e)},async _deleteAccount(e={}){return e.pathParams&&delete e.pathParams,this.callIsConnected("DELETE_ACCOUNT",e)}};class Ee{#e;#t;#o;constructor(e,{id:t,slug:o}={},n={}){if(!t&&!o)throw new Error("Vous devez fournir un id ou un slug pour créer un User.");this.apiClient=e,this.#e=t||null,this.#t=o||null,this.#o=n}get id(){return this.#e}_id(e){this.#e=e}get slug(){return this.#t}_slug(e){this.#t=e}get isConnected(){return this.apiClient.isConnected}get data(){return this.#o}_setData(e){this.#o=e}getEntityType(){return"citoyens"}get userId(){return this.apiClient.userId}get isMe(){return this.isConnected&&this.userId===this.id}async getProfil(){return this.apiClient.safeCall((async()=>this.isMe?await this._meInfoUrl():await this.getPublicProfile()))}async changePassword(e={}){return this.callIsMe((()=>this._changePassword(e)))}async delete(e={}){return this.callIsMe((()=>this._deleteAccount(e)))}async updateSettings(e={}){return this.callIsMe((()=>this._updateSettings(e)))}async updateDescription(e={}){return this.callIsMe((()=>this._updateBlockDescription(e)))}async updateInfo(e={}){return this.callIsMe((()=>this._updateBlockInfo(e)))}async updateSocial(e={}){return this.callIsMe((()=>this._updateBlockSocial(e)))}async updateLocality(e={}){return this.callIsMe((()=>this._updateBlockLocality(e)))}async updateSlug(e){try{await this._check({slug:e})}catch(e){if(e instanceof s)throw new s("Erreur lors de la vérification du slug.",e.status,e.data);throw e}return this.callIsMe((()=>this._updateBlockSlug({slug:e})))}async updateImageProfil(e){return e=await this.validateImage(e),this.callIsMe((()=>this._profilImage({profil_avatar:e})))}async getNews(e={}){return e.pathParams&&delete e.pathParams,this.isMe||(e.pathParams={id:this.id}),this._getNews(e)}async addNews(e={}){return e.parentId&&delete e.parentId,e.parentType&&delete e.parentType,this.callIsMe((()=>this._addNews(e)))}}Object.assign(Ee.prototype,m,Se,Ce,p);const je=require("events"),Oe=(e,t)=>1===t?e:`${e}s`,$e=e=>{if(""===e)return"$";const t=e.substring(1).split(/\//).map((e=>e.replace(/~1/g,"/").replace(/~0/g,"~").replace(/\./g,"\\."))).map((e=>/^\d+$/.exec(e)?`[${e}]`:`.${e}`)).join("");return"$"+t},ze=e=>{switch(e[0]){case"a":case"e":case"i":case"o":case"u":return"an";default:return"a"}},qe=(e,t="and")=>0===e.length?"nothing":1===e.length?e[0]:2===e.length?`${e[0]} ${t} ${e[1]}`:`${e.slice(0,-1).join(", ")}, ${t} ${e[e.length-1]}`,Ne={"date-time":"date and time",time:"time",date:"date",email:"email address",hostname:"hostname",ipv4:"IPv4 address",ipv6:"IPv6 address",uri:"URI","uri-reference":"URI Reference","uri-template":"URI-template","json-pointer":"JSON Pointer","relative-json-pointer":"relative JSON Pointer",regex:"regular expression"},Me={fieldLabels:"title",includeOriginalError:!1,includeData:!1};class Be extends Error{constructor(e,t={}){super(),this.options={},this.redundant=!1,this.options={...Me,...t},this.pointer=e.instancePath,this.path=$e(e.instancePath);const o=(({data:e,keyword:t,message:o,params:n,parentSchema:i,schemaPath:r,instancePath:a},{fieldLabels:s})=>{const c=(({instancePath:e,parentSchema:t},{fieldLabels:o})=>{switch(o){case"js":return""===e?"the root value":`the value at ${$e(e).replace(/^\$/,"")}`;case"jsonPath":return`the value at ${$e(e)}`;case"jsonPointer":case"instancePath":return""===e?"the root value":`the value at ${e}`;case"title":return(null==t?void 0:t.title)?t.title:""===e?"the root value":`the value at ${e}`;default:throw new Error(`invalid fieldLabels value: ${o}`)}})({instancePath:a,parentSchema:i},{fieldLabels:s});if(null==i?void 0:i.errorMessage)return`${c} ${i.errorMessage}`;switch(t){case"enum":{const e=n.allowedValues.map(JSON.stringify);return`${c} must be one of: ${qe(e,"or")}`}case"type":{const t=Array.isArray(n.type)?n.type:n.type.split(","),o=qe(t,"or"),i=(e=>{const t=typeof e;switch(t){case"object":return null===e?"null":Array.isArray(e)?"an array":"an object";case"undefined":return"undefined";default:return`${ze(t)} ${t}`}})(e);return`${c} must be ${ze(o)} ${o} but it was ${i}`}case"minLength":{const t=n.limit,o=Oe("character",t),i=e.length;return`${c} must be ${t} ${o} or more but it was ${i} ${Oe("character",i)}`}case"maxLength":{const t=n.limit,o=Oe("character",t),i=e.length;return`${c} must be ${t} ${o} or fewer but it was ${i} ${Oe("character",i)}`}case"pattern":{if(r.endsWith("propertyNames/pattern"))return null;const e=null==i?void 0:i.patternLabel;return e?`${c} must be ${e} but it was not`:`${c} is an invalid string`}case"format":return`${c} must be a valid ${Ne[n.format]||n.format} string but it was not`;case"multipleOf":return`${c} must be a multiple of ${n.multipleOf}`;case"minimum":return`${c} must be equal to or greater than ${n.limit}`;case"exclusiveMinimum":return`${c} must be greater than ${n.limit}`;case"maximum":return`${c} must be equal to or less than ${n.limit}`;case"exclusiveMaximum":return`${c} must be less than ${n.limit}`;case"additionalProperties":{const e=Object.keys(null==i?void 0:i.properties).join(", ");return`${c} has an unexpected property, ${n.additionalProperty}, which is not in the list of allowed properties (${e})`}case"required":return`${c} is missing the required field '${n.missingProperty}'`;case"propertyNames":return`${c} has an invalid property name ${JSON.stringify(n.propertyName)}`;case"minProperties":return`${c} must have ${n.limit} or more properties but it has ${Object.keys(e).length}`;case"maxProperties":return`${c} must have ${n.limit} or fewer properties but it has ${Object.keys(e).length}`;case"dependencies":{const e=n.property;return`${c} must have property ${n.missingProperty} when ${e} is present`}case"minItems":return`${c} must have ${n.limit} or more items but it has ${e.length}`;case"maxItems":return`${c} must have ${n.limit} or fewer items but it has ${e.length}`;case"uniqueItems":{const{i:e,j:t}=n;return`${c} must be unique but elements ${t} and ${e} are the same`}default:return`${c} ${o}`}})(e,this.options);var n;null!==o?(this.message=`${n=o,"string"!=typeof n||0===n.length?n:n.charAt(0).toUpperCase()+n.slice(1)}.`,this.options.includeOriginalError&&(this.original=e),this.options.includeData&&(this.data=e.data)):this.redundant=!0}toJSON(){const e={path:this.path,pointer:this.pointer,message:this.message};return this.options.includeOriginalError&&(e.original=this.original),this.options.includeData&&(e.data=this.data),e}}class Le extends Error{constructor(e,t={}){super(),this.name="AggregateAjvError",this.errors=(null!=e?e:[]).map((e=>new Be(e,t))).filter((e=>!e.redundant)),this.message=this.errors.map((e=>e.message)).join(" ")}toJSON(){return this.errors.map((e=>e.toJSON()))}*[Symbol.iterator](){for(const e of this.errors)yield e}}const Fe=require("ajv"),De=require("ajv-formats"),Ue=require("axios"),Re=require("axios-retry"),Ge=require("ejson");class Ze extends Error{}Ze.prototype.name="InvalidTokenError";const Ve=require("pino"),Ke={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class{constructor(e){if(e){if(e=e.toLowerCase(),!Ke._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof Ke.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new Ke.ObjectID(this._str)}typeName(){return"oid"}getTimestamp(){return Number.parseInt(this._str.substr(0,8),16)}valueOf(){return this._str}toJSONValue(){return this.valueOf()}toHexString(){return this.valueOf()}}},We=Ke,Je={common1:{type:"string"},common2:{format:"email",type:"string"},common3:{type:"boolean"},common4:{format:"uri",type:"string"},common5:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common6:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},required:["id"],type:"object"},common7:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}},common8:{default:"",type:"string"},common9:{pattern:"^[a-f0-9]{24}$",type:"string"},common10:{const:"citoyens"},common11:{properties:{value:{type:"boolean"}}},common12:{value:{type:"boolean"}},common13:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common14:{},common15:{else:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},if:{properties:{typeElement:{const:"citoyens"}}},then:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}}},common16:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},common17:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common18:{properties:{typeElement:{const:"citoyens"}}},common19:{typeElement:{const:"citoyens"}},common20:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}},common21:{not:{type:"null"}},common22:{type:"null"},common23:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common24:{items:{type:"string"},type:"array"},common25:{enum:[""],type:"string"},common26:{properties:{name:{not:{type:"null"}}},required:["name"]},common27:{name:{not:{type:"null"}}},common28:{properties:{url:{not:{type:"null"}}},required:["url"]},common29:{url:{not:{type:"null"}}},common30:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common31:{tags:{not:{type:"null"}}},common32:{properties:{email:{not:{type:"null"}}},required:["email"]},common33:{email:{not:{type:"null"}}},common34:{const:"info",default:"info",type:"string"},common35:{$ref:"#/$defs/sharedFields/email"},common36:{$ref:"#/$defs/sharedFields/name"},common37:{$ref:"#/$defs/sharedFields/tags"},common38:{$ref:"#/$defs/sharedFields/url"},common39:{const:"projects"},common40:{const:"organizations"},common41:{$ref:"#/$defs/socialField"},common42:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common43:{id:{pattern:"^[a-f0-9]{24}$"}},common44:{pattern:"^[a-f0-9]{24}$"},common45:{minLength:0,type:"string"},common46:{type:["string","number"]},common47:{type:"number"},common48:{const:!0,default:!0,type:"boolean"},common49:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common50:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common51:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common52:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common53:{properties:{type:{const:"citoyens"}}},common54:{type:{const:"citoyens"}},common55:{additionalProperties:!1,else:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{folder:{const:"citoyens"}}},properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],then:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common56:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common57:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common58:{properties:{folder:{const:"citoyens"}}},common59:{folder:{const:"citoyens"}},common60:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common61:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common62:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common63:{additionalProperties:!1,else:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{type:{const:"citoyens"}}},properties:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},required:["type","id"],then:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common64:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common65:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common66:{parentId:{pattern:"^[a-f0-9]{24}$"}},common67:{properties:{parentType:{const:"citoyens"}}},common68:{parentType:{const:"citoyens"}},common69:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common70:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common71:{default:!0,type:"boolean"},common72:{required:["text"]},common73:{required:["mediaImg"]},common74:{required:["mediaFile"]},common75:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common76:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common77:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common78:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common79:{additionalProperties:!1,patternProperties:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},type:"object"},common80:{"^[0-9]+$":{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"}},common81:{additionalProperties:!1,properties:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common82:{count:{type:"number"},id:{type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common83:{default:"public",enum:["public","private","restricted"],type:"string"},common84:{const:"news",default:"news",type:"string"},common85:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common86:{default:!1,type:"boolean"},common87:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common88:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},common89:{default:"news",enum:["news"],type:"string"},common90:{items:{additionalProperties:!1,properties:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},type:"array"},common91:{additionalProperties:!1,properties:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},required:["id","name","slug","type","value","count"],type:"object"},common92:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common93:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common94:{const:!1,default:!1,type:"boolean"},common95:{const:"",default:"",type:"string"},common96:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common97:{indexMax:{type:"number"},indexMin:{type:"number"}},common98:{default:0,minimum:0,type:"integer"},common99:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common100:{enum:["projects"],type:"string"},common101:{$exists:!0},common102:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common103:{$exists:{const:!0}},common104:{const:!0},common105:{default:30,type:"integer"},common106:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common107:{enum:["poi"],type:"string"},common108:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common109:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common110:{$exists:!1},common111:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common112:{$exists:{const:!1}},common113:{const:!1},common114:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common115:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common116:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common117:{$exists:{default:!1,type:"boolean"}},common118:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common119:{$in:{items:{type:"string"},minItems:1,type:"array"}},common120:{items:{type:"string"},minItems:1,type:"array"},common121:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common122:{enum:["citoyens"],type:"string"},common123:{const:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},type:"array"},common124:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common125:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common126:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common127:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common128:{"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},"^links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"}},common129:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common130:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common131:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common132:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common133:{enum:["badges"],type:"string"},common134:{const:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],default:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common135:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common136:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common137:{$exists:{const:!0,type:"boolean"}},common138:{const:!0,type:"boolean"},common139:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common140:{$exists:{const:!1,type:"boolean"}},common141:{const:!1,type:"boolean"},common142:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"}},common143:{indexMax:30,indexMin:0},common144:{additionalProperties:!1,allOf:[{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}}],properties:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},required:["childId","childType","parentType","parentId","connectType"],type:"object"},common145:{if:{properties:{parentType:{const:"citoyens"}}},then:{properties:{connectType:{const:"friend",default:"friend"}}}},common146:{properties:{connectType:{const:"friend",default:"friend"}}},common147:{connectType:{const:"friend",default:"friend"}},common148:{const:"friend",default:"friend"},common149:{if:{properties:{parentType:{const:"organizations"}}},then:{properties:{connectType:{enum:["admin","member"]}}}},common150:{properties:{parentType:{const:"organizations"}}},common151:{parentType:{const:"organizations"}},common152:{properties:{connectType:{enum:["admin","member"]}}},common153:{connectType:{enum:["admin","member"]}},common154:{enum:["admin","member"]},common155:{if:{properties:{parentType:{const:"projects"}}},then:{properties:{connectType:{enum:["admin","contributor"]}}}},common156:{properties:{parentType:{const:"projects"}}},common157:{parentType:{const:"projects"}},common158:{properties:{connectType:{enum:["admin","contributor"]}}},common159:{connectType:{enum:["admin","contributor"]}},common160:{enum:["admin","contributor"]},common161:{if:{properties:{parentType:{const:"events"}}},then:{properties:{connectType:{const:"attendee",default:"attendee"}}}},common162:{properties:{parentType:{const:"events"}}},common163:{parentType:{const:"events"}},common164:{const:"events"},common165:{properties:{connectType:{const:"attendee",default:"attendee"}}},common166:{connectType:{const:"attendee",default:"attendee"}},common167:{const:"attendee",default:"attendee"},common168:{childId:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},childType:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},connectType:{enum:["admin","member","contributor","attendee","friend"],type:"string"},parentId:{pattern:"^[a-f0-9]{24}$",type:"string"},parentType:{enum:["citoyens","organizations","projects","events"],type:"string"}},common169:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common170:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common171:{enum:["admin","member","contributor","attendee","friend"],type:"string"},common172:{enum:["citoyens","organizations","projects","events"],type:"string"}},He=[{auth:"none",constant:"PERSON_REGISTER",contentType:"application/x-www-form-urlencoded",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/co2/person/register",request:{additionalProperties:!1,properties:{app:Je.common1,email:Je.common2,isInvitation:Je.common3,mode:Je.common1,name:Je.common1,pendingUserId:Je.common1,pwd:Je.common1,username:Je.common1},required:["name","username","email","pwd"],type:"object"}},{auth:"none",constant:"AUTHENTICATE_URL",contentType:"application/json",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/api/cocolight/authenticate",postActions:[{path:"accessToken",type:"setToken"},{path:"refreshToken",type:"setRefreshToken"},{event:"userLoggedIn",path:"user",type:"emitEvent"}],request:{additionalProperties:!1,properties:{email:Je.common2,password:Je.common1},required:["email","password"],type:"object"}},{auth:"none",constant:"REFRESH_TOKEN_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/refreshtoken",request:{additionalProperties:!1,properties:{refreshToken:Je.common1},required:["refreshToken"],type:"object"}},{auth:"bearer",constant:"ME_INFO_URL",contentType:"application/json",method:"POST",path:"/api/cocolight/me"},{auth:"none",constant:"PASSWORD_RECOVERY",contentType:"application/x-www-form-urlencoded",generateModule:"UserNoAuth",method:"POST",onlyAuthNone:!0,path:"/co2/person/sendemail",request:{additionalProperties:!1,properties:{email:Je.common2,type:{const:"password",default:"password",type:"string"}},required:["email","type"],type:"object"}},{auth:"bearer",constant:"SERVER_EXCHANGE_TOKEN",contentType:"application/json",method:"POST",path:"/api/cocolight/exchangetoken",request:{additionalProperties:!1,properties:{serverUrl:Je.common4},required:["serverUrl"],type:"object"}},{auth:"bearer",constant:"CHANGE_PASSWORD",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/person/changepassword",request:{additionalProperties:!1,properties:{mode:{const:"changePassword",default:"changePassword",type:"string"},newPassword:Je.common1,newPassword2:Je.common1,oldPassword:Je.common1,scope:{default:"",type:["string"]},userId:Je.common5},required:["mode","userId","oldPassword","newPassword","newPassword2"],type:"object"}},{auth:"bearer",constant:"DELETE_ACCOUNT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/id/{id}/type/citoyens",pathParams:Je.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:{additionalProperties:!1,properties:{reason:Je.common8},required:["reason"],type:"object"}},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{else:{properties:{idEntity:Je.common9}},if:{properties:{typeEntity:Je.common10}},then:{properties:{idEntity:Je.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:Je.common10}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:Je.common10}},then:Je.common11},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","private","feedback"]},typeEntity:{not:Je.common10}}},then:Je.common11}],properties:{idEntity:Je.common1,type:Je.common1,typeEntity:Je.common13,value:Je.common14},required:["type","value","typeEntity","idEntity"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_DESCRIPTION",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{additionalProperties:!1,allOf:[Je.common15,{anyOf:[{properties:{description:Je.common21},required:["description"]},{properties:{shortDescription:Je.common21},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:Je.common8,description:Je.common1,id:Je.common1,scope:{default:"",type:["string","null"]},shortDescription:Je.common1,typeElement:Je.common13},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_INFO",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{sharedFields:{email:Je.common2,name:Je.common1,tags:Je.common23,url:Je.common4}},allOf:[{if:Je.common18,then:{additionalProperties:!1,anyOf:[Je.common26,{properties:{birthDate:Je.common21},required:["birthDate"]},{properties:{fixe:Je.common21},required:["fixe"]},{properties:{mobile:Je.common21},required:["mobile"]},Je.common28,Je.common30,Je.common32],properties:{birthDate:{format:"date",type:"string"},block:Je.common34,email:Je.common35,fixe:Je.common1,id:Je.common5,mobile:Je.common1,name:Je.common36,scope:Je.common8,tags:Je.common37,typeElement:Je.common13,url:Je.common38}}},{if:{properties:{typeElement:Je.common39}},then:{additionalProperties:!1,anyOf:[Je.common26,Je.common28,Je.common30,Je.common32,{properties:{avancement:Je.common21},required:["avancement"]},{properties:{parent:Je.common21},required:["parent"]}],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:Je.common34,email:Je.common35,id:Je.common1,name:Je.common36,parent:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:Je.common1,type:Je.common1},required:["type","name"],type:"object"}},type:"object"},scope:Je.common8,tags:Je.common37,typeElement:Je.common13,url:Je.common38}}},{if:{properties:{typeElement:Je.common40}},then:{additionalProperties:!1,anyOf:[Je.common26,Je.common28,Je.common30,Je.common32,{properties:{type:Je.common21},required:["type"]}],properties:{block:Je.common34,email:Je.common35,id:Je.common1,name:Je.common36,scope:Je.common8,tags:Je.common37,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:Je.common13,url:Je.common38}}}],properties:{block:Je.common34,id:Je.common1,scope:Je.common8,typeElement:Je.common13},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SOCIAL",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{$defs:{socialField:{anyOf:[Je.common25,Je.common4]}},allOf:[Je.common15,{anyOf:[{properties:{gitlab:Je.common21},required:["gitlab"]},{properties:{github:Je.common21},required:["github"]},{properties:{twitter:Je.common21},required:["twitter"]},{properties:{facebook:Je.common21},required:["facebook"]},{properties:{instagram:Je.common21},required:["instagram"]},{properties:{diaspora:Je.common21},required:["diaspora"]},{properties:{mastodon:Je.common21},required:["mastodon"]},{properties:{telegram:Je.common21},required:["telegram"]},{properties:{signal:Je.common21},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:Je.common41,facebook:Je.common41,github:Je.common41,gitlab:Je.common41,id:Je.common1,instagram:Je.common41,mastodon:Je.common41,scope:Je.common8,signal:Je.common41,telegram:Je.common41,twitter:Je.common41,typeElement:Je.common13},required:["block","typeElement","id"],type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_LOCALITY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:Je.common42,if:Je.common18,properties:{address:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:Je.common1,addressLocality:Je.common1,codeInsee:Je.common1,level1:Je.common1,level1Name:Je.common1,level3:Je.common45,level3Name:Je.common45,level4:Je.common45,level4Name:Je.common45,localityId:Je.common1,postalCode:Je.common1,streetAddress:Je.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},block:{const:"localities",default:"localities",type:"string"},geo:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:Je.common46,longitude:Je.common46},required:["latitude","longitude"],type:"object"},geoPosition:{additionalProperties:!0,properties:{coordinates:{items:Je.common47,maxItems:2,minItems:2,type:"array"},float:Je.common48,type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},id:Je.common1,scope:Je.common8,typeElement:Je.common13},required:["block","typeElement","id","address"],then:Je.common49,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:Je.common42,if:Je.common18,properties:{block:Je.common34,id:Je.common1,scope:Je.common8,slug:Je.common52,typeElement:Je.common13},required:["block","typeElement","id","slug"],then:Je.common49,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:Je.common42,if:Je.common53,properties:{block:Je.common34,id:Je.common1,slug:Je.common52,type:Je.common13},required:["block","type","id","slug"],then:Je.common49,type:"object"}},{auth:"bearer",constant:"PROFIL_IMAGE",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/profil_avatar/contentKey/profil/docType/image",pathParams:Je.common55,request:{additionalProperties:!1,properties:{profil_avatar:Je.common14},required:["profil_avatar"],type:"object"}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:Je.common63,request:{additionalProperties:!1,properties:{tpl:{const:"ficheInfoElement",default:"ficheInfoElement",type:"string"}},required:["tpl"],type:"object"}},{auth:"bearer",constant:"MULTICONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:Je.common65,if:Je.common67,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:Je.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:Je.common1,parentType:Je.common13},required:["parentId","parentType","listInvite"],then:Je.common69,type:"object"}},{auth:"none",constant:"GET_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/get/type/{type}/id/{id}/isLive/{isLive}/json/true",pathParams:{additionalProperties:!1,else:Je.common42,if:Je.common53,properties:{id:Je.common1,isLive:Je.common71,type:Je.common13},required:["isLive","type","id"],then:Je.common49,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:{default:0,type:"integer"},indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:Je.common8},required:["name"],type:"object"}},required:["dateLimit","indexStep"],type:"object"}},{auth:"none",constant:"GET_NEWS_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/getbyids",request:{additionalProperties:!1,properties:{ids:{items:Je.common9,type:"array"}},required:["ids"],type:"object"}},{auth:"bearer",constant:"ADD_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/save",request:{additionalProperties:!1,anyOf:[Je.common72,Je.common73,Je.common74],else:Je.common65,if:Je.common67,properties:{json:Je.common48,markdownActive:Je.common71,mediaFile:Je.common75,mediaImg:Je.common77,mentions:Je.common79,parentId:Je.common1,parentType:Je.common13,scope:Je.common83,tags:Je.common23,text:Je.common1,type:Je.common84},required:["scope","markdownActive","parentId","parentType","type","json"],then:Je.common69,type:"object"}},{auth:"bearer",constant:"ADD_IMAGE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/newsImage/docType/image/contentKey/slider",pathParams:Je.common55,request:{additionalProperties:!1,properties:{newsImage:Je.common14},required:["newsImage"],type:"object"}},{auth:"bearer",constant:"ADD_FILE_NEWS",contentType:"multipart/form-data",method:"POST",path:"/co2/document/uploadSave/dir/communecter/folder/{folder}/ownerId/{ownerId}}/input/newsFile/docType/file",pathParams:Je.common55,request:{additionalProperties:!1,properties:{newsFile:Je.common14},required:["newsFile"],type:"object"}},{auth:"bearer",constant:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/delete/id/{id}",pathParams:Je.common85,request:{additionalProperties:!1,properties:{isLive:Je.common86},required:["isLive"],type:"object"}},{auth:"bearer",constant:"UPDATE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/update",request:{additionalProperties:!1,anyOf:[Je.common72,Je.common73,Je.common74],else:Je.common65,if:Je.common67,properties:{idNews:Je.common9,markdownActive:Je.common71,mediaFile:Je.common75,mediaImg:Je.common77,mentions:Je.common79,parentId:Je.common1,parentType:Je.common13,scope:Je.common83,tags:Je.common23,text:Je.common1,type:Je.common84},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:Je.common69,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:{properties:{childId:Je.common44}},if:{properties:{childType:Je.common10}},properties:{childId:Je.common9,childType:Je.common13,comment:Je.common1,connectType:{const:"share",default:"share",type:"string"},parentId:Je.common9,parentType:Je.common84},required:["parentId","parentType","childId","childType","connectType"],then:{properties:{childId:Je.common51}},type:"object"}},{auth:"none",constant:"GET_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/index/type/{type}/id/{id}/json/true",pathParams:Je.common87},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:Je.common8,contextId:Je.common9,contextType:Je.common89,mentions:Je.common90,parentCommentId:Je.common9,path:Je.common8,text:Je.common1},required:["text","contextId","contextType"],type:"object"}},{auth:"bearer",constant:"DELETE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/delete/id/{id}",pathParams:Je.common85},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:Je.common9,params:{properties:{mentions:Je.common90,text:Je.common1},required:["text"],type:"object"}},required:["id","params"],type:"object"}},{auth:"none",constant:"SEARCH_TAGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/tags/search?q={q}",pathParams:{additionalProperties:!1,properties:{q:Je.common1},required:["q"],type:"object"}},{auth:"none",constant:"SHOW_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/list/type/{type}/id/{id}/actionType/vote/json/true",pathParams:Je.common87},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:{const:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:Je.common93,type:"array"},fediverse:Je.common94,filters:Je.common95,indexMin:{const:0,default:0,type:"number"},indexStep:Je.common47,initType:Je.common95,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:Je.common1,type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},name:Je.common1,notSourceKey:Je.common48,ranges:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":Je.common96},type:"object"},searchTags:Je.common24,searchType:{items:Je.common93,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"}},{auth:"none",constant:"CITY_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:{minimum:0,type:"integer"},locality:Je.common95,name:Je.common1,searchBy:{const:"ALL",default:"ALL",type:"string"},searchType:{const:["cities"],default:["cities"],items:{enum:["cities"],type:"string"},type:"array"}},required:["name","locality","searchType"],type:"object"}},{auth:"none",constant:"SUGGESTION_INPUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{default:20,minimum:20,type:"integer"},indexMin:Je.common98,name:Je.common1,searchType:{items:{enum:["organizations","projects","poi"],type:"string"},type:"array"}},required:["name","searchType","indexMin","indexMax"],type:"object"}},{auth:"none",constant:"GET_PROJECTS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common99,fediverse:Je.common94,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":Je.common101,"parent.@userId":Je.common101},"links.contributors.@userId":Je.common101},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102},type:"object"}},required:["$or"],type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common99},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_PROJECTS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:Je.common63,request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common99,fediverse:Je.common94,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":Je.common101,"parent.@{pathParams.id}":Je.common101},"links.contributors.@{pathParams.id}":Je.common101},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102},type:"object"}},required:["$or"],type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common99},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_POIS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common106,fediverse:Je.common94,filters:{additionalProperties:!1,default:{"parent.@userId":Je.common101},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_POIS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:Je.common63,request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common106,fediverse:Je.common94,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":Je.common101},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common106},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_ORGANIZATIONS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common108,fediverse:Je.common94,filters:{additionalProperties:!1,default:{"links.members.@userId":Je.common101,"links.members.@userId.isInviting":Je.common110,"links.members.@userId.toBeValidated":Je.common110},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":Je.common111,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":Je.common111},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common108},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_ORGANIZATIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,else:Je.common42,if:Je.common53,properties:{id:Je.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:Je.common49,type:"object"},request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common108,fediverse:Je.common94,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":Je.common101,"links.members.@{pathParams.id}.isInviting":Je.common110,"links.members.@{pathParams.id}.toBeValidated":Je.common110},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":Je.common111,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":Je.common111},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common108},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_MEMBERS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common114,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":Je.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":Je.common116,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":Je.common118,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":Je.common111},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_MEMBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/organizations/id/{id}/canSee/true",pathParams:Je.common85,request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common114,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.memberOf.@{pathParams.id}":Je.common101,"links.memberOf.@{pathParams.id}.isInviting":Je.common110,"links.memberOf.@{pathParams.id}.toBeValidated":Je.common110},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":Je.common102,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":Je.common116,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":Je.common118,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":Je.common116},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_FRIENDS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:Je.common6,request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common121,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.friends.@{pathParams.id}":Je.common101,"links.friends.@{pathParams.id}.isInviting":Je.common110,"links.friends.@{pathParams.id}.toBeValidated":Je.common110},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":Je.common116,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":Je.common116},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIPTIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common123,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[Je.common125],default:{"links.followers.@userId":Je.common101,"links.followers.@{userId}.isInviting":Je.common110,"links.followers.@{userId}.toBeValidated":Je.common110},patternProperties:Je.common128,type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common123},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIPTIONS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/citoyens/id/{id}/canSee/true",pathParams:Je.common6,request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common123,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[Je.common125],default:{"links.followers.@{pathParams.id}":Je.common101,"links.followers.@{pathParams.id}.isInviting":Je.common110,"links.followers.@{pathParams.id}.toBeValidated":Je.common110},patternProperties:Je.common128,type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common123},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_SUBSCRIBERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common121,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[Je.common129],default:{"links.follows.@userId":Je.common101,"links.follows.@{userId}.isInviting":Je.common110,"links.follows.@{userId}.toBeValidated":Je.common110},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":Je.common111,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":Je.common111},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_SUBSCRIBERS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/{type}/id/{id}/canSee/true",pathParams:{additionalProperties:!1,allOf:[{else:Je.common42,if:Je.common53,then:Je.common49}],properties:{id:Je.common1,type:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common121,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[Je.common129],default:{"links.follows.@{pathParams.id}":Je.common101},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common121},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_CONTRIBUTORS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common114,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":Je.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":Je.common116,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":Je.common118,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":Je.common111},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_CONTRIBUTORS_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/projects/id/{id}/canSee/true",pathParams:Je.common85,request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common114,fediverse:Je.common94,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.projects.@{pathParams.id}":Je.common101,"links.projects.@{pathParams.id}.isInviting":Je.common110,"links.projects.@{pathParams.id}.toBeValidated":Je.common110},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":Je.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":Je.common102,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":Je.common116,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":Je.common118,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":Je.common116},type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common114},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common132,fediverse:Je.common94,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common102},type:"object"},isParcours:Je.common3,"preferences.private":Je.common94},required:["preferences.private"],type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,searchType:Je.common132},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_BADGES_FILTERS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:Je.common48,countType:Je.common134,fediverse:Je.common94,fields:Je.common132,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common136}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":Je.common136,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":Je.common139,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":Je.common139}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:Je.common142},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:Je.common142,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":Je.common138}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":Je.common136}}],type:"object"},indexMin:Je.common98,indexStep:Je.common105,initType:Je.common95,locality:Je.common95,name:Je.common1,notSourceKey:Je.common48,ranges:{additionalProperties:!1,default:{Cooperative:Je.common143,GovernmentOrganization:Je.common143,Group:Je.common143,LocalBusiness:Je.common143,NGO:Je.common143,citoyens:Je.common143,projects:Je.common143},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":Je.common96},type:"object"},searchType:Je.common134},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"CONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/connect",request:Je.common144},{auth:"bearer",constant:"DISCONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/disconnect",request:Je.common144},{auth:"none",constant:"GET_ELEMENTS_KEY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/getinfo/key/{slug}",pathParams:{additionalProperties:!1,properties:{slug:{pattern:"^([a-zA-Z0-9-_]+)$",type:"string"}},required:["slug"],type:"object"}}];Ge.addType("oid",(e=>new We.ObjectID(e)));class Ye extends je.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:r=He,timeout:a=3e4,debug:s=!1,maxRetries:c=0,circuitBreakerThreshold:m=5,circuitBreakerResetTime:p=6e4,fromJSONValue:l=!0}={}){if(super(),!e)throw new i('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshToken=o,this._refreshUrl=n,this._endpoints=r,this._debug=s;let d=null;this._fromJSONValue=l,Object.defineProperty(this,"userId",{get:()=>d,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{d=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new Fe({strict:!1,useDefaults:!0,allErrors:!0,verbose:!0}),De(this._ajv),this._logger=Ve({transport:{target:"pino-pretty",options:{colorize:!0}},level:s?"debug":"info"}),this._client=Ue.create({baseURL:e,timeout:a}),c>0&&(Re(this._client,{retries:c,retryDelay:Re.exponentialDelay,retryCondition:e=>Re.isNetworkError(e)||Re.isRetryableError(e)}),this._logger.info(`[ApiClient] Retry activé : ${c} max`)),this._breakerThreshold=m,this._breakerResetTime=p,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,t&&this.setToken(t),this._client.interceptors.response.use((e=>e),(async e=>{if(e.response&&401===e.response.status&&this._refreshToken)try{if(await this._refreshAccessToken())return this._client.request(e.config)}catch(e){throw new i(e.message,401,e)}throw e}))}setToken(e){this._accessToken=e,this._client.defaults.headers.common.Authorization="Bearer "+e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait et défini : ${t}`)),this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){this._refreshToken=e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait depuis refreshToken : ${t}`)),this._logger.debug(`[ApiClient] setRefreshToken: ${e}`)}getRefreshToken(){return this._refreshToken}get isConnected(){return!!this._accessToken}_getIdFromToken(e){if(!e)return null;try{const t=function(e,t){if("string"!=typeof e)throw new Ze("Invalid token specified: must be a string");t||(t={});const o=!0===t.header?0:1,n=e.split(".")[o];if("string"!=typeof n)throw new Ze(`Invalid token specified: missing part #${o+1}`);let i;try{i=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let o=t.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o})))}(t)}catch(e){return atob(t)}}(n)}catch(e){throw new Ze(`Invalid token specified: invalid base64 for part #${o+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new Ze(`Invalid token specified: invalid json for part #${o+1} (${e.message})`)}}(e);return this._logger.debug("[ApiClient] Payload décodé :",t),t.id||t.userId||null}catch(e){return this._logger.error("[ApiClient] Erreur lors du décodage du token :",e),null}}async _refreshAccessToken(){if(!this._refreshToken)return!1;try{const e=await this._client.post(this._refreshUrl,{refreshToken:this._refreshToken},{headers:{"Content-Type":"application/json"}});return!(!e.data||!e.data.accessToken||(this.setToken(e.data.accessToken),e.data.refreshToken&&this.setRefreshToken(e.data.refreshToken),this.emit("refreshSuccess",e.data),0))}catch(e){return this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),!0)}_updateCircuitBreakerError(){this._breakerErrorCount+=1,this._logger.warn(`[ApiClient] Erreur #${this._breakerErrorCount} sur ${this._breakerThreshold}`),this._breakerErrorCount>=this._breakerThreshold&&(this._breakerOpen=!0,this._lastBreakerOpenTime=Date.now(),this._logger.error("[ApiClient] Circuit breaker ACTIVÉ - L'API est considérée indisponible"))}_resetCircuitBreakerSuccess(){this._breakerErrorCount=0,this._breakerOpen&&(this._breakerOpen=!1,this._logger.warn("[ApiClient] Circuit breaker refermé suite à un succès"))}static stripNullsInPlace(e){if(e&&"object"==typeof e&&e.value&&"function"==typeof e.value.pipe)return e;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)null===e[t]||void 0===e[t]?e.splice(t,1):"object"==typeof e[t]&&Ye.stripNullsInPlace(e[t]);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(null===e[t]||void 0===e[t]?delete e[t]:"object"==typeof e[t]&&Ye.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,i=e=>"string"!=typeof e?e:e.replace(n,((t,n,i)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=o.pathParams(e);return null!=t?t:`@{${n}}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(i){if(i.startsWith("pathParams.")){const e=i.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],r=o.pathParams(t);return null!=r?r+n:`@${i}`}return`@${i}`}{const e=o[i];if("function"==typeof e){const t=e();return null!=t?t:`@${i}`}return`@${i}`}}return e})),r=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(r);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,n]of Object.entries(e))t[i(o)]=r(n);return t}return"string"==typeof e?i(e):e};return r(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const n of Object.keys(e)){const i=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof i&&t.test(i))continue;if(i&&"object"==typeof i){const e=this._cleanSchemaLeftoverAlias(i);Object.keys(e).length>0&&(o[n]=e);continue}}"string"==typeof i&&t.test(i)||(o[n]=this._cleanSchemaLeftoverAlias(i))}}return o}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${e.message}`),e}}async callEndpoint(e,t={},o=!0,n=!0){if(!this._checkCircuitBreaker())throw new a("Le circuit breaker est activé, impossible d'appeler l'API");const s=this._endpoints.find((t=>t.constant===e));if(!s)throw new i(`Endpoint introuvable : ${e}`,404);const{path:c,method:m,contentType:p,auth:l,pathParams:d,request:u,responses:f}=s,h=(m||"GET").toLowerCase(),y=p||"application/json",g={"Content-Type":y};if(this._accessToken)"bearer"===l?g.Authorization=`Bearer ${this._accessToken}`:l&&"none"!==l||g.Authorization||(g.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===l)throw new i(`Token requis pour l'endpoint sécurisé : ${e}`,401);let w,b=c,x={};if(d){let e=d;"none"===l&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(d));const o=t.pathParams||{},n=this._ajv.compile(e);if(!n(o)){const e=this._ajvErrorHuman(n.errors);throw this.emit("validationError",{stage:"pathParams",errors:n.errors}),new r("Path parameter validation failed.",400,e,n.errors)}x=this._resolveSpecialValuesInPlace(o),b=b.replace(/\{(\w+)\}/g,((e,t)=>{const o=x[t];if(void 0!==o)return encodeURIComponent(o);throw new i(`Path param manquant ou non résolu : {${t}}`,400)}))}if(u){let e=u;"none"===l&&null===this.userId&&(e=this._cleanSchemaLeftoverAlias(u));const o={...t};delete o.pathParams;const n=Ye.stripNullsInPlace(o),i=this._ajv.compile(e);if(!i(n)){const e=this._ajvErrorHuman(i.errors);throw this.emit("validationError",{stage:"request",errors:i.errors}),new r("Request validation failed.",400,e,i.errors)}t=this._resolveSpecialValuesInPlace(n,x)}"application/json"===y||"multipart/form-data"===y?w=t:"application/x-www-form-urlencoded"===y&&(w=Ye.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${b}, method=${h}`);try{const e=await this._client.request({url:b,method:h,headers:g,["get"===h?"params":"data"]:w});if(n){const t=e.status.toString(),o=f?.[t];if(o){const n=this._ajv.compile(o);if(!n(e.data)){const e=this._ajvErrorHuman(n.errors);throw this.emit("validationError",{stage:"response",errors:n.errors}),new r("Response validation failed.",t,e,n.errors)}}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(s.postActions)&&s.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(t){throw this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${t.message}`),new i(`Erreur lors de l'appel de l'API : ${t.message}`,t.response?t.response.status:500,t.response?t.response.data:null)}}_ajvErrorHuman(e){return new Le(e).errors.map((({message:e})=>e))}checkAndThrowApiResponseError(e){const t=e.data;if(!t||"object"!=typeof t)return e;if("boolean"==typeof t.result&&!1===t.result)throw new s(t.msg||"Erreur inconnue",e.status,t);if(t.resultErrors&&"object"==typeof t.resultErrors&&"boolean"==typeof t.resultErrors.result&&!1===t.resultErrors.result)throw new s(t.resultErrors.msg||"Erreur inconnue",e.status,t);return e}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),delete this._client.defaults.headers.common.Authorization,this._logger.info("[ApiClient] Session utilisateur réinitialisée."),this.emit("sessionReset")}_getValueByPath(e,t){if(t)return t.split(".").reduce(((e,t)=>e&&e[t]),e)}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:i=!1,metaTokens:r=!0}=o,a=[];function s(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function c(e){return e.endsWith("[]")?e.slice(0,-2):e}function m(e,t,o=!1){return e?e.concat(t).map(((e,t)=>(e=c(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function p(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,l=[]){null==o||a.includes(o)||(a.push(o),Object.entries(o).forEach((([o,a])=>{void 0!==a&&function(e,o,a){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=r?o:o.slice(0,-2),t.append(m(a,o,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(s)||o.endsWith("[]"))return o=c(o),e.forEach(((e,r)=>{if(null!=e){const s=i?m(a.concat(o),r,n):`${m(a,o,n)}[]`;t.append(s,p(e))}})),!1}return!!s(e)||(t.append(m(a,o,n),p(e)),!1)}(a,o.trim(),l)&&e(a,l.concat(c(o)))})),a.pop())}(e),t}_transformData(e){if(e&&"object"==typeof e)if(e.resultGoods?.msg)e=this._normalizeJsonData({msg:e.resultGoods.msg,...e});else if(e.resultErrors?.msg)e=this._normalizeJsonData({msg:e.resultErrors.msg,...e});else if(e.results&&"object"==typeof e.results&&!Array.isArray(e.results))e.results=Object.keys(e.results).map((t=>this._normalizeJsonData({id:t,...e.results[t]})));else if(Array.isArray(e.results))e.results=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?Ge.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let n=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(n=this._normalizeDate(n)),this._imageFields.includes(o)&&(n=this._normalizeImage(n)),"content"===o&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[o]=n})),this._normalizeId(t)}return e}}class Qe{constructor(e){this.client=new Ye(e),this.loggedUser=null}async login(e,t){return this.client.safeCall((async()=>{const o=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new Ee(this.client,{id:o.data.user.id},o.data.user),this.loggedUser}))}async register({name:e,username:t,email:o,pwd:n}={}){return this.client.safeCall((async()=>{const i=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:o,pwd:n});if(!1===i?.data?.result)throw new s(i.data.msg,i.status,i.data);return i.data}))}async recoverPassword(e){return this.client.safeCall((async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!1===t?.data?.result)throw new s(t.data.msg,t.status,t.data);return t.data}))}}class Xe{static async userLogin(e,t,o){const n=Xe.userApi(o);return await Xe.userApiLogin(n,e,t)}static userApi(e){try{return new Qe(e)}catch(e){throw console.error("[Api.userApi] Erreur lors de la création d'un objet utilisateur :",e.message),e}}static async userApiLogin(e,t,o){try{const n=await e.login(t,o);return new Xe(n,e.client)}catch(e){if(e instanceof i&&e?.details?.error)throw new c(e.details.error,e.status,e.details);throw e}}constructor(e,t){this._loggedUser=e,this._client=t}me(){if(!this._loggedUser)throw new c("Accès refusé : utilisateur non authentifié.");return this._loggedUser}user(e){try{return new Ee(this._client,e)}catch(e){throw console.error("[Api.user] Erreur lors de la création d'un objet utilisateur public :",e.message),e}}async organization(e,t={getProfile:!0}){try{const o=new Ie(this._client,e);return t.getProfile&&await o.getProfil(),o}catch(e){throw console.error("[Api.organization] Erreur lors de la création d'un objet organisation :",e.message),e}}async project(e,t={getProfile:!0}){try{const o=new Ae(this._client,e);return t.getProfile&&await o.getProfil(),o}catch(e){throw console.error("[Api.project] Erreur lors de la création d'un objet projet :",e.message),e}}get client(){return this._client}}const et={ApiClient:Ye,Api:Xe,error:e}})(),module.exports=n})();
|