@communecter/cocolight-api-client 1.0.128 → 1.0.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cocolight-api-client.browser.js +2 -2
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +1 -1
- package/src/Api.ts +1 -1
- package/src/api/EndpointApi.types.ts +24 -4
- package/src/api/Organization.ts +15 -4
- package/src/api/Project.ts +15 -2
- package/src/endpoints.module.ts +113 -98
- package/types/api/EndpointApi.types.d.ts +24 -4
- package/types/api/Organization.d.ts +5 -0
- package/types/api/Project.d.ts +6 -0
- package/types/endpoints.module.d.ts +4 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"os";import*as t from"fs";import*as r from"path";import*as n from"stream";import{default as o}from"bson-objectid";import{fromBuffer as i}from"file-type";import*as s from"ajv";import*as a from"ajv-formats";import*as c from"ejson";import*as p from"pino";import{EventEmitter as d}from"events";import{AggregateAjvError as m}from"@segment/ajv-human-errors";import{default as l}from"axios";import{default as u}from"axios-retry";import{jwtDecode as h}from"jwt-decode";var y,f,g={116:(t,r,n)=>{var o,i;t.exports=(o={homedir:()=>e.homedir},i={},n.d(i,o),i)},193:(e,t,r)=>{r.d(t,{GN:()=>MemoryStorageStrategy,Ge:()=>LocalStorageStrategy,u3:()=>TokenStorageStrategy});class TokenStorageStrategy{}class MemoryStorageStrategy extends TokenStorageStrategy{_accessToken=null;_refreshToken=null;constructor(){super()}getAccessToken(){return this._accessToken}setAccessToken(e){this._accessToken=e}getRefreshToken(){return this._refreshToken}setRefreshToken(e){this._refreshToken=e}clear(){this._accessToken=null,this._refreshToken=null}}class LocalStorageStrategy extends TokenStorageStrategy{prefix;constructor(e="cocolight"){super(),this.prefix=e}getAccessToken(){return"undefined"!=typeof localStorage?localStorage.getItem(`${this.prefix}_accessToken`):null}setAccessToken(e){"undefined"!=typeof localStorage&&localStorage.setItem(`${this.prefix}_accessToken`,e??"")}getRefreshToken(){return"undefined"!=typeof localStorage?localStorage.getItem(`${this.prefix}_refreshToken`):null}setRefreshToken(e){"undefined"!=typeof localStorage&&localStorage.setItem(`${this.prefix}_refreshToken`,e??"")}clear(){"undefined"!=typeof localStorage&&(localStorage.removeItem(`${this.prefix}_accessToken`),localStorage.removeItem(`${this.prefix}_refreshToken`))}}},285:(e,t,r)=>{r.d(t,{LD:()=>OfflineQueueStorageStrategy,QM:()=>MemoryOfflineStorage,Rc:()=>LocalStorageOfflineStorage});class OfflineQueueStorageStrategy{}class MemoryOfflineStorage extends OfflineQueueStorageStrategy{_queue=[];constructor(){super()}async loadQueue(){return this._queue}async saveQueue(e){this._queue=[...e]}}class LocalStorageOfflineStorage extends OfflineQueueStorageStrategy{key;constructor(e="cocolight-api-offline-queue"){super(),this.key=e}async loadQueue(){try{const e=localStorage.getItem(this.key);return(e?JSON.parse(e):null)??[]}catch{return[]}}async saveQueue(e){try{localStorage.setItem(this.key,JSON.stringify(e))}catch(e){console.warn("[Offline] Échec du stockage localStorage",e)}}}},421:(e,r,n)=>{var o,i;e.exports=(o={existsSync:()=>t.existsSync,mkdirSync:()=>t.mkdirSync,readFileSync:()=>t.readFileSync,writeFileSync:()=>t.writeFileSync},i={},n.d(i,o),i)},521:(e,t,n)=>{var o,i;e.exports=(o={join:()=>r.join},i={},n.d(i,o),i)},602:(e,t,r)=>{r.d(t,{Ek:()=>MultiServerMemoryStorageStrategy,SJ:()=>MultiServerTokenStorageStrategy,YP:()=>MultiServerLocalStorageStrategy});var n=r(193);class MultiServerTokenStorageStrategy extends n.u3{_currentBaseURL=null;constructor(){super()}use(e){if(!e)throw new Error("baseURL est requis");this._currentBaseURL=e.replace(/\/+$/,"")}_ensureContext(){if(!this._currentBaseURL)throw new Error("baseURL non défini. Appelez use(baseURL)")}_requireBaseURL(){return this._ensureContext(),this._currentBaseURL}}class MultiServerMemoryStorageStrategy extends MultiServerTokenStorageStrategy{_storage=new Map;constructor(){super()}getAccessToken(){const e=this._requireBaseURL();return this._storage.get(e)?.accessToken??null}setAccessToken(e){const t=this._requireBaseURL(),r=this._storage.get(t)||{};this._storage.set(t,{...r,accessToken:e})}getRefreshToken(){const e=this._requireBaseURL();return this._storage.get(e)?.refreshToken??null}setRefreshToken(e){const t=this._requireBaseURL(),r=this._storage.get(t)||{};this._storage.set(t,{...r,refreshToken:e})}clear(){const e=this._requireBaseURL();this._storage.delete(e)}getServers(){return Array.from(this._storage.keys())}exportAll(){return Object.fromEntries(this._storage.entries())}}class MultiServerLocalStorageStrategy extends MultiServerTokenStorageStrategy{prefix;constructor(e="cocolight"){super(),this.prefix=e}_key(e){return`${this.prefix}_tokens_${e}`}_getData(){if(this._ensureContext(),"undefined"==typeof localStorage)return{};const e=localStorage.getItem(this._key(this._currentBaseURL));return e?JSON.parse(e):{}}_setData(e){"undefined"!=typeof localStorage&&localStorage.setItem(this._key(this._currentBaseURL),JSON.stringify(e))}getAccessToken(){return this._getData().accessToken??null}setAccessToken(e){const t=this._getData();t.accessToken=e,this._setData(t)}getRefreshToken(){return this._getData().refreshToken??null}setRefreshToken(e){const t=this._getData();t.refreshToken=e,this._setData(t)}clear(){"undefined"!=typeof localStorage&&localStorage.removeItem(this._key(this._currentBaseURL))}getServers(){return"undefined"==typeof localStorage?[]:Object.keys(localStorage).filter(e=>e.startsWith(`${this.prefix}_tokens_`)).map(e=>e.replace(`${this.prefix}_tokens_`,""))}exportAll(){const e={};for(const t of this.getServers()){const r=this._key(t),n="undefined"!=typeof localStorage?localStorage.getItem(r):null;n&&(e[t]=JSON.parse(n))}return e}}},702:(e,t,r)=>{var o,i;e.exports=(o={PassThrough:()=>n.PassThrough,Readable:()=>n.Readable},i={},r.d(i,o),i)}},w={};function _(e){var t=w[e];if(void 0!==t)return t.exports;var r=w[e]={exports:{}};return g[e](r,r.exports,_),r.exports}_.m=g,_.d=(e,t)=>{for(var r in t)_.o(t,r)&&!_.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},_.f={},_.e=e=>Promise.all(Object.keys(_.f).reduce((t,r)=>(_.f[r](e,t),t),[])),_.u=e=>e+".cocolight-api-client.mjs.js",_.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})},y={792:0},f=e=>{var t,r,{__webpack_esm_ids__:n,__webpack_esm_modules__:o,__webpack_esm_runtime__:i}=e,s=0;for(t in o)_.o(o,t)&&(_.m[t]=o[t]);for(i&&i(_);s<n.length;s++)r=n[s],_.o(y,r)&&y[r]&&y[r][0](),y[n[s]]=0},_.f.j=(e,t)=>{var r=_.o(y,e)?y[e]:void 0;if(0!==r)if(r)t.push(r[1]);else{var n=import("./"+_.u(e)).then(f,t=>{throw 0!==y[e]&&(y[e]=void 0),t});n=Promise.race([n,new Promise(t=>r=y[e]=[t])]),t.push(r[1]=n)}};var E={};_.r(E),_.d(E,{fromBuffer:()=>i});var T={};_.r(T),_.d(T,{ApiAuthenticationError:()=>error_ApiAuthenticationError,ApiClientError:()=>error_ApiClientError,ApiError:()=>error_ApiError,ApiResponseError:()=>error_ApiResponseError,ApiValidationError:()=>error_ApiValidationError,CircuitBreakerError:()=>error_CircuitBreakerError});var A={};_.r(A),_.d(A,{batch:()=>z,computed:()=>Z,effect:()=>B,getSignals:()=>J,isReactive:()=>K,isSignal:()=>F,reactive:()=>G,subscribeTo:()=>H,watch:()=>W});class error_ApiError extends Error{name="ApiError";status;details;constructor(e,t,r){super(e),this.status=t,this.details=r}}class error_ApiClientError extends error_ApiError{name="ApiClientError";constructor(e,t,r){super(e,t,r)}}class error_ApiValidationError extends Error{name="ApiValidationError";status;messages;details;constructor(e,t,r,n=null){super(e),this.status=t,this.messages=r,this.details=n}}class error_CircuitBreakerError extends error_ApiError{name="CircuitBreakerError";constructor(e){super(e,503)}}class error_ApiResponseError extends Error{name="ApiResponseError";status;responseData;details;constructor(e,t,r,n=null){super(e),this.status=t,this.responseData=r,this.details=n}}class error_ApiAuthenticationError extends error_ApiError{name="ApiAuthenticationError";constructor(e,t,r){super(e,t,r)}}const b=new Map;function v(e,t){b.set(e,t)}function I(e,t=null){if(!(r=e)||"object"!=typeof r||!("__entityTag"in r))return e;var r;let n=t;const o=e;if(o.parent&&"object"==typeof o.parent){const e=o.parent,r=e.serverData?.id||e.id;if(t&&"id"in t&&t.id===r)n=t;else{const e=I(o.parent,t);e&&"object"==typeof e&&"id"in e&&(n=e)}}let i=e.serverData?.collection;if(i||(i={User:"citoyens",Organization:"organizations",Project:"projects",Event:"events",Poi:"poi",News:"news",Badge:"badges",Comment:"comments",Answer:"answers",Form:"forms",Classified:"classifieds",Action:"actions"}[e.__entityTag]||null),!i)return e;const s=function(e,t){const r=b.get(t),n=t,o={EndpointApi:b.get("EndpointApi"),User:"User"===n?r:b.get("User"),Organization:"Organization"===n?r:b.get("Organization"),Project:"Project"===n?r:b.get("Project"),Event:"Event"===n?r:b.get("Event"),Poi:"Poi"===n?r:b.get("Poi"),Badge:"Badge"===n?r:b.get("Badge"),News:"News"===n?r:b.get("News"),Comment:"Comment"===n?r:b.get("Comment"),Answer:"Answer"===n?r:b.get("Answer"),Form:"Form"===n?r:b.get("Form"),Classified:"Classified"===n?r:b.get("Classified"),Action:"Action"===n?r:b.get("Action")};return{citoyens:{entityClass:o.User,deps:o},organizations:{entityClass:o.Organization,deps:o},projects:{entityClass:o.Project,deps:o},events:{entityClass:o.Event,deps:{...o,Badge:void 0}},poi:{entityClass:o.Poi,deps:{...o,Badge:void 0,News:void 0,Comment:void 0}},news:{entityClass:o.News,deps:{...o}},badges:{entityClass:o.Badge,deps:{EndpointApi:o.EndpointApi,User:o.User,Organization:o.Organization,Project:o.Project}},comments:{entityClass:o.Comment,deps:{...o}},answers:{entityClass:o.Answer,deps:{...o}},forms:{entityClass:o.Form,deps:{...o}},classifieds:{entityClass:o.Classified,deps:{...o,Badge:void 0,News:void 0}},actions:{entityClass:o.Action,deps:{...o}}}[e]||null}(i,e.__entityTag);if(!s)return e;if(!s.entityClass?.fromJSON)throw new Error(`Classe inconnue ou fromJSON manquant pour ${e.__entityTag}`);return s.entityClass.fromJSON(e,n,s.deps)}function S(e,t){const r=b.get(e),n={EndpointApi:b.get("EndpointApi"),User:b.get("User"),Organization:b.get("Organization"),Project:b.get("Project"),Event:b.get("Event"),Poi:b.get("Poi"),Badge:b.get("Badge"),News:b.get("News"),Comment:b.get("Comment"),Answer:b.get("Answer"),Form:b.get("Form"),Classified:b.get("Classified"),Action:b.get("Action")};return n[e]=r,t.remove.forEach(e=>delete n[e]),{entityClass:r,deps:n}}const P=a,C=c,O=p,j=e=>e&&e.default?e.default:e,D=j(s),k=j(P),x=j(O),L=j(C),N=[],M=new WeakMap,$=new WeakMap;let q=0;const R=new Set;function B(e){const t=()=>{try{N.push(t),e()}finally{N.pop()}};return t(),t}function z(e){q++;try{e()}finally{if(q--,0===q){const e=Array.from(R);R.clear();for(const t of e)t()}}}function U(e){let t=e;const r=new Set;return{get value(){const e=N[N.length-1];return e&&r.add(e),t},set value(e){t!==e&&(t=e,q>0?r.forEach(e=>R.add(e)):r.forEach(e=>e()))},subscribe:e=>(r.add(e),()=>r.delete(e)),__isSignal:!0}}function F(e){return e&&!0===e.__isSignal}function V(e,t=[]){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return function(e,t){return new Proxy(e,{get(e,r,n){if("string"==typeof r&&!isNaN(+r)){const n=e[+r];return K(n)?n:V(n,[...t,r])}return Reflect.get(e,r,n)},set(e,r,n){if("string"==typeof r&&!isNaN(+r)){const o=V(n,[...t,r]);e[+r]=o}return!0}})}(e,t);if(e.__isReactive)return e;if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return e;if("undefined"!=typeof File&&e instanceof File)return e;if("undefined"!=typeof Blob&&e instanceof Blob)return e;if(e&&"function"==typeof e.pipe&&"function"==typeof e.on)return e;if(e instanceof Date)return e;if(e.__entityTag)return e;const r=new Map,n=new Proxy(e,{get(e,n){if("__raw"===n)return e;if("__isReactive"===n)return!0;if(!r.has(n)){const o=U(V(e[n],[...t,String(n)]));r.set(n,o)}return r.get(n).value},set(e,n,o){const i=V(o,[...t,String(n)]);if(!r.has(n)){const e=U(i);r.set(n,e)}return r.get(n).value=i,e[n]=function(e){return F(e)?e.value:e}(i),!0},deleteProperty:(e,t)=>(r.delete(t),Reflect.deleteProperty(e,t))});return $.set(n,r),n}function G(e){return"object"!=typeof e||null===e||e.__isReactive?e:V(e)}function K(e){return null!==e&&"object"==typeof e&&!0===e.__isReactive}function Z(e){if(M.has(e))return M.get(e);const t=U();return B(()=>t.value=e()),M.set(e,t),t}function W(e,t){let r;B(()=>{const n=e();n!==r&&(t(n,r),r=n)})}function J(e){return K(e)?$.get(e):null}function H(e,t,r){const n=J(e);if(!n||!n.has(t))return()=>{};const o=n.get(t);return o?.subscribe?.(()=>r(o.value))??(()=>{})}const{fromBuffer:Q}=E,Y=o;class BaseEntity{__entityTag;deps;apiClient;parent;userContext;endpointApi;data;meta;_draftData={};_initialDraftData={};_serverData=G({});_calledFromSave=!1;_syncReactiveDraft=!1;_isDeleted=!1;_add;_update;_allowedFieldsCache;_allowedFieldsMetadata;static entityTag="BaseEntity";static entityType;static SCHEMA_CONSTANTS;static VIRTUAL_SCHEMAS;static CUSTOM_FIELD_HANDLERS;_checkNotDeleted(){if(this._isDeleted)throw new error_ApiError(`Cet objet ${this.__entityTag} a été supprimé et ne peut plus être utilisé.`,400)}constructor(e,t={},r={},n={}){if(this.__entityTag=n.entityTag||this.getEntityTag(this._getCtor().entityTag)||"BaseEntity",this.deps=r,"ApiClient"===this.getEntityTag(e?.__entityTag))this.apiClient=e,this.parent=null,this.userContext=null;else{if(!e||!("apiClient"in e))throw new error_ApiError("Parent invalide ou ApiClient manquant.",400);{const t=e;this.apiClient=t.apiClient,this.parent=t,this.userContext="User"===this.getEntityTag(t?.__entityTag)?t:t.userContext||null}}if("function"==typeof r.EndpointApi)this.endpointApi=new r.EndpointApi(this.apiClient);else{if("object"!=typeof r.EndpointApi)throw new error_ApiError("deps.EndpointApi doit être une classe ou une instance valide.",500);this.endpointApi=r.EndpointApi}this._serverData=G({});const{draft:o,proxy:i,initial:s}=this._buildDraftAndProxy({data:{...t,...this.defaultFields},serverData:this._serverData,constant:this._getCtor().SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});this._initialDraftData=s,this._draftData=o,this.data=i}_getCtor(){return this.constructor}getEntityTag=e=>e?.replace(/^_/,"");get id(){return this._draftData.id||null}get slug(){return this._draftData.slug||null}_id(e){this._draftData.id=e}get isConnected(){return this.apiClient.isConnected}get userId(){return this.apiClient.userId}get draftData(){return this._draftData}get initialDraftData(){return this._initialDraftData}get serverData(){return this._serverData}get isMe(){return!!(this.isConnected&&this.userId&&this.userContext?.id&&"string"==typeof this.userId&&"string"==typeof this.userContext?.id&&this.userId===this.userContext?.id)}getEntityType(){return this._getCtor().entityType}hasChanges(){const e=this._toRawDeep(this._draftData),t=this._serialize(e),r=this._serialize(this._initialDraftData);return JSON.stringify(t)!==JSON.stringify(r)}async refresh(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);return this.get()}async save(){if(this._checkNotDeleted(),!this.isConnected)throw new error_ApiError("Non connecté.",401);this._calledFromSave=!0;try{const e={...this._draftData};if(!this.id&&"function"==typeof this._add)return await this._add(e),this._resetInitialDraftData(),this.userContext&&await(this.userContext?.refresh()),await this.refresh();if("function"==typeof this._update){const t=await this._update(e);if(this._resetInitialDraftData(),t)return await this.refresh()}return this._serverData}finally{this._calledFromSave=!1}}static fromServerData(e,t,r){const n=new this(t,{},r);return n._setData(e),n}_transformServerData(e){return e}_setData(e,{forceInitialDraftReset:t=!1}={}){this.userContext&&this.userContext!==this&&this.apiClient._logger?.debug?.(`[${this.__entityTag}] Mise à jour liée à userContext : ${this.userContext.id}`);const r=this._transformServerData(e)??{};if(this._serverData&&K(this._serverData)){for(const e of Object.keys(this._serverData))e in r||delete this._serverData[e];for(const e of Object.keys(r))this._serverData[e]=r[e]}else this._serverData=G({...r});const n=this._draftData?this._toRawDeep(this._draftData):{},o={...e||{},...this.defaultFields,...n},{draft:i,proxy:s,initial:a}=this._buildDraftAndProxy({data:o,serverData:this._serverData,previousDraft:this._draftData,constant:this._getCtor().SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});t?this._initialDraftData=structuredClone(this._toRawDeep(i)):this._initialDraftData||(this._initialDraftData=a),K(this._draftData)?this._updateDraftPreservingUserChanges(i):this._draftData=G(i),this.data||(this.data=s)}_updateDraftPreservingUserChanges(e){for(const t of Object.keys(this._draftData||{}))t in e||delete this._draftData[t];for(const t of Object.keys(e)){const r=this._draftData?.[t],n=this._initialDraftData?.[t];void 0!==r&&void 0!==n&&this._serialize(this._toRawDeep(r))!==this._serialize(n)||(this._draftData[t]=e[t])}}_resetInitialDraftData(){const e=this._toRawDeep(this._draftData);this._initialDraftData=structuredClone(e)}_toRawDeep(e){if(!this||"function"!=typeof this._toRawDeep)throw new Error("`this._toRawDeep` is not bound correctly. Use a lambda to preserve context.");if(F(e))return this._toRawDeep(e.value);if(e&&"object"==typeof e&&e.__isReactive&&e.__raw)return this._toRawDeep(e.__raw);if(e instanceof Date)return e;if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return e;if("undefined"!=typeof File&&e instanceof File)return e;if("undefined"!=typeof Blob&&e instanceof Blob)return e;if(e&&"function"==typeof e.pipe&&"function"==typeof e.on)return e;if(Array.isArray(e))return e.map(e=>this._toRawDeep(e));if("object"==typeof e&&null!==e){const t={};for(const r of Object.keys(e))t[r]=this._toRawDeep(e[r]);return t}return e}defaultFields={};removeFields=[];transforms={};toJSON(){const e={};return this.parent?.id&&(e.id=this.parent.id),"function"==typeof this.parent?.getEntityType&&(e.type=this.parent.getEntityType()),this.parent?.__entityTag&&(e.__entityTag=this.parent.__entityTag),this.parent?.slug&&(e.slug=this.parent.slug),this.parent?.serverData&&(e.serverData={id:this.parent.serverData.id,collection:this.parent.serverData.collection,slug:this.parent.serverData.slug,...this.parent.serverData.name&&{name:this.parent.serverData.name},...this.parent.serverData.parent&&{parent:this.parent.serverData.parent},...this.parent.serverData.organizer&&{organizer:this.parent.serverData.organizer},...this.parent.serverData.links&&{links:this.parent.serverData.links}}),{__entityTag:this.__entityTag,__isSerializedEntity:!0,serverData:this._serialize(this._serverData),parent:Object.keys(e).length>0?e:null}}_serialize(e){try{return JSON.parse(L.stringify(this._removeUnserializables(e)))}catch(e){const t=e;return this.apiClient?._logger?.error?.("Erreur de sérialisation EJSON:",{message:t?.message,stack:t?.stack,error:e}),null}}_removeUnserializables(e,t=new WeakSet){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return e;if(e instanceof RegExp)return e;if(e&&"object"==typeof e&&"_bsontype"in e&&"ObjectID"===e._bsontype)return e;if(e instanceof Uint8Array||ArrayBuffer.isView(e))return e;if(e instanceof BaseEntity)return e.toJSON();if(t.has(e))return null;if(t.add(e),e.__isReactive&&"object"==typeof e.__raw)return this._removeUnserializables(e.__raw,t);if(Array.isArray(e))return e.map(e=>this._removeUnserializables(e,t));const r={};for(const n of Object.keys(e)){const o=e[n];if("function"!=typeof o&&"symbol"!=typeof o&&void 0!==o)try{r[n]=this._removeUnserializables(o,t)}catch{r[n]=null}}return r}static _revive(e,t){const r=L.fromJSONValue(e);return this._deserializeNestedEntities(r,t)}static _deserializeNestedEntities(e,t){if(null===e||"object"!=typeof e)return e;if(e instanceof Date||e instanceof RegExp)return e;if(Array.isArray(e))return e.map(e=>this._deserializeNestedEntities(e,t));if(e.__isSerializedEntity&&e.__entityTag&&e.serverData)return I(e,t);const r={};for(const[n,o]of Object.entries(e))r[n]=this._deserializeNestedEntities(o,t);return r}static fromJSON(e,t,r){if(!e||"object"!=typeof e||!("serverData"in e))throw new Error("Invalid JSON format: missing serverData");const{serverData:n}=e;return this.fromServerData(this._revive(n,t),t,r||{})}async call(e,t={}){return this.apiClient.safeCall(async()=>{const r=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(r),r.data})}async callNoConnected(e,t={}){if(this.isConnected)throw new error_ApiAuthenticationError("Vous devez ne devez pas être connecté pour faire cette action.",403);return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new error_ApiAuthenticationError("Vous devez être connecté pour faire cette action.",401);return"function"==typeof e?await e():this.call(e,t)}async callIsMe(e,t={}){if(!this.isMe)throw new error_ApiAuthenticationError("Vous devez être vous-même pour faire cette action.",403);return"function"==typeof e?await e():await this.callIsConnected(e,t)}async _validateImage(e){return await this._validateUploadInput(e,{allowedMimeTypes:["image/jpeg","image/png","image/jpg"],expectedType:"image"})}async _validateFile(e){return await this._validateUploadInput(e,{allowedMimeTypes:["application/pdf","text/plain","text/csv"],expectedType:"file"})}async _validateUploadInput(e,{allowedMimeTypes:t=[],expectedType:r="any"}){if(!e)throw new error_ApiValidationError("Le fichier est requis.",400,["Le fichier est requis"]);const n="undefined"==typeof window&&"undefined"!=typeof process;let o=null,i="";if("undefined"!=typeof File&&e instanceof File){if(i=e.type,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);o=e}else if("undefined"!=typeof Blob&&e instanceof Blob){if(i=e.type,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);const r=i.split("/")[1]||"bin",n=`${Date.now()}.${r}`;o=new File([e],n,{type:i})}else if(n&&Buffer.isBuffer(e)){const n=await Q(e);if(!n)throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);if(i=n.mime,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);if("image"===r){const t=n.ext,r=`${Date.now()}.${t}`;o=await this._createReadStreamFromBuffer(e,r,i)}else o=e}else{if(!n||!(s=e)||"object"!=typeof s||"function"!=typeof s.pipe||"function"!=typeof s.on)throw new error_ApiValidationError("Type de fichier non reconnu.",400,["Type de fichier non reconnu."]);{const r=e,n=[],s=await this._passThrough(),a=await this._passThrough(),c=4100;let p=0;r.on("data",e=>{p<c&&(n.push(e),p+=e.length)}),r.pipe(s).pipe(a),await new Promise(e=>setTimeout(e,10));const d=Buffer.concat(n),m=await Q(d);if(!m)throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);if(i=m.mime,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);a.path=`${Date.now()}.${m.ext}`,a.mimeType=i,o=a}}var s;return o}async _createReadStreamFromBuffer(e,t="file.bin",r="application/octet-stream"){const n=await this._bufferToReadable(e);return n.path=t,n.mimeType=r,n}async _bufferToReadable(e){if("undefined"==typeof window){const{bufferToReadable:t}=await _.e(401).then(_.bind(_,401));return t(e)}throw new Error("bufferToReadable ne doit pas être appelé dans le navigateur")}async _passThrough(){if("undefined"==typeof window){const{createPassThrough:e}=await _.e(401).then(_.bind(_,401));return e()}throw new Error("passThrough ne doit pas être appelé dans le navigateur")}_omitProps(e,t){if(!e||"object"!=typeof e)return{};const r={...e};for(const e of t)delete r[e];return r}_pickProps(e,t,r={}){if(!e||"object"!=typeof e)return{};const n={};for(const o of t)if(o in e){const t=e[o];"function"==typeof r[o]?n[o]=r[o](t,e):n[o]=t}return n}_hasAtLeastOne(e,t=[]){return t.some(t=>t in e&&null!=e[t])}_createFilteredProxy(e){return new Proxy(e,{get(e,t,r){const n=e.filter(e=>!e._isDeleted);if("length"===t)return n.length;if("string"==typeof t&&/^\d+$/.test(t))return n[Number(t)];const o=Reflect.get(n,t,r);return"function"==typeof o?o.bind(n):o}})}_newId(){return Y().toHexString()}_getAllowedFieldsForCurrentState(){if(!this._allowedFieldsMetadata)return this._allowedFieldsCache||[];const{combinedSchema:e,removeFields:t}=this._allowedFieldsMetadata,r=this._toRawDeep(this._draftData),n={...this.defaultFields,...r};let o=this._extractWritableFields(e,n);return n.id&&!o.includes("id")&&o.push("id"),n.slug&&!o.includes("slug")&&o.push("slug"),o=o.filter(e=>!t.includes(e)),o}_createDraftProxy(e,t={},r={},n=[],o={},i={},s=this){return new Proxy({},{get:(e,n)=>{if("string"==typeof n||"symbol"==typeof n){if("string"==typeof n&&n in r){const e=r[n],t=o[n];return"function"==typeof t?t(e,r):e}if(t&&"object"==typeof t&&"string"==typeof n&&n in t){const e=t[n],r=o[n];return"function"==typeof r?r(e,t):e}}},set:(t,n,o)=>{if("string"!=typeof n)return!1;const a=s._getAllowedFieldsForCurrentState();if(!a.includes(n)){const t=`[DraftProxy] Le champ "${n}" n'est pas autorisé.`;if(i.throwOnError)throw new error_ApiValidationError(t,400,[t],{field:n,value:o,allowedFields:a});return e._logger?.warn?.(t),!1}const c=r[n];return c&&"object"==typeof c&&!0===c.__isSignal?c.value=o:r[n]=o,!0},deleteProperty:(e,t)=>"string"==typeof t&&(!!s._getAllowedFieldsForCurrentState().includes(t)&&(delete r[t],!0)),has:(e,n)=>"string"==typeof n&&(n in r||t&&"object"==typeof t&&n in t),ownKeys:()=>{const e=new Set([...Object.keys(t||{}),...Object.keys(r||{})]);return Array.from(e)},getOwnPropertyDescriptor:(e,n)=>{if("string"==typeof n)return n in r||t&&"object"==typeof t&&n in t?{enumerable:!0,configurable:!0}:void 0}})}_extractWritableFields(e={},t={},r={defs:{},visited:new Set}){if(!e||"object"!=typeof e)return[];if(e.$id&&r.visited.has(e.$id))return[];e.$id&&r.visited.add(e.$id),r.defs=e.$defs||e.definitions||r.defs;const n=[];if(e.$ref){const o=e.$ref.replace(/^#\/?(\$defs|definitions)\//,""),i=r.defs[o];i&&n.push(...this._extractWritableFields(i,t,r))}if(e.allOf&&e.allOf.forEach(e=>n.push(...this._extractWritableFields(e,t,r))),e.if&&e.then){const o=e.if.properties;let i=!0;if(o)for(const e in o){const r=o[e]?.const;if(t[e]!==r){i=!1;break}}i&&e.then?n.push(...this._extractWritableFields(e.then,t,r)):!i&&e.else&&n.push(...this._extractWritableFields(e.else,t,r))}return e.properties&&n.push(...Object.entries(e.properties).filter(([e,t])=>!0!==t.readOnly&&void 0===t.const).map(([e])=>e)),Array.from(new Set(n))}_buildDraftAndProxy({data:e={},serverData:t=null,previousDraft:r=null,constant:n,apiClient:o,transforms:i={},throwOnError:s=!0,removeFields:a=[]}){const c=Array.isArray(n)?n:[n],p={allOf:[],$defs:{}};for(const e of c){let t=o.getRequestSchema(e);const r=this._getCtor(),n=r.VIRTUAL_SCHEMAS?.[e];if(n&&(t=this._mergeSchemas(t,n)),!t)throw new error_ApiError(`Unable to find schema for ${e}.`,404);if(t.$defs)for(const[r,n]of Object.entries(t.$defs))p.$defs[r]?o._logger.warn(`Duplicate $defs key '${r}' from schema '${e}'`):p.$defs[r]=n;p.allOf.push(t)}let d=this._extractWritableFields(p,e);e.id&&-1===d.indexOf("id")&&d.push("id"),e.slug&&-1===d.indexOf("slug")&&d.push("slug"),d=d.filter(e=>!a.includes(e)),this._allowedFieldsCache=d,this._allowedFieldsMetadata={combinedSchema:p,transforms:i,removeFields:a};const m=Object.fromEntries(d.map(t=>{const r=e[t];return[t,"function"==typeof i[t]?i[t](r,e):r]}).filter(([e,t])=>void 0!==t)),l=structuredClone?structuredClone(m):JSON.parse(JSON.stringify(m)),u=r&&K(r)?Object.assign(r,m):G(m),h=K(t)?t:t&&"object"==typeof t?G(t):t;return{draft:u,proxy:this._createDraftProxy(o,h,u,d,i,{throwOnError:s}),initial:l}}async _invokeBlockMethod(e,t,r){const n=this[t];return await n.call(this,r)}_isUploadType(e){return!("undefined"==typeof Buffer||!Buffer.isBuffer(e))||"undefined"!=typeof File&&e instanceof File||"undefined"!=typeof Blob&&e instanceof Blob||!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on)}_compareValues(e,t){return this._isUploadType(e)||this._isUploadType(t)?e!==t:JSON.stringify(this._toRawDeep(e))!==JSON.stringify(this._toRawDeep(t))}_mergeSchemas(e,t){return e?t?{allOf:[e,t],$defs:{...e.$defs,...t.$defs}}:e:t}_hasFieldChanged(e){const t=this._draftData[e],r=this._initialDraftData[e];return this._compareValues(t,r)}async _invokeCustomFieldHandler(e,t,r){const n=this[e];if("function"!=typeof n)throw new error_ApiError(`Custom handler "${e}" not found for field "${r}"`,500);return await n.call(this,t)}_extractChangedFieldsFromSchema(e,t,r={},n,o=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,r);const a={},c=n?.()||{};s=s.filter(e=>!o.includes(e));for(const e of s){if(void 0===r[e])continue;const t=r[e],n=c[e];this._compareValues(t,n)&&(a[e]=t)}return Object.keys(a).length>0?a:null}_extractAllValidFieldsFromSchema(e,t,r={},n,o=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,r);const a={},c={},p=n?.()||{};s=s.filter(e=>!o.includes(e));for(const e of s){if(void 0===r[e])continue;const t=r[e],n=p[e];JSON.stringify(t)!==JSON.stringify(n)&&(a[e]=t),c[e]=t}return Object.keys(a).length>0?c:null}async _resolveId(e){if(!this.id&&this.slug)try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:this.slug}});if(!t.contextId||t.contextType!==e)throw new error_ApiResponseError(`Le slug ${this.slug} ne correspond pas à un ${e}`,200,t);this._id(t.contextId)}catch(t){if(t instanceof error_ApiResponseError)throw t.responseData.contextType!==e?t:new error_ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.responseData);throw t}if(!this.id)throw new error_ApiError(`Impossible de résoudre l'identifiant pour le type ${e}.`,404);return this.id}async _getPublicProfile(){if(await this._resolveId(this.getEntityType()),!this.id)throw new error_ApiError("L'identifiant de l'entité n'est pas défini.",400);const e=this.getEntityType();if("news"===e||"comments"===e)throw new error_ApiError(`getElementsAbout ne supporte pas le type '${e}'.`,400);return this.endpointApi.getElementsAbout({pathParams:{id:this.id,type:e},tpl:"ficheInfoElement"})}_getEntityMeta(e){const t=this.constructor,r=this.__entityTag,n={EndpointApi:this.deps.EndpointApi,User:"User"===r?t:this.deps.User,Organization:"Organization"===r?t:this.deps.Organization,Project:"Project"===r?t:this.deps.Project,Event:"Event"===r?t:this.deps.Event,Poi:"Poi"===r?t:this.deps.Poi,Badge:"Badge"===r?t:this.deps.Badge,News:"News"===r?t:this.deps.News,Comment:"Comment"===r?t:this.deps.Comment,Answer:"Answer"===r?t:this.deps.Answer,Form:"Form"===r?t:this.deps.Form,Classified:"Classified"===r?t:this.deps.Classified,Action:"Action"===r?t:this.deps.Action};return{classifieds:{entityClass:n.Classified,deps:{...n}},citoyens:{entityClass:n.User,deps:n},organizations:{entityClass:n.Organization,deps:n},projects:{entityClass:n.Project,deps:n},events:{entityClass:n.Event,deps:{...n,Badge:void 0}},poi:{entityClass:n.Poi,deps:{...n,Badge:void 0,News:void 0}},news:{entityClass:n.News,deps:{...n}},badges:{entityClass:n.Badge,deps:{EndpointApi:n.EndpointApi,User:n.User,Organization:n.Organization,Project:n.Project}},comments:{entityClass:n.Comment,deps:{...n}},answers:{entityClass:n.Answer,deps:{...n}},forms:{entityClass:n.Form,deps:{...n}},actions:{entityClass:n.Action,deps:{...n}}}[e]||null}_linkEntity(e,t){const r=this._getEntityMeta(e);return r?r.entityClass.fromServerData(t,this,r.deps):t}_linkNestedEntity(e){if(!e||"object"!=typeof e)return e;if(!e.id||!e.type)return e;try{return this._linkEntity(e.type,e)}catch(t){return this.apiClient._logger?.warn?.(`Impossible de lier l'entité imbriquée de type ${e.type}:`,t),e}}async _linkEntityById(e,t,r){const n=this._getEntityMeta(e);if(!n)return null;const o=new n.entityClass(this,{id:t},n.deps);return r?.skipGet||await o.get(),o}_linkEntities(e){return e.flatMap(e=>e?.collection?[this._linkEntity?.(e.collection,e)??e]:(this.apiClient._logger?.warn?.(`Objet ignoré car sans 'collection' : ${e?.id}`),[]))}async linkEntitiesFromServerData(e,t={},r={}){const n=r.key||e,o="function"==typeof r.mapFn?r.mapFn:null,i=e=>!0===e||"true"===e,s=e=>!1===e||"false"===e,a=this.serverData?.[n],c=[];if(a&&"object"==typeof a&&Object.keys(a).length>0)for(const r of Object.keys(a)){const n=a[r],p=Object.entries(t).every(([e,t])=>{const r=n[e];if("function"==typeof t)try{return t(r)}catch(t){return console.warn(`Erreur dans le filtre personnalisé pour ${e}`,t),!1}return t instanceof RegExp?"string"==typeof r&&t.test(r):"string"==typeof t&&"string"==typeof r?r.toLowerCase().includes(t.toLowerCase()):i(t)?i(r):s(t)?s(r):"string"!=typeof r||"string"!=typeof t||isNaN(Date.parse(r))||isNaN(Date.parse(t))?r===t:new Date(r).getTime()===new Date(t).getTime()});if(p)try{const t=await this._linkEntityById(e,r);t&&(t.meta=n,c.push(o?o(t):t))}catch(t){this.apiClient._logger?.error?.(`Erreur lors de la récupération de l'entité ${e} (${r}) :`,t)}}return c}_entityInstanceData(e,t){const r=this._getEntityMeta(e);if(!r)throw new error_ApiError(`Type d'entité inconnu: ${e}`,400);const n=this.__entityTag,o=this.constructor;return new r.entityClass(this,t,{[n]:o,...r.deps})}async entity(e,t={}){try{const r=this._entityInstanceData(e,t),n={citoyens:["id","slug"],organizations:["id","slug"],projects:["id","slug"],events:["id","slug"],poi:["id","slug"],news:["id"],badges:["id"],comments:[],answers:["id"],classifieds:["id"],actions:["id"]}[e];return n&&this._hasAtLeastOne(t,n)&&await r.get(),r}catch(t){throw this.apiClient._logger.error(`[Api.${this.__entityTag}.${e}] Erreur lors de la création d'une instance ${e} :`,t.message),t}}async entityBySlug(e){if(!e)throw new error_ApiError("Le slug est requis.",400);try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t.contextId&&t.contextType){const e=await this.entity(t.contextType,{id:t.contextId});return await this._fixEntityUserContext(e),e}throw new error_ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof error_ApiResponseError?new error_ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${e}`,t.status,t.responseData):t}}async _fixEntityUserContext(e){const t=e.getEntityType();if(!["events","projects","poi"].includes(t))return;const r=this._extractRealParent(e);if(!r)return;const n=await this._findOrCreateParent(r);n&&n!==e.parent&&(e.userContext=this._extractUserContext(n),e.parent=n)}_extractRealParent(e){const t=e.serverData;if("events"===e.getEntityType()){const e=t;if(e.organizer){const t=Object.entries(e.organizer),r=t.find(([e,t])=>"projects"===t.type);if(r)return{type:"projects",id:r[0]};const n=t.find(([e,t])=>"organizations"===t.type);if(n)return{type:"organizations",id:n[0]};const o=t.find(([e,t])=>"citoyens"===t.type);if(o)return{type:"citoyens",id:o[0]};const i=t[0];if(i&&i[1])return{type:i[1].type,id:i[0]}}}const r=t;if(r.parent){const e=Object.entries(r.parent)[0];if(e&&e[1])return{type:e[1].type,id:e[0]}}return null}async _findOrCreateParent(e){try{let t=this.parent;for(;t;){if(t.id===e.id&&t.getEntityType()===e.type)return t;t=t.parent}const r={citoyens:"citoyens",organizations:"organizations",projects:"projects"}[e.type];if(r){const t=this._entityInstanceData(r,{id:e.id});return await t.get(),t}return null}catch(e){return this.apiClient._logger?.warn?.("Impossible de créer le parent réel:",e),null}}_extractUserContext(e){return"User"===this.getEntityTag(e?.__entityTag)?e:e.userContext||null}_isAdminViaHierarchy(){const e=this.getEntityType(),t=this.serverData;let r;if("events"===e)r=t?.organizer;else{if("projects"!==e&&"poi"!==e&&"classifieds"!==e)return!1;r=t?.parent}if(!r||"object"!=typeof r)return!1;for(const[e,t]of Object.entries(r)){if(!t||"object"!=typeof t)continue;const r=t.type;if(r&&this._isAdminOfParent(e,r))return!0}return!1}_isAdminOfParent(e,t){const r=this.userContext?.serverData?.links;if(!r)return!1;let n;if("citoyens"===t)return!1;if("organizations"===t)n="memberOf";else{if("projects"!==t)return!1;n="projects"}const o=r[n];if(!o)return!1;const i=o[e];return this._validateUserLink(i)&&!0===i?.isAdmin&&!i?.isAdminPending}_buildLinkFilters(e,{linkType:t,isAdmin:r,isAdminPending:n,isInviting:o,toBeValidated:i=!1,roles:s=[]}){if("string"!=typeof e||null===e)throw new TypeError("id doit être une chaîne non-nulle.");if("string"!=typeof t)throw new TypeError("linkType doit être une chaîne.");if(void 0!==r&&"boolean"!=typeof r)throw new TypeError("isAdmin doit être un booléen.");if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("isAdminPending doit être un booléen.");if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("isInviting doit être un booléen.");if(void 0!==i&&"boolean"!=typeof i)throw new TypeError("toBeValidated doit être un booléen.");if(!Array.isArray(s))throw new TypeError("roles doit être un tableau de chaînes.");const a=`links.${t}.${e}`,c={[`${a}`]:{$exists:!0}};return"boolean"==typeof i&&(c[`${a}.toBeValidated`]={$exists:i}),"boolean"==typeof o&&(c[`${a}.isInviting`]={$exists:o}),!0===r&&(c[`${a}.isAdmin`]={$exists:!0}),!0===n&&(c[`${a}.isAdminPending`]={$exists:!0}),s.length>0&&(c[`${a}.roles`]={$in:s}),c}_getLinkMeta(){const e=this.getEntityType(),t={organizations:{linkType:"memberOf",connectTypeConnect:"member",connectTypeDisconnect:"members"},projects:{linkType:"projects",connectTypeConnect:"contributor",connectTypeDisconnect:"contributors"},events:{linkType:"events",connectTypeConnect:"attendee",connectTypeDisconnect:"attendees"},citoyens:{linkType:"friends",connectTypeConnect:"friend",connectTypeDisconnect:"friends"}}[e];if(!t)throw new error_ApiError(`Aucune correspondance de lien définie pour le type d'entité "${e}"`,404);return t}_checkLinkableEntity(){try{this._getLinkMeta()}catch(e){if(e instanceof error_ApiError)throw new error_ApiError(`L'entité "${this.getEntityType()}" ne prend pas en charge les actions de lien.`,400);throw e}}_getLinkFromConnectedUser(){const{linkType:e}=this._getLinkMeta();if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);return this?.userContext?.serverData?.links?.[e]?.[this.id]||null}async _submitLinkRequest(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){this._assertNotEntityType("connect",["poi","badges","news","actions"]);const t=this.getEntityType(),r={childId:this.userId,childType:"citoyens",parentType:t,parentId:this.id,connectType:e},n=await this.callIsMe(()=>this.endpointApi.connect(r));return await(this.userContext?.refresh()),n}if(t.isInviting)return this._acceptLinkRequest();if(t.toBeValidated)throw new error_ApiError("Vous êtes déjà en attente de validation.",400);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",400)}async _submitLinkRequestAdmin(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const e=this._getLinkFromConnectedUser();if(!e){this._assertNotEntityType("connect",["poi","badges","news","actions"]);const e=this.getEntityType(),t={childId:this.userId,childType:"citoyens",parentType:e,parentId:this.id,connectType:"admin"},r=await this.callIsMe(()=>this.endpointApi.connect(t));return await(this.userContext?.refresh()),r}if(e.isInviting||e.isAdminInviting)return this._acceptLinkRequest();if(e.toBeValidated&&e.isAdminPending)throw new error_ApiError("Vous êtes déjà en attente de validation pour devenir admin.",400);if(e.toBeValidated)throw new error_ApiError("Vous êtes déjà en attente de validation pour rejoindre cette entité.",400);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",400)}async _acceptLinkRequest(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const e=this._getLinkFromConnectedUser();if(e&&(e.isInviting||e.isAdminInviting)){this._assertNotEntityType("linkValidate",["poi","badges","news","actions"]);const e=this.getEntityType(),t={childId:this.userId,childType:"citoyens",parentType:e,parentId:this.id,linkOption:"isInviting"},r=await this.callIsMe(()=>this.endpointApi.linkValidate(t));return await(this.userContext?.refresh()),r}throw new error_ApiError("Vous n'avez pas d'invitation à valider.",400)}async _leaveLinkRequest(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new error_ApiError("Vous n'êtes pas connecté à cette entité.",404);this._assertNotEntityType("disconnect",["poi","badges","news","actions"]);const t=this.getEntityType(),r={childId:this.userId,childType:"citoyens",parentType:t,parentId:this.id,connectType:e},n=await this.callIsMe(()=>this.endpointApi.disconnect(r));return await(this.userContext?.refresh()),n}async get(){return this.apiClient.safeCall(async()=>{const e=await this._getPublicProfile();return this._setData(e,{forceInitialDraftReset:!0}),e})}async updateSettings(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateSettings",["poi","badges","news","actions"]);const t=this.getEntityType(),{type:r,value:n}=e;if("string"!=typeof r)throw new error_ApiValidationError("Le champ 'type' est requis (string).",400,["type requis"]);const o={type:r,value:n,idEntity:this.id,typeEntity:t};return this.callIsConnected(()=>this.endpointApi.updateSettings(o))}async updateDescription(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateDescription",["badges","news","actions"]);const t=this.getEntityType(),r={block:"descriptions",id:this.id,typeElement:t,...e};return this.callIsConnected(()=>this.endpointApi.updateBlockDescription(r))}async updateInfo(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateInfo",["badges","news","actions"]);const t=this.getEntityType(),r={block:"info",id:this.id,typeElement:t,...e};return this.callIsConnected(()=>this.endpointApi.updateBlockInfo(r))}async updateSocial(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateSocial",["badges","news","poi","events","actions"]);const t=this.getEntityType(),r={block:"network",id:this.id,typeElement:t,...e};return this.callIsConnected(()=>this.endpointApi.updateBlockSocial(r))}_isPostalAddress(e){return!!e&&"object"==typeof e&&"PostalAddress"===e["@type"]&&"string"==typeof e.addressCountry&&"string"==typeof e.addressLocality&&"string"==typeof e.level1&&"string"==typeof e.level1Name&&"string"==typeof e.codeInsee&&"string"==typeof e.localityId}_isGeo(e){return!(!e||"object"!=typeof e||"number"!=typeof e.latitude&&"string"!=typeof e.latitude||"number"!=typeof e.longitude&&"string"!=typeof e.longitude)}_isGeoPosition(e){return!!e&&"object"==typeof e&&"Point"===e.type&&Array.isArray(e.coordinates)&&2===e.coordinates.length&&("number"==typeof e.coordinates[0]||"string"==typeof e.coordinates[0])&&("number"==typeof e.coordinates[1]||"string"==typeof e.coordinates[1])&&!0===e.float}async updateLocality(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(this._assertNotEntityType("updateLocality",["badges","news","comments","answers","actions"]),!("address"in e))throw new error_ApiValidationError("Le champ 'address' est requis.",400,["address requis"]);const t=e.address;if(""!==t&&!this._isPostalAddress(t))throw new error_ApiValidationError("Format de 'address' invalide.",400,["address invalide"]);const r=t,n=this.getEntityType(),o={block:"localities",id:this.id,typeElement:n,address:r,..."geo"in e&&this._isGeo(e.geo)?{geo:e.geo}:{},..."geoPosition"in e&&this._isGeoPosition(e.geoPosition)?{geoPosition:e.geoPosition}:{},..."locality"in e?{locality:e.locality}:{}};return this.callIsConnected(()=>this.endpointApi.updateBlockLocality(o))}async updateSlug({slug:e}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateSlug",["badges","news","poi","comments","actions"]);const t=this.getEntityType();try{await this.endpointApi.check({block:"info",type:t,id:this.id,slug:e})}catch(e){if(e instanceof error_ApiResponseError)throw new error_ApiResponseError("Erreur lors de la vérification du slug.",e.status,e.responseData);throw e}const r={block:"info",typeElement:t,id:this.id,slug:e};return this.callIsConnected(()=>this.endpointApi.updateBlockSlug(r))}async updateImageProfil({profil_avatar:e}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateImageProfil",["badges","news","comments","answers","actions"]);const t=this.getEntityType();e=await this._validateImage(e);const r={pathParams:{folder:t,ownerId:this.id},profil_avatar:e};return this.callIsConnected(()=>this.endpointApi.profilImage(r))}async updateImageBanner({banner:e,cropW:t,cropH:r,cropX:n,cropY:o}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateImageBanner",["badges","news","comments","answers","actions"]);const i=this.getEntityType();e=await this._validateImage(e);const s={pathParams:{folder:i,ownerId:this.id},parentType:i,parentId:this.id,formOrigin:"banner",cropW:t,cropH:r,cropX:n,cropY:o,banner:e};return this.callIsConnected(()=>this.endpointApi.profilBanner(s))}async organization(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.",403);return await this.entity("organizations",e)}async project(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un projet.",401);return await this.entity("projects",e)}async poi(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un POI.",401);return await this.entity("poi",e)}async classified(e={}){if(!("id"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer une ressource.",401);return await this.entity("classifieds",e)}async event(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un événement.",401);return await this.entity("events",e)}async badge(e={}){if(!("id"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un badge.",401);return await this.entity("badges",e)}async news(e={}){if(!e?.id&&!this.isConnected)throw new error_ApiError("Vous devez être connecté.",401);return await this.entity("news",e)}async action(e={}){throw new error_ApiError(`action n'existe pas dans ${this.constructor.name}`,501)}async getOrganizations(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getOrganizations",restoredState:t?.restoredState,finalizer:async e=>(this.isMe?e.pathParams={type:this.getEntityType(),id:this.id}:(delete e?.pathParams,e.filters={[`links.members.${this.id}`]:{$exists:!0},[`links.members.${this.id}.toBeValidated`]:{$exists:!1},[`links.members.${this.id}.isInviting`]:{$exists:!1}}),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getOrganizationsAdmin(e)):()=>this.endpointApi.getOrganizationsNoAdmin(e))())}).next()}async getProjects(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_PROJECTS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getProjects",restoredState:t?.restoredState,finalizer:async e=>(this.isMe?(e.pathParams={type:this.getEntityType(),id:this.id},e.filters={$or:{[`links.contributors.${this.id}`]:{$exists:!0},[`parent.${this.id}`]:{$exists:!0}},[`links.contributors.${this.id}`]:{$exists:!0}}):(delete e?.pathParams,e.filters={$or:{[`links.contributors.${this.id}`]:{$exists:!0},[`parent.${this.id}`]:{$exists:!0}},[`links.contributors.${this.id}`]:{$exists:!0}}),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getProjectsAdmin(e)):()=>this.endpointApi.getProjectsNoAdmin(e))())}).next()}async getEvents(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_EVENTS","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getEvents",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,e.filters={$or:{[`links.attendees.${this.id}`]:{$exists:!0},[`organizer.${this.id}`]:{$exists:!0}}},this.endpointApi.getEvents(e))}).next()}async getPois(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_POIS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getPois",restoredState:t?.restoredState,finalizer:async e=>(this.isMe?e.pathParams={type:this.getEntityType(),id:this.id}:(delete e?.pathParams,e.filters={[`parent.${this.id}`]:{$exists:!0}}),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getPoisAdmin(e)):()=>this.endpointApi.getPoisNoAdmin(e))())}).next()}async getSubscribers(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIBERS","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getSubscribers",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,e.filters={[`links.follows.${this.id}`]:{$exists:!0},[`links.follows.${this.id}.toBeValidated`]:{$exists:!1},[`links.follows.${this.id}.isInviting`]:{$exists:!1}},this.endpointApi.getSubscribers(e))}).next()}async getBadgesIssuer(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_BADGES","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getBadgesIssuer",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,e.filters=e.filters||{"preferences.private":!1},e.filters.$or={},e.filters.$or[`issuer.${this.id}`]={$exists:!0},this.endpointApi.getBadges(e))}).next()}async getNews(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("getNews",["badges","news","poi","events","comments","answers","actions"]);const t=this.getEntityType(),r="dateLimit"in e&&"number"==typeof e.dateLimit?{dateLimit:e.dateLimit}:{dateLimit:0},n="indexStep"in e&&"number"==typeof e.indexStep?{indexStep:e.indexStep}:{indexStep:12},o="search"in e&&"object"==typeof e.search&&null!==e.search&&"name"in e.search&&"string"==typeof e.search.name?{search:{name:e.search.name}}:{},i={pathParams:{type:t,id:this.id,isLive:!0},...r,...n,...o},s=await this.endpointApi.getNews(i);if(!Array.isArray(s))throw new error_ApiResponseError("Erreur lors de la récupération des actualités.",500,s);const a=this._linkEntities(s);return this._createFilteredProxy(a)}async getGallery(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("getGallery",["badges","news","poi","events","comments","answers","actions"]);const t={pathParams:{type:this.getEntityType(),id:this.id,docType:e.pathParams?.docType||"image"}};return await this.endpointApi.getGallery(t)}async searchMembers(e){const t=await this.endpointApi.searchMemberAutocomplete(e);return t&&Array.isArray(t)?(this._assertNotEntityType("searchMembers",["badges","news","poi","comments","actions"]),t.forEach(e=>{for(const t of Object.keys(e))["id","name","slug","profilThumbImageUrl","profilMarkerImageUrl","type","collection"].includes(t)||delete e[t]}),this._linkEntities(t)):[]}async requestToJoin(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._submitLinkRequest()}async requestToJoinAdmin(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._submitLinkRequestAdmin()}async requestPromoteToAdmin(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const e=this._getLinkFromConnectedUser();if(!e)throw new error_ApiError("vous n'êtes pas membre de cette entité.",400);if(e?.isAdmin&&(e?.isInviting||e?.isAdminInviting))throw new error_ApiError("Cet utilisateur est déjà en cours d'invitation en tant qu'admin.",400);if(e?.isAdmin&&!e?.isInviting&&!e?.isAdminInviting)throw new error_ApiError("Cet utilisateur est déjà admin.",400);const t=this.getEntityType(),r=["organizations","projects"];if(!r.includes(t))throw new error_ApiError(`L'entité doit être de type : ${r.join(", ")}, reçu : ${t}`,400);const n=t,o={childId:this.userId,childType:"citoyens",parentType:n,parentId:this.id,connectType:"admin"},i=await this.callIsMe(()=>this.endpointApi.connect(o));return await(this.userContext?.refresh()),i}async acceptInvitation(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._acceptLinkRequest()}async leave(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._leaveLinkRequest()}async follow(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour suivre cette entité.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401);this._assertNotEntityType("follow",["badges","news","poi","comments","actions"]);const e=this.getEntityType();if(!this.userContext?.serverData?.links?.follows?.[this.id]){const t={childId:this.userId,childType:"citoyens",parentType:e,parentId:this.id},r=await this.callIsMe(()=>this.endpointApi.follow(t));return await(this.userContext?.refresh()),r}throw new error_ApiError("Vous êtes déjà abonné à cette entité.",409)}async unfollow(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour vous désabonner.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401);const e=this.userContext?.serverData?.links?.follows?.[this.id]||null;this._assertNotEntityType("unfollow",["badges","news","poi","actions"]);const t=this.getEntityType();if(e){const e={childId:this.userId,childType:"citoyens",parentType:t,parentId:this.id,connectType:"followers"},r=await this.callIsMe(()=>this.endpointApi.disconnect(e));return await(this.userContext?.refresh()),r}throw new error_ApiError("Vous n'êtes pas abonné à cette entité.",404)}_checkAccess(e="effectuer cette action"){if(!this.isMe)throw new error_ApiError(`Vous devez être connecté pour ${e}.`,401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404)}_validateUserLink(e){if(!e)return!1;const{toBeValidated:t,isInviting:r,isAdminInviting:n,isAdminPending:o}=e;return!(t||r||n||o)}_assertEntityType(...e){const t=Array.isArray(e[0])?e[0]:e;if(!t.includes(this.getEntityType()))throw new error_ApiError(`L'entité doit être de type : ${t.join(", ")}, reçu : ${this.getEntityType()}`,400)}_assertNotEntityType(e,...t){const r=Array.isArray(t[0])?t[0]:t,n=this.getEntityType();if(r.includes(n))throw new error_ApiError(`Le type d'entité "${n}" n'est pas supporté par ${e}.`,400)}_getValidatedUserLink(e,t,r){const n=r?.silent??!0;try{this._checkAccess(e),this._assertEntityType(...t)}catch(e){if(n)return null;throw e}return this._getLinkFromConnectedUser()}_isLinked(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t=this.userContext?.serverData?.links;return!!t&&!!t[e]?.[this.id]}isAuthor(e){const t=e?.silent??!0;try{if(this._checkAccess("vérifier l'auteur"),!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401)}catch(e){if(t)return!1;throw e}const r=this.serverData;return!!r.creator&&Boolean(this.userId&&"string"==typeof r.creator&&r.creator===this.userId)}isAdmin(e){const t=this._getValidatedUserLink("vérifier l'administrateur",["organizations","projects","events","classifieds"],{silent:e?.silent});return!(!this._validateUserLink(t)||!0!==t?.isAdmin||t?.isAdminPending)||!!e?.checkHierarchy&&this._isAdminViaHierarchy()}isAuthorOrAdmin(e){return this.isAuthor()||this.isAdmin(e)}isMember(e){const t=this._getValidatedUserLink("vérifier le membre",["organizations"],{silent:e?.silent});return this._validateUserLink(t)}isContributor(e){const t=this._getValidatedUserLink("vérifier le contributeur",["projects"],{silent:e?.silent});return this._validateUserLink(t)}isAttendee(e){const t=this._getValidatedUserLink("vérifier le participant",["events"],{silent:e?.silent});return this._validateUserLink(t)}isFollower(e){const t=e?.silent??!0,r=["citoyens","organizations","projects","events","poi"];try{this._checkAccess("vérifier si il vous suit"),this._assertEntityType(...r)}catch(e){if(t)return!1;throw e}return this._isLinked("followers")}isFollowing(e){const t=e?.silent??!0,r=["citoyens","organizations","projects","events","poi"];try{this._checkAccess("vérifier si vous le suivez"),this._assertEntityType(...r)}catch(e){if(t)return!1;throw e}return this._isLinked("follows")}isToBeValidated(e){const t=this._getValidatedUserLink("vérifier si il est à valider",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.toBeValidated}isInviting(e){const t=this._getValidatedUserLink("vérifier si il est invité",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isInviting}isInvitingAdmin(e){const t=this._getValidatedUserLink("vérifier si il est invité admin",["organizations","projects","events"],{silent:e?.silent});return!!t&&(!0===t.isAdminInviting||!0===t.isInviting)&&!0===t.isAdmin}isAdminPending(e){const t=this._getValidatedUserLink("vérifier si il est en attente admin",["organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isAdmin&&!0===t.isAdminPending}async getCostumJson(){if(!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);const e=this.serverData;if(!e||"string"!=typeof e.slug||""===e.slug.trim())throw new error_ApiError("slug de l'entité non défini",400);const t={pathParams:{slug:e.slug}};return this.endpointApi.getCostumJson(t)}_generateRanges(e,t,r={}){const n={};for(const o of e){const e=r[o]||{indexMax:0};n[o]={indexMin:e.indexMax||0,indexMax:e.indexMax+t}}return n}_normalizeCount(e={}){return delete e.spam,e.total=Object.values(e).reduce((e,t)=>e+("number"==typeof t?t:0),0),e}_getDefaultFromEndpoint(e,t){const r=this.apiClient.getRequestSchema(e);if(r?.properties?.[t])return r.properties[t].default}_createPaginatorEngine({initialData:e,finalizer:t,methodName:r,restoredState:n}){const o=this,i=n?{...n}:{cursor:null,count:0,index:0,history:[],sizes:[]},s=e=>Boolean(e?.indexStep&&e.indexStep>0);async function a(n=!1){const c={...e};i.cursor&&(n||0!==i.history.length)||(i.count=0,i.index=0,i.history=[],i.sizes=[],c.countType=c.searchType,!c.searchBy&&s(c)?(c.ranges=o._generateRanges(c.searchType,c.indexStep),c.indexMin=c.indexMin??0,c.indexMax=c.indexMax??c.indexStep):"ALL"===c.searchBy&&s(c)&&(c.indexMin=c.indexMin??0,c.indexMax=c.indexMax??c.indexStep),i.cursor={...c});const p=i.cursor;n&&p&&(i.history.push({...p}),!p.searchBy&&s(p)?(p.ranges=o._generateRanges(p.searchType,p.indexStep,p.ranges),p.indexMin=p.indexMax??0,p.indexMax=(p.indexMax??0)+p.indexStep):"ALL"===p.searchBy&&s(p)&&(p.indexMin=p.indexMax??0,p.indexMax=(p.indexMax??0)+p.indexStep),i.cursor={...p});const d={...i.cursor||{}};if(!n){const e=d.searchType;if(!Array.isArray(e)||0===e.length)throw new Error("searchType non défini")}const m=await t(d);if(!Array.isArray(m.results))throw new Error("Les résultats doivent être un tableau");i.count+=m.results.length,i.sizes.push(m.results.length),n&&i.index++;const l=o._normalizeCount(m.count),u=o._linkEntities(m.results),h=s(d)&&i.count<l.total,y=i.history.length>0;return{count:l,results:u,pageIndex:i.index,pageNumber:i.index+1,hasNext:h,hasPrev:y,next:h?()=>a(!0):void 0,prev:y?async()=>{const e=i.history.pop(),t=i.sizes.pop()??0;return i.count-=t,i.index=Math.max(0,i.index-1),i.cursor={...e},a(!1)}:void 0,_initialData:{...e},_state:i,_entity:o,_methodName:r}}return{next:()=>a(!1)}}_withCostumContext(e){return async t=>{if(!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);const r=this.serverData;if(!r||"string"!=typeof r.slug||""===r.slug.trim())throw new error_ApiError("slug de l'entité non défini",400);if(!r.id||"string"!=typeof r.id)throw new error_ApiError("id de l'entité non défini",400);const n=Array.isArray(t?.sourceKey)?t.sourceKey:[],o={...t||{},costumSlug:r.slug,contextId:r.id,contextType:this.getEntityType(),sourceKey:[...n,r.slug]};return e(o)}}async searchCostum(e={},t){return this._createPaginatorEngine({initialData:e,methodName:"searchCostum",restoredState:t?.restoredState,finalizer:this._withCostumContext(e=>this.endpointApi.globalAutocompleteCostum(e))}).next()}async costumEventRequestActors(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e},r=this._withCostumContext(e=>this.endpointApi.costumEventRequestActors(e));return await r(t)}async costumEventRequestSubevents(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestSubevents(e))(t)}async costumEventRequestDates(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestDates(e))(t)}async costumEventRequestElementEvent(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestElementEvent(e))(t)}async costumEventRequestCategories(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestCategories(e))(t)}async costumEventRequestEvent(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestEvent(e))(t)}async costumEventRequestLinkTlToEvent(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!e.tl&&!e.event)throw new error_ApiError("Les paramètres 'tl' et 'event' sont requis.",400);if("string"!=typeof e.tl||"string"!=typeof e.event)throw new error_ApiError("Les paramètres 'tl' et 'event' doivent être des chaînes de caractères.",400);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestLinkTlToEvent(e))(t)}async costumEventRequestLoadContextTag(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestLoadContextTag(e))(t)}async coformAnswersSearch(e={},t){return e.searchType=e.searchType??["answers"],this._createPaginatorEngine({initialData:e,methodName:"coformAnswersSearch",restoredState:t?.restoredState,finalizer:this._withCostumContext(e=>this.endpointApi.coformAnswersSearch(e))}).next()}async searchAnswersByForms(e={}){if(!e.forms||Array.isArray(e.forms)||0===Object.keys(e.forms).length)throw new error_ApiError("Le paramètre 'forms' est requis et doit être un objet non vide.",400);return(await this.endpointApi.coformAnswersByForms(e)).map(e=>({...e,answers:this._linkEntities(Object.values(e.answers||{}))}))}async fundingEnvelope(e={}){const t=this._withCostumContext(e=>this.endpointApi.fundingEnvelope(e)),r=await t(e);return{...r,...r.contextData&&{contextData:this._linkEntity(r.contextData.collection,r.contextData)??r.contextData},...r.context&&{context:this._linkEntity(r.context.collection,r.context)??r.context},...r.nopropProject&&{nopropProject:this._linkEntities(Object.values(r.nopropProject))??r.nopropProject},...r.projects&&{projects:r.projects.map(e=>{const t=e?.project;if(t&&"object"==typeof t){const r=this._linkEntity(t.collection??"projects",t);return{...e,project:r??e.project}}return e})},...r.userOrga&&{userOrga:this._linkEntities(Object.values(r.userOrga))??r.userOrga}}}async coformFiltersSearch(e={}){return this._withCostumContext(e=>this.endpointApi.costumFilterCoform(e))(e)}async searchZone(e){if(!e.countryCode?.length||!e.level?.length)throw new error_ApiError("countryCode et level sont requis.",400);return this._withCostumContext(e=>this.endpointApi.searchZones(e))(e)}async getCountries(e={}){return this.endpointApi.getCountries(e)}async generateNewAnswerId(e){if(!e||"string"!=typeof e)throw new error_ApiError("formId est requis et doit être une chaîne de caractères.",400);const t=await this.endpointApi.generateAnswerFromForm({pathParams:{formId:e},action:"new"});return this._linkEntity?.(t.collection,t)??t}async linkDiscourseAccount(e){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.linkDiscourseAccount({...e,costumId:e.contextId,costumType:e.contextType}))({username:e})}async unlinkDiscourseAccount(){return this._withCostumContext(e=>this.endpointApi.unlinkDiscourseAccount({...e,costumId:e.contextId,costumType:e.contextType}))({})}async getDiscourseProfile(e){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.discourseProfile({...e,costumId:e.contextId,costumType:e.contextType}))({username:e})}async checkDiscourseEmailMatch(){return this._withCostumContext(e=>this.endpointApi.discourseCheckEmail({...e,costumId:e.contextId,costumType:e.contextType}))({})}async dismissDiscourseLink(){return this._withCostumContext(e=>this.endpointApi.discourseDismissLink({...e,costumId:e.contextId,costumType:e.contextType}))({})}async linkMediaWikiAccount(e){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.linkMediawikiAccount({...e,costumId:e.contextId,costumType:e.contextType}))({username:e})}async unlinkMediaWikiAccount(){return this._withCostumContext(e=>this.endpointApi.unlinkMediawikiAccount({...e,costumId:e.contextId,costumType:e.contextType}))({})}async getMediaWikiContributions(e,t){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.getMediawikiContributions({...e,costumId:e.contextId,costumType:e.contextType}))({username:e,limit:t})}async coremuOperation(e){if(!e.form||"string"!=typeof e.form)throw new error_ApiError("form est requis et doit être une chaîne de caractères.",400);if(!e.project||"string"!=typeof e.project)throw new error_ApiError("project est requis et doit être une chaîne de caractères.",400);const t={...e,answer:"new",action:"generateproposition"},r=await this.endpointApi.coremuOperation(t);return this._linkEntity(r?.collection,r)??r}static restorePaginationFromJSON(e,t){const r=t instanceof BaseEntity?t:I(e._entity,t),n=e.results.map(e=>I(e,r)),o=e._methodName,i=e._initialData,s=e._state;return{results:n,count:e.count,hasNext:e.hasNext,hasPrev:e.hasPrev,pageIndex:e.pageIndex,pageNumber:e.pageNumber,next:e.hasNext?async()=>{const e=r[o];if("function"!=typeof e)throw new Error(`Méthode ${o} non trouvée sur l'entité`);const t=await e.call(r,i,{restoredState:s});return t.next?.()??t}:void 0,prev:e.hasPrev?async()=>{const e=r[o];if("function"!=typeof e)throw new Error(`Méthode ${o} non trouvée sur l'entité`);const t=await e.call(r,i,{restoredState:s});return t.prev?.()??t}:void 0,_initialData:i,_state:s,_entity:r,_methodName:o}}}class Action extends BaseEntity{static entityType="actions";static entityTag="Action";static SCHEMA_CONSTANTS=["COSTUM_PROJECT_ACTION_REQUEST_NEW"];static ADD_BLOCKS=new Map([["COSTUM_PROJECT_ACTION_REQUEST_NEW","addAction"]]);defaultFields={parentType:"projects"};removeFields=[];_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);if(!this.parent?.id)throw new error_ApiError("Le parent (Project) doit être défini pour créer une action.",400);if("projects"!==this.parent.getEntityType())throw new error_ApiError(`Une Action ne peut être créée que depuis un Project (parent reçu: ${this.parent.getEntityType()}).`,400);e.parentId=this.parent.id;for(const[t,r]of Array.from(Action.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Action.ADD_BLOCKS,r,n),t=e?.content;!this.id&&t?.id&&(this._draftData.id=t.id,this._setData(t,{forceInitialDraftReset:!0}))}}};async addAction(e={}){return this.callIsConnected(()=>this.endpointApi.costumProjectActionRequestNew(e))}}class Answer extends BaseEntity{static entityType="answers";static entityTag="Answer";static SCHEMA_CONSTANTS=[];static ADD_BLOCKS=new Map([]);static UPDATE_BLOCKS=new Map([]);defaultFields={};removeFields=[];_transformServerData(e){return e.user&&"object"==typeof e.user&&"id"in e.user&&(e.user=this._linkNestedEntity({type:"citoyens",collection:"citoyens",...e.user})),e}async get(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);const e=this.id,t=await this.endpointApi.coformAnswersById({answerId:e});if(t?.data?.id)return this._setData(t.data,{forceInitialDraftReset:!0}),this.serverData;throw new error_ApiError(`Aucune réponse trouvée pour l'ID ${this.id}`,404)}}class Badge extends BaseEntity{static entityType="badges";static entityTag="Badge";static SCHEMA_CONSTANTS=["ADD_BADGES"];static ADD_BLOCKS=new Map([["ADD_BADGES","addBadges"]]);static UPDATE_BLOCKS=new Map([]);defaultFields={};removeFields=[];_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Badge.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this[r](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(Badge.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this[n](o),t=!0)}return t};async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents n'existe pas dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(){throw new error_ApiError(`getNews n'existe pas dans ${this.constructor.name}`,501)}async getSubscribers(){throw new error_ApiError(`getSubscribers n'existe pas dans ${this.constructor.name}`,501)}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`event n'existe pas dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(){throw new error_ApiError(`news n'existe pas dans ${this.constructor.name}`,501)}}function X(e){return e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{type:t?.type??"",name:t?.name}])):{}}function ee(e){return(t,r)=>r?.socialNetwork?.[e]}class Classified extends BaseEntity{static entityType="classifieds";static entityTag="Classified";static SCHEMA_CONSTANTS=["ADD_CLASSIFIED"];static ADD_BLOCKS=new Map([["ADD_CLASSIFIED","addClassified"]]);defaultFields={typeElement:"classified"};removeFields=["typeElement"];transforms={parent:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.();for(const[t,r]of Array.from(Classified.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this[r](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);if(!this.isAuthor()&&!this.isAdmin({checkHierarchy:!0}))throw new error_ApiError("Vous n'êtes pas autorisé à modifier cette ressource",403);let t=!1;const r=this._extractAllValidFieldsFromSchema(this.apiClient,"ADD_CLASSIFIED",{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);return r&&Object.keys(r).length>0&&(await this.addClassified(r),t=!0),t};async addClassified(e={}){const t=e;return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!t.parent&&(t.parent={},t.parent[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addClassified(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents n'existe pas dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(){throw new error_ApiError(`getNews n'existe pas dans ${this.constructor.name}`,501)}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`event n'existe pas dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(){throw new error_ApiError(`news n'existe pas dans ${this.constructor.name}`,501)}async classified(){throw new error_ApiError(`classified n'existe pas dans ${this.constructor.name}`,501)}async follow(){throw new error_ApiError(`follow n'existe pas dans ${this.constructor.name}`,501)}async unfollow(){throw new error_ApiError(`unfollow n'existe pas dans ${this.constructor.name}`,501)}async getGallery(){throw new error_ApiError(`getGallery n'existe pas dans ${this.constructor.name}`,501)}}class Comment extends BaseEntity{static entityType="comments";static entityTag="Comment";static SCHEMA_CONSTANTS=["ADD_COMMENTS"];static ADD_BLOCKS=new Map([["ADD_COMMENTS","addComments"]]);static UPDATE_BLOCKS=new Map([["ADD_COMMENTS","updateComments"]]);defaultFields={};removeFields=["contextId","contextType","parentCommentId","argval"];_transformServerData(e){return e.author&&(e.author=this._linkNestedEntity(e.author)),Array.isArray(e.replies)&&(e.replies=e.replies.map(e=>(e&&"object"==typeof e&&!e.type&&(e.type="comments",e.collection="comments"),this._linkNestedEntity(e)))),e}async get(){throw new error_ApiError(`get n'existe pas dans ${this.constructor.name}`,501)}async save(){const e=this.refresh;this.refresh=async()=>this._serverData;try{return await super.save()}finally{this.refresh=e}}_add=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _add, utilisez save");if(!this.parent?.id)throw new Error("Le parent doit être défini pour ajouter un commentaire.");if(""===e.text&&(e.text=" "),"comments"===this.parent.getEntityType()){e.parentCommentId=this.parent.id;let t=this.parent.parent;for(;t&&t.getEntityType&&"comments"===t.getEntityType();)t=t.parent;if(!t)throw new Error("Impossible de trouver l'entité racine pour le commentaire.");e.contextId=t.id,e.contextType=t.getEntityType()}else e.parentCommentId=e.parentCommentId||"",e.contextId=this.parent.id,e.contextType=this.parent.getEntityType();for(const[t,r]of Array.from(Comment.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{},[]);if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Comment.ADD_BLOCKS,r,n),t=e?.object?.id||e?.id?.$id||e?.id;!this.id&&t&&(this._draftData.id=t,this._setData(e.newComment,{forceInitialDraftReset:!0}))}}};_update=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");if(!this.parent?.id)throw new Error("Le parent doit être défini pour ajouter un commentaire.");""===e?.text&&(e.text=" "),e.params={text:e.text},delete e.text;let t=!1;const r=await this.callIsConnected(()=>this.endpointApi.updateComments(e));return r?.comment&&this._setData(r.comment,{forceInitialDraftReset:!0}),t=!0,!0};async addComments(e={}){return this.callIsConnected(()=>this.endpointApi.addComments(e))}async updateComments(e={}){return this.callIsConnected(()=>this.endpointApi.updateComments(e))}async delete(){if(!this.id)throw new error_ApiError("Vous devez fournir un id pour supprimer un commentaire.",400);const e={pathParams:{id:this.id}};await this.callIsConnected(()=>this.endpointApi.deleteComments(e)),Object.keys(this._draftData).forEach(e=>delete this._draftData[e]),Object.keys(this._serverData).forEach(e=>delete this._serverData[e]),this._isDeleted=!0}async comment(e={}){if(!this.isConnected)throw new error_ApiError("Vous devez être connecté.",401);return await this.entity("comments",e)}async addVote(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={collection:"comments",id:this.id,action:"vote",details:{status:e}};return await this.callIsConnected(()=>this.endpointApi.addVote(t))}async addReportAbuse({reason:e,comment:t}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const r={collection:"comments",id:this.id,action:"reportAbuse",details:{reason:e,comment:t}};return await this.callIsConnected(()=>this.endpointApi.addReportAbuse(r))}}const te=class EndpointApi{apiClient;constructor(e){this.apiClient=e}get isConnected(){return this.apiClient.isConnected}get userId(){return this.apiClient.userId}async call(e,t={}){return this.apiClient.safeCall(async()=>{const r=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(r),r.data})}async callNoConnected(e,t={}){if(this.isConnected)throw new error_ApiAuthenticationError("Vous ne devez pas être connecté pour faire cette action.",403);return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new error_ApiAuthenticationError("Vous devez être connecté pour effectuer cette action.",401);return this.call(e,t)}async personRegister(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callNoConnected("PERSON_REGISTER",e)}async authenticateUrl(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callNoConnected("AUTHENTICATE_URL",e)}async refreshTokenUrl(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("REFRESH_TOKEN_URL",e)}async meInfoUrl(){return this.callIsConnected("ME_INFO_URL")}async passwordRecovery(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callNoConnected("PASSWORD_RECOVERY",e)}async serverExchangeToken(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SERVER_EXCHANGE_TOKEN",e)}async changePassword(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("CHANGE_PASSWORD",e)}async deleteAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_ACCOUNT",e)}async updateSettings(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_SETTINGS",e)}async updateBlockDescription(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_DESCRIPTION",e)}async updateBlockInfo(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_INFO",e)}async updateBlockSocial(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_SOCIAL",e)}async updateBlockLocality(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_LOCALITY",e)}async updateBlockSlug(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_SLUG",e)}async check(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("CHECK",e)}async profilImage(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("PROFIL_IMAGE",e)}async profilBanner(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("PROFIL_BANNER",e)}async getElementsAbout(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ELEMENTS_ABOUT",e)}async multiconnect(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("MULTICONNECT",e)}async getNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_NEWS",e)}async getNewsById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_NEWS_BY_ID",e)}async addNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_NEWS",e)}async addImageNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_IMAGE_NEWS",e)}async addFileNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_FILE_NEWS",e)}async deleteNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_NEWS",e)}async updateNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_NEWS",e)}async shareNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SHARE_NEWS",e)}async getComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COMMENTS",e)}async addComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_COMMENTS",e)}async deleteComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_COMMENTS",e)}async updateComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_COMMENTS",e)}async searchTags(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SEARCH_TAGS",e)}async showVote(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SHOW_VOTE",e)}async globalAutocomplete(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GLOBAL_AUTOCOMPLETE",e)}async cityAutocomplete(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("CITY_AUTOCOMPLETE",e)}async cityAutocompleteByCountry(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("CITY_AUTOCOMPLETE_BY_COUNTRY",e)}async suggestionInput(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SUGGESTION_INPUT",e)}async getProjectsNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_PROJECTS_NO_ADMIN",e)}async getProjectsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_PROJECTS_ADMIN",e)}async getPoisNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_POIS_NO_ADMIN",e)}async getPoisAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_POIS_ADMIN",e)}async getOrganizationsNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ORGANIZATIONS_NO_ADMIN",e)}async getOrganizationsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_ORGANIZATIONS_ADMIN",e)}async getMembersNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_MEMBERS_NO_ADMIN",e)}async getMembersAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_MEMBERS_ADMIN",e)}async getFriendsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_FRIENDS_ADMIN",e)}async getSubscriptions(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_SUBSCRIPTIONS",e)}async getSubscriptionsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_SUBSCRIPTIONS_ADMIN",e)}async getSubscribers(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_SUBSCRIBERS",e)}async getSubscribersAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_SUBSCRIBERS_ADMIN",e)}async getContributorsNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_CONTRIBUTORS_NO_ADMIN",e)}async getContributorsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_CONTRIBUTORS_ADMIN",e)}async getBadges(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_BADGES",e)}async getBadgesFilters(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_BADGES_FILTERS",e)}async connect(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("CONNECT",e)}async disconnect(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DISCONNECT",e)}async getElementsKey(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ELEMENTS_KEY",e)}async getFavoris(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_FAVORIS",e)}async deleteFavoris(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_FAVORIS",e)}async addFavoris(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_FAVORIS",e)}async addOrganization(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_ORGANIZATION",e)}async addProject(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_PROJECT",e)}async addPoi(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_POI",e)}async addEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_EVENT",e)}async deletePoi(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_POI",e)}async deleteEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_EVENT",e)}async deleteElement(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_ELEMENT",e)}async addImageElement(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_IMAGE_ELEMENT",e)}async linkValidate(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("LINK_VALIDATE",e)}async searchMemberAutocomplete(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SEARCH_MEMBER_AUTOCOMPLETE",e)}async getNotifications(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_NOTIFICATIONS",e)}async getNotificationsCount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_NOTIFICATIONS_COUNT",e)}async notificationUpdate(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("NOTIFICATION_UPDATE",e)}async removeAllNotifications(){return this.callIsConnected("REMOVE_ALL_NOTIFICATIONS")}async markNotificationAsRead(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("MARK_NOTIFICATION_AS_READ",e)}async activitypubSearch(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("ACTIVITYPUB_SEARCH",e)}async activitypubLink(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ACTIVITYPUB_LINK",e)}async activitypubGetCommunity(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("ACTIVITYPUB_GET_COMMUNITY",e)}async getBadge(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_BADGE",e)}async getEmetteurBadges(){return this.call("GET_EMETTEUR_BADGES")}async addBadges(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_BADGES",e)}async assignBadges(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ASSIGN_BADGES",e)}async getEvents(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_EVENTS",e)}async shareEvents(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SHARE_EVENTS",e)}async inviteEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("INVITE_EVENT",e)}async follow(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("FOLLOW",e)}async getCostumJson(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COSTUM_JSON",e)}async globalAutocompleteCostum(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GLOBAL_AUTOCOMPLETE_COSTUM",e)}async costumEventRequestActors(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_ACTORS",e)}async costumEventRequestSubevents(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_SUBEVENTS",e)}async costumEventRequestElementEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_ELEMENT_EVENT",e)}async costumEventRequestCategories(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_CATEGORIES",e)}async costumEventRequestDates(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_DATES",e)}async costumEventRequestEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_EVENT",e)}async costumEventRequestLinkTlToEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_LINK_TL_TO_EVENT",e)}async costumEventRequestLoadContextTag(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_LOAD_CONTEXT_TAG",e)}async getGallery(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_GALLERY",e)}async getAttendeesNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ATTENDEES_NO_ADMIN",e)}async getAttendeesAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_ATTENDEES_ADMIN",e)}async coformAnswersSearch(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COFORM_ANSWERS_SEARCH",e)}async coformAnswersById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COFORM_ANSWERS_BY_ID",e)}async getCoformById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COFORM_BY_ID",e)}async coformUploadAnswerFile(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("COFORM_UPLOAD_ANSWER_FILE",e)}async coformGetAnswerFiles(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("COFORM_GET_ANSWER_FILES",e)}async saveCoformAnswer(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SAVE_COFORM_ANSWER",e)}async addVote(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_VOTE",e)}async addReportAbuse(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_REPORT_ABUSE",e)}async updatePathValue(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_PATH_VALUE",e)}async deleteDocumentByContext(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_DOCUMENT_BY_CONTEXT",e)}async deleteDocumentById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_DOCUMENT_BY_ID",e)}async demoteAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DEMOTE_ADMIN",e)}async costumFilterCoform(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_FILTER_COFORM",e)}async getCountries(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COUNTRIES",e)}async searchZones(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SEARCH_ZONES",e)}async coformAnswersByForms(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COFORM_ANSWERS_BY_FORMS",e)}async generateAnswerFromForm(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GENERATE_ANSWER_FROM_FORM",e)}async fundingEnvelope(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("FUNDING_ENVELOPE",e)}async coremuOperation(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COREMU_OPERATION",e)}async costumProjectActionRequestNew(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_NEW",e)}async linkDiscourseAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("LINK_DISCOURSE_ACCOUNT",e)}async unlinkDiscourseAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UNLINK_DISCOURSE_ACCOUNT",e)}async discourseProfile(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("DISCOURSE_PROFILE",e)}async discourseCheckEmail(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DISCOURSE_CHECK_EMAIL",e)}async discourseDismissLink(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DISCOURSE_DISMISS_LINK",e)}async linkMediawikiAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("LINK_MEDIAWIKI_ACCOUNT",e)}async unlinkMediawikiAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UNLINK_MEDIAWIKI_ACCOUNT",e)}async getMediawikiContributions(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_MEDIAWIKI_CONTRIBUTIONS",e)}async addClassified(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_CLASSIFIED",e)}};class Event extends BaseEntity{static entityType="events";static entityTag="Event";static SCHEMA_CONSTANTS=["ADD_EVENT","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static ADD_BLOCKS=new Map([["ADD_EVENT","addEvent"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={parent:X,organizer:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Event.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Event.ADD_BLOCKS,r,n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAdmin({checkHierarchy:!0}))throw new error_ApiError("Vous n'avez pas les droits pour modifier cet événement",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);let t=!1;const r=this._extractAllValidFieldsFromSchema(this.apiClient,"ADD_EVENT",{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);r&&Object.keys(r).length>0&&(await this.addEvent(r),t=!0),e.id&&delete e.id;for(const[r,n]of Array.from(Event.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Event.UPDATE_BLOCKS,n,o),t=!0)}return t};async addEvent(e={}){return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!e.organizer&&(e.organizer={},e.organizer[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addEvent(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents - les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async getAttendees(e={},t={}){return e.searchType=this._getDefaultFromEndpoint("GET_ATTENDEES_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getAttendees",restoredState:t?.restoredState,finalizer:async e=>{const{toBeValidated:r,isAdmin:n,isInviting:o,isAdminPending:i,roles:s=[]}=t;return this.isMe?(e.pathParams={id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"events",toBeValidated:r,isAdmin:n,isAdminPending:i,isInviting:o,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"events",toBeValidated:!1,isAdmin:n,isInviting:o,roles:s})),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getAttendeesAdmin(e)):()=>this.endpointApi.getAttendeesNoAdmin(e))()}}).next()}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(e={}){return super.news(e)}async requestToJoin(){return super.requestToJoin()}async acceptInvitation(){return super.acceptInvitation()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class Form extends BaseEntity{static entityType="forms";static entityTag="Form";static SCHEMA_CONSTANTS=[];static ADD_BLOCKS=new Map([]);static UPDATE_BLOCKS=new Map([]);defaultFields={};removeFields=[];_transformServerData(e){return e}async get(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);const e=this.id,t=await this.endpointApi.getCoformById({parentFormId:e});if(t?.data?.id||t?.data?._id){const e={...t.data,inputs:t.data.inputs??{},params:t.data.params??{},subForms:t.data.subForms??[],parent:t.data.parent??void 0,config:t.data.config??void 0};return this._setData(e,{forceInitialDraftReset:!0}),this.serverData}throw new error_ApiError(`Aucun formulaire trouvé pour l'ID ${this.id}`,404)}}class News extends BaseEntity{static entityType="news";static entityTag="News";static SCHEMA_CONSTANTS=["ADD_NEWS"];static ADD_BLOCKS=new Map([["ADD_NEWS","addNews"]]);static UPDATE_BLOCKS=new Map([["ADD_NEWS","updateNews"]]);defaultFields={};removeFields=["parentId","parentType"];transforms={scope:e=>e?.type,mentions:e=>Array.isArray(e)?e.map(e=>({...e,count:parseInt(e.count)})):[],mediaImg:e=>{const t=e?.images?.map(e=>e.id).filter(Boolean)||[];return t.length>0?{countImages:t.length,images:t}:{countImages:0,images:[]}},mediaFile:e=>{const t=e?.files?.map(e=>e.id).filter(Boolean)||[];return t.length>0?{countFiles:t.length,files:t}:{countFiles:0,files:[]}}};_transformServerData(e){return e.author&&(e.author=this._linkNestedEntity(e.author)),e.target&&(e.target=this._linkNestedEntity(e.target)),e.lastAuthorShare&&(e.lastAuthorShare=this._linkNestedEntity(e.lastAuthorShare)),Array.isArray(e.sharedBy)&&(e.sharedBy=e.sharedBy.map(e=>this._linkNestedEntity(e))),e}async get(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);const e=this.id,t=await this.endpointApi.getNewsById({ids:[e]});if(t&&Array.isArray(t)&&1===t.length){const e=t[0];return this._setData(e,{forceInitialDraftReset:!0}),this.serverData}throw new error_ApiError(`Aucune actualité trouvée pour l'ID ${this.id}`,404)}_add=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _add, utilisez save");""===e.text&&(e.text=" "),this.parent&&(e.parentId=this.parent.id,e.parentType=this.parent.getEntityType());for(const[t,r]of Array.from(News.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{},[]);if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(News.ADD_BLOCKS,r,n);!this.id&&e?.object?.id&&(this._draftData.id=e.object.id)}}};_update=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");e.id&&delete e.id,""===e?.text&&(e.text=" "),this.parent&&(e.parentId=this.parent.id,e.parentType=this.parent.getEntityType()),e.idNews=this.id;let t=!1;return await this.callIsConnected(()=>this.endpointApi.updateNews(e)),t=!0,!0};async addNews(e={}){return this.callIsConnected(()=>this.endpointApi.addNews(e))}async updateNews(e={}){return this.callIsConnected(()=>this.endpointApi.updateNews(e))}async addMention({slug:e,id:t}){try{if(!e&&!t)throw new error_ApiError("Vous devez fournir un slug ou un id pour ajouter une mention.",400);const r=await this.entity("citoyens",{id:t,slug:e}),n=r.serverData;if(this._draftData.mentions||(this._draftData.mentions=[]),this._draftData.mentions.find(e=>e.id===n.id))return this._draftData.mentions=this._draftData.mentions.map(e=>(e.id===n.id&&(e.count+=1),e)),this._draftData.mentions;const o={id:n.id,slug:n.slug,type:r.getEntityType(),name:n.name,value:n.name,count:1};return this._draftData.mentions.push(o),this._draftData.mentions}catch(e){throw this.apiClient._logger.error("Erreur lors de l'ajout de la mention :",e),e}}async addImage(e){const t=await this._validateImage(e),r={pathParams:{folder:this.parent?.getEntityType(),ownerId:this.parent?.id},newsImage:t},n=await this.callIsConnected(()=>this.endpointApi.addImageNews(r));return this._draftData.mediaImg?(this._draftData.mediaImg.countImages=this._draftData.mediaImg.countImages+1,this._draftData.mediaImg.images.push(n.id)):this._draftData.mediaImg={countImages:1,images:[n.id]},n}async addFile(e){const t=await this._validateFile(e),r={pathParams:{folder:this.parent?.getEntityType(),ownerId:this.parent?.id},newsFile:t},n=await this.callIsConnected(()=>this.endpointApi.addFileNews(r));return this._draftData.mediaFile?(this._draftData.mediaFile.countFiles=this._draftData.mediaFile.countFiles+1,this._draftData.mediaFile.files.push(n.id)):this._draftData.mediaFile={countFiles:1,files:[n.id]},n}async delete(){if(!this.id)throw new error_ApiError("Vous devez fournir un id pour supprimer une news.",400);const e={pathParams:{id:this.id},isLive:!1};await this.callIsConnected(()=>this.endpointApi.deleteNews(e)),Object.keys(this._draftData).forEach(e=>delete this._draftData[e]),Object.keys(this._serverData).forEach(e=>delete this._serverData[e]),this._isDeleted=!0}async comment(e={}){if(!this.isConnected)throw new error_ApiError("Vous devez être connecté.",401);return await this.entity("comments",e)}async getComments(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const e={pathParams:{type:"news",id:this.id}},t=await this.endpointApi.getComments(e);if(!Array.isArray(t))throw new error_ApiResponseError("Erreur lors de la récupération des commentaires.",500,t);const r=this._linkEntities(t);return this._createFilteredProxy(r)}async addVote(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={collection:"news",id:this.id,action:"vote",details:{status:e}};return await this.callIsConnected(()=>this.endpointApi.addVote(t))}async addReportAbuse({reason:e,comment:t}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const r={collection:"news",id:this.id,action:"reportAbuse",details:{reason:e,comment:t}};return await this.callIsConnected(()=>this.endpointApi.addReportAbuse(r))}async shareNews({childId:e,childType:t,comment:r}={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);if(!this.parent?.id)throw new error_ApiError("Le parent doit être défini pour partager une news",400);const n=e??this.userId,o=t??"citoyens",i=["citoyens","projects","organizations"];if(!i.includes(o))throw new error_ApiError(`Le type de cible "${o}" n'est pas valide. Types autorisés: ${i.join(", ")}`,400);if(this.parent.id===this.userId&&n===this.userId)throw new error_ApiError("Vous ne pouvez pas partager votre propre news à vous-même",400);const s={parentId:this.id,parentType:"news",connectType:"share",childType:o,childId:n,comment:r};return await this.callIsConnected(()=>this.endpointApi.shareNews(s))}isAuthor(e){const t=e?.silent??!0;try{if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour vérifier l'auteur.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401)}catch(e){if(t)return!1;throw e}const r=this.serverData.author;if(!r)return!1;let n;return"serverData"in r&&r.serverData&&"object"==typeof r.serverData&&"id"in r.serverData?n=r.serverData.id:"id"in r&&(n=r.id),Boolean(n&&this.userId===n)}}class Organization extends BaseEntity{static entityType="organizations";static entityTag="Organization";static SCHEMA_CONSTANTS=["ADD_ORGANIZATION","UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_SOCIAL","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE","VIRTUAL_OPENING_HOURS"];static VIRTUAL_SCHEMAS={VIRTUAL_OPENING_HOURS:{type:"object",properties:{openingHours:{type:"array",description:"Horaires d'ouverture (7 jours de la semaine)",minItems:7,maxItems:7,items:{oneOf:[{type:"string",const:""},{type:"object",properties:{dayOfWeek:{type:"string",enum:["Mo","Tu","We","Th","Fr","Sa","Su"],description:"Jour de la semaine"},hours:{type:"array",description:"Liste des créneaux horaires",items:{type:"object",properties:{opens:{type:"string",pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",description:"Heure d'ouverture (HH:MM)"},closes:{type:"string",pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",description:"Heure de fermeture (HH:MM)"}},required:["opens","closes"],additionalProperties:!1}}},required:["dayOfWeek","hours"],additionalProperties:!1}]}}}}};static CUSTOM_FIELD_HANDLERS=new Map([["openingHours",{updateMethod:"updateOpeningHours",schemaConstant:"VIRTUAL_OPENING_HOURS"}]]);static ADD_BLOCKS=new Map([["ADD_ORGANIZATION","addOrganization"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={github:ee("github"),gitlab:ee("gitlab"),facebook:ee("facebook"),twitter:ee("twitter"),instagram:ee("instagram"),diaspora:ee("diaspora"),mastodon:ee("mastodon"),telegram:ee("telegram"),signal:ee("signal")};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Organization.ADD_BLOCKS)){const n="ADD_ORGANIZATION"===t,o={...e,...this.defaultFields};n||delete o.id;const i=this._extractChangedFieldsFromSchema(this.apiClient,t,o,()=>{},n?[]:this.removeFields);if(i&&Object.keys(i).length>0){const e=await this._invokeBlockMethod(Organization.ADD_BLOCKS,r,i);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour modifier cette organisation",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;const r=Organization.CUSTOM_FIELD_HANDLERS;if(r){const n=new Set;for(const[o,i]of r)o in e&&this._hasFieldChanged(o)&&(await this._invokeCustomFieldHandler(i.updateMethod,e[o],o),n.add(o),t=!0);n.forEach(t=>delete e[t])}for(const[r,n]of Array.from(Organization.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Organization.UPDATE_BLOCKS,n,o),t=!0)}return t};async addOrganization(e){return this.callIsConnected(()=>this.endpointApi.addOrganization(e))}async getOrganizations(){throw new error_ApiError("getOrganizations n'existe pas dans Organization",404)}async getProjects(e={}){return super.getProjects(e)}async getEvents(e={}){return super.getEvents(e)}async getPois(e={}){return super.getPois(e)}async getBadgesIssuer(e={}){return super.getBadgesIssuer(e)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async getMembers(e={},t={}){if(!this.id)throw new error_ApiError("L'organisation n'est pas définie, impossible de récupérer les membres",400);const r=this.id;return e.searchType=this._getDefaultFromEndpoint("GET_MEMBERS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getMembers",restoredState:t?.restoredState,finalizer:async e=>{const{toBeValidated:n,isAdmin:o,isAdminPending:i,isInviting:s,roles:a=[]}=t;return this.isMe?(e.pathParams={id:this.id},e.filters=this._buildLinkFilters(r,{linkType:"memberOf",toBeValidated:n,isAdmin:o,isAdminPending:i,isInviting:s,roles:a})):(delete e?.pathParams,e.filters=this._buildLinkFilters(r,{linkType:"memberOf",toBeValidated:!1,isAdmin:o,isInviting:s,roles:a})),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getMembersAdmin(e)):()=>this.endpointApi.getMembersNoAdmin(e))()}}).next()}async getGallery(e={}){return super.getGallery(e)}async project(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un projet dans cette organisation",403);return super.project(e)}async poi(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un poi dans cette organisation",403);return super.poi(e)}async event(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un event dans cette organisation",403);return super.event(e)}async badge(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un badge dans cette organisation",403);return super.badge(e)}async news(e={}){return super.news(e)}async updateOpeningHours(e){if(!this.id)throw new error_ApiError("L'organisation n'a pas d'ID, impossible de mettre à jour les horaires d'ouverture.",400);return this.endpointApi.updatePathValue({id:this.id,collection:"organizations",path:"openingHours",value:e})}async requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}requestPromoteToAdmin(){return super.requestPromoteToAdmin()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}async getCostumJson(){return super.getCostumJson()}async searchCostum(e){return super.searchCostum(e)}async coformAnswersSearch(e){return super.coformAnswersSearch(e)}}class Poi extends BaseEntity{static entityType="poi";static entityTag="Poi";static SCHEMA_CONSTANTS=["ADD_POI","UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static ADD_BLOCKS=new Map([["ADD_POI","addPoi"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={parent:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Poi.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Poi.ADD_BLOCKS,r,n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAuthor())throw new error_ApiError("Vous n'avez pas les droits pour modifier ce POI",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(Poi.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Poi.UPDATE_BLOCKS,n,o),t=!0)}return t};async addPoi(e={}){return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!e.parent&&(e.parent={},e.parent[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addPoi(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents n'existe pas dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(){throw new error_ApiError(`getNews n'existe pas dans ${this.constructor.name}`,501)}async getSubscribers(e={}){return super.getSubscribers(e)}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`event n'existe pas dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(){throw new error_ApiError(`news n'existe pas dans ${this.constructor.name}`,501)}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class Project extends BaseEntity{static entityType="projects";static entityTag="Project";static SCHEMA_CONSTANTS=["ADD_PROJECT","UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_SOCIAL","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static ADD_BLOCKS=new Map([["ADD_PROJECT","addProject"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={github:ee("github"),gitlab:ee("gitlab"),facebook:ee("facebook"),twitter:ee("twitter"),instagram:ee("instagram"),diaspora:ee("diaspora"),mastodon:ee("mastodon"),telegram:ee("telegram"),signal:ee("signal"),parent:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Project.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Project.ADD_BLOCKS,r,n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour modifier ce projet",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(Project.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Project.UPDATE_BLOCKS,n,o),t=!0)}return t};async addProject(e={}){return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!e.parent&&(e.parent={},e.parent[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addProject(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(e={}){return super.getProjects(e)}async getEvents(e={}){return super.getEvents(e)}async getPois(e={}){return super.getPois(e)}async getBadgesIssuer(e={}){return super.getBadgesIssuer(e)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async getContributors(e={},t={}){return e.searchType=this._getDefaultFromEndpoint("GET_CONTRIBUTORS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getContributors",restoredState:t?.restoredState,finalizer:async e=>{const{toBeValidated:r,isAdmin:n,isInviting:o,isAdminPending:i,roles:s=[]}=t;return this.isMe?(e.pathParams={id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:r,isAdmin:n,isAdminPending:i,isInviting:o,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:!1,isAdmin:n,isInviting:o,roles:s})),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getContributorsAdmin(e)):()=>this.endpointApi.getContributorsNoAdmin(e))()}}).next()}async getGallery(e={}){return super.getGallery(e)}async project(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un projet dans ce projet",403);return super.project(e)}async poi(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un POI dans ce projet",403);return super.poi(e)}async event(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un événement dans ce projet",403);return super.event(e)}async badge(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un badge dans ce projet",403);return super.badge(e)}async news(e={}){if(!e?.id&&!this.isContributor())throw new error_ApiError("Vous n'avez pas les droits pour créer une news dans ce projet",403);return super.news(e)}async action(e={}){if(!e?.id&&!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer une action dans ce projet",403);return await this.entity("actions",e)}async requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}requestPromoteToAdmin(){return super.requestPromoteToAdmin()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class User extends BaseEntity{static entityType="citoyens";static entityTag="User";static SCHEMA_CONSTANTS=["UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_SOCIAL","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={github:ee("github"),gitlab:ee("gitlab"),facebook:ee("facebook"),twitter:ee("twitter"),instagram:ee("instagram"),diaspora:ee("diaspora"),mastodon:ee("mastodon"),telegram:ee("telegram"),signal:ee("signal")};constructor(e,t,r){if(!r.EndpointApi)throw new error_ApiError("EndpointApi class must be injected to avoid circular dependency.",500);if(!t?.id&&!t?.slug)throw new error_ApiError("Vous devez fournir un id ou un slug pour créer un User.",400);if(!r.Organization)throw new error_ApiError("Organization class must be injected.",500);if(!r.Project)throw new error_ApiError("Project class must be injected.",500);if(!r.Event)throw new error_ApiError("Event class must be injected.",500);if(!r.Poi)throw new error_ApiError("Poi class must be injected.",500);if(!r.Badge)throw new error_ApiError("Badge class must be injected.",500);if(!r.News)throw new error_ApiError("News class must be injected.",500);if(!r.Answer)throw new error_ApiError("Answer class must be injected.",500);super(e,t,r)}get slug(){return this._draftData.slug||null}get isMe(){return this.isConnected&&this.userId===this.id}get parentIsMe(){return super.isMe}get isActingUser(){return this.parentIsMe&&!this.isMe}getEntityType(){return"citoyens"}async get(){return this.apiClient.safeCall(async()=>{if(this.isMe){const e=await this.endpointApi.meInfoUrl();return this._setData(e,{forceInitialDraftReset:!0}),e}{const e=await this._getPublicProfile();return this._setData(e,{forceInitialDraftReset:!0}),e}})}async changePassword(e){return this.callIsMe(()=>this.endpointApi.changePassword(e))}async delete(e){return this.callIsMe(()=>this.endpointApi.deleteAccount(e))}async save(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour sauvegarder.",401);return await super.save()}_add=async()=>{throw new error_ApiError("Vous ne pouvez pas ajouter un utilisateur par ce moyen.",403)};_update=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(User.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(User.UPDATE_BLOCKS,n,o),t=!0)}return t};static fromServerData(e,t,r){const n=new this(t,e,r);return e&&"object"==typeof e&&Object.keys(e).length>0&&"function"==typeof n._setData&&n._setData(e),n}async updateSettings(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les paramètres.",401);const t=await super.updateSettings(e);return await this.refresh(),t}async updateDescription(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la description.",401);return super.updateDescription(e)}async updateInfo(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les informations.",401);return super.updateInfo(e)}async updateSocial(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les réseaux sociaux.",401);return super.updateSocial(e)}async updateLocality(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la localité.",401);return super.updateLocality(e)}async updateSlug(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour le slug.",401);return super.updateSlug(e)}async updateImageProfil(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour l'image de profil.",401);return super.updateImageProfil(e)}async updateImageBanner(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour l'image de bannière.",401);return super.updateImageBanner(e)}async getOrganizations(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getOrganizations",restoredState:t?.restoredState,finalizer:async e=>{delete e?.pathParams;const t=this.isMe?()=>this.callIsMe(()=>this.endpointApi.getOrganizationsAdmin(e)):()=>this.endpointApi.getOrganizationsNoAdmin(e);return this.isMe||e.filters||(e.filters={[`links.members.${this.id}`]:{$exists:!0},[`links.members.${this.id}.toBeValidated`]:{$exists:!1},[`links.members.${this.id}.isInviting`]:{$exists:!1}}),t()}}).next()}async getProjects(e={}){return super.getProjects(e)}async getEvents(e={}){return super.getEvents(e)}async getPois(e={}){return super.getPois(e)}async getNews(e={}){return super.getNews(e)}async getFriends(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_FRIENDS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getFriends",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,!this.isMe&&this.id&&(e.pathParams={id:this.id}),this.endpointApi.getFriendsAdmin(e))}).next()}async getSubscriptions(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIPTIONS","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getSubscriptions",restoredState:t?.restoredState,finalizer:async e=>{delete e?.pathParams;const t=this.isMe?()=>this.callIsMe(()=>this.endpointApi.getSubscriptionsAdmin(e)):()=>this.endpointApi.getSubscriptions(e);return this.isMe||e.filters||(e.filters={[`links.followers.${this.id}`]:{$exists:!0}}),t()}}).next()}async getSubscribers(e={}){return super.getSubscribers(e)}async getBadgesIssuer(e={}){return super.getBadgesIssuer(e)}async getBadges(e={}){return await this.linkEntitiesFromServerData("badges",e)}async getGallery(e={}){return super.getGallery(e)}async user(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur",401);if(!e.id&&!e.slug)throw new error_ApiError("Vous devez fournir un id ou un slug pour créer un User.",400);const t=this.deps,r=new User(this,e,t);return await r.get(),r}async organization(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.",401);return super.organization(e)}async project(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un projet.",401);return super.project(e)}async news(e={}){if(!("id"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer une actualité.",401);return super.news(e)}async poi(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un POI.",401);return super.poi(e)}async event(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un événement.",401);return super.event(e)}async badge(e={}){if(!("id"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un badge.",401);return super.badge(e)}async sendFriendRequest(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour envoyer une demande d'amis.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){const t={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,connectType:e},r=await this.endpointApi.connect(t);return await(this.userContext?.refresh()),r}if(t.isInviting&&t.invitorId===this.id)return this.acceptFriendRequest();if(t.isInviting&&t.invitorId===this.userId)throw new error_ApiError("Vous avez déjà envoyé une demande d'amis à cet utilisateur.",403);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",409)}async acceptFriendRequest(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour accepter une demande d'amitié.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const e=this._getLinkFromConnectedUser();if(e?.isInviting&&e.invitorId===this.id){const e={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,linkOption:"isInviting"},t=await this.endpointApi.linkValidate(e);return await(this.userContext?.refresh()),t}throw new error_ApiError("Vous n'avez pas d'invitation à valider.",404)}async removeFriend(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour supprimer un ami.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new error_ApiError("Vous n'êtes pas connecté à cette entité.",404);const t={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,connectType:e},r=await this.endpointApi.disconnect(t);return await(this.userContext?.refresh()),r}async requestToJoin(){throw new error_ApiError("l'utilisation de requestToJoin n'est pas autorisée sur un utilisateur.",403)}async requestToJoinAdmin(){throw new error_ApiError("l'utilisation de requestToJoinAdmin n'est pas autorisée sur un utilisateur.",403)}async acceptInvitation(){throw new error_ApiError("l'utilisation de acceptInvitation n'est pas autorisée sur un utilisateur.",403)}async leave(){throw new error_ApiError("l'utilisation de leave n'est pas autorisée sur un utilisateur.",403)}async follow(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour suivre un utilisateur.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userContext?.serverData?.links?.follows?.[this.id]){const e={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id},t=await this.endpointApi.follow(e);return await(this.userContext?.refresh()),t}throw new error_ApiError("Vous êtes déjà abonné à cet utilisateur.",409)}async unfollow(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour vous désabonner d'un utilisateur.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(this.userContext?.serverData?.links?.follows?.[this.id]){const e={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,connectType:"followers"},t=await this.endpointApi.disconnect(e);return await(this.userContext?.refresh()),t}throw new error_ApiError("Vous n'êtes pas abonné à cet utilisateur.",404)}isFriend(e){const t=e?.silent??!0;try{if(!this.isActingUser)throw new error_ApiError("Vous devez être connecté pour vérifier si vous êtes ami.",401)}catch(e){if(t)return!1;throw e}this._assertEntityType("citoyens");const r=this._getLinkFromConnectedUser();return!!r&&this._validateUserLink(r)}isFollower(e){const t=e?.silent??!0;try{if(!this.isActingUser)throw new error_ApiError("Vous devez être connecté pour vérifier si il vous suit.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404)}catch(e){if(t)return!1;throw e}return this._assertEntityType("citoyens"),this._isLinked("followers")}isFollowing(e){const t=e?.silent??!0;try{if(!this.isActingUser)throw new error_ApiError("Vous devez être connecté pour vérifier si vous le suivez.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404)}catch(e){if(t)return!1;throw e}return this._assertEntityType("citoyens"),this._isLinked("follows")}async entityBySlug(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer cet entité.",401);return super.entityBySlug(e)}_validateBasePreconditions(e,t){if(!this.userId)throw new error_ApiError(`Vous devez être connecté pour ${e}.`,401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.parent?.id)throw new error_ApiError("L'entité parente n'est pas enregistrée.",404);if(!t.includes(this.parent.getEntityType()))throw new error_ApiError(`L'entité doit être de type : ${t.join(", ")}, reçu : ${this.parent.getEntityType()}`,400)}_validateMemberPreconditions(e,t){if(this._validateBasePreconditions(e,t),!this.parent?.id)throw new error_ApiError("L'entité parente n'est pas enregistrée.",404);const r=this.parent.getEntityType();if("events"===r)return;let n=!1;switch(r){case"organizations":n=this.parent.isMember();break;case"projects":n=this.parent.isContributor();break;default:n=!1}if(!n)throw new error_ApiError(`Vous devez être ${{organizations:"membre",projects:"contributeur"}[r]||"membre"} pour effectuer cette action.`,401)}_validateAdminPreconditions(e,t){if(this._validateMemberPreconditions(e,t),!this.parent?.isAdmin())throw new error_ApiError("Vous devez être administrateur pour effectuer cette action.",401)}_getParentLinkForUser(){const{connectTypeDisconnect:e}=this.parent._getLinkMeta(),t=this.id;return t&&this.parent?.serverData?.links?.[e]?.[t]||null}_getValidatedParentLink(e,t,r){const n=r?.silent??!0;try{this._validateBasePreconditions(e,t)}catch(e){if(n)return null;throw e}return this._getParentLinkForUser()}async _refreshWithParent(){await this.refresh(),this.parent&&await this.parent.refresh()}isAdmin(e){const t=this._getValidatedParentLink("isAdmin",["organizations","projects"],{silent:e?.silent});return this._validateUserLink(t)&&!0===t?.isAdmin}isMember(e){const t=this._getValidatedParentLink("isMember",["organizations"],{silent:e?.silent});return this._validateUserLink(t)}isContributor(e){const t=this._getValidatedParentLink("isContributor",["projects"],{silent:e?.silent});return this._validateUserLink(t)}isAttendee(e){const t=this._getValidatedParentLink("isAttendee",["events"],{silent:e?.silent});return this._validateUserLink(t)}isInviting(e){const t=this._getValidatedParentLink("isInviting",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isInviting}isInvitingFriend(e){const t=this._getValidatedUserLink("isInvitingFriend",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isInviting}isInvitingAdmin(e){const t=this._getValidatedParentLink("isInvitingAdmin",["organizations","projects"],{silent:e?.silent});return!!t&&(!0===t.isAdminInviting||!0===t.isInviting)&&!0===t.isAdmin}isAdminPending(e){const t=this._getValidatedParentLink("isAdminPending",["organizations","projects"],{silent:e?.silent});return!!t&&!0===t.isAdmin&&!0===t.isAdminPending}isToBeValidated(e){const t=this._getValidatedParentLink("isToBeValidated",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.toBeValidated}isToBeValidatedFriend(e){const t=this._getValidatedUserLink("isToBeValidatedFriend",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.toBeValidated}async sendRequestToJoinParent({admin:e}={admin:!1}){e?this._validateAdminPreconditions("sendRequestToJoinParent",["organizations","projects"]):this._validateMemberPreconditions("sendRequestToJoinParent",["organizations","projects","events"]);const{connectTypeConnect:t}=this.parent._getLinkMeta(),r=this._getParentLinkForUser();if(!r){const r=this.parent.getEntityType(),n={childId:this.id,childType:"citoyens",parentType:r,parentId:this.parent.id,connectType:e?"admin":t},o=await this.callIsConnected(()=>this.endpointApi.connect(n));return await this._refreshWithParent(),o}if(r.isInviting||r?.isAdminInviting)throw new error_ApiError("Une invitation est déjà en attente d'acceptation.",400);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",400)}async validateMemberRequest(){this._validateAdminPreconditions("validateMemberRequest",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e?.toBeValidated)throw new error_ApiError("Cet utilisateur n'a pas de demande en attente de validation.",400);const t=this.parent.getEntityType(),r={childId:this.id,childType:"citoyens",parentType:t,parentId:this.parent.id,linkOption:"toBeValidated"},n=await this.callIsConnected(()=>this.endpointApi.linkValidate(r));return await this._refreshWithParent(),n}async validateAdminRequest(){this._validateAdminPreconditions("validateAdminRequest",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e?.isAdminPending)throw new error_ApiError("Cet utilisateur n'a pas de demande d'admin en attente.",400);const t=this.parent.getEntityType(),r={childId:this.id,childType:"citoyens",parentType:t,parentId:this.parent.id,linkOption:"isAdminPending"},n=await this.callIsConnected(()=>this.endpointApi.linkValidate(r));return await this._refreshWithParent(),n}async removeFromParent(){if(this._validateAdminPreconditions("removeFromParent",["organizations","projects"]),!this._getParentLinkForUser())throw new error_ApiError("Cet utilisateur n'est pas connecté à cette entité.",400);const e=this.parent.getEntityType(),{connectTypeDisconnect:t}=this.parent._getLinkMeta(),r={childId:this.id,childType:"citoyens",parentType:e,parentId:this.parent.id,connectType:t},n=await this.callIsConnected(()=>this.endpointApi.disconnect(r));return await this._refreshWithParent(),n}async promoteToAdmin(){this._validateAdminPreconditions("promoteToAdmin",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e)throw new error_ApiError("Cet utilisateur n'est pas membre de cette entité.",400);if(e?.isAdmin&&(e?.isInviting||e?.isAdminInviting))throw new error_ApiError("Cet utilisateur est déjà en cours d'invitation en tant qu'admin.",400);if(e?.isAdmin&&!e?.isInviting&&!e?.isAdminInviting)throw new error_ApiError("Cet utilisateur est déjà admin.",400);const t=this.parent.getEntityType(),r={childId:this.id,childType:"citoyens",parentType:t,parentId:this.parent.id,connectType:"admin"},n=await this.callIsConnected(()=>this.endpointApi.connect(r));return await this._refreshWithParent(),n}async demoteFromAdmin(){this._validateAdminPreconditions("demoteFromAdmin",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e?.isAdmin||e.isAdminPending)throw new error_ApiError("Cet utilisateur n'est pas admin de cette entité.",400);const t=this.parent.getEntityType(),{connectTypeDisconnect:r}=this.parent._getLinkMeta(),n=t,o={childId:this.id,childType:"citoyens",parentType:n,parentId:this.parent.id,connect:r,isAdmin:!1},i=await this.callIsConnected(()=>this.endpointApi.demoteAdmin(o));return await this._refreshWithParent(),i}}Object.assign(User.prototype,{});const re=e=>24===e.length&&/^[0-9a-f]*$/.test(e);class ObjectID{_str;constructor(e){if(this._str=void 0,e){if(e=e.toLowerCase(),!re(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new 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()}}const ne=ObjectID,oe={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:{additionalProperties:!1,properties:{reason:{default:"",type:"string"}},required:["reason"],type:"object"},common9:{reason:{default:"",type:"string"}},common10:{default:"",type:"string"},common11:{pattern:"^[a-f0-9]{24}$",type:"string"},common12:{const:"citoyens"},common13:{properties:{value:{type:"boolean"}}},common14:{value:{type:"boolean"}},common15:{enum:["isOpenData","isOpenEdition","private","feedback"]},common16:{const:"organizations"},common17:{const:"projects"},common18:{const:"events"},common19:{default:"citoyens",enum:["citoyens","projects","organizations","events"],type:"string"},common20:{},common21:{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"}}}},common22:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},common23:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common24:{properties:{typeElement:{const:"citoyens"}}},common25:{typeElement:{const:"citoyens"}},common26:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}},common27:{not:{type:"null"}},common28:{type:"null"},common29:{default:"citoyens",enum:["citoyens","projects","organizations","poi","events"],type:"string"},common30:{anyOf:[{format:"email",type:"string"},{const:"",type:"string"}]},common31:{const:"",type:"string"},common32:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common33:{items:{type:"string"},type:"array"},common34:{enum:[""],type:"string"},common35:{anyOf:[{format:"uri",type:"string"},{const:"",type:"string"}]},common36:{properties:{name:{not:{type:"null"}}},required:["name"]},common37:{name:{not:{type:"null"}}},common38:{properties:{url:{not:{type:"null"}}},required:["url"]},common39:{url:{not:{type:"null"}}},common40:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common41:{tags:{not:{type:"null"}}},common42:{properties:{email:{not:{type:"null"}}},required:["email"]},common43:{email:{not:{type:"null"}}},common44:{format:"date",type:"string"},common45:{const:"info",default:"info",type:"string"},common46:{anyOf:[{type:"string"},{const:"",type:"string"}]},common47:{$ref:"#/$defs/sharedFields/name"},common48:{$ref:"#/$defs/sharedFields/tags"},common49:{default:"citoyens",enum:["citoyens"],type:"string"},common50:{$ref:"#/$defs/sharedFields/url"},common51:{properties:{avancement:{not:{type:"null"}}},required:["avancement"]},common52:{avancement:{not:{type:"null"}}},common53:{properties:{parent:{not:{type:"null"}}},required:["parent"]},common54:{parent:{not:{type:"null"}}},common55:{$ref:"#/$defs/sharedFields/emailNullable"},common56:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},type:"object"},common57:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},common58:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"},common59:{name:{type:"string"},type:{type:"string"}},common60:{properties:{type:{not:{type:"null"}}},required:["type"]},common61:{type:{not:{type:"null"}}},common62:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common63:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},common64:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"},common65:{enum:["workshop","competition","concert","contest","conference","debate","exhibition","festival","crowdfunding","fair","course","protest","market","film","getTogether","meeting","spectacle","internship","stand","others"],type:"string"},common66:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common67:{enum:["link","tool","machine","software","rh","Resource material","Financial Ressource","ficheBlanche","geoJson","compostPickup","video","sharedLibrary","recoveryCenter","trash","history","something2See","funPlace","place","artPiece","streetArts","openScene","stand","parking","other"],type:"string"},common68:{enum:["poi"],type:"string"},common69:{$ref:"#/$defs/socialField"},common70:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common71:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common72:{id:{pattern:"^[a-f0-9]{24}$"}},common73:{pattern:"^[a-f0-9]{24}$"},common74:{oneOf:[{const:"",type:"string"},{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:{type:"string"},addressLocality:{type:"string"},codeInsee:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{minLength:0,type:"string"},level3Name:{minLength:0,type:"string"},level4:{minLength:0,type:"string"},level4Name:{minLength:0,type:"string"},localityId:{type:"string"},postalCode:{type:"string"},streetAddress:{type:"string"}},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"}]},common75:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:{type:"string"},addressLocality:{type:"string"},codeInsee:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{minLength:0,type:"string"},level3Name:{minLength:0,type:"string"},level4:{minLength:0,type:"string"},level4Name:{minLength:0,type:"string"},localityId:{type:"string"},postalCode:{type:"string"},streetAddress:{type:"string"}},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},common76:{"@type":{const:"PostalAddress",type:"string"},addressCountry:{type:"string"},addressLocality:{type:"string"},codeInsee:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{minLength:0,type:"string"},level3Name:{minLength:0,type:"string"},level4:{minLength:0,type:"string"},level4Name:{minLength:0,type:"string"},localityId:{type:"string"},postalCode:{type:"string"},streetAddress:{type:"string"}},common77:{const:"PostalAddress",type:"string"},common78:{minLength:0,type:"string"},common79:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},required:["latitude","longitude"],type:"object"},common80:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},common81:{const:"GeoCoordinates",type:"string"},common82:{type:["string","number"]},common83:{additionalProperties:!0,properties:{coordinates:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},float:{const:!0,default:!0,type:"boolean"},type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},common84:{coordinates:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},float:{const:!0,default:!0,type:"boolean"},type:{const:"Point",type:"string"}},common85:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},common86:{type:"number"},common87:{const:!0,default:!0,type:"boolean"},common88:{const:"Point",type:"string"},common89:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common90:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common91:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common92:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common93:{properties:{type:{const:"citoyens"}}},common94:{type:{const:"citoyens"}},common95:{additionalProperties:!1,else:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{folder:{const:"citoyens"}}},properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],then:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common96:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common97:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common98:{properties:{folder:{const:"citoyens"}}},common99:{folder:{const:"citoyens"}},common100:{folder:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},ownerId:{type:"string"}},common101:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},common102:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common103:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common104:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common105:{parentId:{pattern:"^[a-f0-9]{24}$"}},common106:{properties:{parentType:{const:"citoyens"}}},common107:{parentType:{const:"citoyens"}},common108:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common109:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common110:{default:!0,type:"boolean"},common111:{default:0,type:"integer"},common112:{required:["text"]},common113:{required:["mediaImg"]},common114:{required:["mediaFile"]},common115:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common116:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common117:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common118:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common119:{items:{properties:{count:{minimum:1,type:"integer"},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"},common120:{properties:{count:{minimum:1,type:"integer"},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"},common121:{count:{minimum:1,type:"integer"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common122:{minimum:1,type:"integer"},common123:{default:"public",enum:["public","private","restricted"],type:"string"},common124:{const:"news",default:"news",type:"string"},common125:{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"},common126:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common127:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common128:{default:!1,type:"boolean"},common129:{properties:{childId:{pattern:"^[a-f0-9]{24}$"}}},common130:{childId:{pattern:"^[a-f0-9]{24}$"}},common131:{properties:{childType:{const:"citoyens"}}},common132:{childType:{const:"citoyens"}},common133:{const:"share",default:"share",type:"string"},common134:{properties:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common135:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common136:{default:"news",enum:["news"],type:"string"},common137:{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"},common138:{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"},common139:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common140:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi","answers","forms"],type:"string"},common141:{const:!1,default:!1,type:"boolean"},common142:{const:"",default:"",type:"string"},common143:{default:0,type:"number"},common144:{default:30,type:"number"},common145:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},common146:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},common147:{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"},common148:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},common149:{enum:["cities","level1"],type:"string"},common150:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},type:"object"},common151:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},common152:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common153:{indexMax:{type:"number"},indexMin:{type:"number"}},common154:{enum:["ALL"],type:"string"},common155:{minimum:0,type:"integer"},common156:{default:0,minimum:0,type:"integer"},common157:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common158:{enum:["projects"],type:"string"},common159:{$exists:!0},common160:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common161:{$exists:{const:!0}},common162:{const:!0},common163:{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"},common164:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common165:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common166:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common167:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common168:{$exists:!1},common169:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common170:{$exists:{const:!1}},common171:{const:!1},common172:{default:30,type:"integer"},common173:{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"},common174:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common175:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common176:{$exists:{default:!1,type:"boolean"}},common177:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common178:{$in:{items:{type:"string"},minItems:1,type:"array"}},common179:{items:{type:"string"},minItems:1,type:"array"},common180:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common181:{enum:["citoyens"],type:"string"},common182:{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"},common183:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common184:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common185:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common186:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common187:{"^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"}},common188:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common189:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common190:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common191:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"},common192:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common193:{enum:["badges"],type:"string"},common194:{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"},common195:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common196:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common197:{$exists:{const:!0,type:"boolean"}},common198:{const:!0,type:"boolean"},common199:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common200:{$exists:{const:!1,type:"boolean"}},common201:{const:!1,type:"boolean"},common202:{"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"}},common203:{indexMax:30,indexMin:0},common204:{properties:{parentType:{const:"organizations"}}},common205:{parentType:{const:"organizations"}},common206:{properties:{parentType:{const:"projects"}}},common207:{parentType:{const:"projects"}},common208:{properties:{parentType:{const:"events"}}},common209:{parentType:{const:"events"}},common210:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common211:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common212:{enum:["citoyens","organizations","projects","events"],type:"string"},common213:{const:"citoyens",default:"citoyens",type:"string"},common214:{const:"@userId",default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common215:{minLength:3,type:"string"},common216:{enum:["Mo","Tu","We","Th","Fr","Sa","Su"],type:"string"},common217:{additionalProperties:!1,properties:{closes:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},opens:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"}},required:["opens","closes"],type:"object"},common218:{closes:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},opens:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"}},common219:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},common220:{default:{isOpenData:!0,isOpenEdition:!0},properties:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},required:["isOpenData","isOpenEdition"],type:"object"},common221:{isOpenData:!0,isOpenEdition:!0},common222:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},common223:{const:"projects",default:"projects",type:"string"},common224:{additionalProperties:!1,default:{"@userId":{type:"citoyens"}},patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common225:{"@userId":{type:"citoyens"}},common226:{type:"citoyens"},common227:{const:"poi",default:"poi",type:"string"},common228:{const:"events",default:"events",type:"string"},common229:{format:"date-time",type:"string"},common230:{type:"integer"},common231:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},type:{const:"citoyens",default:"citoyens",type:"string"}},required:["type","id"],type:"object"},common232:{id:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},type:{const:"citoyens",default:"citoyens",type:"string"}},common233:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},common234:{const:"badges",default:"badges",type:"string"},common235:{const:"badge",default:"badge",type:"string"},common236:{patternProperties:{"^[0-9a-f]{24}$":{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"}},type:"object"},common237:{"^[0-9a-f]{24}$":{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"}},common238:{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"},common239:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},common240:{default:"",enum:["","admin"],type:"string"},common241:{enum:["projects","organizations"],type:"string"},common242:{items:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi","answers","forms","classifieds"],type:"string"},type:"array"},common243:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi","answers","forms","classifieds"],type:"string"},common244:{default:"",oneOf:[{additionalProperties:!0,type:"object"},{const:"",type:"string"}]},common245:{additionalProperties:!0,type:"object"},common246:{additionalProperties:!0,properties:{tags:{additionalProperties:!0,properties:{verb:{type:"string"}},type:"object"}},type:"object"},common247:{tags:{additionalProperties:!0,properties:{verb:{type:"string"}},type:"object"}},common248:{additionalProperties:!0,properties:{verb:{type:"string"}},type:"object"},common249:{verb:{type:"string"}},common250:{additionalProperties:{enum:[1,-1],type:"integer"},type:"object"},common251:{enum:[1,-1],type:"integer"},common252:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},required:["id","type"],type:"object"},common253:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},common254:{default:"events",type:"string"},common255:{items:{properties:{id:{type:"string"}},required:["id"],type:"object"},type:"array"},common256:{properties:{id:{type:"string"}},required:["id"],type:"object"},common257:{id:{type:"string"}},common258:{additionalProperties:!1,properties:{contextId:{pattern:"^[a-f0-9]{24}$",type:"string"},contextType:{enum:["projects","organizations"],type:"string"},costumEditMode:{default:!1,type:"boolean"},costumSlug:{type:"string"},sourceKey:{items:{type:"string"},type:"array"}},type:"object"},common259:{contextId:{pattern:"^[a-f0-9]{24}$",type:"string"},contextType:{enum:["projects","organizations"],type:"string"},costumEditMode:{default:!1,type:"boolean"},costumSlug:{type:"string"},sourceKey:{items:{type:"string"},type:"array"}},common260:{items:{enum:["answers"],type:"string"},type:"array"},common261:{enum:["answers"],type:"string"},common262:{enum:["comments","news"],type:"string"},common263:{minLength:1,type:"string"},common264:{default:"citoyens",enum:["citoyens","organizations","projects","events","poi"],type:"string"},common265:{type:"array"},common266:{additionalProperties:!0,properties:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"},username:{type:"string"}},required:["username","costumSlug","costumId","costumType"],type:"object"},common267:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"},username:{type:"string"}},common268:{additionalProperties:!0,properties:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"}},required:["costumSlug","costumId","costumType"],type:"object"},common269:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"}}},ie={endpoints:[{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:oe.common1,email:oe.common2,isInvitation:oe.common3,mode:oe.common1,name:oe.common1,pendingUserId:oe.common1,pwd:oe.common1,username:oe.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:oe.common2,password:oe.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:oe.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:oe.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:oe.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:oe.common1,newPassword2:oe.common1,oldPassword:oe.common1,scope:{default:"",type:["string"]},userId:oe.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:oe.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:oe.common8},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{else:{properties:{idEntity:oe.common11}},if:{properties:{typeEntity:oe.common12}},then:{properties:{idEntity:oe.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:oe.common12}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:oe.common12}},then:oe.common13},{if:{properties:{type:oe.common15,typeEntity:oe.common16}},then:oe.common13},{if:{properties:{type:oe.common15,typeEntity:oe.common17}},then:oe.common13},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","public"]},typeEntity:oe.common18}},then:oe.common13}],properties:{idEntity:oe.common1,type:oe.common1,typeEntity:oe.common19,value:oe.common20},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:[oe.common21,{anyOf:[{properties:{description:oe.common27},required:["description"]},{properties:{shortDescription:oe.common27},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:oe.common10,description:oe.common1,id:oe.common1,scope:{default:"",type:["string","null"]},shortDescription:oe.common1,typeElement:oe.common29},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:oe.common2,emailNullable:oe.common30,name:oe.common1,tags:oe.common32,url:oe.common35}},allOf:[{if:oe.common24,then:{additionalProperties:!1,anyOf:[oe.common36,{properties:{birthDate:oe.common27},required:["birthDate"]},{properties:{fixe:oe.common27},required:["fixe"]},{properties:{mobile:oe.common27},required:["mobile"]},oe.common38,oe.common40,oe.common42],properties:{birthDate:{anyOf:[oe.common44,oe.common31]},block:oe.common45,email:{$ref:"#/$defs/sharedFields/email"},fixe:oe.common46,id:oe.common5,mobile:oe.common46,name:oe.common47,scope:oe.common10,tags:oe.common48,typeElement:oe.common49,url:oe.common50}}},{if:{properties:{typeElement:oe.common17}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common38,oe.common40,oe.common42,oe.common51,oe.common53],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:oe.common45,email:oe.common55,id:oe.common1,name:oe.common47,parent:oe.common56,scope:oe.common10,tags:oe.common48,typeElement:{default:"citoyens",enum:["projects"],type:"string"},url:oe.common50}}},{if:{properties:{typeElement:oe.common18}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common38,oe.common40,oe.common42,oe.common51,oe.common60,{properties:{organizer:oe.common27},required:["organizer"]},oe.common53],properties:{block:oe.common45,email:oe.common55,id:oe.common1,name:oe.common47,organizer:oe.common62,parent:oe.common56,scope:oe.common10,tags:oe.common48,type:oe.common65,typeElement:{default:"citoyens",enum:["events"],type:"string"},url:oe.common50}}},{if:{properties:{typeElement:oe.common16}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common38,oe.common40,oe.common42,oe.common60],properties:{block:oe.common45,email:oe.common55,id:oe.common1,name:oe.common47,scope:oe.common10,tags:oe.common48,type:oe.common66,typeElement:{enum:["organizations"],type:"string"},url:oe.common50}}},{if:{properties:{typeElement:{const:"poi"}}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common40,oe.common60,{properties:{urls:oe.common27},required:["urls"]}],properties:{block:oe.common45,id:oe.common1,name:oe.common47,scope:oe.common10,tags:oe.common48,type:oe.common67,typeElement:oe.common68,urls:oe.common32}}}],properties:{block:oe.common45,id:oe.common1,scope:oe.common10,typeElement:oe.common29},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:[oe.common34,oe.common4]}},allOf:[oe.common21,{anyOf:[{properties:{gitlab:oe.common27},required:["gitlab"]},{properties:{github:oe.common27},required:["github"]},{properties:{twitter:oe.common27},required:["twitter"]},{properties:{facebook:oe.common27},required:["facebook"]},{properties:{instagram:oe.common27},required:["instagram"]},{properties:{diaspora:oe.common27},required:["diaspora"]},{properties:{mastodon:oe.common27},required:["mastodon"]},{properties:{telegram:oe.common27},required:["telegram"]},{properties:{signal:oe.common27},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:oe.common69,facebook:oe.common69,github:oe.common69,gitlab:oe.common69,id:oe.common1,instagram:oe.common69,mastodon:oe.common69,scope:oe.common10,signal:oe.common69,telegram:oe.common69,twitter:oe.common69,typeElement:oe.common70},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:oe.common71,if:oe.common24,properties:{address:oe.common74,block:{const:"localities",default:"localities",type:"string"},geo:{oneOf:[oe.common31,oe.common79]},geoPosition:{oneOf:[oe.common31,oe.common83]},id:oe.common1,scope:oe.common10,typeElement:oe.common29},required:["block","typeElement","id","address"],then:oe.common89,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:oe.common71,if:oe.common24,properties:{block:oe.common45,id:oe.common1,scope:oe.common10,slug:oe.common92,typeElement:oe.common29},required:["block","typeElement","id","slug"],then:oe.common89,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:oe.common71,if:oe.common93,properties:{block:oe.common45,id:oe.common1,slug:oe.common92,type:oe.common19},required:["block","type","id","slug"],then:oe.common89,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:oe.common95,request:{additionalProperties:!1,properties:{profil_avatar:oe.common20},required:["profil_avatar"],type:"object"}},{auth:"bearer",constant:"PROFIL_BANNER",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/banner/docType/image/contentKey/banner",pathParams:oe.common95,request:{additionalProperties:!1,properties:{banner:oe.common20,cropH:oe.common86,cropW:oe.common86,cropX:oe.common86,cropY:oe.common86,formOrigin:{const:"banner",default:"banner"},parentId:oe.common11,parentType:oe.common101},required:["banner","parentId","parentType","formOrigin","cropW","cropH","cropX","cropY"],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,else:oe.common71,if:oe.common93,properties:{id:oe.common1,type:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi","badges","answers","classifieds","forms","actions"],type:"string"}},required:["type","id"],then:oe.common89,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,else:oe.common104,if:oe.common106,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:oe.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:oe.common1,parentType:oe.common70},required:["parentId","parentType","listInvite"],then:oe.common108,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:oe.common71,if:oe.common93,properties:{id:oe.common1,isLive:oe.common110,type:oe.common70},required:["isLive","type","id"],then:oe.common89,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:oe.common111,indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:oe.common10},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:oe.common11,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:[oe.common112,oe.common113,oe.common114],else:oe.common104,if:oe.common106,properties:{json:oe.common87,markdownActive:oe.common110,mediaFile:oe.common115,mediaImg:oe.common117,mentions:oe.common119,parentId:oe.common1,parentType:oe.common70,scope:oe.common123,tags:oe.common32,text:oe.common1,type:oe.common124},required:["scope","markdownActive","parentId","parentType","type","json"],then:oe.common108,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:oe.common125,request:{additionalProperties:!1,properties:{newsImage:oe.common20},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:oe.common125,request:{additionalProperties:!1,properties:{newsFile:oe.common20},required:["newsFile"],type:"object"}},{auth:"bearer",constant:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/delete/id/{id}",pathParams:oe.common127,request:{additionalProperties:!1,properties:{isLive:oe.common128},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:[oe.common112,oe.common113,oe.common114],else:oe.common104,if:oe.common106,properties:{idNews:oe.common11,markdownActive:oe.common110,mediaFile:oe.common115,mediaImg:oe.common117,mentions:oe.common119,parentId:oe.common1,parentType:oe.common70,scope:oe.common123,tags:oe.common32,text:oe.common1,type:oe.common124},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:oe.common108,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:oe.common129,if:oe.common131,properties:{childId:oe.common11,childType:oe.common70,comment:oe.common1,connectType:oe.common133,parentId:oe.common11,parentType:oe.common124},required:["parentId","parentType","childId","childType","connectType"],then:oe.common134,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:{additionalProperties:!1,properties:{id:oe.common11,type:oe.common136},required:["type","id"],type:"object"}},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:oe.common10,contextId:oe.common11,contextType:oe.common136,mentions:oe.common137,parentCommentId:{default:"",pattern:"^([a-f0-9]{24}|)$",type:"string"},path:oe.common10,text:oe.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:oe.common127},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:oe.common11,params:{properties:{mentions:oe.common137,text:oe.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:oe.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:{additionalProperties:!1,properties:{id:oe.common11,type:{default:"news",enum:["news","comments"],type:"string"}},required:["type","id"],type:"object"}},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:oe.common87,countType:{default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:oe.common140,type:"array"},fediverse:oe.common141,filters:oe.common142,indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common145,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchTags:oe.common33,searchType:{items:oe.common140,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:oe.common155,locality:oe.common142,name:oe.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:"CITY_AUTOCOMPLETE_BY_COUNTRY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/city/autocompletemultiscope",request:{additionalProperties:!1,properties:{countryCode:{default:"FR",type:"string"},formInMap:oe.common128,scopeValue:oe.common1,type:{enum:["locality"],type:"string"}},required:["type","countryCode","scopeValue","formInMap"],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:oe.common156,name:oe.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:oe.common87,countType:oe.common157,fediverse:oe.common141,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":oe.common159,"parent.@userId":oe.common159},"links.contributors.@userId":oe.common159},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"}},required:["$or"],type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common157},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:oe.common163,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common157,fediverse:oe.common141,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":oe.common159,"parent.@{pathParams.id}":oe.common159},"links.contributors.@{pathParams.id}":oe.common159},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},type:"object"}},required:["$or"],type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common157},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:oe.common87,countType:oe.common165,fediverse:oe.common141,filters:{additionalProperties:!1,default:{"parent.@userId":oe.common159},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common165},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:oe.common163,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common165,fediverse:oe.common141,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":oe.common159},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common165},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:oe.common87,countType:oe.common166,fediverse:oe.common141,filters:{additionalProperties:!1,default:{"links.members.@userId":oe.common159,"links.members.@userId.isInviting":oe.common168,"links.members.@userId.toBeValidated":oe.common168},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common169,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common166},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:oe.common71,if:oe.common93,properties:{id:oe.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:oe.common89,type:"object"},request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common166,fediverse:oe.common141,filters:{additionalProperties:!0,default:{"links.members.@{pathParams.id}":oe.common159,"links.members.@{pathParams.id}.isInviting":oe.common168,"links.members.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common169,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common166},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:oe.common87,countType:oe.common173,fediverse:oe.common141,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+)$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common175,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":oe.common177,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common173},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:oe.common127,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common173,fediverse:oe.common141,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}":oe.common159,"links.memberOf.@{pathParams.id}.isInviting":oe.common168,"links.memberOf.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":oe.common177,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common173},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:oe.common6,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common180,fediverse:oe.common141,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}":oe.common159,"links.friends.@{pathParams.id}.isInviting":oe.common168,"links.friends.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchType:oe.common180},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:oe.common87,countType:oe.common182,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common184],default:{"links.followers.@userId":oe.common159,"links.followers.@{userId}.isInviting":oe.common168,"links.followers.@{userId}.toBeValidated":oe.common168},patternProperties:oe.common187,type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common182},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:oe.common6,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common182,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common184],default:{"links.followers.@{pathParams.id}":oe.common159,"links.followers.@{pathParams.id}.isInviting":oe.common168,"links.followers.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:oe.common187,type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common182},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:oe.common87,countType:oe.common180,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common188],default:{"links.follows.@userId":oe.common159,"links.follows.@{userId}.isInviting":oe.common168,"links.follows.@{userId}.toBeValidated":oe.common168},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common169,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},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:oe.common71,if:oe.common93,then:oe.common89}],properties:{id:oe.common1,type:oe.common191},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common180,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common188],default:{"links.follows.@{pathParams.id}":oe.common159},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},type:"object"},indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,searchType:oe.common180},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_CONTRIBUTORS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common173,fediverse:oe.common141,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+)$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common175,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":oe.common177,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common173},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:oe.common127,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common173,fediverse:oe.common141,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}":oe.common159,"links.projects.@{pathParams.id}.isInviting":oe.common168,"links.projects.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":oe.common177,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common173},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:oe.common87,countType:oe.common192,fediverse:oe.common141,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"},isParcours:oe.common3,"preferences.private":oe.common141},required:["preferences.private"],type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common192},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:oe.common87,countType:oe.common194,fediverse:oe.common141,fields:oe.common192,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common196}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common196,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":oe.common199,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":oe.common199}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:oe.common202},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:oe.common202,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":oe.common198}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":oe.common196}}],type:"object"},indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:{additionalProperties:!1,default:{Cooperative:oe.common203,GovernmentOrganization:oe.common203,Group:oe.common203,LocalBusiness:oe.common203,NGO:oe.common203,citoyens:oe.common203,projects:oe.common203},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":oe.common152},type:"object"},searchType:oe.common194},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:{additionalProperties:!1,allOf:[{if:oe.common106,then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:oe.common204,then:{properties:{connectType:{enum:["admin","member"]}}}},{if:oe.common206,then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:oe.common208,then:{properties:{connectType:{default:"attendee",enum:["attendee","connect"]}}}}],properties:{childId:oe.common210,childType:oe.common211,connectType:{enum:["admin","member","contributor","attendee","friend","connect"],type:"string"},parentId:oe.common11,parentType:oe.common212},required:["childId","childType","parentType","parentId","connectType"],type:"object"}},{auth:"bearer",constant:"DISCONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/disconnect",request:{additionalProperties:!1,allOf:[{if:oe.common106,then:{properties:{connectType:{default:"friends",enum:["friends","followers"]}}}},{if:oe.common204,then:{properties:{connectType:{default:"members",enum:["members","followers"]}}}},{if:oe.common206,then:{properties:{connectType:{default:"contributors",enum:["contributors","followers"]}}}},{if:oe.common208,then:{properties:{connectType:{default:"attendees",enum:["attendees","followers"]}}}}],properties:{childId:oe.common210,childType:oe.common211,connectType:{enum:["members","contributors","attendees","friends","followers"],type:"string"},parentId:oe.common11,parentType:oe.common212},required:["childId","childType","parentType","parentId","connectType"],type:"object"}},{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"}},{auth:"bearer",constant:"GET_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/app/config/type/citoyens/id/{id}/json/true",pathParams:oe.common6},{auth:"bearer",constant:"DELETE_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue?index={index}",pathParams:{properties:{index:oe.common86},type:"object"},request:{additionalProperties:!1,properties:{collection:oe.common213,id:oe.common214,path:{const:"preferences.search.@{pathParams.index}",default:"preferences.search.@{pathParams.index}",type:"string"},pull:{const:"preferences.search",type:"string"},value:oe.common142},required:["id","collection","path","pull","value"],type:"object"}},{auth:"bearer",constant:"ADD_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue",request:{additionalProperties:!1,properties:{arrayForm:oe.common198,collection:oe.common213,id:oe.common214,path:{const:"preferences.search",default:"preferences.search",type:"string"}},required:["id","collection","path","arrayForm","value"],type:"object"}},{auth:"bearer",constant:"ADD_ORGANIZATION",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!0,properties:{address:oe.common75,buildingSurfaceArea:oe.common86,collection:{const:"organizations",default:"organizations",type:"string"},compagnon:oe.common1,costum:{additionalProperties:!0,properties:{bannerImageUrl:oe.common1,bannerLogoUrl:oe.common1,bannerText:oe.common1,cocity:oe.common128,slug:oe.common1,transparentCommune:oe.common128,typeCocity:oe.common1},required:[],type:"object"},costumEditMode:oe.common3,costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,description:oe.common1,email:oe.common2,filiere:{additionalProperties:{additionalProperties:!1,properties:{icon:oe.common1,name:oe.common1,tags:oe.common33},required:["name","icon","tags"],type:"object"},type:"object"},geo:oe.common79,geoPosition:oe.common83,holderOrganization:oe.common1,id:oe.common11,key:{const:"organization",default:"organization",type:"string"},mainTag:oe.common1,manageModel:oe.common1,name:oe.common215,openingDate:oe.common1,openingHours:{items:{oneOf:[oe.common31,{additionalProperties:!1,properties:{dayOfWeek:oe.common216,hours:{items:oe.common217,type:"array"}},required:["dayOfWeek","hours"],type:"object"}]},maxItems:7,minItems:7,type:"array"},preferences:oe.common220,role:{enum:["admin","member"],type:"string"},scope:oe.common142,shortDescription:oe.common1,siteSurfaceArea:oe.common86,source:{properties:{insertOrign:oe.common1,key:oe.common1,keys:oe.common33},type:"object"},tags:oe.common33,telephone:oe.common1,thematic:oe.common33,type:oe.common66,typePlace:oe.common1,url:oe.common35,video:oe.common33},required:["id","collection","key","name","type","role","scope"],type:"object"}},{auth:"bearer",constant:"ADD_PROJECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,properties:{address:oe.common75,collection:oe.common223,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:{const:"project",default:"project",type:"string"},name:oe.common1,parent:oe.common224,preferences:{default:{crowdfunding:!0,isOpenData:!1,isOpenEdition:!1},properties:{crowdfunding:oe.common110,isOpenData:oe.common128,isOpenEdition:oe.common128},required:["isOpenData","isOpenEdition"],type:"object"},public:oe.common110,scope:oe.common142,shortDescription:oe.common1,tags:oe.common33,url:oe.common35},required:["id","collection","key","parent","name","public","scope"],type:"object"}},{auth:"bearer",constant:"ADD_POI",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,properties:{address:oe.common75,collection:oe.common227,description:oe.common1,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:oe.common227,name:oe.common1,parent:oe.common224,scope:oe.common142,tags:oe.common33,type:oe.common67,urls:oe.common33},required:["id","collection","key","parent","type","name"],type:"object"}},{auth:"bearer",constant:"ADD_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,else:{required:["openingHours"]},if:{properties:{recurrency:oe.common171}},properties:{address:oe.common74,collection:oe.common228,email:oe.common30,endDate:oe.common229,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:{const:"event",default:"event",type:"string"},name:{minLength:2,type:"string"},openingHours:{default:["","","","","","",""],items:{anyOf:[oe.common31,{additionalProperties:!1,properties:{dayOfWeek:oe.common216,hours:{default:[],items:oe.common217,type:"array"}},required:["dayOfWeek","hours"],type:"object"}]},maxItems:7,minItems:7,type:"array"},organizer:oe.common224,parent:{oneOf:[oe.common62,oe.common31]},preferences:{default:{isOpenData:!1,isOpenEdition:!1},properties:{isOpenData:oe.common128,isOpenEdition:oe.common128},required:["isOpenData","isOpenEdition"],type:"object"},public:oe.common110,recurrency:oe.common128,scope:oe.common142,shortDescription:{format:"textarea",type:"string"},startDate:oe.common229,tags:{anyOf:[oe.common33,oe.common31]},timeZone:oe.common1,type:oe.common65,url:oe.common35},required:["id","collection","key","organizer","type","name","scope"],startBeforeEnd:!0,then:{required:["startDate","endDate"]},type:"object"}},{auth:"bearer",constant:"DELETE_POI",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/poi/id/{id}",pathParams:oe.common127,request:oe.common8},{auth:"bearer",constant:"DELETE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/events/id/{id}/",pathParams:oe.common127,request:oe.common8},{auth:"bearer",constant:"DELETE_ELEMENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/{type}/id/{id}",pathParams:{additionalProperties:!1,properties:{id:oe.common11,type:oe.common1},required:["type","id"],type:"object"},request:oe.common8},{auth:"bearer",constant:"ADD_IMAGE_ELEMENT",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/qqfile/docType/image/contentKey/profil",pathParams:{additionalProperties:!1,properties:{folder:{enum:["badges","events"],type:"string"},ownerId:oe.common11},required:["folder","ownerId"],type:"object"},request:{additionalProperties:!1,properties:{qqfile:oe.common20,qqfilename:oe.common1,qqtotalfilesize:oe.common230,qquuid:oe.common11},required:["qquuid","qqfilename","qqtotalfilesize","qqfile"],type:"object"}},{auth:"bearer",constant:"LINK_VALIDATE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/validate",request:{additionalProperties:!1,properties:{childId:oe.common5,childType:oe.common49,linkOption:{enum:["isInviting","toBeValidated","isAdminPending"],type:"string"},parentId:oe.common11,parentType:oe.common212},required:["childId","childType","parentType","parentId"],type:"object"}},{auth:"none",constant:"SEARCH_MEMBER_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/searchmemberautocomplete",request:{additionalProperties:!1,properties:{search:oe.common1,searchMode:{default:"personOnly",enum:["personOnly","organizationOnly","mixte"],type:"string"}},required:["search","searchMode"],type:"object"}},{auth:"bearer",constant:"GET_NOTIFICATIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/getnotifications/type/{type}/id/{id}",pathParams:oe.common231,request:{additionalProperties:!1,properties:{indexMin:oe.common111},type:"object"}},{auth:"bearer",constant:"GET_NOTIFICATIONS_COUNT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/getnotifications/type/{type}/id/{id}",pathParams:oe.common231,request:{additionalProperties:!1,properties:{refreshTimestamp:oe.common230},type:"object"}},{auth:"bearer",constant:"NOTIFICATION_UPDATE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/update",request:{additionalProperties:!1,properties:{action:{enum:["seen","read"],type:"string"},all:oe.common87},required:["action","all"],type:"object"}},{auth:"bearer",constant:"REMOVE_ALL_NOTIFICATIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/removeall"},{auth:"bearer",constant:"MARK_NOTIFICATION_AS_READ",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/marknotificationasread",request:oe.common127},{auth:"none",constant:"ACTIVITYPUB_SEARCH",contentType:"application/x-www-form-urlencoded",method:"GET",params:[oe.common20],path:"/api/activitypub/search?address={address}",pathParams:{additionalProperties:!1,properties:{address:oe.common1},required:["address"],type:"object"}},{auth:"bearer",constant:"ACTIVITYPUB_LINK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/activitypub/link",request:{additionalProperties:!1,properties:{action:{enum:["undo_follow","accept_invitation","reject_invitation","undo_accept","undo_request_follow","follow","remove_follow","accept_follower","reject_follower","remove_follower","remove_invitation"],type:"string"},actor:{additionalProperties:!1,properties:{id:oe.common1,name:oe.common1,type:{enum:["person"],type:"string"}},required:["id","type","name"],type:"object"},payload:oe.common4},required:["action","payload","actor"],type:"object"}},{auth:"none",constant:"ACTIVITYPUB_GET_COMMUNITY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/activitypub/getcommunity/userId/${userId}/type/${type}/actor/person",pathParams:{additionalProperties:!1,properties:{type:{enum:["follows","followers"],type:"string"},userId:oe.common11},required:["userId","type"],type:"object"}},{auth:"none",constant:"GET_BADGE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/app/page/type/badges/id/{id}/json/true",pathParams:oe.common127},{auth:"none",constant:"GET_EMETTEUR_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/app/badge/json/true"},{auth:"bearer",constant:"ADD_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,properties:{collection:oe.common234,criteria:{additionalProperties:!1,properties:{narrative:oe.common1},required:["narrative"],type:"object"},description:oe.common1,id:oe.common11,isParcours:oe.common128,issuer:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:oe.common1,type:{enum:["citoyens","organizations","projects"],type:"string"}},required:["type"],type:"object"}},type:"object"},key:oe.common235,name:oe.common1,parent:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{additionalProperties:!1,properties:{name:oe.common1,type:oe.common234},required:["type"],type:"object"}},type:"object"},preferences:oe.common220,public:oe.common110,scope:oe.common142,tags:oe.common33},required:["id","collection","key","name","public","scope","issuer","criteria"],type:"object"}},{auth:"bearer",constant:"ASSIGN_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/badges/assign",request:{additionalProperties:!1,properties:{award:{patternProperties:{"^[0-9a-f]{24}$":oe.common58},type:"object"},badgeId:oe.common11,collection:oe.common234,evidences:{items:{additionalProperties:!1,properties:{narative:oe.common1,url:oe.common4},required:["narative"],type:"object"},type:"array"},key:oe.common235,narative:oe.common1,scope:oe.common142},required:["key","collection","badgeId","award"],type:"object"}},{auth:"none",constant:"GET_EVENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/agenda",request:{additionalProperties:!0,properties:{count:oe.common128,countType:{const:["events"],default:["events"],type:"array"},endDateUTC:oe.common229,fediverse:oe.common128,filters:{additionalProperties:!1,default:{$or:{"links.attendees.@userId":oe.common159,"organizer.@userId":oe.common159},"links.attendees.@userId":oe.common159},patternProperties:{"^links\\.attendees\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.attendees\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^organizer\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"}},required:["$or"],type:"object"},indexMin:oe.common111,indexStep:{default:100,type:"integer"},locality:{patternProperties:{"^[^\\s]+$":{type:"object"}},type:"object"},name:oe.common1,recurrency:oe.common110,searchType:{const:["events"],default:["events"],items:{enum:["events"],type:"string"},type:"array"},startDateUTC:oe.common229,type:oe.common65},required:["searchType","indexMin","indexStep","fediverse"],type:"object"}},{auth:"bearer",constant:"SHARE_EVENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:oe.common129,if:oe.common131,properties:{childId:oe.common11,childType:oe.common70,comment:oe.common1,connectType:oe.common133,parentId:oe.common11,parentType:oe.common228},required:["parentId","childId","childType","connectType","parentType"],then:oe.common134,type:"object"}},{auth:"bearer",constant:"INVITE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:oe.common104,if:oe.common106,properties:{listInvite:{additionalProperties:!1,minProperties:1,properties:{citoyens:oe.common236,invites:{patternProperties:{"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$":{additionalProperties:!1,properties:{email:oe.common2,isAdmin:oe.common240,msg:oe.common1,name:oe.common1,roles:oe.common33},required:["name","email"],type:"object"}},type:"object"},organizations:oe.common236,projects:oe.common236},type:"object"},parentId:oe.common1,parentType:oe.common70},required:["parentId","parentType","listInvite"],then:oe.common108,type:"object"}},{auth:"bearer",constant:"FOLLOW",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/follow",request:{additionalProperties:!1,properties:{childId:oe.common210,childType:oe.common211,parentId:oe.common11,parentType:oe.common212},required:["childId","childType","parentType","parentId"],type:"object"}},{auth:"none",constant:"GET_COSTUM_JSON",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/cms/getcostumjson?slug={slug}",pathParams:{slug:oe.common1}},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE_COSTUM",contentType:"application/x-www-form-urlencoded",functionCocostum:"globalautocomplete",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,count:oe.common87,countType:oe.common242,fediverse:oe.common128,fields:oe.common33,filters:oe.common244,indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:oe.common1,type:{enum:["cities","level1","level2","level3","level4","level5"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},mapUsed:oe.common198,name:oe.common1,notSourceKey:oe.common198,options:oe.common246,ranges:oe.common150,searchBy:oe.common154,searchTags:oe.common33,searchType:oe.common242,sortBy:oe.common250,sourceKey:oe.common33},required:["searchType","countType","indexMin","indexStep","initType","count","fediverse","costumSlug","costumEditMode"],type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_ACTORS",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestActors",method:"POST",path:"/costum/coevent/get_events/request/actors/id/{id}/type/{type}",pathParams:oe.common252,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,parent_only:oe.common3,sourceKey:oe.common33,types:{items:{enum:["organizer","links.attendees","creator","links.creator","links.organizer","organizerName","animator"],type:"string"},type:"array"}},type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_SUBEVENTS",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestSubevents",method:"POST",path:"/costum/coevent/get_events/request/subevents/id/{id}/type/{type}",pathParams:oe.common252,request:{additionalProperties:!1,allOf:[{if:{properties:{date:oe.common1},required:["date"]},then:{required:["timezone"]}}],properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,date:{oneOf:[oe.common1,{properties:{between:{properties:{end:oe.common44,start:oe.common44},required:["start","end"],type:"object"}},required:["between"],type:"object"}]},fromToday:oe.common3,regions:oe.common255,sourceKey:oe.common33,tags:oe.common33,timezone:oe.common1,type:oe.common1},type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_ELEMENT_EVENT",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestElementEvent",method:"POST",path:"/costum/coevent/get_events/request/element_event/id/{id}/type/{type}",pathParams:oe.common252,request:oe.common258},{auth:"none",constant:"COSTUM_EVENT_REQUEST_CATEGORIES",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestCategories",method:"POST",path:"/costum/coevent/get_events/request/categories/id/{id}/type/{type}",pathParams:oe.common252,request:oe.common258},{auth:"none",constant:"COSTUM_EVENT_REQUEST_DATES",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestDates",method:"POST",path:"/costum/coevent/get_events/request/dates/id/{id}/type/{type}",pathParams:oe.common252,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,regions:oe.common255,sourceKey:oe.common33,tags:oe.common33,type:oe.common1},type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_EVENT",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestEvent",method:"POST",path:"/costum/coevent/get_events/request/event/id/{id}/type/{type}",pathParams:oe.common252,request:oe.common258},{auth:"none",constant:"COSTUM_EVENT_REQUEST_LINK_TL_TO_EVENT",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestLinkTlToEvent",method:"POST",path:"/costum/coevent/get_events/request/link_tl_to_event/id/{id}/type/{type}",pathParams:oe.common252,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,event:oe.common1,sourceKey:oe.common33,tl:oe.common1},required:["tl","event"],type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_LOAD_CONTEXT_TAG",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestLoadContextTag",method:"POST",path:"/costum/coevent/get_events/request/load_context_tag/id/{id}/type/{type}",pathParams:oe.common252,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,event:oe.common11,search:oe.common1,sourceKey:oe.common33},type:"object"}},{auth:"none",constant:"GET_GALLERY",contentType:"application/x-www-form-urlencoded",functionCocostum:"",method:"POST",path:"/co2/gallery/index/type/{type}/id/{id}/docType/{docType}/tpl/json",pathParams:{additionalProperties:!1,else:oe.common71,if:oe.common93,properties:{docType:{default:"image",enum:["image","file","bookmarks"],type:"string"},id:oe.common1,type:oe.common191},required:["id","type","docType"],then:oe.common89,type:"object"},request:{additionalProperties:!1,properties:{contentKey:oe.common1,folderId:oe.common1},type:"object"}},{auth:"none",constant:"GET_ATTENDEES_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common180,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.events\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common175,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":oe.common177,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_ATTENDEES_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/events/id/{id}/canSee/true",pathParams:oe.common127,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common180,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.events.@{pathParams.id}":oe.common159,"links.events.@{pathParams.id}.isInviting":oe.common168,"links.events.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":oe.common177,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"COFORM_ANSWERS_SEARCH",contentType:"application/x-www-form-urlencoded",functionCocostum:"answerlist",method:"POST",path:"/survey/coform/answerslist",request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common241,costumEditMode:oe.common128,costumSlug:oe.common1,count:oe.common87,countType:oe.common260,fediverse:oe.common128,fields:oe.common33,filters:oe.common244,indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common145,mapUsed:oe.common198,name:oe.common1,notSourceKey:oe.common198,options:oe.common246,ranges:oe.common150,searchBy:oe.common154,searchTags:oe.common33,searchType:oe.common260,sortBy:oe.common250,sourceKey:oe.common33},required:["searchType","countType","indexMin","indexStep","initType","count","fediverse"],type:"object"}},{auth:"none",constant:"COFORM_ANSWERS_BY_ID",contentType:"application/x-www-form-urlencoded",functionCocostum:"findanswered",method:"POST",path:"/survey/coform/findanswered",request:{additionalProperties:!1,properties:{answerId:oe.common1,fields:oe.common33,finderPath:oe.common10,formId:oe.common1},required:["answerId"],type:"object"}},{auth:"none",constant:"GET_COFORM_BY_ID",contentType:"application/x-www-form-urlencoded",functionCocostum:"getformbyid",method:"POST",path:"/survey/coform/getformbyid",request:{additionalProperties:!1,properties:{parentFormId:oe.common11},required:["parentFormId"],type:"object"}},{auth:"bearer",constant:"COFORM_UPLOAD_ANSWER_FILE",contentType:"multipart/form-data",method:"POST",path:"/survey/coform/uploadanswerfile",request:{additionalProperties:!1,properties:{answerId:oe.common11,contentKey:{default:"slider",type:"string"},docType:{default:"image",enum:["image","file"],type:"string"},formId:oe.common11,qqfile:oe.common245,qqfilename:oe.common1,qqtotalfilesize:oe.common86,qquuid:oe.common1,subKey:oe.common1},required:["formId","qquuid","qqfilename","qqtotalfilesize","qqfile"],type:"object"}},{auth:"bearer",constant:"COFORM_GET_ANSWER_FILES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/survey/coform/getanswerfiles",request:{additionalProperties:!1,properties:{answerId:oe.common11,contentKey:{default:"presentation",type:"string"},docType:{default:"file",enum:["image","file"],type:"string"},subKey:oe.common1},required:["answerId","subKey"],type:"object"}},{auth:"bearer",constant:"SAVE_COFORM_ANSWER",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/survey/coform/saveanswer",request:{additionalProperties:!1,properties:{addedOptions:oe.common1,answerId:oe.common11,answers:oe.common1,formId:oe.common11,links:oe.common1},required:["formId","answers"],type:"object"}},{auth:"bearer",constant:"ADD_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/addaction",request:{additionalProperties:!1,properties:{action:{const:"vote",default:"vote",type:"string"},collection:oe.common262,details:{additionalProperties:!1,properties:{status:oe.common1},required:["status"],type:"object"},id:oe.common11},required:["id","collection","action","details"],type:"object"}},{auth:"bearer",constant:"ADD_REPORT_ABUSE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/addaction",request:{additionalProperties:!1,properties:{action:{const:"reportAbuse",default:"reportAbuse",type:"string"},collection:oe.common262,details:{additionalProperties:!1,properties:{comment:oe.common1,reason:oe.common1},required:["reason"],type:"object"},id:oe.common11},required:["id","collection","action","details"],type:"object"}},{auth:"bearer",constant:"UPDATE_PATH_VALUE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue",request:{additionalProperties:!1,allOf:[{if:{required:["pull"]},then:{properties:{value:oe.common1}}}],properties:{arrayForm:oe.common3,collection:{default:"citoyens",enum:["citoyens","organizations","projects","events","poi","answers","forms","actions"],type:"string"},id:oe.common5,path:oe.common1,pull:oe.common1,setType:{anyOf:[oe.common263,{items:{additionalProperties:!1,properties:{path:oe.common1,type:oe.common1},required:["path","type"],type:"object"},type:"array"}]},value:{type:["string","number","boolean","object","array","null"]}},required:["id","collection","path","value"],type:"object"}},{auth:"bearer",constant:"DELETE_DOCUMENT_BY_CONTEXT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/document/delete/dir/co2/contextType/{contextType}/contextId/{contextId}",pathParams:{additionalProperties:!1,properties:{contextId:oe.common5,contextType:oe.common264},required:["contextType","contextId"],type:"object"},request:{additionalProperties:!1,properties:{ids:oe.common11,parentId:oe.common5,parentType:oe.common264,path:{const:"communecter",default:"communecter",type:"string"}},required:["id","collection","path","value"],type:"object"}},{auth:"bearer",constant:"DELETE_DOCUMENT_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/document/deletedocumentbyid/id/{id}",pathParams:oe.common127},{auth:"bearer",constant:"DEMOTE_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/updateadminlink/",request:{additionalProperties:!1,properties:{childId:oe.common11,childType:oe.common181,connect:{enum:["members","contributors"],type:"string"},isAdmin:oe.common141,parentId:oe.common11,parentType:{enum:["organizations","projects"],type:"string"}},required:["parentId","parentType","childId","childType","connect","isAdmin"],type:"object"}},{constant:"COSTUM_FILTER_COFORM",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/costum/francetierslieux/autoglobalthematicntwrk",request:{properties:{costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,searchedData:oe.common245},type:"object"}},{auth:"none",constant:"GET_COUNTRIES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/opendata/getcountries",request:{additionalProperties:!1,properties:{costumEditMode:{oneOf:[{enum:["true","false"],type:"string"},{enum:[0,1],type:"number"},oe.common3]},costumId:oe.common11,costumSlug:oe.common1,costumType:{enum:["organizations","projects","events","citoyens","poi"],type:"string"}},type:"object"}},{constant:"SEARCH_ZONES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/getzone",request:{properties:{costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,countryCode:oe.common265,level:oe.common265,sortBy:oe.common1,upperLevelId:oe.common1},required:["countryCode","level"],type:"object"}},{auth:"none",constant:"COFORM_ANSWERS_BY_FORMS",contentType:"application/x-www-form-urlencoded",functionCocostum:"findanswers",method:"POST",path:"/costum/francetierslieux/getallanswersbyforms",request:{properties:{forms:{patternProperties:{"^[a-fA-F0-9]{24}$":oe.common1},type:"object"}},type:"object"}},{auth:"none",constant:"GENERATE_ANSWER_FROM_FORM",contentType:"application/x-www-form-urlencoded",functionCocostum:"generateanswerfromform",method:"POST",path:"/survey/answer/newanswer/form/{formId}",pathParams:{additionalProperties:!1,properties:{formId:oe.common11},required:["formId"],type:"object"},request:{properties:{action:oe.common1},type:"object"}},{auth:"none",constant:"FUNDING_ENVELOPE",contentType:"application/x-www-form-urlencoded",functionCocostum:"fundingenvelope",method:"POST",path:"/co2/aap/fundingenvelope",request:{additionalProperties:!0,properties:{action:oe.common1,answer:oe.common11,contextId:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},contextType:oe.common1,financerId:oe.common11,financerType:oe.common1,formId:oe.common11,params:oe.common245,project:oe.common11},required:["contextId","contextType"],type:"object"}},{auth:"none",constant:"COREMU_OPERATION",contentType:"application/x-www-form-urlencoded",functionCocostum:"coremuoperation",method:"POST",path:"/co2/aap/coremuoperation/",request:{additionalProperties:!0,properties:{action:{const:"generateproposition",type:"string"},answer:{const:"new",type:"string"},form:oe.common11,project:oe.common11},required:["form","answer","action","project"],type:"object"}},{auth:"bearer",constant:"COSTUM_PROJECT_ACTION_REQUEST_NEW",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumProjectActionRequestNew",method:"POST",path:"/costum/project/action/request/new",request:{additionalProperties:!1,properties:{assign:oe.common11,credits:{default:1,minimum:0,type:"number"},endDate:oe.common229,idParentRoom:oe.common11,importance:{default:"low",type:"string"},is_contributor:oe.common3,max:oe.common155,mentions:oe.common33,milestone:{additionalProperties:!1,properties:{endDate:oe.common229,milestoneId:oe.common11,startDate:oe.common229},required:["milestoneId"],type:"object"},min:oe.common155,name:oe.common1,parentId:oe.common11,parentType:oe.common223,startDate:oe.common229,status:{default:"todo",enum:["todo","done","tracking","discuter","next","totest","disabled","closed"],type:"string"},tags:oe.common33,timeSpent:oe.common155,urls:oe.common32},required:["name","status","parentId","parentType"],type:"object"}},{auth:"bearer",constant:"LINK_DISCOURSE_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"linkDiscourseAccount",method:"POST",path:"/interop/discourse/linkAccount",request:oe.common266},{auth:"bearer",constant:"UNLINK_DISCOURSE_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"unlinkDiscourseAccount",method:"POST",path:"/interop/discourse/unlinkAccount",request:oe.common268},{auth:"none",constant:"DISCOURSE_PROFILE",contentType:"application/x-www-form-urlencoded",functionCocostum:"getDiscourseProfile",method:"POST",path:"/interop/discourse/profile",request:oe.common266},{auth:"bearer",constant:"DISCOURSE_CHECK_EMAIL",contentType:"application/x-www-form-urlencoded",functionCocostum:"checkDiscourseEmailMatch",method:"POST",path:"/interop/discourse/checkEmailMatch",request:oe.common268},{auth:"bearer",constant:"DISCOURSE_DISMISS_LINK",contentType:"application/x-www-form-urlencoded",functionCocostum:"dismissDiscourseLink",method:"POST",path:"/interop/discourse/dismissDiscourseLink",request:oe.common268},{auth:"bearer",constant:"LINK_MEDIAWIKI_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"linkMediaWikiAccount",method:"POST",path:"/interop/mediawiki/linkAccount",request:oe.common266},{auth:"bearer",constant:"UNLINK_MEDIAWIKI_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"unlinkMediaWikiAccount",method:"POST",path:"/interop/mediawiki/unlinkAccount",request:oe.common268},{auth:"none",constant:"GET_MEDIAWIKI_CONTRIBUTIONS",contentType:"application/x-www-form-urlencoded",functionCocostum:"getMediaWikiContributions",method:"POST",path:"/interop/mediawiki/contribs",request:{additionalProperties:!0,properties:{costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,limit:oe.common230,username:oe.common1},required:["username","costumSlug","costumId","costumType"],type:"object"}},{auth:"bearer",constant:"ADD_CLASSIFIED",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!0,properties:{address:{additionalProperties:!1,properties:{"@type":oe.common77,addressCountry:oe.common1,addressLocality:oe.common1,codeInsee:oe.common1,level1:oe.common1,level1Name:oe.common1,level2:oe.common1,level2Name:oe.common1,level3:oe.common78,level3Name:oe.common78,level4:oe.common78,level4Name:oe.common78,localityId:oe.common1,postalCode:oe.common1,streetAddress:oe.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},category:{enum:["service","competence","material"],type:"string"},collection:{const:"classifieds",default:"classifieds",type:"string"},description:oe.common1,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:{const:"classified",default:"classified",type:"string"},name:oe.common215,parent:oe.common224,preferences:oe.common220,scope:oe.common142,section:{enum:["need","offer"],type:"string"},subtype:oe.common263,tags:oe.common33},required:["id","collection","key","name","section","category","subtype","scope"],type:"object"}}]};function se(e){return e instanceof Error}function ae(e){return se(e)&&"response"in e&&"object"==typeof e.response&&"number"==typeof e.response.status}function ce(e){return se(e)?e.message:"string"==typeof e?e:e&&"object"==typeof e&&"message"in e?String(e.message):"Unknown error"}function pe(e){return function(e){return se(e)&&"status"in e&&"number"==typeof e.status}(e)?e.status:ae(e)?e.response.status:e instanceof error_ApiError?e.status:void 0}var de=_(602),me=_(193);const le=u;L.addType("oid",e=>{if("string"==typeof e)return new ne(e);if(void 0===e)return new ne;throw new Error("Expected string value for ObjectID")});class ApiClient extends d{__entityTag="ApiClient";userId=null;_baseURL;_refreshUrl;_endpoints;_debug;_fromJSONValue;_tokenStorage;_offlineClientManager=null;_ajv;_logger;_client;_breakerThreshold;_breakerResetTime;_breakerErrorCount=0;_breakerOpen=!1;_lastBreakerOpenTime=null;_accessToken=null;_refreshToken=null;_setUserId;constructor({baseURL:e,accessToken:t,refreshToken:r,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:o=ie.endpoints,timeout:i=3e4,debug:s=!1,maxRetries:a=0,circuitBreakerThreshold:c=5,circuitBreakerResetTime:p=6e4,fromJSONValue:d=!0,tokenStorageStrategy:m=null}){if(super(),!e)throw new error_ApiClientError('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshUrl=n,this._endpoints=o||ie.endpoints,this._debug=s,this._fromJSONValue=d,this._breakerThreshold=c,this._breakerResetTime=p;let u=null;if(Object.defineProperty(this,"userId",{get:()=>u,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{u=e,this._logger?.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new D({strict:!1,useDefaults:!0,allErrors:!0,verbose:!0}),k(this._ajv),this._ajv.addFormat("textarea",!0),this._ajv.addKeyword({keyword:"startBeforeEnd",type:"object",errors:!0,validate:this._startBeforeEndValidate}),this._logger=x({transport:{target:"pino-pretty",options:{colorize:!0}},level:s?"debug":"info"}),this._client=l.create({baseURL:e,timeout:i}),a>0&&(le(this._client,{retries:a,retryDelay:le.exponentialDelay,retryCondition:e=>le.isNetworkError(e)||le.isRetryableError(e),onRetry:(e,t,r)=>{this._logger.warn(`[Retry] Tentative #${e} pour ${r?.url}`),this.emit("retryAttempt",{retryCount:e,url:r?.url})}}),this._logger.info(`[ApiClient] Retry activé : ${a} max`)),m instanceof de.SJ&&m.use(this._baseURL),this._tokenStorage=m||new me.GN,"function"!=typeof this._tokenStorage?.getAccessToken||"function"!=typeof this._tokenStorage?.setAccessToken||"function"!=typeof this._tokenStorage?.getRefreshToken||"function"!=typeof this._tokenStorage?.setRefreshToken||"function"!=typeof this._tokenStorage?.clear)throw new Error("[ApiClient] La stratégie de stockage des tokens n’est pas valide. Elle doit implémenter les méthodes requises.");r&&this.setRefreshToken(r),t&&this.setToken(t);const h=this._tokenStorage.getAccessToken();h&&this.setToken(h);const y=this._tokenStorage.getRefreshToken();y&&this.setRefreshToken(y),this._client.interceptors.response.use(e=>e,async e=>{const t=e.config;if(t._retry)throw this._logger.error("[ApiClient] Requête déjà retentée, échec définitif."),e;if(e.response&&401===e.response.status&&this._refreshToken){t._retry=!0;try{if(this._logger.info("[ApiClient] Tentative de refresh du token..."),await this._refreshAccessToken())return this._logger.info("[ApiClient] Token rafraîchi avec succès."),t.headers=t.headers??{},t.headers.Authorization="Bearer "+this.getToken(),this._logger.info("[ApiClient] Retente la requête originale avec le nouveau token."),this._client.request(t);throw this.resetSession(),new error_ApiClientError("Impossible de rafraîchir le token.",401)}catch(e){this.resetSession();const t={code:pe(e)||401,message:ce(e)};throw new error_ApiClientError("Erreur lors du rafraîchissement du token.",401,t)}}throw e})}setToken(e){this._accessToken=e,this._tokenStorage.setAccessToken(e??""),e?this._client.defaults.headers.common.Authorization="Bearer "+e:delete this._client.defaults.headers.common.Authorization;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){if(this._refreshToken=e,this._tokenStorage.setRefreshToken(e??""),null===this.userId){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=h(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;const e=l.create({baseURL:this._baseURL,timeout:1e4,headers:{"Content-Type":"application/json"}});try{const t=await e.post(this._refreshUrl,{refreshToken:this._refreshToken});return!(!t.data||!t.data.token||(this.setToken(t.data.token),t.data.refreshToken&&this.setRefreshToken(t.data.refreshToken),this.emit("refreshSuccess",t.data),0))}catch(e){return this.emit("refreshFailed",{error:ce(e)}),this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${ce(e)}`),!1}}_checkCircuitBreaker(){if(!this._breakerOpen)return!0;const e=Date.now();return null!=this._lastBreakerOpenTime&&e-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),this.emit("circuitBreakerReset"),!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"),this.emit("circuitBreakerOpen",{timestamp:this._lastBreakerOpenTime}))}_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]&&ApiClient.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]&&ApiClient.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const r={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const r=this._getValueByPath(t,e);return null!=r?r:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,o=e=>"string"!=typeof e?e:e.replace(n,(t,n,o)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=r.pathParams(e);return null!=t?t:`@{${n}}`}{const e=r[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(o){if(o.startsWith("pathParams.")){const e=o.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],i=r.pathParams(t);return null!=i?i+n:`@${o}`}return`@${o}`}{const e=r[o];if("function"==typeof e){const t=e();return null!=t?t:`@${o}`}return`@${o}`}}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[r,n]of Object.entries(e))t[o(r)]=i(n);return t}return"string"==typeof e?o(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 r={};for(const n of Object.keys(e)){const o=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof o&&t.test(o))continue;if(o&&"object"==typeof o){const e=this._cleanSchemaLeftoverAlias(o);Object.keys(e).length>0&&(r[n]=e);continue}}"string"==typeof o&&t.test(o)||(r[n]=this._cleanSchemaLeftoverAlias(o))}}return r}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${ce(e)}`),e}}async callEndpoint(e,t={},r=!0,n=!0){const o=this._endpoints.find(t=>t.constant===e);if(!o)throw new error_ApiClientError(`Endpoint introuvable : ${e}`,404);const{path:i,method:s,contentType:a,auth:c,pathParams:p,request:d,responses:m}=o,l=(s||"GET").toLowerCase(),u=a||"application/json",h={"Content-Type":u};if(this._accessToken)"bearer"===c?h.Authorization=`Bearer ${this._accessToken}`:c&&"none"!==c||h.Authorization||(h.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===c)throw new error_ApiClientError(`Token requis pour l'endpoint sécurisé : ${e}`,401);let y,f=i,g={};if(p){let r=p;"none"===c&&null===this.userId&&(r=this._cleanSchemaLeftoverAlias(p));const n=t.pathParams||{},o=this._ajv.compile(r);if(!o(n)){const t=this._ajvErrorHuman(o.errors??[]);throw this.emit("validationError",{stage:"pathParams",errors:o.errors}),new error_ApiValidationError(`callEndpoint: ${e} - Path parameter validation failed.`,400,t,o.errors)}g=this._resolveSpecialValuesInPlace(n),f=f.replace(/\{(\w+)\}/g,(e,t)=>{const r=g[t];if(void 0!==r)return encodeURIComponent(r);throw new error_ApiClientError(`Path param manquant ou non résolu : {${t}}`,400)})}if(d){let r=d;"none"===c&&null===this.userId&&(r=this._cleanSchemaLeftoverAlias(d));let n={...t};delete n.pathParams,"application/x-www-form-urlencoded"===u&&(n=ApiClient.normalizeDatesForValidation(n),n=ApiClient.normalizeSchemaDateFields(n,r));const o=ApiClient.stripNullsInPlace(n),i=this._ajv.compile(r);if(!i(o)){const t=i.errors?this._ajvErrorHuman(i.errors):[];throw this.emit("validationError",{stage:"request",errors:i.errors}),new error_ApiValidationError(`callEndpoint: ${e} - Request validation failed.`,400,t,i.errors)}t=this._resolveSpecialValuesInPlace(o,g)}if(this._offlineClientManager?.isOffline()){if("function"==typeof this._offlineClientManager._enqueueOfflineAction)return this._logger.warn(`[ApiClient] Mode dégradé : mise en file de ${e}`),await this._offlineClientManager._enqueueOfflineAction({constant:e,data:t,options:{transformResponseData:r,validateResponseSchema:n}}),this._logger.info(`[ApiClient] Requête ${e} mise en file (offline mode)`),this.emit("queuedOffline",{constant:e,reason:"offlineMode",data:t}),{data:null,offline:!0};throw this._logger.warn("[ApiClient] Mode dégradé actif mais offlineManager non initialisé correctement"),new error_ApiClientError("Mode hors-ligne actif, mais gestionnaire offline non disponible.",503)}if(!this._checkCircuitBreaker()){if(!1===this._offlineClientManager?.isOffline?.()&&"function"==typeof this._offlineClientManager._enqueueOfflineAction)return this._logger.warn(`[ApiClient] Circuit breaker actif → mise en file de ${e}`),await this._offlineClientManager._enqueueOfflineAction({constant:e,data:t,options:{transformResponseData:r,validateResponseSchema:n}}),this._logger.info(`[ApiClient] Requête ${e} mise en file (circuit breaker)`),this.emit("queuedOffline",{constant:e,reason:"circuitBreaker",data:t}),{data:null,breaker:!0};throw new error_CircuitBreakerError("Le circuit breaker est activé, impossible d'appeler l'API")}"application/json"===u||"multipart/form-data"===u?y=t:"application/x-www-form-urlencoded"===u&&(y=ApiClient.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${f}, method=${l}`);try{const e=await this._client.request({url:f,method:l,headers:h,["get"===l?"params":"data"]:y});if(n){const t=String(e.status),r=m?.[t];if(r){const t=this._ajv.compile(r);if(!t(e.data)){const r=this._ajvErrorHuman(t.errors??[]);throw this.emit("validationError",{stage:"response",errors:t.errors}),new error_ApiValidationError("Response validation failed.",e.status,r,t.errors)}}}return this._resetCircuitBreakerSuccess(),"function"==typeof r?e.data=r(e.data):!0===r&&(e.data=this._transformData(e.data)),Array.isArray(o.postActions)&&o.postActions.forEach(t=>{const r=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(r);break;case"setRefreshToken":this.setRefreshToken(r);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,r),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,r));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){if(this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${ce(t)}`),t instanceof error_ApiValidationError)throw t;{const e=ae(t)?t.response.status:500,r=ae(t)?t.response.data:null;throw new error_ApiClientError(`Erreur lors de l'appel de l'API : ${ce(t)}`,e,r)}}}_ajvErrorHuman(e){try{return new m(e).errors.map(({message:e})=>e)}catch(t){return this._logger.error("[ApiClient] _ajvErrorHuman",t),e.map(({message:e})=>e)}}checkAndThrowApiResponseError(e){if(!("status"in e))return e;const t=e.data;if(!t||"object"!=typeof t)return e;if("boolean"==typeof t.result&&!1===t.result)throw new error_ApiResponseError(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 error_ApiResponseError(t.resultErrors.msg||"Erreur inconnue",e.status,t);return e}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),this._tokenStorage.clear(),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 normalizeDatesForValidation(e){if(null==e)return e;if(e&&"object"==typeof e&&e.__isReactive&&e.__raw)return ApiClient.normalizeDatesForValidation(e.__raw);if(e instanceof Date)return e.toISOString().replace(/\.\d{3}Z$/,"+0000");if(Array.isArray(e))return e.map(e=>ApiClient.normalizeDatesForValidation(e));if("object"==typeof e){const t={};for(const r of Object.keys(e))t[r]=ApiClient.normalizeDatesForValidation(e[r]);return t}return e}static normalizeSchemaDateFields(e,t){if(!e||!t||"object"!=typeof e)return e;const r={...e};let n=t.properties||{};if(t.allOf&&Array.isArray(t.allOf))for(const e of t.allOf)e.properties&&(n={...n,...e.properties}),e.then&&e.then.properties&&(n={...n,...e.then.properties});t.then&&t.then.properties&&(n={...n,...t.then.properties});for(const[e,t]of Object.entries(n)){const n=t;if("date"===n?.format&&r[e]){const t=r[e];"string"==typeof t&&t.includes("T")&&(r[e]=t.split("T")[0])}}return r}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,r={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:o=!1,metaTokens:i=!0}=r,s=[];function a(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function c(e){return e.endsWith("[]")?e.slice(0,-2):e}function p(e,t,r=!1){return e?e.concat(t).map((e,t)=>(e=c(e),!r&&t?`[${e}]`:e)).join(r?".":""):t}function d(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(r,m=[]){null==r||s.includes(r)||(s.push(r),Object.entries(r).forEach(([r,s])=>{void 0!==s&&function(e,r,s){if(e&&"object"==typeof e){if(r.endsWith("{}"))return r=i?r:r.slice(0,-2),t.append(p(s,r,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(a)||r.endsWith("[]"))return r=c(r),e.forEach((e,i)=>{if(null!=e){const a=o?p(s.concat(r),i,n):`${p(s,r,n)}[]`;t.append(a,d(e))}}),!1}return!!a(e)||(t.append(p(s,r,n),d(e)),!1)}(s,r.trim(),m)&&e(s,m.concat(c(r)))}),s.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.length>0)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,"people"===e?.author?.typeSig&&(e.author.type="citoyens"),"people"===e?.typeSig&&(e.collection="citoyens"),"organizations"===e?.typeSig&&(e.collection="organizations"),this._fromJSONValue?L.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){if(e&&"object"==typeof e&&"number"==typeof e.sec)return{$date:1e3*e.sec};if("number"==typeof e)return{$date:1e3*e};if("string"==typeof e&&""!==e.trim()){const t=new Date(e);if(!isNaN(t.getTime()))return L.toJSONValue(t)}return e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_normalizeNumber(e){if("string"!=typeof e)return e;const t=e.trim();if(""===t)return e;const r=Number(t);return Number.isFinite(r)?r:e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath","imageThumb","imageMediumPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date","issuedOn"];_numberFields=["buildingSurfaceArea","siteSurfaceArea","credits","min","max","timeSpent"];_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(r=>{let n=this._normalizeRecursively(e[r]);this._dateFields.includes(r)&&(n=this._normalizeDate(n)),this._imageFields.includes(r)&&(n=this._normalizeImage(n)),this._numberFields.includes(r)&&(n=this._normalizeNumber(n)),"content"===r&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[r]=n}),this._normalizeId(t)}return e}_startBeforeEndValidate=(e,t)=>{if(!t.startDate||!t.endDate)return!0;const r=new Date(t.startDate)<new Date(t.endDate);return r||(this._startBeforeEndValidate.errors=[{instancePath:"/startDate",schemaPath:"#/startBeforeEnd",keyword:"startBeforeEnd",params:{},message:"startDate must be before endDate"}]),r};getRequestSchema(e){const t=this._endpoints.find(t=>t.constant===e);return t?.request||null}getPathSchema(e){return this._endpoints.find(t=>t.constant===e)?.pathParams||null}onEvent(e={}){const t=["retryAttempt","queuedOffline","circuitBreakerOpen","circuitBreakerReset","refreshSuccess","refreshFailed","sessionReset","validationError","offlineModeChanged","userLoggedIn"];for(const r of t)"function"==typeof e[r]&&this.on(r,e[r])}getDeclaredEvents(){const e=new Set;for(const t of this._endpoints)if(Array.isArray(t.postActions))for(const r of t.postActions)"emitEvent"===r.type&&r.event&&e.add(r.event);return Array.from(e)}}function ue(e){return e&&"object"==typeof e&&"status"in e&&"data"in e}class UserApi{client;loggedUser=null;constructor(e){this.client=e instanceof ApiClient?e:new ApiClient(e)}get isConnected(){return this.client.isConnected}get userId(){return this.client.userId}async login(e,t){return this.client.safeCall(async()=>{const r=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new User(this.client,r.data.user,{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action}),this.loggedUser})}async meIsconnected(){if(!this.client.isConnected||!this.client.userId)throw new error_ApiError("User not connected",401);return this.client._logger.debug("UserApi","meIsconnected",this.client.userId),this.loggedUser=new User(this.client,{id:this.client.userId},{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action}),this.loggedUser}async register({name:e,username:t,email:r,pwd:n}){return this.client.safeCall(async()=>{const o=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:r,pwd:n});if(!ue(o))throw new error_ApiError("Requête mise en file (offline/circuit breaker)",503,o);if(!1===o?.data?.result)throw new error_ApiResponseError(o.data.msg,o.status,o.data);return o.data})}async recoverPassword(e){return this.client.safeCall(async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!ue(t))throw new error_ApiError("Requête mise en file (offline/circuit breaker)",503,t);if(!1===t?.data?.result)throw new error_ApiResponseError(t.data.msg,t.status,t.data);return t.data})}}v("User",User),v("Organization",Organization),v("Project",Project),v("Event",Event),v("Poi",Poi),v("Badge",Badge),v("EndpointApi",te),v("News",News),v("Comment",Comment),v("Answer",Answer),v("Form",Form),v("Classified",Classified),v("Action",Action);class Api{_loggedUser;_client;static async userLogin(e,t,r){const n=Api.userApi(r);return await Api.userApiLogin(n,e,t)}static userApi(e){try{return new UserApi(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,r){try{if(!e)throw new error_ApiError("userApi is not defined",500);if(!e.client)throw new error_ApiError("userApi.client is not defined",500);if(e.client.isConnected){const t=await e.meIsconnected();return new Api(t,e.client)}{if(!t||!r)throw new error_ApiError("email and password are required",400);const n=await e.login(t,r);return new Api(n,e.client)}}catch(e){if(e instanceof error_ApiClientError&&e?.details?.error)throw new error_ApiAuthenticationError(e.details.error,e.status,e.details);throw e}}constructor(e,t){this._loggedUser=e,this._client=t}async me(){if(!this._loggedUser)throw new error_ApiAuthenticationError("Accès refusé : utilisateur non authentifié.",401);return await this._loggedUser.get(),this._loggedUser}async user(e){try{if(e.id||e.slug){const t=new User(this._client,e,{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action});return await t.get(),t}return new User(this._client,e,{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action})}catch(e){throw console.error("[Api.user] Erreur lors de la création d'un objet utilisateur public :",e.message),e}}async organization(e){try{const t=new Organization(this._client,e,{EndpointApi:te,User,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Organization.");return await t.get(),t}catch(e){throw console.error("[Api.organization] Erreur lors de la création d'un objet organisation :",e.message),e}}async project(e){try{const t=new Project(this._client,e,{EndpointApi:te,User,Organization,Event,Poi,Badge,News,Comment,Classified,Action});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Project.");return await t.get(),t}catch(e){throw console.error("[Api.project] Erreur lors de la création d'un objet projet :",e.message),e}}async event(e){try{const t=new Event(this._client,e,{EndpointApi:te,User,Organization,Project,Poi,Badge,News,Comment});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Event.");return await t.get(),t}catch(e){throw console.error("[Api.event] Erreur lors de la création d'un objet événement :",e.message),e}}async poi(e){try{const t=new Poi(this._client,e,{EndpointApi:te,User,Organization,Project,Poi,Badge,News,Comment});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Poi.");return await t.get(),t}catch(e){throw console.error("[Api.poi] Erreur lors de la création d'un objet poi :",e.message),e}}async answer(e){try{const t=new Answer(this._client,e,{EndpointApi:te,User,Organization,Project,Event,Poi,Badge,News,Comment});if(!e.id)throw new Error("Vous devez fournir un id pour créer une instance Answer.");return await t.get(),t}catch(e){throw console.error("[Api.answer] Erreur lors de la création d'un objet Answer :",e.message),e}}async form(e){try{const t=new Form(this._client,e,{EndpointApi:te,User,Organization,Project});if(!e.id)throw new Error("Vous devez fournir un id pour créer une instance Form.");return await t.get(),t}catch(e){throw console.error("[Api.form] Erreur lors de la création d'un objet Form :",e.message),e}}async classified(e){try{const t=new Classified(this._client,e,{EndpointApi:te,User,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Form,Classified});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Classified.");return await t.get(),t}catch(e){throw console.error("[Api.classified] Erreur lors de la création d'un objet Classified :",e.message),e}}async entitySlug(e){if(!e)throw new error_ApiError("slug requis",400);try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t.contextId&&t.contextType){const r=function(e,t=null,r={}){const n={citoyens:{entityTag:"User",meta:e=>S(e,{remove:[]})},organizations:{entityTag:"Organization",meta:e=>S(e,{remove:[]})},projects:{entityTag:"Project",meta:e=>S(e,{remove:[]})},events:{entityTag:"Event",meta:e=>S(e,{remove:["Badge"]})},poi:{entityTag:"Poi",meta:e=>S(e,{remove:["Badge","News","Comments"]})},news:{entityTag:"News",meta:e=>S(e,{remove:[]})},badges:{entityTag:"Badge",meta:()=>function(e){const t=b.get(e),r={EndpointApi:b.get("EndpointApi"),User:b.get("User"),Organization:b.get("Organization"),Project:b.get("Project")};return r[e]=t,{entityClass:t,deps:r}}("Badge")},comments:{entityTag:"Comment",meta:e=>S(e,{remove:[]})},answers:{entityTag:"Answer",meta:e=>S(e,{remove:[]})},forms:{entityTag:"Form",meta:e=>S(e,{remove:[]})},classifieds:{entityTag:"Classified",meta:e=>S(e,{remove:["Badge","News"]})},actions:{entityTag:"Action",meta:e=>S(e,{remove:[]})}}[e];if(!n)return console.warn(`Collection inconnue : '${e}'`),null;const{entityTag:o,meta:i}=n,{entityClass:s,deps:a}=i(o);if(!s)throw new Error(`EntityClass introuvable pour ${o}`);return new s(t,r,a)}(t.contextType,this._client,{id:t.contextId});if(!r)throw new error_ApiResponseError(`Le type d'entité pour le slug ${e} n'est pas reconnu`,200,t);return await r.get(),r}throw new error_ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof error_ApiResponseError?new error_ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${e}`,t.status,t.responseData):t}}get client(){return this._client}get endpointApi(){return new te(this._client)}logout(){this._loggedUser=null,this._client.resetSession(),this._client._logger.info("UserApi: User logged out")}}var he=_(285);class OfflineClientManager{_clients;_client;_offlineMode;_pingInterval;_offlineQueueStorage;_offlineQueue;_monitoringStarted;constructor(e){if(!(e&&e instanceof ApiClient))throw new Error("[OfflineClientManager] apiClient doit être une instance de ApiClient");this._clients=new Map,this._client=e,this._offlineMode=void 0,this._pingInterval=void 0,this._offlineQueueStorage=void 0,this._offlineQueue=[],this._monitoringStarted=void 0}static async attachTo(e,t={}){e._offlineClientManager=new OfflineClientManager(e);const r=await async function(e="auto"){if("memory"===e)return new he.QM;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new he.Rc;throw new Error("localStorage is not available in this environment.")}if("file"===e){if("undefined"!=typeof window&&window.localStorage)throw new Error("file storage is not available in this environment.");const{FileOfflineStorage:e}=await _.e(588).then(_.bind(_,588));return new e}if("auto"===e){if("undefined"!=typeof window&&window.localStorage)return new he.Rc;{const{FileOfflineStorage:e}=await _.e(588).then(_.bind(_,588));return new e}}throw new Error(`Unsupported offline storage strategy: ${e}`)}(t?.offlineStorageStrategy||"auto");await e._offlineClientManager._initOfflineQueue(r),t?.disableOfflineMonitoring||e._offlineClientManager.startOfflineMonitoring(t)}async getClient(e){const t=`${e.baseURL}|${e.accessToken}`;if(this._clients.has(t))return this._clients.get(t);const r=new ApiClient({baseURL:e.baseURL,accessToken:e.accessToken,refreshToken:e.refreshToken,debug:this._client._debug});return this._clients.set(t,r),r}async replayAction(e){const t=await this.getClient(e.meta);try{const r=await t.callEndpoint(e.constant,e.data,e.options?.transformResponseData??!0,e.options?.validateResponseSchema??!0);return this._client._logger.info(`[OfflineReplay] Succès ${e.constant} sur ${e.meta.baseURL}`),r}catch(t){throw this._client._logger.error(`[OfflineReplay] Échec ${e.constant}`,t.message),t}}startOfflineMonitoring({interval:e=3e4,disableOfflineMonitoring:t=!1}={}){t||this._monitoringStarted||(this._monitoringStarted=!0,this._offlineMode="undefined"!=typeof window&&"undefined"!=typeof navigator&&!navigator.onLine,"undefined"!=typeof window&&(window.addEventListener("online",()=>this.setOfflineMode(!1)),window.addEventListener("offline",()=>this.setOfflineMode(!0))),this._pingInterval=setInterval(async()=>{const e=this._offlineMode;try{await this._client._client.head("/api/cocolight/infoserver",{timeout:5e3}),e&&this.setOfflineMode(!1)}catch{this._client._logger.error("[OfflineMonitor] ping() échoué → passage en offline"),this.setOfflineMode(!0)}},e))}setOfflineMode(e){this._offlineMode!==e&&(this._offlineMode=e,"function"==typeof this._client.emit&&this._client.emit("offlineModeChanged",e),this._client._logger.info(`[ApiClient] Mode offline : ${e} (set depuis monitoring)`),e||"function"!=typeof this._replayOfflineQueue||this._replayOfflineQueue())}isOffline(){return!!this._offlineMode}async _enqueueOfflineAction({constant:e,data:t,options:r={}}){if(!this._offlineQueueStorage)throw new Error("[OfflineClientManager] _offlineQueueStorage non initialisé");const n=this._client.getToken()||this._client.getRefreshToken(),o=this._client._endpoints.find(t=>t.constant===e);if("required"===(o?.authPolicy||("none"===o?.auth?"none":"required"))&&!n)return void this._client._logger.warn(`[Offline] Action ignorée : token requis mais absent (${e})`);const i={constant:e,data:t,options:r,meta:{baseURL:this._client._baseURL,accessToken:this._client.getToken(),refreshToken:this._client.getRefreshToken(),timestamp:Date.now()}};this._offlineQueue.push(i),await this._offlineQueueStorage.saveQueue(this._offlineQueue),this._client._logger.info(`[Offline] Action mise en file : ${e}`)}async _replayOfflineQueue(){if(!this._offlineQueueStorage)throw new Error("[OfflineClientManager] _offlineQueueStorage non initialisé");const e=[...this._offlineQueue];this._offlineQueue=[],await this._offlineQueueStorage.saveQueue([]);for(const t of e){const e=this._client._endpoints.find(e=>e.constant===t.constant),r=e?.authPolicy||("none"===e?.auth?"none":"required"),n=t.meta.accessToken||t.meta.refreshToken;if("required"!==r||n)try{await this.replayAction(t)}catch(e){this._client._logger.error("[Offline] Relecture échouée :",e.message),this._offlineQueue.push(t)}else this._client._logger.warn(`[Offline] Rejetée : token requis manquant (${t.constant})`)}await this._offlineQueueStorage.saveQueue(this._offlineQueue)}async _initOfflineQueue(e){if(!(e&&e instanceof he.LD))throw new Error("[OfflineClientManager] storageStrategy doit être une instance de OfflineQueueStorageStrategy");this._offlineQueueStorage=e,this._offlineQueue=await e.loadQueue()}}const ye=OfflineClientManager,fe=["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],ge=["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],we=["workshop","competition","concert","contest","conference","debate","exhibition","festival","crowdfunding","fair","course","protest","market","film","getTogether","meeting","spectacle","internship","stand","others"],_e=["link","tool","machine","software","rh","Resource material","Financial Ressource","ficheBlanche","geoJson","compostPickup","video","sharedLibrary","recoveryCenter","trash","history","something2See","funPlace","place","artPiece","streetArts","openScene","stand","parking","other"],Ee=["need","offer"],Te=["service","competence","material"],Ae={service:{key:"service",icon:"cogs",label:"Service",subcat:{charity:{key:"charity",label:"Charité",icon:"heart"},education:{key:"education",label:"Aide éducative",icon:"book"},househelp:{key:"househelp",label:"Aide ménagère",icon:"home"},washing:{key:"washing",label:"Lavage",icon:"droplets"},gardening:{key:"gardening",label:"Jardinage",icon:"flower"},farming:{key:"farming",label:"Agriculture",icon:"wheat"},generalmaintenance:{key:"generalmaintenance",label:"Maintenance générale",icon:"wrench"},childrencare:{key:"childrencare",label:"Garde d'enfants",icon:"baby"},ederlycare:{key:"ederlycare",label:"Aide aux personnes âgées",icon:"user"},disabledcare:{key:"disabledcare",label:"Aide aux personnes en situation de handicap",icon:"accessibility"},hostinghelp:{key:"hostinghelp",label:"Aide à l'accueil",icon:"handshake"},animalcare:{key:"animalcare",label:"Soins aux animaux",icon:"paw-print"}}},competence:{key:"competence",icon:"bookmark",label:"Compétence",subcat:{artistic:{key:"artistic",label:"Artistique",icon:"palette"},laws:{key:"laws",label:"Droit",icon:"scale"},itdevlopment:{key:"itdevlopment",label:"Développement informatique",icon:"code"},handcraft:{key:"handcraft",label:"Artisanat",icon:"scissors"},animalcare:{key:"animalcare",label:"Soins aux animaux",icon:"paw-print"},agriculture:{key:"agriculture",label:"Agriculture",icon:"wheat"},restauration:{key:"restauration",label:"Restauration",icon:"utensils"},building:{key:"building",label:"Construction",icon:"hard-hat"}}},material:{key:"material",icon:"wrench",label:"Matériel",subcat:{electronic:{key:"electronic",label:"Électronique",icon:"cpu"},furniture:{key:"furniture",label:"Mobilier",icon:"armchair"},primaryressources:{key:"primaryressources",label:"Ressources primaires",icon:"leaf"},buildingtools:{key:"buildingtools",label:"Outils de construction",icon:"hammer"},gardeningtools:{key:"gardeningtools",label:"Outils de jardinage",icon:"shovel"},medicalstuff:{key:"medicalstuff",label:"Matériel médical",icon:"stethoscope"}}}},be=["todo","done","tracking","discuter","next","totest","disabled","closed"],ve={ApiClient,Api,error:T,reactive:A,effect:B,batch:z,isSignal:F,reactiveObject:G,isReactive:K,computed:Z,watch:W,getSignals:J,subscribeTo:H,tokenStorageStrategy:{createDefaultTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new me.GN;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new me.Ge;throw new Error("localStorage is not available in this environment.")}if("file"===e){if("undefined"!=typeof window&&window.localStorage)throw new Error("file storage is not available in this environment.");const{FileStorageStrategy:e}=await _.e(839).then(_.bind(_,839));return new e}if("undefined"!=typeof window&&window.localStorage)return new me.Ge;const{FileStorageStrategy:t}=await _.e(839).then(_.bind(_,839));return new t},TokenStorageStrategy:me.u3,createDefaultMultiServerTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new de.Ek;if("localStorage"===e){if("undefined"!=typeof window&&void 0!==window.localStorage)return new de.YP;throw new Error("localStorage n'est pas disponible dans cet environnement.")}if("file"===e){if("undefined"!=typeof window&&void 0!==window.localStorage)throw new Error("Le stockage fichier n'est pas disponible côté navigateur.");const{MultiServerFileStorageStrategy:e}=await _.e(593).then(_.bind(_,593));return new e}if("undefined"!=typeof window&&void 0!==window.localStorage)return new de.YP;const{MultiServerFileStorageStrategy:t}=await _.e(593).then(_.bind(_,593));return new t},MultiServerTokenStorageStrategy:de.SJ},helper:{fromEntityJSON:I,restorePaginationFromJSON:BaseEntity.restorePaginationFromJSON},OfflineClientManager:ye};export{be as ACTION_STATUSES,Te as CLASSIFIED_CATEGORIES,Ee as CLASSIFIED_SECTIONS,Ae as CLASSIFIED_SUBCATEGORIES,we as EVENT_TYPES,fe as ORGANIZATION_TYPES,_e as POI_TYPES,ge as PROJECT_AVANCEMENTS,ve as default};
|
|
1
|
+
import*as e from"os";import*as t from"fs";import*as r from"path";import*as n from"stream";import{default as o}from"bson-objectid";import{fromBuffer as i}from"file-type";import*as s from"ajv";import*as a from"ajv-formats";import*as c from"ejson";import*as p from"pino";import{EventEmitter as d}from"events";import{AggregateAjvError as m}from"@segment/ajv-human-errors";import{default as l}from"axios";import{default as u}from"axios-retry";import{jwtDecode as h}from"jwt-decode";var y,f,g={116:(t,r,n)=>{var o,i;t.exports=(o={homedir:()=>e.homedir},i={},n.d(i,o),i)},193:(e,t,r)=>{r.d(t,{GN:()=>MemoryStorageStrategy,Ge:()=>LocalStorageStrategy,u3:()=>TokenStorageStrategy});class TokenStorageStrategy{}class MemoryStorageStrategy extends TokenStorageStrategy{_accessToken=null;_refreshToken=null;constructor(){super()}getAccessToken(){return this._accessToken}setAccessToken(e){this._accessToken=e}getRefreshToken(){return this._refreshToken}setRefreshToken(e){this._refreshToken=e}clear(){this._accessToken=null,this._refreshToken=null}}class LocalStorageStrategy extends TokenStorageStrategy{prefix;constructor(e="cocolight"){super(),this.prefix=e}getAccessToken(){return"undefined"!=typeof localStorage?localStorage.getItem(`${this.prefix}_accessToken`):null}setAccessToken(e){"undefined"!=typeof localStorage&&localStorage.setItem(`${this.prefix}_accessToken`,e??"")}getRefreshToken(){return"undefined"!=typeof localStorage?localStorage.getItem(`${this.prefix}_refreshToken`):null}setRefreshToken(e){"undefined"!=typeof localStorage&&localStorage.setItem(`${this.prefix}_refreshToken`,e??"")}clear(){"undefined"!=typeof localStorage&&(localStorage.removeItem(`${this.prefix}_accessToken`),localStorage.removeItem(`${this.prefix}_refreshToken`))}}},285:(e,t,r)=>{r.d(t,{LD:()=>OfflineQueueStorageStrategy,QM:()=>MemoryOfflineStorage,Rc:()=>LocalStorageOfflineStorage});class OfflineQueueStorageStrategy{}class MemoryOfflineStorage extends OfflineQueueStorageStrategy{_queue=[];constructor(){super()}async loadQueue(){return this._queue}async saveQueue(e){this._queue=[...e]}}class LocalStorageOfflineStorage extends OfflineQueueStorageStrategy{key;constructor(e="cocolight-api-offline-queue"){super(),this.key=e}async loadQueue(){try{const e=localStorage.getItem(this.key);return(e?JSON.parse(e):null)??[]}catch{return[]}}async saveQueue(e){try{localStorage.setItem(this.key,JSON.stringify(e))}catch(e){console.warn("[Offline] Échec du stockage localStorage",e)}}}},421:(e,r,n)=>{var o,i;e.exports=(o={existsSync:()=>t.existsSync,mkdirSync:()=>t.mkdirSync,readFileSync:()=>t.readFileSync,writeFileSync:()=>t.writeFileSync},i={},n.d(i,o),i)},521:(e,t,n)=>{var o,i;e.exports=(o={join:()=>r.join},i={},n.d(i,o),i)},602:(e,t,r)=>{r.d(t,{Ek:()=>MultiServerMemoryStorageStrategy,SJ:()=>MultiServerTokenStorageStrategy,YP:()=>MultiServerLocalStorageStrategy});var n=r(193);class MultiServerTokenStorageStrategy extends n.u3{_currentBaseURL=null;constructor(){super()}use(e){if(!e)throw new Error("baseURL est requis");this._currentBaseURL=e.replace(/\/+$/,"")}_ensureContext(){if(!this._currentBaseURL)throw new Error("baseURL non défini. Appelez use(baseURL)")}_requireBaseURL(){return this._ensureContext(),this._currentBaseURL}}class MultiServerMemoryStorageStrategy extends MultiServerTokenStorageStrategy{_storage=new Map;constructor(){super()}getAccessToken(){const e=this._requireBaseURL();return this._storage.get(e)?.accessToken??null}setAccessToken(e){const t=this._requireBaseURL(),r=this._storage.get(t)||{};this._storage.set(t,{...r,accessToken:e})}getRefreshToken(){const e=this._requireBaseURL();return this._storage.get(e)?.refreshToken??null}setRefreshToken(e){const t=this._requireBaseURL(),r=this._storage.get(t)||{};this._storage.set(t,{...r,refreshToken:e})}clear(){const e=this._requireBaseURL();this._storage.delete(e)}getServers(){return Array.from(this._storage.keys())}exportAll(){return Object.fromEntries(this._storage.entries())}}class MultiServerLocalStorageStrategy extends MultiServerTokenStorageStrategy{prefix;constructor(e="cocolight"){super(),this.prefix=e}_key(e){return`${this.prefix}_tokens_${e}`}_getData(){if(this._ensureContext(),"undefined"==typeof localStorage)return{};const e=localStorage.getItem(this._key(this._currentBaseURL));return e?JSON.parse(e):{}}_setData(e){"undefined"!=typeof localStorage&&localStorage.setItem(this._key(this._currentBaseURL),JSON.stringify(e))}getAccessToken(){return this._getData().accessToken??null}setAccessToken(e){const t=this._getData();t.accessToken=e,this._setData(t)}getRefreshToken(){return this._getData().refreshToken??null}setRefreshToken(e){const t=this._getData();t.refreshToken=e,this._setData(t)}clear(){"undefined"!=typeof localStorage&&localStorage.removeItem(this._key(this._currentBaseURL))}getServers(){return"undefined"==typeof localStorage?[]:Object.keys(localStorage).filter(e=>e.startsWith(`${this.prefix}_tokens_`)).map(e=>e.replace(`${this.prefix}_tokens_`,""))}exportAll(){const e={};for(const t of this.getServers()){const r=this._key(t),n="undefined"!=typeof localStorage?localStorage.getItem(r):null;n&&(e[t]=JSON.parse(n))}return e}}},702:(e,t,r)=>{var o,i;e.exports=(o={PassThrough:()=>n.PassThrough,Readable:()=>n.Readable},i={},r.d(i,o),i)}},w={};function _(e){var t=w[e];if(void 0!==t)return t.exports;var r=w[e]={exports:{}};return g[e](r,r.exports,_),r.exports}_.m=g,_.d=(e,t)=>{for(var r in t)_.o(t,r)&&!_.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},_.f={},_.e=e=>Promise.all(Object.keys(_.f).reduce((t,r)=>(_.f[r](e,t),t),[])),_.u=e=>e+".cocolight-api-client.mjs.js",_.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})},y={792:0},f=e=>{var t,r,{__webpack_esm_ids__:n,__webpack_esm_modules__:o,__webpack_esm_runtime__:i}=e,s=0;for(t in o)_.o(o,t)&&(_.m[t]=o[t]);for(i&&i(_);s<n.length;s++)r=n[s],_.o(y,r)&&y[r]&&y[r][0](),y[n[s]]=0},_.f.j=(e,t)=>{var r=_.o(y,e)?y[e]:void 0;if(0!==r)if(r)t.push(r[1]);else{var n=import("./"+_.u(e)).then(f,t=>{throw 0!==y[e]&&(y[e]=void 0),t});n=Promise.race([n,new Promise(t=>r=y[e]=[t])]),t.push(r[1]=n)}};var E={};_.r(E),_.d(E,{fromBuffer:()=>i});var T={};_.r(T),_.d(T,{ApiAuthenticationError:()=>error_ApiAuthenticationError,ApiClientError:()=>error_ApiClientError,ApiError:()=>error_ApiError,ApiResponseError:()=>error_ApiResponseError,ApiValidationError:()=>error_ApiValidationError,CircuitBreakerError:()=>error_CircuitBreakerError});var A={};_.r(A),_.d(A,{batch:()=>z,computed:()=>Z,effect:()=>B,getSignals:()=>J,isReactive:()=>K,isSignal:()=>F,reactive:()=>G,subscribeTo:()=>H,watch:()=>W});class error_ApiError extends Error{name="ApiError";status;details;constructor(e,t,r){super(e),this.status=t,this.details=r}}class error_ApiClientError extends error_ApiError{name="ApiClientError";constructor(e,t,r){super(e,t,r)}}class error_ApiValidationError extends Error{name="ApiValidationError";status;messages;details;constructor(e,t,r,n=null){super(e),this.status=t,this.messages=r,this.details=n}}class error_CircuitBreakerError extends error_ApiError{name="CircuitBreakerError";constructor(e){super(e,503)}}class error_ApiResponseError extends Error{name="ApiResponseError";status;responseData;details;constructor(e,t,r,n=null){super(e),this.status=t,this.responseData=r,this.details=n}}class error_ApiAuthenticationError extends error_ApiError{name="ApiAuthenticationError";constructor(e,t,r){super(e,t,r)}}const b=new Map;function v(e,t){b.set(e,t)}function I(e,t=null){if(!(r=e)||"object"!=typeof r||!("__entityTag"in r))return e;var r;let n=t;const o=e;if(o.parent&&"object"==typeof o.parent){const e=o.parent,r=e.serverData?.id||e.id;if(t&&"id"in t&&t.id===r)n=t;else{const e=I(o.parent,t);e&&"object"==typeof e&&"id"in e&&(n=e)}}let i=e.serverData?.collection;if(i||(i={User:"citoyens",Organization:"organizations",Project:"projects",Event:"events",Poi:"poi",News:"news",Badge:"badges",Comment:"comments",Answer:"answers",Form:"forms",Classified:"classifieds",Action:"actions"}[e.__entityTag]||null),!i)return e;const s=function(e,t){const r=b.get(t),n=t,o={EndpointApi:b.get("EndpointApi"),User:"User"===n?r:b.get("User"),Organization:"Organization"===n?r:b.get("Organization"),Project:"Project"===n?r:b.get("Project"),Event:"Event"===n?r:b.get("Event"),Poi:"Poi"===n?r:b.get("Poi"),Badge:"Badge"===n?r:b.get("Badge"),News:"News"===n?r:b.get("News"),Comment:"Comment"===n?r:b.get("Comment"),Answer:"Answer"===n?r:b.get("Answer"),Form:"Form"===n?r:b.get("Form"),Classified:"Classified"===n?r:b.get("Classified"),Action:"Action"===n?r:b.get("Action")};return{citoyens:{entityClass:o.User,deps:o},organizations:{entityClass:o.Organization,deps:o},projects:{entityClass:o.Project,deps:o},events:{entityClass:o.Event,deps:{...o,Badge:void 0}},poi:{entityClass:o.Poi,deps:{...o,Badge:void 0,News:void 0,Comment:void 0}},news:{entityClass:o.News,deps:{...o}},badges:{entityClass:o.Badge,deps:{EndpointApi:o.EndpointApi,User:o.User,Organization:o.Organization,Project:o.Project}},comments:{entityClass:o.Comment,deps:{...o}},answers:{entityClass:o.Answer,deps:{...o}},forms:{entityClass:o.Form,deps:{...o}},classifieds:{entityClass:o.Classified,deps:{...o,Badge:void 0,News:void 0}},actions:{entityClass:o.Action,deps:{...o}}}[e]||null}(i,e.__entityTag);if(!s)return e;if(!s.entityClass?.fromJSON)throw new Error(`Classe inconnue ou fromJSON manquant pour ${e.__entityTag}`);return s.entityClass.fromJSON(e,n,s.deps)}function S(e,t){const r=b.get(e),n={EndpointApi:b.get("EndpointApi"),User:b.get("User"),Organization:b.get("Organization"),Project:b.get("Project"),Event:b.get("Event"),Poi:b.get("Poi"),Badge:b.get("Badge"),News:b.get("News"),Comment:b.get("Comment"),Answer:b.get("Answer"),Form:b.get("Form"),Classified:b.get("Classified"),Action:b.get("Action")};return n[e]=r,t.remove.forEach(e=>delete n[e]),{entityClass:r,deps:n}}const P=a,C=c,O=p,j=e=>e&&e.default?e.default:e,D=j(s),k=j(P),x=j(O),L=j(C),N=[],M=new WeakMap,$=new WeakMap;let q=0;const R=new Set;function B(e){const t=()=>{try{N.push(t),e()}finally{N.pop()}};return t(),t}function z(e){q++;try{e()}finally{if(q--,0===q){const e=Array.from(R);R.clear();for(const t of e)t()}}}function U(e){let t=e;const r=new Set;return{get value(){const e=N[N.length-1];return e&&r.add(e),t},set value(e){t!==e&&(t=e,q>0?r.forEach(e=>R.add(e)):r.forEach(e=>e()))},subscribe:e=>(r.add(e),()=>r.delete(e)),__isSignal:!0}}function F(e){return e&&!0===e.__isSignal}function V(e,t=[]){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return function(e,t){return new Proxy(e,{get(e,r,n){if("string"==typeof r&&!isNaN(+r)){const n=e[+r];return K(n)?n:V(n,[...t,r])}return Reflect.get(e,r,n)},set(e,r,n){if("string"==typeof r&&!isNaN(+r)){const o=V(n,[...t,r]);e[+r]=o}return!0}})}(e,t);if(e.__isReactive)return e;if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return e;if("undefined"!=typeof File&&e instanceof File)return e;if("undefined"!=typeof Blob&&e instanceof Blob)return e;if(e&&"function"==typeof e.pipe&&"function"==typeof e.on)return e;if(e instanceof Date)return e;if(e.__entityTag)return e;const r=new Map,n=new Proxy(e,{get(e,n){if("__raw"===n)return e;if("__isReactive"===n)return!0;if(!r.has(n)){const o=U(V(e[n],[...t,String(n)]));r.set(n,o)}return r.get(n).value},set(e,n,o){const i=V(o,[...t,String(n)]);if(!r.has(n)){const e=U(i);r.set(n,e)}return r.get(n).value=i,e[n]=function(e){return F(e)?e.value:e}(i),!0},deleteProperty:(e,t)=>(r.delete(t),Reflect.deleteProperty(e,t))});return $.set(n,r),n}function G(e){return"object"!=typeof e||null===e||e.__isReactive?e:V(e)}function K(e){return null!==e&&"object"==typeof e&&!0===e.__isReactive}function Z(e){if(M.has(e))return M.get(e);const t=U();return B(()=>t.value=e()),M.set(e,t),t}function W(e,t){let r;B(()=>{const n=e();n!==r&&(t(n,r),r=n)})}function J(e){return K(e)?$.get(e):null}function H(e,t,r){const n=J(e);if(!n||!n.has(t))return()=>{};const o=n.get(t);return o?.subscribe?.(()=>r(o.value))??(()=>{})}const{fromBuffer:Q}=E,Y=o;class BaseEntity{__entityTag;deps;apiClient;parent;userContext;endpointApi;data;meta;_draftData={};_initialDraftData={};_serverData=G({});_calledFromSave=!1;_syncReactiveDraft=!1;_isDeleted=!1;_add;_update;_allowedFieldsCache;_allowedFieldsMetadata;static entityTag="BaseEntity";static entityType;static SCHEMA_CONSTANTS;static VIRTUAL_SCHEMAS;static CUSTOM_FIELD_HANDLERS;_checkNotDeleted(){if(this._isDeleted)throw new error_ApiError(`Cet objet ${this.__entityTag} a été supprimé et ne peut plus être utilisé.`,400)}constructor(e,t={},r={},n={}){if(this.__entityTag=n.entityTag||this.getEntityTag(this._getCtor().entityTag)||"BaseEntity",this.deps=r,"ApiClient"===this.getEntityTag(e?.__entityTag))this.apiClient=e,this.parent=null,this.userContext=null;else{if(!e||!("apiClient"in e))throw new error_ApiError("Parent invalide ou ApiClient manquant.",400);{const t=e;this.apiClient=t.apiClient,this.parent=t,this.userContext="User"===this.getEntityTag(t?.__entityTag)?t:t.userContext||null}}if("function"==typeof r.EndpointApi)this.endpointApi=new r.EndpointApi(this.apiClient);else{if("object"!=typeof r.EndpointApi)throw new error_ApiError("deps.EndpointApi doit être une classe ou une instance valide.",500);this.endpointApi=r.EndpointApi}this._serverData=G({});const{draft:o,proxy:i,initial:s}=this._buildDraftAndProxy({data:{...t,...this.defaultFields},serverData:this._serverData,constant:this._getCtor().SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});this._initialDraftData=s,this._draftData=o,this.data=i}_getCtor(){return this.constructor}getEntityTag=e=>e?.replace(/^_/,"");get id(){return this._draftData.id||null}get slug(){return this._draftData.slug||null}_id(e){this._draftData.id=e}get isConnected(){return this.apiClient.isConnected}get userId(){return this.apiClient.userId}get draftData(){return this._draftData}get initialDraftData(){return this._initialDraftData}get serverData(){return this._serverData}get isMe(){return!!(this.isConnected&&this.userId&&this.userContext?.id&&"string"==typeof this.userId&&"string"==typeof this.userContext?.id&&this.userId===this.userContext?.id)}getEntityType(){return this._getCtor().entityType}hasChanges(){const e=this._toRawDeep(this._draftData),t=this._serialize(e),r=this._serialize(this._initialDraftData);return JSON.stringify(t)!==JSON.stringify(r)}async refresh(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);return this.get()}async save(){if(this._checkNotDeleted(),!this.isConnected)throw new error_ApiError("Non connecté.",401);this._calledFromSave=!0;try{const e={...this._draftData};if(!this.id&&"function"==typeof this._add)return await this._add(e),this._resetInitialDraftData(),this.userContext&&await(this.userContext?.refresh()),await this.refresh();if("function"==typeof this._update){const t=await this._update(e);if(this._resetInitialDraftData(),t)return await this.refresh()}return this._serverData}finally{this._calledFromSave=!1}}static fromServerData(e,t,r){const n=new this(t,{},r);return n._setData(e),n}_transformServerData(e){return e}_setData(e,{forceInitialDraftReset:t=!1}={}){this.userContext&&this.userContext!==this&&this.apiClient._logger?.debug?.(`[${this.__entityTag}] Mise à jour liée à userContext : ${this.userContext.id}`);const r=this._transformServerData(e)??{};if(this._serverData&&K(this._serverData)){for(const e of Object.keys(this._serverData))e in r||delete this._serverData[e];for(const e of Object.keys(r))this._serverData[e]=r[e]}else this._serverData=G({...r});const n=this._draftData?this._toRawDeep(this._draftData):{},o={...e||{},...this.defaultFields,...n},{draft:i,proxy:s,initial:a}=this._buildDraftAndProxy({data:o,serverData:this._serverData,previousDraft:this._draftData,constant:this._getCtor().SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});t?this._initialDraftData=structuredClone(this._toRawDeep(i)):this._initialDraftData||(this._initialDraftData=a),K(this._draftData)?this._updateDraftPreservingUserChanges(i):this._draftData=G(i),this.data||(this.data=s)}_updateDraftPreservingUserChanges(e){for(const t of Object.keys(this._draftData||{}))t in e||delete this._draftData[t];for(const t of Object.keys(e)){const r=this._draftData?.[t],n=this._initialDraftData?.[t];void 0!==r&&void 0!==n&&this._serialize(this._toRawDeep(r))!==this._serialize(n)||(this._draftData[t]=e[t])}}_resetInitialDraftData(){const e=this._toRawDeep(this._draftData);this._initialDraftData=structuredClone(e)}_toRawDeep(e){if(!this||"function"!=typeof this._toRawDeep)throw new Error("`this._toRawDeep` is not bound correctly. Use a lambda to preserve context.");if(F(e))return this._toRawDeep(e.value);if(e&&"object"==typeof e&&e.__isReactive&&e.__raw)return this._toRawDeep(e.__raw);if(e instanceof Date)return e;if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return e;if("undefined"!=typeof File&&e instanceof File)return e;if("undefined"!=typeof Blob&&e instanceof Blob)return e;if(e&&"function"==typeof e.pipe&&"function"==typeof e.on)return e;if(Array.isArray(e))return e.map(e=>this._toRawDeep(e));if("object"==typeof e&&null!==e){const t={};for(const r of Object.keys(e))t[r]=this._toRawDeep(e[r]);return t}return e}defaultFields={};removeFields=[];transforms={};toJSON(){const e={};return this.parent?.id&&(e.id=this.parent.id),"function"==typeof this.parent?.getEntityType&&(e.type=this.parent.getEntityType()),this.parent?.__entityTag&&(e.__entityTag=this.parent.__entityTag),this.parent?.slug&&(e.slug=this.parent.slug),this.parent?.serverData&&(e.serverData={id:this.parent.serverData.id,collection:this.parent.serverData.collection,slug:this.parent.serverData.slug,...this.parent.serverData.name&&{name:this.parent.serverData.name},...this.parent.serverData.parent&&{parent:this.parent.serverData.parent},...this.parent.serverData.organizer&&{organizer:this.parent.serverData.organizer},...this.parent.serverData.links&&{links:this.parent.serverData.links}}),{__entityTag:this.__entityTag,__isSerializedEntity:!0,serverData:this._serialize(this._serverData),parent:Object.keys(e).length>0?e:null}}_serialize(e){try{return JSON.parse(L.stringify(this._removeUnserializables(e)))}catch(e){const t=e;return this.apiClient?._logger?.error?.("Erreur de sérialisation EJSON:",{message:t?.message,stack:t?.stack,error:e}),null}}_removeUnserializables(e,t=new WeakSet){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return e;if(e instanceof RegExp)return e;if(e&&"object"==typeof e&&"_bsontype"in e&&"ObjectID"===e._bsontype)return e;if(e instanceof Uint8Array||ArrayBuffer.isView(e))return e;if(e instanceof BaseEntity)return e.toJSON();if(t.has(e))return null;if(t.add(e),e.__isReactive&&"object"==typeof e.__raw)return this._removeUnserializables(e.__raw,t);if(Array.isArray(e))return e.map(e=>this._removeUnserializables(e,t));const r={};for(const n of Object.keys(e)){const o=e[n];if("function"!=typeof o&&"symbol"!=typeof o&&void 0!==o)try{r[n]=this._removeUnserializables(o,t)}catch{r[n]=null}}return r}static _revive(e,t){const r=L.fromJSONValue(e);return this._deserializeNestedEntities(r,t)}static _deserializeNestedEntities(e,t){if(null===e||"object"!=typeof e)return e;if(e instanceof Date||e instanceof RegExp)return e;if(Array.isArray(e))return e.map(e=>this._deserializeNestedEntities(e,t));if(e.__isSerializedEntity&&e.__entityTag&&e.serverData)return I(e,t);const r={};for(const[n,o]of Object.entries(e))r[n]=this._deserializeNestedEntities(o,t);return r}static fromJSON(e,t,r){if(!e||"object"!=typeof e||!("serverData"in e))throw new Error("Invalid JSON format: missing serverData");const{serverData:n}=e;return this.fromServerData(this._revive(n,t),t,r||{})}async call(e,t={}){return this.apiClient.safeCall(async()=>{const r=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(r),r.data})}async callNoConnected(e,t={}){if(this.isConnected)throw new error_ApiAuthenticationError("Vous devez ne devez pas être connecté pour faire cette action.",403);return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new error_ApiAuthenticationError("Vous devez être connecté pour faire cette action.",401);return"function"==typeof e?await e():this.call(e,t)}async callIsMe(e,t={}){if(!this.isMe)throw new error_ApiAuthenticationError("Vous devez être vous-même pour faire cette action.",403);return"function"==typeof e?await e():await this.callIsConnected(e,t)}async _validateImage(e){return await this._validateUploadInput(e,{allowedMimeTypes:["image/jpeg","image/png","image/jpg"],expectedType:"image"})}async _validateFile(e){return await this._validateUploadInput(e,{allowedMimeTypes:["application/pdf","text/plain","text/csv"],expectedType:"file"})}async _validateUploadInput(e,{allowedMimeTypes:t=[],expectedType:r="any"}){if(!e)throw new error_ApiValidationError("Le fichier est requis.",400,["Le fichier est requis"]);const n="undefined"==typeof window&&"undefined"!=typeof process;let o=null,i="";if("undefined"!=typeof File&&e instanceof File){if(i=e.type,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);o=e}else if("undefined"!=typeof Blob&&e instanceof Blob){if(i=e.type,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);const r=i.split("/")[1]||"bin",n=`${Date.now()}.${r}`;o=new File([e],n,{type:i})}else if(n&&Buffer.isBuffer(e)){const n=await Q(e);if(!n)throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);if(i=n.mime,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);if("image"===r){const t=n.ext,r=`${Date.now()}.${t}`;o=await this._createReadStreamFromBuffer(e,r,i)}else o=e}else{if(!n||!(s=e)||"object"!=typeof s||"function"!=typeof s.pipe||"function"!=typeof s.on)throw new error_ApiValidationError("Type de fichier non reconnu.",400,["Type de fichier non reconnu."]);{const r=e,n=[],s=await this._passThrough(),a=await this._passThrough(),c=4100;let p=0;r.on("data",e=>{p<c&&(n.push(e),p+=e.length)}),r.pipe(s).pipe(a),await new Promise(e=>setTimeout(e,10));const d=Buffer.concat(n),m=await Q(d);if(!m)throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);if(i=m.mime,!t.includes(i))throw new error_ApiValidationError("Le type du fichier est invalide.",400,["Le type du fichier est invalide"]);a.path=`${Date.now()}.${m.ext}`,a.mimeType=i,o=a}}var s;return o}async _createReadStreamFromBuffer(e,t="file.bin",r="application/octet-stream"){const n=await this._bufferToReadable(e);return n.path=t,n.mimeType=r,n}async _bufferToReadable(e){if("undefined"==typeof window){const{bufferToReadable:t}=await _.e(401).then(_.bind(_,401));return t(e)}throw new Error("bufferToReadable ne doit pas être appelé dans le navigateur")}async _passThrough(){if("undefined"==typeof window){const{createPassThrough:e}=await _.e(401).then(_.bind(_,401));return e()}throw new Error("passThrough ne doit pas être appelé dans le navigateur")}_omitProps(e,t){if(!e||"object"!=typeof e)return{};const r={...e};for(const e of t)delete r[e];return r}_pickProps(e,t,r={}){if(!e||"object"!=typeof e)return{};const n={};for(const o of t)if(o in e){const t=e[o];"function"==typeof r[o]?n[o]=r[o](t,e):n[o]=t}return n}_hasAtLeastOne(e,t=[]){return t.some(t=>t in e&&null!=e[t])}_createFilteredProxy(e){return new Proxy(e,{get(e,t,r){const n=e.filter(e=>!e._isDeleted);if("length"===t)return n.length;if("string"==typeof t&&/^\d+$/.test(t))return n[Number(t)];const o=Reflect.get(n,t,r);return"function"==typeof o?o.bind(n):o}})}_newId(){return Y().toHexString()}_getAllowedFieldsForCurrentState(){if(!this._allowedFieldsMetadata)return this._allowedFieldsCache||[];const{combinedSchema:e,removeFields:t}=this._allowedFieldsMetadata,r=this._toRawDeep(this._draftData),n={...this.defaultFields,...r};let o=this._extractWritableFields(e,n);return n.id&&!o.includes("id")&&o.push("id"),n.slug&&!o.includes("slug")&&o.push("slug"),o=o.filter(e=>!t.includes(e)),o}_createDraftProxy(e,t={},r={},n=[],o={},i={},s=this){return new Proxy({},{get:(e,n)=>{if("string"==typeof n||"symbol"==typeof n){if("string"==typeof n&&n in r){const e=r[n],t=o[n];return"function"==typeof t?t(e,r):e}if(t&&"object"==typeof t&&"string"==typeof n&&n in t){const e=t[n],r=o[n];return"function"==typeof r?r(e,t):e}}},set:(t,n,o)=>{if("string"!=typeof n)return!1;const a=s._getAllowedFieldsForCurrentState();if(!a.includes(n)){const t=`[DraftProxy] Le champ "${n}" n'est pas autorisé.`;if(i.throwOnError)throw new error_ApiValidationError(t,400,[t],{field:n,value:o,allowedFields:a});return e._logger?.warn?.(t),!1}const c=r[n];return c&&"object"==typeof c&&!0===c.__isSignal?c.value=o:r[n]=o,!0},deleteProperty:(e,t)=>"string"==typeof t&&(!!s._getAllowedFieldsForCurrentState().includes(t)&&(delete r[t],!0)),has:(e,n)=>"string"==typeof n&&(n in r||t&&"object"==typeof t&&n in t),ownKeys:()=>{const e=new Set([...Object.keys(t||{}),...Object.keys(r||{})]);return Array.from(e)},getOwnPropertyDescriptor:(e,n)=>{if("string"==typeof n)return n in r||t&&"object"==typeof t&&n in t?{enumerable:!0,configurable:!0}:void 0}})}_extractWritableFields(e={},t={},r={defs:{},visited:new Set}){if(!e||"object"!=typeof e)return[];if(e.$id&&r.visited.has(e.$id))return[];e.$id&&r.visited.add(e.$id),r.defs=e.$defs||e.definitions||r.defs;const n=[];if(e.$ref){const o=e.$ref.replace(/^#\/?(\$defs|definitions)\//,""),i=r.defs[o];i&&n.push(...this._extractWritableFields(i,t,r))}if(e.allOf&&e.allOf.forEach(e=>n.push(...this._extractWritableFields(e,t,r))),e.if&&e.then){const o=e.if.properties;let i=!0;if(o)for(const e in o){const r=o[e]?.const;if(t[e]!==r){i=!1;break}}i&&e.then?n.push(...this._extractWritableFields(e.then,t,r)):!i&&e.else&&n.push(...this._extractWritableFields(e.else,t,r))}return e.properties&&n.push(...Object.entries(e.properties).filter(([e,t])=>!0!==t.readOnly&&void 0===t.const).map(([e])=>e)),Array.from(new Set(n))}_buildDraftAndProxy({data:e={},serverData:t=null,previousDraft:r=null,constant:n,apiClient:o,transforms:i={},throwOnError:s=!0,removeFields:a=[]}){const c=Array.isArray(n)?n:[n],p={allOf:[],$defs:{}};for(const e of c){let t=o.getRequestSchema(e);const r=this._getCtor(),n=r.VIRTUAL_SCHEMAS?.[e];if(n&&(t=this._mergeSchemas(t,n)),!t)throw new error_ApiError(`Unable to find schema for ${e}.`,404);if(t.$defs)for(const[r,n]of Object.entries(t.$defs))p.$defs[r]?o._logger.warn(`Duplicate $defs key '${r}' from schema '${e}'`):p.$defs[r]=n;p.allOf.push(t)}let d=this._extractWritableFields(p,e);e.id&&-1===d.indexOf("id")&&d.push("id"),e.slug&&-1===d.indexOf("slug")&&d.push("slug"),d=d.filter(e=>!a.includes(e)),this._allowedFieldsCache=d,this._allowedFieldsMetadata={combinedSchema:p,transforms:i,removeFields:a};const m=Object.fromEntries(d.map(t=>{const r=e[t];return[t,"function"==typeof i[t]?i[t](r,e):r]}).filter(([e,t])=>void 0!==t)),l=structuredClone?structuredClone(m):JSON.parse(JSON.stringify(m)),u=r&&K(r)?Object.assign(r,m):G(m),h=K(t)?t:t&&"object"==typeof t?G(t):t;return{draft:u,proxy:this._createDraftProxy(o,h,u,d,i,{throwOnError:s}),initial:l}}async _invokeBlockMethod(e,t,r){const n=this[t];return await n.call(this,r)}_isUploadType(e){return!("undefined"==typeof Buffer||!Buffer.isBuffer(e))||"undefined"!=typeof File&&e instanceof File||"undefined"!=typeof Blob&&e instanceof Blob||!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on)}_compareValues(e,t){return this._isUploadType(e)||this._isUploadType(t)?e!==t:JSON.stringify(this._toRawDeep(e))!==JSON.stringify(this._toRawDeep(t))}_mergeSchemas(e,t){return e?t?{allOf:[e,t],$defs:{...e.$defs,...t.$defs}}:e:t}_hasFieldChanged(e){const t=this._draftData[e],r=this._initialDraftData[e];return this._compareValues(t,r)}async _invokeCustomFieldHandler(e,t,r){const n=this[e];if("function"!=typeof n)throw new error_ApiError(`Custom handler "${e}" not found for field "${r}"`,500);return await n.call(this,t)}_extractChangedFieldsFromSchema(e,t,r={},n,o=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,r);const a={},c=n?.()||{};s=s.filter(e=>!o.includes(e));for(const e of s){if(void 0===r[e])continue;const t=r[e],n=c[e];this._compareValues(t,n)&&(a[e]=t)}return Object.keys(a).length>0?a:null}_extractAllValidFieldsFromSchema(e,t,r={},n,o=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,r);const a={},c={},p=n?.()||{};s=s.filter(e=>!o.includes(e));for(const e of s){if(void 0===r[e])continue;const t=r[e],n=p[e];JSON.stringify(t)!==JSON.stringify(n)&&(a[e]=t),c[e]=t}return Object.keys(a).length>0?c:null}async _resolveId(e){if(!this.id&&this.slug)try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:this.slug}});if(!t.contextId||t.contextType!==e)throw new error_ApiResponseError(`Le slug ${this.slug} ne correspond pas à un ${e}`,200,t);this._id(t.contextId)}catch(t){if(t instanceof error_ApiResponseError)throw t.responseData.contextType!==e?t:new error_ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.responseData);throw t}if(!this.id)throw new error_ApiError(`Impossible de résoudre l'identifiant pour le type ${e}.`,404);return this.id}async _getPublicProfile(){if(await this._resolveId(this.getEntityType()),!this.id)throw new error_ApiError("L'identifiant de l'entité n'est pas défini.",400);const e=this.getEntityType();if("news"===e||"comments"===e)throw new error_ApiError(`getElementsAbout ne supporte pas le type '${e}'.`,400);return this.endpointApi.getElementsAbout({pathParams:{id:this.id,type:e},tpl:"ficheInfoElement"})}_getEntityMeta(e){const t=this.constructor,r=this.__entityTag,n={EndpointApi:this.deps.EndpointApi,User:"User"===r?t:this.deps.User,Organization:"Organization"===r?t:this.deps.Organization,Project:"Project"===r?t:this.deps.Project,Event:"Event"===r?t:this.deps.Event,Poi:"Poi"===r?t:this.deps.Poi,Badge:"Badge"===r?t:this.deps.Badge,News:"News"===r?t:this.deps.News,Comment:"Comment"===r?t:this.deps.Comment,Answer:"Answer"===r?t:this.deps.Answer,Form:"Form"===r?t:this.deps.Form,Classified:"Classified"===r?t:this.deps.Classified,Action:"Action"===r?t:this.deps.Action};return{classifieds:{entityClass:n.Classified,deps:{...n}},citoyens:{entityClass:n.User,deps:n},organizations:{entityClass:n.Organization,deps:n},projects:{entityClass:n.Project,deps:n},events:{entityClass:n.Event,deps:{...n,Badge:void 0}},poi:{entityClass:n.Poi,deps:{...n,Badge:void 0,News:void 0}},news:{entityClass:n.News,deps:{...n}},badges:{entityClass:n.Badge,deps:{EndpointApi:n.EndpointApi,User:n.User,Organization:n.Organization,Project:n.Project}},comments:{entityClass:n.Comment,deps:{...n}},answers:{entityClass:n.Answer,deps:{...n}},forms:{entityClass:n.Form,deps:{...n}},actions:{entityClass:n.Action,deps:{...n}}}[e]||null}_linkEntity(e,t){const r=this._getEntityMeta(e);return r?r.entityClass.fromServerData(t,this,r.deps):t}_linkNestedEntity(e){if(!e||"object"!=typeof e)return e;if(!e.id||!e.type)return e;try{return this._linkEntity(e.type,e)}catch(t){return this.apiClient._logger?.warn?.(`Impossible de lier l'entité imbriquée de type ${e.type}:`,t),e}}async _linkEntityById(e,t,r){const n=this._getEntityMeta(e);if(!n)return null;const o=new n.entityClass(this,{id:t},n.deps);return r?.skipGet||await o.get(),o}_linkEntities(e){return e.flatMap(e=>e?.collection?[this._linkEntity?.(e.collection,e)??e]:(this.apiClient._logger?.warn?.(`Objet ignoré car sans 'collection' : ${e?.id}`),[]))}async linkEntitiesFromServerData(e,t={},r={}){const n=r.key||e,o="function"==typeof r.mapFn?r.mapFn:null,i=e=>!0===e||"true"===e,s=e=>!1===e||"false"===e,a=this.serverData?.[n],c=[];if(a&&"object"==typeof a&&Object.keys(a).length>0)for(const r of Object.keys(a)){const n=a[r],p=Object.entries(t).every(([e,t])=>{const r=n[e];if("function"==typeof t)try{return t(r)}catch(t){return console.warn(`Erreur dans le filtre personnalisé pour ${e}`,t),!1}return t instanceof RegExp?"string"==typeof r&&t.test(r):"string"==typeof t&&"string"==typeof r?r.toLowerCase().includes(t.toLowerCase()):i(t)?i(r):s(t)?s(r):"string"!=typeof r||"string"!=typeof t||isNaN(Date.parse(r))||isNaN(Date.parse(t))?r===t:new Date(r).getTime()===new Date(t).getTime()});if(p)try{const t=await this._linkEntityById(e,r);t&&(t.meta=n,c.push(o?o(t):t))}catch(t){this.apiClient._logger?.error?.(`Erreur lors de la récupération de l'entité ${e} (${r}) :`,t)}}return c}_entityInstanceData(e,t){const r=this._getEntityMeta(e);if(!r)throw new error_ApiError(`Type d'entité inconnu: ${e}`,400);const n=this.__entityTag,o=this.constructor;return new r.entityClass(this,t,{[n]:o,...r.deps})}async entity(e,t={}){try{const r=this._entityInstanceData(e,t),n={citoyens:["id","slug"],organizations:["id","slug"],projects:["id","slug"],events:["id","slug"],poi:["id","slug"],news:["id"],badges:["id"],comments:[],answers:["id"],classifieds:["id"],actions:["id"]}[e];return n&&this._hasAtLeastOne(t,n)&&await r.get(),r}catch(t){throw this.apiClient._logger.error(`[Api.${this.__entityTag}.${e}] Erreur lors de la création d'une instance ${e} :`,t.message),t}}async entityBySlug(e){if(!e)throw new error_ApiError("Le slug est requis.",400);try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t.contextId&&t.contextType){const e=await this.entity(t.contextType,{id:t.contextId});return await this._fixEntityUserContext(e),e}throw new error_ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof error_ApiResponseError?new error_ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${e}`,t.status,t.responseData):t}}async _fixEntityUserContext(e){const t=e.getEntityType();if(!["events","projects","poi"].includes(t))return;const r=this._extractRealParent(e);if(!r)return;const n=await this._findOrCreateParent(r);n&&n!==e.parent&&(e.userContext=this._extractUserContext(n),e.parent=n)}_extractRealParent(e){const t=e.serverData;if("events"===e.getEntityType()){const e=t;if(e.organizer){const t=Object.entries(e.organizer),r=t.find(([e,t])=>"projects"===t.type);if(r)return{type:"projects",id:r[0]};const n=t.find(([e,t])=>"organizations"===t.type);if(n)return{type:"organizations",id:n[0]};const o=t.find(([e,t])=>"citoyens"===t.type);if(o)return{type:"citoyens",id:o[0]};const i=t[0];if(i&&i[1])return{type:i[1].type,id:i[0]}}}const r=t;if(r.parent){const e=Object.entries(r.parent)[0];if(e&&e[1])return{type:e[1].type,id:e[0]}}return null}async _findOrCreateParent(e){try{let t=this.parent;for(;t;){if(t.id===e.id&&t.getEntityType()===e.type)return t;t=t.parent}const r={citoyens:"citoyens",organizations:"organizations",projects:"projects"}[e.type];if(r){const t=this._entityInstanceData(r,{id:e.id});return await t.get(),t}return null}catch(e){return this.apiClient._logger?.warn?.("Impossible de créer le parent réel:",e),null}}_extractUserContext(e){return"User"===this.getEntityTag(e?.__entityTag)?e:e.userContext||null}_isAdminViaHierarchy(){const e=this.getEntityType(),t=this.serverData;let r;if("events"===e)r=t?.organizer;else{if("projects"!==e&&"poi"!==e&&"classifieds"!==e)return!1;r=t?.parent}if(!r||"object"!=typeof r)return!1;for(const[e,t]of Object.entries(r)){if(!t||"object"!=typeof t)continue;const r=t.type;if(r&&this._isAdminOfParent(e,r))return!0}return!1}_isAdminOfParent(e,t){const r=this.userContext?.serverData?.links;if(!r)return!1;let n;if("citoyens"===t)return!1;if("organizations"===t)n="memberOf";else{if("projects"!==t)return!1;n="projects"}const o=r[n];if(!o)return!1;const i=o[e];return this._validateUserLink(i)&&!0===i?.isAdmin&&!i?.isAdminPending}_buildLinkFilters(e,{linkType:t,isAdmin:r,isAdminPending:n,isInviting:o,toBeValidated:i=!1,roles:s=[]}){if("string"!=typeof e||null===e)throw new TypeError("id doit être une chaîne non-nulle.");if("string"!=typeof t)throw new TypeError("linkType doit être une chaîne.");if(void 0!==r&&"boolean"!=typeof r)throw new TypeError("isAdmin doit être un booléen.");if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("isAdminPending doit être un booléen.");if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("isInviting doit être un booléen.");if(void 0!==i&&"boolean"!=typeof i)throw new TypeError("toBeValidated doit être un booléen.");if(!Array.isArray(s))throw new TypeError("roles doit être un tableau de chaînes.");const a=`links.${t}.${e}`,c={[`${a}`]:{$exists:!0}};return"boolean"==typeof i&&(c[`${a}.toBeValidated`]={$exists:i}),"boolean"==typeof o&&(c[`${a}.isInviting`]={$exists:o}),!0===r&&(c[`${a}.isAdmin`]={$exists:!0}),!0===n&&(c[`${a}.isAdminPending`]={$exists:!0}),s.length>0&&(c[`${a}.roles`]={$in:s}),c}_getLinkMeta(){const e=this.getEntityType(),t={organizations:{linkType:"memberOf",connectTypeConnect:"member",connectTypeDisconnect:"members"},projects:{linkType:"projects",connectTypeConnect:"contributor",connectTypeDisconnect:"contributors"},events:{linkType:"events",connectTypeConnect:"attendee",connectTypeDisconnect:"attendees"},citoyens:{linkType:"friends",connectTypeConnect:"friend",connectTypeDisconnect:"friends"}}[e];if(!t)throw new error_ApiError(`Aucune correspondance de lien définie pour le type d'entité "${e}"`,404);return t}_checkLinkableEntity(){try{this._getLinkMeta()}catch(e){if(e instanceof error_ApiError)throw new error_ApiError(`L'entité "${this.getEntityType()}" ne prend pas en charge les actions de lien.`,400);throw e}}_getLinkFromConnectedUser(){const{linkType:e}=this._getLinkMeta();if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);return this?.userContext?.serverData?.links?.[e]?.[this.id]||null}async _submitLinkRequest(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){this._assertNotEntityType("connect",["poi","badges","news","actions"]);const t=this.getEntityType(),r={childId:this.userId,childType:"citoyens",parentType:t,parentId:this.id,connectType:e},n=await this.callIsMe(()=>this.endpointApi.connect(r));return await(this.userContext?.refresh()),n}if(t.isInviting)return this._acceptLinkRequest();if(t.toBeValidated)throw new error_ApiError("Vous êtes déjà en attente de validation.",400);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",400)}async _submitLinkRequestAdmin(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const e=this._getLinkFromConnectedUser();if(!e){this._assertNotEntityType("connect",["poi","badges","news","actions"]);const e=this.getEntityType(),t={childId:this.userId,childType:"citoyens",parentType:e,parentId:this.id,connectType:"admin"},r=await this.callIsMe(()=>this.endpointApi.connect(t));return await(this.userContext?.refresh()),r}if(e.isInviting||e.isAdminInviting)return this._acceptLinkRequest();if(e.toBeValidated&&e.isAdminPending)throw new error_ApiError("Vous êtes déjà en attente de validation pour devenir admin.",400);if(e.toBeValidated)throw new error_ApiError("Vous êtes déjà en attente de validation pour rejoindre cette entité.",400);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",400)}async _acceptLinkRequest(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const e=this._getLinkFromConnectedUser();if(e&&(e.isInviting||e.isAdminInviting)){this._assertNotEntityType("linkValidate",["poi","badges","news","actions"]);const e=this.getEntityType(),t={childId:this.userId,childType:"citoyens",parentType:e,parentId:this.id,linkOption:"isInviting"},r=await this.callIsMe(()=>this.endpointApi.linkValidate(t));return await(this.userContext?.refresh()),r}throw new error_ApiError("Vous n'avez pas d'invitation à valider.",400)}async _leaveLinkRequest(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new error_ApiError("Vous n'êtes pas connecté à cette entité.",404);this._assertNotEntityType("disconnect",["poi","badges","news","actions"]);const t=this.getEntityType(),r={childId:this.userId,childType:"citoyens",parentType:t,parentId:this.id,connectType:e},n=await this.callIsMe(()=>this.endpointApi.disconnect(r));return await(this.userContext?.refresh()),n}async get(){return this.apiClient.safeCall(async()=>{const e=await this._getPublicProfile();return this._setData(e,{forceInitialDraftReset:!0}),e})}async updateSettings(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateSettings",["poi","badges","news","actions"]);const t=this.getEntityType(),{type:r,value:n}=e;if("string"!=typeof r)throw new error_ApiValidationError("Le champ 'type' est requis (string).",400,["type requis"]);const o={type:r,value:n,idEntity:this.id,typeEntity:t};return this.callIsConnected(()=>this.endpointApi.updateSettings(o))}async updateDescription(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateDescription",["badges","news","actions"]);const t=this.getEntityType(),r={block:"descriptions",id:this.id,typeElement:t,...e};return this.callIsConnected(()=>this.endpointApi.updateBlockDescription(r))}async updateInfo(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateInfo",["badges","news","actions"]);const t=this.getEntityType(),r={block:"info",id:this.id,typeElement:t,...e};return this.callIsConnected(()=>this.endpointApi.updateBlockInfo(r))}async updateSocial(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateSocial",["badges","news","poi","events","actions"]);const t=this.getEntityType(),r={block:"network",id:this.id,typeElement:t,...e};return this.callIsConnected(()=>this.endpointApi.updateBlockSocial(r))}_isPostalAddress(e){return!!e&&"object"==typeof e&&"PostalAddress"===e["@type"]&&"string"==typeof e.addressCountry&&"string"==typeof e.addressLocality&&"string"==typeof e.level1&&"string"==typeof e.level1Name&&"string"==typeof e.codeInsee&&"string"==typeof e.localityId}_isGeo(e){return!(!e||"object"!=typeof e||"number"!=typeof e.latitude&&"string"!=typeof e.latitude||"number"!=typeof e.longitude&&"string"!=typeof e.longitude)}_isGeoPosition(e){return!!e&&"object"==typeof e&&"Point"===e.type&&Array.isArray(e.coordinates)&&2===e.coordinates.length&&("number"==typeof e.coordinates[0]||"string"==typeof e.coordinates[0])&&("number"==typeof e.coordinates[1]||"string"==typeof e.coordinates[1])&&!0===e.float}async updateLocality(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(this._assertNotEntityType("updateLocality",["badges","news","comments","answers","actions"]),!("address"in e))throw new error_ApiValidationError("Le champ 'address' est requis.",400,["address requis"]);const t=e.address;if(""!==t&&!this._isPostalAddress(t))throw new error_ApiValidationError("Format de 'address' invalide.",400,["address invalide"]);const r=t,n=this.getEntityType(),o={block:"localities",id:this.id,typeElement:n,address:r,..."geo"in e&&this._isGeo(e.geo)?{geo:e.geo}:{},..."geoPosition"in e&&this._isGeoPosition(e.geoPosition)?{geoPosition:e.geoPosition}:{},..."locality"in e?{locality:e.locality}:{}};return this.callIsConnected(()=>this.endpointApi.updateBlockLocality(o))}async updateSlug({slug:e}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateSlug",["badges","news","poi","comments","actions"]);const t=this.getEntityType();try{await this.endpointApi.check({block:"info",type:t,id:this.id,slug:e})}catch(e){if(e instanceof error_ApiResponseError)throw new error_ApiResponseError("Erreur lors de la vérification du slug.",e.status,e.responseData);throw e}const r={block:"info",typeElement:t,id:this.id,slug:e};return this.callIsConnected(()=>this.endpointApi.updateBlockSlug(r))}async updateImageProfil({profil_avatar:e}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateImageProfil",["badges","news","comments","answers","actions"]);const t=this.getEntityType();e=await this._validateImage(e);const r={pathParams:{folder:t,ownerId:this.id},profil_avatar:e};return this.callIsConnected(()=>this.endpointApi.profilImage(r))}async updateImageBanner({banner:e,cropW:t,cropH:r,cropX:n,cropY:o}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("updateImageBanner",["badges","news","comments","answers","actions"]);const i=this.getEntityType();e=await this._validateImage(e);const s={pathParams:{folder:i,ownerId:this.id},parentType:i,parentId:this.id,formOrigin:"banner",cropW:t,cropH:r,cropX:n,cropY:o,banner:e};return this.callIsConnected(()=>this.endpointApi.profilBanner(s))}async organization(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.",403);return await this.entity("organizations",e)}async project(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un projet.",401);return await this.entity("projects",e)}async poi(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un POI.",401);return await this.entity("poi",e)}async classified(e={}){if(!("id"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer une ressource.",401);return await this.entity("classifieds",e)}async event(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un événement.",401);return await this.entity("events",e)}async badge(e={}){if(!("id"in e)&&!this.isConnected)throw new error_ApiError("Vous devez être connecté pour créer un badge.",401);return await this.entity("badges",e)}async news(e={}){if(!e?.id&&!this.isConnected)throw new error_ApiError("Vous devez être connecté.",401);return await this.entity("news",e)}async action(e={}){throw new error_ApiError(`action n'existe pas dans ${this.constructor.name}`,501)}async getOrganizations(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getOrganizations",restoredState:t?.restoredState,finalizer:async e=>(this.isMe?e.pathParams={type:this.getEntityType(),id:this.id}:(delete e?.pathParams,e.filters={[`links.members.${this.id}`]:{$exists:!0},[`links.members.${this.id}.toBeValidated`]:{$exists:!1},[`links.members.${this.id}.isInviting`]:{$exists:!1}}),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getOrganizationsAdmin(e)):()=>this.endpointApi.getOrganizationsNoAdmin(e))())}).next()}async getProjects(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_PROJECTS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getProjects",restoredState:t?.restoredState,finalizer:async e=>(this.isMe?(e.pathParams={type:this.getEntityType(),id:this.id},e.filters={$or:{[`links.contributors.${this.id}`]:{$exists:!0},[`parent.${this.id}`]:{$exists:!0}},[`links.contributors.${this.id}`]:{$exists:!0}}):(delete e?.pathParams,e.filters={$or:{[`links.contributors.${this.id}`]:{$exists:!0},[`parent.${this.id}`]:{$exists:!0}},[`links.contributors.${this.id}`]:{$exists:!0}}),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getProjectsAdmin(e)):()=>this.endpointApi.getProjectsNoAdmin(e))())}).next()}async getEvents(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_EVENTS","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getEvents",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,e.filters={$or:{[`links.attendees.${this.id}`]:{$exists:!0},[`organizer.${this.id}`]:{$exists:!0}}},this.endpointApi.getEvents(e))}).next()}async getPois(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_POIS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getPois",restoredState:t?.restoredState,finalizer:async e=>(this.isMe?e.pathParams={type:this.getEntityType(),id:this.id}:(delete e?.pathParams,e.filters={[`parent.${this.id}`]:{$exists:!0}}),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getPoisAdmin(e)):()=>this.endpointApi.getPoisNoAdmin(e))())}).next()}async getSubscribers(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIBERS","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getSubscribers",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,e.filters={[`links.follows.${this.id}`]:{$exists:!0},[`links.follows.${this.id}.toBeValidated`]:{$exists:!1},[`links.follows.${this.id}.isInviting`]:{$exists:!1}},this.endpointApi.getSubscribers(e))}).next()}async getBadgesIssuer(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_BADGES","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getBadgesIssuer",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,e.filters=e.filters||{"preferences.private":!1},e.filters.$or={},e.filters.$or[`issuer.${this.id}`]={$exists:!0},this.endpointApi.getBadges(e))}).next()}async getNews(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("getNews",["badges","news","poi","events","comments","answers","actions"]);const t=this.getEntityType(),r="dateLimit"in e&&"number"==typeof e.dateLimit?{dateLimit:e.dateLimit}:{dateLimit:0},n="indexStep"in e&&"number"==typeof e.indexStep?{indexStep:e.indexStep}:{indexStep:12},o="search"in e&&"object"==typeof e.search&&null!==e.search&&"name"in e.search&&"string"==typeof e.search.name?{search:{name:e.search.name}}:{},i={pathParams:{type:t,id:this.id,isLive:!0},...r,...n,...o},s=await this.endpointApi.getNews(i);if(!Array.isArray(s))throw new error_ApiResponseError("Erreur lors de la récupération des actualités.",500,s);const a=this._linkEntities(s);return this._createFilteredProxy(a)}async getGallery(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);this._assertNotEntityType("getGallery",["badges","news","poi","events","comments","answers","actions"]);const t={pathParams:{type:this.getEntityType(),id:this.id,docType:e.pathParams?.docType||"image"}};return await this.endpointApi.getGallery(t)}async searchMembers(e){const t=await this.endpointApi.searchMemberAutocomplete(e);return t&&Array.isArray(t)?(this._assertNotEntityType("searchMembers",["badges","news","poi","comments","actions"]),t.forEach(e=>{for(const t of Object.keys(e))["id","name","slug","profilThumbImageUrl","profilMarkerImageUrl","type","collection"].includes(t)||delete e[t]}),this._linkEntities(t)):[]}async requestToJoin(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._submitLinkRequest()}async requestToJoinAdmin(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._submitLinkRequestAdmin()}async requestPromoteToAdmin(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);const e=this._getLinkFromConnectedUser();if(!e)throw new error_ApiError("vous n'êtes pas membre de cette entité.",400);if(e?.isAdmin&&(e?.isInviting||e?.isAdminInviting))throw new error_ApiError("Cet utilisateur est déjà en cours d'invitation en tant qu'admin.",400);if(e?.isAdmin&&!e?.isInviting&&!e?.isAdminInviting)throw new error_ApiError("Cet utilisateur est déjà admin.",400);const t=this.getEntityType(),r=["organizations","projects"];if(!r.includes(t))throw new error_ApiError(`L'entité doit être de type : ${r.join(", ")}, reçu : ${t}`,400);const n=t,o={childId:this.userId,childType:"citoyens",parentType:n,parentId:this.id,connectType:"admin"},i=await this.callIsMe(()=>this.endpointApi.connect(o));return await(this.userContext?.refresh()),i}async acceptInvitation(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._acceptLinkRequest()}async leave(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour envoyer une demande de participation.",401);return this._checkLinkableEntity(),this._leaveLinkRequest()}async follow(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour suivre cette entité.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401);this._assertNotEntityType("follow",["badges","news","poi","comments","actions"]);const e=this.getEntityType();if(!this.userContext?.serverData?.links?.follows?.[this.id]){const t={childId:this.userId,childType:"citoyens",parentType:e,parentId:this.id},r=await this.callIsMe(()=>this.endpointApi.follow(t));return await(this.userContext?.refresh()),r}throw new error_ApiError("Vous êtes déjà abonné à cette entité.",409)}async unfollow(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour vous désabonner.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401);const e=this.userContext?.serverData?.links?.follows?.[this.id]||null;this._assertNotEntityType("unfollow",["badges","news","poi","actions"]);const t=this.getEntityType();if(e){const e={childId:this.userId,childType:"citoyens",parentType:t,parentId:this.id,connectType:"followers"},r=await this.callIsMe(()=>this.endpointApi.disconnect(e));return await(this.userContext?.refresh()),r}throw new error_ApiError("Vous n'êtes pas abonné à cette entité.",404)}_checkAccess(e="effectuer cette action"){if(!this.isMe)throw new error_ApiError(`Vous devez être connecté pour ${e}.`,401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404)}_validateUserLink(e){if(!e)return!1;const{toBeValidated:t,isInviting:r,isAdminInviting:n,isAdminPending:o}=e;return!(t||r||n||o)}_assertEntityType(...e){const t=Array.isArray(e[0])?e[0]:e;if(!t.includes(this.getEntityType()))throw new error_ApiError(`L'entité doit être de type : ${t.join(", ")}, reçu : ${this.getEntityType()}`,400)}_assertNotEntityType(e,...t){const r=Array.isArray(t[0])?t[0]:t,n=this.getEntityType();if(r.includes(n))throw new error_ApiError(`Le type d'entité "${n}" n'est pas supporté par ${e}.`,400)}_getValidatedUserLink(e,t,r){const n=r?.silent??!0;try{this._checkAccess(e),this._assertEntityType(...t)}catch(e){if(n)return null;throw e}return this._getLinkFromConnectedUser()}_isLinked(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t=this.userContext?.serverData?.links;return!!t&&!!t[e]?.[this.id]}isAuthor(e){const t=e?.silent??!0;try{if(this._checkAccess("vérifier l'auteur"),!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401)}catch(e){if(t)return!1;throw e}const r=this.serverData;return!!r.creator&&Boolean(this.userId&&"string"==typeof r.creator&&r.creator===this.userId)}isAdmin(e){const t=this._getValidatedUserLink("vérifier l'administrateur",["organizations","projects","events","classifieds"],{silent:e?.silent});return!(!this._validateUserLink(t)||!0!==t?.isAdmin||t?.isAdminPending)||!!e?.checkHierarchy&&this._isAdminViaHierarchy()}isAuthorOrAdmin(e){return this.isAuthor()||this.isAdmin(e)}isMember(e){const t=this._getValidatedUserLink("vérifier le membre",["organizations"],{silent:e?.silent});return this._validateUserLink(t)}isContributor(e){const t=this._getValidatedUserLink("vérifier le contributeur",["projects"],{silent:e?.silent});return this._validateUserLink(t)}isAttendee(e){const t=this._getValidatedUserLink("vérifier le participant",["events"],{silent:e?.silent});return this._validateUserLink(t)}isFollower(e){const t=e?.silent??!0,r=["citoyens","organizations","projects","events","poi"];try{this._checkAccess("vérifier si il vous suit"),this._assertEntityType(...r)}catch(e){if(t)return!1;throw e}return this._isLinked("followers")}isFollowing(e){const t=e?.silent??!0,r=["citoyens","organizations","projects","events","poi"];try{this._checkAccess("vérifier si vous le suivez"),this._assertEntityType(...r)}catch(e){if(t)return!1;throw e}return this._isLinked("follows")}isToBeValidated(e){const t=this._getValidatedUserLink("vérifier si il est à valider",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.toBeValidated}isInviting(e){const t=this._getValidatedUserLink("vérifier si il est invité",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isInviting}isInvitingAdmin(e){const t=this._getValidatedUserLink("vérifier si il est invité admin",["organizations","projects","events"],{silent:e?.silent});return!!t&&(!0===t.isAdminInviting||!0===t.isInviting)&&!0===t.isAdmin}isAdminPending(e){const t=this._getValidatedUserLink("vérifier si il est en attente admin",["organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isAdmin&&!0===t.isAdminPending}async getCostumJson(){if(!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);const e=this.serverData;if(!e||"string"!=typeof e.slug||""===e.slug.trim())throw new error_ApiError("slug de l'entité non défini",400);const t={pathParams:{slug:e.slug}};return this.endpointApi.getCostumJson(t)}_generateRanges(e,t,r={}){const n={};for(const o of e){const e=r[o]||{indexMax:0};n[o]={indexMin:e.indexMax||0,indexMax:e.indexMax+t}}return n}_normalizeCount(e={}){return delete e.spam,e.total=Object.values(e).reduce((e,t)=>e+("number"==typeof t?t:0),0),e}_getDefaultFromEndpoint(e,t){const r=this.apiClient.getRequestSchema(e);if(r?.properties?.[t])return r.properties[t].default}_createPaginatorEngine({initialData:e,finalizer:t,methodName:r,restoredState:n}){const o=this,i=n?{...n}:{cursor:null,count:0,index:0,history:[],sizes:[]},s=e=>Boolean(e?.indexStep&&e.indexStep>0);async function a(n=!1){const c={...e};i.cursor&&(n||0!==i.history.length)||(i.count=0,i.index=0,i.history=[],i.sizes=[],c.countType=c.searchType,!c.searchBy&&s(c)?(c.ranges=o._generateRanges(c.searchType,c.indexStep),c.indexMin=c.indexMin??0,c.indexMax=c.indexMax??c.indexStep):"ALL"===c.searchBy&&s(c)&&(c.indexMin=c.indexMin??0,c.indexMax=c.indexMax??c.indexStep),i.cursor={...c});const p=i.cursor;n&&p&&(i.history.push({...p}),!p.searchBy&&s(p)?(p.ranges=o._generateRanges(p.searchType,p.indexStep,p.ranges),p.indexMin=p.indexMax??0,p.indexMax=(p.indexMax??0)+p.indexStep):"ALL"===p.searchBy&&s(p)&&(p.indexMin=p.indexMax??0,p.indexMax=(p.indexMax??0)+p.indexStep),i.cursor={...p});const d={...i.cursor||{}};if(!n){const e=d.searchType;if(!Array.isArray(e)||0===e.length)throw new Error("searchType non défini")}const m=await t(d);if(!Array.isArray(m.results))throw new Error("Les résultats doivent être un tableau");i.count+=m.results.length,i.sizes.push(m.results.length),n&&i.index++;const l=o._normalizeCount(m.count),u=o._linkEntities(m.results),h=s(d)&&i.count<l.total,y=i.history.length>0;return{count:l,results:u,pageIndex:i.index,pageNumber:i.index+1,hasNext:h,hasPrev:y,next:h?()=>a(!0):void 0,prev:y?async()=>{const e=i.history.pop(),t=i.sizes.pop()??0;return i.count-=t,i.index=Math.max(0,i.index-1),i.cursor={...e},a(!1)}:void 0,_initialData:{...e},_state:i,_entity:o,_methodName:r}}return{next:()=>a(!1)}}_withCostumContext(e){return async t=>{if(!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);const r=this.serverData;if(!r||"string"!=typeof r.slug||""===r.slug.trim())throw new error_ApiError("slug de l'entité non défini",400);if(!r.id||"string"!=typeof r.id)throw new error_ApiError("id de l'entité non défini",400);const n=Array.isArray(t?.sourceKey)?t.sourceKey:[],o={...t||{},costumSlug:r.slug,contextId:r.id,contextType:this.getEntityType(),sourceKey:[...n,r.slug]};return e(o)}}async searchCostum(e={},t){return this._createPaginatorEngine({initialData:e,methodName:"searchCostum",restoredState:t?.restoredState,finalizer:this._withCostumContext(e=>this.endpointApi.globalAutocompleteCostum(e))}).next()}async costumEventRequestActors(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e},r=this._withCostumContext(e=>this.endpointApi.costumEventRequestActors(e));return await r(t)}async costumEventRequestSubevents(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestSubevents(e))(t)}async costumEventRequestDates(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestDates(e))(t)}async costumEventRequestElementEvent(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestElementEvent(e))(t)}async costumEventRequestCategories(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestCategories(e))(t)}async costumEventRequestEvent(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestEvent(e))(t)}async costumEventRequestLinkTlToEvent(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!e.tl&&!e.event)throw new error_ApiError("Les paramètres 'tl' et 'event' sont requis.",400);if("string"!=typeof e.tl||"string"!=typeof e.event)throw new error_ApiError("Les paramètres 'tl' et 'event' doivent être des chaînes de caractères.",400);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestLinkTlToEvent(e))(t)}async costumEventRequestLoadContextTag(e={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={pathParams:{id:this.id,type:this.getEntityType()},...e};return this._withCostumContext(e=>this.endpointApi.costumEventRequestLoadContextTag(e))(t)}async coformAnswersSearch(e={},t){return e.searchType=e.searchType??["answers"],this._createPaginatorEngine({initialData:e,methodName:"coformAnswersSearch",restoredState:t?.restoredState,finalizer:this._withCostumContext(e=>this.endpointApi.coformAnswersSearch(e))}).next()}async searchAnswersByForms(e={}){if(!e.forms||Array.isArray(e.forms)||0===Object.keys(e.forms).length)throw new error_ApiError("Le paramètre 'forms' est requis et doit être un objet non vide.",400);return(await this.endpointApi.coformAnswersByForms(e)).map(e=>({...e,answers:this._linkEntities(Object.values(e.answers||{}))}))}async fundingEnvelope(e={}){const t=this._withCostumContext(e=>this.endpointApi.fundingEnvelope(e)),r=await t(e);return{...r,...r.contextData&&{contextData:this._linkEntity(r.contextData.collection,r.contextData)??r.contextData},...r.context&&{context:this._linkEntity(r.context.collection,r.context)??r.context},...r.nopropProject&&{nopropProject:this._linkEntities(Object.values(r.nopropProject))??r.nopropProject},...r.projects&&{projects:r.projects.map(e=>{const t=e?.project;if(t&&"object"==typeof t){const r=this._linkEntity(t.collection??"projects",t);return{...e,project:r??e.project}}return e})},...r.userOrga&&{userOrga:this._linkEntities(Object.values(r.userOrga))??r.userOrga}}}async coformFiltersSearch(e={}){return this._withCostumContext(e=>this.endpointApi.costumFilterCoform(e))(e)}async searchZone(e){if(!e.countryCode?.length||!e.level?.length)throw new error_ApiError("countryCode et level sont requis.",400);return this._withCostumContext(e=>this.endpointApi.searchZones(e))(e)}async getCountries(e={}){return this.endpointApi.getCountries(e)}async generateNewAnswerId(e){if(!e||"string"!=typeof e)throw new error_ApiError("formId est requis et doit être une chaîne de caractères.",400);const t=await this.endpointApi.generateAnswerFromForm({pathParams:{formId:e},action:"new"});return this._linkEntity?.(t.collection,t)??t}async linkDiscourseAccount(e){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.linkDiscourseAccount({...e,costumId:e.contextId,costumType:e.contextType}))({username:e})}async unlinkDiscourseAccount(){return this._withCostumContext(e=>this.endpointApi.unlinkDiscourseAccount({...e,costumId:e.contextId,costumType:e.contextType}))({})}async getDiscourseProfile(e){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.discourseProfile({...e,costumId:e.contextId,costumType:e.contextType}))({username:e})}async checkDiscourseEmailMatch(){return this._withCostumContext(e=>this.endpointApi.discourseCheckEmail({...e,costumId:e.contextId,costumType:e.contextType}))({})}async dismissDiscourseLink(){return this._withCostumContext(e=>this.endpointApi.discourseDismissLink({...e,costumId:e.contextId,costumType:e.contextType}))({})}async linkMediaWikiAccount(e){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.linkMediawikiAccount({...e,costumId:e.contextId,costumType:e.contextType}))({username:e})}async unlinkMediaWikiAccount(){return this._withCostumContext(e=>this.endpointApi.unlinkMediawikiAccount({...e,costumId:e.contextId,costumType:e.contextType}))({})}async getMediaWikiContributions(e,t){if(!e||"string"!=typeof e)throw new error_ApiError("username est requis et doit être une chaîne de caractères.",400);return this._withCostumContext(e=>this.endpointApi.getMediawikiContributions({...e,costumId:e.contextId,costumType:e.contextType}))({username:e,limit:t})}async coremuOperation(e){if(!e.form||"string"!=typeof e.form)throw new error_ApiError("form est requis et doit être une chaîne de caractères.",400);if(!e.project||"string"!=typeof e.project)throw new error_ApiError("project est requis et doit être une chaîne de caractères.",400);const t={...e,answer:"new",action:"generateproposition"},r=await this.endpointApi.coremuOperation(t);return this._linkEntity(r?.collection,r)??r}static restorePaginationFromJSON(e,t){const r=t instanceof BaseEntity?t:I(e._entity,t),n=e.results.map(e=>I(e,r)),o=e._methodName,i=e._initialData,s=e._state;return{results:n,count:e.count,hasNext:e.hasNext,hasPrev:e.hasPrev,pageIndex:e.pageIndex,pageNumber:e.pageNumber,next:e.hasNext?async()=>{const e=r[o];if("function"!=typeof e)throw new Error(`Méthode ${o} non trouvée sur l'entité`);const t=await e.call(r,i,{restoredState:s});return t.next?.()??t}:void 0,prev:e.hasPrev?async()=>{const e=r[o];if("function"!=typeof e)throw new Error(`Méthode ${o} non trouvée sur l'entité`);const t=await e.call(r,i,{restoredState:s});return t.prev?.()??t}:void 0,_initialData:i,_state:s,_entity:r,_methodName:o}}}class Action extends BaseEntity{static entityType="actions";static entityTag="Action";static SCHEMA_CONSTANTS=["COSTUM_PROJECT_ACTION_REQUEST_NEW"];static ADD_BLOCKS=new Map([["COSTUM_PROJECT_ACTION_REQUEST_NEW","addAction"]]);defaultFields={parentType:"projects"};removeFields=[];_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);if(!this.parent?.id)throw new error_ApiError("Le parent (Project) doit être défini pour créer une action.",400);if("projects"!==this.parent.getEntityType())throw new error_ApiError(`Une Action ne peut être créée que depuis un Project (parent reçu: ${this.parent.getEntityType()}).`,400);e.parentId=this.parent.id;for(const[t,r]of Array.from(Action.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Action.ADD_BLOCKS,r,n),t=e?.content;!this.id&&t?.id&&(this._draftData.id=t.id,this._setData(t,{forceInitialDraftReset:!0}))}}};async addAction(e={}){return this.callIsConnected(()=>this.endpointApi.costumProjectActionRequestNew(e))}}class Answer extends BaseEntity{static entityType="answers";static entityTag="Answer";static SCHEMA_CONSTANTS=[];static ADD_BLOCKS=new Map([]);static UPDATE_BLOCKS=new Map([]);defaultFields={};removeFields=[];_transformServerData(e){return e.user&&"object"==typeof e.user&&"id"in e.user&&(e.user=this._linkNestedEntity({type:"citoyens",collection:"citoyens",...e.user})),e}async get(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);const e=this.id,t=await this.endpointApi.coformAnswersById({answerId:e});if(t?.data?.id)return this._setData(t.data,{forceInitialDraftReset:!0}),this.serverData;throw new error_ApiError(`Aucune réponse trouvée pour l'ID ${this.id}`,404)}}class Badge extends BaseEntity{static entityType="badges";static entityTag="Badge";static SCHEMA_CONSTANTS=["ADD_BADGES"];static ADD_BLOCKS=new Map([["ADD_BADGES","addBadges"]]);static UPDATE_BLOCKS=new Map([]);defaultFields={};removeFields=[];_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Badge.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this[r](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(Badge.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this[n](o),t=!0)}return t};async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents n'existe pas dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(){throw new error_ApiError(`getNews n'existe pas dans ${this.constructor.name}`,501)}async getSubscribers(){throw new error_ApiError(`getSubscribers n'existe pas dans ${this.constructor.name}`,501)}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`event n'existe pas dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(){throw new error_ApiError(`news n'existe pas dans ${this.constructor.name}`,501)}}function X(e){return e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{type:t?.type??"",name:t?.name}])):{}}function ee(e){return(t,r)=>r?.socialNetwork?.[e]}class Classified extends BaseEntity{static entityType="classifieds";static entityTag="Classified";static SCHEMA_CONSTANTS=["ADD_CLASSIFIED"];static ADD_BLOCKS=new Map([["ADD_CLASSIFIED","addClassified"]]);defaultFields={typeElement:"classified"};removeFields=["typeElement"];transforms={parent:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.();for(const[t,r]of Array.from(Classified.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this[r](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);if(!this.isAuthor()&&!this.isAdmin({checkHierarchy:!0}))throw new error_ApiError("Vous n'êtes pas autorisé à modifier cette ressource",403);let t=!1;const r=this._extractAllValidFieldsFromSchema(this.apiClient,"ADD_CLASSIFIED",{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);return r&&Object.keys(r).length>0&&(await this.addClassified(r),t=!0),t};async addClassified(e={}){const t=e;return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!t.parent&&(t.parent={},t.parent[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addClassified(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents n'existe pas dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(){throw new error_ApiError(`getNews n'existe pas dans ${this.constructor.name}`,501)}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`event n'existe pas dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(){throw new error_ApiError(`news n'existe pas dans ${this.constructor.name}`,501)}async classified(){throw new error_ApiError(`classified n'existe pas dans ${this.constructor.name}`,501)}async follow(){throw new error_ApiError(`follow n'existe pas dans ${this.constructor.name}`,501)}async unfollow(){throw new error_ApiError(`unfollow n'existe pas dans ${this.constructor.name}`,501)}async getGallery(){throw new error_ApiError(`getGallery n'existe pas dans ${this.constructor.name}`,501)}}class Comment extends BaseEntity{static entityType="comments";static entityTag="Comment";static SCHEMA_CONSTANTS=["ADD_COMMENTS"];static ADD_BLOCKS=new Map([["ADD_COMMENTS","addComments"]]);static UPDATE_BLOCKS=new Map([["ADD_COMMENTS","updateComments"]]);defaultFields={};removeFields=["contextId","contextType","parentCommentId","argval"];_transformServerData(e){return e.author&&(e.author=this._linkNestedEntity(e.author)),Array.isArray(e.replies)&&(e.replies=e.replies.map(e=>(e&&"object"==typeof e&&!e.type&&(e.type="comments",e.collection="comments"),this._linkNestedEntity(e)))),e}async get(){throw new error_ApiError(`get n'existe pas dans ${this.constructor.name}`,501)}async save(){const e=this.refresh;this.refresh=async()=>this._serverData;try{return await super.save()}finally{this.refresh=e}}_add=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _add, utilisez save");if(!this.parent?.id)throw new Error("Le parent doit être défini pour ajouter un commentaire.");if(""===e.text&&(e.text=" "),"comments"===this.parent.getEntityType()){e.parentCommentId=this.parent.id;let t=this.parent.parent;for(;t&&t.getEntityType&&"comments"===t.getEntityType();)t=t.parent;if(!t)throw new Error("Impossible de trouver l'entité racine pour le commentaire.");e.contextId=t.id,e.contextType=t.getEntityType()}else e.parentCommentId=e.parentCommentId||"",e.contextId=this.parent.id,e.contextType=this.parent.getEntityType();for(const[t,r]of Array.from(Comment.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{},[]);if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Comment.ADD_BLOCKS,r,n),t=e?.object?.id||e?.id?.$id||e?.id;!this.id&&t&&(this._draftData.id=t,this._setData(e.newComment,{forceInitialDraftReset:!0}))}}};_update=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");if(!this.parent?.id)throw new Error("Le parent doit être défini pour ajouter un commentaire.");""===e?.text&&(e.text=" "),e.params={text:e.text},delete e.text;let t=!1;const r=await this.callIsConnected(()=>this.endpointApi.updateComments(e));return r?.comment&&this._setData(r.comment,{forceInitialDraftReset:!0}),t=!0,!0};async addComments(e={}){return this.callIsConnected(()=>this.endpointApi.addComments(e))}async updateComments(e={}){return this.callIsConnected(()=>this.endpointApi.updateComments(e))}async delete(){if(!this.id)throw new error_ApiError("Vous devez fournir un id pour supprimer un commentaire.",400);const e={pathParams:{id:this.id}};await this.callIsConnected(()=>this.endpointApi.deleteComments(e)),Object.keys(this._draftData).forEach(e=>delete this._draftData[e]),Object.keys(this._serverData).forEach(e=>delete this._serverData[e]),this._isDeleted=!0}async comment(e={}){if(!this.isConnected)throw new error_ApiError("Vous devez être connecté.",401);return await this.entity("comments",e)}async addVote(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={collection:"comments",id:this.id,action:"vote",details:{status:e}};return await this.callIsConnected(()=>this.endpointApi.addVote(t))}async addReportAbuse({reason:e,comment:t}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const r={collection:"comments",id:this.id,action:"reportAbuse",details:{reason:e,comment:t}};return await this.callIsConnected(()=>this.endpointApi.addReportAbuse(r))}}const te=class EndpointApi{apiClient;constructor(e){this.apiClient=e}get isConnected(){return this.apiClient.isConnected}get userId(){return this.apiClient.userId}async call(e,t={}){return this.apiClient.safeCall(async()=>{const r=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(r),r.data})}async callNoConnected(e,t={}){if(this.isConnected)throw new error_ApiAuthenticationError("Vous ne devez pas être connecté pour faire cette action.",403);return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new error_ApiAuthenticationError("Vous devez être connecté pour effectuer cette action.",401);return this.call(e,t)}async personRegister(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callNoConnected("PERSON_REGISTER",e)}async authenticateUrl(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callNoConnected("AUTHENTICATE_URL",e)}async refreshTokenUrl(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("REFRESH_TOKEN_URL",e)}async meInfoUrl(){return this.callIsConnected("ME_INFO_URL")}async passwordRecovery(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callNoConnected("PASSWORD_RECOVERY",e)}async serverExchangeToken(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SERVER_EXCHANGE_TOKEN",e)}async changePassword(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("CHANGE_PASSWORD",e)}async deleteAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_ACCOUNT",e)}async updateSettings(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_SETTINGS",e)}async updateBlockDescription(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_DESCRIPTION",e)}async updateBlockInfo(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_INFO",e)}async updateBlockSocial(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_SOCIAL",e)}async updateBlockLocality(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_LOCALITY",e)}async updateBlockSlug(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_BLOCK_SLUG",e)}async check(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("CHECK",e)}async profilImage(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("PROFIL_IMAGE",e)}async profilBanner(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("PROFIL_BANNER",e)}async getElementsAbout(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ELEMENTS_ABOUT",e)}async multiconnect(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("MULTICONNECT",e)}async getNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_NEWS",e)}async getNewsById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_NEWS_BY_ID",e)}async addNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_NEWS",e)}async addImageNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_IMAGE_NEWS",e)}async addFileNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_FILE_NEWS",e)}async deleteNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_NEWS",e)}async updateNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_NEWS",e)}async shareNews(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SHARE_NEWS",e)}async getComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COMMENTS",e)}async addComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_COMMENTS",e)}async deleteComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_COMMENTS",e)}async updateComments(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_COMMENTS",e)}async searchTags(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SEARCH_TAGS",e)}async showVote(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SHOW_VOTE",e)}async globalAutocomplete(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GLOBAL_AUTOCOMPLETE",e)}async cityAutocomplete(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("CITY_AUTOCOMPLETE",e)}async cityAutocompleteByCountry(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("CITY_AUTOCOMPLETE_BY_COUNTRY",e)}async suggestionInput(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SUGGESTION_INPUT",e)}async getProjectsNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_PROJECTS_NO_ADMIN",e)}async getProjectsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_PROJECTS_ADMIN",e)}async getPoisNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_POIS_NO_ADMIN",e)}async getPoisAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_POIS_ADMIN",e)}async getOrganizationsNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ORGANIZATIONS_NO_ADMIN",e)}async getOrganizationsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_ORGANIZATIONS_ADMIN",e)}async getMembersNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_MEMBERS_NO_ADMIN",e)}async getMembersAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_MEMBERS_ADMIN",e)}async getFriendsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_FRIENDS_ADMIN",e)}async getSubscriptions(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_SUBSCRIPTIONS",e)}async getSubscriptionsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_SUBSCRIPTIONS_ADMIN",e)}async getSubscribers(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_SUBSCRIBERS",e)}async getSubscribersAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_SUBSCRIBERS_ADMIN",e)}async getContributorsNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_CONTRIBUTORS_NO_ADMIN",e)}async getContributorsAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_CONTRIBUTORS_ADMIN",e)}async getBadges(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_BADGES",e)}async getBadgesFilters(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_BADGES_FILTERS",e)}async connect(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("CONNECT",e)}async disconnect(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DISCONNECT",e)}async getElementsKey(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ELEMENTS_KEY",e)}async getFavoris(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_FAVORIS",e)}async deleteFavoris(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_FAVORIS",e)}async addFavoris(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_FAVORIS",e)}async addOrganization(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_ORGANIZATION",e)}async addProject(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_PROJECT",e)}async addPoi(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_POI",e)}async addEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_EVENT",e)}async deletePoi(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_POI",e)}async deleteEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_EVENT",e)}async deleteElement(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_ELEMENT",e)}async addImageElement(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_IMAGE_ELEMENT",e)}async linkValidate(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("LINK_VALIDATE",e)}async searchMemberAutocomplete(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SEARCH_MEMBER_AUTOCOMPLETE",e)}async getNotifications(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_NOTIFICATIONS",e)}async getNotificationsCount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_NOTIFICATIONS_COUNT",e)}async notificationUpdate(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("NOTIFICATION_UPDATE",e)}async removeAllNotifications(){return this.callIsConnected("REMOVE_ALL_NOTIFICATIONS")}async markNotificationAsRead(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("MARK_NOTIFICATION_AS_READ",e)}async activitypubSearch(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("ACTIVITYPUB_SEARCH",e)}async activitypubLink(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ACTIVITYPUB_LINK",e)}async activitypubGetCommunity(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("ACTIVITYPUB_GET_COMMUNITY",e)}async getBadge(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_BADGE",e)}async getEmetteurBadges(){return this.call("GET_EMETTEUR_BADGES")}async addBadges(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_BADGES",e)}async assignBadges(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ASSIGN_BADGES",e)}async getEvents(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_EVENTS",e)}async shareEvents(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SHARE_EVENTS",e)}async inviteEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("INVITE_EVENT",e)}async follow(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("FOLLOW",e)}async getCostumJson(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COSTUM_JSON",e)}async globalAutocompleteCostum(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GLOBAL_AUTOCOMPLETE_COSTUM",e)}async costumEventRequestActors(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_ACTORS",e)}async costumEventRequestSubevents(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_SUBEVENTS",e)}async costumEventRequestElementEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_ELEMENT_EVENT",e)}async costumEventRequestCategories(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_CATEGORIES",e)}async costumEventRequestDates(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_DATES",e)}async costumEventRequestEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_EVENT",e)}async costumEventRequestLinkTlToEvent(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_LINK_TL_TO_EVENT",e)}async costumEventRequestLoadContextTag(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_EVENT_REQUEST_LOAD_CONTEXT_TAG",e)}async getGallery(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_GALLERY",e)}async getAttendeesNoAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_ATTENDEES_NO_ADMIN",e)}async getAttendeesAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("GET_ATTENDEES_ADMIN",e)}async coformAnswersSearch(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COFORM_ANSWERS_SEARCH",e)}async coformAnswersById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COFORM_ANSWERS_BY_ID",e)}async getCoformById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COFORM_BY_ID",e)}async coformUploadAnswerFile(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("COFORM_UPLOAD_ANSWER_FILE",e)}async coformGetAnswerFiles(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("COFORM_GET_ANSWER_FILES",e)}async saveCoformAnswer(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("SAVE_COFORM_ANSWER",e)}async addVote(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_VOTE",e)}async addReportAbuse(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_REPORT_ABUSE",e)}async updatePathValue(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UPDATE_PATH_VALUE",e)}async deleteDocumentByContext(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_DOCUMENT_BY_CONTEXT",e)}async deleteDocumentById(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DELETE_DOCUMENT_BY_ID",e)}async demoteAdmin(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DEMOTE_ADMIN",e)}async costumFilterCoform(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COSTUM_FILTER_COFORM",e)}async getCountries(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_COUNTRIES",e)}async searchZones(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("SEARCH_ZONES",e)}async coformAnswersByForms(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COFORM_ANSWERS_BY_FORMS",e)}async generateAnswerFromForm(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GENERATE_ANSWER_FROM_FORM",e)}async fundingEnvelope(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("FUNDING_ENVELOPE",e)}async coremuOperation(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("COREMU_OPERATION",e)}async costumProjectActionRequestNew(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("COSTUM_PROJECT_ACTION_REQUEST_NEW",e)}async linkDiscourseAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("LINK_DISCOURSE_ACCOUNT",e)}async unlinkDiscourseAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UNLINK_DISCOURSE_ACCOUNT",e)}async discourseProfile(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("DISCOURSE_PROFILE",e)}async discourseCheckEmail(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DISCOURSE_CHECK_EMAIL",e)}async discourseDismissLink(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("DISCOURSE_DISMISS_LINK",e)}async linkMediawikiAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("LINK_MEDIAWIKI_ACCOUNT",e)}async unlinkMediawikiAccount(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("UNLINK_MEDIAWIKI_ACCOUNT",e)}async getMediawikiContributions(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.call("GET_MEDIAWIKI_CONTRIBUTIONS",e)}async addClassified(e){if(!e||"object"!=typeof e)throw new TypeError("Le paramètre data doit être un objet.");return this.callIsConnected("ADD_CLASSIFIED",e)}};class Event extends BaseEntity{static entityType="events";static entityTag="Event";static SCHEMA_CONSTANTS=["ADD_EVENT","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static ADD_BLOCKS=new Map([["ADD_EVENT","addEvent"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={parent:X,organizer:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Event.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Event.ADD_BLOCKS,r,n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAdmin({checkHierarchy:!0}))throw new error_ApiError("Vous n'avez pas les droits pour modifier cet événement",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);let t=!1;const r=this._extractAllValidFieldsFromSchema(this.apiClient,"ADD_EVENT",{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);r&&Object.keys(r).length>0&&(await this.addEvent(r),t=!0),e.id&&delete e.id;for(const[r,n]of Array.from(Event.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Event.UPDATE_BLOCKS,n,o),t=!0)}return t};async addEvent(e={}){return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!e.organizer&&(e.organizer={},e.organizer[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addEvent(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents - les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async getAttendees(e={},t={}){return e.searchType=this._getDefaultFromEndpoint("GET_ATTENDEES_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getAttendees",restoredState:t?.restoredState,finalizer:async e=>{const{toBeValidated:r,isAdmin:n,isInviting:o,isAdminPending:i,roles:s=[]}=t;return this.isMe?(e.pathParams={id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"events",toBeValidated:r,isAdmin:n,isAdminPending:i,isInviting:o,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"events",toBeValidated:!1,isAdmin:n,isInviting:o,roles:s})),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getAttendeesAdmin(e)):()=>this.endpointApi.getAttendeesNoAdmin(e))()}}).next()}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(e={}){return super.news(e)}async requestToJoin(){return super.requestToJoin()}async acceptInvitation(){return super.acceptInvitation()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class Form extends BaseEntity{static entityType="forms";static entityTag="Form";static SCHEMA_CONSTANTS=[];static ADD_BLOCKS=new Map([]);static UPDATE_BLOCKS=new Map([]);defaultFields={};removeFields=[];_transformServerData(e){return e}async get(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);const e=this.id,t=await this.endpointApi.getCoformById({parentFormId:e});if(t?.data?.id||t?.data?._id){const e={...t.data,inputs:t.data.inputs??{},params:t.data.params??{},subForms:t.data.subForms??[],parent:t.data.parent??void 0,config:t.data.config??void 0};return this._setData(e,{forceInitialDraftReset:!0}),this.serverData}throw new error_ApiError(`Aucun formulaire trouvé pour l'ID ${this.id}`,404)}}class News extends BaseEntity{static entityType="news";static entityTag="News";static SCHEMA_CONSTANTS=["ADD_NEWS"];static ADD_BLOCKS=new Map([["ADD_NEWS","addNews"]]);static UPDATE_BLOCKS=new Map([["ADD_NEWS","updateNews"]]);defaultFields={};removeFields=["parentId","parentType"];transforms={scope:e=>e?.type,mentions:e=>Array.isArray(e)?e.map(e=>({...e,count:parseInt(e.count)})):[],mediaImg:e=>{const t=e?.images?.map(e=>e.id).filter(Boolean)||[];return t.length>0?{countImages:t.length,images:t}:{countImages:0,images:[]}},mediaFile:e=>{const t=e?.files?.map(e=>e.id).filter(Boolean)||[];return t.length>0?{countFiles:t.length,files:t}:{countFiles:0,files:[]}}};_transformServerData(e){return e.author&&(e.author=this._linkNestedEntity(e.author)),e.target&&(e.target=this._linkNestedEntity(e.target)),e.lastAuthorShare&&(e.lastAuthorShare=this._linkNestedEntity(e.lastAuthorShare)),Array.isArray(e.sharedBy)&&(e.sharedBy=e.sharedBy.map(e=>this._linkNestedEntity(e))),e}async get(){if(!this.id)throw new error_ApiError("Impossible de rafraîchir sans ID.",400);const e=this.id,t=await this.endpointApi.getNewsById({ids:[e]});if(t&&Array.isArray(t)&&1===t.length){const e=t[0];return this._setData(e,{forceInitialDraftReset:!0}),this.serverData}throw new error_ApiError(`Aucune actualité trouvée pour l'ID ${this.id}`,404)}_add=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _add, utilisez save");""===e.text&&(e.text=" "),this.parent&&(e.parentId=this.parent.id,e.parentType=this.parent.getEntityType());for(const[t,r]of Array.from(News.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{},[]);if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(News.ADD_BLOCKS,r,n);!this.id&&e?.object?.id&&(this._draftData.id=e.object.id)}}};_update=async e=>{if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");e.id&&delete e.id,""===e?.text&&(e.text=" "),this.parent&&(e.parentId=this.parent.id,e.parentType=this.parent.getEntityType()),e.idNews=this.id;let t=!1;return await this.callIsConnected(()=>this.endpointApi.updateNews(e)),t=!0,!0};async addNews(e={}){return this.callIsConnected(()=>this.endpointApi.addNews(e))}async updateNews(e={}){return this.callIsConnected(()=>this.endpointApi.updateNews(e))}async addMention({slug:e,id:t}){try{if(!e&&!t)throw new error_ApiError("Vous devez fournir un slug ou un id pour ajouter une mention.",400);const r=await this.entity("citoyens",{id:t,slug:e}),n=r.serverData;if(this._draftData.mentions||(this._draftData.mentions=[]),this._draftData.mentions.find(e=>e.id===n.id))return this._draftData.mentions=this._draftData.mentions.map(e=>(e.id===n.id&&(e.count+=1),e)),this._draftData.mentions;const o={id:n.id,slug:n.slug,type:r.getEntityType(),name:n.name,value:n.name,count:1};return this._draftData.mentions.push(o),this._draftData.mentions}catch(e){throw this.apiClient._logger.error("Erreur lors de l'ajout de la mention :",e),e}}async addImage(e){const t=await this._validateImage(e),r={pathParams:{folder:this.parent?.getEntityType(),ownerId:this.parent?.id},newsImage:t},n=await this.callIsConnected(()=>this.endpointApi.addImageNews(r));return this._draftData.mediaImg?(this._draftData.mediaImg.countImages=this._draftData.mediaImg.countImages+1,this._draftData.mediaImg.images.push(n.id)):this._draftData.mediaImg={countImages:1,images:[n.id]},n}async addFile(e){const t=await this._validateFile(e),r={pathParams:{folder:this.parent?.getEntityType(),ownerId:this.parent?.id},newsFile:t},n=await this.callIsConnected(()=>this.endpointApi.addFileNews(r));return this._draftData.mediaFile?(this._draftData.mediaFile.countFiles=this._draftData.mediaFile.countFiles+1,this._draftData.mediaFile.files.push(n.id)):this._draftData.mediaFile={countFiles:1,files:[n.id]},n}async delete(){if(!this.id)throw new error_ApiError("Vous devez fournir un id pour supprimer une news.",400);const e={pathParams:{id:this.id},isLive:!1};await this.callIsConnected(()=>this.endpointApi.deleteNews(e)),Object.keys(this._draftData).forEach(e=>delete this._draftData[e]),Object.keys(this._serverData).forEach(e=>delete this._serverData[e]),this._isDeleted=!0}async comment(e={}){if(!this.isConnected)throw new error_ApiError("Vous devez être connecté.",401);return await this.entity("comments",e)}async getComments(){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const e={pathParams:{type:"news",id:this.id}},t=await this.endpointApi.getComments(e);if(!Array.isArray(t))throw new error_ApiResponseError("Erreur lors de la récupération des commentaires.",500,t);const r=this._linkEntities(t);return this._createFilteredProxy(r)}async addVote(e){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const t={collection:"news",id:this.id,action:"vote",details:{status:e}};return await this.callIsConnected(()=>this.endpointApi.addVote(t))}async addReportAbuse({reason:e,comment:t}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const r={collection:"news",id:this.id,action:"reportAbuse",details:{reason:e,comment:t}};return await this.callIsConnected(()=>this.endpointApi.addReportAbuse(r))}async shareNews({childId:e,childType:t,comment:r}={}){if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userId)throw new error_ApiError("L'utilisateur connecté n'est pas défini.",400);if(!this.parent?.id)throw new error_ApiError("Le parent doit être défini pour partager une news",400);const n=e??this.userId,o=t??"citoyens",i=["citoyens","projects","organizations"];if(!i.includes(o))throw new error_ApiError(`Le type de cible "${o}" n'est pas valide. Types autorisés: ${i.join(", ")}`,400);if(this.parent.id===this.userId&&n===this.userId)throw new error_ApiError("Vous ne pouvez pas partager votre propre news à vous-même",400);const s={parentId:this.id,parentType:"news",connectType:"share",childType:o,childId:n,comment:r};return await this.callIsConnected(()=>this.endpointApi.shareNews(s))}isAuthor(e){const t=e?.silent??!0;try{if(!this.isMe)throw new error_ApiError("Vous devez être connecté pour vérifier l'auteur.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.serverData)throw new error_ApiError("Aucune donnée serveur disponible.",404);if(!this.userId)throw new error_ApiError("Utilisateur non connecté.",401)}catch(e){if(t)return!1;throw e}const r=this.serverData.author;if(!r)return!1;let n;return"serverData"in r&&r.serverData&&"object"==typeof r.serverData&&"id"in r.serverData?n=r.serverData.id:"id"in r&&(n=r.id),Boolean(n&&this.userId===n)}}class Organization extends BaseEntity{static entityType="organizations";static entityTag="Organization";static SCHEMA_CONSTANTS=["ADD_ORGANIZATION","UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_SOCIAL","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE","VIRTUAL_OPENING_HOURS"];static VIRTUAL_SCHEMAS={VIRTUAL_OPENING_HOURS:{type:"object",properties:{openingHours:{type:"array",description:"Horaires d'ouverture (7 jours de la semaine)",minItems:7,maxItems:7,items:{oneOf:[{type:"string",const:""},{type:"object",properties:{dayOfWeek:{type:"string",enum:["Mo","Tu","We","Th","Fr","Sa","Su"],description:"Jour de la semaine"},hours:{type:"array",description:"Liste des créneaux horaires",items:{type:"object",properties:{opens:{type:"string",pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",description:"Heure d'ouverture (HH:MM)"},closes:{type:"string",pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",description:"Heure de fermeture (HH:MM)"}},required:["opens","closes"],additionalProperties:!1}}},required:["dayOfWeek","hours"],additionalProperties:!1}]}}}}};static CUSTOM_FIELD_HANDLERS=new Map([["openingHours",{updateMethod:"updateOpeningHours",schemaConstant:"VIRTUAL_OPENING_HOURS"}]]);static ADD_BLOCKS=new Map([["ADD_ORGANIZATION","addOrganization"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={github:ee("github"),gitlab:ee("gitlab"),facebook:ee("facebook"),twitter:ee("twitter"),instagram:ee("instagram"),diaspora:ee("diaspora"),mastodon:ee("mastodon"),telegram:ee("telegram"),signal:ee("signal")};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Organization.ADD_BLOCKS)){const n="ADD_ORGANIZATION"===t,o={...e,...this.defaultFields};n||delete o.id;const i=this._extractChangedFieldsFromSchema(this.apiClient,t,o,()=>{},n?[]:this.removeFields);if(i&&Object.keys(i).length>0){const e=await this._invokeBlockMethod(Organization.ADD_BLOCKS,r,i);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour modifier cette organisation",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;const r=Organization.CUSTOM_FIELD_HANDLERS;if(r){const n=new Set;for(const[o,i]of r)o in e&&this._hasFieldChanged(o)&&(await this._invokeCustomFieldHandler(i.updateMethod,e[o],o),n.add(o),t=!0);n.forEach(t=>delete e[t])}for(const[r,n]of Array.from(Organization.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Organization.UPDATE_BLOCKS,n,o),t=!0)}return t};async addOrganization(e){return this.callIsConnected(()=>this.endpointApi.addOrganization(e))}async getOrganizations(){throw new error_ApiError("getOrganizations n'existe pas dans Organization",404)}async getProjects(e={}){return super.getProjects(e)}async getEvents(e={}){return super.getEvents(e)}async getPois(e={}){return super.getPois(e)}async getBadgesIssuer(e={}){return super.getBadgesIssuer(e)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async getMembers(e={},t={}){if(!this.id)throw new error_ApiError("L'organisation n'est pas définie, impossible de récupérer les membres",400);const r=this.id,n=this._getDefaultFromEndpoint("GET_MEMBERS_ADMIN","searchType");return"citoyens"===t.searchType?e.searchType=["citoyens"]:"organizations"===t.searchType?e.searchType=n.filter(e=>"citoyens"!==e):e.searchType=n,this._createPaginatorEngine({initialData:e,methodName:"getMembers",restoredState:t?.restoredState,finalizer:async e=>{const{toBeValidated:n,isAdmin:o,isAdminPending:i,isInviting:s,roles:a=[]}=t;return this.isMe?(e.pathParams={id:this.id},e.filters=this._buildLinkFilters(r,{linkType:"memberOf",toBeValidated:n,isAdmin:o,isAdminPending:i,isInviting:s,roles:a})):(delete e?.pathParams,e.filters=this._buildLinkFilters(r,{linkType:"memberOf",toBeValidated:!1,isAdmin:o,isInviting:s,roles:a})),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getMembersAdmin(e)):()=>this.endpointApi.getMembersNoAdmin(e))()}}).next()}async getGallery(e={}){return super.getGallery(e)}async project(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un projet dans cette organisation",403);return super.project(e)}async poi(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un poi dans cette organisation",403);return super.poi(e)}async event(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un event dans cette organisation",403);return super.event(e)}async badge(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un badge dans cette organisation",403);return super.badge(e)}async news(e={}){return super.news(e)}async updateOpeningHours(e){if(!this.id)throw new error_ApiError("L'organisation n'a pas d'ID, impossible de mettre à jour les horaires d'ouverture.",400);return this.endpointApi.updatePathValue({id:this.id,collection:"organizations",path:"openingHours",value:e})}async requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}requestPromoteToAdmin(){return super.requestPromoteToAdmin()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}async getCostumJson(){return super.getCostumJson()}async searchCostum(e){return super.searchCostum(e)}async coformAnswersSearch(e){return super.coformAnswersSearch(e)}}class Poi extends BaseEntity{static entityType="poi";static entityTag="Poi";static SCHEMA_CONSTANTS=["ADD_POI","UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static ADD_BLOCKS=new Map([["ADD_POI","addPoi"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={parent:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Poi.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Poi.ADD_BLOCKS,r,n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAuthor())throw new error_ApiError("Vous n'avez pas les droits pour modifier ce POI",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(Poi.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Poi.UPDATE_BLOCKS,n,o),t=!0)}return t};async addPoi(e={}){return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!e.parent&&(e.parent={},e.parent[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addPoi(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(){throw new error_ApiError(`getProjects n'existe pas dans ${this.constructor.name}`,501)}async getEvents(){throw new error_ApiError(`getEvents n'existe pas dans ${this.constructor.name}`,501)}async getPois(){throw new error_ApiError(`getPois n'existe pas dans ${this.constructor.name}`,501)}async getBadgesIssuer(){throw new error_ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`,501)}async getNews(){throw new error_ApiError(`getNews n'existe pas dans ${this.constructor.name}`,501)}async getSubscribers(e={}){return super.getSubscribers(e)}async project(){throw new error_ApiError(`project n'existe pas dans ${this.constructor.name}`,501)}async poi(){throw new error_ApiError(`poi n'existe pas dans ${this.constructor.name}`,501)}async event(){throw new error_ApiError(`event n'existe pas dans ${this.constructor.name}`,501)}async badge(){throw new error_ApiError(`badge n'existe pas dans ${this.constructor.name}`,501)}async news(){throw new error_ApiError(`news n'existe pas dans ${this.constructor.name}`,501)}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class Project extends BaseEntity{static entityType="projects";static entityTag="Project";static SCHEMA_CONSTANTS=["ADD_PROJECT","UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_SOCIAL","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static ADD_BLOCKS=new Map([["ADD_PROJECT","addProject"],["PROFIL_IMAGE","updateImageProfil"]]);static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={github:ee("github"),gitlab:ee("gitlab"),facebook:ee("facebook"),twitter:ee("twitter"),instagram:ee("instagram"),diaspora:ee("diaspora"),mastodon:ee("mastodon"),telegram:ee("telegram"),signal:ee("signal"),parent:X};_add=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _add, utilisez save",400);e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,r]of Array.from(Project.ADD_BLOCKS)){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},()=>{});if(n&&Object.keys(n).length>0){const e=await this._invokeBlockMethod(Project.ADD_BLOCKS,r,n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}};_update=async e=>{if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour modifier ce projet",403);if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(Project.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(Project.UPDATE_BLOCKS,n,o),t=!0)}return t};async addProject(e={}){return this.parent&&this.parent.id&&this.parent.id!==this.userId&&!e.parent&&(e.parent={},e.parent[`${this.parent.id}`]={type:this.parent.getEntityType(),name:this.parent.name}),this.callIsConnected(()=>this.endpointApi.addProject(e))}async getOrganizations(){throw new error_ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`,501)}async getProjects(e={}){return super.getProjects(e)}async getEvents(e={}){return super.getEvents(e)}async getPois(e={}){return super.getPois(e)}async getBadgesIssuer(e={}){return super.getBadgesIssuer(e)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async getContributors(e={},t={}){const r=this._getDefaultFromEndpoint("GET_CONTRIBUTORS_ADMIN","searchType");return"citoyens"===t.searchType?e.searchType=["citoyens"]:"organizations"===t.searchType?e.searchType=r.filter(e=>"citoyens"!==e):e.searchType=r,this._createPaginatorEngine({initialData:e,methodName:"getContributors",restoredState:t?.restoredState,finalizer:async e=>{const{toBeValidated:r,isAdmin:n,isInviting:o,isAdminPending:i,roles:s=[]}=t;return this.isMe?(e.pathParams={id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:r,isAdmin:n,isAdminPending:i,isInviting:o,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:!1,isAdmin:n,isInviting:o,roles:s})),(this.isMe?()=>this.callIsMe(()=>this.endpointApi.getContributorsAdmin(e)):()=>this.endpointApi.getContributorsNoAdmin(e))()}}).next()}async getGallery(e={}){return super.getGallery(e)}async project(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un projet dans ce projet",403);return super.project(e)}async poi(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un POI dans ce projet",403);return super.poi(e)}async event(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un événement dans ce projet",403);return super.event(e)}async badge(e={}){if(!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer un badge dans ce projet",403);return super.badge(e)}async news(e={}){if(!e?.id&&!this.isContributor())throw new error_ApiError("Vous n'avez pas les droits pour créer une news dans ce projet",403);return super.news(e)}async action(e={}){if(!e?.id&&!this.isAdmin())throw new error_ApiError("Vous n'avez pas les droits pour créer une action dans ce projet",403);return await this.entity("actions",e)}async requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}requestPromoteToAdmin(){return super.requestPromoteToAdmin()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class User extends BaseEntity{static entityType="citoyens";static entityTag="User";static SCHEMA_CONSTANTS=["UPDATE_BLOCK_DESCRIPTION","UPDATE_BLOCK_INFO","UPDATE_BLOCK_SOCIAL","UPDATE_BLOCK_LOCALITY","UPDATE_BLOCK_SLUG","PROFIL_IMAGE"];static UPDATE_BLOCKS=new Map([["UPDATE_BLOCK_DESCRIPTION","updateDescription"],["UPDATE_BLOCK_SOCIAL","updateSocial"],["UPDATE_BLOCK_LOCALITY","updateLocality"],["UPDATE_BLOCK_INFO","updateInfo"],["UPDATE_BLOCK_SLUG","updateSlug"],["PROFIL_IMAGE","updateImageProfil"]]);defaultFields={typeElement:this.getEntityType()};removeFields=["typeElement"];transforms={github:ee("github"),gitlab:ee("gitlab"),facebook:ee("facebook"),twitter:ee("twitter"),instagram:ee("instagram"),diaspora:ee("diaspora"),mastodon:ee("mastodon"),telegram:ee("telegram"),signal:ee("signal")};constructor(e,t,r){if(!r.EndpointApi)throw new error_ApiError("EndpointApi class must be injected to avoid circular dependency.",500);if(!t?.id&&!t?.slug)throw new error_ApiError("Vous devez fournir un id ou un slug pour créer un User.",400);if(!r.Organization)throw new error_ApiError("Organization class must be injected.",500);if(!r.Project)throw new error_ApiError("Project class must be injected.",500);if(!r.Event)throw new error_ApiError("Event class must be injected.",500);if(!r.Poi)throw new error_ApiError("Poi class must be injected.",500);if(!r.Badge)throw new error_ApiError("Badge class must be injected.",500);if(!r.News)throw new error_ApiError("News class must be injected.",500);if(!r.Answer)throw new error_ApiError("Answer class must be injected.",500);super(e,t,r)}get slug(){return this._draftData.slug||null}get isMe(){return this.isConnected&&this.userId===this.id}get parentIsMe(){return super.isMe}get isActingUser(){return this.parentIsMe&&!this.isMe}getEntityType(){return"citoyens"}async get(){return this.apiClient.safeCall(async()=>{if(this.isMe){const e=await this.endpointApi.meInfoUrl();return this._setData(e,{forceInitialDraftReset:!0}),e}{const e=await this._getPublicProfile();return this._setData(e,{forceInitialDraftReset:!0}),e}})}async changePassword(e){return this.callIsMe(()=>this.endpointApi.changePassword(e))}async delete(e){return this.callIsMe(()=>this.endpointApi.deleteAccount(e))}async save(){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour sauvegarder.",401);return await super.save()}_add=async()=>{throw new error_ApiError("Vous ne pouvez pas ajouter un utilisateur par ce moyen.",403)};_update=async e=>{if(!this._calledFromSave)throw new error_ApiError("utilisation invalide de _update, utilisez save",400);e.id&&delete e.id;let t=!1;for(const[r,n]of Array.from(User.UPDATE_BLOCKS)){const o=this._extractChangedFieldsFromSchema(this.apiClient,r,{...e,...this.defaultFields},()=>this.initialDraftData,this.removeFields);o&&Object.keys(o).length>0&&(await this._invokeBlockMethod(User.UPDATE_BLOCKS,n,o),t=!0)}return t};static fromServerData(e,t,r){const n=new this(t,e,r);return e&&"object"==typeof e&&Object.keys(e).length>0&&"function"==typeof n._setData&&n._setData(e),n}async updateSettings(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les paramètres.",401);const t=await super.updateSettings(e);return await this.refresh(),t}async updateDescription(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la description.",401);return super.updateDescription(e)}async updateInfo(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les informations.",401);return super.updateInfo(e)}async updateSocial(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les réseaux sociaux.",401);return super.updateSocial(e)}async updateLocality(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la localité.",401);return super.updateLocality(e)}async updateSlug(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour le slug.",401);return super.updateSlug(e)}async updateImageProfil(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour l'image de profil.",401);return super.updateImageProfil(e)}async updateImageBanner(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour l'image de bannière.",401);return super.updateImageBanner(e)}async getOrganizations(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getOrganizations",restoredState:t?.restoredState,finalizer:async e=>{delete e?.pathParams;const t=this.isMe?()=>this.callIsMe(()=>this.endpointApi.getOrganizationsAdmin(e)):()=>this.endpointApi.getOrganizationsNoAdmin(e);return this.isMe||e.filters||(e.filters={[`links.members.${this.id}`]:{$exists:!0},[`links.members.${this.id}.toBeValidated`]:{$exists:!1},[`links.members.${this.id}.isInviting`]:{$exists:!1}}),t()}}).next()}async getProjects(e={}){return super.getProjects(e)}async getEvents(e={}){return super.getEvents(e)}async getPois(e={}){return super.getPois(e)}async getNews(e={}){return super.getNews(e)}async getFriends(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_FRIENDS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getFriends",restoredState:t?.restoredState,finalizer:async e=>(delete e?.pathParams,!this.isMe&&this.id&&(e.pathParams={id:this.id}),this.endpointApi.getFriendsAdmin(e))}).next()}async getSubscriptions(e={},t){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIPTIONS","searchType"),this._createPaginatorEngine({initialData:e,methodName:"getSubscriptions",restoredState:t?.restoredState,finalizer:async e=>{delete e?.pathParams;const t=this.isMe?()=>this.callIsMe(()=>this.endpointApi.getSubscriptionsAdmin(e)):()=>this.endpointApi.getSubscriptions(e);return this.isMe||e.filters||(e.filters={[`links.followers.${this.id}`]:{$exists:!0}}),t()}}).next()}async getSubscribers(e={}){return super.getSubscribers(e)}async getBadgesIssuer(e={}){return super.getBadgesIssuer(e)}async getBadges(e={}){return await this.linkEntitiesFromServerData("badges",e)}async getGallery(e={}){return super.getGallery(e)}async user(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur",401);if(!e.id&&!e.slug)throw new error_ApiError("Vous devez fournir un id ou un slug pour créer un User.",400);const t=this.deps,r=new User(this,e,t);return await r.get(),r}async organization(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.",401);return super.organization(e)}async project(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un projet.",401);return super.project(e)}async news(e={}){if(!("id"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer une actualité.",401);return super.news(e)}async poi(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un POI.",401);return super.poi(e)}async event(e={}){if(!("id"in e)&&!("slug"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un événement.",401);return super.event(e)}async badge(e={}){if(!("id"in e)&&!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer un badge.",401);return super.badge(e)}async sendFriendRequest(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour envoyer une demande d'amis.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){const t={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,connectType:e},r=await this.endpointApi.connect(t);return await(this.userContext?.refresh()),r}if(t.isInviting&&t.invitorId===this.id)return this.acceptFriendRequest();if(t.isInviting&&t.invitorId===this.userId)throw new error_ApiError("Vous avez déjà envoyé une demande d'amis à cet utilisateur.",403);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",409)}async acceptFriendRequest(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour accepter une demande d'amitié.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const e=this._getLinkFromConnectedUser();if(e?.isInviting&&e.invitorId===this.id){const e={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,linkOption:"isInviting"},t=await this.endpointApi.linkValidate(e);return await(this.userContext?.refresh()),t}throw new error_ApiError("Vous n'avez pas d'invitation à valider.",404)}async removeFriend(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour supprimer un ami.",401);if(this._checkLinkableEntity(),!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new error_ApiError("Vous n'êtes pas connecté à cette entité.",404);const t={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,connectType:e},r=await this.endpointApi.disconnect(t);return await(this.userContext?.refresh()),r}async requestToJoin(){throw new error_ApiError("l'utilisation de requestToJoin n'est pas autorisée sur un utilisateur.",403)}async requestToJoinAdmin(){throw new error_ApiError("l'utilisation de requestToJoinAdmin n'est pas autorisée sur un utilisateur.",403)}async acceptInvitation(){throw new error_ApiError("l'utilisation de acceptInvitation n'est pas autorisée sur un utilisateur.",403)}async leave(){throw new error_ApiError("l'utilisation de leave n'est pas autorisée sur un utilisateur.",403)}async follow(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour suivre un utilisateur.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.userContext?.serverData?.links?.follows?.[this.id]){const e={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id},t=await this.endpointApi.follow(e);return await(this.userContext?.refresh()),t}throw new error_ApiError("Vous êtes déjà abonné à cet utilisateur.",409)}async unfollow(){if(!this.isActingUser||!this.userId)throw new error_ApiError("Vous devez être connecté pour vous désabonner d'un utilisateur.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(this.userContext?.serverData?.links?.follows?.[this.id]){const e={childId:this.userId,childType:"citoyens",parentType:this.getEntityType(),parentId:this.id,connectType:"followers"},t=await this.endpointApi.disconnect(e);return await(this.userContext?.refresh()),t}throw new error_ApiError("Vous n'êtes pas abonné à cet utilisateur.",404)}isFriend(e){const t=e?.silent??!0;try{if(!this.isActingUser)throw new error_ApiError("Vous devez être connecté pour vérifier si vous êtes ami.",401)}catch(e){if(t)return!1;throw e}this._assertEntityType("citoyens");const r=this._getLinkFromConnectedUser();return!!r&&this._validateUserLink(r)}isFollower(e){const t=e?.silent??!0;try{if(!this.isActingUser)throw new error_ApiError("Vous devez être connecté pour vérifier si il vous suit.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404)}catch(e){if(t)return!1;throw e}return this._assertEntityType("citoyens"),this._isLinked("followers")}isFollowing(e){const t=e?.silent??!0;try{if(!this.isActingUser)throw new error_ApiError("Vous devez être connecté pour vérifier si vous le suivez.",401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404)}catch(e){if(t)return!1;throw e}return this._assertEntityType("citoyens"),this._isLinked("follows")}async entityBySlug(e){if(!this.isMe)throw new error_ApiError("Vous devez être connecté et être l'utilisateur pour créer cet entité.",401);return super.entityBySlug(e)}_validateBasePreconditions(e,t){if(!this.userId)throw new error_ApiError(`Vous devez être connecté pour ${e}.`,401);if(!this.id)throw new error_ApiError(`${this.constructor.name} non enregistrée.`,404);if(!this.parent?.id)throw new error_ApiError("L'entité parente n'est pas enregistrée.",404);if(!t.includes(this.parent.getEntityType()))throw new error_ApiError(`L'entité doit être de type : ${t.join(", ")}, reçu : ${this.parent.getEntityType()}`,400)}_validateMemberPreconditions(e,t){if(this._validateBasePreconditions(e,t),!this.parent?.id)throw new error_ApiError("L'entité parente n'est pas enregistrée.",404);const r=this.parent.getEntityType();if("events"===r)return;let n=!1;switch(r){case"organizations":n=this.parent.isMember();break;case"projects":n=this.parent.isContributor();break;default:n=!1}if(!n)throw new error_ApiError(`Vous devez être ${{organizations:"membre",projects:"contributeur"}[r]||"membre"} pour effectuer cette action.`,401)}_validateAdminPreconditions(e,t){if(this._validateMemberPreconditions(e,t),!this.parent?.isAdmin())throw new error_ApiError("Vous devez être administrateur pour effectuer cette action.",401)}_getParentLinkForUser(){const{connectTypeDisconnect:e}=this.parent._getLinkMeta(),t=this.id;return t&&this.parent?.serverData?.links?.[e]?.[t]||null}_getValidatedParentLink(e,t,r){const n=r?.silent??!0;try{this._validateBasePreconditions(e,t)}catch(e){if(n)return null;throw e}return this._getParentLinkForUser()}async _refreshWithParent(){await this.refresh(),this.parent&&await this.parent.refresh()}isAdmin(e){const t=this._getValidatedParentLink("isAdmin",["organizations","projects"],{silent:e?.silent});return this._validateUserLink(t)&&!0===t?.isAdmin}isMember(e){const t=this._getValidatedParentLink("isMember",["organizations"],{silent:e?.silent});return this._validateUserLink(t)}isContributor(e){const t=this._getValidatedParentLink("isContributor",["projects"],{silent:e?.silent});return this._validateUserLink(t)}isAttendee(e){const t=this._getValidatedParentLink("isAttendee",["events"],{silent:e?.silent});return this._validateUserLink(t)}isInviting(e){const t=this._getValidatedParentLink("isInviting",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isInviting}isInvitingFriend(e){const t=this._getValidatedUserLink("isInvitingFriend",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.isInviting}isInvitingAdmin(e){const t=this._getValidatedParentLink("isInvitingAdmin",["organizations","projects"],{silent:e?.silent});return!!t&&(!0===t.isAdminInviting||!0===t.isInviting)&&!0===t.isAdmin}isAdminPending(e){const t=this._getValidatedParentLink("isAdminPending",["organizations","projects"],{silent:e?.silent});return!!t&&!0===t.isAdmin&&!0===t.isAdminPending}isToBeValidated(e){const t=this._getValidatedParentLink("isToBeValidated",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.toBeValidated}isToBeValidatedFriend(e){const t=this._getValidatedUserLink("isToBeValidatedFriend",["citoyens","organizations","projects","events"],{silent:e?.silent});return!!t&&!0===t.toBeValidated}async sendRequestToJoinParent({admin:e}={admin:!1}){e?this._validateAdminPreconditions("sendRequestToJoinParent",["organizations","projects"]):this._validateMemberPreconditions("sendRequestToJoinParent",["organizations","projects","events"]);const{connectTypeConnect:t}=this.parent._getLinkMeta(),r=this._getParentLinkForUser();if(!r){const r=this.parent.getEntityType(),n={childId:this.id,childType:"citoyens",parentType:r,parentId:this.parent.id,connectType:e?"admin":t},o=await this.callIsConnected(()=>this.endpointApi.connect(n));return await this._refreshWithParent(),o}if(r.isInviting||r?.isAdminInviting)throw new error_ApiError("Une invitation est déjà en attente d'acceptation.",400);throw new error_ApiError("Vous êtes déjà connecté à cette entité.",400)}async validateMemberRequest(){this._validateAdminPreconditions("validateMemberRequest",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e?.toBeValidated)throw new error_ApiError("Cet utilisateur n'a pas de demande en attente de validation.",400);const t=this.parent.getEntityType(),r={childId:this.id,childType:"citoyens",parentType:t,parentId:this.parent.id,linkOption:"toBeValidated"},n=await this.callIsConnected(()=>this.endpointApi.linkValidate(r));return await this._refreshWithParent(),n}async validateAdminRequest(){this._validateAdminPreconditions("validateAdminRequest",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e?.isAdminPending)throw new error_ApiError("Cet utilisateur n'a pas de demande d'admin en attente.",400);const t=this.parent.getEntityType(),r={childId:this.id,childType:"citoyens",parentType:t,parentId:this.parent.id,linkOption:"isAdminPending"},n=await this.callIsConnected(()=>this.endpointApi.linkValidate(r));return await this._refreshWithParent(),n}async removeFromParent(){if(this._validateAdminPreconditions("removeFromParent",["organizations","projects"]),!this._getParentLinkForUser())throw new error_ApiError("Cet utilisateur n'est pas connecté à cette entité.",400);const e=this.parent.getEntityType(),{connectTypeDisconnect:t}=this.parent._getLinkMeta(),r={childId:this.id,childType:"citoyens",parentType:e,parentId:this.parent.id,connectType:t},n=await this.callIsConnected(()=>this.endpointApi.disconnect(r));return await this._refreshWithParent(),n}async promoteToAdmin(){this._validateAdminPreconditions("promoteToAdmin",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e)throw new error_ApiError("Cet utilisateur n'est pas membre de cette entité.",400);if(e?.isAdmin&&(e?.isInviting||e?.isAdminInviting))throw new error_ApiError("Cet utilisateur est déjà en cours d'invitation en tant qu'admin.",400);if(e?.isAdmin&&!e?.isInviting&&!e?.isAdminInviting)throw new error_ApiError("Cet utilisateur est déjà admin.",400);const t=this.parent.getEntityType(),r={childId:this.id,childType:"citoyens",parentType:t,parentId:this.parent.id,connectType:"admin"},n=await this.callIsConnected(()=>this.endpointApi.connect(r));return await this._refreshWithParent(),n}async demoteFromAdmin(){this._validateAdminPreconditions("demoteFromAdmin",["organizations","projects"]);const e=this._getParentLinkForUser();if(!e?.isAdmin||e.isAdminPending)throw new error_ApiError("Cet utilisateur n'est pas admin de cette entité.",400);const t=this.parent.getEntityType(),{connectTypeDisconnect:r}=this.parent._getLinkMeta(),n=t,o={childId:this.id,childType:"citoyens",parentType:n,parentId:this.parent.id,connect:r,isAdmin:!1},i=await this.callIsConnected(()=>this.endpointApi.demoteAdmin(o));return await this._refreshWithParent(),i}}Object.assign(User.prototype,{});const re=e=>24===e.length&&/^[0-9a-f]*$/.test(e);class ObjectID{_str;constructor(e){if(this._str=void 0,e){if(e=e.toLowerCase(),!re(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new 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()}}const ne=ObjectID,oe={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:{additionalProperties:!1,properties:{reason:{default:"",type:"string"}},required:["reason"],type:"object"},common9:{reason:{default:"",type:"string"}},common10:{default:"",type:"string"},common11:{pattern:"^[a-f0-9]{24}$",type:"string"},common12:{const:"citoyens"},common13:{properties:{value:{type:"boolean"}}},common14:{value:{type:"boolean"}},common15:{enum:["isOpenData","isOpenEdition","private","feedback"]},common16:{const:"organizations"},common17:{const:"projects"},common18:{const:"events"},common19:{default:"citoyens",enum:["citoyens","projects","organizations","events"],type:"string"},common20:{},common21:{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"}}}},common22:{properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}}},common23:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},common24:{properties:{typeElement:{const:"citoyens"}}},common25:{typeElement:{const:"citoyens"}},common26:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"}}},common27:{not:{type:"null"}},common28:{type:"null"},common29:{default:"citoyens",enum:["citoyens","projects","organizations","poi","events"],type:"string"},common30:{anyOf:[{format:"email",type:"string"},{const:"",type:"string"}]},common31:{const:"",type:"string"},common32:{anyOf:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common33:{items:{type:"string"},type:"array"},common34:{enum:[""],type:"string"},common35:{anyOf:[{format:"uri",type:"string"},{const:"",type:"string"}]},common36:{properties:{name:{not:{type:"null"}}},required:["name"]},common37:{name:{not:{type:"null"}}},common38:{properties:{url:{not:{type:"null"}}},required:["url"]},common39:{url:{not:{type:"null"}}},common40:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common41:{tags:{not:{type:"null"}}},common42:{properties:{email:{not:{type:"null"}}},required:["email"]},common43:{email:{not:{type:"null"}}},common44:{format:"date",type:"string"},common45:{const:"info",default:"info",type:"string"},common46:{anyOf:[{type:"string"},{const:"",type:"string"}]},common47:{$ref:"#/$defs/sharedFields/name"},common48:{$ref:"#/$defs/sharedFields/tags"},common49:{default:"citoyens",enum:["citoyens"],type:"string"},common50:{$ref:"#/$defs/sharedFields/url"},common51:{properties:{avancement:{not:{type:"null"}}},required:["avancement"]},common52:{avancement:{not:{type:"null"}}},common53:{properties:{parent:{not:{type:"null"}}},required:["parent"]},common54:{parent:{not:{type:"null"}}},common55:{$ref:"#/$defs/sharedFields/emailNullable"},common56:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},type:"object"},common57:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},common58:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"},common59:{name:{type:"string"},type:{type:"string"}},common60:{properties:{type:{not:{type:"null"}}},required:["type"]},common61:{type:{not:{type:"null"}}},common62:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common63:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},common64:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"},common65:{enum:["workshop","competition","concert","contest","conference","debate","exhibition","festival","crowdfunding","fair","course","protest","market","film","getTogether","meeting","spectacle","internship","stand","others"],type:"string"},common66:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common67:{enum:["link","tool","machine","software","rh","Resource material","Financial Ressource","ficheBlanche","geoJson","compostPickup","video","sharedLibrary","recoveryCenter","trash","history","something2See","funPlace","place","artPiece","streetArts","openScene","stand","parking","other"],type:"string"},common68:{enum:["poi"],type:"string"},common69:{$ref:"#/$defs/socialField"},common70:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common71:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common72:{id:{pattern:"^[a-f0-9]{24}$"}},common73:{pattern:"^[a-f0-9]{24}$"},common74:{oneOf:[{const:"",type:"string"},{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:{type:"string"},addressLocality:{type:"string"},codeInsee:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{minLength:0,type:"string"},level3Name:{minLength:0,type:"string"},level4:{minLength:0,type:"string"},level4Name:{minLength:0,type:"string"},localityId:{type:"string"},postalCode:{type:"string"},streetAddress:{type:"string"}},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"}]},common75:{additionalProperties:!1,properties:{"@type":{const:"PostalAddress",type:"string"},addressCountry:{type:"string"},addressLocality:{type:"string"},codeInsee:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{minLength:0,type:"string"},level3Name:{minLength:0,type:"string"},level4:{minLength:0,type:"string"},level4Name:{minLength:0,type:"string"},localityId:{type:"string"},postalCode:{type:"string"},streetAddress:{type:"string"}},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},common76:{"@type":{const:"PostalAddress",type:"string"},addressCountry:{type:"string"},addressLocality:{type:"string"},codeInsee:{type:"string"},level1:{type:"string"},level1Name:{type:"string"},level3:{minLength:0,type:"string"},level3Name:{minLength:0,type:"string"},level4:{minLength:0,type:"string"},level4Name:{minLength:0,type:"string"},localityId:{type:"string"},postalCode:{type:"string"},streetAddress:{type:"string"}},common77:{const:"PostalAddress",type:"string"},common78:{minLength:0,type:"string"},common79:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},required:["latitude","longitude"],type:"object"},common80:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},common81:{const:"GeoCoordinates",type:"string"},common82:{type:["string","number"]},common83:{additionalProperties:!0,properties:{coordinates:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},float:{const:!0,default:!0,type:"boolean"},type:{const:"Point",type:"string"}},required:["type","coordinates","float"],type:"object"},common84:{coordinates:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},float:{const:!0,default:!0,type:"boolean"},type:{const:"Point",type:"string"}},common85:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},common86:{type:"number"},common87:{const:!0,default:!0,type:"boolean"},common88:{const:"Point",type:"string"},common89:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common90:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common91:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common92:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common93:{properties:{type:{const:"citoyens"}}},common94:{type:{const:"citoyens"}},common95:{additionalProperties:!1,else:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},if:{properties:{folder:{const:"citoyens"}}},properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},ownerId:{type:"string"}},required:["folder","ownerId"],then:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},type:"object"},common96:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common97:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common98:{properties:{folder:{const:"citoyens"}}},common99:{folder:{const:"citoyens"}},common100:{folder:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},ownerId:{type:"string"}},common101:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},common102:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common103:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common104:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common105:{parentId:{pattern:"^[a-f0-9]{24}$"}},common106:{properties:{parentType:{const:"citoyens"}}},common107:{parentType:{const:"citoyens"}},common108:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common109:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common110:{default:!0,type:"boolean"},common111:{default:0,type:"integer"},common112:{required:["text"]},common113:{required:["mediaImg"]},common114:{required:["mediaFile"]},common115:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common116:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common117:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common118:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common119:{items:{properties:{count:{minimum:1,type:"integer"},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"},common120:{properties:{count:{minimum:1,type:"integer"},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"},common121:{count:{minimum:1,type:"integer"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common122:{minimum:1,type:"integer"},common123:{default:"public",enum:["public","private","restricted"],type:"string"},common124:{const:"news",default:"news",type:"string"},common125:{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"},common126:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common127:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common128:{default:!1,type:"boolean"},common129:{properties:{childId:{pattern:"^[a-f0-9]{24}$"}}},common130:{childId:{pattern:"^[a-f0-9]{24}$"}},common131:{properties:{childType:{const:"citoyens"}}},common132:{childType:{const:"citoyens"}},common133:{const:"share",default:"share",type:"string"},common134:{properties:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common135:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common136:{default:"news",enum:["news"],type:"string"},common137:{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"},common138:{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"},common139:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common140:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi","answers","forms"],type:"string"},common141:{const:!1,default:!1,type:"boolean"},common142:{const:"",default:"",type:"string"},common143:{default:0,type:"number"},common144:{default:30,type:"number"},common145:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},common146:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},common147:{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"},common148:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},common149:{enum:["cities","level1"],type:"string"},common150:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},type:"object"},common151:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},common152:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common153:{indexMax:{type:"number"},indexMin:{type:"number"}},common154:{enum:["ALL"],type:"string"},common155:{minimum:0,type:"integer"},common156:{default:0,minimum:0,type:"integer"},common157:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common158:{enum:["projects"],type:"string"},common159:{$exists:!0},common160:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common161:{$exists:{const:!0}},common162:{const:!0},common163:{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"},common164:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common165:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common166:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common167:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common168:{$exists:!1},common169:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common170:{$exists:{const:!1}},common171:{const:!1},common172:{default:30,type:"integer"},common173:{default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},type:"array"},common174:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common175:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common176:{$exists:{default:!1,type:"boolean"}},common177:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common178:{$in:{items:{type:"string"},minItems:1,type:"array"}},common179:{items:{type:"string"},minItems:1,type:"array"},common180:{default:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],items:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},minItems:1,type:"array"},common181:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common182:{enum:["citoyens"],type:"string"},common183:{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"},common184:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common185:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common186:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common187:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common188:{"^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"}},common189:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common190:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common191:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common192:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"},common193:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common194:{enum:["badges"],type:"string"},common195:{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"},common196:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common197:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common198:{$exists:{const:!0,type:"boolean"}},common199:{const:!0,type:"boolean"},common200:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common201:{$exists:{const:!1,type:"boolean"}},common202:{const:!1,type:"boolean"},common203:{"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"}},common204:{indexMax:30,indexMin:0},common205:{properties:{parentType:{const:"organizations"}}},common206:{parentType:{const:"organizations"}},common207:{properties:{parentType:{const:"projects"}}},common208:{parentType:{const:"projects"}},common209:{properties:{parentType:{const:"events"}}},common210:{parentType:{const:"events"}},common211:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common212:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common213:{enum:["citoyens","organizations","projects","events"],type:"string"},common214:{const:"citoyens",default:"citoyens",type:"string"},common215:{const:"@userId",default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common216:{minLength:3,type:"string"},common217:{enum:["Mo","Tu","We","Th","Fr","Sa","Su"],type:"string"},common218:{additionalProperties:!1,properties:{closes:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},opens:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"}},required:["opens","closes"],type:"object"},common219:{closes:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},opens:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"}},common220:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},common221:{default:{isOpenData:!0,isOpenEdition:!0},properties:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},required:["isOpenData","isOpenEdition"],type:"object"},common222:{isOpenData:!0,isOpenEdition:!0},common223:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},common224:{const:"projects",default:"projects",type:"string"},common225:{additionalProperties:!1,default:{"@userId":{type:"citoyens"}},patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common226:{"@userId":{type:"citoyens"}},common227:{type:"citoyens"},common228:{const:"poi",default:"poi",type:"string"},common229:{const:"events",default:"events",type:"string"},common230:{format:"date-time",type:"string"},common231:{type:"integer"},common232:{additionalProperties:!1,properties:{id:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},type:{const:"citoyens",default:"citoyens",type:"string"}},required:["type","id"],type:"object"},common233:{id:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},type:{const:"citoyens",default:"citoyens",type:"string"}},common234:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},common235:{const:"badges",default:"badges",type:"string"},common236:{const:"badge",default:"badge",type:"string"},common237:{patternProperties:{"^[0-9a-f]{24}$":{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"}},type:"object"},common238:{"^[0-9a-f]{24}$":{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"}},common239:{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"},common240:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},common241:{default:"",enum:["","admin"],type:"string"},common242:{enum:["projects","organizations"],type:"string"},common243:{items:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi","answers","forms","classifieds"],type:"string"},type:"array"},common244:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi","answers","forms","classifieds"],type:"string"},common245:{default:"",oneOf:[{additionalProperties:!0,type:"object"},{const:"",type:"string"}]},common246:{additionalProperties:!0,type:"object"},common247:{additionalProperties:!0,properties:{tags:{additionalProperties:!0,properties:{verb:{type:"string"}},type:"object"}},type:"object"},common248:{tags:{additionalProperties:!0,properties:{verb:{type:"string"}},type:"object"}},common249:{additionalProperties:!0,properties:{verb:{type:"string"}},type:"object"},common250:{verb:{type:"string"}},common251:{additionalProperties:{enum:[1,-1],type:"integer"},type:"object"},common252:{enum:[1,-1],type:"integer"},common253:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},required:["id","type"],type:"object"},common254:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},common255:{default:"events",type:"string"},common256:{items:{properties:{id:{type:"string"}},required:["id"],type:"object"},type:"array"},common257:{properties:{id:{type:"string"}},required:["id"],type:"object"},common258:{id:{type:"string"}},common259:{additionalProperties:!1,properties:{contextId:{pattern:"^[a-f0-9]{24}$",type:"string"},contextType:{enum:["projects","organizations"],type:"string"},costumEditMode:{default:!1,type:"boolean"},costumSlug:{type:"string"},sourceKey:{items:{type:"string"},type:"array"}},type:"object"},common260:{contextId:{pattern:"^[a-f0-9]{24}$",type:"string"},contextType:{enum:["projects","organizations"],type:"string"},costumEditMode:{default:!1,type:"boolean"},costumSlug:{type:"string"},sourceKey:{items:{type:"string"},type:"array"}},common261:{items:{enum:["answers"],type:"string"},type:"array"},common262:{enum:["answers"],type:"string"},common263:{enum:["comments","news"],type:"string"},common264:{minLength:1,type:"string"},common265:{default:"citoyens",enum:["citoyens","organizations","projects","events","poi"],type:"string"},common266:{type:"array"},common267:{additionalProperties:!0,properties:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"},username:{type:"string"}},required:["username","costumSlug","costumId","costumType"],type:"object"},common268:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"},username:{type:"string"}},common269:{additionalProperties:!0,properties:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"}},required:["costumSlug","costumId","costumType"],type:"object"},common270:{costumId:{type:"string"},costumSlug:{type:"string"},costumType:{type:"string"}}},ie={endpoints:[{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:oe.common1,email:oe.common2,isInvitation:oe.common3,mode:oe.common1,name:oe.common1,pendingUserId:oe.common1,pwd:oe.common1,username:oe.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:oe.common2,password:oe.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:oe.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:oe.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:oe.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:oe.common1,newPassword2:oe.common1,oldPassword:oe.common1,scope:{default:"",type:["string"]},userId:oe.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:oe.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:oe.common8},{auth:"bearer",constant:"UPDATE_SETTINGS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatesettings",request:{additionalProperties:!1,allOf:[{else:{properties:{idEntity:oe.common11}},if:{properties:{typeEntity:oe.common12}},then:{properties:{idEntity:oe.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:oe.common12}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:oe.common12}},then:oe.common13},{if:{properties:{type:oe.common15,typeEntity:oe.common16}},then:oe.common13},{if:{properties:{type:oe.common15,typeEntity:oe.common17}},then:oe.common13},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","public"]},typeEntity:oe.common18}},then:oe.common13}],properties:{idEntity:oe.common1,type:oe.common1,typeEntity:oe.common19,value:oe.common20},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:[oe.common21,{anyOf:[{properties:{description:oe.common27},required:["description"]},{properties:{shortDescription:oe.common27},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:oe.common10,description:oe.common1,id:oe.common1,scope:{default:"",type:["string","null"]},shortDescription:oe.common1,typeElement:oe.common29},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:oe.common2,emailNullable:oe.common30,name:oe.common1,tags:oe.common32,url:oe.common35}},allOf:[{if:oe.common24,then:{additionalProperties:!1,anyOf:[oe.common36,{properties:{birthDate:oe.common27},required:["birthDate"]},{properties:{fixe:oe.common27},required:["fixe"]},{properties:{mobile:oe.common27},required:["mobile"]},oe.common38,oe.common40,oe.common42],properties:{birthDate:{anyOf:[oe.common44,oe.common31]},block:oe.common45,email:{$ref:"#/$defs/sharedFields/email"},fixe:oe.common46,id:oe.common5,mobile:oe.common46,name:oe.common47,scope:oe.common10,tags:oe.common48,typeElement:oe.common49,url:oe.common50}}},{if:{properties:{typeElement:oe.common17}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common38,oe.common40,oe.common42,oe.common51,oe.common53],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:oe.common45,email:oe.common55,id:oe.common1,name:oe.common47,parent:oe.common56,scope:oe.common10,tags:oe.common48,typeElement:{default:"citoyens",enum:["projects"],type:"string"},url:oe.common50}}},{if:{properties:{typeElement:oe.common18}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common38,oe.common40,oe.common42,oe.common51,oe.common60,{properties:{organizer:oe.common27},required:["organizer"]},oe.common53],properties:{block:oe.common45,email:oe.common55,id:oe.common1,name:oe.common47,organizer:oe.common62,parent:oe.common56,scope:oe.common10,tags:oe.common48,type:oe.common65,typeElement:{default:"citoyens",enum:["events"],type:"string"},url:oe.common50}}},{if:{properties:{typeElement:oe.common16}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common38,oe.common40,oe.common42,oe.common60],properties:{block:oe.common45,email:oe.common55,id:oe.common1,name:oe.common47,scope:oe.common10,tags:oe.common48,type:oe.common66,typeElement:{enum:["organizations"],type:"string"},url:oe.common50}}},{if:{properties:{typeElement:{const:"poi"}}},then:{additionalProperties:!1,anyOf:[oe.common36,oe.common40,oe.common60,{properties:{urls:oe.common27},required:["urls"]}],properties:{block:oe.common45,id:oe.common1,name:oe.common47,scope:oe.common10,tags:oe.common48,type:oe.common67,typeElement:oe.common68,urls:oe.common32}}}],properties:{block:oe.common45,id:oe.common1,scope:oe.common10,typeElement:oe.common29},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:[oe.common34,oe.common4]}},allOf:[oe.common21,{anyOf:[{properties:{gitlab:oe.common27},required:["gitlab"]},{properties:{github:oe.common27},required:["github"]},{properties:{twitter:oe.common27},required:["twitter"]},{properties:{facebook:oe.common27},required:["facebook"]},{properties:{instagram:oe.common27},required:["instagram"]},{properties:{diaspora:oe.common27},required:["diaspora"]},{properties:{mastodon:oe.common27},required:["mastodon"]},{properties:{telegram:oe.common27},required:["telegram"]},{properties:{signal:oe.common27},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:oe.common69,facebook:oe.common69,github:oe.common69,gitlab:oe.common69,id:oe.common1,instagram:oe.common69,mastodon:oe.common69,scope:oe.common10,signal:oe.common69,telegram:oe.common69,twitter:oe.common69,typeElement:oe.common70},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:oe.common71,if:oe.common24,properties:{address:oe.common74,block:{const:"localities",default:"localities",type:"string"},geo:{oneOf:[oe.common31,oe.common79]},geoPosition:{oneOf:[oe.common31,oe.common83]},id:oe.common1,scope:oe.common10,typeElement:oe.common29},required:["block","typeElement","id","address"],then:oe.common89,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:oe.common71,if:oe.common24,properties:{block:oe.common45,id:oe.common1,scope:oe.common10,slug:oe.common92,typeElement:oe.common29},required:["block","typeElement","id","slug"],then:oe.common89,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:oe.common71,if:oe.common93,properties:{block:oe.common45,id:oe.common1,slug:oe.common92,type:oe.common19},required:["block","type","id","slug"],then:oe.common89,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:oe.common95,request:{additionalProperties:!1,properties:{profil_avatar:oe.common20},required:["profil_avatar"],type:"object"}},{auth:"bearer",constant:"PROFIL_BANNER",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/banner/docType/image/contentKey/banner",pathParams:oe.common95,request:{additionalProperties:!1,properties:{banner:oe.common20,cropH:oe.common86,cropW:oe.common86,cropX:oe.common86,cropY:oe.common86,formOrigin:{const:"banner",default:"banner"},parentId:oe.common11,parentType:oe.common101},required:["banner","parentId","parentType","formOrigin","cropW","cropH","cropX","cropY"],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,else:oe.common71,if:oe.common93,properties:{id:oe.common1,type:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi","badges","answers","classifieds","forms","actions"],type:"string"}},required:["type","id"],then:oe.common89,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,else:oe.common104,if:oe.common106,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:oe.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:oe.common1,parentType:oe.common70},required:["parentId","parentType","listInvite"],then:oe.common108,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:oe.common71,if:oe.common93,properties:{id:oe.common1,isLive:oe.common110,type:oe.common70},required:["isLive","type","id"],then:oe.common89,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:oe.common111,indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:oe.common10},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:oe.common11,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:[oe.common112,oe.common113,oe.common114],else:oe.common104,if:oe.common106,properties:{json:oe.common87,markdownActive:oe.common110,mediaFile:oe.common115,mediaImg:oe.common117,mentions:oe.common119,parentId:oe.common1,parentType:oe.common70,scope:oe.common123,tags:oe.common32,text:oe.common1,type:oe.common124},required:["scope","markdownActive","parentId","parentType","type","json"],then:oe.common108,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:oe.common125,request:{additionalProperties:!1,properties:{newsImage:oe.common20},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:oe.common125,request:{additionalProperties:!1,properties:{newsFile:oe.common20},required:["newsFile"],type:"object"}},{auth:"bearer",constant:"DELETE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/delete/id/{id}",pathParams:oe.common127,request:{additionalProperties:!1,properties:{isLive:oe.common128},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:[oe.common112,oe.common113,oe.common114],else:oe.common104,if:oe.common106,properties:{idNews:oe.common11,markdownActive:oe.common110,mediaFile:oe.common115,mediaImg:oe.common117,mentions:oe.common119,parentId:oe.common1,parentType:oe.common70,scope:oe.common123,tags:oe.common32,text:oe.common1,type:oe.common124},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:oe.common108,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:oe.common129,if:oe.common131,properties:{childId:oe.common11,childType:oe.common70,comment:oe.common1,connectType:oe.common133,parentId:oe.common11,parentType:oe.common124},required:["parentId","parentType","childId","childType","connectType"],then:oe.common134,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:{additionalProperties:!1,properties:{id:oe.common11,type:oe.common136},required:["type","id"],type:"object"}},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:oe.common10,contextId:oe.common11,contextType:oe.common136,mentions:oe.common137,parentCommentId:{default:"",pattern:"^([a-f0-9]{24}|)$",type:"string"},path:oe.common10,text:oe.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:oe.common127},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:oe.common11,params:{properties:{mentions:oe.common137,text:oe.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:oe.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:{additionalProperties:!1,properties:{id:oe.common11,type:{default:"news",enum:["news","comments"],type:"string"}},required:["type","id"],type:"object"}},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:oe.common87,countType:{default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:oe.common140,type:"array"},fediverse:oe.common141,filters:oe.common142,indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common145,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchTags:oe.common33,searchType:{items:oe.common140,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:oe.common155,locality:oe.common142,name:oe.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:"CITY_AUTOCOMPLETE_BY_COUNTRY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/city/autocompletemultiscope",request:{additionalProperties:!1,properties:{countryCode:{default:"FR",type:"string"},formInMap:oe.common128,scopeValue:oe.common1,type:{enum:["locality"],type:"string"}},required:["type","countryCode","scopeValue","formInMap"],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:oe.common156,name:oe.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:oe.common87,countType:oe.common157,fediverse:oe.common141,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":oe.common159,"parent.@userId":oe.common159},"links.contributors.@userId":oe.common159},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"}},required:["$or"],type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common157},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:oe.common163,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common157,fediverse:oe.common141,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":oe.common159,"parent.@{pathParams.id}":oe.common159},"links.contributors.@{pathParams.id}":oe.common159},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},type:"object"}},required:["$or"],type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common157},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:oe.common87,countType:oe.common165,fediverse:oe.common141,filters:{additionalProperties:!1,default:{"parent.@userId":oe.common159},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common165},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:oe.common163,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common165,fediverse:oe.common141,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":oe.common159},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common165},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:oe.common87,countType:oe.common166,fediverse:oe.common141,filters:{additionalProperties:!1,default:{"links.members.@userId":oe.common159,"links.members.@userId.isInviting":oe.common168,"links.members.@userId.toBeValidated":oe.common168},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common169,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common166},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:oe.common71,if:oe.common93,properties:{id:oe.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:oe.common89,type:"object"},request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common166,fediverse:oe.common141,filters:{additionalProperties:!0,default:{"links.members.@{pathParams.id}":oe.common159,"links.members.@{pathParams.id}.isInviting":oe.common168,"links.members.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common169,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common166},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:oe.common87,countType:oe.common173,fediverse:oe.common141,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+)$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common175,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":oe.common177,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},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:oe.common127,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common173,fediverse:oe.common141,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}":oe.common159,"links.memberOf.@{pathParams.id}.isInviting":oe.common168,"links.memberOf.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":oe.common160,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":oe.common177,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},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:oe.common6,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common181,fediverse:oe.common141,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}":oe.common159,"links.friends.@{pathParams.id}.isInviting":oe.common168,"links.friends.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchType:oe.common181},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:oe.common87,countType:oe.common183,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common185],default:{"links.followers.@userId":oe.common159,"links.followers.@{userId}.isInviting":oe.common168,"links.followers.@{userId}.toBeValidated":oe.common168},patternProperties:oe.common188,type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common183},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:oe.common6,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common183,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common185],default:{"links.followers.@{pathParams.id}":oe.common159,"links.followers.@{pathParams.id}.isInviting":oe.common168,"links.followers.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:oe.common188,type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common183},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:oe.common87,countType:oe.common181,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common189],default:{"links.follows.@userId":oe.common159,"links.follows.@{userId}.isInviting":oe.common168,"links.follows.@{userId}.toBeValidated":oe.common168},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common169,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common181},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:oe.common71,if:oe.common93,then:oe.common89}],properties:{id:oe.common1,type:oe.common192},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common181,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[oe.common189],default:{"links.follows.@{pathParams.id}":oe.common159},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160},type:"object"},indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,searchType:oe.common181},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"GET_CONTRIBUTORS_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common173,fediverse:oe.common141,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+)$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common175,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":oe.common177,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},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:oe.common127,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common173,fediverse:oe.common141,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}":oe.common159,"links.projects.@{pathParams.id}.isInviting":oe.common168,"links.projects.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":oe.common160,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":oe.common177,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common180},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:oe.common87,countType:oe.common193,fediverse:oe.common141,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"},isParcours:oe.common3,"preferences.private":oe.common141},required:["preferences.private"],type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common193},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:oe.common87,countType:oe.common195,fediverse:oe.common141,fields:oe.common193,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common197}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common197,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":oe.common200,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":oe.common200}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:oe.common203},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:oe.common203,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":oe.common199}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":oe.common197}}],type:"object"},indexMin:oe.common156,indexStep:oe.common172,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:{additionalProperties:!1,default:{Cooperative:oe.common204,GovernmentOrganization:oe.common204,Group:oe.common204,LocalBusiness:oe.common204,NGO:oe.common204,citoyens:oe.common204,projects:oe.common204},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":oe.common152},type:"object"},searchType:oe.common195},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:{additionalProperties:!1,allOf:[{if:oe.common106,then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:oe.common205,then:{properties:{connectType:{enum:["admin","member"]}}}},{if:oe.common207,then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:oe.common209,then:{properties:{connectType:{default:"attendee",enum:["attendee","connect"]}}}}],properties:{childId:oe.common211,childType:oe.common212,connectType:{enum:["admin","member","contributor","attendee","friend","connect"],type:"string"},parentId:oe.common11,parentType:oe.common213},required:["childId","childType","parentType","parentId","connectType"],type:"object"}},{auth:"bearer",constant:"DISCONNECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/disconnect",request:{additionalProperties:!1,allOf:[{if:oe.common106,then:{properties:{connectType:{default:"friends",enum:["friends","followers"]}}}},{if:oe.common205,then:{properties:{connectType:{default:"members",enum:["members","followers"]}}}},{if:oe.common207,then:{properties:{connectType:{default:"contributors",enum:["contributors","followers"]}}}},{if:oe.common209,then:{properties:{connectType:{default:"attendees",enum:["attendees","followers"]}}}}],properties:{childId:oe.common211,childType:oe.common212,connectType:{enum:["members","contributors","attendees","friends","followers"],type:"string"},parentId:oe.common11,parentType:oe.common213},required:["childId","childType","parentType","parentId","connectType"],type:"object"}},{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"}},{auth:"bearer",constant:"GET_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/app/config/type/citoyens/id/{id}/json/true",pathParams:oe.common6},{auth:"bearer",constant:"DELETE_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue?index={index}",pathParams:{properties:{index:oe.common86},type:"object"},request:{additionalProperties:!1,properties:{collection:oe.common214,id:oe.common215,path:{const:"preferences.search.@{pathParams.index}",default:"preferences.search.@{pathParams.index}",type:"string"},pull:{const:"preferences.search",type:"string"},value:oe.common142},required:["id","collection","path","pull","value"],type:"object"}},{auth:"bearer",constant:"ADD_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue",request:{additionalProperties:!1,properties:{arrayForm:oe.common199,collection:oe.common214,id:oe.common215,path:{const:"preferences.search",default:"preferences.search",type:"string"}},required:["id","collection","path","arrayForm","value"],type:"object"}},{auth:"bearer",constant:"ADD_ORGANIZATION",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!0,properties:{address:oe.common75,buildingSurfaceArea:oe.common86,collection:{const:"organizations",default:"organizations",type:"string"},compagnon:oe.common1,costum:{additionalProperties:!0,properties:{bannerImageUrl:oe.common1,bannerLogoUrl:oe.common1,bannerText:oe.common1,cocity:oe.common128,slug:oe.common1,transparentCommune:oe.common128,typeCocity:oe.common1},required:[],type:"object"},costumEditMode:oe.common3,costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,description:oe.common1,email:oe.common2,filiere:{additionalProperties:{additionalProperties:!1,properties:{icon:oe.common1,name:oe.common1,tags:oe.common33},required:["name","icon","tags"],type:"object"},type:"object"},geo:oe.common79,geoPosition:oe.common83,holderOrganization:oe.common1,id:oe.common11,key:{const:"organization",default:"organization",type:"string"},mainTag:oe.common1,manageModel:oe.common1,name:oe.common216,openingDate:oe.common1,openingHours:{items:{oneOf:[oe.common31,{additionalProperties:!1,properties:{dayOfWeek:oe.common217,hours:{items:oe.common218,type:"array"}},required:["dayOfWeek","hours"],type:"object"}]},maxItems:7,minItems:7,type:"array"},preferences:oe.common221,role:{enum:["admin","member"],type:"string"},scope:oe.common142,shortDescription:oe.common1,siteSurfaceArea:oe.common86,source:{properties:{insertOrign:oe.common1,key:oe.common1,keys:oe.common33},type:"object"},tags:oe.common33,telephone:oe.common1,thematic:oe.common33,type:oe.common66,typePlace:oe.common1,url:oe.common35,video:oe.common33},required:["id","collection","key","name","type","role","scope"],type:"object"}},{auth:"bearer",constant:"ADD_PROJECT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,properties:{address:oe.common75,collection:oe.common224,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:{const:"project",default:"project",type:"string"},name:oe.common1,parent:oe.common225,preferences:{default:{crowdfunding:!0,isOpenData:!1,isOpenEdition:!1},properties:{crowdfunding:oe.common110,isOpenData:oe.common128,isOpenEdition:oe.common128},required:["isOpenData","isOpenEdition"],type:"object"},public:oe.common110,scope:oe.common142,shortDescription:oe.common1,tags:oe.common33,url:oe.common35},required:["id","collection","key","parent","name","public","scope"],type:"object"}},{auth:"bearer",constant:"ADD_POI",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,properties:{address:oe.common75,collection:oe.common228,description:oe.common1,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:oe.common228,name:oe.common1,parent:oe.common225,scope:oe.common142,tags:oe.common33,type:oe.common67,urls:oe.common33},required:["id","collection","key","parent","type","name"],type:"object"}},{auth:"bearer",constant:"ADD_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,else:{required:["openingHours"]},if:{properties:{recurrency:oe.common171}},properties:{address:oe.common74,collection:oe.common229,email:oe.common30,endDate:oe.common230,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:{const:"event",default:"event",type:"string"},name:{minLength:2,type:"string"},openingHours:{default:["","","","","","",""],items:{anyOf:[oe.common31,{additionalProperties:!1,properties:{dayOfWeek:oe.common217,hours:{default:[],items:oe.common218,type:"array"}},required:["dayOfWeek","hours"],type:"object"}]},maxItems:7,minItems:7,type:"array"},organizer:oe.common225,parent:{oneOf:[oe.common62,oe.common31]},preferences:{default:{isOpenData:!1,isOpenEdition:!1},properties:{isOpenData:oe.common128,isOpenEdition:oe.common128},required:["isOpenData","isOpenEdition"],type:"object"},public:oe.common110,recurrency:oe.common128,scope:oe.common142,shortDescription:{format:"textarea",type:"string"},startDate:oe.common230,tags:{anyOf:[oe.common33,oe.common31]},timeZone:oe.common1,type:oe.common65,url:oe.common35},required:["id","collection","key","organizer","type","name","scope"],startBeforeEnd:!0,then:{required:["startDate","endDate"]},type:"object"}},{auth:"bearer",constant:"DELETE_POI",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/poi/id/{id}",pathParams:oe.common127,request:oe.common8},{auth:"bearer",constant:"DELETE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/events/id/{id}/",pathParams:oe.common127,request:oe.common8},{auth:"bearer",constant:"DELETE_ELEMENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/{type}/id/{id}",pathParams:{additionalProperties:!1,properties:{id:oe.common11,type:oe.common1},required:["type","id"],type:"object"},request:oe.common8},{auth:"bearer",constant:"ADD_IMAGE_ELEMENT",contentType:"multipart/form-data",method:"POST",path:"/co2/document/upload-save/dir/communecter/folder/{folder}/ownerId/{ownerId}/input/qqfile/docType/image/contentKey/profil",pathParams:{additionalProperties:!1,properties:{folder:{enum:["badges","events"],type:"string"},ownerId:oe.common11},required:["folder","ownerId"],type:"object"},request:{additionalProperties:!1,properties:{qqfile:oe.common20,qqfilename:oe.common1,qqtotalfilesize:oe.common231,qquuid:oe.common11},required:["qquuid","qqfilename","qqtotalfilesize","qqfile"],type:"object"}},{auth:"bearer",constant:"LINK_VALIDATE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/validate",request:{additionalProperties:!1,properties:{childId:oe.common5,childType:oe.common49,linkOption:{enum:["isInviting","toBeValidated","isAdminPending"],type:"string"},parentId:oe.common11,parentType:oe.common213},required:["childId","childType","parentType","parentId"],type:"object"}},{auth:"none",constant:"SEARCH_MEMBER_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/searchmemberautocomplete",request:{additionalProperties:!1,properties:{search:oe.common1,searchMode:{default:"personOnly",enum:["personOnly","organizationOnly","mixte"],type:"string"}},required:["search","searchMode"],type:"object"}},{auth:"bearer",constant:"GET_NOTIFICATIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/getnotifications/type/{type}/id/{id}",pathParams:oe.common232,request:{additionalProperties:!1,properties:{indexMin:oe.common111},type:"object"}},{auth:"bearer",constant:"GET_NOTIFICATIONS_COUNT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/getnotifications/type/{type}/id/{id}",pathParams:oe.common232,request:{additionalProperties:!1,properties:{refreshTimestamp:oe.common231},type:"object"}},{auth:"bearer",constant:"NOTIFICATION_UPDATE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/update",request:{additionalProperties:!1,properties:{action:{enum:["seen","read"],type:"string"},all:oe.common87},required:["action","all"],type:"object"}},{auth:"bearer",constant:"REMOVE_ALL_NOTIFICATIONS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/removeall"},{auth:"bearer",constant:"MARK_NOTIFICATION_AS_READ",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/notification/marknotificationasread",request:oe.common127},{auth:"none",constant:"ACTIVITYPUB_SEARCH",contentType:"application/x-www-form-urlencoded",method:"GET",params:[oe.common20],path:"/api/activitypub/search?address={address}",pathParams:{additionalProperties:!1,properties:{address:oe.common1},required:["address"],type:"object"}},{auth:"bearer",constant:"ACTIVITYPUB_LINK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/activitypub/link",request:{additionalProperties:!1,properties:{action:{enum:["undo_follow","accept_invitation","reject_invitation","undo_accept","undo_request_follow","follow","remove_follow","accept_follower","reject_follower","remove_follower","remove_invitation"],type:"string"},actor:{additionalProperties:!1,properties:{id:oe.common1,name:oe.common1,type:{enum:["person"],type:"string"}},required:["id","type","name"],type:"object"},payload:oe.common4},required:["action","payload","actor"],type:"object"}},{auth:"none",constant:"ACTIVITYPUB_GET_COMMUNITY",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/api/activitypub/getcommunity/userId/${userId}/type/${type}/actor/person",pathParams:{additionalProperties:!1,properties:{type:{enum:["follows","followers"],type:"string"},userId:oe.common11},required:["userId","type"],type:"object"}},{auth:"none",constant:"GET_BADGE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/app/page/type/badges/id/{id}/json/true",pathParams:oe.common127},{auth:"none",constant:"GET_EMETTEUR_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/app/badge/json/true"},{auth:"bearer",constant:"ADD_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!1,properties:{collection:oe.common235,criteria:{additionalProperties:!1,properties:{narrative:oe.common1},required:["narrative"],type:"object"},description:oe.common1,id:oe.common11,isParcours:oe.common128,issuer:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:oe.common1,type:{enum:["citoyens","organizations","projects"],type:"string"}},required:["type"],type:"object"}},type:"object"},key:oe.common236,name:oe.common1,parent:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{additionalProperties:!1,properties:{name:oe.common1,type:oe.common235},required:["type"],type:"object"}},type:"object"},preferences:oe.common221,public:oe.common110,scope:oe.common142,tags:oe.common33},required:["id","collection","key","name","public","scope","issuer","criteria"],type:"object"}},{auth:"bearer",constant:"ASSIGN_BADGES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/badges/assign",request:{additionalProperties:!1,properties:{award:{patternProperties:{"^[0-9a-f]{24}$":oe.common58},type:"object"},badgeId:oe.common11,collection:oe.common235,evidences:{items:{additionalProperties:!1,properties:{narative:oe.common1,url:oe.common4},required:["narative"],type:"object"},type:"array"},key:oe.common236,narative:oe.common1,scope:oe.common142},required:["key","collection","badgeId","award"],type:"object"}},{auth:"none",constant:"GET_EVENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/agenda",request:{additionalProperties:!0,properties:{count:oe.common128,countType:{const:["events"],default:["events"],type:"array"},endDateUTC:oe.common230,fediverse:oe.common128,filters:{additionalProperties:!1,default:{$or:{"links.attendees.@userId":oe.common159,"organizer.@userId":oe.common159},"links.attendees.@userId":oe.common159},patternProperties:{"^links\\.attendees\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.attendees\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^organizer\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160},type:"object"}},required:["$or"],type:"object"},indexMin:oe.common111,indexStep:{default:100,type:"integer"},locality:{patternProperties:{"^[^\\s]+$":{type:"object"}},type:"object"},name:oe.common1,recurrency:oe.common110,searchType:{const:["events"],default:["events"],items:{enum:["events"],type:"string"},type:"array"},startDateUTC:oe.common230,type:oe.common65},required:["searchType","indexMin","indexStep","fediverse"],type:"object"}},{auth:"bearer",constant:"SHARE_EVENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:oe.common129,if:oe.common131,properties:{childId:oe.common11,childType:oe.common70,comment:oe.common1,connectType:oe.common133,parentId:oe.common11,parentType:oe.common229},required:["parentId","childId","childType","connectType","parentType"],then:oe.common134,type:"object"}},{auth:"bearer",constant:"INVITE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:oe.common104,if:oe.common106,properties:{listInvite:{additionalProperties:!1,minProperties:1,properties:{citoyens:oe.common237,invites:{patternProperties:{"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$":{additionalProperties:!1,properties:{email:oe.common2,isAdmin:oe.common241,msg:oe.common1,name:oe.common1,roles:oe.common33},required:["name","email"],type:"object"}},type:"object"},organizations:oe.common237,projects:oe.common237},type:"object"},parentId:oe.common1,parentType:oe.common70},required:["parentId","parentType","listInvite"],then:oe.common108,type:"object"}},{auth:"bearer",constant:"FOLLOW",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/follow",request:{additionalProperties:!1,properties:{childId:oe.common211,childType:oe.common212,parentId:oe.common11,parentType:oe.common213},required:["childId","childType","parentType","parentId"],type:"object"}},{auth:"none",constant:"GET_COSTUM_JSON",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/cms/getcostumjson?slug={slug}",pathParams:{slug:oe.common1}},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE_COSTUM",contentType:"application/x-www-form-urlencoded",functionCocostum:"globalautocomplete",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,count:oe.common87,countType:oe.common243,fediverse:oe.common128,fields:oe.common33,filters:oe.common245,indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:oe.common1,type:{enum:["cities","level1","level2","level3","level4","level5"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},mapUsed:oe.common199,name:oe.common1,notSourceKey:oe.common199,options:oe.common247,ranges:oe.common150,searchBy:oe.common154,searchTags:oe.common33,searchType:oe.common243,sortBy:oe.common251,sourceKey:oe.common33},required:["searchType","countType","indexMin","indexStep","initType","count","fediverse","costumSlug","costumEditMode"],type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_ACTORS",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestActors",method:"POST",path:"/costum/coevent/get_events/request/actors/id/{id}/type/{type}",pathParams:oe.common253,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,parent_only:oe.common3,sourceKey:oe.common33,types:{items:{enum:["organizer","links.attendees","creator","links.creator","links.organizer","organizerName","animator"],type:"string"},type:"array"}},type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_SUBEVENTS",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestSubevents",method:"POST",path:"/costum/coevent/get_events/request/subevents/id/{id}/type/{type}",pathParams:oe.common253,request:{additionalProperties:!1,allOf:[{if:{properties:{date:oe.common1},required:["date"]},then:{required:["timezone"]}}],properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,date:{oneOf:[oe.common1,{properties:{between:{properties:{end:oe.common44,start:oe.common44},required:["start","end"],type:"object"}},required:["between"],type:"object"}]},fromToday:oe.common3,regions:oe.common256,sourceKey:oe.common33,tags:oe.common33,timezone:oe.common1,type:oe.common1},type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_ELEMENT_EVENT",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestElementEvent",method:"POST",path:"/costum/coevent/get_events/request/element_event/id/{id}/type/{type}",pathParams:oe.common253,request:oe.common259},{auth:"none",constant:"COSTUM_EVENT_REQUEST_CATEGORIES",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestCategories",method:"POST",path:"/costum/coevent/get_events/request/categories/id/{id}/type/{type}",pathParams:oe.common253,request:oe.common259},{auth:"none",constant:"COSTUM_EVENT_REQUEST_DATES",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestDates",method:"POST",path:"/costum/coevent/get_events/request/dates/id/{id}/type/{type}",pathParams:oe.common253,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,regions:oe.common256,sourceKey:oe.common33,tags:oe.common33,type:oe.common1},type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_EVENT",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestEvent",method:"POST",path:"/costum/coevent/get_events/request/event/id/{id}/type/{type}",pathParams:oe.common253,request:oe.common259},{auth:"none",constant:"COSTUM_EVENT_REQUEST_LINK_TL_TO_EVENT",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestLinkTlToEvent",method:"POST",path:"/costum/coevent/get_events/request/link_tl_to_event/id/{id}/type/{type}",pathParams:oe.common253,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,event:oe.common1,sourceKey:oe.common33,tl:oe.common1},required:["tl","event"],type:"object"}},{auth:"none",constant:"COSTUM_EVENT_REQUEST_LOAD_CONTEXT_TAG",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumEventRequestLoadContextTag",method:"POST",path:"/costum/coevent/get_events/request/load_context_tag/id/{id}/type/{type}",pathParams:oe.common253,request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,event:oe.common11,search:oe.common1,sourceKey:oe.common33},type:"object"}},{auth:"none",constant:"GET_GALLERY",contentType:"application/x-www-form-urlencoded",functionCocostum:"",method:"POST",path:"/co2/gallery/index/type/{type}/id/{id}/docType/{docType}/tpl/json",pathParams:{additionalProperties:!1,else:oe.common71,if:oe.common93,properties:{docType:{default:"image",enum:["image","file","bookmarks"],type:"string"},id:oe.common1,type:oe.common192},required:["id","type","docType"],then:oe.common89,type:"object"},request:{additionalProperties:!1,properties:{contentKey:oe.common1,folderId:oe.common1},type:"object"}},{auth:"none",constant:"GET_ATTENDEES_NO_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common181,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.events\\.(?:[a-f0-9]{24}|@\\w+)$)"}}},{not:{propertyNames:{pattern:"^(?!links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$)"}}}],patternProperties:{"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":oe.common175,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":oe.common177,"^links\\.events\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":oe.common169},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common181},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"bearer",constant:"GET_ATTENDEES_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocompleteadmin/type/events/id/{id}/canSee/true",pathParams:oe.common127,request:{additionalProperties:!1,properties:{count:oe.common87,countType:oe.common181,fediverse:oe.common141,filters:{additionalProperties:!1,allOf:[{not:{propertyNames:{pattern:"^(?!links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}}],default:{"links.events.@{pathParams.id}":oe.common159,"links.events.@{pathParams.id}.isInviting":oe.common168,"links.events.@{pathParams.id}.toBeValidated":oe.common168},patternProperties:{"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":oe.common160,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":oe.common175,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":oe.common177,"^links\\.events\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":oe.common175},type:"object"},indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common142,name:oe.common1,notSourceKey:oe.common87,ranges:oe.common150,searchBy:oe.common154,searchType:oe.common181},required:["searchType","indexMin","initType","count","countType","indexStep","notSourceKey","filters","locality","fediverse"],type:"object"}},{auth:"none",constant:"COFORM_ANSWERS_SEARCH",contentType:"application/x-www-form-urlencoded",functionCocostum:"answerlist",method:"POST",path:"/survey/coform/answerslist",request:{additionalProperties:!1,properties:{contextId:oe.common11,contextType:oe.common242,costumEditMode:oe.common128,costumSlug:oe.common1,count:oe.common87,countType:oe.common261,fediverse:oe.common128,fields:oe.common33,filters:oe.common245,indexMax:oe.common86,indexMin:oe.common143,indexStep:oe.common144,initType:oe.common142,locality:oe.common145,mapUsed:oe.common199,name:oe.common1,notSourceKey:oe.common199,options:oe.common247,ranges:oe.common150,searchBy:oe.common154,searchTags:oe.common33,searchType:oe.common261,sortBy:oe.common251,sourceKey:oe.common33},required:["searchType","countType","indexMin","indexStep","initType","count","fediverse"],type:"object"}},{auth:"none",constant:"COFORM_ANSWERS_BY_ID",contentType:"application/x-www-form-urlencoded",functionCocostum:"findanswered",method:"POST",path:"/survey/coform/findanswered",request:{additionalProperties:!1,properties:{answerId:oe.common1,fields:oe.common33,finderPath:oe.common10,formId:oe.common1},required:["answerId"],type:"object"}},{auth:"none",constant:"GET_COFORM_BY_ID",contentType:"application/x-www-form-urlencoded",functionCocostum:"getformbyid",method:"POST",path:"/survey/coform/getformbyid",request:{additionalProperties:!1,properties:{parentFormId:oe.common11},required:["parentFormId"],type:"object"}},{auth:"bearer",constant:"COFORM_UPLOAD_ANSWER_FILE",contentType:"multipart/form-data",method:"POST",path:"/survey/coform/uploadanswerfile",request:{additionalProperties:!1,properties:{answerId:oe.common11,contentKey:{default:"slider",type:"string"},docType:{default:"image",enum:["image","file"],type:"string"},formId:oe.common11,qqfile:oe.common246,qqfilename:oe.common1,qqtotalfilesize:oe.common86,qquuid:oe.common1,subKey:oe.common1},required:["formId","qquuid","qqfilename","qqtotalfilesize","qqfile"],type:"object"}},{auth:"bearer",constant:"COFORM_GET_ANSWER_FILES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/survey/coform/getanswerfiles",request:{additionalProperties:!1,properties:{answerId:oe.common11,contentKey:{default:"presentation",type:"string"},docType:{default:"file",enum:["image","file"],type:"string"},subKey:oe.common1},required:["answerId","subKey"],type:"object"}},{auth:"bearer",constant:"SAVE_COFORM_ANSWER",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/survey/coform/saveanswer",request:{additionalProperties:!1,properties:{addedOptions:oe.common1,answerId:oe.common11,answers:oe.common1,formId:oe.common11,links:oe.common1},required:["formId","answers"],type:"object"}},{auth:"bearer",constant:"ADD_VOTE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/addaction",request:{additionalProperties:!1,properties:{action:{const:"vote",default:"vote",type:"string"},collection:oe.common263,details:{additionalProperties:!1,properties:{status:oe.common1},required:["status"],type:"object"},id:oe.common11},required:["id","collection","action","details"],type:"object"}},{auth:"bearer",constant:"ADD_REPORT_ABUSE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/action/addaction",request:{additionalProperties:!1,properties:{action:{const:"reportAbuse",default:"reportAbuse",type:"string"},collection:oe.common263,details:{additionalProperties:!1,properties:{comment:oe.common1,reason:oe.common1},required:["reason"],type:"object"},id:oe.common11},required:["id","collection","action","details"],type:"object"}},{auth:"bearer",constant:"UPDATE_PATH_VALUE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue",request:{additionalProperties:!1,allOf:[{if:{required:["pull"]},then:{properties:{value:oe.common1}}}],properties:{arrayForm:oe.common3,collection:{default:"citoyens",enum:["citoyens","organizations","projects","events","poi","answers","forms","actions"],type:"string"},id:oe.common5,path:oe.common1,pull:oe.common1,setType:{anyOf:[oe.common264,{items:{additionalProperties:!1,properties:{path:oe.common1,type:oe.common1},required:["path","type"],type:"object"},type:"array"}]},value:{type:["string","number","boolean","object","array","null"]}},required:["id","collection","path","value"],type:"object"}},{auth:"bearer",constant:"DELETE_DOCUMENT_BY_CONTEXT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/document/delete/dir/co2/contextType/{contextType}/contextId/{contextId}",pathParams:{additionalProperties:!1,properties:{contextId:oe.common5,contextType:oe.common265},required:["contextType","contextId"],type:"object"},request:{additionalProperties:!1,properties:{ids:oe.common11,parentId:oe.common5,parentType:oe.common265,path:{const:"communecter",default:"communecter",type:"string"}},required:["id","collection","path","value"],type:"object"}},{auth:"bearer",constant:"DELETE_DOCUMENT_BY_ID",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/document/deletedocumentbyid/id/{id}",pathParams:oe.common127},{auth:"bearer",constant:"DEMOTE_ADMIN",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/updateadminlink/",request:{additionalProperties:!1,properties:{childId:oe.common11,childType:oe.common182,connect:{enum:["members","contributors"],type:"string"},isAdmin:oe.common141,parentId:oe.common11,parentType:{enum:["organizations","projects"],type:"string"}},required:["parentId","parentType","childId","childType","connect","isAdmin"],type:"object"}},{constant:"COSTUM_FILTER_COFORM",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/costum/francetierslieux/autoglobalthematicntwrk",request:{properties:{costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,searchedData:oe.common246},type:"object"}},{auth:"none",constant:"GET_COUNTRIES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/opendata/getcountries",request:{additionalProperties:!1,properties:{costumEditMode:{oneOf:[{enum:["true","false"],type:"string"},{enum:[0,1],type:"number"},oe.common3]},costumId:oe.common11,costumSlug:oe.common1,costumType:{enum:["organizations","projects","events","citoyens","poi"],type:"string"}},type:"object"}},{constant:"SEARCH_ZONES",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/getzone",request:{properties:{costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,countryCode:oe.common266,level:oe.common266,sortBy:oe.common1,upperLevelId:oe.common1},required:["countryCode","level"],type:"object"}},{auth:"none",constant:"COFORM_ANSWERS_BY_FORMS",contentType:"application/x-www-form-urlencoded",functionCocostum:"findanswers",method:"POST",path:"/costum/francetierslieux/getallanswersbyforms",request:{properties:{forms:{patternProperties:{"^[a-fA-F0-9]{24}$":oe.common1},type:"object"}},type:"object"}},{auth:"none",constant:"GENERATE_ANSWER_FROM_FORM",contentType:"application/x-www-form-urlencoded",functionCocostum:"generateanswerfromform",method:"POST",path:"/survey/answer/newanswer/form/{formId}",pathParams:{additionalProperties:!1,properties:{formId:oe.common11},required:["formId"],type:"object"},request:{properties:{action:oe.common1},type:"object"}},{auth:"none",constant:"FUNDING_ENVELOPE",contentType:"application/x-www-form-urlencoded",functionCocostum:"fundingenvelope",method:"POST",path:"/co2/aap/fundingenvelope",request:{additionalProperties:!0,properties:{action:oe.common1,answer:oe.common11,contextId:{pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},contextType:oe.common1,financerId:oe.common11,financerType:oe.common1,formId:oe.common11,params:oe.common246,project:oe.common11},required:["contextId","contextType"],type:"object"}},{auth:"none",constant:"COREMU_OPERATION",contentType:"application/x-www-form-urlencoded",functionCocostum:"coremuoperation",method:"POST",path:"/co2/aap/coremuoperation/",request:{additionalProperties:!0,properties:{action:{const:"generateproposition",type:"string"},answer:{const:"new",type:"string"},form:oe.common11,project:oe.common11},required:["form","answer","action","project"],type:"object"}},{auth:"bearer",constant:"COSTUM_PROJECT_ACTION_REQUEST_NEW",contentType:"application/x-www-form-urlencoded",functionCocostum:"costumProjectActionRequestNew",method:"POST",path:"/costum/project/action/request/new",request:{additionalProperties:!1,properties:{assign:oe.common11,credits:{default:1,minimum:0,type:"number"},endDate:oe.common230,idParentRoom:oe.common11,importance:{default:"low",type:"string"},is_contributor:oe.common3,max:oe.common155,mentions:oe.common33,milestone:{additionalProperties:!1,properties:{endDate:oe.common230,milestoneId:oe.common11,startDate:oe.common230},required:["milestoneId"],type:"object"},min:oe.common155,name:oe.common1,parentId:oe.common11,parentType:oe.common224,startDate:oe.common230,status:{default:"todo",enum:["todo","done","tracking","discuter","next","totest","disabled","closed"],type:"string"},tags:oe.common33,timeSpent:oe.common155,urls:oe.common32},required:["name","status","parentId","parentType"],type:"object"}},{auth:"bearer",constant:"LINK_DISCOURSE_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"linkDiscourseAccount",method:"POST",path:"/interop/discourse/linkAccount",request:oe.common267},{auth:"bearer",constant:"UNLINK_DISCOURSE_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"unlinkDiscourseAccount",method:"POST",path:"/interop/discourse/unlinkAccount",request:oe.common269},{auth:"none",constant:"DISCOURSE_PROFILE",contentType:"application/x-www-form-urlencoded",functionCocostum:"getDiscourseProfile",method:"POST",path:"/interop/discourse/profile",request:oe.common267},{auth:"bearer",constant:"DISCOURSE_CHECK_EMAIL",contentType:"application/x-www-form-urlencoded",functionCocostum:"checkDiscourseEmailMatch",method:"POST",path:"/interop/discourse/checkEmailMatch",request:oe.common269},{auth:"bearer",constant:"DISCOURSE_DISMISS_LINK",contentType:"application/x-www-form-urlencoded",functionCocostum:"dismissDiscourseLink",method:"POST",path:"/interop/discourse/dismissDiscourseLink",request:oe.common269},{auth:"bearer",constant:"LINK_MEDIAWIKI_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"linkMediaWikiAccount",method:"POST",path:"/interop/mediawiki/linkAccount",request:oe.common267},{auth:"bearer",constant:"UNLINK_MEDIAWIKI_ACCOUNT",contentType:"application/x-www-form-urlencoded",functionCocostum:"unlinkMediaWikiAccount",method:"POST",path:"/interop/mediawiki/unlinkAccount",request:oe.common269},{auth:"none",constant:"GET_MEDIAWIKI_CONTRIBUTIONS",contentType:"application/x-www-form-urlencoded",functionCocostum:"getMediaWikiContributions",method:"POST",path:"/interop/mediawiki/contribs",request:{additionalProperties:!0,properties:{costumId:oe.common1,costumSlug:oe.common1,costumType:oe.common1,limit:oe.common231,username:oe.common1},required:["username","costumSlug","costumId","costumType"],type:"object"}},{auth:"bearer",constant:"ADD_CLASSIFIED",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/save",request:{additionalProperties:!0,properties:{address:{additionalProperties:!1,properties:{"@type":oe.common77,addressCountry:oe.common1,addressLocality:oe.common1,codeInsee:oe.common1,level1:oe.common1,level1Name:oe.common1,level2:oe.common1,level2Name:oe.common1,level3:oe.common78,level3Name:oe.common78,level4:oe.common78,level4Name:oe.common78,localityId:oe.common1,postalCode:oe.common1,streetAddress:oe.common1},required:["@type","addressCountry","codeInsee","addressLocality","localityId","level1","level1Name"],type:"object"},category:{enum:["service","competence","material"],type:"string"},collection:{const:"classifieds",default:"classifieds",type:"string"},description:oe.common1,geo:oe.common79,geoPosition:oe.common83,id:oe.common11,key:{const:"classified",default:"classified",type:"string"},name:oe.common216,parent:oe.common225,preferences:oe.common221,scope:oe.common142,section:{enum:["need","offer"],type:"string"},subtype:oe.common264,tags:oe.common33},required:["id","collection","key","name","section","category","subtype","scope"],type:"object"}}]};function se(e){return e instanceof Error}function ae(e){return se(e)&&"response"in e&&"object"==typeof e.response&&"number"==typeof e.response.status}function ce(e){return se(e)?e.message:"string"==typeof e?e:e&&"object"==typeof e&&"message"in e?String(e.message):"Unknown error"}function pe(e){return function(e){return se(e)&&"status"in e&&"number"==typeof e.status}(e)?e.status:ae(e)?e.response.status:e instanceof error_ApiError?e.status:void 0}var de=_(602),me=_(193);const le=u;L.addType("oid",e=>{if("string"==typeof e)return new ne(e);if(void 0===e)return new ne;throw new Error("Expected string value for ObjectID")});class ApiClient extends d{__entityTag="ApiClient";userId=null;_baseURL;_refreshUrl;_endpoints;_debug;_fromJSONValue;_tokenStorage;_offlineClientManager=null;_ajv;_logger;_client;_breakerThreshold;_breakerResetTime;_breakerErrorCount=0;_breakerOpen=!1;_lastBreakerOpenTime=null;_accessToken=null;_refreshToken=null;_setUserId;constructor({baseURL:e,accessToken:t,refreshToken:r,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:o=ie.endpoints,timeout:i=3e4,debug:s=!1,maxRetries:a=0,circuitBreakerThreshold:c=5,circuitBreakerResetTime:p=6e4,fromJSONValue:d=!0,tokenStorageStrategy:m=null}){if(super(),!e)throw new error_ApiClientError('Le paramètre "baseURL" est obligatoire.',500);this._baseURL=e,this._refreshUrl=n,this._endpoints=o||ie.endpoints,this._debug=s,this._fromJSONValue=d,this._breakerThreshold=c,this._breakerResetTime=p;let u=null;if(Object.defineProperty(this,"userId",{get:()=>u,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{u=e,this._logger?.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new D({strict:!1,useDefaults:!0,allErrors:!0,verbose:!0}),k(this._ajv),this._ajv.addFormat("textarea",!0),this._ajv.addKeyword({keyword:"startBeforeEnd",type:"object",errors:!0,validate:this._startBeforeEndValidate}),this._logger=x({transport:{target:"pino-pretty",options:{colorize:!0}},level:s?"debug":"info"}),this._client=l.create({baseURL:e,timeout:i}),a>0&&(le(this._client,{retries:a,retryDelay:le.exponentialDelay,retryCondition:e=>le.isNetworkError(e)||le.isRetryableError(e),onRetry:(e,t,r)=>{this._logger.warn(`[Retry] Tentative #${e} pour ${r?.url}`),this.emit("retryAttempt",{retryCount:e,url:r?.url})}}),this._logger.info(`[ApiClient] Retry activé : ${a} max`)),m instanceof de.SJ&&m.use(this._baseURL),this._tokenStorage=m||new me.GN,"function"!=typeof this._tokenStorage?.getAccessToken||"function"!=typeof this._tokenStorage?.setAccessToken||"function"!=typeof this._tokenStorage?.getRefreshToken||"function"!=typeof this._tokenStorage?.setRefreshToken||"function"!=typeof this._tokenStorage?.clear)throw new Error("[ApiClient] La stratégie de stockage des tokens n’est pas valide. Elle doit implémenter les méthodes requises.");r&&this.setRefreshToken(r),t&&this.setToken(t);const h=this._tokenStorage.getAccessToken();h&&this.setToken(h);const y=this._tokenStorage.getRefreshToken();y&&this.setRefreshToken(y),this._client.interceptors.response.use(e=>e,async e=>{const t=e.config;if(t._retry)throw this._logger.error("[ApiClient] Requête déjà retentée, échec définitif."),e;if(e.response&&401===e.response.status&&this._refreshToken){t._retry=!0;try{if(this._logger.info("[ApiClient] Tentative de refresh du token..."),await this._refreshAccessToken())return this._logger.info("[ApiClient] Token rafraîchi avec succès."),t.headers=t.headers??{},t.headers.Authorization="Bearer "+this.getToken(),this._logger.info("[ApiClient] Retente la requête originale avec le nouveau token."),this._client.request(t);throw this.resetSession(),new error_ApiClientError("Impossible de rafraîchir le token.",401)}catch(e){this.resetSession();const t={code:pe(e)||401,message:ce(e)};throw new error_ApiClientError("Erreur lors du rafraîchissement du token.",401,t)}}throw e})}setToken(e){this._accessToken=e,this._tokenStorage.setAccessToken(e??""),e?this._client.defaults.headers.common.Authorization="Bearer "+e:delete this._client.defaults.headers.common.Authorization;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){if(this._refreshToken=e,this._tokenStorage.setRefreshToken(e??""),null===this.userId){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=h(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;const e=l.create({baseURL:this._baseURL,timeout:1e4,headers:{"Content-Type":"application/json"}});try{const t=await e.post(this._refreshUrl,{refreshToken:this._refreshToken});return!(!t.data||!t.data.token||(this.setToken(t.data.token),t.data.refreshToken&&this.setRefreshToken(t.data.refreshToken),this.emit("refreshSuccess",t.data),0))}catch(e){return this.emit("refreshFailed",{error:ce(e)}),this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${ce(e)}`),!1}}_checkCircuitBreaker(){if(!this._breakerOpen)return!0;const e=Date.now();return null!=this._lastBreakerOpenTime&&e-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),this.emit("circuitBreakerReset"),!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"),this.emit("circuitBreakerOpen",{timestamp:this._lastBreakerOpenTime}))}_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]&&ApiClient.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]&&ApiClient.stripNullsInPlace(e[t]));return e}_resolveSpecialValuesInPlace(e,t={}){const r={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const r=this._getValueByPath(t,e);return null!=r?r:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,o=e=>"string"!=typeof e?e:e.replace(n,(t,n,o)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=r.pathParams(e);return null!=t?t:`@{${n}}`}{const e=r[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(o){if(o.startsWith("pathParams.")){const e=o.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],i=r.pathParams(t);return null!=i?i+n:`@${o}`}return`@${o}`}{const e=r[o];if("function"==typeof e){const t=e();return null!=t?t:`@${o}`}return`@${o}`}}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[r,n]of Object.entries(e))t[o(r)]=i(n);return t}return"string"==typeof e?o(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 r={};for(const n of Object.keys(e)){const o=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof o&&t.test(o))continue;if(o&&"object"==typeof o){const e=this._cleanSchemaLeftoverAlias(o);Object.keys(e).length>0&&(r[n]=e);continue}}"string"==typeof o&&t.test(o)||(r[n]=this._cleanSchemaLeftoverAlias(o))}}return r}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${ce(e)}`),e}}async callEndpoint(e,t={},r=!0,n=!0){const o=this._endpoints.find(t=>t.constant===e);if(!o)throw new error_ApiClientError(`Endpoint introuvable : ${e}`,404);const{path:i,method:s,contentType:a,auth:c,pathParams:p,request:d,responses:m}=o,l=(s||"GET").toLowerCase(),u=a||"application/json",h={"Content-Type":u};if(this._accessToken)"bearer"===c?h.Authorization=`Bearer ${this._accessToken}`:c&&"none"!==c||h.Authorization||(h.Authorization=`Bearer ${this._accessToken}`);else if("bearer"===c)throw new error_ApiClientError(`Token requis pour l'endpoint sécurisé : ${e}`,401);let y,f=i,g={};if(p){let r=p;"none"===c&&null===this.userId&&(r=this._cleanSchemaLeftoverAlias(p));const n=t.pathParams||{},o=this._ajv.compile(r);if(!o(n)){const t=this._ajvErrorHuman(o.errors??[]);throw this.emit("validationError",{stage:"pathParams",errors:o.errors}),new error_ApiValidationError(`callEndpoint: ${e} - Path parameter validation failed.`,400,t,o.errors)}g=this._resolveSpecialValuesInPlace(n),f=f.replace(/\{(\w+)\}/g,(e,t)=>{const r=g[t];if(void 0!==r)return encodeURIComponent(r);throw new error_ApiClientError(`Path param manquant ou non résolu : {${t}}`,400)})}if(d){let r=d;"none"===c&&null===this.userId&&(r=this._cleanSchemaLeftoverAlias(d));let n={...t};delete n.pathParams,"application/x-www-form-urlencoded"===u&&(n=ApiClient.normalizeDatesForValidation(n),n=ApiClient.normalizeSchemaDateFields(n,r));const o=ApiClient.stripNullsInPlace(n),i=this._ajv.compile(r);if(!i(o)){const t=i.errors?this._ajvErrorHuman(i.errors):[];throw this.emit("validationError",{stage:"request",errors:i.errors}),new error_ApiValidationError(`callEndpoint: ${e} - Request validation failed.`,400,t,i.errors)}t=this._resolveSpecialValuesInPlace(o,g)}if(this._offlineClientManager?.isOffline()){if("function"==typeof this._offlineClientManager._enqueueOfflineAction)return this._logger.warn(`[ApiClient] Mode dégradé : mise en file de ${e}`),await this._offlineClientManager._enqueueOfflineAction({constant:e,data:t,options:{transformResponseData:r,validateResponseSchema:n}}),this._logger.info(`[ApiClient] Requête ${e} mise en file (offline mode)`),this.emit("queuedOffline",{constant:e,reason:"offlineMode",data:t}),{data:null,offline:!0};throw this._logger.warn("[ApiClient] Mode dégradé actif mais offlineManager non initialisé correctement"),new error_ApiClientError("Mode hors-ligne actif, mais gestionnaire offline non disponible.",503)}if(!this._checkCircuitBreaker()){if(!1===this._offlineClientManager?.isOffline?.()&&"function"==typeof this._offlineClientManager._enqueueOfflineAction)return this._logger.warn(`[ApiClient] Circuit breaker actif → mise en file de ${e}`),await this._offlineClientManager._enqueueOfflineAction({constant:e,data:t,options:{transformResponseData:r,validateResponseSchema:n}}),this._logger.info(`[ApiClient] Requête ${e} mise en file (circuit breaker)`),this.emit("queuedOffline",{constant:e,reason:"circuitBreaker",data:t}),{data:null,breaker:!0};throw new error_CircuitBreakerError("Le circuit breaker est activé, impossible d'appeler l'API")}"application/json"===u||"multipart/form-data"===u?y=t:"application/x-www-form-urlencoded"===u&&(y=ApiClient.toURLSearchParams(t)),this._logger.debug(`[ApiClient] callEndpoint: ${e} -> ${f}, method=${l}`);try{const e=await this._client.request({url:f,method:l,headers:h,["get"===l?"params":"data"]:y});if(n){const t=String(e.status),r=m?.[t];if(r){const t=this._ajv.compile(r);if(!t(e.data)){const r=this._ajvErrorHuman(t.errors??[]);throw this.emit("validationError",{stage:"response",errors:t.errors}),new error_ApiValidationError("Response validation failed.",e.status,r,t.errors)}}}return this._resetCircuitBreakerSuccess(),"function"==typeof r?e.data=r(e.data):!0===r&&(e.data=this._transformData(e.data)),Array.isArray(o.postActions)&&o.postActions.forEach(t=>{const r=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(r);break;case"setRefreshToken":this.setRefreshToken(r);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,r),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,r));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){if(this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${ce(t)}`),t instanceof error_ApiValidationError)throw t;{const e=ae(t)?t.response.status:500,r=ae(t)?t.response.data:null;throw new error_ApiClientError(`Erreur lors de l'appel de l'API : ${ce(t)}`,e,r)}}}_ajvErrorHuman(e){try{return new m(e).errors.map(({message:e})=>e)}catch(t){return this._logger.error("[ApiClient] _ajvErrorHuman",t),e.map(({message:e})=>e)}}checkAndThrowApiResponseError(e){if(!("status"in e))return e;const t=e.data;if(!t||"object"!=typeof t)return e;if("boolean"==typeof t.result&&!1===t.result)throw new error_ApiResponseError(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 error_ApiResponseError(t.resultErrors.msg||"Erreur inconnue",e.status,t);return e}resetSession(){this.setToken(null),this.setRefreshToken(null),this._setUserId(null),this._tokenStorage.clear(),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 normalizeDatesForValidation(e){if(null==e)return e;if(e&&"object"==typeof e&&e.__isReactive&&e.__raw)return ApiClient.normalizeDatesForValidation(e.__raw);if(e instanceof Date)return e.toISOString().replace(/\.\d{3}Z$/,"+0000");if(Array.isArray(e))return e.map(e=>ApiClient.normalizeDatesForValidation(e));if("object"==typeof e){const t={};for(const r of Object.keys(e))t[r]=ApiClient.normalizeDatesForValidation(e[r]);return t}return e}static normalizeSchemaDateFields(e,t){if(!e||!t||"object"!=typeof e)return e;const r={...e};let n=t.properties||{};if(t.allOf&&Array.isArray(t.allOf))for(const e of t.allOf)e.properties&&(n={...n,...e.properties}),e.then&&e.then.properties&&(n={...n,...e.then.properties});t.then&&t.then.properties&&(n={...n,...t.then.properties});for(const[e,t]of Object.entries(n)){const n=t;if("date"===n?.format&&r[e]){const t=r[e];"string"==typeof t&&t.includes("T")&&(r[e]=t.split("T")[0])}}return r}static toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,r={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:o=!1,metaTokens:i=!0}=r,s=[];function a(e){return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)}function c(e){return e.endsWith("[]")?e.slice(0,-2):e}function p(e,t,r=!1){return e?e.concat(t).map((e,t)=>(e=c(e),!r&&t?`[${e}]`:e)).join(r?".":""):t}function d(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(r,m=[]){null==r||s.includes(r)||(s.push(r),Object.entries(r).forEach(([r,s])=>{void 0!==s&&function(e,r,s){if(e&&"object"==typeof e){if(r.endsWith("{}"))return r=i?r:r.slice(0,-2),t.append(p(s,r,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(a)||r.endsWith("[]"))return r=c(r),e.forEach((e,i)=>{if(null!=e){const a=o?p(s.concat(r),i,n):`${p(s,r,n)}[]`;t.append(a,d(e))}}),!1}return!!a(e)||(t.append(p(s,r,n),d(e)),!1)}(s,r.trim(),m)&&e(s,m.concat(c(r)))}),s.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.length>0)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,"people"===e?.author?.typeSig&&(e.author.type="citoyens"),"people"===e?.typeSig&&(e.collection="citoyens"),"organizations"===e?.typeSig&&(e.collection="organizations"),this._fromJSONValue?L.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){if(e&&"object"==typeof e&&"number"==typeof e.sec)return{$date:1e3*e.sec};if("number"==typeof e)return{$date:1e3*e};if("string"==typeof e&&""!==e.trim()){const t=new Date(e);if(!isNaN(t.getTime()))return L.toJSONValue(t)}return e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_normalizeNumber(e){if("string"!=typeof e)return e;const t=e.trim();if(""===t)return e;const r=Number(t);return Number.isFinite(r)?r:e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath","imageThumb","imageMediumPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date","issuedOn"];_numberFields=["buildingSurfaceArea","siteSurfaceArea","credits","min","max","timeSpent"];_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(r=>{let n=this._normalizeRecursively(e[r]);this._dateFields.includes(r)&&(n=this._normalizeDate(n)),this._imageFields.includes(r)&&(n=this._normalizeImage(n)),this._numberFields.includes(r)&&(n=this._normalizeNumber(n)),"content"===r&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[r]=n}),this._normalizeId(t)}return e}_startBeforeEndValidate=(e,t)=>{if(!t.startDate||!t.endDate)return!0;const r=new Date(t.startDate)<new Date(t.endDate);return r||(this._startBeforeEndValidate.errors=[{instancePath:"/startDate",schemaPath:"#/startBeforeEnd",keyword:"startBeforeEnd",params:{},message:"startDate must be before endDate"}]),r};getRequestSchema(e){const t=this._endpoints.find(t=>t.constant===e);return t?.request||null}getPathSchema(e){return this._endpoints.find(t=>t.constant===e)?.pathParams||null}onEvent(e={}){const t=["retryAttempt","queuedOffline","circuitBreakerOpen","circuitBreakerReset","refreshSuccess","refreshFailed","sessionReset","validationError","offlineModeChanged","userLoggedIn"];for(const r of t)"function"==typeof e[r]&&this.on(r,e[r])}getDeclaredEvents(){const e=new Set;for(const t of this._endpoints)if(Array.isArray(t.postActions))for(const r of t.postActions)"emitEvent"===r.type&&r.event&&e.add(r.event);return Array.from(e)}}function ue(e){return e&&"object"==typeof e&&"status"in e&&"data"in e}class UserApi{client;loggedUser=null;constructor(e){this.client=e instanceof ApiClient?e:new ApiClient(e)}get isConnected(){return this.client.isConnected}get userId(){return this.client.userId}async login(e,t){return this.client.safeCall(async()=>{const r=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new User(this.client,r.data.user,{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action}),this.loggedUser})}async meIsconnected(){if(!this.client.isConnected||!this.client.userId)throw new error_ApiError("User not connected",401);return this.client._logger.debug("UserApi","meIsconnected",this.client.userId),this.loggedUser=new User(this.client,{id:this.client.userId},{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action}),this.loggedUser}async register({name:e,username:t,email:r,pwd:n}){return this.client.safeCall(async()=>{const o=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:r,pwd:n});if(!ue(o))throw new error_ApiError("Requête mise en file (offline/circuit breaker)",503,o);if(!1===o?.data?.result)throw new error_ApiResponseError(o.data.msg,o.status,o.data);return o.data})}async recoverPassword(e){return this.client.safeCall(async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!ue(t))throw new error_ApiError("Requête mise en file (offline/circuit breaker)",503,t);if(!1===t?.data?.result)throw new error_ApiResponseError(t.data.msg,t.status,t.data);return t.data})}}v("User",User),v("Organization",Organization),v("Project",Project),v("Event",Event),v("Poi",Poi),v("Badge",Badge),v("EndpointApi",te),v("News",News),v("Comment",Comment),v("Answer",Answer),v("Form",Form),v("Classified",Classified),v("Action",Action);class Api{_loggedUser;_client;static async userLogin(e,t,r){const n=Api.userApi(r);return await Api.userApiLogin(n,e,t)}static userApi(e){try{return new UserApi(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,r){try{if(!e)throw new error_ApiError("userApi is not defined",500);if(!e.client)throw new error_ApiError("userApi.client is not defined",500);if(e.client.isConnected){const t=await e.meIsconnected();return new Api(t,e.client)}{if(!t||!r)throw new error_ApiError("email and password are required",400);const n=await e.login(t,r);return new Api(n,e.client)}}catch(e){if(e instanceof error_ApiClientError&&e?.details?.error)throw new error_ApiAuthenticationError(e.details.error,e.status,e.details);throw e}}constructor(e,t){this._loggedUser=e,this._client=t}async me(){if(!this._loggedUser)throw new error_ApiAuthenticationError("Accès refusé : utilisateur non authentifié.",401);return await this._loggedUser.get(),this._loggedUser}async user(e){try{if(e.id||e.slug){const t=new User(this._client,e,{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action});return await t.get(),t}return new User(this._client,e,{EndpointApi:te,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action})}catch(e){throw console.error("[Api.user] Erreur lors de la création d'un objet utilisateur public :",e.message),e}}async organization(e){try{const t=new Organization(this._client,e,{EndpointApi:te,User,Project,Event,Poi,Badge,News,Comment,Answer,Classified,Action});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Organization.");return await t.get(),t}catch(e){throw console.error("[Api.organization] Erreur lors de la création d'un objet organisation :",e.message),e}}async project(e){try{const t=new Project(this._client,e,{EndpointApi:te,User,Organization,Event,Poi,Badge,News,Comment,Answer,Classified,Action});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Project.");return await t.get(),t}catch(e){throw console.error("[Api.project] Erreur lors de la création d'un objet projet :",e.message),e}}async event(e){try{const t=new Event(this._client,e,{EndpointApi:te,User,Organization,Project,Poi,Badge,News,Comment});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Event.");return await t.get(),t}catch(e){throw console.error("[Api.event] Erreur lors de la création d'un objet événement :",e.message),e}}async poi(e){try{const t=new Poi(this._client,e,{EndpointApi:te,User,Organization,Project,Poi,Badge,News,Comment});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Poi.");return await t.get(),t}catch(e){throw console.error("[Api.poi] Erreur lors de la création d'un objet poi :",e.message),e}}async answer(e){try{const t=new Answer(this._client,e,{EndpointApi:te,User,Organization,Project,Event,Poi,Badge,News,Comment});if(!e.id)throw new Error("Vous devez fournir un id pour créer une instance Answer.");return await t.get(),t}catch(e){throw console.error("[Api.answer] Erreur lors de la création d'un objet Answer :",e.message),e}}async form(e){try{const t=new Form(this._client,e,{EndpointApi:te,User,Organization,Project});if(!e.id)throw new Error("Vous devez fournir un id pour créer une instance Form.");return await t.get(),t}catch(e){throw console.error("[Api.form] Erreur lors de la création d'un objet Form :",e.message),e}}async classified(e){try{const t=new Classified(this._client,e,{EndpointApi:te,User,Organization,Project,Event,Poi,Badge,News,Comment,Answer,Form,Classified});if(!e.id&&!e.slug)throw new Error("Vous devez fournir un id ou un slug pour créer une instance Classified.");return await t.get(),t}catch(e){throw console.error("[Api.classified] Erreur lors de la création d'un objet Classified :",e.message),e}}async entitySlug(e){if(!e)throw new error_ApiError("slug requis",400);try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t.contextId&&t.contextType){const r=function(e,t=null,r={}){const n={citoyens:{entityTag:"User",meta:e=>S(e,{remove:[]})},organizations:{entityTag:"Organization",meta:e=>S(e,{remove:[]})},projects:{entityTag:"Project",meta:e=>S(e,{remove:[]})},events:{entityTag:"Event",meta:e=>S(e,{remove:["Badge"]})},poi:{entityTag:"Poi",meta:e=>S(e,{remove:["Badge","News","Comments"]})},news:{entityTag:"News",meta:e=>S(e,{remove:[]})},badges:{entityTag:"Badge",meta:()=>function(e){const t=b.get(e),r={EndpointApi:b.get("EndpointApi"),User:b.get("User"),Organization:b.get("Organization"),Project:b.get("Project")};return r[e]=t,{entityClass:t,deps:r}}("Badge")},comments:{entityTag:"Comment",meta:e=>S(e,{remove:[]})},answers:{entityTag:"Answer",meta:e=>S(e,{remove:[]})},forms:{entityTag:"Form",meta:e=>S(e,{remove:[]})},classifieds:{entityTag:"Classified",meta:e=>S(e,{remove:["Badge","News"]})},actions:{entityTag:"Action",meta:e=>S(e,{remove:[]})}}[e];if(!n)return console.warn(`Collection inconnue : '${e}'`),null;const{entityTag:o,meta:i}=n,{entityClass:s,deps:a}=i(o);if(!s)throw new Error(`EntityClass introuvable pour ${o}`);return new s(t,r,a)}(t.contextType,this._client,{id:t.contextId});if(!r)throw new error_ApiResponseError(`Le type d'entité pour le slug ${e} n'est pas reconnu`,200,t);return await r.get(),r}throw new error_ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof error_ApiResponseError?new error_ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${e}`,t.status,t.responseData):t}}get client(){return this._client}get endpointApi(){return new te(this._client)}logout(){this._loggedUser=null,this._client.resetSession(),this._client._logger.info("UserApi: User logged out")}}var he=_(285);class OfflineClientManager{_clients;_client;_offlineMode;_pingInterval;_offlineQueueStorage;_offlineQueue;_monitoringStarted;constructor(e){if(!(e&&e instanceof ApiClient))throw new Error("[OfflineClientManager] apiClient doit être une instance de ApiClient");this._clients=new Map,this._client=e,this._offlineMode=void 0,this._pingInterval=void 0,this._offlineQueueStorage=void 0,this._offlineQueue=[],this._monitoringStarted=void 0}static async attachTo(e,t={}){e._offlineClientManager=new OfflineClientManager(e);const r=await async function(e="auto"){if("memory"===e)return new he.QM;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new he.Rc;throw new Error("localStorage is not available in this environment.")}if("file"===e){if("undefined"!=typeof window&&window.localStorage)throw new Error("file storage is not available in this environment.");const{FileOfflineStorage:e}=await _.e(588).then(_.bind(_,588));return new e}if("auto"===e){if("undefined"!=typeof window&&window.localStorage)return new he.Rc;{const{FileOfflineStorage:e}=await _.e(588).then(_.bind(_,588));return new e}}throw new Error(`Unsupported offline storage strategy: ${e}`)}(t?.offlineStorageStrategy||"auto");await e._offlineClientManager._initOfflineQueue(r),t?.disableOfflineMonitoring||e._offlineClientManager.startOfflineMonitoring(t)}async getClient(e){const t=`${e.baseURL}|${e.accessToken}`;if(this._clients.has(t))return this._clients.get(t);const r=new ApiClient({baseURL:e.baseURL,accessToken:e.accessToken,refreshToken:e.refreshToken,debug:this._client._debug});return this._clients.set(t,r),r}async replayAction(e){const t=await this.getClient(e.meta);try{const r=await t.callEndpoint(e.constant,e.data,e.options?.transformResponseData??!0,e.options?.validateResponseSchema??!0);return this._client._logger.info(`[OfflineReplay] Succès ${e.constant} sur ${e.meta.baseURL}`),r}catch(t){throw this._client._logger.error(`[OfflineReplay] Échec ${e.constant}`,t.message),t}}startOfflineMonitoring({interval:e=3e4,disableOfflineMonitoring:t=!1}={}){t||this._monitoringStarted||(this._monitoringStarted=!0,this._offlineMode="undefined"!=typeof window&&"undefined"!=typeof navigator&&!navigator.onLine,"undefined"!=typeof window&&(window.addEventListener("online",()=>this.setOfflineMode(!1)),window.addEventListener("offline",()=>this.setOfflineMode(!0))),this._pingInterval=setInterval(async()=>{const e=this._offlineMode;try{await this._client._client.head("/api/cocolight/infoserver",{timeout:5e3}),e&&this.setOfflineMode(!1)}catch{this._client._logger.error("[OfflineMonitor] ping() échoué → passage en offline"),this.setOfflineMode(!0)}},e))}setOfflineMode(e){this._offlineMode!==e&&(this._offlineMode=e,"function"==typeof this._client.emit&&this._client.emit("offlineModeChanged",e),this._client._logger.info(`[ApiClient] Mode offline : ${e} (set depuis monitoring)`),e||"function"!=typeof this._replayOfflineQueue||this._replayOfflineQueue())}isOffline(){return!!this._offlineMode}async _enqueueOfflineAction({constant:e,data:t,options:r={}}){if(!this._offlineQueueStorage)throw new Error("[OfflineClientManager] _offlineQueueStorage non initialisé");const n=this._client.getToken()||this._client.getRefreshToken(),o=this._client._endpoints.find(t=>t.constant===e);if("required"===(o?.authPolicy||("none"===o?.auth?"none":"required"))&&!n)return void this._client._logger.warn(`[Offline] Action ignorée : token requis mais absent (${e})`);const i={constant:e,data:t,options:r,meta:{baseURL:this._client._baseURL,accessToken:this._client.getToken(),refreshToken:this._client.getRefreshToken(),timestamp:Date.now()}};this._offlineQueue.push(i),await this._offlineQueueStorage.saveQueue(this._offlineQueue),this._client._logger.info(`[Offline] Action mise en file : ${e}`)}async _replayOfflineQueue(){if(!this._offlineQueueStorage)throw new Error("[OfflineClientManager] _offlineQueueStorage non initialisé");const e=[...this._offlineQueue];this._offlineQueue=[],await this._offlineQueueStorage.saveQueue([]);for(const t of e){const e=this._client._endpoints.find(e=>e.constant===t.constant),r=e?.authPolicy||("none"===e?.auth?"none":"required"),n=t.meta.accessToken||t.meta.refreshToken;if("required"!==r||n)try{await this.replayAction(t)}catch(e){this._client._logger.error("[Offline] Relecture échouée :",e.message),this._offlineQueue.push(t)}else this._client._logger.warn(`[Offline] Rejetée : token requis manquant (${t.constant})`)}await this._offlineQueueStorage.saveQueue(this._offlineQueue)}async _initOfflineQueue(e){if(!(e&&e instanceof he.LD))throw new Error("[OfflineClientManager] storageStrategy doit être une instance de OfflineQueueStorageStrategy");this._offlineQueueStorage=e,this._offlineQueue=await e.loadQueue()}}const ye=OfflineClientManager,fe=["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],ge=["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],we=["workshop","competition","concert","contest","conference","debate","exhibition","festival","crowdfunding","fair","course","protest","market","film","getTogether","meeting","spectacle","internship","stand","others"],_e=["link","tool","machine","software","rh","Resource material","Financial Ressource","ficheBlanche","geoJson","compostPickup","video","sharedLibrary","recoveryCenter","trash","history","something2See","funPlace","place","artPiece","streetArts","openScene","stand","parking","other"],Ee=["need","offer"],Te=["service","competence","material"],Ae={service:{key:"service",icon:"cogs",label:"Service",subcat:{charity:{key:"charity",label:"Charité",icon:"heart"},education:{key:"education",label:"Aide éducative",icon:"book"},househelp:{key:"househelp",label:"Aide ménagère",icon:"home"},washing:{key:"washing",label:"Lavage",icon:"droplets"},gardening:{key:"gardening",label:"Jardinage",icon:"flower"},farming:{key:"farming",label:"Agriculture",icon:"wheat"},generalmaintenance:{key:"generalmaintenance",label:"Maintenance générale",icon:"wrench"},childrencare:{key:"childrencare",label:"Garde d'enfants",icon:"baby"},ederlycare:{key:"ederlycare",label:"Aide aux personnes âgées",icon:"user"},disabledcare:{key:"disabledcare",label:"Aide aux personnes en situation de handicap",icon:"accessibility"},hostinghelp:{key:"hostinghelp",label:"Aide à l'accueil",icon:"handshake"},animalcare:{key:"animalcare",label:"Soins aux animaux",icon:"paw-print"}}},competence:{key:"competence",icon:"bookmark",label:"Compétence",subcat:{artistic:{key:"artistic",label:"Artistique",icon:"palette"},laws:{key:"laws",label:"Droit",icon:"scale"},itdevlopment:{key:"itdevlopment",label:"Développement informatique",icon:"code"},handcraft:{key:"handcraft",label:"Artisanat",icon:"scissors"},animalcare:{key:"animalcare",label:"Soins aux animaux",icon:"paw-print"},agriculture:{key:"agriculture",label:"Agriculture",icon:"wheat"},restauration:{key:"restauration",label:"Restauration",icon:"utensils"},building:{key:"building",label:"Construction",icon:"hard-hat"}}},material:{key:"material",icon:"wrench",label:"Matériel",subcat:{electronic:{key:"electronic",label:"Électronique",icon:"cpu"},furniture:{key:"furniture",label:"Mobilier",icon:"armchair"},primaryressources:{key:"primaryressources",label:"Ressources primaires",icon:"leaf"},buildingtools:{key:"buildingtools",label:"Outils de construction",icon:"hammer"},gardeningtools:{key:"gardeningtools",label:"Outils de jardinage",icon:"shovel"},medicalstuff:{key:"medicalstuff",label:"Matériel médical",icon:"stethoscope"}}}},be=["todo","done","tracking","discuter","next","totest","disabled","closed"],ve={ApiClient,Api,error:T,reactive:A,effect:B,batch:z,isSignal:F,reactiveObject:G,isReactive:K,computed:Z,watch:W,getSignals:J,subscribeTo:H,tokenStorageStrategy:{createDefaultTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new me.GN;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new me.Ge;throw new Error("localStorage is not available in this environment.")}if("file"===e){if("undefined"!=typeof window&&window.localStorage)throw new Error("file storage is not available in this environment.");const{FileStorageStrategy:e}=await _.e(839).then(_.bind(_,839));return new e}if("undefined"!=typeof window&&window.localStorage)return new me.Ge;const{FileStorageStrategy:t}=await _.e(839).then(_.bind(_,839));return new t},TokenStorageStrategy:me.u3,createDefaultMultiServerTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new de.Ek;if("localStorage"===e){if("undefined"!=typeof window&&void 0!==window.localStorage)return new de.YP;throw new Error("localStorage n'est pas disponible dans cet environnement.")}if("file"===e){if("undefined"!=typeof window&&void 0!==window.localStorage)throw new Error("Le stockage fichier n'est pas disponible côté navigateur.");const{MultiServerFileStorageStrategy:e}=await _.e(593).then(_.bind(_,593));return new e}if("undefined"!=typeof window&&void 0!==window.localStorage)return new de.YP;const{MultiServerFileStorageStrategy:t}=await _.e(593).then(_.bind(_,593));return new t},MultiServerTokenStorageStrategy:de.SJ},helper:{fromEntityJSON:I,restorePaginationFromJSON:BaseEntity.restorePaginationFromJSON},OfflineClientManager:ye};export{be as ACTION_STATUSES,Te as CLASSIFIED_CATEGORIES,Ee as CLASSIFIED_SECTIONS,Ae as CLASSIFIED_SUBCATEGORIES,we as EVENT_TYPES,fe as ORGANIZATION_TYPES,_e as POI_TYPES,ge as PROJECT_AVANCEMENTS,ve as default};
|