@communecter/cocolight-api-client 1.0.47 → 1.0.48

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.
@@ -1 +1 @@
1
- import*as e from"os";import*as t from"fs";import*as o from"path";import*as n from"stream";import*as r from"bson-objectid";import*as i from"ejson";import*as s from"file-type";import*as a from"events";import*as c from"@segment/ajv-human-errors";import*as p from"ajv";import*as m from"ajv-formats";import*as d from"axios";import*as l from"axios-retry";import*as u from"jwt-decode";import*as h from"pino";var y,f,g={72:(e,t,o)=>{o.d(t,{GN:()=>MemoryStorageStrategy,Ge:()=>LocalStorageStrategy,u3:()=>TokenStorageStrategy});class TokenStorageStrategy{getAccessToken(){throw new Error("getAccessToken() doit être implémenté")}setAccessToken(e){throw new Error("setAccessToken() doit être implémenté")}getRefreshToken(){throw new Error("getRefreshToken() doit être implémenté")}setRefreshToken(e){throw new Error("setRefreshToken() doit être implémenté")}clear(){throw new Error("clear() doit être implémenté")}}class MemoryStorageStrategy extends TokenStorageStrategy{constructor(){super(),this._accessToken=null,this._refreshToken=null}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{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`))}}},116:(t,o,n)=>{var r,i;t.exports=(r={default:()=>e.default},i={},n.d(i,r),i)},421:(e,o,n)=>{var r,i;e.exports=(r={default:()=>t.default},i={},n.d(i,r),i)},521:(e,t,n)=>{var r,i;e.exports=(r={default:()=>o.default},i={},n.d(i,r),i)},633:(e,t,o)=>{o.d(t,{Ek:()=>MultiServerMemoryStorageStrategy,SJ:()=>MultiServerTokenStorageStrategy,YP:()=>MultiServerLocalStorageStrategy});var n=o(72);class MultiServerTokenStorageStrategy extends n.u3{constructor(){super(),this._currentBaseURL=null}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)")}getServers(){throw new Error("getServers() doit être implémenté")}exportAll(){throw new Error("exportAll() doit être implémenté")}}class MultiServerMemoryStorageStrategy extends MultiServerTokenStorageStrategy{constructor(){super(),this._storage=new Map}getAccessToken(){return this._ensureContext(),this._storage.get(this._currentBaseURL)?.accessToken||null}setAccessToken(e){this._ensureContext();const t=this._storage.get(this._currentBaseURL)||{};this._storage.set(this._currentBaseURL,{...t,accessToken:e})}getRefreshToken(){return this._ensureContext(),this._storage.get(this._currentBaseURL)?.refreshToken||null}setRefreshToken(e){this._ensureContext();const t=this._storage.get(this._currentBaseURL)||{};this._storage.set(this._currentBaseURL,{...t,refreshToken:e})}clear(){this._ensureContext(),this._storage.delete(this._currentBaseURL)}getServers(){return[...this._storage.keys()]}exportAll(){return Object.fromEntries(this._storage.entries())}}class MultiServerLocalStorageStrategy extends MultiServerTokenStorageStrategy{constructor(e="cocolight"){super(),this.prefix=e}_key(e){return`${this.prefix}_tokens_${e}`}_getData(){this._ensureContext();const e=localStorage.getItem(this._key(this._currentBaseURL));return e?JSON.parse(e):{}}_setData(e){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(){localStorage.removeItem(this._key(this._currentBaseURL))}getServers(){return 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 o=localStorage.getItem(this._key(t));o&&(e[t]=JSON.parse(o))}return e}}},702:(e,t,o)=>{var r,i;e.exports=(r={PassThrough:()=>n.PassThrough,Readable:()=>n.Readable},i={},o.d(i,r),i)},942:(e,t,o)=>{o.d(t,{LD:()=>OfflineQueueStorageStrategy,QM:()=>MemoryOfflineStorage,Rc:()=>LocalStorageOfflineStorage});class OfflineQueueStorageStrategy{async loadQueue(){throw new Error("loadQueue() doit être implémenté")}async saveQueue(e){throw new Error("saveQueue(queue) doit être implémenté")}}class MemoryOfflineStorage extends OfflineQueueStorageStrategy{constructor(){super(),this._queue=[]}async loadQueue(){return this._queue}async saveQueue(e){this._queue=[...e]}}class LocalStorageOfflineStorage extends OfflineQueueStorageStrategy{constructor(e="cocolight-api-offline-queue"){super(),this.key=e}async loadQueue(){try{const e=localStorage.getItem(this.key);return e?JSON.parse(e):[]}catch{return[]}}async saveQueue(e){try{localStorage.setItem(this.key,JSON.stringify(e))}catch(e){console.warn("[Offline] Échec du stockage localStorage",e)}}}}},w={};function _(e){var t=w[e];if(void 0!==t)return t.exports;var o=w[e]={exports:{}};return g[e](o,o.exports,_),o.exports}_.m=g,_.d=(e,t)=>{for(var o in t)_.o(t,o)&&!_.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},_.f={},_.e=e=>Promise.all(Object.keys(_.f).reduce(((t,o)=>(_.f[o](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,o,{__webpack_ids__:n,__webpack_modules__:r,__webpack_runtime__:i}=e,s=0;for(t in r)_.o(r,t)&&(_.m[t]=r[t]);for(i&&i(_);s<n.length;s++)o=n[s],_.o(y,o)&&y[o]&&y[o][0](),y[n[s]]=0},_.f.j=(e,t)=>{var o=_.o(y,e)?y[e]:void 0;if(0!==o)if(o)t.push(o[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=>o=y[e]=[t]))]),t.push(o[1]=n)}};var E={};_.r(E),_.d(E,{ApiAuthenticationError:()=>ApiAuthenticationError,ApiClientError:()=>ApiClientError,ApiError:()=>ApiError,ApiResponseError:()=>ApiResponseError,ApiValidationError:()=>ApiValidationError,CircuitBreakerError:()=>CircuitBreakerError});var T={};_.r(T),_.d(T,{batch:()=>M,computed:()=>U,effect:()=>N,getSignals:()=>G,isReactive:()=>B,isSignal:()=>q,reactive:()=>z,subscribeTo:()=>V,watch:()=>F});const b=new Map;function A(e,t){b.set(e,t)}function v(e,t){const o=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")};return n[e]=o,t.remove.forEach((e=>delete n[e])),{entityClass:o,deps:n}}class ApiError extends Error{constructor(e,t,o){super(e),this.name="ApiError",this.status=t,this.details=o}}class ApiClientError extends ApiError{constructor(e,t,o){super(e,t,o),this.name="ApiClientError"}}class ApiValidationError extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiValidationError",this.status=t,this.messages=o,this.details=n}}class CircuitBreakerError extends ApiError{constructor(e){super(e,503),this.name="CircuitBreakerError"}}class ApiResponseError extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiResponseError",this.status=t,this.responseData=o,this.details=n}}class ApiAuthenticationError extends ApiError{constructor(e,t,o){super(e,t,o),this.name="ApiAuthenticationError"}}const P=(O={default:()=>r.default},S={},_.d(S,O),S);var O,S;const I=(e=>{var t={};return _.d(t,e),t})({default:()=>i.default}),j=(e=>{var t={};return _.d(t,e),t})({default:()=>s.default}),C=[],k=new WeakMap,x=new WeakMap;let D=0;const L=new Set;function N(e){const t=()=>{try{C.push(t),e()}finally{C.pop()}};return t(),t}function M(e){D++;try{e()}finally{if(D--,0===D){const e=Array.from(L);L.clear();for(const t of e)t()}}}function $(e){let t=e;const o=new Set;return{get value(){const e=C[C.length-1];return e&&o.add(e),t},set value(e){t!==e&&(t=e,D>0?o.forEach((e=>L.add(e))):o.forEach((e=>e())))},subscribe:e=>(o.add(e),()=>o.delete(e)),__isSignal:!0}}function q(e){return e&&!0===e.__isSignal}function R(e,t=[]){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return function(e,t){return new Proxy(e,{get(e,o){if("string"==typeof o&&!isNaN(o)){const n=e[o];return B(n)?n:z(n,t.concat(o))}return Reflect.get(e,o)},set(e,o,n){const r=z(n,t.concat(o));return e[o]=r,!0}})}(e,t);if(e.__isReactive)return e;const o=new Map,n=new Proxy(e,{get(e,n,r){if("__raw"===n)return e;if("__isReactive"===n)return!0;if(!o.has(n)){const r=$(R(e[n],t.concat(n)));o.set(n,r)}return o.get(n).value},set(e,n,r){const i=R(r,t.concat(n));if(!o.has(n)){const e=$(i);o.set(n,e)}return o.get(n).value=i,e[n]=function(e){return q(e)?e.value:e}(i),!0},deleteProperty:(e,t)=>(o.delete(t),Reflect.deleteProperty(e,t))});return x.set(n,o),n}function z(e){return"object"!=typeof e||null===e||e.__isReactive?e:R(e)}function B(e){return null!==e&&"object"==typeof e&&!0===e.__isReactive}function U(e){if(k.has(e))return k.get(e);const t=$();return N((()=>t.value=e())),k.set(e,t),t}function F(e,t){let o;N((()=>{const n=e();n!==o&&(t(n,o),o=n)}))}function G(e){return B(e)?x.get(e):null}function V(e,t,o){const n=G(e);if(!n||!n.has(t))return()=>{};const r=n.get(t);return r?.subscribe?.((()=>o(r.value)))??(()=>{})}const{fromBuffer:K}=j.default,Z=class BaseEntity{_draftData={};_initialDraftData={};_serverData=null;_calledFromSave=!1;_syncReactiveDraft=!1;static entityTag="BaseEntity";constructor(e,t={},o={},n={}){if(this.__entityTag=n.entityTag||this.getEntityTag(this.constructor.entityTag)||"BaseEntity",this.deps=o,"ApiClient"===this.getEntityTag(e?.__entityTag))this.apiClient=e,this.parent=null,this.userContext=null;else{if(!e?.apiClient)throw new ApiError("Parent invalide ou ApiClient manquant.");this.apiClient=e.apiClient,this.parent=e,"User"===this.getEntityTag(e?.__entityTag)?this.userContext=e:e?.userContext&&(this.userContext=e.userContext)}if("function"==typeof o.EndpointApi)this.endpointApi=new o.EndpointApi(this.apiClient);else{if("object"!=typeof o.EndpointApi)throw new ApiError("deps.EndpointApi doit être une classe ou une instance valide.");this.endpointApi=o.EndpointApi}this._serverData=z({});const{draft:r,proxy:i,initial:s}=this._buildDraftAndProxy({data:{...t,...this.defaultFields},serverData:this._serverData,constant:this.constructor.SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});this._initialDraftData=s,this._draftData=r,this.data=i}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}getEntityType(){return this.constructor.entityType}hasChanges(){return this._serialize(this._toRawDeep(this._draftData))!==this._serialize(this._initialDraftData)}async refresh(){if(!this.id)throw new ApiError("Impossible de rafraîchir sans ID.");return this.get()}async save(){if(!this.isConnected)throw new ApiError("Non connecté.");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,o){const n=new this(t,{},o);return n._setData(e),n}_setData(e,{forceInitialDraftReset:t=!1}={}){this.userContext&&this.userContext!==this&&this.apiClient._logger?.info?.(`[${this.__entityTag}] Mise à jour liée à userContext : ${this.userContext.id}`),B(this._serverData)?Object.assign(this._serverData,e):this._serverData=z({...e});const o=this._draftData?this._toRawDeep(this._draftData):{},n={...e,...this.defaultFields,...o},{draft:r,proxy:i,initial:s}=this._buildDraftAndProxy({data:n,serverData:this._serverData,previousDraft:this._draftData,constant:this.constructor.SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});t?this._initialDraftData=structuredClone(this._toRawDeep(r)):this._initialDraftData||(this._initialDraftData=s),B(this._draftData)?this._updateDraftPreservingUserChanges(r):this._draftData=z(r),this.data||(this.data=i)}_updateDraftPreservingUserChanges(e){for(const t of Object.keys(e)){const o=this._draftData?.[t],n=this._initialDraftData?.[t];void 0!==o&&void 0!==n&&this._serialize(this._toRawDeep(o))!==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(q(e))return this._toRawDeep(e.value);if(Array.isArray(e))return e.map((e=>this._toRawDeep(e)));if("object"==typeof e&&null!==e){const t={};for(const o of Object.keys(e))t[o]=this._toRawDeep(e[o]);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),{__entityTag:this.__entityTag,__isSerializedEntity:!0,serverData:this._serialize(this._serverData),parent:Object.keys(e).length>0?e:null}}_serialize(e){try{return JSON.parse(I.default.stringify(this._removeUnserializables(e)))}catch(e){return this.apiClient?._logger?.error?.("Erreur de sérialisation EJSON",e),null}}_removeUnserializables(e,t=new WeakSet){if(null===e||"object"!=typeof e)return e;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 o={};for(const n of Object.keys(e)){const r=e[n];if("function"!=typeof r&&"symbol"!=typeof r&&void 0!==r)try{o[n]=this._removeUnserializables(r,t)}catch(e){o[n]=null}}return o}static _revive(e){return I.default.fromJSONValue(e)}static fromJSON(e,t,o){const{serverData:n}=e;return this.fromServerData(this._revive(n),t,o)}async call(e,t={}){return this.apiClient.safeCall((async()=>{const o=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(o),o.data}))}async callNoConnected(e,t={}){if(this.isConnected)throw new ApiAuthenticationError("Vous devez ne devez pas être connecté pour faire cette action.");return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new ApiAuthenticationError("Vous devez être connecté pour faire cette action.");return"function"==typeof e?await e():this.call(e,t)}async callIsMe(e,t={}){if(!this.isMe)throw new ApiAuthenticationError("Vous devez être vous-même pour faire cette action.");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:o="any"}){if(!e)throw new ApiValidationError("Le fichier est requis.");const n="undefined"==typeof window&&"undefined"!=typeof process;let r="",i=e;if("undefined"!=typeof File&&e instanceof File){if(r=e.type,!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.")}else if("undefined"!=typeof Blob&&e instanceof Blob){if(r=e.type,!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.");const o=r.split("/")[1]||"bin",n=`${Date.now()}.${o}`;i=new File([e],n,{type:r})}else if(n&&Buffer.isBuffer(e)){const n=await K(e);if(r=n?.mime,!n||!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.");if("image"===o){const t=n.ext,o=`${Date.now()}.${t}`;i=await this._createReadStreamFromBuffer(e,o,r)}}else{if(!n||!e?.readable||"function"!=typeof e._read)throw new ApiValidationError("Type de fichier non reconnu.");{const o=[],n=await this._passThrough(),s=await this._passThrough(),a=4100;let c=0;e.on("data",(e=>{c<a&&(o.push(e),c+=e.length)})),e.pipe(n).pipe(s),await new Promise((e=>setTimeout(e,10)));const p=Buffer.concat(o),m=await K(p);if(r=m?.mime,!m||!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.");s.path=`${Date.now()}.${m.ext}`,s.mimeType=r,i=s}}return i}async _createReadStreamFromBuffer(e,t="file.bin",o="application/octet-stream"){const n=await this._bufferToReadable(e);return n.path=t,n.mimeType=o,n}async _bufferToReadable(e){if("undefined"==typeof window){const{bufferToReadable:t}=await _.e(22).then(_.bind(_,22));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(22).then(_.bind(_,22));return e()}throw new Error("passThrough ne doit pas être appelé dans le navigateur")}_omitProps(e,t){if(!e||"object"!=typeof e)return{};const o={...e};for(const e of t)delete o[e];return o}_pickProps(e,t,o={}){if(!e||"object"!=typeof e)return{};const n={};for(const r of t)if(r in e){const t=e[r];"function"==typeof o[r]?n[r]=o[r](t,e):n[r]=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,o)=>"string"!=typeof t||isNaN(t)?"length"===t?e.filter((e=>!e._isDeleted)).length:"function"==typeof e[t]?(...o)=>e.filter((e=>!e._isDeleted))[t](...o):Reflect.get(e,t,o):e.filter((e=>!e._isDeleted))[t]})}_newId(){return(new P.default).toString()}_createDraftProxy(e,t={},o={},n=[],r={},i={}){return new Proxy({},{get:(e,n)=>{if("string"==typeof n||"symbol"==typeof n){if(n in o){const e=o[n],t=r[n];return"function"==typeof t?t(e):e}if(t&&"object"==typeof t&&n in t){const e=t[n],o=r[n];return"function"==typeof o?o(e):e}}},set:(t,r,s)=>{if(!n.includes(r)){const t=`[DraftProxy] Le champ "${r}" n'est pas autorisé.`;if(i.throwOnError)throw new ApiValidationError(t,400,null,{field:r,value:s,allowedFields:n});return e._logger.warn(t),!1}const a=o[r];return a&&"object"==typeof a&&!0===a.__isSignal?a.value=s:o[r]=s,!0},deleteProperty:(e,t)=>!!n.includes(t)&&(delete o[t],!0),has:(e,n)=>n in o||n in t,ownKeys:()=>[...new Set([...Object.keys(t||{}),...Object.keys(o||{})])],getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}_extractWritableFields(e={},t={},o={defs:{},visited:new Set}){if(!e||"object"!=typeof e)return[];if(e.$id&&o.visited.has(e.$id))return[];e.$id&&o.visited.add(e.$id),o.defs=e.$defs||e.definitions||o.defs;const n=[];if(e.$ref){const r=e.$ref.replace(/^#\/?(\$defs|definitions)\//,""),i=o.defs?.[r];i&&n.push(...this._extractWritableFields(i,t,o))}if(e.allOf&&e.allOf.forEach((e=>n.push(...this._extractWritableFields(e,t,o)))),e.if&&e.then){const r=e.if?.properties;let i=!0;if(r)for(const e in r){const o=r[e]?.const;if(t[e]!==o){i=!1;break}}i&&e.then?n.push(...this._extractWritableFields(e.then,t,o)):!i&&e.else&&n.push(...this._extractWritableFields(e.else,t,o))}return e.properties&&n.push(...Object.entries(e.properties).filter((([e,t])=>!0!==t.readOnly&&void 0===t.const)).map((([e])=>e))),[...new Set(n)]}_buildDraftAndProxy({data:e={},serverData:t=null,previousDraft:o=null,constant:n,apiClient:r,transforms:i={},throwOnError:s=!0,removeFields:a=[]}){const c=Array.isArray(n)?n:[n],p={allOf:[],$defs:{}};for(const e of c){const t=r.getRequestSchema(e);if(!t)throw new ApiError(`Unable to find schema for ${e}.`);if(t.$defs)for(const[o,n]of Object.entries(t.$defs))p.$defs[o]?r._logger.warn(`Duplicate $defs key '${o}' from schema '${e}'`):p.$defs[o]=n;p.allOf.push(t)}let m=this._extractWritableFields(p,e);e.id&&-1===m.indexOf("id")&&m.push("id"),e.slug&&-1===m.indexOf("slug")&&m.push("slug"),m=m.filter((e=>!a.includes(e)));const d=Object.fromEntries(m.map((t=>{const o=e[t];return[t,"function"==typeof i[t]?i[t](o,e):o]})).filter((([e,t])=>void 0!==t))),l=structuredClone?structuredClone(d):JSON.parse(JSON.stringify(d)),u=B(o)?Object.assign(o,d):z(d),h=B(t)?t:t&&"object"==typeof t?z(t):t;return{draft:u,proxy:this._createDraftProxy(r,h,u,m,i,{throwOnError:s}),initial:l}}_extractChangedFieldsFromSchema(e,t,o={},n,r=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,o);const a={},c=n?.()||{};s=s.filter((e=>!r.includes(e)));for(const e of s){if(void 0===o[e])continue;const t=o[e],n=c[e];JSON.stringify(t)!==JSON.stringify(n)&&(a[e]=t)}return Object.keys(a).length>0?a:null}_extractAllValidFieldsFromSchema(e,t,o={},n,r=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,o);const a={},c={},p=n?.()||{};s=s.filter((e=>!r.includes(e)));for(const e of s){if(void 0===o[e])continue;const t=o[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 ApiResponseError(`Le slug ${this.slug} ne correspond pas à un ${e}`,200,t);this._id(t.contextId)}catch(t){throw t instanceof ApiResponseError?t?.responseData?.contextType!==e?t:new ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.responseData):t}return this.id}async _getPublicProfile(){return await this._resolveId(this.getEntityType()),this.endpointApi.getElementsAbout({pathParams:{id:this.id,type:this.getEntityType()}})}_getEntityMeta(e){const t=this.constructor,o=this.__entityTag,n={EndpointApi:this.deps.EndpointApi,User:"User"===o?t:this.deps.User,Organization:"Organization"===o?t:this.deps.Organization,Project:"Project"===o?t:this.deps.Project,Event:"Event"===o?t:this.deps.Event,Poi:"Poi"===o?t:this.deps.Poi,Badge:"Badge"===o?t:this.deps.Badge,News:"News"===o?t:this.deps.News};return{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}}}[e]||null}_linkEntity(e,t){const o=this._getEntityMeta(e);return o?o.entityClass.fromServerData(t,this,o.deps):t}async _linkEntityById(e,t,o={}){const n=this._getEntityMeta(e);if(!n)return null;const r=new n.entityClass(this,{id:t},n.deps);return o?.skipGet||await r.get(),r}_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={},o={}){const n=o.key||e,r="function"==typeof o.mapFn?o.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 o of Object.keys(a)){const n=a[o],p=Object.entries(t).every((([e,t])=>{const o=n[e];if("function"==typeof t)try{return t(o)}catch(t){return console.warn(`Erreur dans le filtre personnalisé pour ${e}`,t),!1}return t instanceof RegExp?"string"==typeof o&&t.test(o):"string"==typeof t&&"string"==typeof o?o.toLowerCase().includes(t.toLowerCase()):i(t)?i(o):s(t)?s(o):"string"!=typeof o||"string"!=typeof t||isNaN(Date.parse(o))||isNaN(Date.parse(t))?o===t:new Date(o).getTime()===new Date(t).getTime()}));if(p)try{const t=await this._linkEntityById(e,o);t&&(t.meta=n,c.push(r?r(t):t))}catch(t){this._logger?.error?.(`Erreur lors de la récupération de l'entité ${e} (${o}) :`,t)}}return c}_entityInstanceData(e,t){const o=this._getEntityMeta(e),n=this.__entityTag,r=this.constructor;return new o.entityClass(this,t,{[n]:r,...o.deps})}async entity(e,t={}){try{const o=this._entityInstanceData(e,t),n={citoyens:["id","slug"],organizations:["id","slug"],projects:["id","slug"],events:["id","slug"],poi:["id","slug"],news:["id"],badges:["id"]}[e];return n&&this._hasAtLeastOne(t,n)&&await o.get(),o}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 ApiError("Le slug est requis.");try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t?.contextId&&t?.contextType)return await this.entity(t.contextType,{id:t.contextId});throw new ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof ApiResponseError?new ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${e}`,t.status,t.responseData):t}}_buildLinkFilters(e,{linkType:t,isAdmin:o,isAdminPending:n,isInviting:r,toBeValidated:i=!1,roles:s=[]}={}){if("string"!=typeof e)throw new TypeError("id doit être une chaîne.");if("string"!=typeof t)throw new TypeError("linkType doit être une chaîne.");if(void 0!==o&&"boolean"!=typeof o)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!==r&&"boolean"!=typeof r)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 r&&(c[`${a}.isInviting`]={$exists:r}),!0===o&&(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 ApiError(`Aucune correspondance de lien définie pour le type d'entité "${e}"`);return t}_checkLinkableEntity(){try{this._getLinkMeta()}catch(e){if(e instanceof ApiError)throw new ApiError(`L'entité "${this.getEntityType()}" ne prend pas en charge les actions de lien.`);throw e}}_getLinkFromConnectedUser(){const{linkType:e}=this._getLinkMeta();return this?.userContext?.serverData?.links?.[e]?.[this.id]||null}async _submitLinkRequest(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.callIsMe((()=>this.endpointApi.connect(t)));return await this.userContext.refresh(),o}if(t.isInviting)return this._acceptLinkRequest();if(t.toBeValidated)throw new ApiError("Vous êtes déjà en attente de validation.");throw new ApiError("Vous êtes déjà connecté à cette entité.")}async _submitLinkRequestAdmin(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const e=this._getLinkFromConnectedUser();if(!e){const e={parentType:this.getEntityType(),parentId:this.id,connectType:"admin"},t=await this.callIsMe((()=>this.endpointApi.connect(e)));return await this.userContext.refresh(),t}if(e.isInviting)return this._acceptLinkRequest();if(e.toBeValidated&&e.isAdminPending)throw new ApiError("Vous êtes déjà en attente de validation pour devenir admin.");if(e.toBeValidated)throw new ApiError("Vous êtes déjà en attente de validation pour rejoindre cette entité.");throw new ApiError("Vous êtes déjà connecté à cette entité.")}async _acceptLinkRequest(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(this._getLinkFromConnectedUser().isInviting){const e={parentType:this.getEntityType(),parentId:this.id,linkOption:"isInviting"},t=await this.callIsMe((()=>this.endpointApi.linkValidate(e)));return await this.userContext.refresh(),t}throw new ApiError("Vous n'avez pas d'invitation à valider.")}async _leaveLinkRequest(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new ApiError("Vous n'êtes pas connecté à cette entité.");const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.callIsMe((()=>this.endpointApi.disconnect(t)));return await this.userContext.refresh(),o}async get(){return this.apiClient.safeCall((async()=>{const e=await this._getPublicProfile();return this._setData(e,{forceInitialDraftReset:!0}),e}))}async updateSettings(e={}){return e.idEntity=this.id,e.typeEntity=this.getEntityType(),this.callIsConnected((()=>this.endpointApi.updateSettings(e)))}async updateDescription(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockDescription(e)))}async updateInfo(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockInfo(e)))}async updateSocial(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockSocial(e)))}async updateLocality(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockLocality(e)))}async updateSlug({slug:e}){try{await this.endpointApi.check({type:this.getEntityType(),id:this.id,slug:e})}catch(e){if(e instanceof ApiResponseError)throw new ApiResponseError("Erreur lors de la vérification du slug.",e.status,e.data);throw e}return this.callIsConnected((()=>this.endpointApi.updateBlockSlug({typeElement:this.getEntityType(),id:this.id,slug:e})))}async updateImageProfil({profil_avatar:e}){e=await this._validateImage(e);const t={pathParams:{folder:this.getEntityType(),ownerId:this.id},profil_avatar:e};return this.callIsConnected((()=>this.endpointApi.profilImage(t)))}async organization(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.");return this.entity("organizations",e)}async project(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un projet.");return this.entity("projects",e)}async poi(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un POI.");return this.entity("poi",e)}async event(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un événement.");return this.entity("events",e)}async badge(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un badge.");return this.entity("badges",e)}async news(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté.");return this.entity("news",e)}async getOrganizations(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,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={}){return e.searchType=this._getDefaultFromEndpoint("GET_PROJECTS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>(this.isMe?e.pathParams={type:this.getEntityType(),id:this.id}:(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 getPois(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_POIS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,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={}){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIBERS","searchType"),this._createPaginatorEngine({initialData:e,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={}){return e.searchType=this._getDefaultFromEndpoint("GET_BADGES","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>(delete e?.pathParams,e.filters=e.filters||{},e.filters.$or={},e.filters.$or[`issuer.${this.id}`]={$exists:!0},this.endpointApi.getBadges(e))}).next()}async getNews(e={}){e.pathParams={type:this.getEntityType(),id:this.id};const t=await this.endpointApi.getNews(e);if(!Array.isArray(t))throw new ApiResponseError("Erreur lors de la récupération des actualités.",500,t);const o=this._linkEntities(t);return this._createFilteredProxy(o)}async requestToJoin(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._submitLinkRequest()}async requestToJoinAdmin(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._submitLinkRequestAdmin()}async acceptInvitation(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._acceptLinkRequest()}async leave(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._leaveLinkRequest()}async follow(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour suivre cette entité.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(!this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id},t=await this.callIsMe((()=>this.endpointApi.follow(e)));return await this.userContext.refresh(),t}throw new ApiError("Vous êtes déjà abonné à cette entité.")}async unfollow(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour vous désabonner.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id,connectType:"followers"},t=await this.callIsMe((()=>this.endpointApi.disconnect(e)));return await this.userContext.refresh(),t}throw new ApiError("Vous n'êtes pas abonné à cette entité.")}_checkAccess(e="effectuer cette action"){if(!this.isMe)throw new ApiError(`Vous devez être connecté pour ${e}`);if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`)}_validateUserLink(e){if(!e)return!1;const{toBeValidated:t,isInviting:o}=e;return!t&&!o}_assertEntityType(...e){const t=Array.isArray(e[0])?e[0]:e;if(!t.includes(this.getEntityType()))throw new ApiError(`L'entité doit être de type : ${t.join(", ")}, reçu : ${this.getEntityType()}`)}_isLinked(e){return!!this.userContext?.serverData?.links?.[e]?.[this.id]}isAuthor(){if(this._checkAccess("vérifier l'auteur"),!this.serverData)throw new ApiError("Aucune donnée serveur disponible.");return this.userId&&this.serverData?.creator===this.userId}isAdmin(){this._checkAccess("vérifier l'administrateur."),this._assertEntityType("organizations","projects","events");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)&&!0===e?.isAdmin&&!e?.isAdminPending}isAuthorOrAdmin(){return this._checkAccess("vérifier l'auteur ou l'administrateur."),this.isAuthor()||this.isAdmin()}isMember(){this._checkAccess("vérifier le membre."),this._assertEntityType("organizations");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isContributor(){this._checkAccess("vérifier le contributeur."),this._assertEntityType("projects");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isAttendee(){this._checkAccess("vérifier si vous êtes un participant."),this._assertEntityType("events");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isFollower(){return this._checkAccess("vérifier si il vous suit."),this._assertEntityType("citoyens","organizations","projects","events","poi"),this._isLinked("followers")}isFollowing(){return this._checkAccess("vérifier si vous le suivez."),this._assertEntityType("citoyens","organizations","projects","events","poi"),this._isLinked("follows")}async getCostumJson(){if(!this.serverData.slug)throw new ApiError("slug de l'entité non défini");const e={pathParams:{slug:this.serverData.slug}};return this.endpointApi.getCostumJson(e)}_generateRanges(e,t,o={}){const n={};for(const r of e){const e=o[r]||{indexMax:0};n[r]={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 o=this.apiClient._endpoints.find((t=>t.constant===e));if(o?.request?.properties?.[t])return o.request.properties[t].default}_createPaginatorEngine({initialData:e,finalizer:t}){const o=this,n={cursor:void 0,count:0,index:0,history:[],sizes:[]},r=e=>e?.indexStep&&e.indexStep>0;async function i(s=!1){let a={...e};n.cursor&&(s||0!==n.history.length)||(n.count=0,n.index=0,n.history=[],n.sizes=[],a.countType=a.searchType,!a?.searchBy&&r(a)?(a.ranges=o._generateRanges(a.searchType,a.indexStep),a.indexMin=a.indexMin??0,a.indexMax=a.indexMax??a.indexStep):"ALL"===a?.searchBy&&r(a)&&(a.indexMin=a.indexMin??0,a.indexMax=a.indexMax??a.indexStep),n.cursor={...a});const c=n.cursor;if(s&&(n.history.push({...c}),!c.searchBy&&r(c)?(c.ranges=o._generateRanges(c.searchType,c.indexStep,c.ranges),c.indexMin=c.indexMax??0,c.indexMax=(c.indexMax??0)+c.indexStep):"ALL"===c.searchBy&&r(c)&&(c.indexMin=c.indexMax??0,c.indexMax=(c.indexMax??0)+c.indexStep),n.cursor={...c}),a={...n.cursor},!(s||a?.searchType&&Array.isArray(a.searchType)&&0!==a.searchType.length))throw new Error("searchType non défini");const p=await t(a);if(!Array.isArray(p.results))throw new Error("Les résultats doivent être un tableau");n.count+=p.results.length,n.sizes.push(p.results.length),s&&n.index++;const m=o._normalizeCount(p.count),d=o._linkEntities(p.results),l=r(a)&&n.count<m.total,u=n.history.length>0;return{count:m,results:d,pageIndex:n.index,pageNumber:n.index+1,hasNext:l,hasPrev:u,next:l?()=>i(!0):void 0,prev:u?async()=>{const e=n.history.pop(),t=n.sizes.pop()??0;return n.count-=t,n.index=Math.max(0,n.index-1),n.cursor={...e},i(!1)}:void 0}}return{next:()=>i(!1)}}_withCostumContext(e){return async t=>{const o={...t,costumSlug:this.serverData.slug,contextId:this.serverData.id,contextType:this.getEntityType(),sourceKey:[...t.sourceKey||[],this.serverData.slug]};return e(o)}}async searchCostum(e={}){return this._createPaginatorEngine({initialData:e,finalizer:this._withCostumContext((e=>this.endpointApi.globalAutocompleteCostum(e)))}).next()}async costumEventRequestActors(e={}){e={pathParams:{id:this.id,type:this.getEntityType()},...e};const t=this._withCostumContext((e=>this.endpointApi.costumEventRequestActors(e)));return await t(e)}async costumEventRequestSubevents(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestSubevents(e)))(e)}async costumEventRequestDates(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestDates(e)))(e)}async costumEventRequestElementEvent(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestElementEvent(e)))(e)}async costumEventRequestCategories(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestCategories(e)))(e)}async costumEventRequestEvent(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestEvent(e)))(e)}async costumEventRequestLinkTlToEvent(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestLinkTlToEvent(e)))(e)}async costumEventRequestLoadContextTag(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestLoadContextTag(e)))(e)}};class Badge extends Z{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=[];transforms={};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Badge.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Badge.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async getOrganizations(){throw new ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(){throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`)}async getEvents(){throw new ApiError(`getEvents n'existe pas dans ${this.constructor.name}`)}async getPois(){throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`)}async getBadgesIssuer(){throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`)}async getNews(){throw new ApiError(`getNews n'existe pas dans ${this.constructor.name}`)}async getSubscribers(){throw new ApiError(`getSubscribers n'existe pas dans ${this.constructor.name}`)}async project(){throw new ApiError(`project n'existe pas dans ${this.constructor.name}`)}async poi(){throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`)}async event(){throw new ApiError(`event n'existe pas dans ${this.constructor.name}`)}async badge(){throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`)}async news(){throw new ApiError(`news n'existe pas dans ${this.constructor.name}`)}}const J=class EndpointApi{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 o=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(o),o.data}))}async callNoConnected(e,t={}){if(this.isConnected)throw new ApiAuthenticationError("Vous ne devez pas être connecté pour faire cette action.");return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new ApiAuthenticationError("Vous devez être connecté pour effectuer cette action.");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 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)}};class Event extends Z{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:e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{type:t?.type??null,name:t?.name??null}]))):null,organizer:e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{type:t?.type??null,name:t?.name??null}]))):null};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Event.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAdmin())throw new ApiError("Vous n'avez pas les droits pour modifier cet événement",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");let t=!1;const o=this._extractAllValidFieldsFromSchema(this.apiClient,"ADD_EVENT",{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);o&&Object.keys(o).length>0&&(await this.addEvent(o),t=!0),e.id&&delete e.id;for(const[o,n]of Event.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addEvent(e={}){return this.isMe||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 ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(){throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`)}async getEvents(){throw new ApiError(`getEvents - les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`)}async getPois(){throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`)}async getBadgesIssuer(){throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async project(){throw new ApiError(`project n'existe pas dans ${this.constructor.name}`)}async poi(){throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`)}async event(){throw new ApiError(`les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`)}async badge(){throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`)}async news(e={}){return super.news(e)}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class News extends Z{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=[];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}:void 0},mediaFile:e=>{const t=e?.files?.map((e=>e.id)).filter(Boolean)||[];return t.length>0?{countFiles:t.length,files:t}:void 0}};async get(){if(!this.id)throw new ApiError("Impossible de rafraîchir sans ID.");const e=await this.callIsConnected((()=>this.endpointApi.getNewsById({ids:[this.id]})));if(e&&Array.isArray(e)&&1===e.length){const t=e[0];return this._setData(t),this.serverData}throw new ApiError(`Aucune actualité trouvée pour l'ID ${this.id}`)}async _add(e){if(!this._calledFromSave)throw new Error("utilisation invalide de _add, utilisez save");""===e.text&&(e.text=" "),e.parentId=this.parent.id,e.parentType=this.parent.getEntityType();for(const[t,o]of News.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.object?.id&&(this._draftData.id=e.object.id)}}}async _update(e){if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");e.id&&delete e.id,""===e?.text&&(e.text=" "),e.parentId=this.parent.id,e.parentType=this.parent.getEntityType(),e.idNews=this.id;let t=!1;const o=await this.callIsConnected((()=>this.endpointApi.updateNews(e)));return o?.object&&(this._serverData={...o.object}),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 ApiError("Vous devez fournir un slug ou un id pour ajouter une mention.");const o=await this.entity("citoyens",{id:t,slug:e}),n=o.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 r={id:n.id,slug:n.slug,type:o.getEntityType(),name:n.name,value:n.name,count:1};return this._draftData.mentions.push(r),this._draftData.mentions}catch(e){throw this.apiClient._logger.error("Erreur lors de l'ajout de la mention :",e),e}}async addImage(e){e=await this._validateImage(e);const t={pathParams:{folder:this.parent.getEntityType(),ownerId:this.parent.id},newsImage:e},o=await this.callIsConnected((()=>this.endpointApi.addImageNews(t)));return this._draftData.mediaImg?(this._draftData.mediaImg.countImages=this._draftData.mediaImg.countImages+1,this._draftData.mediaImg.images.push(o.id)):this._draftData.mediaImg={countImages:1,images:[o.id]},o}async addFile(e){e=await this._validateFile(e);const t={pathParams:{folder:this.parent.getEntityType(),ownerId:this.parent.id},newsFile:e},o=await this.callIsConnected((()=>this.endpointApi.addFileNews(t)));return this._draftData.mediaFile?(this._draftData.mediaFile.countFiles=this._draftData.mediaFile.countFiles+1,this._draftData.mediaFile.files.push(o)):this._draftData.mediaFile={countFiles:1,files:[o]},o}async delete(){if(!this.id)throw new ApiError("Vous devez fournir un id pour supprimer une news.");const e={pathParams:{id:this.id}};await this.callIsConnected((()=>this.endpointApi.deleteNews(e))),this._draftData={},this._serverData=null,this._draftData.id=null,this._isDeleted=!0}}class Organization extends Z{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"];static ADD_BLOCKS=new Map([["ADD_ORGANIZATION","addOrganization"],["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:(e,t)=>t?.socialNetwork?.github,gitlab:(e,t)=>t?.socialNetwork?.gitlab,facebook:(e,t)=>t?.socialNetwork?.facebook,twitter:(e,t)=>t?.socialNetwork?.twitter,instagram:(e,t)=>t?.socialNetwork?.instagram,diaspora:(e,t)=>t?.socialNetwork?.diaspora,mastodon:(e,t)=>t?.socialNetwork?.mastodon,telegram:(e,t)=>t?.socialNetwork?.telegram,signal:(e,t)=>t?.socialNetwork?.signal};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Organization.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAdmin())throw new ApiError("Vous n'avez pas les droits pour modifier cette organisation",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Organization.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addOrganization(e={}){return this.callIsConnected((()=>this.endpointApi.addOrganization(e)))}async getOrganizations(){throw new ApiError("getOrganizations n'existe pas dans Organization")}async getProjects(e={}){return super.getProjects(e)}async getEvents(){throw new ApiError("getEvents pas encore implémenté dans Organization")}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={}){return e.searchType=this._getDefaultFromEndpoint("GET_MEMBERS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>{const{toBeValidated:o,isAdmin:n,isAdminPending:r,isInviting:i,roles:s=[]}=t;return this.isMe?(e.pathParams={type:this.getEntityType(),id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"memberOf",toBeValidated:o,isAdmin:n,isAdminPending:r,isInviting:i,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"memberOf",toBeValidated:!1,isAdmin:n,isInviting:i,roles:s})),(this.isMe?()=>this.callIsMe((()=>this.endpointApi.getMembersAdmin(e))):()=>this.endpointApi.getMembersNoAdmin(e))()}}).next()}async project(e={}){if(!this.isAdmin())throw new 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 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 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 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 requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}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)}}class Poi extends Z{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={};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Poi.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAuthor())throw new ApiError("Vous n'avez pas les droits pour modifier ce POI",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Poi.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addPoi(e={}){return this.isMe||(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 ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(){throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`)}async getEvents(){throw new ApiError(`getEvents n'existe pas dans${this.constructor.name}`)}async getPois(){throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`)}async getBadgesIssuer(){throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async project(){throw new ApiError(`project n'existe pas dans ${this.constructor.name}`)}async poi(){throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`)}async event(){throw new ApiError(`event n'existe pas dans ${this.constructor.name}`)}async badge(){throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`)}async news(e={}){return super.news(e)}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class Project extends Z{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:(e,t)=>t?.socialNetwork?.github,gitlab:(e,t)=>t?.socialNetwork?.gitlab,facebook:(e,t)=>t?.socialNetwork?.facebook,twitter:(e,t)=>t?.socialNetwork?.twitter,instagram:(e,t)=>t?.socialNetwork?.instagram,diaspora:(e,t)=>t?.socialNetwork?.diaspora,mastodon:(e,t)=>t?.socialNetwork?.mastodon,telegram:(e,t)=>t?.socialNetwork?.telegram,signal:(e,t)=>t?.socialNetwork?.signal,parent:e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{type:t?.type??null,name:t?.name??null}]))):null};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Project.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAdmin())throw new ApiError("Vous n'avez pas les droits pour modifier ce projet",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Project.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addProject(e={}){return this.isMe||(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 ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(e={}){return super.getProjects(e)}async getEvents(){throw new ApiError(`getEvents pas encore implémenté dans ${this.constructor.name}`)}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,finalizer:async e=>{const{toBeValidated:o,isAdmin:n,isInviting:r,isAdminPending:i,roles:s=[]}=t;return this.isMe?(e.pathParams={type:this.getEntityType(),id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:o,isAdmin:n,isAdminPending:i,isInviting:r,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:!1,isAdmin:n,isInviting:r,roles:s})),(this.isMe?()=>this.callIsMe((()=>this.endpointApi.getContributorsAdmin(e))):()=>this.endpointApi.getContributorsNoAdmin(e))()}}).next()}async project(e={}){if(!this.isAdmin())throw new 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 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 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 ApiError("Vous n'avez pas les droits pour créer un badge dans ce projet",403);return super.badge(e)}async news(e={}){return super.news(e)}async requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class User extends Z{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:(e,t)=>t?.socialNetwork?.github,gitlab:(e,t)=>t?.socialNetwork?.gitlab,facebook:(e,t)=>t?.socialNetwork?.facebook,twitter:(e,t)=>t?.socialNetwork?.twitter,instagram:(e,t)=>t?.socialNetwork?.instagram,diaspora:(e,t)=>t?.socialNetwork?.diaspora,mastodon:(e,t)=>t?.socialNetwork?.mastodon,telegram:(e,t)=>t?.socialNetwork?.telegram,signal:(e,t)=>t?.socialNetwork?.signal};constructor(e,t={},o={}){if(!o.EndpointApi)throw new ApiError("EndpointApi class must be injected to avoid circular dependency.");if(!t?.id&&!t?.slug)throw new ApiError("Vous devez fournir un id ou un slug pour créer un User.");if(!o.Organization)throw new ApiError("Organization class must be injected.");if(!o.Project)throw new ApiError("Project class must be injected.");if(!o.Event)throw new ApiError("Event class must be injected.");if(!o.Poi)throw new ApiError("Poi class must be injected.");if(!o.Badge)throw new ApiError("Badge class must be injected.");if(!o.News)throw new ApiError("News class must be injected.");super(e,t,o)}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}async get(){return this.apiClient.safeCall((async()=>{if(this.isMe){const e=await this.endpointApi.meInfoUrl();return this._setData(e),e}{const e=await this._getPublicProfile();return this._setData(e),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 ApiError("Vous devez être connecté et être l'utilisateur pour sauvegarder.");await super.save()}async _add(){throw new ApiError("Vous ne pouvez pas ajouter un utilisateur par ce moyen.")}async _update(e){if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of User.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}static fromServerData(e,t,o){const n=new User(t.apiClient,e,o);return("object"==typeof e||Object.keys(e).length>0)&&n._setData(e),n}async updateSettings(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les paramètres.");await super.updateSettings(e),await this.refresh()}async updateDescription(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la description.");return super.updateDescription(e)}async updateInfo(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les informations.");return super.updateInfo(e)}async updateSocial(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les réseaux sociaux.");return super.updateSocial(e)}async updateLocality(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la localité.");return super.updateLocality(e)}async updateSlug({slug:e}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour le slug.");return super.updateSlug({slug:e})}async updateImageProfil({profil_avatar:e}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour l'image de profil.");return super.updateImageProfil({profil_avatar:e})}async getOrganizations(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,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 getPois(e={}){return super.getPois(e)}async getNews(e={}){return super.getNews(e)}async getFriends(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_FRIENDS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>(delete e?.pathParams,this.isMe||(e.pathParams={id:this.id}),this.endpointApi.getFriendsAdmin(e))}).next()}async getSubscriptions(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIPTIONS","searchType"),this._createPaginatorEngine({initialData:e,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 user(e){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur");if(!e.id&&!e.slug)throw new ApiError("Vous devez fournir un id ou un slug pour créer un User.");const t=new User(this,e,this.deps);return await t.get(),t}async organization(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.");return super.organization(e)}async project(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un projet.");return super.project(e)}async news(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer une actualité.");return super.news(e)}async poi(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un POI.");return super.poi(e)}async event(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un événement.");return super.event(e)}async badge(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un badge.");return super.badge(e)}async sendFriendRequest(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour envoyer une demande d'amis.");if(this._checkLinkableEntity(),!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.endpointApi.connect(t);return await this.userContext.refresh(),o}if(t.isInviting&&t.invitorId===this.id)return this.acceptFriendRequest();if(t.isInviting&&t.invitorId===this.userId)throw new ApiError("Vous avez déjà envoyé une demande d'amis à cet utilisateur.");throw new ApiError("Vous êtes déjà connecté à cette entité.")}async acceptFriendRequest(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour accepter une demande d'amitié.");if(this._checkLinkableEntity(),!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const e=this._getLinkFromConnectedUser();if(e?.isInviting&&e.invitorId===this.id){const e={parentType:this.getEntityType(),parentId:this.id,linkOption:"isInviting"},t=await this.endpointApi.linkValidate(e);return await this.userContext.refresh(),t}throw new ApiError("Vous n'avez pas d'invitation à valider.")}async removeFriend(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour supprimer un ami.");if(this._checkLinkableEntity(),!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new ApiError("Vous n'êtes pas connecté à cette entité.");const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.endpointApi.disconnect(t);return await this.userContext.refresh(),o}requestToJoin(){throw new ApiError("l'utilisation de requestToJoin n'est pas autorisée sur un utilisateur.")}requestToJoinAdmin(){throw new ApiError("l'utilisation de requestToJoinAdmin n'est pas autorisée sur un utilisateur.")}acceptInvitation(){throw new ApiError("l'utilisation de acceptInvitation n'est pas autorisée sur un utilisateur.")}leave(){throw new ApiError("l'utilisation de leave n'est pas autorisée sur un utilisateur.")}async follow(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour suivre un utilisateur.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(!this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id},t=await this.endpointApi.follow(e);return await this.userContext.refresh(),t}throw new ApiError("Vous êtes déjà abonné à cet utilisateur.")}async unfollow(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vous désabonner d'un utilisateur.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id,connectType:"followers"},t=await this.endpointApi.disconnect(e);return await this.userContext.refresh(),t}throw new ApiError("Vous n'êtes pas abonné à cet utilisateur.")}isFriend(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vérifier si vous êtes ami.");this._assertEntityType("citoyens");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isFollower(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vérifier si il vous suit.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);return this._assertEntityType("citoyens"),this._isLinked("followers")}isFollowing(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vérifier si vous le suivez.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);return this._assertEntityType("citoyens"),this._isLinked("follows")}}Object.assign(User.prototype,{});const W=(e=>{var t={};return _.d(t,e),t})({EventEmitter:()=>a.EventEmitter}),Q=(e=>{var t={};return _.d(t,e),t})({AggregateAjvError:()=>c.AggregateAjvError}),H=(e=>{var t={};return _.d(t,e),t})({default:()=>p.default}),Y=(e=>{var t={};return _.d(t,e),t})({default:()=>m.default}),X=(e=>{var t={};return _.d(t,e),t})({default:()=>d.default}),ee=(e=>{var t={};return _.d(t,e),t})({default:()=>l.default}),te=(e=>{var t={};return _.d(t,e),t})({jwtDecode:()=>u.jwtDecode}),oe=(e=>{var t={};return _.d(t,e),t})({default:()=>h.default}),ne={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class ObjectID{constructor(e){if(e){if(e=e.toLowerCase(),!ne._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof ne.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new ne.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()}}},re=ne,ie={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:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common31:{items:{type:"string"},type:"array"},common32:{enum:[""],type:"string"},common33:{properties:{name:{not:{type:"null"}}},required:["name"]},common34:{name:{not:{type:"null"}}},common35:{properties:{url:{not:{type:"null"}}},required:["url"]},common36:{url:{not:{type:"null"}}},common37:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common38:{tags:{not:{type:"null"}}},common39:{properties:{email:{not:{type:"null"}}},required:["email"]},common40:{email:{not:{type:"null"}}},common41:{format:"date",type:"string"},common42:{const:"info",default:"info",type:"string"},common43:{$ref:"#/$defs/sharedFields/email"},common44:{$ref:"#/$defs/sharedFields/name"},common45:{$ref:"#/$defs/sharedFields/tags"},common46:{default:"citoyens",enum:["citoyens"],type:"string"},common47:{$ref:"#/$defs/sharedFields/url"},common48:{properties:{avancement:{not:{type:"null"}}},required:["avancement"]},common49:{avancement:{not:{type:"null"}}},common50:{properties:{parent:{not:{type:"null"}}},required:["parent"]},common51:{parent:{not:{type:"null"}}},common52:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},type:"object"},common53:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},common54:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"},common55:{name:{type:"string"},type:{type:"string"}},common56:{properties:{type:{not:{type:"null"}}},required:["type"]},common57:{type:{not:{type:"null"}}},common58:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common59:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},common60:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"},common61:{enum:["workshop","competition","concert","contest","conference","debate","exhibition","festival","crowdfunding","fair","course","protest","market","film","getTogether","meeting","spectacle","internship","stand","others"],type:"string"},common62:{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"},common63:{enum:["poi"],type:"string"},common64:{$ref:"#/$defs/socialField"},common65:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common66:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common67:{id:{pattern:"^[a-f0-9]{24}$"}},common68:{pattern:"^[a-f0-9]{24}$"},common69:{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"},common70:{"@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"}},common71:{const:"PostalAddress",type:"string"},common72:{minLength:0,type:"string"},common73:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},required:["latitude","longitude"],type:"object"},common74:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},common75:{const:"GeoCoordinates",type:"string"},common76:{type:["string","number"]},common77:{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"},common78:{coordinates:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},float:{const:!0,default:!0,type:"boolean"},type:{const:"Point",type:"string"}},common79:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},common80:{type:"number"},common81:{const:!0,default:!0,type:"boolean"},common82:{const:"Point",type:"string"},common83:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common84:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common85:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common86:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common87:{properties:{type:{const:"citoyens"}}},common88:{type:{const:"citoyens"}},common89:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common90:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common91:{properties:{folder:{const:"citoyens"}}},common92:{folder:{const:"citoyens"}},common93:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common94:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common95:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common96:{parentId:{pattern:"^[a-f0-9]{24}$"}},common97:{properties:{parentType:{const:"citoyens"}}},common98:{parentType:{const:"citoyens"}},common99:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common100:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common101:{default:!0,type:"boolean"},common102:{default:0,type:"integer"},common103:{required:["text"]},common104:{required:["mediaImg"]},common105:{required:["mediaFile"]},common106:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common107:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common108:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common109:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common110:{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"},common111:{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"},common112:{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"}},common113:{minimum:1,type:"integer"},common114:{default:"public",enum:["public","private","restricted"],type:"string"},common115:{const:"news",default:"news",type:"string"},common116:{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"},common117:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common118:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common119:{default:!1,type:"boolean"},common120:{properties:{childId:{pattern:"^[a-f0-9]{24}$"}}},common121:{childId:{pattern:"^[a-f0-9]{24}$"}},common122:{properties:{childType:{const:"citoyens"}}},common123:{childType:{const:"citoyens"}},common124:{const:"share",default:"share",type:"string"},common125:{properties:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common126:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common127:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common128:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},common129:{default:"news",enum:["news"],type:"string"},common130:{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"},common131:{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"},common132:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common133:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common134:{const:!1,default:!1,type:"boolean"},common135:{const:"",default:"",type:"string"},common136:{default:0,type:"number"},common137:{default:30,type:"number"},common138:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},common139:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},common140:{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"},common141:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},common142:{enum:["cities","level1"],type:"string"},common143:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},type:"object"},common144:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},common145:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common146:{indexMax:{type:"number"},indexMin:{type:"number"}},common147:{enum:["ALL"],type:"string"},common148:{default:0,minimum:0,type:"integer"},common149:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common150:{enum:["projects"],type:"string"},common151:{$exists:!0},common152:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common153:{$exists:{const:!0}},common154:{const:!0},common155:{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"},common156:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common157:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common158:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common159:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common160:{$exists:!1},common161:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common162:{$exists:{const:!1}},common163:{const:!1},common164:{default:30,type:"integer"},common165:{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"},common166:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common167:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common168:{$exists:{default:!1,type:"boolean"}},common169:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common170:{$in:{items:{type:"string"},minItems:1,type:"array"}},common171:{items:{type:"string"},minItems:1,type:"array"},common172:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common173:{enum:["citoyens"],type:"string"},common174:{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"},common175:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common176:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common177:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common178:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common179:{"^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"}},common180:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common181:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common182:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common183:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common184:{enum:["badges"],type:"string"},common185:{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"},common186:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common187:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common188:{$exists:{const:!0,type:"boolean"}},common189:{const:!0,type:"boolean"},common190:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common191:{$exists:{const:!1,type:"boolean"}},common192:{const:!1,type:"boolean"},common193:{"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"}},common194:{indexMax:30,indexMin:0},common195:{properties:{parentType:{const:"organizations"}}},common196:{parentType:{const:"organizations"}},common197:{properties:{parentType:{const:"projects"}}},common198:{parentType:{const:"projects"}},common199:{properties:{parentType:{const:"events"}}},common200:{parentType:{const:"events"}},common201:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common202:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common203:{enum:["citoyens","organizations","projects","events"],type:"string"},common204:{const:"citoyens",default:"citoyens",type:"string"},common205:{const:"@userId",default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common206:{default:{isOpenData:!0,isOpenEdition:!0},properties:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},required:["isOpenData","isOpenEdition"],type:"object"},common207:{isOpenData:!0,isOpenEdition:!0},common208:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},common209:{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"},common210:{"@userId":{type:"citoyens"}},common211:{type:"citoyens"},common212:{const:"poi",default:"poi",type:"string"},common213:{const:"events",default:"events",type:"string"},common214:{format:"date-time",type:"string"},common215:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},common216:{type:"integer"},common217:{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"},common218:{id:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},type:{const:"citoyens",default:"citoyens",type:"string"}},common219:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},common220:{const:"badges",default:"badges",type:"string"},common221:{const:"badge",default:"badge",type:"string"},common222:{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"},common223:{"^[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"}},common224:{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"},common225:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},common226:{default:"",enum:["","admin"],type:"string"},common227:{enum:["projects","organizations"],type:"string"},common228:{items:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi"],type:"string"},type:"array"},common229:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi"],type:"string"},common230:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},required:["id","type"],type:"object"},common231:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},common232:{default:"events",type:"string"},common233:{items:{properties:{id:{type:"string"}},required:["id"],type:"object"},type:"array"},common234:{properties:{id:{type:"string"}},required:["id"],type:"object"},common235:{id:{type:"string"}},common236:{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"},common237:{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"}}},se=[{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:ie.common1,email:ie.common2,isInvitation:ie.common3,mode:ie.common1,name:ie.common1,pendingUserId:ie.common1,pwd:ie.common1,username:ie.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:ie.common2,password:ie.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:ie.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:ie.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:ie.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:ie.common1,newPassword2:ie.common1,oldPassword:ie.common1,scope:{default:"",type:["string"]},userId:ie.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:ie.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:ie.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:ie.common11}},if:{properties:{typeEntity:ie.common12}},then:{properties:{idEntity:ie.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:ie.common12}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:ie.common12}},then:ie.common13},{if:{properties:{type:ie.common15,typeEntity:ie.common16}},then:ie.common13},{if:{properties:{type:ie.common15,typeEntity:ie.common17}},then:ie.common13},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","public"]},typeEntity:ie.common18}},then:ie.common13}],properties:{idEntity:ie.common1,type:ie.common1,typeEntity:ie.common19,value:ie.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:[ie.common21,{anyOf:[{properties:{description:ie.common27},required:["description"]},{properties:{shortDescription:ie.common27},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:ie.common10,description:ie.common1,id:ie.common1,scope:{default:"",type:["string","null"]},shortDescription:ie.common1,typeElement:ie.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:ie.common2,name:ie.common1,tags:ie.common30,url:ie.common4}},allOf:[{if:ie.common24,then:{additionalProperties:!1,anyOf:[ie.common33,{properties:{birthDate:ie.common27},required:["birthDate"]},{properties:{fixe:ie.common27},required:["fixe"]},{properties:{mobile:ie.common27},required:["mobile"]},ie.common35,ie.common37,ie.common39],properties:{birthDate:ie.common41,block:ie.common42,email:ie.common43,fixe:ie.common1,id:ie.common5,mobile:ie.common1,name:ie.common44,scope:ie.common10,tags:ie.common45,typeElement:ie.common46,url:ie.common47}}},{if:{properties:{typeElement:ie.common17}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common48,ie.common50],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,parent:ie.common52,scope:ie.common10,tags:ie.common45,typeElement:{default:"citoyens",enum:["projects"],type:"string"},url:ie.common47}}},{if:{properties:{typeElement:ie.common18}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common48,ie.common56,{properties:{organizer:ie.common27},required:["organizer"]},ie.common50],properties:{block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,organizer:ie.common58,parent:ie.common52,scope:ie.common10,tags:ie.common45,type:ie.common61,typeElement:{default:"citoyens",enum:["events"],type:"string"},url:ie.common47}}},{if:{properties:{typeElement:ie.common16}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common56],properties:{block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,scope:ie.common10,tags:ie.common45,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:{enum:["organizations"],type:"string"},url:ie.common47}}},{if:{properties:{typeElement:{const:"poi"}}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common56,{properties:{urls:ie.common27},required:["urls"]}],properties:{block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,scope:ie.common10,tags:ie.common45,type:ie.common62,typeElement:ie.common63,url:ie.common47,urls:ie.common31}}}],properties:{block:ie.common42,id:ie.common1,scope:ie.common10,typeElement:ie.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:[ie.common32,ie.common4]}},allOf:[ie.common21,{anyOf:[{properties:{gitlab:ie.common27},required:["gitlab"]},{properties:{github:ie.common27},required:["github"]},{properties:{twitter:ie.common27},required:["twitter"]},{properties:{facebook:ie.common27},required:["facebook"]},{properties:{instagram:ie.common27},required:["instagram"]},{properties:{diaspora:ie.common27},required:["diaspora"]},{properties:{mastodon:ie.common27},required:["mastodon"]},{properties:{telegram:ie.common27},required:["telegram"]},{properties:{signal:ie.common27},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:ie.common64,facebook:ie.common64,github:ie.common64,gitlab:ie.common64,id:ie.common1,instagram:ie.common64,mastodon:ie.common64,scope:ie.common10,signal:ie.common64,telegram:ie.common64,twitter:ie.common64,typeElement:ie.common65},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:ie.common66,if:ie.common24,properties:{address:ie.common69,block:{const:"localities",default:"localities",type:"string"},geo:ie.common73,geoPosition:ie.common77,id:ie.common1,scope:ie.common10,typeElement:ie.common29},required:["block","typeElement","id","address"],then:ie.common83,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:ie.common66,if:ie.common24,properties:{block:ie.common42,id:ie.common1,scope:ie.common10,slug:ie.common86,typeElement:ie.common29},required:["block","typeElement","id","slug"],then:ie.common83,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:ie.common66,if:ie.common87,properties:{block:ie.common42,id:ie.common1,slug:ie.common86,type:ie.common19},required:["block","type","id","slug"],then:ie.common83,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:{additionalProperties:!1,else:ie.common89,if:ie.common91,properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},ownerId:ie.common1},required:["folder","ownerId"],then:ie.common93,type:"object"},request:{additionalProperties:!1,properties:{profil_avatar:ie.common20},required:["profil_avatar"],type:"object"}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:{additionalProperties:!1,else:ie.common66,if:ie.common87,properties:{id:ie.common1,type:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi","badges"],type:"string"}},required:["type","id"],then:ie.common83,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:ie.common95,if:ie.common97,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:ie.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:ie.common1,parentType:ie.common65},required:["parentId","parentType","listInvite"],then:ie.common99,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:ie.common66,if:ie.common87,properties:{id:ie.common1,isLive:ie.common101,type:ie.common65},required:["isLive","type","id"],then:ie.common83,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:ie.common102,indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:ie.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:ie.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:[ie.common103,ie.common104,ie.common105],else:ie.common95,if:ie.common97,properties:{json:ie.common81,markdownActive:ie.common101,mediaFile:ie.common106,mediaImg:ie.common108,mentions:ie.common110,parentId:ie.common1,parentType:ie.common65,scope:ie.common114,tags:ie.common30,text:ie.common1,type:ie.common115},required:["scope","markdownActive","parentId","parentType","type","json"],then:ie.common99,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:ie.common116,request:{additionalProperties:!1,properties:{newsImage:ie.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:ie.common116,request:{additionalProperties:!1,properties:{newsFile:ie.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:ie.common118,request:{additionalProperties:!1,properties:{isLive:ie.common119},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:[ie.common103,ie.common104,ie.common105],else:ie.common95,if:ie.common97,properties:{idNews:ie.common11,markdownActive:ie.common101,mediaFile:ie.common106,mediaImg:ie.common108,mentions:ie.common110,parentId:ie.common1,parentType:ie.common65,scope:ie.common114,tags:ie.common30,text:ie.common1,type:ie.common115},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:ie.common99,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:ie.common120,if:ie.common122,properties:{childId:ie.common11,childType:ie.common65,comment:ie.common1,connectType:ie.common124,parentId:ie.common11,parentType:ie.common115},required:["parentId","parentType","childId","childType","connectType"],then:ie.common125,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:ie.common127},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:ie.common10,contextId:ie.common11,contextType:ie.common129,mentions:ie.common130,parentCommentId:ie.common11,path:ie.common10,text:ie.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:ie.common118},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:ie.common11,params:{properties:{mentions:ie.common130,text:ie.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:ie.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:ie.common127},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:ie.common81,countType:{default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:ie.common133,type:"array"},fediverse:ie.common134,filters:ie.common135,indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common138,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchTags:ie.common31,searchType:{items:ie.common133,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"}},{auth:"none",constant:"CITY_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:{minimum:0,type:"integer"},locality:ie.common135,name:ie.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:ie.common119,scopeValue:ie.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:ie.common148,name:ie.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:ie.common81,countType:ie.common149,fediverse:ie.common134,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":ie.common151,"parent.@userId":ie.common151},"links.contributors.@userId":ie.common151},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},type:"object"}},required:["$or"],type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common149},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:ie.common155,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common149,fediverse:ie.common134,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":ie.common151,"parent.@{pathParams.id}":ie.common151},"links.contributors.@{pathParams.id}":ie.common151},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},type:"object"}},required:["$or"],type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common149},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:ie.common81,countType:ie.common157,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"parent.@userId":ie.common151},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common157},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:ie.common155,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common157,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":ie.common151},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common157},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:ie.common81,countType:ie.common158,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"links.members.@userId":ie.common151,"links.members.@userId.isInviting":ie.common160,"links.members.@userId.toBeValidated":ie.common160},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":ie.common161,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common158},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:ie.common66,if:ie.common87,properties:{id:ie.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:ie.common83,type:"object"},request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common158,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":ie.common151,"links.members.@{pathParams.id}.isInviting":ie.common160,"links.members.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common161,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common158},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:ie.common81,countType:ie.common165,fediverse:ie.common134,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+)$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":ie.common167,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":ie.common169,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common118,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common165,fediverse:ie.common134,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}":ie.common151,"links.memberOf.@{pathParams.id}.isInviting":ie.common160,"links.memberOf.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common167,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":ie.common169,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common167},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common6,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common172,fediverse:ie.common134,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}":ie.common151,"links.friends.@{pathParams.id}.isInviting":ie.common160,"links.friends.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common167,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common167},type:"object"},indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,searchType:ie.common172},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:ie.common81,countType:ie.common174,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common176],default:{"links.followers.@userId":ie.common151,"links.followers.@{userId}.isInviting":ie.common160,"links.followers.@{userId}.toBeValidated":ie.common160},patternProperties:ie.common179,type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common174},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:ie.common6,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common174,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common176],default:{"links.followers.@{pathParams.id}":ie.common151,"links.followers.@{pathParams.id}.isInviting":ie.common160,"links.followers.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:ie.common179,type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common174},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:ie.common81,countType:ie.common172,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common180],default:{"links.follows.@userId":ie.common151,"links.follows.@{userId}.isInviting":ie.common160,"links.follows.@{userId}.toBeValidated":ie.common160},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common161,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common172},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:ie.common66,if:ie.common87,then:ie.common83}],properties:{id:ie.common1,type:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"}},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common172,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common180],default:{"links.follows.@{pathParams.id}":ie.common151},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},type:"object"},indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,searchType:ie.common172},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:ie.common81,countType:ie.common165,fediverse:ie.common134,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+)$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":ie.common167,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":ie.common169,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common118,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common165,fediverse:ie.common134,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}":ie.common151,"links.projects.@{pathParams.id}.isInviting":ie.common160,"links.projects.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common167,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":ie.common169,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common167},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common81,countType:ie.common183,fediverse:ie.common134,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},type:"object"},isParcours:ie.common3,"preferences.private":ie.common134},required:["preferences.private"],type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common183},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:ie.common81,countType:ie.common185,fediverse:ie.common134,fields:ie.common183,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common187}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common187,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":ie.common190,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":ie.common190}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:ie.common193},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:ie.common193,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":ie.common189}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":ie.common187}}],type:"object"},indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:{additionalProperties:!1,default:{Cooperative:ie.common194,GovernmentOrganization:ie.common194,Group:ie.common194,LocalBusiness:ie.common194,NGO:ie.common194,citoyens:ie.common194,projects:ie.common194},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":ie.common145},type:"object"},searchType:ie.common185},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:ie.common97,then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:ie.common195,then:{properties:{connectType:{enum:["admin","member"]}}}},{if:ie.common197,then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:ie.common199,then:{properties:{connectType:{default:"attendee",enum:["attendee","connect"]}}}}],properties:{childId:ie.common201,childType:ie.common202,connectType:{enum:["admin","member","contributor","attendee","friend","connect"],type:"string"},parentId:ie.common11,parentType:ie.common203},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:ie.common97,then:{properties:{connectType:{default:"friends",enum:["friends","followers"]}}}},{if:ie.common195,then:{properties:{connectType:{default:"members",enum:["members","followers"]}}}},{if:ie.common197,then:{properties:{connectType:{default:"contributors",enum:["contributors","followers"]}}}},{if:ie.common199,then:{properties:{connectType:{default:"attendees",enum:["attendees","followers"]}}}}],properties:{childId:ie.common201,childType:ie.common202,connectType:{enum:["members","contributors","attendees","friends","followers"],type:"string"},parentId:ie.common11,parentType:ie.common203},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:ie.common6},{auth:"bearer",constant:"DELETE_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue?index={index}",pathParams:{properties:{index:ie.common80},type:"object"},request:{additionalProperties:!1,properties:{collection:ie.common204,id:ie.common205,path:{const:"preferences.search.@{pathParams.index}",default:"preferences.search.@{pathParams.index}",type:"string"},pull:{const:"preferences.search",type:"string"},value:ie.common135},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:ie.common189,collection:ie.common204,id:ie.common205,path:{const:"preferences.search",default:"preferences.search",type:"string"},value:{additionalProperties:!1,properties:{description:ie.common1,locality:{patternProperties:{"^[a-f0-9]{24}$":{additionalProperties:!1,properties:ie.common55,required:["name","type"]}},type:"object"},name:ie.common1,tags:ie.common31,url:ie.common1},required:["url","name"],type:"object"}},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:!1,properties:{address:ie.common69,collection:{const:"organizations",default:"organizations",type:"string"},email:ie.common2,geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:{const:"organization",default:"organization",type:"string"},name:{minLength:3,type:"string"},preferences:ie.common206,role:{enum:["admin","member"],type:"string"},scope:ie.common135,shortDescription:ie.common1,tags:ie.common31,type:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},url:ie.common4},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:ie.common69,collection:{const:"projects",default:"projects",type:"string"},geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:{const:"project",default:"project",type:"string"},name:ie.common1,parent:ie.common209,preferences:{default:{crowdfunding:!0,isOpenData:!1,isOpenEdition:!1},properties:{crowdfunding:ie.common101,isOpenData:ie.common119,isOpenEdition:ie.common119},required:["isOpenData","isOpenEdition"],type:"object"},public:ie.common101,scope:ie.common135,shortDescription:ie.common1,tags:ie.common31,url:ie.common4},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:ie.common69,collection:ie.common212,description:ie.common1,geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:ie.common212,name:ie.common1,parent:ie.common209,scope:ie.common135,tags:ie.common31,type:ie.common62,urls:ie.common31},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:ie.common163}},properties:{address:ie.common69,collection:ie.common213,email:ie.common2,endDate:ie.common214,geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:{const:"event",default:"event",type:"string"},name:{minLength:2,type:"string"},openingHours:{default:["","","","","","",""],items:{anyOf:[{const:"",type:"string"},{additionalProperties:!1,properties:{dayOfWeek:{enum:["Mo","Tu","We","Th","Fr","Sa","Su"],type:"string"},hours:{default:[],items:{additionalProperties:!1,properties:{closes:ie.common215,opens:ie.common215},required:["opens","closes"],type:"object"},type:"array"}},required:["dayOfWeek","hours"],type:"object"}]},maxItems:7,minItems:7,type:"array"},organizer:ie.common209,parent:ie.common58,preferences:{default:{isOpenData:!1,isOpenEdition:!1},properties:{isOpenData:ie.common119,isOpenEdition:ie.common119},required:["isOpenData","isOpenEdition"],type:"object"},public:ie.common101,recurrency:ie.common119,scope:ie.common135,shortDescription:{format:"textarea",type:"string"},startDate:ie.common214,tags:ie.common31,timeZone:ie.common1,type:ie.common61,url:ie.common4},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:ie.common118,request:ie.common8},{auth:"bearer",constant:"DELETE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/events/id/{id}/",pathParams:ie.common118,request:ie.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:ie.common11,type:ie.common1},required:["type","id"],type:"object"},request:ie.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:ie.common11},required:["folder","ownerId"],type:"object"},request:{additionalProperties:!1,properties:{qqfile:ie.common20,qqfilename:ie.common1,qqtotalfilesize:ie.common216,qquuid:ie.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:ie.common5,childType:ie.common46,linkOption:{enum:["isInviting","toBeValidated","isAdminPending"],type:"string"},parentId:ie.common11,parentType:ie.common203},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:ie.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:ie.common217,request:{additionalProperties:!1,properties:{indexMin:ie.common102},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:ie.common217,request:{additionalProperties:!1,properties:{refreshTimestamp:ie.common216},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:ie.common81},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:ie.common118},{auth:"none",constant:"ACTIVITYPUB_SEARCH",contentType:"application/x-www-form-urlencoded",method:"GET",params:[ie.common20],path:"/api/activitypub/search?address={address}",pathParams:{additionalProperties:!1,properties:{address:ie.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:ie.common1,name:ie.common1,type:{enum:["person"],type:"string"}},required:["id","type","name"],type:"object"},payload:ie.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:ie.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:ie.common118},{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:ie.common220,criteria:{additionalProperties:!1,properties:{narrative:ie.common1},required:["narrative"],type:"object"},description:ie.common1,id:ie.common11,isParcours:ie.common119,issuer:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:ie.common1,type:{enum:["citoyens","organizations","projects"],type:"string"}},required:["type"],type:"object"}},type:"object"},key:ie.common221,name:ie.common1,parent:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{additionalProperties:!1,properties:{name:ie.common1,type:ie.common220},required:["type"],type:"object"}},type:"object"},preferences:ie.common206,public:ie.common101,scope:ie.common135,tags:ie.common31},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}$":ie.common54},type:"object"},badgeId:ie.common11,collection:ie.common220,evidences:{items:{additionalProperties:!1,properties:{narative:ie.common1,url:ie.common4},required:["narative"],type:"object"},type:"array"},key:ie.common221,narative:ie.common1,scope:ie.common135},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:!1,properties:{count:ie.common119,countType:{const:["events"],default:["events"],type:"array"},endDateUTC:ie.common214,fediverse:ie.common119,indexMin:ie.common102,indexStep:{default:100,type:"integer"},locality:{patternProperties:{"^[^\\s]+$":{type:"object"}},type:"object"},name:ie.common1,searchType:{const:["events"],default:["events"],items:ie.common1,type:"array"},startDate:ie.common80,startDateUTC:ie.common214,type:ie.common61},required:["searchType","indexMin","indexStep","startDate","startDateUTC","fediverse"],type:"object"}},{auth:"bearer",constant:"SHARE_EVENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:ie.common120,if:ie.common122,properties:{childId:ie.common11,childType:ie.common65,comment:ie.common1,connectType:ie.common124,parentId:ie.common11,parentType:ie.common213},required:["parentId","childId","childType","connectType","parentType"],then:ie.common125,type:"object"}},{auth:"bearer",constant:"INVITE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:ie.common95,if:ie.common97,properties:{listInvite:{additionalProperties:!1,minProperties:1,properties:{citoyens:ie.common222,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:ie.common2,isAdmin:ie.common226,msg:ie.common1,name:ie.common1,roles:ie.common31},required:["name","email"],type:"object"}},type:"object"},organizations:ie.common222,projects:ie.common222},type:"object"},parentId:ie.common1,parentType:ie.common65},required:["parentId","parentType","listInvite"],then:ie.common99,type:"object"}},{auth:"bearer",constant:"FOLLOW",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/follow",request:{additionalProperties:!1,properties:{childId:ie.common201,childType:ie.common202,parentId:ie.common11,parentType:ie.common203},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:ie.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:ie.common11,contextType:ie.common227,costumEditMode:ie.common119,costumSlug:ie.common1,count:ie.common81,countType:ie.common228,fediverse:ie.common119,filters:ie.common135,indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common138,mapUsed:ie.common119,name:ie.common1,options:{additionalProperties:!0,properties:{tags:{additionalProperties:!0,properties:{verb:ie.common1},type:"object"}},type:"object"},ranges:ie.common143,searchBy:ie.common147,searchTags:ie.common31,searchType:ie.common228,sourceKey:ie.common31},required:["name","searchType","countType","indexMin","indexStep","initType","count","filters","fediverse","mapUsed","costumSlug","sourceKey","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:ie.common230,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common227,costumEditMode:ie.common119,costumSlug:ie.common1,parent_only:ie.common3,sourceKey:ie.common31,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:ie.common230,request:{additionalProperties:!1,allOf:[{if:{properties:{date:ie.common1},required:["date"]},then:{required:["timezone"]}}],properties:{contextId:ie.common11,contextType:ie.common227,costumEditMode:ie.common119,costumSlug:ie.common1,date:{oneOf:[ie.common1,{properties:{between:{properties:{end:ie.common41,start:ie.common41},required:["start","end"],type:"object"}},required:["between"],type:"object"}]},fromToday:ie.common3,regions:ie.common233,sourceKey:ie.common31,tags:ie.common31,timezone:ie.common1,type:ie.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:ie.common230,request:ie.common236},{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:ie.common230,request:ie.common236},{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:ie.common230,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common227,costumEditMode:ie.common119,costumSlug:ie.common1,regions:ie.common233,sourceKey:ie.common31,tags:ie.common31,type:ie.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:ie.common230,request:ie.common236},{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:ie.common230,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common227,costumEditMode:ie.common119,costumSlug:ie.common1,event:ie.common1,sourceKey:ie.common31,tl:ie.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:ie.common230,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common227,costumEditMode:ie.common119,costumSlug:ie.common1,event:ie.common11,search:ie.common1,sourceKey:ie.common31},type:"object"}}];var ae=_(633),ce=_(72);I.default.addType("oid",(e=>new re.ObjectID(e)));class ApiClient extends W.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:r=se,timeout:i=3e4,debug:s=!1,maxRetries:a=0,circuitBreakerThreshold:c=5,circuitBreakerResetTime:p=6e4,fromJSONValue:m=!0,tokenStorageStrategy:d=null}={}){if(super(),!e)throw new ApiClientError('Le paramètre "baseURL" est obligatoire.',500);this.__entityTag="ApiClient",this._baseURL=e,this._refreshUrl=n,this._endpoints=r,this._debug=s;let l=null;if(this._offlineClientManager=null,this._fromJSONValue=m,Object.defineProperty(this,"userId",{get:()=>l,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{l=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new H.default({strict:!1,useDefaults:!0,allErrors:!0,verbose:!0}),(0,Y.default)(this._ajv),this._ajv.addFormat("textarea",!0),this._ajv.addKeyword({keyword:"startBeforeEnd",type:"object",errors:!0,validate:this._startBeforeEndValidate}),this._logger=(0,oe.default)({transport:{target:"pino-pretty",options:{colorize:!0}},level:s?"debug":"info"}),this._client=X.default.create({baseURL:e,timeout:i}),a>0&&((0,ee.default)(this._client,{retries:a,retryDelay:ee.default.exponentialDelay,retryCondition:e=>ee.default.isNetworkError(e)||ee.default.isRetryableError(e),onRetry:(e,t,o)=>{this._logger.warn(`[Retry] Tentative #${e} pour ${o?.url}`),this.emit("retryAttempt",{retryCount:e,url:o?.url})}}),this._logger.info(`[ApiClient] Retry activé : ${a} max`)),this._breakerThreshold=c,this._breakerResetTime=p,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,this._accessToken=null,this._refreshToken=null,d instanceof ae.SJ&&d.use(this._baseURL),this._tokenStorage=d||new ce.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.");o&&this.setRefreshToken(o),t&&this.setToken(t);const u=this._tokenStorage.getAccessToken();u&&this.setToken(u);const h=this._tokenStorage.getRefreshToken();h&&this.setRefreshToken(h),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.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 ApiClientError("Impossible de rafraîchir le token.",401)}catch(e){throw this.resetSession(),new ApiClientError("Erreur lors du rafraîchissement du token.",401,e)}}throw e}))}setToken(e){this._accessToken=e,this._tokenStorage.setAccessToken(e),this._client.defaults.headers.common.Authorization="Bearer "+e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait et défini : ${t}`)),this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){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=(0,te.jwtDecode)(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=X.default.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:e.message}),this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),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 o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,r=e=>"string"!=typeof e?e:e.replace(n,((t,n,r)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=o.pathParams(e);return null!=t?t:`@{${n}}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(r){if(r.startsWith("pathParams.")){const e=r.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],i=o.pathParams(t);return null!=i?i+n:`@${r}`}return`@${r}`}{const e=o[r];if("function"==typeof e){const t=e();return null!=t?t:`@${r}`}return`@${r}`}}return e})),i=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(i);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,n]of Object.entries(e))t[r(o)]=i(n);return t}return"string"==typeof e?r(e):e};return i(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const n of Object.keys(e)){const r=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof r&&t.test(r))continue;if(r&&"object"==typeof r){const e=this._cleanSchemaLeftoverAlias(r);Object.keys(e).length>0&&(o[n]=e);continue}}"string"==typeof r&&t.test(r)||(o[n]=this._cleanSchemaLeftoverAlias(r))}}return o}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${e.message}`),e}}async callEndpoint(e,t={},o=!0,n=!0){const r=this._endpoints.find((t=>t.constant===e));if(!r)throw new ApiClientError(`Endpoint introuvable : ${e}`,404);const{path:i,method:s,contentType:a,auth:c,pathParams:p,request:m,responses:d}=r,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 ApiClientError(`Token requis pour l'endpoint sécurisé : ${e}`,401);let y,f=i,g={};if(p){let o=p;"none"===c&&null===this.userId&&(o=this._cleanSchemaLeftoverAlias(p));const n=t.pathParams||{},r=this._ajv.compile(o);if(!r(n)){const t=this._ajvErrorHuman(r.errors);throw this.emit("validationError",{stage:"pathParams",errors:r.errors}),new ApiValidationError(`callEndpoint: ${e} - Path parameter validation failed.`,400,t,r.errors)}g=this._resolveSpecialValuesInPlace(n),f=f.replace(/\{(\w+)\}/g,((e,t)=>{const o=g[t];if(void 0!==o)return encodeURIComponent(o);throw new ApiClientError(`Path param manquant ou non résolu : {${t}}`,400)}))}if(m){let o=m;"none"===c&&null===this.userId&&(o=this._cleanSchemaLeftoverAlias(m));const n={...t};delete n.pathParams;const r=ApiClient.stripNullsInPlace(n),i=this._ajv.compile(o);if(!i(r)){const t=i.errors?this._ajvErrorHuman(i.errors):[];throw this.emit("validationError",{stage:"request",errors:i.errors}),new ApiValidationError(`callEndpoint: ${e} - Request validation failed.`,400,t,i.errors)}t=this._resolveSpecialValuesInPlace(r,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:o,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 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:o,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 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=e.status.toString(),o=d?.[t];if(o){const n=this._ajv.compile(o);if(!n(e.data)){const e=this._ajvErrorHuman(n.errors);throw this.emit("validationError",{stage:"response",errors:n.errors}),new ApiValidationError("Response validation failed.",t,e,n.errors)}}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(r.postActions)&&r.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(t){throw this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${t.message}`),t instanceof ApiValidationError?t:new ApiClientError(`Erreur lors de l'appel de l'API : ${t.message}`,t.response?t.response.status:500,t.response?t.response.data:null)}}_ajvErrorHuman(e){try{return new Q.AggregateAjvError(e).errors.map((({message:e})=>e))}catch(t){return this._logger.error("[ApiClient] _ajvErrorHuman",t),e.map((({message:e})=>e))}}checkAndThrowApiResponseError(e){const t=e.data;if(!t||"object"!=typeof t)return e;if("boolean"==typeof t.result&&!1===t.result)throw new 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 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 toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:r=!1,metaTokens:i=!0}=o,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,o=!1){return e?e.concat(t).map(((e,t)=>(e=c(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function m(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,d=[]){null==o||s.includes(o)||(s.push(o),Object.entries(o).forEach((([o,s])=>{void 0!==s&&function(e,o,s){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=i?o:o.slice(0,-2),t.append(p(s,o,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(a)||o.endsWith("[]"))return o=c(o),e.forEach(((e,i)=>{if(null!=e){const a=r?p(s.concat(o),i,n):`${p(s,o,n)}[]`;t.append(a,m(e))}})),!1}return!!a(e)||(t.append(p(s,o,n),m(e)),!1)}(s,o.trim(),d)&&e(s,d.concat(c(o)))})),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=e.results.map((e=>this._normalizeJsonData(e)));else if(e.news&&Array.isArray(e.news)&&0===e.news.length)e=e.news;else if(e.news&&"object"==typeof e.news&&!Array.isArray(e.news))e=Object.keys(e.news).map((t=>this._normalizeJsonData({id:t,...e.news[t]})));else if(e.notif&&"object"==typeof e.notif&&!Array.isArray(e.notif))e.notif=Object.keys(e.notif).map((t=>this._normalizeJsonData({id:t,...e.notif[t]})));else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens)&&e.organizations&&"object"==typeof e.organizations&&!Array.isArray(e.organizations))e=[...Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]}))),...Object.keys(e.organizations).map((t=>this._normalizeJsonData({id:t,...e.organizations[t]})))];else if(e.citoyens&&"object"==typeof e.citoyens&&!Array.isArray(e.citoyens))e=Object.keys(e.citoyens).map((t=>this._normalizeJsonData({id:t,...e.citoyens[t]})));else if(e.cities&&"object"==typeof e.cities&&!Array.isArray(e.cities))e=Object.keys(e.cities).map((t=>this._normalizeJsonData({id:t,...e.cities[t]})));else if(e.cities&&Array.isArray(e.cities)&&0===e.cities.length)e=e.cities;else if(e.newComment&&"object"==typeof e.newComment)e.newComment=this._normalizeJsonData({...e.newComment});else if(Array.isArray(e))e=e.map((e=>this._normalizeJsonData(e)));else if(e.map&&"object"==typeof e.map)e.map=this._normalizeJsonData(e.map);else if(e.object&&"object"==typeof e.object)e.object=this._normalizeJsonData(e.object);else if("object"==typeof e&&Object.keys(e).length>0){const t=Object.keys(e).every((e=>/^[0-9a-fA-F]{24}$/.test(e)));e=t?Object.keys(e).map((t=>({id:t,...this._normalizeJsonData(e[t])}))):this._normalizeJsonData(e)}return e}_normalizeJsonData(e){if(!e||"object"!=typeof e)return e;if(e=this._normalizeRecursively(e),e?.mediaImg?.images&&Array.isArray(e.mediaImg.images)&&e.mediaImg.images.length>0&&(e.mediaImg.countImages=e.mediaImg.images.length),e?.mediaFile?.files&&Array.isArray(e.mediaFile.files)&&e.mediaFile.files.length>0&&(e.mediaFile.countFiles=e.mediaFile.files.length),e?.src?.changes&&"object"==typeof e.src.changes&&Object.keys(e.src.changes).length>0&&Object.keys(e.src.changes).forEach((t=>{e.src.changes[t]&&(e.src.changes[t]=this._ensureFullURL(e.src.changes[t]))})),e?.openingHours&&Array.isArray(e.openingHours)&&e.openingHours.length>0&&(e.openingHours=e.openingHours.filter((e=>e.dayOfWeek&&e.hours&&e.hours[0]&&e.hours[0].opens))),e.replies&&"object"==typeof e.replies&&Object.keys(e.replies).length>0&&(e.replies=Object.keys(e.replies).map((t=>this._normalizeJsonData({id:t,...e.replies[t]})))),e?.author&&"object"==typeof e.author&&Object.keys(e.author).length>0&&!("profilThumbImageUrl"in e.author)){const t=Object.keys(e.author)[0];e.author={...e.author[t]}}return e?.timeAgo&&delete e.timeAgo,this._fromJSONValue?I.default.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date","issuedOn"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let n=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(n=this._normalizeDate(n)),this._imageFields.includes(o)&&(n=this._normalizeImage(n)),"content"===o&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[o]=n})),this._normalizeId(t)}return e}_startBeforeEndValidate=(e,t)=>{if(!t.startDate||!t.endDate)return!0;const o=new Date(t.startDate)<new Date(t.endDate);return o||(this._startBeforeEndValidate.errors=[{instancePath:"/startDate",schemaPath:"#/startBeforeEnd",keyword:"startBeforeEnd",params:{},message:"startDate must be before endDate"}]),o};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 o of t)"function"==typeof e[o]&&this.on(o,e[o])}getDeclaredEvents(){const e=new Set;for(const t of this._endpoints)if(Array.isArray(t.postActions))for(const o of t.postActions)"emitEvent"===o.type&&o.event&&e.add(o.event);return Array.from(e)}}class UserApi{constructor(e){this.client=e instanceof ApiClient?e:new ApiClient(e),this.loggedUser=null}get isConnected(){return this.client.isConnected}get userId(){return this.client.userId}async login(e,t){return this.client.safeCall((async()=>{const o=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new User(this.client,o.data.user,{EndpointApi:J,Organization,Project,Event,Poi,Badge,News}),this.loggedUser}))}async meIsconnected(){if(!this.client.isConnected||!this.client.userId)throw new ApiError("User not connected",401);return this.client._logger.info("UserApi","meIsconnected",this.client.userId),this.loggedUser=new User(this.client,{id:this.client.userId},{EndpointApi:J,Organization,Project,Event,Poi,Badge,News}),this.loggedUser}async register({name:e,username:t,email:o,pwd:n}={}){return this.client.safeCall((async()=>{const r=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:o,pwd:n});if(!1===r?.data?.result)throw new ApiResponseError(r.data.msg,r.status,r.data);return r.data}))}async recoverPassword(e){return this.client.safeCall((async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!1===t?.data?.result)throw new ApiResponseError(t.data.msg,t.status,t.data);return t.data}))}}A("User",User),A("Organization",Organization),A("Project",Project),A("Event",Event),A("Poi",Poi),A("Badge",Badge),A("EndpointApi",J),A("UserApi",UserApi),A("News",News);class Api{static async userLogin(e,t,o){const n=Api.userApi(o);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,o){try{if(!e)throw new ApiError("userApi is not defined");if(!e.client)throw new ApiError("userApi.client is not defined");if(e.client.isConnected){const t=await e.meIsconnected();return new Api(t,e.client)}{if(!t||!o)throw new ApiError("email and password are required");const n=await e.login(t,o);return new Api(n,e.client)}}catch(e){if(e instanceof ApiClientError&&e?.details?.error)throw new 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 ApiAuthenticationError("Accès refusé : utilisateur non authentifié.");return await this._loggedUser.get(),this._loggedUser}async user(e){try{if(e.id||e.slug){const t=new User(this._client,e,{EndpointApi:J,Organization,Project,Event,Poi,Badge,News});return await t.get(),t}return new User(this._client,e,{EndpointApi:J,Organization,Project,Event,Poi,Badge,News})}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:J,User,Project,Event,Poi,Badge,News});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:J,User,Organization,Event,Poi,Badge,News});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:J,User,Organization,Project,Poi,Badge,News});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 entitySlug(e){if(e)try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t?.contextId&&t?.contextType){const e=function(e,t=null,o={}){const n={citoyens:{entityTag:"User",meta:e=>v(e,{remove:[]})},organizations:{entityTag:"Organization",meta:e=>v(e,{remove:[]})},projects:{entityTag:"Project",meta:e=>v(e,{remove:[]})},events:{entityTag:"Event",meta:e=>v(e,{remove:["Badge"]})},poi:{entityTag:"Poi",meta:e=>v(e,{remove:["Badge","News"]})},news:{entityTag:"News",meta:e=>v(e,{remove:[]})},badges:{entityTag:"Badge",meta:e=>function(e){const t=b.get(e),o={EndpointApi:b.get("EndpointApi"),User:b.get("User"),Organization:b.get("Organization"),Project:b.get("Project")};return o[e]=t,{entityClass:t,deps:o}}(e)}}[e];if(!n)return console.warn(`Collection inconnue : '${e}'`),null;const{entityTag:r,meta:i}=n,{entityClass:s,deps:a}=i(r);return new s(t,o,a)}(t?.contextType,this._client,{id:t?.contextId});return await e.get(),e}throw new ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof ApiResponseError?new 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 J(this._client)}logout(){this.loggedUser=null,this._client.resetSession(),this._client._logger.info("UserApi: User logged out")}}var pe=_(942);class OfflineClientManager{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}static async attachTo(e,t={}){e._offlineClientManager=new OfflineClientManager(e);const o=await async function(e="auto"){if("memory"===e)return new pe.QM;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new pe.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(339).then(_.bind(_,339));return new e}if("auto"===e){if("undefined"!=typeof window&&window.localStorage)return new pe.Rc;{const{FileOfflineStorage:e}=await _.e(339).then(_.bind(_,339));return new e}}}(t?.offlineStorageStrategy||"auto");await e._offlineClientManager._initOfflineQueue(o),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 o=new ApiClient({baseURL:e.baseURL,accessToken:e.accessToken,refreshToken:e.refreshToken,debug:this._client._debug});return this._clients.set(t,o),o}async replayAction(e){const t=await this.getClient(e.meta);try{const o=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}`),o}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(e){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._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:o={}}){const n=this._client.getToken()||this._client.getRefreshToken(),r=this._client._endpoints.find((t=>t.constant===e));if("required"===(r?.authPolicy||("none"===r?.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:o,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(){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)),o=e?.authPolicy||("none"===e?.auth?"none":"required"),n=t.meta.accessToken||t.meta.refreshToken;if("required"!==o||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){this._offlineQueueStorage=e,this._offlineQueue=await e.loadQueue()}}const me=OfflineClientManager,de={ApiClient,Api,error:E,reactive:T,...T,tokenStorageStrategy:{createDefaultTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new ce.GN;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new ce.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(790).then(_.bind(_,790));return new e}if("auto"===e){if("undefined"!=typeof window&&window.localStorage)return new ce.Ge;{const{FileStorageStrategy:e}=await _.e(790).then(_.bind(_,790));return new e}}},TokenStorageStrategy:ce.u3,createDefaultMultiServerTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new ae.Ek;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new ae.YP;throw new Error("localStorage n’est pas disponible dans cet environnement.")}if("file"===e){if("undefined"!=typeof window&&window.localStorage)throw new Error("Le stockage fichier n’est pas disponible côté navigateur.");const{MultiServerFileStorageStrategy:e}=await _.e(774).then(_.bind(_,774));return new e}if("undefined"!=typeof window&&window.localStorage)return new ae.YP;{const{MultiServerFileStorageStrategy:e}=await _.e(774).then(_.bind(_,774));return new e}},MultiServerTokenStorageStrategy:ae.SJ},helper:{fromEntityJSON:function(e,t=null){if(!e?.__entityTag)return null;if(!e.serverData?.collection)return e;const o=function(e,t){const o=b.get(t),n=t,r={EndpointApi:b.get("EndpointApi"),User:"User"===n?o:b.get("User"),Organization:"Organization"===n?o:b.get("Organization"),Project:"Project"===n?o:b.get("Project"),Event:"Event"===n?o:b.get("Event"),Poi:"Poi"===n?o:b.get("Poi"),Badge:"Badge"===n?o:b.get("Badge"),News:"News"===n?o:b.get("News")};return{citoyens:{entityClass:r.User,deps:r},organizations:{entityClass:r.Organization,deps:r},projects:{entityClass:r.Project,deps:r},events:{entityClass:r.Event,deps:{...r,Badge:void 0}},poi:{entityClass:r.Poi,deps:{...r,Badge:void 0,News:void 0}},news:{entityClass:r.News,deps:{...r}},badges:{entityClass:r.Badge,deps:{EndpointApi:r.EndpointApi,User:r.User,Organization:r.Organization,Project:r.Project}}}[e]||null}(e.serverData.collection,e.__entityTag);if(!o)return e;if(!o?.entityClass?.fromJSON)throw new Error(`Classe inconnue ou fromJSON manquant pour ${e.__entityTag}`);return o.entityClass.fromJSON(e,t,o.deps)}},OfflineClientManager:me};export{de as default};
1
+ import*as e from"os";import*as t from"fs";import*as o from"path";import*as n from"stream";import*as r from"bson-objectid";import*as i from"ejson";import*as s from"file-type";import*as a from"events";import*as c from"@segment/ajv-human-errors";import*as p from"ajv";import*as m from"ajv-formats";import*as d from"axios";import*as l from"axios-retry";import*as u from"jwt-decode";import*as h from"pino";var y,f,g={72:(e,t,o)=>{o.d(t,{GN:()=>MemoryStorageStrategy,Ge:()=>LocalStorageStrategy,u3:()=>TokenStorageStrategy});class TokenStorageStrategy{getAccessToken(){throw new Error("getAccessToken() doit être implémenté")}setAccessToken(e){throw new Error("setAccessToken() doit être implémenté")}getRefreshToken(){throw new Error("getRefreshToken() doit être implémenté")}setRefreshToken(e){throw new Error("setRefreshToken() doit être implémenté")}clear(){throw new Error("clear() doit être implémenté")}}class MemoryStorageStrategy extends TokenStorageStrategy{constructor(){super(),this._accessToken=null,this._refreshToken=null}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{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`))}}},116:(t,o,n)=>{var r,i;t.exports=(r={default:()=>e.default},i={},n.d(i,r),i)},421:(e,o,n)=>{var r,i;e.exports=(r={default:()=>t.default},i={},n.d(i,r),i)},521:(e,t,n)=>{var r,i;e.exports=(r={default:()=>o.default},i={},n.d(i,r),i)},633:(e,t,o)=>{o.d(t,{Ek:()=>MultiServerMemoryStorageStrategy,SJ:()=>MultiServerTokenStorageStrategy,YP:()=>MultiServerLocalStorageStrategy});var n=o(72);class MultiServerTokenStorageStrategy extends n.u3{constructor(){super(),this._currentBaseURL=null}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)")}getServers(){throw new Error("getServers() doit être implémenté")}exportAll(){throw new Error("exportAll() doit être implémenté")}}class MultiServerMemoryStorageStrategy extends MultiServerTokenStorageStrategy{constructor(){super(),this._storage=new Map}getAccessToken(){return this._ensureContext(),this._storage.get(this._currentBaseURL)?.accessToken||null}setAccessToken(e){this._ensureContext();const t=this._storage.get(this._currentBaseURL)||{};this._storage.set(this._currentBaseURL,{...t,accessToken:e})}getRefreshToken(){return this._ensureContext(),this._storage.get(this._currentBaseURL)?.refreshToken||null}setRefreshToken(e){this._ensureContext();const t=this._storage.get(this._currentBaseURL)||{};this._storage.set(this._currentBaseURL,{...t,refreshToken:e})}clear(){this._ensureContext(),this._storage.delete(this._currentBaseURL)}getServers(){return[...this._storage.keys()]}exportAll(){return Object.fromEntries(this._storage.entries())}}class MultiServerLocalStorageStrategy extends MultiServerTokenStorageStrategy{constructor(e="cocolight"){super(),this.prefix=e}_key(e){return`${this.prefix}_tokens_${e}`}_getData(){this._ensureContext();const e=localStorage.getItem(this._key(this._currentBaseURL));return e?JSON.parse(e):{}}_setData(e){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(){localStorage.removeItem(this._key(this._currentBaseURL))}getServers(){return 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 o=localStorage.getItem(this._key(t));o&&(e[t]=JSON.parse(o))}return e}}},702:(e,t,o)=>{var r,i;e.exports=(r={PassThrough:()=>n.PassThrough,Readable:()=>n.Readable},i={},o.d(i,r),i)},942:(e,t,o)=>{o.d(t,{LD:()=>OfflineQueueStorageStrategy,QM:()=>MemoryOfflineStorage,Rc:()=>LocalStorageOfflineStorage});class OfflineQueueStorageStrategy{async loadQueue(){throw new Error("loadQueue() doit être implémenté")}async saveQueue(e){throw new Error("saveQueue(queue) doit être implémenté")}}class MemoryOfflineStorage extends OfflineQueueStorageStrategy{constructor(){super(),this._queue=[]}async loadQueue(){return this._queue}async saveQueue(e){this._queue=[...e]}}class LocalStorageOfflineStorage extends OfflineQueueStorageStrategy{constructor(e="cocolight-api-offline-queue"){super(),this.key=e}async loadQueue(){try{const e=localStorage.getItem(this.key);return e?JSON.parse(e):[]}catch{return[]}}async saveQueue(e){try{localStorage.setItem(this.key,JSON.stringify(e))}catch(e){console.warn("[Offline] Échec du stockage localStorage",e)}}}}},w={};function _(e){var t=w[e];if(void 0!==t)return t.exports;var o=w[e]={exports:{}};return g[e](o,o.exports,_),o.exports}_.m=g,_.d=(e,t)=>{for(var o in t)_.o(t,o)&&!_.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},_.f={},_.e=e=>Promise.all(Object.keys(_.f).reduce(((t,o)=>(_.f[o](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,o,{__webpack_ids__:n,__webpack_modules__:r,__webpack_runtime__:i}=e,s=0;for(t in r)_.o(r,t)&&(_.m[t]=r[t]);for(i&&i(_);s<n.length;s++)o=n[s],_.o(y,o)&&y[o]&&y[o][0](),y[n[s]]=0},_.f.j=(e,t)=>{var o=_.o(y,e)?y[e]:void 0;if(0!==o)if(o)t.push(o[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=>o=y[e]=[t]))]),t.push(o[1]=n)}};var E={};_.r(E),_.d(E,{ApiAuthenticationError:()=>ApiAuthenticationError,ApiClientError:()=>ApiClientError,ApiError:()=>ApiError,ApiResponseError:()=>ApiResponseError,ApiValidationError:()=>ApiValidationError,CircuitBreakerError:()=>CircuitBreakerError});var T={};_.r(T),_.d(T,{batch:()=>M,computed:()=>U,effect:()=>N,getSignals:()=>G,isReactive:()=>B,isSignal:()=>q,reactive:()=>z,subscribeTo:()=>V,watch:()=>F});const b=new Map;function A(e,t){b.set(e,t)}function v(e,t){const o=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")};return n[e]=o,t.remove.forEach((e=>delete n[e])),{entityClass:o,deps:n}}class ApiError extends Error{constructor(e,t,o){super(e),this.name="ApiError",this.status=t,this.details=o}}class ApiClientError extends ApiError{constructor(e,t,o){super(e,t,o),this.name="ApiClientError"}}class ApiValidationError extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiValidationError",this.status=t,this.messages=o,this.details=n}}class CircuitBreakerError extends ApiError{constructor(e){super(e,503),this.name="CircuitBreakerError"}}class ApiResponseError extends Error{constructor(e,t,o,n=null){super(e),this.name="ApiResponseError",this.status=t,this.responseData=o,this.details=n}}class ApiAuthenticationError extends ApiError{constructor(e,t,o){super(e,t,o),this.name="ApiAuthenticationError"}}const P=(O={default:()=>r.default},S={},_.d(S,O),S);var O,S;const I=(e=>{var t={};return _.d(t,e),t})({default:()=>i.default}),j=(e=>{var t={};return _.d(t,e),t})({default:()=>s.default}),C=[],k=new WeakMap,x=new WeakMap;let D=0;const L=new Set;function N(e){const t=()=>{try{C.push(t),e()}finally{C.pop()}};return t(),t}function M(e){D++;try{e()}finally{if(D--,0===D){const e=Array.from(L);L.clear();for(const t of e)t()}}}function $(e){let t=e;const o=new Set;return{get value(){const e=C[C.length-1];return e&&o.add(e),t},set value(e){t!==e&&(t=e,D>0?o.forEach((e=>L.add(e))):o.forEach((e=>e())))},subscribe:e=>(o.add(e),()=>o.delete(e)),__isSignal:!0}}function q(e){return e&&!0===e.__isSignal}function R(e,t=[]){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return function(e,t){return new Proxy(e,{get(e,o){if("string"==typeof o&&!isNaN(o)){const n=e[o];return B(n)?n:z(n,t.concat(o))}return Reflect.get(e,o)},set(e,o,n){const r=z(n,t.concat(o));return e[o]=r,!0}})}(e,t);if(e.__isReactive)return e;const o=new Map,n=new Proxy(e,{get(e,n,r){if("__raw"===n)return e;if("__isReactive"===n)return!0;if(!o.has(n)){const r=$(R(e[n],t.concat(n)));o.set(n,r)}return o.get(n).value},set(e,n,r){const i=R(r,t.concat(n));if(!o.has(n)){const e=$(i);o.set(n,e)}return o.get(n).value=i,e[n]=function(e){return q(e)?e.value:e}(i),!0},deleteProperty:(e,t)=>(o.delete(t),Reflect.deleteProperty(e,t))});return x.set(n,o),n}function z(e){return"object"!=typeof e||null===e||e.__isReactive?e:R(e)}function B(e){return null!==e&&"object"==typeof e&&!0===e.__isReactive}function U(e){if(k.has(e))return k.get(e);const t=$();return N((()=>t.value=e())),k.set(e,t),t}function F(e,t){let o;N((()=>{const n=e();n!==o&&(t(n,o),o=n)}))}function G(e){return B(e)?x.get(e):null}function V(e,t,o){const n=G(e);if(!n||!n.has(t))return()=>{};const r=n.get(t);return r?.subscribe?.((()=>o(r.value)))??(()=>{})}const{fromBuffer:K}=j.default,Z=class BaseEntity{_draftData={};_initialDraftData={};_serverData=null;_calledFromSave=!1;_syncReactiveDraft=!1;static entityTag="BaseEntity";constructor(e,t={},o={},n={}){if(this.__entityTag=n.entityTag||this.getEntityTag(this.constructor.entityTag)||"BaseEntity",this.deps=o,"ApiClient"===this.getEntityTag(e?.__entityTag))this.apiClient=e,this.parent=null,this.userContext=null;else{if(!e?.apiClient)throw new ApiError("Parent invalide ou ApiClient manquant.");this.apiClient=e.apiClient,this.parent=e,"User"===this.getEntityTag(e?.__entityTag)?this.userContext=e:e?.userContext&&(this.userContext=e.userContext)}if("function"==typeof o.EndpointApi)this.endpointApi=new o.EndpointApi(this.apiClient);else{if("object"!=typeof o.EndpointApi)throw new ApiError("deps.EndpointApi doit être une classe ou une instance valide.");this.endpointApi=o.EndpointApi}this._serverData=z({});const{draft:r,proxy:i,initial:s}=this._buildDraftAndProxy({data:{...t,...this.defaultFields},serverData:this._serverData,constant:this.constructor.SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});this._initialDraftData=s,this._draftData=r,this.data=i}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}getEntityType(){return this.constructor.entityType}hasChanges(){return this._serialize(this._toRawDeep(this._draftData))!==this._serialize(this._initialDraftData)}async refresh(){if(!this.id)throw new ApiError("Impossible de rafraîchir sans ID.");return this.get()}async save(){if(!this.isConnected)throw new ApiError("Non connecté.");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,o){const n=new this(t,{},o);return n._setData(e),n}_setData(e,{forceInitialDraftReset:t=!1}={}){this.userContext&&this.userContext!==this&&this.apiClient._logger?.info?.(`[${this.__entityTag}] Mise à jour liée à userContext : ${this.userContext.id}`),B(this._serverData)?Object.assign(this._serverData,e):this._serverData=z({...e});const o=this._draftData?this._toRawDeep(this._draftData):{},n={...e,...this.defaultFields,...o},{draft:r,proxy:i,initial:s}=this._buildDraftAndProxy({data:n,serverData:this._serverData,previousDraft:this._draftData,constant:this.constructor.SCHEMA_CONSTANTS,apiClient:this.apiClient,transforms:this.transforms,removeFields:this.removeFields});t?this._initialDraftData=structuredClone(this._toRawDeep(r)):this._initialDraftData||(this._initialDraftData=s),B(this._draftData)?this._updateDraftPreservingUserChanges(r):this._draftData=z(r),this.data||(this.data=i)}_updateDraftPreservingUserChanges(e){for(const t of Object.keys(e)){const o=this._draftData?.[t],n=this._initialDraftData?.[t];void 0!==o&&void 0!==n&&this._serialize(this._toRawDeep(o))!==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(q(e))return this._toRawDeep(e.value);if(Array.isArray(e))return e.map((e=>this._toRawDeep(e)));if("object"==typeof e&&null!==e){const t={};for(const o of Object.keys(e))t[o]=this._toRawDeep(e[o]);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),{__entityTag:this.__entityTag,__isSerializedEntity:!0,serverData:this._serialize(this._serverData),parent:Object.keys(e).length>0?e:null}}_serialize(e){try{return JSON.parse(I.default.stringify(this._removeUnserializables(e)))}catch(e){return this.apiClient?._logger?.error?.("Erreur de sérialisation EJSON",e),null}}_removeUnserializables(e,t=new WeakSet){if(null===e||"object"!=typeof e)return e;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 o={};for(const n of Object.keys(e)){const r=e[n];if("function"!=typeof r&&"symbol"!=typeof r&&void 0!==r)try{o[n]=this._removeUnserializables(r,t)}catch(e){o[n]=null}}return o}static _revive(e){return I.default.fromJSONValue(e)}static fromJSON(e,t,o){const{serverData:n}=e;return this.fromServerData(this._revive(n),t,o)}async call(e,t={}){return this.apiClient.safeCall((async()=>{const o=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(o),o.data}))}async callNoConnected(e,t={}){if(this.isConnected)throw new ApiAuthenticationError("Vous devez ne devez pas être connecté pour faire cette action.");return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new ApiAuthenticationError("Vous devez être connecté pour faire cette action.");return"function"==typeof e?await e():this.call(e,t)}async callIsMe(e,t={}){if(!this.isMe)throw new ApiAuthenticationError("Vous devez être vous-même pour faire cette action.");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:o="any"}){if(!e)throw new ApiValidationError("Le fichier est requis.");const n="undefined"==typeof window&&"undefined"!=typeof process;let r="",i=e;if("undefined"!=typeof File&&e instanceof File){if(r=e.type,!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.")}else if("undefined"!=typeof Blob&&e instanceof Blob){if(r=e.type,!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.");const o=r.split("/")[1]||"bin",n=`${Date.now()}.${o}`;i=new File([e],n,{type:r})}else if(n&&Buffer.isBuffer(e)){const n=await K(e);if(r=n?.mime,!n||!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.");if("image"===o){const t=n.ext,o=`${Date.now()}.${t}`;i=await this._createReadStreamFromBuffer(e,o,r)}}else{if(!n||!e?.readable||"function"!=typeof e._read)throw new ApiValidationError("Type de fichier non reconnu.");{const o=[],n=await this._passThrough(),s=await this._passThrough(),a=4100;let c=0;e.on("data",(e=>{c<a&&(o.push(e),c+=e.length)})),e.pipe(n).pipe(s),await new Promise((e=>setTimeout(e,10)));const p=Buffer.concat(o),m=await K(p);if(r=m?.mime,!m||!t.includes(r))throw new ApiValidationError("Le type du fichier est invalide.");s.path=`${Date.now()}.${m.ext}`,s.mimeType=r,i=s}}return i}async _createReadStreamFromBuffer(e,t="file.bin",o="application/octet-stream"){const n=await this._bufferToReadable(e);return n.path=t,n.mimeType=o,n}async _bufferToReadable(e){if("undefined"==typeof window){const{bufferToReadable:t}=await _.e(22).then(_.bind(_,22));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(22).then(_.bind(_,22));return e()}throw new Error("passThrough ne doit pas être appelé dans le navigateur")}_omitProps(e,t){if(!e||"object"!=typeof e)return{};const o={...e};for(const e of t)delete o[e];return o}_pickProps(e,t,o={}){if(!e||"object"!=typeof e)return{};const n={};for(const r of t)if(r in e){const t=e[r];"function"==typeof o[r]?n[r]=o[r](t,e):n[r]=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,o)=>"string"!=typeof t||isNaN(t)?"length"===t?e.filter((e=>!e._isDeleted)).length:"function"==typeof e[t]?(...o)=>e.filter((e=>!e._isDeleted))[t](...o):Reflect.get(e,t,o):e.filter((e=>!e._isDeleted))[t]})}_newId(){return(new P.default).toString()}_createDraftProxy(e,t={},o={},n=[],r={},i={}){return new Proxy({},{get:(e,n)=>{if("string"==typeof n||"symbol"==typeof n){if(n in o){const e=o[n],t=r[n];return"function"==typeof t?t(e):e}if(t&&"object"==typeof t&&n in t){const e=t[n],o=r[n];return"function"==typeof o?o(e):e}}},set:(t,r,s)=>{if(!n.includes(r)){const t=`[DraftProxy] Le champ "${r}" n'est pas autorisé.`;if(i.throwOnError)throw new ApiValidationError(t,400,null,{field:r,value:s,allowedFields:n});return e._logger.warn(t),!1}const a=o[r];return a&&"object"==typeof a&&!0===a.__isSignal?a.value=s:o[r]=s,!0},deleteProperty:(e,t)=>!!n.includes(t)&&(delete o[t],!0),has:(e,n)=>n in o||n in t,ownKeys:()=>[...new Set([...Object.keys(t||{}),...Object.keys(o||{})])],getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}_extractWritableFields(e={},t={},o={defs:{},visited:new Set}){if(!e||"object"!=typeof e)return[];if(e.$id&&o.visited.has(e.$id))return[];e.$id&&o.visited.add(e.$id),o.defs=e.$defs||e.definitions||o.defs;const n=[];if(e.$ref){const r=e.$ref.replace(/^#\/?(\$defs|definitions)\//,""),i=o.defs?.[r];i&&n.push(...this._extractWritableFields(i,t,o))}if(e.allOf&&e.allOf.forEach((e=>n.push(...this._extractWritableFields(e,t,o)))),e.if&&e.then){const r=e.if?.properties;let i=!0;if(r)for(const e in r){const o=r[e]?.const;if(t[e]!==o){i=!1;break}}i&&e.then?n.push(...this._extractWritableFields(e.then,t,o)):!i&&e.else&&n.push(...this._extractWritableFields(e.else,t,o))}return e.properties&&n.push(...Object.entries(e.properties).filter((([e,t])=>!0!==t.readOnly&&void 0===t.const)).map((([e])=>e))),[...new Set(n)]}_buildDraftAndProxy({data:e={},serverData:t=null,previousDraft:o=null,constant:n,apiClient:r,transforms:i={},throwOnError:s=!0,removeFields:a=[]}){const c=Array.isArray(n)?n:[n],p={allOf:[],$defs:{}};for(const e of c){const t=r.getRequestSchema(e);if(!t)throw new ApiError(`Unable to find schema for ${e}.`);if(t.$defs)for(const[o,n]of Object.entries(t.$defs))p.$defs[o]?r._logger.warn(`Duplicate $defs key '${o}' from schema '${e}'`):p.$defs[o]=n;p.allOf.push(t)}let m=this._extractWritableFields(p,e);e.id&&-1===m.indexOf("id")&&m.push("id"),e.slug&&-1===m.indexOf("slug")&&m.push("slug"),m=m.filter((e=>!a.includes(e)));const d=Object.fromEntries(m.map((t=>{const o=e[t];return[t,"function"==typeof i[t]?i[t](o,e):o]})).filter((([e,t])=>void 0!==t))),l=structuredClone?structuredClone(d):JSON.parse(JSON.stringify(d)),u=B(o)?Object.assign(o,d):z(d),h=B(t)?t:t&&"object"==typeof t?z(t):t;return{draft:u,proxy:this._createDraftProxy(r,h,u,m,i,{throwOnError:s}),initial:l}}_extractChangedFieldsFromSchema(e,t,o={},n,r=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,o);const a={},c=n?.()||{};s=s.filter((e=>!r.includes(e)));for(const e of s){if(void 0===o[e])continue;const t=o[e],n=c[e];JSON.stringify(t)!==JSON.stringify(n)&&(a[e]=t)}return Object.keys(a).length>0?a:null}_extractAllValidFieldsFromSchema(e,t,o={},n,r=[]){const i=e.getRequestSchema(t);let s=this._extractWritableFields(i,o);const a={},c={},p=n?.()||{};s=s.filter((e=>!r.includes(e)));for(const e of s){if(void 0===o[e])continue;const t=o[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 ApiResponseError(`Le slug ${this.slug} ne correspond pas à un ${e}`,200,t);this._id(t.contextId)}catch(t){throw t instanceof ApiResponseError?t?.responseData?.contextType!==e?t:new ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${this.slug}`,t.status,t.responseData):t}return this.id}async _getPublicProfile(){return await this._resolveId(this.getEntityType()),this.endpointApi.getElementsAbout({pathParams:{id:this.id,type:this.getEntityType()}})}_getEntityMeta(e){const t=this.constructor,o=this.__entityTag,n={EndpointApi:this.deps.EndpointApi,User:"User"===o?t:this.deps.User,Organization:"Organization"===o?t:this.deps.Organization,Project:"Project"===o?t:this.deps.Project,Event:"Event"===o?t:this.deps.Event,Poi:"Poi"===o?t:this.deps.Poi,Badge:"Badge"===o?t:this.deps.Badge,News:"News"===o?t:this.deps.News};return{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}}}[e]||null}_linkEntity(e,t){const o=this._getEntityMeta(e);return o?o.entityClass.fromServerData(t,this,o.deps):t}async _linkEntityById(e,t,o={}){const n=this._getEntityMeta(e);if(!n)return null;const r=new n.entityClass(this,{id:t},n.deps);return o?.skipGet||await r.get(),r}_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={},o={}){const n=o.key||e,r="function"==typeof o.mapFn?o.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 o of Object.keys(a)){const n=a[o],p=Object.entries(t).every((([e,t])=>{const o=n[e];if("function"==typeof t)try{return t(o)}catch(t){return console.warn(`Erreur dans le filtre personnalisé pour ${e}`,t),!1}return t instanceof RegExp?"string"==typeof o&&t.test(o):"string"==typeof t&&"string"==typeof o?o.toLowerCase().includes(t.toLowerCase()):i(t)?i(o):s(t)?s(o):"string"!=typeof o||"string"!=typeof t||isNaN(Date.parse(o))||isNaN(Date.parse(t))?o===t:new Date(o).getTime()===new Date(t).getTime()}));if(p)try{const t=await this._linkEntityById(e,o);t&&(t.meta=n,c.push(r?r(t):t))}catch(t){this._logger?.error?.(`Erreur lors de la récupération de l'entité ${e} (${o}) :`,t)}}return c}_entityInstanceData(e,t){const o=this._getEntityMeta(e),n=this.__entityTag,r=this.constructor;return new o.entityClass(this,t,{[n]:r,...o.deps})}async entity(e,t={}){try{const o=this._entityInstanceData(e,t),n={citoyens:["id","slug"],organizations:["id","slug"],projects:["id","slug"],events:["id","slug"],poi:["id","slug"],news:["id"],badges:["id"]}[e];return n&&this._hasAtLeastOne(t,n)&&await o.get(),o}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 ApiError("Le slug est requis.");try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t?.contextId&&t?.contextType)return await this.entity(t.contextType,{id:t.contextId});throw new ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof ApiResponseError?new ApiResponseError(`Impossible de récupérer l'identifiant pour le slug ${e}`,t.status,t.responseData):t}}_buildLinkFilters(e,{linkType:t,isAdmin:o,isAdminPending:n,isInviting:r,toBeValidated:i=!1,roles:s=[]}={}){if("string"!=typeof e)throw new TypeError("id doit être une chaîne.");if("string"!=typeof t)throw new TypeError("linkType doit être une chaîne.");if(void 0!==o&&"boolean"!=typeof o)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!==r&&"boolean"!=typeof r)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 r&&(c[`${a}.isInviting`]={$exists:r}),!0===o&&(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 ApiError(`Aucune correspondance de lien définie pour le type d'entité "${e}"`);return t}_checkLinkableEntity(){try{this._getLinkMeta()}catch(e){if(e instanceof ApiError)throw new ApiError(`L'entité "${this.getEntityType()}" ne prend pas en charge les actions de lien.`);throw e}}_getLinkFromConnectedUser(){const{linkType:e}=this._getLinkMeta();return this?.userContext?.serverData?.links?.[e]?.[this.id]||null}async _submitLinkRequest(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.callIsMe((()=>this.endpointApi.connect(t)));return await this.userContext.refresh(),o}if(t.isInviting)return this._acceptLinkRequest();if(t.toBeValidated)throw new ApiError("Vous êtes déjà en attente de validation.");throw new ApiError("Vous êtes déjà connecté à cette entité.")}async _submitLinkRequestAdmin(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const e=this._getLinkFromConnectedUser();if(!e){const e={parentType:this.getEntityType(),parentId:this.id,connectType:"admin"},t=await this.callIsMe((()=>this.endpointApi.connect(e)));return await this.userContext.refresh(),t}if(e.isInviting)return this._acceptLinkRequest();if(e.toBeValidated&&e.isAdminPending)throw new ApiError("Vous êtes déjà en attente de validation pour devenir admin.");if(e.toBeValidated)throw new ApiError("Vous êtes déjà en attente de validation pour rejoindre cette entité.");throw new ApiError("Vous êtes déjà connecté à cette entité.")}async _acceptLinkRequest(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(this._getLinkFromConnectedUser().isInviting){const e={parentType:this.getEntityType(),parentId:this.id,linkOption:"isInviting"},t=await this.callIsMe((()=>this.endpointApi.linkValidate(e)));return await this.userContext.refresh(),t}throw new ApiError("Vous n'avez pas d'invitation à valider.")}async _leaveLinkRequest(){if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new ApiError("Vous n'êtes pas connecté à cette entité.");const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.callIsMe((()=>this.endpointApi.disconnect(t)));return await this.userContext.refresh(),o}async get(){return this.apiClient.safeCall((async()=>{const e=await this._getPublicProfile();return this._setData(e,{forceInitialDraftReset:!0}),e}))}async updateSettings(e={}){return e.idEntity=this.id,e.typeEntity=this.getEntityType(),this.callIsConnected((()=>this.endpointApi.updateSettings(e)))}async updateDescription(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockDescription(e)))}async updateInfo(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockInfo(e)))}async updateSocial(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockSocial(e)))}async updateLocality(e={}){return e.typeElement=this.getEntityType(),e.id=this.id,this.callIsConnected((()=>this.endpointApi.updateBlockLocality(e)))}async updateSlug({slug:e}){try{await this.endpointApi.check({type:this.getEntityType(),id:this.id,slug:e})}catch(e){if(e instanceof ApiResponseError)throw new ApiResponseError("Erreur lors de la vérification du slug.",e.status,e.data);throw e}return this.callIsConnected((()=>this.endpointApi.updateBlockSlug({typeElement:this.getEntityType(),id:this.id,slug:e})))}async updateImageProfil({profil_avatar:e}){e=await this._validateImage(e);const t={pathParams:{folder:this.getEntityType(),ownerId:this.id},profil_avatar:e};return this.callIsConnected((()=>this.endpointApi.profilImage(t)))}async organization(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.");return this.entity("organizations",e)}async project(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un projet.");return this.entity("projects",e)}async poi(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un POI.");return this.entity("poi",e)}async event(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un événement.");return this.entity("events",e)}async badge(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté pour créer un badge.");return this.entity("badges",e)}async news(e={}){if(!this.isConnected)throw new ApiError("Vous devez être connecté.");return this.entity("news",e)}async getOrganizations(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,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={}){return e.searchType=this._getDefaultFromEndpoint("GET_PROJECTS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>(this.isMe?e.pathParams={type:this.getEntityType(),id:this.id}:(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 getPois(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_POIS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,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={}){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIBERS","searchType"),this._createPaginatorEngine({initialData:e,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={}){return e.searchType=this._getDefaultFromEndpoint("GET_BADGES","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>(delete e?.pathParams,e.filters=e.filters||{},e.filters.$or={},e.filters.$or[`issuer.${this.id}`]={$exists:!0},this.endpointApi.getBadges(e))}).next()}async getNews(e={}){e.pathParams={type:this.getEntityType(),id:this.id};const t=await this.endpointApi.getNews(e);if(!Array.isArray(t))throw new ApiResponseError("Erreur lors de la récupération des actualités.",500,t);const o=this._linkEntities(t);return this._createFilteredProxy(o)}async getGallery(e={}){return e.pathParams={type:this.getEntityType(),id:this.id,docType:e.pathParams?.docType||"image"},await this.endpointApi.getGallery(e)}async requestToJoin(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._submitLinkRequest()}async requestToJoinAdmin(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._submitLinkRequestAdmin()}async acceptInvitation(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._acceptLinkRequest()}async leave(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour envoyer une demande de participation.");return this._checkLinkableEntity(),this._leaveLinkRequest()}async follow(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour suivre cette entité.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(!this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id},t=await this.callIsMe((()=>this.endpointApi.follow(e)));return await this.userContext.refresh(),t}throw new ApiError("Vous êtes déjà abonné à cette entité.")}async unfollow(){if(!this.isMe)throw new ApiError("Vous devez être connecté pour vous désabonner.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id,connectType:"followers"},t=await this.callIsMe((()=>this.endpointApi.disconnect(e)));return await this.userContext.refresh(),t}throw new ApiError("Vous n'êtes pas abonné à cette entité.")}_checkAccess(e="effectuer cette action"){if(!this.isMe)throw new ApiError(`Vous devez être connecté pour ${e}`);if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`)}_validateUserLink(e){if(!e)return!1;const{toBeValidated:t,isInviting:o}=e;return!t&&!o}_assertEntityType(...e){const t=Array.isArray(e[0])?e[0]:e;if(!t.includes(this.getEntityType()))throw new ApiError(`L'entité doit être de type : ${t.join(", ")}, reçu : ${this.getEntityType()}`)}_isLinked(e){return!!this.userContext?.serverData?.links?.[e]?.[this.id]}isAuthor(){if(this._checkAccess("vérifier l'auteur"),!this.serverData)throw new ApiError("Aucune donnée serveur disponible.");return this.userId&&this.serverData?.creator===this.userId}isAdmin(){this._checkAccess("vérifier l'administrateur."),this._assertEntityType("organizations","projects","events");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)&&!0===e?.isAdmin&&!e?.isAdminPending}isAuthorOrAdmin(){return this._checkAccess("vérifier l'auteur ou l'administrateur."),this.isAuthor()||this.isAdmin()}isMember(){this._checkAccess("vérifier le membre."),this._assertEntityType("organizations");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isContributor(){this._checkAccess("vérifier le contributeur."),this._assertEntityType("projects");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isAttendee(){this._checkAccess("vérifier si vous êtes un participant."),this._assertEntityType("events");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isFollower(){return this._checkAccess("vérifier si il vous suit."),this._assertEntityType("citoyens","organizations","projects","events","poi"),this._isLinked("followers")}isFollowing(){return this._checkAccess("vérifier si vous le suivez."),this._assertEntityType("citoyens","organizations","projects","events","poi"),this._isLinked("follows")}async getCostumJson(){if(!this.serverData.slug)throw new ApiError("slug de l'entité non défini");const e={pathParams:{slug:this.serverData.slug}};return this.endpointApi.getCostumJson(e)}_generateRanges(e,t,o={}){const n={};for(const r of e){const e=o[r]||{indexMax:0};n[r]={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 o=this.apiClient._endpoints.find((t=>t.constant===e));if(o?.request?.properties?.[t])return o.request.properties[t].default}_createPaginatorEngine({initialData:e,finalizer:t}){const o=this,n={cursor:void 0,count:0,index:0,history:[],sizes:[]},r=e=>e?.indexStep&&e.indexStep>0;async function i(s=!1){let a={...e};n.cursor&&(s||0!==n.history.length)||(n.count=0,n.index=0,n.history=[],n.sizes=[],a.countType=a.searchType,!a?.searchBy&&r(a)?(a.ranges=o._generateRanges(a.searchType,a.indexStep),a.indexMin=a.indexMin??0,a.indexMax=a.indexMax??a.indexStep):"ALL"===a?.searchBy&&r(a)&&(a.indexMin=a.indexMin??0,a.indexMax=a.indexMax??a.indexStep),n.cursor={...a});const c=n.cursor;if(s&&(n.history.push({...c}),!c.searchBy&&r(c)?(c.ranges=o._generateRanges(c.searchType,c.indexStep,c.ranges),c.indexMin=c.indexMax??0,c.indexMax=(c.indexMax??0)+c.indexStep):"ALL"===c.searchBy&&r(c)&&(c.indexMin=c.indexMax??0,c.indexMax=(c.indexMax??0)+c.indexStep),n.cursor={...c}),a={...n.cursor},!(s||a?.searchType&&Array.isArray(a.searchType)&&0!==a.searchType.length))throw new Error("searchType non défini");const p=await t(a);if(!Array.isArray(p.results))throw new Error("Les résultats doivent être un tableau");n.count+=p.results.length,n.sizes.push(p.results.length),s&&n.index++;const m=o._normalizeCount(p.count),d=o._linkEntities(p.results),l=r(a)&&n.count<m.total,u=n.history.length>0;return{count:m,results:d,pageIndex:n.index,pageNumber:n.index+1,hasNext:l,hasPrev:u,next:l?()=>i(!0):void 0,prev:u?async()=>{const e=n.history.pop(),t=n.sizes.pop()??0;return n.count-=t,n.index=Math.max(0,n.index-1),n.cursor={...e},i(!1)}:void 0}}return{next:()=>i(!1)}}_withCostumContext(e){return async t=>{const o={...t,costumSlug:this.serverData.slug,contextId:this.serverData.id,contextType:this.getEntityType(),sourceKey:[...t.sourceKey||[],this.serverData.slug]};return e(o)}}async searchCostum(e={}){return this._createPaginatorEngine({initialData:e,finalizer:this._withCostumContext((e=>this.endpointApi.globalAutocompleteCostum(e)))}).next()}async costumEventRequestActors(e={}){e={pathParams:{id:this.id,type:this.getEntityType()},...e};const t=this._withCostumContext((e=>this.endpointApi.costumEventRequestActors(e)));return await t(e)}async costumEventRequestSubevents(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestSubevents(e)))(e)}async costumEventRequestDates(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestDates(e)))(e)}async costumEventRequestElementEvent(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestElementEvent(e)))(e)}async costumEventRequestCategories(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestCategories(e)))(e)}async costumEventRequestEvent(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestEvent(e)))(e)}async costumEventRequestLinkTlToEvent(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestLinkTlToEvent(e)))(e)}async costumEventRequestLoadContextTag(e={}){return e={pathParams:{id:this.id,type:this.getEntityType()},...e},this._withCostumContext((e=>this.endpointApi.costumEventRequestLoadContextTag(e)))(e)}};class Badge extends Z{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=[];transforms={};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Badge.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Badge.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async getOrganizations(){throw new ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(){throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`)}async getEvents(){throw new ApiError(`getEvents n'existe pas dans ${this.constructor.name}`)}async getPois(){throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`)}async getBadgesIssuer(){throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`)}async getNews(){throw new ApiError(`getNews n'existe pas dans ${this.constructor.name}`)}async getSubscribers(){throw new ApiError(`getSubscribers n'existe pas dans ${this.constructor.name}`)}async project(){throw new ApiError(`project n'existe pas dans ${this.constructor.name}`)}async poi(){throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`)}async event(){throw new ApiError(`event n'existe pas dans ${this.constructor.name}`)}async badge(){throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`)}async news(){throw new ApiError(`news n'existe pas dans ${this.constructor.name}`)}}const J=class EndpointApi{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 o=await this.apiClient.callEndpoint(e,t);return this.apiClient.checkAndThrowApiResponseError(o),o.data}))}async callNoConnected(e,t={}){if(this.isConnected)throw new ApiAuthenticationError("Vous ne devez pas être connecté pour faire cette action.");return this.call(e,t)}async callIsConnected(e,t={}){if(!this.isConnected)throw new ApiAuthenticationError("Vous devez être connecté pour effectuer cette action.");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 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)}};class Event extends Z{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:e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{type:t?.type??null,name:t?.name??null}]))):null,organizer:e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{type:t?.type??null,name:t?.name??null}]))):null};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Event.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAdmin())throw new ApiError("Vous n'avez pas les droits pour modifier cet événement",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");let t=!1;const o=this._extractAllValidFieldsFromSchema(this.apiClient,"ADD_EVENT",{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);o&&Object.keys(o).length>0&&(await this.addEvent(o),t=!0),e.id&&delete e.id;for(const[o,n]of Event.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addEvent(e={}){return this.isMe||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 ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(){throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`)}async getEvents(){throw new ApiError(`getEvents - les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`)}async getPois(){throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`)}async getBadgesIssuer(){throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async project(){throw new ApiError(`project n'existe pas dans ${this.constructor.name}`)}async poi(){throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`)}async event(){throw new ApiError(`les sous-events ne sont pas encore implémentés dans ${this.constructor.name}`)}async badge(){throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`)}async news(e={}){return super.news(e)}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class News extends Z{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=[];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}:void 0},mediaFile:e=>{const t=e?.files?.map((e=>e.id)).filter(Boolean)||[];return t.length>0?{countFiles:t.length,files:t}:void 0}};async get(){if(!this.id)throw new ApiError("Impossible de rafraîchir sans ID.");const e=await this.callIsConnected((()=>this.endpointApi.getNewsById({ids:[this.id]})));if(e&&Array.isArray(e)&&1===e.length){const t=e[0];return this._setData(t),this.serverData}throw new ApiError(`Aucune actualité trouvée pour l'ID ${this.id}`)}async _add(e){if(!this._calledFromSave)throw new Error("utilisation invalide de _add, utilisez save");""===e.text&&(e.text=" "),e.parentId=this.parent.id,e.parentType=this.parent.getEntityType();for(const[t,o]of News.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.object?.id&&(this._draftData.id=e.object.id)}}}async _update(e){if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");e.id&&delete e.id,""===e?.text&&(e.text=" "),e.parentId=this.parent.id,e.parentType=this.parent.getEntityType(),e.idNews=this.id;let t=!1;const o=await this.callIsConnected((()=>this.endpointApi.updateNews(e)));return o?.object&&(this._serverData={...o.object}),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 ApiError("Vous devez fournir un slug ou un id pour ajouter une mention.");const o=await this.entity("citoyens",{id:t,slug:e}),n=o.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 r={id:n.id,slug:n.slug,type:o.getEntityType(),name:n.name,value:n.name,count:1};return this._draftData.mentions.push(r),this._draftData.mentions}catch(e){throw this.apiClient._logger.error("Erreur lors de l'ajout de la mention :",e),e}}async addImage(e){e=await this._validateImage(e);const t={pathParams:{folder:this.parent.getEntityType(),ownerId:this.parent.id},newsImage:e},o=await this.callIsConnected((()=>this.endpointApi.addImageNews(t)));return this._draftData.mediaImg?(this._draftData.mediaImg.countImages=this._draftData.mediaImg.countImages+1,this._draftData.mediaImg.images.push(o.id)):this._draftData.mediaImg={countImages:1,images:[o.id]},o}async addFile(e){e=await this._validateFile(e);const t={pathParams:{folder:this.parent.getEntityType(),ownerId:this.parent.id},newsFile:e},o=await this.callIsConnected((()=>this.endpointApi.addFileNews(t)));return this._draftData.mediaFile?(this._draftData.mediaFile.countFiles=this._draftData.mediaFile.countFiles+1,this._draftData.mediaFile.files.push(o)):this._draftData.mediaFile={countFiles:1,files:[o]},o}async delete(){if(!this.id)throw new ApiError("Vous devez fournir un id pour supprimer une news.");const e={pathParams:{id:this.id}};await this.callIsConnected((()=>this.endpointApi.deleteNews(e))),this._draftData={},this._serverData=null,this._draftData.id=null,this._isDeleted=!0}}class Organization extends Z{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"];static ADD_BLOCKS=new Map([["ADD_ORGANIZATION","addOrganization"],["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:(e,t)=>t?.socialNetwork?.github,gitlab:(e,t)=>t?.socialNetwork?.gitlab,facebook:(e,t)=>t?.socialNetwork?.facebook,twitter:(e,t)=>t?.socialNetwork?.twitter,instagram:(e,t)=>t?.socialNetwork?.instagram,diaspora:(e,t)=>t?.socialNetwork?.diaspora,mastodon:(e,t)=>t?.socialNetwork?.mastodon,telegram:(e,t)=>t?.socialNetwork?.telegram,signal:(e,t)=>t?.socialNetwork?.signal};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Organization.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAdmin())throw new ApiError("Vous n'avez pas les droits pour modifier cette organisation",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Organization.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addOrganization(e={}){return this.callIsConnected((()=>this.endpointApi.addOrganization(e)))}async getOrganizations(){throw new ApiError("getOrganizations n'existe pas dans Organization")}async getProjects(e={}){return super.getProjects(e)}async getEvents(){throw new ApiError("getEvents pas encore implémenté dans Organization")}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={}){return e.searchType=this._getDefaultFromEndpoint("GET_MEMBERS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>{const{toBeValidated:o,isAdmin:n,isAdminPending:r,isInviting:i,roles:s=[]}=t;return this.isMe?(e.pathParams={type:this.getEntityType(),id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"memberOf",toBeValidated:o,isAdmin:n,isAdminPending:r,isInviting:i,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"memberOf",toBeValidated:!1,isAdmin:n,isInviting:i,roles:s})),(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 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 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 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 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 requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}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)}}class Poi extends Z{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={};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Poi.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAuthor())throw new ApiError("Vous n'avez pas les droits pour modifier ce POI",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Poi.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addPoi(e={}){return this.isMe||(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 ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(){throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`)}async getEvents(){throw new ApiError(`getEvents n'existe pas dans${this.constructor.name}`)}async getPois(){throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`)}async getBadgesIssuer(){throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`)}async getNews(e={}){return super.getNews(e)}async getSubscribers(e={}){return super.getSubscribers(e)}async project(){throw new ApiError(`project n'existe pas dans ${this.constructor.name}`)}async poi(){throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`)}async event(){throw new ApiError(`event n'existe pas dans ${this.constructor.name}`)}async badge(){throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`)}async news(e={}){return super.news(e)}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class Project extends Z{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:(e,t)=>t?.socialNetwork?.github,gitlab:(e,t)=>t?.socialNetwork?.gitlab,facebook:(e,t)=>t?.socialNetwork?.facebook,twitter:(e,t)=>t?.socialNetwork?.twitter,instagram:(e,t)=>t?.socialNetwork?.instagram,diaspora:(e,t)=>t?.socialNetwork?.diaspora,mastodon:(e,t)=>t?.socialNetwork?.mastodon,telegram:(e,t)=>t?.socialNetwork?.telegram,signal:(e,t)=>t?.socialNetwork?.signal,parent:e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,{type:t?.type??null,name:t?.name??null}]))):null};async _add(e){if(!this._calledFromSave)throw new ApiError("utilisation invalide de _add, utilisez save");e.id=this._newId?.(),e.slug&&delete e.slug;for(const[t,o]of Project.ADD_BLOCKS){const n=this._extractChangedFieldsFromSchema(this.apiClient,t,{...e,...this.defaultFields},(()=>{}));if(n&&Object.keys(n).length>0){const e=await this[o](n);!this.id&&e?.map?.id&&(this._draftData.id=e.map.id,this._draftData.slug=e.map.slug)}}}async _update(e){if(!this.isAdmin())throw new ApiError("Vous n'avez pas les droits pour modifier ce projet",403);if(!this._calledFromSave)throw new ApiError("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of Project.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}async addProject(e={}){return this.isMe||(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 ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`)}async getProjects(e={}){return super.getProjects(e)}async getEvents(){throw new ApiError(`getEvents pas encore implémenté dans ${this.constructor.name}`)}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,finalizer:async e=>{const{toBeValidated:o,isAdmin:n,isInviting:r,isAdminPending:i,roles:s=[]}=t;return this.isMe?(e.pathParams={type:this.getEntityType(),id:this.id},e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:o,isAdmin:n,isAdminPending:i,isInviting:r,roles:s})):(delete e?.pathParams,e.filters=this._buildLinkFilters(this.id,{linkType:"projects",toBeValidated:!1,isAdmin:n,isInviting:r,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 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 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 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 ApiError("Vous n'avez pas les droits pour créer un badge dans ce projet",403);return super.badge(e)}async news(e={}){return super.news(e)}async requestToJoin(){return super.requestToJoin()}async requestToJoinAdmin(){return super.requestToJoinAdmin()}async acceptInvitation(){return super.acceptInvitation()}async leave(){return super.leave()}async follow(){return super.follow()}async unfollow(){return super.unfollow()}}class User extends Z{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:(e,t)=>t?.socialNetwork?.github,gitlab:(e,t)=>t?.socialNetwork?.gitlab,facebook:(e,t)=>t?.socialNetwork?.facebook,twitter:(e,t)=>t?.socialNetwork?.twitter,instagram:(e,t)=>t?.socialNetwork?.instagram,diaspora:(e,t)=>t?.socialNetwork?.diaspora,mastodon:(e,t)=>t?.socialNetwork?.mastodon,telegram:(e,t)=>t?.socialNetwork?.telegram,signal:(e,t)=>t?.socialNetwork?.signal};constructor(e,t={},o={}){if(!o.EndpointApi)throw new ApiError("EndpointApi class must be injected to avoid circular dependency.");if(!t?.id&&!t?.slug)throw new ApiError("Vous devez fournir un id ou un slug pour créer un User.");if(!o.Organization)throw new ApiError("Organization class must be injected.");if(!o.Project)throw new ApiError("Project class must be injected.");if(!o.Event)throw new ApiError("Event class must be injected.");if(!o.Poi)throw new ApiError("Poi class must be injected.");if(!o.Badge)throw new ApiError("Badge class must be injected.");if(!o.News)throw new ApiError("News class must be injected.");super(e,t,o)}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}async get(){return this.apiClient.safeCall((async()=>{if(this.isMe){const e=await this.endpointApi.meInfoUrl();return this._setData(e),e}{const e=await this._getPublicProfile();return this._setData(e),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 ApiError("Vous devez être connecté et être l'utilisateur pour sauvegarder.");await super.save()}async _add(){throw new ApiError("Vous ne pouvez pas ajouter un utilisateur par ce moyen.")}async _update(e){if(!this._calledFromSave)throw new Error("utilisation invalide de _update, utilisez save");e.id&&delete e.id;let t=!1;for(const[o,n]of User.UPDATE_BLOCKS){const r=this._extractChangedFieldsFromSchema(this.apiClient,o,{...e,...this.defaultFields},(()=>this.initialDraftData),this.removeFields);r&&Object.keys(r).length>0&&(await this[n](r),t=!0)}return t}static fromServerData(e,t,o){const n=new User(t.apiClient,e,o);return("object"==typeof e||Object.keys(e).length>0)&&n._setData(e),n}async updateSettings(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les paramètres.");await super.updateSettings(e),await this.refresh()}async updateDescription(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la description.");return super.updateDescription(e)}async updateInfo(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les informations.");return super.updateInfo(e)}async updateSocial(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour les réseaux sociaux.");return super.updateSocial(e)}async updateLocality(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour la localité.");return super.updateLocality(e)}async updateSlug({slug:e}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour le slug.");return super.updateSlug({slug:e})}async updateImageProfil({profil_avatar:e}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour mettre à jour l'image de profil.");return super.updateImageProfil({profil_avatar:e})}async getOrganizations(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_ORGANIZATIONS_NO_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,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 getPois(e={}){return super.getPois(e)}async getNews(e={}){return super.getNews(e)}async getFriends(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_FRIENDS_ADMIN","searchType"),this._createPaginatorEngine({initialData:e,finalizer:async e=>(delete e?.pathParams,this.isMe||(e.pathParams={id:this.id}),this.endpointApi.getFriendsAdmin(e))}).next()}async getSubscriptions(e={}){return e.searchType=this._getDefaultFromEndpoint("GET_SUBSCRIPTIONS","searchType"),this._createPaginatorEngine({initialData:e,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 ApiError("Vous devez être connecté et être l'utilisateur");if(!e.id&&!e.slug)throw new ApiError("Vous devez fournir un id ou un slug pour créer un User.");const t=new User(this,e,this.deps);return await t.get(),t}async organization(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer une organisation.");return super.organization(e)}async project(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un projet.");return super.project(e)}async news(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer une actualité.");return super.news(e)}async poi(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un POI.");return super.poi(e)}async event(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un événement.");return super.event(e)}async badge(e={}){if(!this.isMe)throw new ApiError("Vous devez être connecté et être l'utilisateur pour créer un badge.");return super.badge(e)}async sendFriendRequest(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour envoyer une demande d'amis.");if(this._checkLinkableEntity(),!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeConnect:e}=this._getLinkMeta(),t=this._getLinkFromConnectedUser();if(!t){const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.endpointApi.connect(t);return await this.userContext.refresh(),o}if(t.isInviting&&t.invitorId===this.id)return this.acceptFriendRequest();if(t.isInviting&&t.invitorId===this.userId)throw new ApiError("Vous avez déjà envoyé une demande d'amis à cet utilisateur.");throw new ApiError("Vous êtes déjà connecté à cette entité.")}async acceptFriendRequest(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour accepter une demande d'amitié.");if(this._checkLinkableEntity(),!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const e=this._getLinkFromConnectedUser();if(e?.isInviting&&e.invitorId===this.id){const e={parentType:this.getEntityType(),parentId:this.id,linkOption:"isInviting"},t=await this.endpointApi.linkValidate(e);return await this.userContext.refresh(),t}throw new ApiError("Vous n'avez pas d'invitation à valider.")}async removeFriend(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour supprimer un ami.");if(this._checkLinkableEntity(),!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);const{connectTypeDisconnect:e}=this._getLinkMeta();if(!this._getLinkFromConnectedUser())throw new ApiError("Vous n'êtes pas connecté à cette entité.");const t={parentType:this.getEntityType(),parentId:this.id,connectType:e},o=await this.endpointApi.disconnect(t);return await this.userContext.refresh(),o}requestToJoin(){throw new ApiError("l'utilisation de requestToJoin n'est pas autorisée sur un utilisateur.")}requestToJoinAdmin(){throw new ApiError("l'utilisation de requestToJoinAdmin n'est pas autorisée sur un utilisateur.")}acceptInvitation(){throw new ApiError("l'utilisation de acceptInvitation n'est pas autorisée sur un utilisateur.")}leave(){throw new ApiError("l'utilisation de leave n'est pas autorisée sur un utilisateur.")}async follow(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour suivre un utilisateur.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(!this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id},t=await this.endpointApi.follow(e);return await this.userContext.refresh(),t}throw new ApiError("Vous êtes déjà abonné à cet utilisateur.")}async unfollow(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vous désabonner d'un utilisateur.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);if(this.userContext?.serverData?.links?.follows?.[this.id]){const e={parentType:this.getEntityType(),parentId:this.id,connectType:"followers"},t=await this.endpointApi.disconnect(e);return await this.userContext.refresh(),t}throw new ApiError("Vous n'êtes pas abonné à cet utilisateur.")}isFriend(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vérifier si vous êtes ami.");this._assertEntityType("citoyens");const e=this._getLinkFromConnectedUser();return this._validateUserLink(e)}isFollower(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vérifier si il vous suit.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);return this._assertEntityType("citoyens"),this._isLinked("followers")}isFollowing(){if(!this.isActingUser)throw new ApiError("Vous devez être connecté pour vérifier si vous le suivez.");if(!this.id)throw new ApiError(`${this.constructor.name} non enregistrée.`);return this._assertEntityType("citoyens"),this._isLinked("follows")}}Object.assign(User.prototype,{});const W=(e=>{var t={};return _.d(t,e),t})({EventEmitter:()=>a.EventEmitter}),Q=(e=>{var t={};return _.d(t,e),t})({AggregateAjvError:()=>c.AggregateAjvError}),H=(e=>{var t={};return _.d(t,e),t})({default:()=>p.default}),Y=(e=>{var t={};return _.d(t,e),t})({default:()=>m.default}),X=(e=>{var t={};return _.d(t,e),t})({default:()=>d.default}),ee=(e=>{var t={};return _.d(t,e),t})({default:()=>l.default}),te=(e=>{var t={};return _.d(t,e),t})({jwtDecode:()=>u.jwtDecode}),oe=(e=>{var t={};return _.d(t,e),t})({default:()=>h.default}),ne={_looksLikeObjectID:e=>24===e.length&&/^[0-9a-f]*$/.test(e),ObjectID:class ObjectID{constructor(e){if(e){if(e=e.toLowerCase(),!ne._looksLikeObjectID(e))throw new Error("Invalid hexadecimal string for creating an ObjectID");this._str=e}}equals(e){return e instanceof ne.ObjectID&&this.valueOf()===e.valueOf()}toString(){return`ObjectID("${this._str}")`}clone(){return new ne.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()}}},re=ne,ie={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:[{items:{type:"string"},type:"array"},{enum:[""],type:"string"}]},common31:{items:{type:"string"},type:"array"},common32:{enum:[""],type:"string"},common33:{properties:{name:{not:{type:"null"}}},required:["name"]},common34:{name:{not:{type:"null"}}},common35:{properties:{url:{not:{type:"null"}}},required:["url"]},common36:{url:{not:{type:"null"}}},common37:{properties:{tags:{not:{type:"null"}}},required:["tags"]},common38:{tags:{not:{type:"null"}}},common39:{properties:{email:{not:{type:"null"}}},required:["email"]},common40:{email:{not:{type:"null"}}},common41:{format:"date",type:"string"},common42:{const:"info",default:"info",type:"string"},common43:{$ref:"#/$defs/sharedFields/email"},common44:{$ref:"#/$defs/sharedFields/name"},common45:{$ref:"#/$defs/sharedFields/tags"},common46:{default:"citoyens",enum:["citoyens"],type:"string"},common47:{$ref:"#/$defs/sharedFields/url"},common48:{properties:{avancement:{not:{type:"null"}}},required:["avancement"]},common49:{avancement:{not:{type:"null"}}},common50:{properties:{parent:{not:{type:"null"}}},required:["parent"]},common51:{parent:{not:{type:"null"}}},common52:{additionalProperties:!1,patternProperties:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},type:"object"},common53:{"^[a-fA-F0-9]{24}$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"}},common54:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type","name"],type:"object"},common55:{name:{type:"string"},type:{type:"string"}},common56:{properties:{type:{not:{type:"null"}}},required:["type"]},common57:{type:{not:{type:"null"}}},common58:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},type:"object"},common59:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"}},common60:{additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"}},required:["type"],type:"object"},common61:{enum:["workshop","competition","concert","contest","conference","debate","exhibition","festival","crowdfunding","fair","course","protest","market","film","getTogether","meeting","spectacle","internship","stand","others"],type:"string"},common62:{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"},common63:{enum:["poi"],type:"string"},common64:{$ref:"#/$defs/socialField"},common65:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},common66:{properties:{id:{pattern:"^[a-f0-9]{24}$"}}},common67:{id:{pattern:"^[a-f0-9]{24}$"}},common68:{pattern:"^[a-f0-9]{24}$"},common69:{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"},common70:{"@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"}},common71:{const:"PostalAddress",type:"string"},common72:{minLength:0,type:"string"},common73:{additionalProperties:!1,properties:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},required:["latitude","longitude"],type:"object"},common74:{"@type":{const:"GeoCoordinates",type:"string"},latitude:{type:["string","number"]},longitude:{type:["string","number"]}},common75:{const:"GeoCoordinates",type:"string"},common76:{type:["string","number"]},common77:{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"},common78:{coordinates:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},float:{const:!0,default:!0,type:"boolean"},type:{const:"Point",type:"string"}},common79:{items:{type:"number"},maxItems:2,minItems:2,type:"array"},common80:{type:"number"},common81:{const:!0,default:!0,type:"boolean"},common82:{const:"Point",type:"string"},common83:{properties:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common84:{id:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common85:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"},common86:{maxLength:100,minLength:3,pattern:"^[a-zA-Z0-9]+$",type:"string"},common87:{properties:{type:{const:"citoyens"}}},common88:{type:{const:"citoyens"}},common89:{properties:{ownerId:{pattern:"^[a-f0-9]{24}$"}}},common90:{ownerId:{pattern:"^[a-f0-9]{24}$"}},common91:{properties:{folder:{const:"citoyens"}}},common92:{folder:{const:"citoyens"}},common93:{properties:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common94:{ownerId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common95:{properties:{parentId:{pattern:"^[a-f0-9]{24}$"}}},common96:{parentId:{pattern:"^[a-f0-9]{24}$"}},common97:{properties:{parentType:{const:"citoyens"}}},common98:{parentType:{const:"citoyens"}},common99:{properties:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common100:{parentId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common101:{default:!0,type:"boolean"},common102:{default:0,type:"integer"},common103:{required:["text"]},common104:{required:["mediaImg"]},common105:{required:["mediaFile"]},common106:{additionalProperties:!1,properties:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},required:["countFiles","files"],type:"object"},common107:{countFiles:{type:"number"},files:{items:{type:"string"},type:"array"}},common108:{additionalProperties:!1,properties:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},required:["countImages","images"],type:"object"},common109:{countImages:{type:"number"},images:{items:{type:"string"},type:"array"}},common110:{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"},common111:{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"},common112:{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"}},common113:{minimum:1,type:"integer"},common114:{default:"public",enum:["public","private","restricted"],type:"string"},common115:{const:"news",default:"news",type:"string"},common116:{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"},common117:{folder:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"},ownerId:{type:"string"}},common118:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"}},required:["id"],type:"object"},common119:{default:!1,type:"boolean"},common120:{properties:{childId:{pattern:"^[a-f0-9]{24}$"}}},common121:{childId:{pattern:"^[a-f0-9]{24}$"}},common122:{properties:{childType:{const:"citoyens"}}},common123:{childType:{const:"citoyens"}},common124:{const:"share",default:"share",type:"string"},common125:{properties:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}}},common126:{childId:{default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$"}},common127:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},required:["type","id"],type:"object"},common128:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"news",enum:["news"],type:"string"}},common129:{default:"news",enum:["news"],type:"string"},common130:{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"},common131:{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"},common132:{count:{type:"number"},id:{pattern:"^[a-f0-9]{24}$",type:"string"},name:{type:"string"},slug:{type:"string"},type:{type:"string"},value:{type:"string"}},common133:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],type:"string"},common134:{const:!1,default:!1,type:"boolean"},common135:{const:"",default:"",type:"string"},common136:{default:0,type:"number"},common137:{default:30,type:"number"},common138:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},type:"object"},common139:{"^[^\\s]+$":{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"}},common140:{additionalProperties:!1,properties:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},required:["id","type"],type:"object"},common141:{id:{type:"string"},type:{enum:["cities","level1"],type:"string"}},common142:{enum:["cities","level1"],type:"string"},common143:{additionalProperties:!1,patternProperties:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},type:"object"},common144:{"^[^\\s]+$":{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"}},common145:{additionalProperties:!1,properties:{indexMax:{type:"number"},indexMin:{type:"number"}},required:["indexMin","indexMax"],type:"object"},common146:{indexMax:{type:"number"},indexMin:{type:"number"}},common147:{enum:["ALL"],type:"string"},common148:{default:0,minimum:0,type:"integer"},common149:{const:["projects"],default:["projects"],items:{enum:["projects"],type:"string"},type:"array"},common150:{enum:["projects"],type:"string"},common151:{$exists:!0},common152:{additionalProperties:!1,properties:{$exists:{const:!0}},required:["$exists"],type:"object"},common153:{$exists:{const:!0}},common154:{const:!0},common155:{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"},common156:{id:{type:"string"},type:{default:"citoyens",enum:["citoyens","projects","organizations"],type:"string"}},common157:{const:["poi"],default:["poi"],items:{enum:["poi"],type:"string"},type:"array"},common158:{const:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],default:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],items:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},type:"array"},common159:{enum:["NGO","Cooperative","LocalBusiness","Group","GovernmentOrganization"],type:"string"},common160:{$exists:!1},common161:{additionalProperties:!1,properties:{$exists:{const:!1}},required:["$exists"],type:"object"},common162:{$exists:{const:!1}},common163:{const:!1},common164:{default:30,type:"integer"},common165:{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"},common166:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common167:{additionalProperties:!1,properties:{$exists:{default:!1,type:"boolean"}},required:["$exists"],type:"object"},common168:{$exists:{default:!1,type:"boolean"}},common169:{additionalProperties:!1,properties:{$in:{items:{type:"string"},minItems:1,type:"array"}},required:["$in"],type:"object"},common170:{$in:{items:{type:"string"},minItems:1,type:"array"}},common171:{items:{type:"string"},minItems:1,type:"array"},common172:{const:["citoyens"],default:["citoyens"],items:{enum:["citoyens"],type:"string"},type:"array"},common173:{enum:["citoyens"],type:"string"},common174:{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"},common175:{enum:["citoyens","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects"],type:"string"},common176:{not:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common177:{propertyNames:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common178:{pattern:"^(?!links\\.followers\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common179:{"^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"}},common180:{not:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}}},common181:{propertyNames:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"}},common182:{pattern:"^(?!links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$)"},common183:{default:"citoyens",enum:["citoyens","organizations","projects"],type:"string"},common184:{const:["badges"],default:["badges"],items:{enum:["badges"],type:"string"},type:"array"},common185:{enum:["badges"],type:"string"},common186:{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"},common187:{enum:["citoyens","projects","NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},common188:{additionalProperties:!1,properties:{$exists:{const:!0,type:"boolean"}},required:["$exists"],type:"object"},common189:{$exists:{const:!0,type:"boolean"}},common190:{const:!0,type:"boolean"},common191:{additionalProperties:!1,properties:{$exists:{const:!1,type:"boolean"}},required:["$exists"],type:"object"},common192:{$exists:{const:!1,type:"boolean"}},common193:{const:!1,type:"boolean"},common194:{"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"}},common195:{indexMax:30,indexMin:0},common196:{properties:{parentType:{const:"organizations"}}},common197:{parentType:{const:"organizations"}},common198:{properties:{parentType:{const:"projects"}}},common199:{parentType:{const:"projects"}},common200:{properties:{parentType:{const:"events"}}},common201:{parentType:{const:"events"}},common202:{default:"@userId",pattern:"^([a-f0-9]{24}|@\\w+)$",type:"string"},common203:{const:"citoyens",default:"citoyens",enum:["citoyens"],type:"string"},common204:{enum:["citoyens","organizations","projects","events"],type:"string"},common205:{const:"citoyens",default:"citoyens",type:"string"},common206:{const:"@userId",default:"@userId",pattern:"^(?:[a-f0-9]{24}|@userId)$",type:"string"},common207:{default:{isOpenData:!0,isOpenEdition:!0},properties:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},required:["isOpenData","isOpenEdition"],type:"object"},common208:{isOpenData:!0,isOpenEdition:!0},common209:{isOpenData:{default:!0,type:"boolean"},isOpenEdition:{default:!0,type:"boolean"}},common210:{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"},common211:{"@userId":{type:"citoyens"}},common212:{type:"citoyens"},common213:{const:"poi",default:"poi",type:"string"},common214:{const:"events",default:"events",type:"string"},common215:{format:"date-time",type:"string"},common216:{pattern:"^([01]\\d|2[0-3]):[0-5]\\d$",type:"string"},common217:{type:"integer"},common218:{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"},common219:{id:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},type:{const:"citoyens",default:"citoyens",type:"string"}},common220:{default:"@userId",pattern:"^[a-f0-9]{24}$",type:"string"},common221:{const:"badges",default:"badges",type:"string"},common222:{const:"badge",default:"badge",type:"string"},common223:{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"},common224:{"^[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"}},common225:{additionalProperties:!1,properties:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},required:["name"],type:"object"},common226:{isAdmin:{default:"",enum:["","admin"],type:"string"},name:{type:"string"},roles:{items:{type:"string"},type:"array"}},common227:{default:"",enum:["","admin"],type:"string"},common228:{enum:["projects","organizations"],type:"string"},common229:{items:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi"],type:"string"},type:"array"},common230:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","organizations","projects","events","citoyens","poi"],type:"string"},common231:{additionalProperties:!1,properties:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},required:["id","type"],type:"object"},common232:{id:{pattern:"^[a-f0-9]{24}$",type:"string"},type:{default:"events",type:"string"}},common233:{default:"events",type:"string"},common234:{items:{properties:{id:{type:"string"}},required:["id"],type:"object"},type:"array"},common235:{properties:{id:{type:"string"}},required:["id"],type:"object"},common236:{id:{type:"string"}},common237:{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"},common238:{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"}}},se=[{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:ie.common1,email:ie.common2,isInvitation:ie.common3,mode:ie.common1,name:ie.common1,pendingUserId:ie.common1,pwd:ie.common1,username:ie.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:ie.common2,password:ie.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:ie.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:ie.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:ie.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:ie.common1,newPassword2:ie.common1,oldPassword:ie.common1,scope:{default:"",type:["string"]},userId:ie.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:ie.common6,postActions:[{type:"resetSession"},{event:"accountDeleted",path:null,type:"emitEvent"}],request:ie.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:ie.common11}},if:{properties:{typeEntity:ie.common12}},then:{properties:{idEntity:ie.common5}}},{if:{properties:{type:{enum:["birthDate","email","locality","phone","directory"]},typeEntity:ie.common12}},then:{properties:{value:{enum:["private","public","mask"],type:"string"}}}},{if:{properties:{type:{enum:["activitypub","isOpenData"]},typeEntity:ie.common12}},then:ie.common13},{if:{properties:{type:ie.common15,typeEntity:ie.common16}},then:ie.common13},{if:{properties:{type:ie.common15,typeEntity:ie.common17}},then:ie.common13},{if:{properties:{type:{enum:["isOpenData","isOpenEdition","public"]},typeEntity:ie.common18}},then:ie.common13}],properties:{idEntity:ie.common1,type:ie.common1,typeEntity:ie.common19,value:ie.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:[ie.common21,{anyOf:[{properties:{description:ie.common27},required:["description"]},{properties:{shortDescription:ie.common27},required:["shortDescription"]}]}],properties:{block:{const:"descriptions",default:"descriptions",type:"string"},descMentions:ie.common10,description:ie.common1,id:ie.common1,scope:{default:"",type:["string","null"]},shortDescription:ie.common1,typeElement:ie.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:ie.common2,name:ie.common1,tags:ie.common30,url:ie.common4}},allOf:[{if:ie.common24,then:{additionalProperties:!1,anyOf:[ie.common33,{properties:{birthDate:ie.common27},required:["birthDate"]},{properties:{fixe:ie.common27},required:["fixe"]},{properties:{mobile:ie.common27},required:["mobile"]},ie.common35,ie.common37,ie.common39],properties:{birthDate:ie.common41,block:ie.common42,email:ie.common43,fixe:ie.common1,id:ie.common5,mobile:ie.common1,name:ie.common44,scope:ie.common10,tags:ie.common45,typeElement:ie.common46,url:ie.common47}}},{if:{properties:{typeElement:ie.common17}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common48,ie.common50],properties:{avancement:{enum:["abandoned","concept","development","production","started","testing","idea","mature","qa","finished"],type:"string"},block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,parent:ie.common52,scope:ie.common10,tags:ie.common45,typeElement:{default:"citoyens",enum:["projects"],type:"string"},url:ie.common47}}},{if:{properties:{typeElement:ie.common18}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common48,ie.common56,{properties:{organizer:ie.common27},required:["organizer"]},ie.common50],properties:{block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,organizer:ie.common58,parent:ie.common52,scope:ie.common10,tags:ie.common45,type:ie.common61,typeElement:{default:"citoyens",enum:["events"],type:"string"},url:ie.common47}}},{if:{properties:{typeElement:ie.common16}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common56],properties:{block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,scope:ie.common10,tags:ie.common45,type:{enum:["NGO","Cooperative","LocalBusiness","GovernmentOrganizationautre"],type:"string"},typeElement:{enum:["organizations"],type:"string"},url:ie.common47}}},{if:{properties:{typeElement:{const:"poi"}}},then:{additionalProperties:!1,anyOf:[ie.common33,ie.common35,ie.common37,ie.common39,ie.common56,{properties:{urls:ie.common27},required:["urls"]}],properties:{block:ie.common42,email:ie.common43,id:ie.common1,name:ie.common44,scope:ie.common10,tags:ie.common45,type:ie.common62,typeElement:ie.common63,url:ie.common47,urls:ie.common31}}}],properties:{block:ie.common42,id:ie.common1,scope:ie.common10,typeElement:ie.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:[ie.common32,ie.common4]}},allOf:[ie.common21,{anyOf:[{properties:{gitlab:ie.common27},required:["gitlab"]},{properties:{github:ie.common27},required:["github"]},{properties:{twitter:ie.common27},required:["twitter"]},{properties:{facebook:ie.common27},required:["facebook"]},{properties:{instagram:ie.common27},required:["instagram"]},{properties:{diaspora:ie.common27},required:["diaspora"]},{properties:{mastodon:ie.common27},required:["mastodon"]},{properties:{telegram:ie.common27},required:["telegram"]},{properties:{signal:ie.common27},required:["signal"]}]}],properties:{block:{const:"network",default:"network",type:"string"},diaspora:ie.common64,facebook:ie.common64,github:ie.common64,gitlab:ie.common64,id:ie.common1,instagram:ie.common64,mastodon:ie.common64,scope:ie.common10,signal:ie.common64,telegram:ie.common64,twitter:ie.common64,typeElement:ie.common65},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:ie.common66,if:ie.common24,properties:{address:ie.common69,block:{const:"localities",default:"localities",type:"string"},geo:ie.common73,geoPosition:ie.common77,id:ie.common1,scope:ie.common10,typeElement:ie.common29},required:["block","typeElement","id","address"],then:ie.common83,type:"object"}},{auth:"bearer",constant:"UPDATE_BLOCK_SLUG",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updateblock/",request:{else:ie.common66,if:ie.common24,properties:{block:ie.common42,id:ie.common1,scope:ie.common10,slug:ie.common86,typeElement:ie.common29},required:["block","typeElement","id","slug"],then:ie.common83,type:"object"}},{auth:"bearer",constant:"CHECK",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/slug/check",request:{additionalProperties:!1,else:ie.common66,if:ie.common87,properties:{block:ie.common42,id:ie.common1,slug:ie.common86,type:ie.common19},required:["block","type","id","slug"],then:ie.common83,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:{additionalProperties:!1,else:ie.common89,if:ie.common91,properties:{folder:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi"],type:"string"},ownerId:ie.common1},required:["folder","ownerId"],then:ie.common93,type:"object"},request:{additionalProperties:!1,properties:{profil_avatar:ie.common20},required:["profil_avatar"],type:"object"}},{auth:"none",constant:"GET_ELEMENTS_ABOUT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/about/type/{type}/id/{id}/json/true",pathParams:{additionalProperties:!1,else:ie.common66,if:ie.common87,properties:{id:ie.common1,type:{default:"citoyens",enum:["citoyens","projects","organizations","events","poi","badges"],type:"string"}},required:["type","id"],then:ie.common83,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:ie.common95,if:ie.common97,properties:{listInvite:{additionalProperties:!1,patternProperties:{"^(citoyens|projects|organizations)$":{additionalProperties:!1,patternProperties:{"^[0-9a-fA-F]{24}$":{additionalProperties:!1,properties:{name:ie.common1},required:["name"],type:"object"}},type:"object"}},type:"object"},parentId:ie.common1,parentType:ie.common65},required:["parentId","parentType","listInvite"],then:ie.common99,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:ie.common66,if:ie.common87,properties:{id:ie.common1,isLive:ie.common101,type:ie.common65},required:["isLive","type","id"],then:ie.common83,type:"object"},request:{additionalProperties:!1,properties:{dateLimit:ie.common102,indexStep:{default:12,type:"integer"},search:{additionalProperties:!1,properties:{name:ie.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:ie.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:[ie.common103,ie.common104,ie.common105],else:ie.common95,if:ie.common97,properties:{json:ie.common81,markdownActive:ie.common101,mediaFile:ie.common106,mediaImg:ie.common108,mentions:ie.common110,parentId:ie.common1,parentType:ie.common65,scope:ie.common114,tags:ie.common30,text:ie.common1,type:ie.common115},required:["scope","markdownActive","parentId","parentType","type","json"],then:ie.common99,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:ie.common116,request:{additionalProperties:!1,properties:{newsImage:ie.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:ie.common116,request:{additionalProperties:!1,properties:{newsFile:ie.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:ie.common118,request:{additionalProperties:!1,properties:{isLive:ie.common119},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:[ie.common103,ie.common104,ie.common105],else:ie.common95,if:ie.common97,properties:{idNews:ie.common11,markdownActive:ie.common101,mediaFile:ie.common106,mediaImg:ie.common108,mentions:ie.common110,parentId:ie.common1,parentType:ie.common65,scope:ie.common114,tags:ie.common30,text:ie.common1,type:ie.common115},required:["idNews","scope","markdownActive","parentId","parentType","type"],then:ie.common99,type:"object"}},{auth:"bearer",constant:"SHARE_NEWS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:ie.common120,if:ie.common122,properties:{childId:ie.common11,childType:ie.common65,comment:ie.common1,connectType:ie.common124,parentId:ie.common11,parentType:ie.common115},required:["parentId","parentType","childId","childType","connectType"],then:ie.common125,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:ie.common127},{auth:"bearer",constant:"ADD_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/save",request:{additionalProperties:!1,properties:{argval:ie.common10,contextId:ie.common11,contextType:ie.common129,mentions:ie.common130,parentCommentId:ie.common11,path:ie.common10,text:ie.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:ie.common118},{auth:"bearer",constant:"UPDATE_COMMENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/comment/update",request:{additionalProperties:!1,properties:{id:ie.common11,params:{properties:{mentions:ie.common130,text:ie.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:ie.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:ie.common127},{auth:"none",constant:"GLOBAL_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{count:ie.common81,countType:{default:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative","projects","citoyens","poi"],items:ie.common133,type:"array"},fediverse:ie.common134,filters:ie.common135,indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common138,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchTags:ie.common31,searchType:{items:ie.common133,type:"array"}},required:["name","searchType","countType","indexMin","indexStep","initType","count","notSourceKey","filters","fediverse"],type:"object"}},{auth:"none",constant:"CITY_AUTOCOMPLETE",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/search/globalautocomplete",request:{additionalProperties:!1,properties:{indexMax:{minimum:5,type:"integer"},indexMin:{minimum:0,type:"integer"},locality:ie.common135,name:ie.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:ie.common119,scopeValue:ie.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:ie.common148,name:ie.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:ie.common81,countType:ie.common149,fediverse:ie.common134,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@userId":ie.common151,"parent.@userId":ie.common151},"links.contributors.@userId":ie.common151},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152,"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},type:"object"}},required:["$or"],type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common149},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:ie.common155,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common149,fediverse:ie.common134,filters:{additionalProperties:!1,default:{$or:{"links.contributors.@{pathParams.id}":ie.common151,"parent.@{pathParams.id}":ie.common151},"links.contributors.@{pathParams.id}":ie.common151},patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:{"^links\\.contributors\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},type:"object"}},required:["$or"],type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common149},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:ie.common81,countType:ie.common157,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"parent.@userId":ie.common151},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common157},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:ie.common155,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common157,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"parent.@{pathParams.id}":ie.common151},patternProperties:{"^parent\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common157},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:ie.common81,countType:ie.common158,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"links.members.@userId":ie.common151,"links.members.@userId.isInviting":ie.common160,"links.members.@userId.toBeValidated":ie.common160},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":ie.common161,"^links\\.members\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common158},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:ie.common66,if:ie.common87,properties:{id:ie.common1,type:{default:"citoyens",enum:["citoyens","organizations"],type:"string"}},required:["type","id"],then:ie.common83,type:"object"},request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common158,fediverse:ie.common134,filters:{additionalProperties:!1,default:{"links.members.@{pathParams.id}":ie.common151,"links.members.@{pathParams.id}.isInviting":ie.common160,"links.members.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common161,"^links\\.members\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common158},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:ie.common81,countType:ie.common165,fediverse:ie.common134,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+)$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":ie.common167,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":ie.common169,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common118,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common165,fediverse:ie.common134,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}":ie.common151,"links.memberOf.@{pathParams.id}.isInviting":ie.common160,"links.memberOf.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":ie.common152,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common167,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":ie.common169,"^links\\.memberOf\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common167},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common6,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common172,fediverse:ie.common134,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}":ie.common151,"links.friends.@{pathParams.id}.isInviting":ie.common160,"links.friends.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common167,"^links\\.friends\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common167},type:"object"},indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,searchType:ie.common172},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:ie.common81,countType:ie.common174,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common176],default:{"links.followers.@userId":ie.common151,"links.followers.@{userId}.isInviting":ie.common160,"links.followers.@{userId}.toBeValidated":ie.common160},patternProperties:ie.common179,type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common174},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:ie.common6,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common174,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common176],default:{"links.followers.@{pathParams.id}":ie.common151,"links.followers.@{pathParams.id}.isInviting":ie.common160,"links.followers.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:ie.common179,type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common174},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:ie.common81,countType:ie.common172,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common180],default:{"links.follows.@userId":ie.common151,"links.follows.@{userId}.isInviting":ie.common160,"links.follows.@{userId}.toBeValidated":ie.common160},patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common161,"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common172},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:ie.common66,if:ie.common87,then:ie.common83}],properties:{id:ie.common1,type:ie.common183},required:["type","id"],type:"object"},request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common172,fediverse:ie.common134,filters:{additionalProperties:!1,allOf:[ie.common180],default:{"links.follows.@{pathParams.id}":ie.common151},maxProperties:1,minProperties:1,patternProperties:{"^links\\.follows\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152},type:"object"},indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,searchType:ie.common172},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:ie.common81,countType:ie.common165,fediverse:ie.common134,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+)$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdmin$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isAdminPending$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.isInviting$":ie.common167,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.roles$":ie.common169,"^links\\.projects\\.(?:[a-f0-9]{24}|@\\w+)\\.toBeValidated$":ie.common161},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common118,request:{additionalProperties:!1,properties:{count:ie.common81,countType:ie.common165,fediverse:ie.common134,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}":ie.common151,"links.projects.@{pathParams.id}.isInviting":ie.common160,"links.projects.@{pathParams.id}.toBeValidated":ie.common160},patternProperties:{"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdmin$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isAdminPending$":ie.common152,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.isInviting$":ie.common167,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.roles$":ie.common169,"^links\\.projects\\.(?:[a-f0-9]{24}|@(?:\\{[^}]+\\}|[A-Za-z0-9_]+(?:\\.[A-Za-z0-9_]+)?))\\.toBeValidated$":ie.common167},type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common165},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:ie.common81,countType:ie.common184,fediverse:ie.common134,filters:{properties:{$or:{additionalProperties:!1,minProperties:1,patternProperties:{"^issuer\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common152},type:"object"},isParcours:ie.common3,"preferences.private":ie.common134},required:["preferences.private"],type:"object"},indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:ie.common143,searchBy:ie.common147,searchType:ie.common184},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:ie.common81,countType:ie.common186,fediverse:ie.common134,fields:ie.common184,filters:{oneOf:[{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common188}},{additionalProperties:!1,maxProperties:3,minProperties:3,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)$":ie.common188,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":ie.common191,"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteRecepteur$":ie.common191}},{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:ie.common194},{additionalProperties:!1,maxProperties:1,minProperties:1,properties:{$or:{additionalProperties:!1,maxProperties:2,minProperties:2,patternProperties:ie.common194,type:"object"}},required:["$or"]},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.revoke$":ie.common190}},{additionalProperties:!1,maxProperties:1,minProperties:1,patternProperties:{"badges\\.(?:[a-f0-9]{24}|@\\w+)\\.attenteEmetteur$":ie.common188}}],type:"object"},indexMin:ie.common148,indexStep:ie.common164,initType:ie.common135,locality:ie.common135,name:ie.common1,notSourceKey:ie.common81,ranges:{additionalProperties:!1,default:{Cooperative:ie.common195,GovernmentOrganization:ie.common195,Group:ie.common195,LocalBusiness:ie.common195,NGO:ie.common195,citoyens:ie.common195,projects:ie.common195},maxProperties:7,minProperties:7,patternProperties:{"^[a-zA-Z][a-zA-Z0-9]*$":ie.common145},type:"object"},searchType:ie.common186},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:ie.common97,then:{properties:{connectType:{const:"friend",default:"friend"}}}},{if:ie.common196,then:{properties:{connectType:{enum:["admin","member"]}}}},{if:ie.common198,then:{properties:{connectType:{enum:["admin","contributor"]}}}},{if:ie.common200,then:{properties:{connectType:{default:"attendee",enum:["attendee","connect"]}}}}],properties:{childId:ie.common202,childType:ie.common203,connectType:{enum:["admin","member","contributor","attendee","friend","connect"],type:"string"},parentId:ie.common11,parentType:ie.common204},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:ie.common97,then:{properties:{connectType:{default:"friends",enum:["friends","followers"]}}}},{if:ie.common196,then:{properties:{connectType:{default:"members",enum:["members","followers"]}}}},{if:ie.common198,then:{properties:{connectType:{default:"contributors",enum:["contributors","followers"]}}}},{if:ie.common200,then:{properties:{connectType:{default:"attendees",enum:["attendees","followers"]}}}}],properties:{childId:ie.common202,childType:ie.common203,connectType:{enum:["members","contributors","attendees","friends","followers"],type:"string"},parentId:ie.common11,parentType:ie.common204},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:ie.common6},{auth:"bearer",constant:"DELETE_FAVORIS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/updatepathvalue?index={index}",pathParams:{properties:{index:ie.common80},type:"object"},request:{additionalProperties:!1,properties:{collection:ie.common205,id:ie.common206,path:{const:"preferences.search.@{pathParams.index}",default:"preferences.search.@{pathParams.index}",type:"string"},pull:{const:"preferences.search",type:"string"},value:ie.common135},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:ie.common190,collection:ie.common205,id:ie.common206,path:{const:"preferences.search",default:"preferences.search",type:"string"},value:{additionalProperties:!1,properties:{description:ie.common1,locality:{patternProperties:{"^[a-f0-9]{24}$":{additionalProperties:!1,properties:ie.common55,required:["name","type"]}},type:"object"},name:ie.common1,tags:ie.common31,url:ie.common1},required:["url","name"],type:"object"}},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:!1,properties:{address:ie.common69,collection:{const:"organizations",default:"organizations",type:"string"},email:ie.common2,geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:{const:"organization",default:"organization",type:"string"},name:{minLength:3,type:"string"},preferences:ie.common207,role:{enum:["admin","member"],type:"string"},scope:ie.common135,shortDescription:ie.common1,tags:ie.common31,type:{enum:["NGO","LocalBusiness","Group","GovernmentOrganization","Cooperative"],type:"string"},url:ie.common4},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:ie.common69,collection:{const:"projects",default:"projects",type:"string"},geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:{const:"project",default:"project",type:"string"},name:ie.common1,parent:ie.common210,preferences:{default:{crowdfunding:!0,isOpenData:!1,isOpenEdition:!1},properties:{crowdfunding:ie.common101,isOpenData:ie.common119,isOpenEdition:ie.common119},required:["isOpenData","isOpenEdition"],type:"object"},public:ie.common101,scope:ie.common135,shortDescription:ie.common1,tags:ie.common31,url:ie.common4},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:ie.common69,collection:ie.common213,description:ie.common1,geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:ie.common213,name:ie.common1,parent:ie.common210,scope:ie.common135,tags:ie.common31,type:ie.common62,urls:ie.common31},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:ie.common163}},properties:{address:ie.common69,collection:ie.common214,email:ie.common2,endDate:ie.common215,geo:ie.common73,geoPosition:ie.common77,id:ie.common11,key:{const:"event",default:"event",type:"string"},name:{minLength:2,type:"string"},openingHours:{default:["","","","","","",""],items:{anyOf:[{const:"",type:"string"},{additionalProperties:!1,properties:{dayOfWeek:{enum:["Mo","Tu","We","Th","Fr","Sa","Su"],type:"string"},hours:{default:[],items:{additionalProperties:!1,properties:{closes:ie.common216,opens:ie.common216},required:["opens","closes"],type:"object"},type:"array"}},required:["dayOfWeek","hours"],type:"object"}]},maxItems:7,minItems:7,type:"array"},organizer:ie.common210,parent:ie.common58,preferences:{default:{isOpenData:!1,isOpenEdition:!1},properties:{isOpenData:ie.common119,isOpenEdition:ie.common119},required:["isOpenData","isOpenEdition"],type:"object"},public:ie.common101,recurrency:ie.common119,scope:ie.common135,shortDescription:{format:"textarea",type:"string"},startDate:ie.common215,tags:ie.common31,timeZone:ie.common1,type:ie.common61,url:ie.common4},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:ie.common118,request:ie.common8},{auth:"bearer",constant:"DELETE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/element/delete/type/events/id/{id}/",pathParams:ie.common118,request:ie.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:ie.common11,type:ie.common1},required:["type","id"],type:"object"},request:ie.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:ie.common11},required:["folder","ownerId"],type:"object"},request:{additionalProperties:!1,properties:{qqfile:ie.common20,qqfilename:ie.common1,qqtotalfilesize:ie.common217,qquuid:ie.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:ie.common5,childType:ie.common46,linkOption:{enum:["isInviting","toBeValidated","isAdminPending"],type:"string"},parentId:ie.common11,parentType:ie.common204},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:ie.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:ie.common218,request:{additionalProperties:!1,properties:{indexMin:ie.common102},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:ie.common218,request:{additionalProperties:!1,properties:{refreshTimestamp:ie.common217},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:ie.common81},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:ie.common118},{auth:"none",constant:"ACTIVITYPUB_SEARCH",contentType:"application/x-www-form-urlencoded",method:"GET",params:[ie.common20],path:"/api/activitypub/search?address={address}",pathParams:{additionalProperties:!1,properties:{address:ie.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:ie.common1,name:ie.common1,type:{enum:["person"],type:"string"}},required:["id","type","name"],type:"object"},payload:ie.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:ie.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:ie.common118},{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:ie.common221,criteria:{additionalProperties:!1,properties:{narrative:ie.common1},required:["narrative"],type:"object"},description:ie.common1,id:ie.common11,isParcours:ie.common119,issuer:{additionalProperties:!1,patternProperties:{"^(?:[a-f0-9]{24}|@userId)$":{additionalProperties:!1,properties:{name:ie.common1,type:{enum:["citoyens","organizations","projects"],type:"string"}},required:["type"],type:"object"}},type:"object"},key:ie.common222,name:ie.common1,parent:{additionalProperties:!1,patternProperties:{"^[a-f0-9]{24}$":{additionalProperties:!1,properties:{name:ie.common1,type:ie.common221},required:["type"],type:"object"}},type:"object"},preferences:ie.common207,public:ie.common101,scope:ie.common135,tags:ie.common31},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}$":ie.common54},type:"object"},badgeId:ie.common11,collection:ie.common221,evidences:{items:{additionalProperties:!1,properties:{narative:ie.common1,url:ie.common4},required:["narative"],type:"object"},type:"array"},key:ie.common222,narative:ie.common1,scope:ie.common135},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:!1,properties:{count:ie.common119,countType:{const:["events"],default:["events"],type:"array"},endDateUTC:ie.common215,fediverse:ie.common119,indexMin:ie.common102,indexStep:{default:100,type:"integer"},locality:{patternProperties:{"^[^\\s]+$":{type:"object"}},type:"object"},name:ie.common1,searchType:{const:["events"],default:["events"],items:ie.common1,type:"array"},startDate:ie.common80,startDateUTC:ie.common215,type:ie.common61},required:["searchType","indexMin","indexStep","startDate","startDateUTC","fediverse"],type:"object"}},{auth:"bearer",constant:"SHARE_EVENTS",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/news/co/share",request:{additionalProperties:!1,else:ie.common120,if:ie.common122,properties:{childId:ie.common11,childType:ie.common65,comment:ie.common1,connectType:ie.common124,parentId:ie.common11,parentType:ie.common214},required:["parentId","childId","childType","connectType","parentType"],then:ie.common125,type:"object"}},{auth:"bearer",constant:"INVITE_EVENT",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/multiconnect",request:{additionalProperties:!1,else:ie.common95,if:ie.common97,properties:{listInvite:{additionalProperties:!1,minProperties:1,properties:{citoyens:ie.common223,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:ie.common2,isAdmin:ie.common227,msg:ie.common1,name:ie.common1,roles:ie.common31},required:["name","email"],type:"object"}},type:"object"},organizations:ie.common223,projects:ie.common223},type:"object"},parentId:ie.common1,parentType:ie.common65},required:["parentId","parentType","listInvite"],then:ie.common99,type:"object"}},{auth:"bearer",constant:"FOLLOW",contentType:"application/x-www-form-urlencoded",method:"POST",path:"/co2/link/follow",request:{additionalProperties:!1,properties:{childId:ie.common202,childType:ie.common203,parentId:ie.common11,parentType:ie.common204},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:ie.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:ie.common11,contextType:ie.common228,costumEditMode:ie.common119,costumSlug:ie.common1,count:ie.common81,countType:ie.common229,fediverse:ie.common119,filters:ie.common135,indexMax:ie.common80,indexMin:ie.common136,indexStep:ie.common137,initType:ie.common135,locality:ie.common138,mapUsed:ie.common119,name:ie.common1,options:{additionalProperties:!0,properties:{tags:{additionalProperties:!0,properties:{verb:ie.common1},type:"object"}},type:"object"},ranges:ie.common143,searchBy:ie.common147,searchTags:ie.common31,searchType:ie.common229,sourceKey:ie.common31},required:["name","searchType","countType","indexMin","indexStep","initType","count","filters","fediverse","mapUsed","costumSlug","sourceKey","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:ie.common231,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common228,costumEditMode:ie.common119,costumSlug:ie.common1,parent_only:ie.common3,sourceKey:ie.common31,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:ie.common231,request:{additionalProperties:!1,allOf:[{if:{properties:{date:ie.common1},required:["date"]},then:{required:["timezone"]}}],properties:{contextId:ie.common11,contextType:ie.common228,costumEditMode:ie.common119,costumSlug:ie.common1,date:{oneOf:[ie.common1,{properties:{between:{properties:{end:ie.common41,start:ie.common41},required:["start","end"],type:"object"}},required:["between"],type:"object"}]},fromToday:ie.common3,regions:ie.common234,sourceKey:ie.common31,tags:ie.common31,timezone:ie.common1,type:ie.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:ie.common231,request:ie.common237},{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:ie.common231,request:ie.common237},{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:ie.common231,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common228,costumEditMode:ie.common119,costumSlug:ie.common1,regions:ie.common234,sourceKey:ie.common31,tags:ie.common31,type:ie.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:ie.common231,request:ie.common237},{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:ie.common231,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common228,costumEditMode:ie.common119,costumSlug:ie.common1,event:ie.common1,sourceKey:ie.common31,tl:ie.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:ie.common231,request:{additionalProperties:!1,properties:{contextId:ie.common11,contextType:ie.common228,costumEditMode:ie.common119,costumSlug:ie.common1,event:ie.common11,search:ie.common1,sourceKey:ie.common31},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:ie.common66,if:ie.common87,properties:{docType:{default:"image",enum:["image","file","bookmarks"],type:"string"},id:ie.common1,type:ie.common183},required:["id","type","docType"],then:ie.common83,type:"object"},request:{additionalProperties:!1,properties:{contentKey:ie.common1,folderId:ie.common1},type:"object"}}];var ae=_(633),ce=_(72);I.default.addType("oid",(e=>new re.ObjectID(e)));class ApiClient extends W.EventEmitter{constructor({baseURL:e,accessToken:t,refreshToken:o,refreshUrl:n="/api/cocolight/refreshtoken",endpoints:r=se,timeout:i=3e4,debug:s=!1,maxRetries:a=0,circuitBreakerThreshold:c=5,circuitBreakerResetTime:p=6e4,fromJSONValue:m=!0,tokenStorageStrategy:d=null}={}){if(super(),!e)throw new ApiClientError('Le paramètre "baseURL" est obligatoire.',500);this.__entityTag="ApiClient",this._baseURL=e,this._refreshUrl=n,this._endpoints=r,this._debug=s;let l=null;if(this._offlineClientManager=null,this._fromJSONValue=m,Object.defineProperty(this,"userId",{get:()=>l,set:()=>{throw new Error("Modification directe de userId non autorisée.")},enumerable:!0}),this._setUserId=e=>{l=e,this._logger.debug(`[ApiClient] userId set: ${e}`)},this._ajv=new H.default({strict:!1,useDefaults:!0,allErrors:!0,verbose:!0}),(0,Y.default)(this._ajv),this._ajv.addFormat("textarea",!0),this._ajv.addKeyword({keyword:"startBeforeEnd",type:"object",errors:!0,validate:this._startBeforeEndValidate}),this._logger=(0,oe.default)({transport:{target:"pino-pretty",options:{colorize:!0}},level:s?"debug":"info"}),this._client=X.default.create({baseURL:e,timeout:i}),a>0&&((0,ee.default)(this._client,{retries:a,retryDelay:ee.default.exponentialDelay,retryCondition:e=>ee.default.isNetworkError(e)||ee.default.isRetryableError(e),onRetry:(e,t,o)=>{this._logger.warn(`[Retry] Tentative #${e} pour ${o?.url}`),this.emit("retryAttempt",{retryCount:e,url:o?.url})}}),this._logger.info(`[ApiClient] Retry activé : ${a} max`)),this._breakerThreshold=c,this._breakerResetTime=p,this._breakerErrorCount=0,this._breakerOpen=!1,this._lastBreakerOpenTime=null,this._accessToken=null,this._refreshToken=null,d instanceof ae.SJ&&d.use(this._baseURL),this._tokenStorage=d||new ce.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.");o&&this.setRefreshToken(o),t&&this.setToken(t);const u=this._tokenStorage.getAccessToken();u&&this.setToken(u);const h=this._tokenStorage.getRefreshToken();h&&this.setRefreshToken(h),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.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 ApiClientError("Impossible de rafraîchir le token.",401)}catch(e){throw this.resetSession(),new ApiClientError("Erreur lors du rafraîchissement du token.",401,e)}}throw e}))}setToken(e){this._accessToken=e,this._tokenStorage.setAccessToken(e),this._client.defaults.headers.common.Authorization="Bearer "+e;const t=this._getIdFromToken(e);t&&(this._setUserId(t),this._logger.debug(`[ApiClient] userId extrait et défini : ${t}`)),this._logger.debug(`[ApiClient] setToken: ${e}`)}getToken(){return this._accessToken}setRefreshToken(e){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=(0,te.jwtDecode)(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=X.default.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:e.message}),this.resetSession(),this._logger.error(`[ApiClient] Refresh Error : ${e.message}`),!1}}_checkCircuitBreaker(){return!this._breakerOpen||Date.now()-this._lastBreakerOpenTime>this._breakerResetTime&&(this._breakerOpen=!1,this._breakerErrorCount=0,this._logger.warn("[ApiClient] Circuit breaker réinitialisé"),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 o={userId:()=>this.userId,accessToken:()=>this._accessToken,refreshToken:()=>this._refreshToken,baseURL:()=>this._baseURL,pathParams:e=>{const o=this._getValueByPath(t,e);return null!=o?o:void 0}},n=/@(?:\{([^}]+)\}|([\w.]+))/g,r=e=>"string"!=typeof e?e:e.replace(n,((t,n,r)=>{if(n){if(n.startsWith("pathParams.")){const e=n.substring(11),t=o.pathParams(e);return null!=t?t:`@{${n}}`}{const e=o[n];if("function"==typeof e){const t=e();return null!=t?t:`@{${n}}`}return`@{${n}}`}}if(r){if(r.startsWith("pathParams.")){const e=r.match(/^pathParams\.([^.]+)(.*)$/);if(e){const t=e[1],n=e[2],i=o.pathParams(t);return null!=i?i+n:`@${r}`}return`@${r}`}{const e=o[r];if("function"==typeof e){const t=e();return null!=t?t:`@${r}`}return`@${r}`}}return e})),i=e=>{if((e=>e&&"object"==typeof e&&("function"==typeof e.pipe||"undefined"!=typeof Buffer&&e instanceof Buffer))(e))return e;if(Array.isArray(e))return e.map(i);if((e=>"[object Object]"===Object.prototype.toString.call(e))(e)){const t={};for(const[o,n]of Object.entries(e))t[r(o)]=i(n);return t}return"string"==typeof e?r(e):e};return i(e)}_cleanSchemaLeftoverAlias(e){const t=/@\w+/;if(Array.isArray(e))return e.map((e=>this._cleanSchemaLeftoverAlias(e)));if(e&&"object"==typeof e){const o={};for(const n of Object.keys(e)){const r=e[n];if(!t.test(n)){if("default"===n){if("string"==typeof r&&t.test(r))continue;if(r&&"object"==typeof r){const e=this._cleanSchemaLeftoverAlias(r);Object.keys(e).length>0&&(o[n]=e);continue}}"string"==typeof r&&t.test(r)||(o[n]=this._cleanSchemaLeftoverAlias(r))}}return o}return e}async safeCall(e,...t){try{return await e(...t)}catch(e){throw this._logger.error(`[ApiClient.safeCall] Erreur: ${e.message}`),e}}async callEndpoint(e,t={},o=!0,n=!0){const r=this._endpoints.find((t=>t.constant===e));if(!r)throw new ApiClientError(`Endpoint introuvable : ${e}`,404);const{path:i,method:s,contentType:a,auth:c,pathParams:p,request:m,responses:d}=r,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 ApiClientError(`Token requis pour l'endpoint sécurisé : ${e}`,401);let y,f=i,g={};if(p){let o=p;"none"===c&&null===this.userId&&(o=this._cleanSchemaLeftoverAlias(p));const n=t.pathParams||{},r=this._ajv.compile(o);if(!r(n)){const t=this._ajvErrorHuman(r.errors);throw this.emit("validationError",{stage:"pathParams",errors:r.errors}),new ApiValidationError(`callEndpoint: ${e} - Path parameter validation failed.`,400,t,r.errors)}g=this._resolveSpecialValuesInPlace(n),f=f.replace(/\{(\w+)\}/g,((e,t)=>{const o=g[t];if(void 0!==o)return encodeURIComponent(o);throw new ApiClientError(`Path param manquant ou non résolu : {${t}}`,400)}))}if(m){let o=m;"none"===c&&null===this.userId&&(o=this._cleanSchemaLeftoverAlias(m));const n={...t};delete n.pathParams;const r=ApiClient.stripNullsInPlace(n),i=this._ajv.compile(o);if(!i(r)){const t=i.errors?this._ajvErrorHuman(i.errors):[];throw this.emit("validationError",{stage:"request",errors:i.errors}),new ApiValidationError(`callEndpoint: ${e} - Request validation failed.`,400,t,i.errors)}t=this._resolveSpecialValuesInPlace(r,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:o,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 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:o,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 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=e.status.toString(),o=d?.[t];if(o){const n=this._ajv.compile(o);if(!n(e.data)){const e=this._ajvErrorHuman(n.errors);throw this.emit("validationError",{stage:"response",errors:n.errors}),new ApiValidationError("Response validation failed.",t,e,n.errors)}}}return this._resetCircuitBreakerSuccess(),"function"==typeof o?e.data=o(e.data):!0===o&&(e.data=this._transformData(e.data)),Array.isArray(r.postActions)&&r.postActions.forEach((t=>{const o=t.path?this._getValueByPath(e.data,t.path):null;switch(t.type){case"setToken":this.setToken(o);break;case"setRefreshToken":this.setRefreshToken(o);break;case"resetSession":this.resetSession();break;case"emitEvent":t.event&&(this.emit(t.event,o),this._logger.debug(`[ApiClient] Event émis : ${t.event}`,o));break;case"callMethod":"function"==typeof this[t.method]?(this[t.method](),this._logger.debug(`[ApiClient] Méthode appelée : ${t.method}`)):this._logger.warn(`[ApiClient] Méthode inconnue : ${t.method}`);break;default:this._logger.warn(`[ApiClient] Action inconnue : ${t.type}`)}})),e}catch(t){throw this._updateCircuitBreakerError(),this._logger.error(`[ApiClient] Erreur lors de l'appel de ${e}: ${t.message}`),t instanceof ApiValidationError?t:new ApiClientError(`Erreur lors de l'appel de l'API : ${t.message}`,t.response?t.response.status:500,t.response?t.response.data:null)}}_ajvErrorHuman(e){try{return new Q.AggregateAjvError(e).errors.map((({message:e})=>e))}catch(t){return this._logger.error("[ApiClient] _ajvErrorHuman",t),e.map((({message:e})=>e))}}checkAndThrowApiResponseError(e){const t=e.data;if(!t||"object"!=typeof t)return e;if("boolean"==typeof t.result&&!1===t.result)throw new 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 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 toURLSearchParams(e,t={}){return this._buildParams(e,new URLSearchParams,t)}static _buildParams(e,t,o={}){if("object"!=typeof e||null===e)throw new TypeError("La donnée doit être un objet non nul.");const{dots:n=!1,indexes:r=!1,metaTokens:i=!0}=o,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,o=!1){return e?e.concat(t).map(((e,t)=>(e=c(e),!o&&t?`[${e}]`:e))).join(o?".":""):t}function m(e){return null==e?"":e instanceof Date?e.toISOString():(e instanceof Blob||e instanceof File||e instanceof ArrayBuffer||ArrayBuffer.isView(e),e)}return function e(o,d=[]){null==o||s.includes(o)||(s.push(o),Object.entries(o).forEach((([o,s])=>{void 0!==s&&function(e,o,s){if(e&&"object"==typeof e){if(o.endsWith("{}"))return o=i?o:o.slice(0,-2),t.append(p(s,o,n),JSON.stringify(e)),!1;if(Array.isArray(e)&&!e.some(a)||o.endsWith("[]"))return o=c(o),e.forEach(((e,i)=>{if(null!=e){const a=r?p(s.concat(o),i,n):`${p(s,o,n)}[]`;t.append(a,m(e))}})),!1}return!!a(e)||(t.append(p(s,o,n),m(e)),!1)}(s,o.trim(),d)&&e(s,d.concat(c(o)))})),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,this._fromJSONValue?I.default.fromJSONValue(e):e}_ensureFullURL(e){if(!e)return e;if(!(e=e.trim())||/^https?:\/\//i.test(e))return e;let t="/";return t=this._baseURL.endsWith("/")&&e.startsWith("/")||this._baseURL.endsWith("/")||e.startsWith("/")?"":"/",`${this._baseURL}${t}${e}`}_normalizeString(e){return"true"===e||"false"!==e&&e}_normalizeId(e){return e._id&&e._id.$id&&/^[0-9a-fA-F]{24}$/.test(e._id.$id)&&(e.id=e._id.$id,e._id={$type:"oid",$value:e._id.$id}),e.id&&e.id.$id&&/^[0-9a-fA-F]{24}$/.test(e.id.$id)&&(e._id={$type:"oid",$value:e.id.$id},e.id=e.id.$id),e}_normalizeDate(e){return e&&"object"==typeof e&&"number"==typeof e.sec?{$date:1e3*e.sec}:"number"==typeof e?{$date:1e3*e}:e}_normalizeImage(e){return"string"==typeof e&&""!==e.trim()?this._ensureFullURL(e):e}_imageFields=["profilImageUrl","profilThumbImageUrl","profilMediumImageUrl","profilMarkerImageUrl","profilBannerUrl","profilRealBannerUrl","imagePath","imageThumbPath","docPath","imageThumb","imageMediumPath"];_dateFields=["modified","created","updated","birthDate","lastLoginDate","startDate","endDate","date","issuedOn"];_normalizeRecursively(e){if("string"==typeof e)return this._normalizeString(e);if(Array.isArray(e))return e.map((e=>this._normalizeRecursively(e)));if(null!==e&&"object"==typeof e){const t={};return Object.keys(e).forEach((o=>{let n=this._normalizeRecursively(e[o]);this._dateFields.includes(o)&&(n=this._normalizeDate(n)),this._imageFields.includes(o)&&(n=this._normalizeImage(n)),"content"===o&&n&&"object"==typeof n&&n.image&&(n.image=this._normalizeImage(n.image)),t[o]=n})),this._normalizeId(t)}return e}_startBeforeEndValidate=(e,t)=>{if(!t.startDate||!t.endDate)return!0;const o=new Date(t.startDate)<new Date(t.endDate);return o||(this._startBeforeEndValidate.errors=[{instancePath:"/startDate",schemaPath:"#/startBeforeEnd",keyword:"startBeforeEnd",params:{},message:"startDate must be before endDate"}]),o};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 o of t)"function"==typeof e[o]&&this.on(o,e[o])}getDeclaredEvents(){const e=new Set;for(const t of this._endpoints)if(Array.isArray(t.postActions))for(const o of t.postActions)"emitEvent"===o.type&&o.event&&e.add(o.event);return Array.from(e)}}class UserApi{constructor(e){this.client=e instanceof ApiClient?e:new ApiClient(e),this.loggedUser=null}get isConnected(){return this.client.isConnected}get userId(){return this.client.userId}async login(e,t){return this.client.safeCall((async()=>{const o=await this.client.callEndpoint("AUTHENTICATE_URL",{email:e,password:t});return this.loggedUser=new User(this.client,o.data.user,{EndpointApi:J,Organization,Project,Event,Poi,Badge,News}),this.loggedUser}))}async meIsconnected(){if(!this.client.isConnected||!this.client.userId)throw new ApiError("User not connected",401);return this.client._logger.info("UserApi","meIsconnected",this.client.userId),this.loggedUser=new User(this.client,{id:this.client.userId},{EndpointApi:J,Organization,Project,Event,Poi,Badge,News}),this.loggedUser}async register({name:e,username:t,email:o,pwd:n}={}){return this.client.safeCall((async()=>{const r=await this.client.callEndpoint("PERSON_REGISTER",{name:e,username:t,email:o,pwd:n});if(!1===r?.data?.result)throw new ApiResponseError(r.data.msg,r.status,r.data);return r.data}))}async recoverPassword(e){return this.client.safeCall((async()=>{const t=await this.client.callEndpoint("PASSWORD_RECOVERY",{email:e});if(!1===t?.data?.result)throw new ApiResponseError(t.data.msg,t.status,t.data);return t.data}))}}A("User",User),A("Organization",Organization),A("Project",Project),A("Event",Event),A("Poi",Poi),A("Badge",Badge),A("EndpointApi",J),A("UserApi",UserApi),A("News",News);class Api{static async userLogin(e,t,o){const n=Api.userApi(o);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,o){try{if(!e)throw new ApiError("userApi is not defined");if(!e.client)throw new ApiError("userApi.client is not defined");if(e.client.isConnected){const t=await e.meIsconnected();return new Api(t,e.client)}{if(!t||!o)throw new ApiError("email and password are required");const n=await e.login(t,o);return new Api(n,e.client)}}catch(e){if(e instanceof ApiClientError&&e?.details?.error)throw new 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 ApiAuthenticationError("Accès refusé : utilisateur non authentifié.");return await this._loggedUser.get(),this._loggedUser}async user(e){try{if(e.id||e.slug){const t=new User(this._client,e,{EndpointApi:J,Organization,Project,Event,Poi,Badge,News});return await t.get(),t}return new User(this._client,e,{EndpointApi:J,Organization,Project,Event,Poi,Badge,News})}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:J,User,Project,Event,Poi,Badge,News});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:J,User,Organization,Event,Poi,Badge,News});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:J,User,Organization,Project,Poi,Badge,News});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 entitySlug(e){if(e)try{const t=await this.endpointApi.getElementsKey({pathParams:{slug:e}});if(t?.contextId&&t?.contextType){const e=function(e,t=null,o={}){const n={citoyens:{entityTag:"User",meta:e=>v(e,{remove:[]})},organizations:{entityTag:"Organization",meta:e=>v(e,{remove:[]})},projects:{entityTag:"Project",meta:e=>v(e,{remove:[]})},events:{entityTag:"Event",meta:e=>v(e,{remove:["Badge"]})},poi:{entityTag:"Poi",meta:e=>v(e,{remove:["Badge","News"]})},news:{entityTag:"News",meta:e=>v(e,{remove:[]})},badges:{entityTag:"Badge",meta:e=>function(e){const t=b.get(e),o={EndpointApi:b.get("EndpointApi"),User:b.get("User"),Organization:b.get("Organization"),Project:b.get("Project")};return o[e]=t,{entityClass:t,deps:o}}(e)}}[e];if(!n)return console.warn(`Collection inconnue : '${e}'`),null;const{entityTag:r,meta:i}=n,{entityClass:s,deps:a}=i(r);return new s(t,o,a)}(t?.contextType,this._client,{id:t?.contextId});return await e.get(),e}throw new ApiResponseError(`Le slug ${e} n'est pas valide`,200,t)}catch(t){throw t instanceof ApiResponseError?new 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 J(this._client)}logout(){this.loggedUser=null,this._client.resetSession(),this._client._logger.info("UserApi: User logged out")}}var pe=_(942);class OfflineClientManager{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}static async attachTo(e,t={}){e._offlineClientManager=new OfflineClientManager(e);const o=await async function(e="auto"){if("memory"===e)return new pe.QM;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new pe.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(339).then(_.bind(_,339));return new e}if("auto"===e){if("undefined"!=typeof window&&window.localStorage)return new pe.Rc;{const{FileOfflineStorage:e}=await _.e(339).then(_.bind(_,339));return new e}}}(t?.offlineStorageStrategy||"auto");await e._offlineClientManager._initOfflineQueue(o),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 o=new ApiClient({baseURL:e.baseURL,accessToken:e.accessToken,refreshToken:e.refreshToken,debug:this._client._debug});return this._clients.set(t,o),o}async replayAction(e){const t=await this.getClient(e.meta);try{const o=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}`),o}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(e){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._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:o={}}){const n=this._client.getToken()||this._client.getRefreshToken(),r=this._client._endpoints.find((t=>t.constant===e));if("required"===(r?.authPolicy||("none"===r?.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:o,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(){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)),o=e?.authPolicy||("none"===e?.auth?"none":"required"),n=t.meta.accessToken||t.meta.refreshToken;if("required"!==o||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){this._offlineQueueStorage=e,this._offlineQueue=await e.loadQueue()}}const me=OfflineClientManager,de={ApiClient,Api,error:E,reactive:T,...T,tokenStorageStrategy:{createDefaultTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new ce.GN;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new ce.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(790).then(_.bind(_,790));return new e}if("auto"===e){if("undefined"!=typeof window&&window.localStorage)return new ce.Ge;{const{FileStorageStrategy:e}=await _.e(790).then(_.bind(_,790));return new e}}},TokenStorageStrategy:ce.u3,createDefaultMultiServerTokenStorageStrategy:async function(e="auto"){if("memory"===e)return new ae.Ek;if("localStorage"===e){if("undefined"!=typeof window&&window.localStorage)return new ae.YP;throw new Error("localStorage n’est pas disponible dans cet environnement.")}if("file"===e){if("undefined"!=typeof window&&window.localStorage)throw new Error("Le stockage fichier n’est pas disponible côté navigateur.");const{MultiServerFileStorageStrategy:e}=await _.e(774).then(_.bind(_,774));return new e}if("undefined"!=typeof window&&window.localStorage)return new ae.YP;{const{MultiServerFileStorageStrategy:e}=await _.e(774).then(_.bind(_,774));return new e}},MultiServerTokenStorageStrategy:ae.SJ},helper:{fromEntityJSON:function(e,t=null){if(!e?.__entityTag)return null;if(!e.serverData?.collection)return e;const o=function(e,t){const o=b.get(t),n=t,r={EndpointApi:b.get("EndpointApi"),User:"User"===n?o:b.get("User"),Organization:"Organization"===n?o:b.get("Organization"),Project:"Project"===n?o:b.get("Project"),Event:"Event"===n?o:b.get("Event"),Poi:"Poi"===n?o:b.get("Poi"),Badge:"Badge"===n?o:b.get("Badge"),News:"News"===n?o:b.get("News")};return{citoyens:{entityClass:r.User,deps:r},organizations:{entityClass:r.Organization,deps:r},projects:{entityClass:r.Project,deps:r},events:{entityClass:r.Event,deps:{...r,Badge:void 0}},poi:{entityClass:r.Poi,deps:{...r,Badge:void 0,News:void 0}},news:{entityClass:r.News,deps:{...r}},badges:{entityClass:r.Badge,deps:{EndpointApi:r.EndpointApi,User:r.User,Organization:r.Organization,Project:r.Project}}}[e]||null}(e.serverData.collection,e.__entityTag);if(!o)return e;if(!o?.entityClass?.fromJSON)throw new Error(`Classe inconnue ou fromJSON manquant pour ${e.__entityTag}`);return o.entityClass.fromJSON(e,t,o.deps)}},OfflineClientManager:me};export{de as default};