@beam3_dev/api_module 0.0.155 → 0.0.157

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,5 +1,5 @@
1
- (function(u,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["exports","uuid","luxon","@widget-lab/3ddashboard-utils"],v):(u=typeof globalThis<"u"?globalThis:u||self,v(u["@beam3_dev/api_module"]={},u.uuid,u.luxon,u["@widget-lab/3ddashboard-utils"]))})(this,function(u,v,N,D){"use strict";function F(){return v.v4()}const L={b3M3Yellow:"#FFB300",b3AboutageBlue:"#42A5F5",b3UsinageGreen:"#689F38",b3PanneauOrange:"#ff8000",b3M350percent:"#fafa6e",b3M380percent:"#aae479",b3M390percent:"#64c987",b3M3100percent:"#23aa8f",b3M3105percent:"#00898a",b3M3110percent:"#176877",b3M3120percent:"#2a4858",b3Aboutage50percent:"#fafa6e",b3Aboutage80percent:"#aae479",b3Aboutage90percent:"#64c987",b3Aboutage100percent:"#23aa8f",b3Aboutage105percent:"#00898a",b3Aboutage110percent:"#176877",b3Aboutage120percent:"#2a4858",b3Warning:"#FF0000",b3Edit1:"#AD1457",b3Edit2:"#F4511E",b3Edit3:"#009688",b3Edit4:"#D50000",b3Edit5:"#039BE5",b3Edit6:"#9E69AF",b3Edit7:"#A79B8E",b3Edit8:"#616161",b3Edit9:"#795548"};async function ee(e,t=void 0,n=void 0){const s=parseInt(e);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+s,{method:"GET",headers:{Accept:"application/json"}}).then(a=>a.json()).then(a=>{t&&t(a)}).catch(a=>{n&&n(a),console.error("Erreur : "+a)})}async function te(e,t=void 0,n=void 0){e=encodeURIComponent(e),await fetch("https://api-adresse.data.gouv.fr/search/?q="+e+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(s=>s.json()).then(s=>{t&&t(s)}).catch(s=>{n&&n(s),console.error("Erreur : "+s)})}async function ne(e,t=L){let n=N.DateTime.now().year;const s=e,a=[],r=i=>{for(let c in i)a.push({date:c,comment:i[c]})};for(let i=n;i<=n+1;i++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+i+".json",{method:"GET",headers:{Accept:"application/json"}}).then(c=>c.json()).then(c=>{r(c)}).catch(c=>console.error("Erreur : "+c));return(()=>{const i=s.length===0?{events:[]}:s;for(let c of a)i.events.findIndex(l=>l.start===N.DateTime.fromISO(c.date).toISODate()&&l.name==="Férié : "+c.comment)===-1&&i.events.push({name:"Férié : "+c.comment,start:N.DateTime.fromISO(c.date).toISODate(),end:N.DateTime.fromISO(c.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return i})()}async function se(e,t,n=!0){const s=e.events.findIndex(a=>a.uuid===t.uuid);return s===-1?e.events.push(t):n?e.events[s]=t:e.events.splice(s,1),e.length>0&&e.sort((a,r)=>a.start-r.start),e}function g(e,t){D.requirejs(["DS/WAFData/WAFData"],n=>{n.authenticatedRequest(e,t)})}function ie(e,t,n){D.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.draggable(e,{data:t,start:n})})}function ae(e,t=void 0){D.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],n=>{let s;s===void 0&&(s=n.createProxy({widgetId:D.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&s.addEvent("onFilterSubjectsChange",t)),s.setSubjectsTags(e)})}function oe(e,t){D.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.droppable(e,{drop:t})})}async function re(e,t=void 0,n=void 0){await D.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],s=>{(!e||e==="")&&(e=D.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),t&&t(s.getPlatformServices({platformId:e,onComplete:t,onFailure:n}))})}function J(){let e={};return D.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const n=t.getTenant(),s=t.getUser(),a=t.getAllApplicationConfigurations(),r=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:n,user:s,appsConfiguration:a,appConf:r}}),console.log("%cRETOUR API :","color:blue",e),e}function I(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1-apps.3dexperience.3ds.com/enovia/resources/AppsMngt/api/v1/services?tenant=${e.tenant}&cors=true&xrequestedwith=xmlhttprequest`;g(s,{onComplete(a){const r=typeof a=="string"?JSON.parse(a):a;if(r&&"platforms"in r){const o=r.platforms.find(i=>i.id===e.tenant.toUpperCase());t&&o?t(o):n&&n("_getServiceUrl return listServiceUrl = undefined")}else n&&n("_getServiceUrl return oResponse = undefined")},onFailure(a){n&&n(a)}})}}function ce(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dpassport&platformId=${e.tenant}`;g(s,{onComplete(a){const r=JSON.parse(a);if(console.log("serviceId=3dpassport",r),Array.isArray(r)&&r.length>0){const o=`${r[0].services[0].url}`;t&&t(o)}},onFailure(a){n&&n(a)}})}}function de(e,t,n){const s={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},a=`${s.base}${s.uri}${s.option}`;g(a,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(r,o,i){const c=JSON.parse(r),d=c.data.map(l=>{const p=l.attributes.name,m=l.id;return{name:p,id:m}});t&&t(d,c)},onFailure(r,o){const i=r;i.msg=o.errormsg,i.errCode=o.errorcode,n&&n(i)}})}function le(e,t=void 0,n=void 0){let s=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;g(s,{onComplete(a,r,o){const i=JSON.parse(a);console.log("_AppMngt_get_users => ",i),t&&t(i)},onFailure(a,r){const o=a;o.msg=r.errormsg,o.errCode=r.errorcode,n&&n(o)}})}function ue(e,t,n=void 0,s=void 0){let a=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;g(a,{onComplete(r,o,i){const c=JSON.parse(r);n&&n(c)},onFailure(r,o){const i=r;i.msg=o.errormsg,i.errCode=o.errorcode,s&&s(i)}})}const j={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function pe(e,t,n=void 0,s=void 0){const{space:a,currentUser:r}=e,i=`${a}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,c={groups:[{title:t.title,description:t.description,members:t.members||[r.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};g(i,{method:"POST",headers:j,data:JSON.stringify(c),onComplete(d){n&&n(JSON.parse(d))},onFailure(d,l){console.log(d);const p=d;p.msg=l.errormsg,p.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",p),s&&s(p)}})}function fe(e,t,n=void 0,s=void 0){const{space:a,tenant:r}=e,o=a,i=`/3drdfpersist/v1/resources/${t}`,c=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${r}`,d=`${o}${i}${c}`;g(d,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(m){n&&n(JSON.parse(m))},onFailure(m,f){const _=m;_.msg=f.errormsg,_.errCode=f.errorcode,s&&s(_)}})}function G(e,t=void 0,n=void 0){const{space:s,tenant:a}=e,r=s,o="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",i=`?tenant=dstenant:${a}`,c={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${r}${o}${i}`;g(d,{OPTsH:c,onComplete(l){t&&t(JSON.parse(l))},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.errorcode,n&&n(m)}})}function me(e,t=void 0,n=void 0){const{space:s,currentUser:a}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup?select=uri,title,description,owner,members,pending_members,creation_date,modification_date,visibility`,d={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}};try{g(i,{opts:d,onComplete(l){const p=JSON.parse(l),m={},f=p.groups.filter(_=>_.uri.startsWith("uuid:"));if(a&&Object.keys(a).length>0){const _=f.filter(y=>y.owner===a.email),S=f.filter(y=>y.members.includes(a.email)),h=_.concat(S);m.iam=h,m.UG=f,m.iamMember=S,G(e,y=>{m.rules=y,t&&t(m)},y=>{n&&n(y)})}},onFailure(l){n&&n(l)}})}catch(l){console.log(l)}}function ge(e,t){const{space:n}=e,a=`${n}/3drdfpersist/resources/v1/usersgroup/${t}`;g(a,{method:"DELETE"})}function _e(e,t,n,s=void 0,a=void 0){const{space:r,tenant:o}=e,i={URITI:"/3drdfpersist/resources/v1/template-instances",URIUGr:"/3drdfpersist/resources/v1/usersgroup",nextURICh:"/characteristics",nextURIGr:"/group",nexURImem:"/members",OPTsTI:"?$mask=dsaccess:Mask.GroupUI.Properties",OPTsTenant:`tenant=dstenant:${o}`},c=n,d=`${r}${i.URIUGr}/${t}`,l=JSON.stringify(c);g(d,{headers:j,method:"PATCH",data:l,type:"json",onComplete(p){s&&s(p)},onFailure(p){a&&a(p)}})}function Se(e,t,n,s=void 0,a=void 0){const{space:r}=e,i=`${r}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;g(i,{method:"PATCH",headers:j,data:JSON.stringify(n),type:"json",onComplete(d){s&&s(d)},onFailure(d){a&&a(d)}})}function he(e,t,n=void 0,s=void 0){const{space:a}=e,o=`${a}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;g(o,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(d){n&&n(JSON.parse(d))},onFailure(d){s&&s(d)}})}async function E(e,t,n){if(e.space){const s=`${e.space}/resources/v1/application/CSRF`;g(s,{onComplete(a){a=JSON.parse(a),t&&t(a.csrf)},onFailure(a,r,o){n&&n({error:a,headers:r,xhr:o})}})}}var A={};function ye(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var we=function(e,t,n,s){t=t||"&",n=n||"=";var a={};if(typeof e!="string"||e.length===0)return a;var r=/\+/g;e=e.split(t);var o=1e3;s&&typeof s.maxKeys=="number"&&(o=s.maxKeys);var i=e.length;o>0&&i>o&&(i=o);for(var c=0;c<i;++c){var d=e[c].replace(r,"%20"),l=d.indexOf(n),p,m,f,_;l>=0?(p=d.substr(0,l),m=d.substr(l+1)):(p=d,m=""),f=decodeURIComponent(p),_=decodeURIComponent(m),ye(a,f)?Array.isArray(a[f])?a[f].push(_):a[f]=[a[f],_]:a[f]=_}return a},k=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Ce=function(e,t,n,s){return t=t||"&",n=n||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(a){var r=encodeURIComponent(k(a))+n;return Array.isArray(e[a])?e[a].map(function(o){return r+encodeURIComponent(k(o))}).join(t):r+encodeURIComponent(k(e[a]))}).filter(Boolean).join(t):s?encodeURIComponent(k(s))+n+encodeURIComponent(k(e)):""};A.decode=A.parse=we,A.encode=A.stringify=Ce;async function x(e,t=void 0,n=void 0,s=void 0){const a=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const r=a+`/resources/v1/modeler/documents/${t}`;g(r,{onComplete(o,i,c){const d=JSON.parse(o);n&&n(d)},onFailure(o){s&&s(o)}})}async function Te(e,t=void 0,n=void 0,s=void 0){const a=e.space;if(t===void 0){console.log("Le paramètre docids est obligatoire");return}let r=`${a}/resources/v1/modeler/documents/ids?$include=!files,!ownerInfo,!originatorInfo,!relOwnerInfo'`,o=A.stringify({$ids:t.toString().replace('"',"").replace("[","").replace("]","")});g(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:o,onComplete(i,c,d){const l=JSON.parse(i);n&&n(l)},onFailure(i){s&&s(i)}})}function U(e,t=void 0,n=void 0){if(e.objID&&e.objID!==""){let s=`${e.space}/resources/v1/modeler/documents/${e.objID}`;g(s,{onComplete(a,r,o){const i=JSON.parse(a);e.token=i?.csrf?.value,e.datas=i?.data[0],t&&t(e)},onFailure(a){n&&n(a)}})}else O(e,s=>{console.log("_3DSpace_get_csrf / _3DSpace_csrf",s),t&&t(s)},s=>{n&&n(s)})}function O(e,t=void 0,n=void 0){if(e.space){const s=e.space+"/resources/v1/application/CSRF";g(s,{onComplete(a,r,o){const i=JSON.parse(a);t&&t(i.csrf.value)},onFailure(a,r,o){n&&n({response:a,headers:r,xhr:o})}})}else n&&n("ERROR : url du 3DSpace non défini.")}function $(e,t=void 0,n=void 0){let s=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;U(e,a=>{g(s,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(r){const i=JSON.parse(r).data[0].dataelements.ticketURL;t&&t(i)},onFailure(r,o){console.warn("☠️ error => ",r,o),n&&n(r,o)}})},a=>{console.warn("_3DSpace_get_ticket / error => ",a),n&&n(a)})}function Oe(e,t,n,s=void 0,a=void 0){const r=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;n||(n=e.token),g(r,{method:"PUT",headers:{ENO_CSRF_TOKEN:n},onComplete(o){let i=JSON.parse(o);if(console.log("☠️ info => ",i),i.success===!0)try{const c=i.data[0].dataelements.ticketURL;s&&s(c)}catch(c){a&&a(c)}},onFailure(o){a&&a(o)}})}function K(e,t,n,s,a,r=void 0,o=void 0){const i=()=>V(e,t,n,s,a,e.token,r,o);e.token?i():U(e,t,c=>{e.token=c.csrf.value,i()})}function V(e,t,n,s,a,r,o=void 0,i=void 0){const c=e.space+`/resources/v1/modeler/documents/${t}/files/CheckinTicket`;g(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:r},onComplete(d,l,p){const m=JSON.parse(d).data[0].dataelements,f=new FormData;f.append("__fcs__jobTicket",m.ticket),f.append("file_0",s,a);const _={};_.method="POST",_.data=f,_.onComplete=function(S){let h="temp_"+Date.now(),y={method:"PUT",headers:{ENO_CSRF_TOKEN:r},data:JSON.stringify({data:[{id:t,relateddata:{files:[{id:n,dataelements:{title:a,receipt:S},updateAction:"REVISE"}]},tempId:h}]}),type:"json",onComplete(w){o&&o(w)},onFailure(w){i&&i(w)}};g(e.space+"/resources/v1/modeler/documents",y)},_.onFailure=function(S){i&&i(S)},_.timeout=0,g(m.ticketURL,_)}})}async function De(e,t,n,s,a=void 0,r=void 0){const o=e.space,i=e.token,c=e.ctx,d=new FormData,l=new Blob([JSON.stringify(t)],{type:"text/plain"}),p={url_Ticket:`${o}/resources/v1/modeler/documents/files/CheckinTicket`,url_Post:`${o}/resources/v1/modeler/documents/?SecurityContext=ctx::${c}`};if(!o&&o!==""){console.log("le store._3DSpace est vide");return}g(p.url_Ticket,{method:"PUT",headers:{ENO_CSRF_TOKEN:i.value},onComplete(m,f,_){const S=JSON.parse(m).data[0].dataelements;d.append("__fcs__jobTicket",S.ticket),d.append("filename",l,n);const h={method:"POST",data:d,onComplete(T){if(c!==""&&i!==""){const M={method:"POST",headers:{ENO_CSRF_TOKEN:i,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{type:"Document",dataelements:{title:`Title_${n.toLowerCase().split(" ").join("_")}`,policy:"Document Release",description:s},relateddata:{files:[{dataelements:{title:`${n}.json`,receipt:T}}]},tempId:F()}]}),type:"json",timeout:0,onComplete:y,onFailure:w};c!==""&&g(p.url_Post,M)}else console.warn("le store est vide")},onFailure:w};function y(T){console.log("Success -- response ",T.data[0]),a&&a(T)}function w(T,M){console.log("Erreur -- response ",T,`
2
- headers `,M),r&&r(T)}g(S.ticketURL,h)}})}function b(e,t=void 0,n=void 0,s=void 0,a=void 0,r=void 0,o=!1){const i=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;g(i,{method:"GET",onComplete(c){const d=JSON.parse(c);let l="",p,m,f;if(t){let _=d.collabspaces.find(S=>S.title===t);if(_){p=t;let S=_.couples;S=S.filter((h,y,w)=>y===w.findIndex(T=>T.organization.pid===h.organization.pid&&T.role.pid===h.role.pid)),n&&(Array.isArray(n)?n.forEach(h=>{f||S.forEach(y=>{if(h===y.role.name&&s===y.organization.title)f=h,m=s;else if(h===y.role.name){let w=S.filter(T=>T.role.name===h);w.length===1?(f=w[0].role.name,m=w[0].organization.title):r(w)}})}):S.forEach(h=>{if(n===h.role.name&&s===h.organization.title)f=n,m=s;else if(n===h.role.name){let y=S.filter(w=>w.role.name===n);y.length===1?(f=y[0].role.name,m=y[0].organization.title):r(y)}}))}}p&&m&&f?(l=f+"."+m+"."+p,a(l)):d.preferredcredentials&&o?(l=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,a(l)):r&&(l=f+"."+m+"."+p,r(l))},onFailure(c,d){console.log("Erreur de récupération du contexte de sécurité. => ",{err:c,headers:d})}})}async function P(e,t=void 0,n=void 0){return(!e.objID||e.objID==="")&&console.warn("_3DSpace_download_doc() / Le paramètre objectId est obligatoire"),(e.space===""||!e.space)&&console.warn("_3DSpace_download_doc() / Le paramètre space est obligatoire"),(e.token===""||!e.token)&&E(e,s=>{e.token=s},s=>{console.log("☠️ error => ",s)}),new Promise((s,a)=>{$(e,r=>{g(r,{headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(i){let c;try{c=JSON.parse(i)}catch{c=i}t&&typeof t=="function"&&t(c),s(c)},onFailure(i,c,d){n&&(console.log("error http",i),n({msg:JSON.parse(i),headers:c,xhr:d}),a({msg:JSON.parse(i),headers:c,xhr:d}))}})},r=>{n&&n(r),console.log("*_3dspace_download_doc / error file URL *",r),a(r)})})}async function W(e,t,n=void 0,s=void 0){let a=[];if(typeof t<"u"&&Array.isArray(t)&&t?.length>0){for(let i=0;i<t.length;i+=80){const c=t.slice(i,i+80);a.push(c)}const o=i=>{B(e,a[i],()=>{i++,i<a.length&&o(i)},c=>{n&&n(c)})};o(0)}else console.warn("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini."),s&&s("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini.")}function B(e,t,n=void 0,s=void 0,a=void 0){const r=[];t.forEach(c=>{r.push({id:c})});let o=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:r});const i=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;g(i,{method:"PUT",data:o,type:"json",onComplete(c){const d=c.data;c.success===!0&&(n&&n(),d.forEach(l=>{try{const p=l.dataelements.fileName,m=l.dataelements.ticketURL;g(m,{onComplete:(f,_)=>{let S;try{S=JSON.parse(f)}catch{S=f}s&&s({objectId:l.id,headers:_,fileName:p,data:S})},onFailure:f=>{console.log("error http",f)}})}catch(p){console.log(p),a&&a(p)}}))},onFailure(c){console.log(c),a&&a(c)}})}function be(e,t,n=void 0,s=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t}]}),type:"json",onComplete(i){n&&n(i)},onFailure(i){s&&s(i)}};g(r,o)}})}function Ie(e,t,n,s=void 0,a=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,c=>e.ctx=c,c=>{console.log("onError =>",c)});let i={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t,nextState:n}]}),type:"json",onComplete(c){s&&s(c)},onFailure(c){a&&a(c)}};g(o,i)}})}function ve(e,t,n=void 0,s=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t}]}),type:"json",onComplete(i){n&&n(i)},onFailure(i){s&&s(i)}};g(r,o)}})}function Ne(e,t,n=void 0,s=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{"attribute[PLMReference.V_versionComment]":null,physicalid:t,type:"Document",tenant:e.tenant,objectId:t,policy:"Document Release",availableSemantic:["E","LAST","NEW","DUP"]}]}),type:"json",onComplete(i){n&&n(i)},onFailure(i){s&&s(i)}};g(r,o)}})}function Ae(e,t,n,s=void 0,a=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;b(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,c=>e.ctx=c,c=>{console.log("onError =>",c)});let i={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{physicalid:t,proposedRevision:n,modifiedAttributes:{revision:n}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(c){s&&s(c)},onFailure(c){a&&a(c)}};g(o,i)}})}function ke(e,t,n,s,a=void 0,r=void 0){return new Promise(o=>{const i=`${e.space}/resources/v1/modeler/dsbks/dsbks:Bookmark`;let c={attributes:{title:n,description:s,inheritedAccess:"no"}},d={items:[]};t&&(d.parentId=t),d.items.push(c);let l={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",SecurityContext:e.ctx,ENO_CSRF_TOKEN:e.token},data:JSON.stringify(d),type:"json",onComplete(p){a&&a(p)},onFailure(p){r&&r(p)}};g(i,l)})}function Ue(e,t,n,s,a=void 0,r=void 0){return console.log("credentials",e),new Promise(o=>{`${e.space}`,JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:[{type:"Workspace",cestamp:"businessobject",relId:t,id:t,dataelements:{personList:n,eventsList:s},tenant:e.tenant}]})})}//!SECTION
1
+ (function(u,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("uuid"),require("luxon"),require("@widget-lab/3ddashboard-utils")):typeof define=="function"&&define.amd?define(["exports","uuid","luxon","@widget-lab/3ddashboard-utils"],v):(u=typeof globalThis<"u"?globalThis:u||self,v(u["@beam3_dev/api_module"]={},u.uuid,u.luxon,u["@widget-lab/3ddashboard-utils"]))})(this,function(u,v,N,b){"use strict";function F(){return v.v4()}const L={b3M3Yellow:"#FFB300",b3AboutageBlue:"#42A5F5",b3UsinageGreen:"#689F38",b3PanneauOrange:"#ff8000",b3M350percent:"#fafa6e",b3M380percent:"#aae479",b3M390percent:"#64c987",b3M3100percent:"#23aa8f",b3M3105percent:"#00898a",b3M3110percent:"#176877",b3M3120percent:"#2a4858",b3Aboutage50percent:"#fafa6e",b3Aboutage80percent:"#aae479",b3Aboutage90percent:"#64c987",b3Aboutage100percent:"#23aa8f",b3Aboutage105percent:"#00898a",b3Aboutage110percent:"#176877",b3Aboutage120percent:"#2a4858",b3Warning:"#FF0000",b3Edit1:"#AD1457",b3Edit2:"#F4511E",b3Edit3:"#009688",b3Edit4:"#D50000",b3Edit5:"#039BE5",b3Edit6:"#9E69AF",b3Edit7:"#A79B8E",b3Edit8:"#616161",b3Edit9:"#795548"};async function ee(e,t=void 0,n=void 0){const s=parseInt(e);await fetch("https://apicarto.ign.fr/api/codes-postaux/communes/"+s,{method:"GET",headers:{Accept:"application/json"}}).then(a=>a.json()).then(a=>{t&&t(a)}).catch(a=>{n&&n(a),console.error("Erreur : "+a)})}async function te(e,t=void 0,n=void 0){e=encodeURIComponent(e),await fetch("https://api-adresse.data.gouv.fr/search/?q="+e+"&limit=15",{method:"GET",headers:{Accept:"application/json"}}).then(s=>s.json()).then(s=>{t&&t(s)}).catch(s=>{n&&n(s),console.error("Erreur : "+s)})}async function ne(e,t=L){let n=N.DateTime.now().year;const s=e,a=[],r=i=>{for(let c in i)a.push({date:c,comment:i[c]})};for(let i=n;i<=n+1;i++)await fetch("https://calendrier.api.gouv.fr/jours-feries/metropole/"+i+".json",{method:"GET",headers:{Accept:"application/json"}}).then(c=>c.json()).then(c=>{r(c)}).catch(c=>console.error("Erreur : "+c));return(()=>{const i=s.length===0?{events:[]}:s;for(let c of a)i.events.findIndex(l=>l.start===N.DateTime.fromISO(c.date).toISODate()&&l.name==="Férié : "+c.comment)===-1&&i.events.push({name:"Férié : "+c.comment,start:N.DateTime.fromISO(c.date).toISODate(),end:N.DateTime.fromISO(c.date).toISODate(),color:t.b3BusinnessDays,timed:!1});return i})()}async function se(e,t,n=!0){const s=e.events.findIndex(a=>a.uuid===t.uuid);return s===-1?e.events.push(t):n?e.events[s]=t:e.events.splice(s,1),e.length>0&&e.sort((a,r)=>a.start-r.start),e}function g(e,t){b.requirejs(["DS/WAFData/WAFData"],n=>{n.authenticatedRequest(e,t)})}function ie(e,t,n){b.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],s=>{s.draggable(e,{data:t,start:n})})}function ae(e,t=void 0){b.requirejs(["DS/TagNavigatorProxy/TagNavigatorProxy"],n=>{let s;s===void 0&&(s=n.createProxy({widgetId:b.widget.id,filteringMode:"WithFilteringServices"}),t!==void 0&&s.addEvent("onFilterSubjectsChange",t)),s.setSubjectsTags(e)})}function oe(e,t){b.requirejs(["DS/DataDragAndDrop/DataDragAndDrop"],n=>{n.droppable(e,{drop:t})})}async function re(e,t=void 0,n=void 0){await b.requirejs(["DS/i3DXCompassServices/i3DXCompassServices"],s=>{(!e||e==="")&&(e=b.widget.getValue("PlatFormInstanceId")),(!e||e==="")&&(e=void 0),t&&t(s.getPlatformServices({platformId:e,onComplete:t,onFailure:n}))})}function J(){let e={};return b.requirejs(["DS/PlatformAPI/PlatformAPI"],t=>{const n=t.getTenant(),s=t.getUser(),a=t.getAllApplicationConfigurations(),r=t.getApplicationConfiguration("com.3ds.wp.passport.cors");e={tenant:n,user:s,appsConfiguration:a,appConf:r}}),console.log("%cRETOUR API :","color:blue",e),e}function I(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1-apps.3dexperience.3ds.com/enovia/resources/AppsMngt/api/v1/services?tenant=${e.tenant}&cors=true&xrequestedwith=xmlhttprequest`;g(s,{onComplete(a){const r=typeof a=="string"?JSON.parse(a):a;if(r&&"platforms"in r){const o=r.platforms.find(i=>i.id===e.tenant.toUpperCase());t&&o?t(o):n&&n("_getServiceUrl return listServiceUrl = undefined")}else n&&n("_getServiceUrl return oResponse = undefined")},onFailure(a){n&&n(a)}})}}function ce(e,t=void 0,n=void 0){if(e.tenant){const s=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dpassport&platformId=${e.tenant}`;g(s,{onComplete(a){const r=JSON.parse(a);if(console.log("serviceId=3dpassport",r),Array.isArray(r)&&r.length>0){const o=`${r[0].services[0].url}`;t&&t(o)}},onFailure(a){n&&n(a)}})}}function de(e,t,n){const s={base:`${e.space}`,uri:"/resources/AppsMngt/api/custom/applications",option:`?filter=${e.tenant}`},a=`${s.base}${s.uri}${s.option}`;g(a,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},onComplete(r,o,i){const c=JSON.parse(r),d=c.data.map(l=>{const p=l.attributes.name,m=l.id;return{name:p,id:m}});t&&t(d,c)},onFailure(r,o){const i=r;i.msg=o.errormsg,i.errCode=o.errorcode,n&&n(i)}})}function le(e,t=void 0,n=void 0){let s=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&limit=-1`;g(s,{onComplete(a,r,o){const i=JSON.parse(a);console.log("_AppMngt_get_users => ",i),t&&t(i)},onFailure(a,r){const o=a;o.msg=r.errormsg,o.errCode=r.errorcode,n&&n(o)}})}function ue(e,t,n=void 0,s=void 0){let a=`${e.space}/resources/AppsMngt/user?platform=${e.tenant}&id=${t}`;g(a,{onComplete(r,o,i){const c=JSON.parse(r);n&&n(c)},onFailure(r,o){const i=r;i.msg=o.errormsg,i.errCode=o.errorcode,s&&s(i)}})}const j={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"};function pe(e,t,n=void 0,s=void 0){const{space:a,currentUser:r}=e,i=`${a}${{URIUGr:"/3drdfpersist/resources/v1/usersgroup"}.URIUGr}`,c={groups:[{title:t.title,description:t.description,members:t.members||[r.email,"samuel.mureau@beam3.fr"],pending_members:[],sharing:t.sharing,visibility:t.visibility}]};g(i,{method:"POST",headers:j,data:JSON.stringify(c),onComplete(d){n&&n(JSON.parse(d))},onFailure(d,l){console.log(d);const p=d;p.msg=l.errormsg,p.errCode=l.errorcode,console.log("❌ sendDirectMessage => ",p),s&&s(p)}})}function fe(e,t,n=void 0,s=void 0){const{space:a,tenant:r}=e,o=a,i=`/3drdfpersist/v1/resources/${t}`,c=`?$mask=dsaccess:Mask.GroupUI.Properties&tenant=dstenant:${r}`,d=`${o}${i}${c}`;g(d,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(m){n&&n(JSON.parse(m))},onFailure(m,f){const _=m;_.msg=f.errormsg,_.errCode=f.errorcode,s&&s(_)}})}function G(e,t=void 0,n=void 0){const{space:s,tenant:a}=e,r=s,o="/3drdfpersist/resources/v1/option-sets/dsusergroup:ListOfGroupResponsibilities/options",i=`?tenant=dstenant:${a}`,c={method:"GET",Accept:"application/json,*/*,test/javascript"},d=`${r}${o}${i}`;g(d,{OPTsH:c,onComplete(l){t&&t(JSON.parse(l))},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.errorcode,n&&n(m)}})}function me(e,t=void 0,n=void 0){const{space:s,currentUser:a}=e,i=`${s}/3drdfpersist/resources/v1/usersgroup?select=uri,title,description,owner,members,pending_members,creation_date,modification_date,visibility`,d={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}};try{g(i,{opts:d,onComplete(l){const p=JSON.parse(l),m={},f=p.groups.filter(_=>_.uri.startsWith("uuid:"));if(a&&Object.keys(a).length>0){const _=f.filter(y=>y.owner===a.email),S=f.filter(y=>y.members.includes(a.email)),h=_.concat(S);m.iam=h,m.UG=f,m.iamMember=S,G(e,y=>{m.rules=y,t&&t(m)},y=>{n&&n(y)})}},onFailure(l){n&&n(l)}})}catch(l){console.log(l)}}function ge(e,t){const{space:n}=e,a=`${n}/3drdfpersist/resources/v1/usersgroup/${t}`;g(a,{method:"DELETE"})}function _e(e,t,n,s=void 0,a=void 0){const{space:r,tenant:o}=e,i={URITI:"/3drdfpersist/resources/v1/template-instances",URIUGr:"/3drdfpersist/resources/v1/usersgroup",nextURICh:"/characteristics",nextURIGr:"/group",nexURImem:"/members",OPTsTI:"?$mask=dsaccess:Mask.GroupUI.Properties",OPTsTenant:`tenant=dstenant:${o}`},c=n,d=`${r}${i.URIUGr}/${t}`,l=JSON.stringify(c);g(d,{headers:j,method:"PATCH",data:l,type:"json",onComplete(p){s&&s(p)},onFailure(p){a&&a(p)}})}function Se(e,t,n,s=void 0,a=void 0){const{space:r}=e,i=`${r}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;g(i,{method:"PATCH",headers:j,data:JSON.stringify(n),type:"json",onComplete(d){s&&s(d)},onFailure(d){a&&a(d)}})}function he(e,t,n=void 0,s=void 0){const{space:a}=e,o=`${a}/3drdfpersist/resources/v1/usersgroup/${t}/sharing`;g(o,{opts:{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"}},onComplete(d){n&&n(JSON.parse(d))},onFailure(d){s&&s(d)}})}async function E(e,t,n){if(e.space){const s=`${e.space}/resources/v1/application/CSRF`;g(s,{onComplete(a){a=JSON.parse(a),t&&t(a.csrf)},onFailure(a,r,o){n&&n({error:a,headers:r,xhr:o})}})}}var A={};function ye(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var we=function(e,t,n,s){t=t||"&",n=n||"=";var a={};if(typeof e!="string"||e.length===0)return a;var r=/\+/g;e=e.split(t);var o=1e3;s&&typeof s.maxKeys=="number"&&(o=s.maxKeys);var i=e.length;o>0&&i>o&&(i=o);for(var c=0;c<i;++c){var d=e[c].replace(r,"%20"),l=d.indexOf(n),p,m,f,_;l>=0?(p=d.substr(0,l),m=d.substr(l+1)):(p=d,m=""),f=decodeURIComponent(p),_=decodeURIComponent(m),ye(a,f)?Array.isArray(a[f])?a[f].push(_):a[f]=[a[f],_]:a[f]=_}return a},k=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Ce=function(e,t,n,s){return t=t||"&",n=n||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(a){var r=encodeURIComponent(k(a))+n;return Array.isArray(e[a])?e[a].map(function(o){return r+encodeURIComponent(k(o))}).join(t):r+encodeURIComponent(k(e[a]))}).filter(Boolean).join(t):s?encodeURIComponent(k(s))+n+encodeURIComponent(k(e)):""};A.decode=A.parse=we,A.encode=A.stringify=Ce;async function x(e,t=void 0,n=void 0,s=void 0){const a=e.space;if(t===void 0){console.log("Le paramètre docid est obligatoire");return}const r=a+`/resources/v1/modeler/documents/${t}`;g(r,{onComplete(o,i,c){const d=JSON.parse(o);n&&n(d)},onFailure(o){s&&s(o)}})}async function Te(e,t=void 0,n=void 0,s=void 0){const a=e.space;if(t===void 0){console.log("Le paramètre docids est obligatoire");return}let r=`${a}/resources/v1/modeler/documents/ids?$include=!files,!ownerInfo,!originatorInfo,!relOwnerInfo'`,o=A.stringify({$ids:t.toString().replace('"',"").replace("[","").replace("]","")});g(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:o,onComplete(i,c,d){const l=JSON.parse(i);n&&n(l)},onFailure(i){s&&s(i)}})}function U(e,t=void 0,n=void 0){if(e.objID&&e.objID!==""){let s=`${e.space}/resources/v1/modeler/documents/${e.objID}`;g(s,{onComplete(a,r,o){const i=JSON.parse(a);e.token=i?.csrf?.value,e.datas=i?.data[0],t&&t(e)},onFailure(a){n&&n(a)}})}else O(e,s=>{console.log("_3DSpace_get_csrf / _3DSpace_csrf",s),t&&t(s)},s=>{n&&n(s)})}function O(e,t=void 0,n=void 0){if(e.space){const s=e.space+"/resources/v1/application/CSRF";g(s,{onComplete(a,r,o){const i=JSON.parse(a);t&&t(i.csrf.value)},onFailure(a,r,o){n&&n({response:a,headers:r,xhr:o})}})}else n&&n("ERROR : url du 3DSpace non défini.")}function $(e,t=void 0,n=void 0){let s=e.space+`/resources/v1/modeler/documents/${e.objID}/files/DownloadTicket`;U(e,a=>{g(s,{method:"PUT",headers:{ENO_CSRF_TOKEN:e.token},onComplete(r,o){const c=JSON.parse(r).data[0].dataelements.ticketURL;t&&t(c,o)},onFailure(r,o){console.warn("☠️ error => ",r,o),n&&n(r,o)}})},a=>{console.warn("_3DSpace_get_ticket / error => ",a),n&&n(a)})}function Oe(e,t,n,s=void 0,a=void 0){const r=`${e.space}/resources/v1/modeler/documents/${t}/files/DownloadTicket`;n||(n=e.token),g(r,{method:"PUT",headers:{ENO_CSRF_TOKEN:n},onComplete(o){let i=JSON.parse(o);if(console.log("☠️ info => ",i),i.success===!0)try{const c=i.data[0].dataelements.ticketURL;s&&s(c)}catch(c){a&&a(c)}},onFailure(o){a&&a(o)}})}function K(e,t,n,s,a,r=void 0,o=void 0){const i=()=>V(e,t,n,s,a,e.token,r,o);e.token?i():U(e,t,c=>{e.token=c.csrf.value,i()})}function V(e,t,n,s,a,r,o=void 0,i=void 0){const c=e.space+`/resources/v1/modeler/documents/${t}/files/CheckinTicket`;g(c,{method:"PUT",headers:{ENO_CSRF_TOKEN:r},onComplete(d,l,p){const m=JSON.parse(d).data[0].dataelements,f=new FormData;f.append("__fcs__jobTicket",m.ticket),f.append("file_0",s,a);const _={};_.method="POST",_.data=f,_.onComplete=function(S){let h="temp_"+Date.now(),y={method:"PUT",headers:{ENO_CSRF_TOKEN:r},data:JSON.stringify({data:[{id:t,relateddata:{files:[{id:n,dataelements:{title:a,receipt:S},updateAction:"REVISE"}]},tempId:h}]}),type:"json",onComplete(w){o&&o(w)},onFailure(w){i&&i(w)}};g(e.space+"/resources/v1/modeler/documents",y)},_.onFailure=function(S){i&&i(S)},_.timeout=0,g(m.ticketURL,_)}})}async function be(e,t,n,s,a=void 0,r=void 0){const o=e.space,i=e.token,c=e.ctx,d=new FormData,l=new Blob([JSON.stringify(t)],{type:"text/plain"}),p={url_Ticket:`${o}/resources/v1/modeler/documents/files/CheckinTicket`,url_Post:`${o}/resources/v1/modeler/documents/?SecurityContext=ctx::${c}`};if(!o&&o!==""){console.log("le store._3DSpace est vide");return}g(p.url_Ticket,{method:"PUT",headers:{ENO_CSRF_TOKEN:i.value},onComplete(m,f,_){const S=JSON.parse(m).data[0].dataelements;d.append("__fcs__jobTicket",S.ticket),d.append("filename",l,n);const h={method:"POST",data:d,onComplete(T){if(c!==""&&i!==""){const M={method:"POST",headers:{ENO_CSRF_TOKEN:i,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{type:"Document",dataelements:{title:`Title_${n.toLowerCase().split(" ").join("_")}`,policy:"Document Release",description:s},relateddata:{files:[{dataelements:{title:`${n}.json`,receipt:T}}]},tempId:F()}]}),type:"json",timeout:0,onComplete:y,onFailure:w};c!==""&&g(p.url_Post,M)}else console.warn("le store est vide")},onFailure:w};function y(T){console.log("Success -- response ",T.data[0]),a&&a(T)}function w(T,M){console.log("Erreur -- response ",T,`
2
+ headers `,M),r&&r(T)}g(S.ticketURL,h)}})}function D(e,t=void 0,n=void 0,s=void 0,a=void 0,r=void 0,o=!1){const i=`${e.space}/resources/modeler/pno/person?current=true&select=preferredcredentials&select=collabspaces`;g(i,{method:"GET",onComplete(c){const d=JSON.parse(c);let l="",p,m,f;if(t){let _=d.collabspaces.find(S=>S.title===t);if(_){p=t;let S=_.couples;S=S.filter((h,y,w)=>y===w.findIndex(T=>T.organization.pid===h.organization.pid&&T.role.pid===h.role.pid)),n&&(Array.isArray(n)?n.forEach(h=>{f||S.forEach(y=>{if(h===y.role.name&&s===y.organization.title)f=h,m=s;else if(h===y.role.name){let w=S.filter(T=>T.role.name===h);w.length===1?(f=w[0].role.name,m=w[0].organization.title):r(w)}})}):S.forEach(h=>{if(n===h.role.name&&s===h.organization.title)f=n,m=s;else if(n===h.role.name){let y=S.filter(w=>w.role.name===n);y.length===1?(f=y[0].role.name,m=y[0].organization.title):r(y)}}))}}p&&m&&f?(l=f+"."+m+"."+p,a(l)):d.preferredcredentials&&o?(l=d.preferredcredentials.role.name+"."+d.preferredcredentials.organization.title+"."+d.preferredcredentials.collabspace.title,a(l)):r&&(l=f+"."+m+"."+p,r(l))},onFailure(c,d){console.log("Erreur de récupération du contexte de sécurité. => ",{err:c,headers:d})}})}async function P(e,t=void 0,n=void 0){return(!e.objID||e.objID==="")&&console.warn("_3DSpace_download_doc() / Le paramètre objectId est obligatoire"),(e.space===""||!e.space)&&console.warn("_3DSpace_download_doc() / Le paramètre space est obligatoire"),(e.token===""||!e.token)&&E(e,s=>{e.token=s},s=>{console.log("☠️ error => ",s)}),new Promise((s,a)=>{$(e,r=>{e?.returnType==="blob"?fetch(r).then(o=>o.blob()).then(o=>{t&&t(o)}):g(r,{onComplete(o){let i;try{i=JSON.parse(o)}catch{i=o}t&&typeof t=="function"&&t(i),s(i)},onFailure(o,i,c){n&&(console.log("error http",o),n({msg:JSON.parse(o),headers:i,xhr:c}),a({msg:JSON.parse(o),headers:i,xhr:c}))}})},r=>{n&&n(r),console.log("*_3dspace_download_doc / error file URL *",r),a(r)})})}async function W(e,t,n=void 0,s=void 0){let a=[];if(typeof t<"u"&&Array.isArray(t)&&t?.length>0){for(let i=0;i<t.length;i+=80){const c=t.slice(i,i+80);a.push(c)}const o=i=>{B(e,a[i],()=>{i++,i<a.length&&o(i)},c=>{n&&n(c)})};o(0)}else console.warn("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini."),s&&s("La liste d'objects dans la fonction _3DSpace_download_multidoc est vide ou non défini.")}function B(e,t,n=void 0,s=void 0,a=void 0){const r=[];t.forEach(c=>{r.push({id:c})});let o=JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:r});const i=`${e.space}/resources/v1/modeler/documents/DownloadTicket?tenant=${e.tenant}&e6w-lang=fr&e6w-timezone=-120`;g(i,{method:"PUT",data:o,type:"json",onComplete(c){const d=c.data;c.success===!0&&(n&&n(),d.forEach(l=>{try{const p=l.dataelements.fileName,m=l.dataelements.ticketURL;g(m,{onComplete:(f,_)=>{let S;try{S=JSON.parse(f)}catch{S=f.blob()}s&&s({objectId:l.id,headers:_,fileName:p,data:S})},onFailure:f=>{console.log("error http",f)}})}catch(p){console.log(p),a&&a(p)}}))},onFailure(c){console.log(c),a&&a(c)}})}function De(e,t,n=void 0,s=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/modeler/dslc/maturity/getNextStates`;D(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t}]}),type:"json",onComplete(i){n&&n(i)},onFailure(i){s&&s(i)}};g(r,o)}})}function Ie(e,t,n,s=void 0,a=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/v1/modeler/dslc/maturity/changeState`;D(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,c=>e.ctx=c,c=>{console.log("onError =>",c)});let i={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{id:t,nextState:n}]}),type:"json",onComplete(c){s&&s(c)},onFailure(c){a&&a(c)}};g(o,i)}})}function ve(e,t,n=void 0,s=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/v1/dslc/versiongraph?withThumbnail=0&withIsLastVersion=0&withAttributes=0&withCopyFrom=0&tenant=${e.tenant}`;D(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({graphRequests:[{id:t}]}),type:"json",onComplete(i){n&&n(i)},onFailure(i){s&&s(i)}};g(r,o)}})}function Ne(e,t,n=void 0,s=void 0){return new Promise(a=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const r=`${e.space}/resources/lifecycle/revise/prepare_revise_maskattributes?tenant=${e.tenant}`;D(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,i=>e.ctx=i,i=>{console.log("onError =>",i)});let o={method:"POST",headers:{SecurityContext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{"attribute[PLMReference.V_versionComment]":null,physicalid:t,type:"Document",tenant:e.tenant,objectId:t,policy:"Document Release",availableSemantic:["E","LAST","NEW","DUP"]}]}),type:"json",onComplete(i){n&&n(i)},onFailure(i){s&&s(i)}};g(r,o)}})}function Ae(e,t,n,s=void 0,a=void 0){return new Promise(r=>{if(e.token===""&&O(e),t!==void 0&&t!==""&&t!==null){const o=`${e.space}/resources/lifecycle/revise/major?tenant=${e.tenant}`;D(e.space,"ESPACE COMMUN",["VPLMProjectLeader","VPLMCreator"],void 0,c=>e.ctx=c,c=>{console.log("onError =>",c)});let i={method:"POST",headers:{securitycontext:"ctx::"+e.ctx,ENO_CSRF_TOKEN:e.token,Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({data:[{physicalid:t,proposedRevision:n,modifiedAttributes:{revision:n}}],folderid:null,notificationTimeout:600}),type:"json",onComplete(c){s&&s(c)},onFailure(c){a&&a(c)}};g(o,i)}})}function ke(e,t,n,s,a=void 0,r=void 0){return new Promise(o=>{const i=`${e.space}/resources/v1/modeler/dsbks/dsbks:Bookmark`;let c={attributes:{title:n,description:s,inheritedAccess:"no"}},d={items:[]};t&&(d.parentId=t),d.items.push(c);let l={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",SecurityContext:e.ctx,ENO_CSRF_TOKEN:e.token},data:JSON.stringify(d),type:"json",onComplete(p){a&&a(p)},onFailure(p){r&&r(p)}};g(i,l)})}function Ue(e,t,n,s,a=void 0,r=void 0){return console.log("credentials",e),new Promise(o=>{`${e.space}`,JSON.stringify({csrf:{name:"ENO_CSRF_TOKEN",value:e.token},data:[{type:"Workspace",cestamp:"businessobject",relId:t,id:t,dataelements:{personList:n,eventsList:s},tenant:e.tenant}]})})}//!SECTION
3
3
  function $e(e,t=void 0,n=void 0){const s={base:`${e.space}`,uri:"/resources/bps/cspaces",optTenant:`tenant=${e.tenant}`},a=`${s.base}${s.uri}?${s.optTenant}`;g(a,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","Content-Type":"application/ds-json"},onComplete(r,o){const i=JSON.parse(r);t&&t(i,o)},onFailure(r,o,i){n&&n({response:r,headers:o,xhr:i})}})}function Fe(e,t,n,s){$(e.space,t,a=>{g(a,{header:{ENO_CSRF_TOKEN:e.token},onComplete:r=>{n&&n(r)},onFailure:r=>{console.log("error http",r),s&&s(r)}})})}async function je(e,t,n=void 0,s=void 0){return new Promise(a=>{$(e,t,r=>{g(r,{onComplete:(o,i,c)=>(a(JSON.parse(o)),n&&n(JSON.parse(o),i,c),a),onFailure:(o,i,c)=>{s&&s(o,i,c),console.log(o,i?.errormsg)}})})})}function Pe(e,t,n,s=void 0,a=void 0){const r=new Blob([JSON.stringify(t)],{type:"text/plain"});U(e,n,o=>{const i=o.data[0].relateddata.files[0].id,c=o.data[0].dataelements.secondaryTitle!==""?o.data[0].dataelements.secondaryTitle:o.data[0].dataelements.title;K(e,n,i,r,c,d=>{s&&s(d)},d=>{a&&a(d)})})}let X,Y;const q=[];async function Re(e,t=void 0,n=void 0){e.objID&&e.objID!==""?U(e,s=>{t&&t(s)},s=>{n&&n(s)}):(e.objID===null||e.objID==="")&&O(e,s=>{t&&t({rep:s,msg:"Pas d'objID, ou invalide"})},s=>{n&&n({msg:"Pas d'objID et erreur sur le Space",err:s})})}async function Me(e,t=void 0,n=void 0){console.log("getDatasByTenant (getDocuments)",e),await P(e,s=>{const a={};a.obj=s,console.log("getDatasByTenant (getDocuments) _datas",a),t&&t?.(a)},s=>{n&&n?.(s)})}function Le(e,t=void 0,n=void 0){const s=[];if(!e.objIds&&!Array.isArray(e.objIds)&&e.objIds.length===0){console.warn("la liste est vide ou n'est pas un tableau");return}e.objIds.forEach((a,r)=>{P(e,a.objID,o=>{s.push({[a.name]:o}),a.name==="dbProjets"&&(X=o.affaires.map(i=>i.objectID),H(e,Y)),r===e.objIds.length-1&&(t&&t(s),delete e.objIds,delete e.datas)})})}function H(e,t,n=void 0,s=void 0){W(e,X,a=>{const r=[...t];r.find(o=>o.objectID===a.objectId).data=a.data,Y=r,q.push(a.data),n&&n(q)},a=>{s&&(s(a),console.log(a))})}const Je="FA35FB9B177A280065800EA0000F599C",Ge=["swym","3dspace","drive","usersgroup","3dplan","dashboard"],z={how:"ds6w:how",what:"ds6w:what",when:"ds6w:when",where:"ds6w:where",who:"ds6w:who",why:"ds6w:why"},Ee={objId:Je,pred:"who",order_by:"desc",tag:"testTag"};function xe(e,t,n=void 0,s=void 0){const{space:a,tenant:r}=e,{objId:o,pred:i,tag:c}=t,d={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${r}`},l=`${a}${d.uri}?${d.otpCTX}&${d.optTenant}`,p={tag:[{subject:[{uri:`pid://${o}`}],predicate:z[i],object:{literal:c}}]};g(l,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},data:JSON.stringify(p),onComplete(m){JSON.parse(m);const f={};setTimeout(()=>{x(e,o,_=>{const S=_.data[0].dataelements.title,h=_.data[0].dataelements.fileExtension!==void 0?_.data[0].dataelements.fileExtension:"",y=_.data[0].relateddata.ownerInfo[0].dataelements.name;f.name=S,f.ext=h,f.createBy=y,t.info={...f},Ke(e,t,w=>{n&&n(w)},w=>{s&&s(w)})},(_,S)=>{const h=_;h.msg=S.errormsg,h.errCode=S.errorcode,console.log("❌ sendDirectMessage => ",h),s&&s(h)})},2e3)},onFailure(m,f){const _=m;_.msg=f.errormsg,_.errCode=f.errorcode,console.log("❌ sendDirectMessage => ",_),s&&s(_)}})}function Ke(e,t,n=void 0,s=void 0){console.log("obj ",t);const a=t.info.name,r={baseUrl:`https://${e.tenant.toLowerCase()}-eu1-fedsearch.3dexperience.3ds.com`,uri:"/federated/search"},o=`${r.baseUrl}${r.uri}`,i={"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},c=F(),d={with_indexing_date:!0,with_synthesis:!0,with_nls:!1,label:`3DSearch-${e.currentUser.username}-AjoutDeTagBeam-${c}`,locale:"fr",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:modified","ds6w:created","ds6wg:revision","ds6w:status","ds6w:responsible","owner","ds6w:responsibleUid","ds6wg:filesize","ds6w:project","ds6w:dataSource","ds6w:community","ds6w:originator","dsgeo:referential","ds6w:lastModifiedBy","ds6w:repository","dcterms:title","dcterms:description","ds6w:containerUid"],with_synthesis_hierarchical:!0,select_file:["icon","thumbnail_2d"],query:a,specific_source_parameter:{"3dspace":{additional_query:' AND NOT (owner:"ENOVIA_CLOUD" OR owner:"Service Creator" OR owner:"Corporate" OR owner:"User Agent" OR owner:"SLMInstallerAdmin" OR owner:"Creator" OR owner:"VPLMAdminUser") AND (ds6w_58_islastrevisionperstate:true OR NOT listoffields:ds6w_58_islastrevisionperstate)'},drive:{additional_query:' AND NOT ([flattenedtaxonomies]:"types/DriveNode" AND ( [current]:"Trashed" OR [policy]:"Drive File Iteration") )'}},select_exclude_synthesis:["ds6w:what/ds6w:topic"],order_by:Ee.order_by,order_field:"relevance",select_snippets:["ds6w:snippet","ds6w:label:snippet","ds6w:responsible:snippet","ds6w:community:snippet","swym:message_text:snippet"],nresults:40,start:"0",source:Ge,tenant:e.tenant,login:{"3dspace":{SecurityContext:e.ctx}}};console.log("dataPattern => ",d),g(o,{method:"POST",headers:i,data:JSON.stringify(d),onComplete(l){const p=JSON.parse(l);n(p)},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.errorcode,console.log("❌ sendDirectMessage => ",m),s&&s(m),console.log("Erreur de recuperation d'id du doc et des tags",l)}})}function Ve(e,t,n=void 0,s=void 0){const{objId:a,pred:r,tag:o}=t,i={uri:"/resources/6w/tags",otpCTX:"SecurityContext=preferred",optTenant:`tenant=${e.tenant}`},c=`${e.space}${i.uri}?${i.otpCTX}&${i.optTenant}`,d={tag:[{subject:[{uri:`pid://${a}`}],predicate:z[r],object:{literal:o}}]};g(c,{method:"DELETE",data:JSON.stringify(d),headers:{"Content-Type":"application/json",Accept:"application/json,text/javascript,*/*"},onComplete(l){n&&n(l)},onFailure(l,p){const m=l;m.msg=p.errormsg,m.errCode=p.errorcode,console.log("❌ sendDirectMessage => ",m),s&&s(m)}})}function We(e,t="",n=void 0,s=void 0){const{space:a}=e;if(t==="")return;const r={uri:"/resources/v1/modeler/documents"},o={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json,text/javascript,*/*"},i=`${a}${r.uri}`,c=`$include=none,lockerInfo,ownerInfo,originatorInfo,files,ownerInfo,originatorInfo&$fields=none,title,name,typeNLS,collabSpaceTitle,revision,isLatestRevision,files,lockStatus,lockerInfo.name,lockerInfo.firstname,lockerInfo.lastname,owner,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,stateNLS,modified,policy,state,organizationTitle,originator,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname,hasModifyAccess,fileExtension,files.name,files.title,files.revision,files.locker,ownerInfo,ownerInfo.name,ownerInfo.firstname,ownerInfo.lastname,originatorInfo,originatorInfo.name,originatorInfo.firstname,originatorInfo.lastname&$ids=${t}`;g(i,{method:"POST",headers:o,data:c,onComplete(d){n&&n(JSON.parse(d))},onFailure(d,l){const p=d;p.msg=l.error,s&&s(p)}})}async function C(e,t=void 0,n=void 0){const s=e.space+"/api/index/tk";return g(s,{onComplete(a,r,o){const i=JSON.parse(a);if(t)return t(i),e.token=i?.result?.ServerToken},onFailure(a){n&&n(a)}})}function Be(e,t=void 0,n=void 0){const s=`${e.space}/api/exalead/whatsnew`,a={params:{community_id:null,hash_key:null,legacyFormat:!1,nresults:1,query:"#all",start:0}};C(e,r=>{g(s,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(a),type:"json",onComplete(o,i){t&&t(o,i)},onFailure(o,i){n&&n(o,i)}})})}function Xe(e,t=void 0,n=void 0){const s=`${e.space}/api/Recommendation/getpeoplefamiliartocurrentuser`,a={params:{idsToFilterArr:[],mode:"offline",limit:30,itemType:"User",maxNbOfCommonElements:"5"}};C(e,r=>{g(s,{method:"POST",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken,"Content-type":"application/json;charset=UTF-8",Accept:"application/json"},data:JSON.stringify(a),type:"json",onComplete(o,i){const c=o.result.hits.map(d=>({login:d.login,fullName:d.name}));t&&t(c,o)},onFailure(o,i){n&&n(o,i)}})})}function Ye(e,t=void 0,n=void 0){const s={base:e.space,uri:"/api/community/listmycommunities",limit:`/limit/${e.limit?e.limit:128}`,page:`/page/${e.page?e.page:"1"}`},a=`${s.base}${s.uri}${s.limit}${s.page}`,r=[];C(e,o=>{g(a,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},onComplete(i,c,d){const p=JSON.parse(i).result;let m=0;p.forEach(f=>{const _={description:f.description,id:f.id,title:f.title,owner:f.owner,role:f.role,access:f.access};Q(e,f.id,S=>{m++,_.members=S,r.push(_),m===p.length&&t&&t(r)},S=>n(S))})},onFailure(i,c){const d=i;d.status=c.status,d.response=c.errormsg,n&&n(d)}})})}function Q(e,t,n,s){const a=`${e.space}/api/community/listmembers`,r={params:{page:e.page?e.page:1,limit:e.limit?e.limit:50,community_id:t}};C(e,o=>{g(a,{method:"POST",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":o.result.ServerToken},data:JSON.stringify(r),type:"json",onComplete(i,c,d){n&&n(i)},onFailure(i,c){const d=i;d.status=c.status,d.response=c.errormsg,s&&s(d)}})})}function qe(e,t=void 0,n=void 0){const s="YXdA5x4DSUKtlAi2wmnyTA";e.commu_id||(e.commu_id=s);const a=`${e.space}/api/v2/communities/${e.commu_id}/ideas/statuses`;C(e,r=>{g(a,{method:"GET",headers:{"Content-type":"application/json;charset=UTF-8",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o){const i=JSON.parse(o);t&&t(i)},onFailure(o,i){const c=o;c.status=i.status,c.response=i.errormsg,n&&n(c)}})})}function He(e,t,n=void 0,s=void 0){const{listAllContacts:a,currentUser:r}=e;console.log("__listAllContacts",a.hits);const o=`${e.space}/api/directmessages`,i={users:[r.login].concat(t.receipt)},c={id_msg:"",senderId:e.currentUser.login,senderName:`${e.currentUser.first_name} ${e.currentUser.last_name}`,msg:ze(t.msg)};let d=!1;Z(i.users,l=>{l!==void 0&&(c.id_msg=l.id,d=!0,R(e,c))},l=>{d=!1,console.log("_3dSwym_findCommunityToInstantMSG callback",l),s&&s(l),c.id_msg=""}),d===!1&&setTimeout(()=>{d===!1&&C(e,l=>{g(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":l.result.ServerToken},data:JSON.stringify(i),type:"json",onComplete(p,m,f){const _=p;_.reponse=JSON.parse(f.response),_.status=f.status,n&&n(_),c.id_msg=_.result.id,R(e,c)},onFailure(p,m,f){const _=p;_.msg=m.errormsg,_.status=m.status,s&&s(_)}})})},500)}function Z(e,t,n,s){const a=`${e.space}/api/directmessages/lite?with_favorites=false`;C(e,r=>{g(a,{method:"GET",headers:{Accept:"application/json,text/javascript,*/*","X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o){const i=JSON.parse(o),c=[];i.result.forEach(p=>{p.users=p.users.sort((m,f)=>m.login.localeCompare(f.login)),p.users.length===t.length&&c.push(p)});const d=t.sort(),l=c.find(p=>{const m=[];return p.users.forEach(f=>{m.push(f.login)}),JSON.stringify(m)===JSON.stringify(d)});n&&l!==void 0?n(l):(s||l===void 0)&&s(l)},onFailure(o){const i=o;i.msg=headers.errormsg,i.errCode=headers.errorcode,console.log("❌ sendDirectMessageLite => ",i),s&&s(i)}})})}function R(e,t,n=void 0,s=void 0){const a={base:e.space,uri:"/api/community",id_msg:`${t.id_msg}`,endUri:"/instantmessages"},r=`${a.base}${a.uri}/${a.id_msg}${a.endUri}`,o={author:{login:t.senderId,displayName:t.senderName},accessState:null,commentUri:null,comments:null,endorsements:null,moderationState:null,parentCommentUri:null,richMessage:t.msg};console.log("_3dSwym_sendDirectMessageData url ",r),C(e,i=>{g(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-DS-SWYM-CSRFTOKEN":i.result.ServerToken},data:JSON.stringify(o),type:"json",onComplete(c,d,l){const p=c;p.status=l.status,p.response=JSON.parse(l.response),console.log("✅ _3dSwym_sendDirectMessageData => ",p),n&&n(p)},onFailure(c,d){const l=c;l.msg=d.errormsg,l.errCode=d.errorcode,console.log("❌ sendDirectMessage => ",l),s&&s(l)}})})}function ze(e){const t=new Date().toLocaleDateString(),n=new Date().toLocaleTimeString();return`<p>${e} </p>
4
4
  <br/>
5
5
  <hr/>
@@ -75,5 +75,5 @@ function $e(e,t=void 0,n=void 0){const s={base:`${e.space}`,uri:"/resources/bps/
75
75
  <tr><td><strong>Service études de prix</strong></td><td><br /></td></tr>
76
76
  </tbody></table>
77
77
  <p>
78
- </p>`:e}function it(e,t=void 0,n=void 0){const s=e.space+"/api/user/getcurrent/";C(e,a=>{g(s,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},onComplete(r,o,i){const c=JSON.parse(r);t&&t(c.result)},onFailure(r,o,i){const c={erreur:JSON.parse(r),headers:o,xhr:i};n&&n(c)}})})}function at(e,t,n=void 0,s=void 0){const a=e.space+"/api/user/find/login/"+t;C(e,r=>{g(a,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o,i,c){const d=JSON.parse(o);n&&n(d)},onFailure(o){s&&s(o)}})},s)}function ot(e,t=void 0,n=void 0){e.tenant&&I(e,s=>{console.log("serviceUrls",s);const a=s.services.find(r=>r.id==="businessprocess")?.url+"/api/v2";t&&t(a)})}function rt(e,t=void 0,n=void 0){e.tenant&&I(e,s=>{console.log("serviceUrls",s);const a=s.services.find(i=>i.id==="3dpassport")?.url,r=s.services.find(i=>i.id==="businessprocess")?.url+"/api/v2",o=`${a}/login/?service=${r}/auth/cas`;g(o,{async onComplete(i){console.log("response",i);const c=typeof i=="string"?JSON.parse(i)?.x3ds_service_redirect_url:i?.x3ds_service_redirect_url;await fetch(c,{method:"POST"}).then(d=>d.json()).then(async d=>{t&&t(d?.token)})},onFailure(i){n&&n(i)}})})}async function ct(e,t,n=void 0,s=void 0){e.tenant&&I(e,a=>{const o=`${a.services.find(i=>i.id==="businessprocess")?.url+"/api/v2"}/identity/users`;fetch(`https://api.uixhome.fr/iterop/listusers?t=${t}&s=${o}`,{method:"POST"}).then(i=>i.json()).then(i=>{n&&n(i)}).catch(i=>{s&&s(i)})})}async function dt(e,t,n=void 0,s=void 0){e.tenant&&I(e,a=>{const o=`${a.services.find(i=>i.id==="businessprocess")?.url+"/api/v2"}/repository/data/tables`;fetch(`https://api.uixhome.fr/iterop/repository/data/tables?t=${t}&s=${o}`,{method:"GET"}).then(i=>i.json()).then(i=>{n&&n(i)}).catch(i=>{s&&s(i)})})}async function lt(e,t,n,s,a=void 0,r=void 0){e.tenant&&I(e,o=>{const i=o.services.find(d=>d.id==="businessprocess")?.url+"/api/v2",c=encodeURIComponent(`${i}`);fetch(`https://api.uixhome.fr/iterop/runtime/processes/${n}?t=${t}&s=${c}&b=${s}`,{method:"POST"}).then(d=>d.json()).then(d=>{a&&a(d)}).catch(d=>{r&&r(d)})})}function ut(e){const t="Hello "+e;return console.log(t),t}function pt(e,t=void 0,n=void 0){return console.log("credentials",e),new Promise(s=>{if(e.token===""&&O(e),!e.space||e.space===""){const o=J();console.log("platformeInfo",o)}b(e,"Common space",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)},!0);const a=N.DateTime.now().ts,r=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dsearch&platformId=${e.tenant}`;g(r,{onComplete(o){if(Array.isArray(JSON.parse(o))){const i=JSON.parse(o);console.log("serviceId=3dsearch",i);const c=`${i[0].services[0].url}/search?xrequestedwith=xmlhttprequest`;g(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({with_indexing_date:!0,with_nls:!1,label:`3DSearch-${a}`,locale:"en",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:responsible","ds6wg:fullname"],select_file:["icon","thumbnail_2d"],query:'([ds6w:type]:(Group) AND [ds6w:status]:(Public)) OR (flattenedtaxonomies:"types/Person" AND current:"active")',order_by:"desc",order_field:"relevance",nresults:1e3,start:"0",source:["3dspace","usersgroup"],tenant:e.tenant,login:{"3dspace":{SecurityContext:`ctx::${e.ctx}`}}}),type:"json",onComplete(d){t&&t(d)},onFailure(d){n&&n(d)}})}},onFailure(o){n&&n(o)}})})}u.UUID=F,u._3DSearch_usersGroup=pt,u._3DSpace_Create_Doc=De,u._3DSpace_bookmark_addSubsciptions=Ue,u._3DSpace_bookmark_newWorkspace=ke,u._3DSpace_csrf=O,u._3DSpace_download_doc=P,u._3DSpace_download_multidoc=W,u._3DSpace_file_update=K,u._3DSpace_file_update_csr=V,u._3DSpace_file_url_csr=Oe,u._3DSpace_get_csrf=U,u._3DSpace_get_docInfo=x,u._3DSpace_get_downloadTicket_multidoc=B,u._3DSpace_get_multiDocInfo=Te,u._3DSpace_get_securityContexts=b,u._3DSpace_get_ticket=$,u._3DSpace_lifecycle_changeRevision=Ae,u._3DSpace_lifecycle_changeState=Ie,u._3DSpace_lifecycle_getGraph=ve,u._3DSpace_lifecycle_getNextRevision=Ne,u._3DSpace_lifecycle_getNextStates=be,u._3DSwym_buildDirectMessage=He,u._3DSwym_deleteIdea=et,u._3DSwym_findCommunityToInstantMSG=Z,u._3DSwym_getAllCommunities=Ye,u._3DSwym_getAllNews=Be,u._3DSwym_getFamiliarPeople=Xe,u._3DSwym_getIdeaStatusMaturity=qe,u._3DSwym_getMembersCommunity=Q,u._3DSwym_getSWYMIdea=tt,u._3DSwym_get_AllSWYMIdeas=nt,u._3DSwym_get_currentUser=it,u._3DSwym_get_findUser=at,u._3DSwym_get_version=C,u._3DSwym_postIdea=Ze,u._3DSwym_sendMessageData=R,u._AppMngt_get_info_user=ue,u._AppMngt_get_users=le,u._Iterop_Auth_CAS=rt,u._Iterop_ListUsers=ct,u._Iterop_getAllBusinessTables=dt,u._Iterop_runProcess=lt,u._getPlateformInfos=J,u._getPlatformServices=re,u._getServiceUrl=I,u._getServiceUrl_3DPassport=ce,u._getServiceUrl_Iterop=ot,u._httpCallAuthenticated=g,u._setDraggable=ie,u._setDroppable=oe,u._setupTagger=ae,u.addTagToDoc=xe,u.compass_getListAdditionalApps=de,u.couleurs=L,u.createUserGroups=pe,u.dataMixing=H,u.deleteUserGroups=ge,u.findAdresse=te,u.getAllContextSecurity=$e,u.getCSRFToken=E,u.getCommunes=ee,u.getComplementUG=fe,u.getDataFrom3DSpace=Fe,u.getDataFromGouvFr=ne,u.getDatasByTenant=Me,u.getDatasFrom3DSpace=Le,u.getDownloadDocument=je,u.getInfoDocTags=We,u.getUserGroupsList=me,u.getUsersGroupRules=G,u.get_3DSpace_csrf=Re,u.patchUserGroups=_e,u.patchUserGroupsControl=Se,u.pushDataIn3DSpace=Pe,u.readUserGroupControl=he,u.removeTagToDoc=Ve,u.sayHello=ut,u.updateEvent=se,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
78
+ </p>`:e}function it(e,t=void 0,n=void 0){const s=e.space+"/api/user/getcurrent/";C(e,a=>{g(s,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":a.result.ServerToken},onComplete(r,o,i){const c=JSON.parse(r);t&&t(c.result)},onFailure(r,o,i){const c={erreur:JSON.parse(r),headers:o,xhr:i};n&&n(c)}})})}function at(e,t,n=void 0,s=void 0){const a=e.space+"/api/user/find/login/"+t;C(e,r=>{g(a,{method:"GET",headers:{"X-DS-SWYM-CSRFTOKEN":r.result.ServerToken},onComplete(o,i,c){const d=JSON.parse(o);n&&n(d)},onFailure(o){s&&s(o)}})},s)}function ot(e,t=void 0,n=void 0){e.tenant&&I(e,s=>{console.log("serviceUrls",s);const a=s.services.find(r=>r.id==="businessprocess")?.url+"/api/v2";t&&t(a)})}function rt(e,t=void 0,n=void 0){e.tenant&&I(e,s=>{console.log("serviceUrls",s);const a=s.services.find(i=>i.id==="3dpassport")?.url,r=s.services.find(i=>i.id==="businessprocess")?.url+"/api/v2",o=`${a}/login/?service=${r}/auth/cas`;g(o,{async onComplete(i){console.log("response",i);const c=typeof i=="string"?JSON.parse(i)?.x3ds_service_redirect_url:i?.x3ds_service_redirect_url;await fetch(c,{method:"POST"}).then(d=>d.json()).then(async d=>{t&&t(d?.token)})},onFailure(i){n&&n(i)}})})}async function ct(e,t,n=void 0,s=void 0){e.tenant&&I(e,a=>{const o=`${a.services.find(i=>i.id==="businessprocess")?.url+"/api/v2"}/identity/users`;fetch(`https://api.uixhome.fr/iterop/listusers?t=${t}&s=${o}`,{method:"POST"}).then(i=>i.json()).then(i=>{n&&n(i)}).catch(i=>{s&&s(i)})})}async function dt(e,t,n=void 0,s=void 0){e.tenant&&I(e,a=>{const o=`${a.services.find(i=>i.id==="businessprocess")?.url+"/api/v2"}/repository/data/tables`;fetch(`https://api.uixhome.fr/iterop/repository/data/tables?t=${t}&s=${o}`,{method:"GET"}).then(i=>i.json()).then(i=>{n&&n(i)}).catch(i=>{s&&s(i)})})}async function lt(e,t,n,s,a=void 0,r=void 0){e.tenant&&I(e,o=>{const i=o.services.find(d=>d.id==="businessprocess")?.url+"/api/v2",c=encodeURIComponent(`${i}`);fetch(`https://api.uixhome.fr/iterop/runtime/processes/${n}?t=${t}&s=${c}&b=${s}`,{method:"POST"}).then(d=>d.json()).then(d=>{a&&a(d)}).catch(d=>{r&&r(d)})})}function ut(e){const t="Hello "+e;return console.log(t),t}function pt(e,t=void 0,n=void 0){return console.log("credentials",e),new Promise(s=>{if(e.token===""&&O(e),!e.space||e.space===""){const o=J();console.log("platformeInfo",o)}D(e,"Common space",["VPLMProjectLeader","VPLMCreator"],void 0,o=>e.ctx=o,o=>{console.log("onError =>",o)},!0);const a=N.DateTime.now().ts,r=`https://${e.tenant}-eu1-registry.3dexperience.3ds.com/api/v1/platform/service/instance?serviceId=3dsearch&platformId=${e.tenant}`;g(r,{onComplete(o){if(Array.isArray(JSON.parse(o))){const i=JSON.parse(o);console.log("serviceId=3dsearch",i);const c=`${i[0].services[0].url}/search?xrequestedwith=xmlhttprequest`;g(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},data:JSON.stringify({with_indexing_date:!0,with_nls:!1,label:`3DSearch-${a}`,locale:"en",select_predicate:["ds6w:label","ds6w:type","ds6w:description","ds6w:identifier","ds6w:responsible","ds6wg:fullname"],select_file:["icon","thumbnail_2d"],query:'([ds6w:type]:(Group) AND [ds6w:status]:(Public)) OR (flattenedtaxonomies:"types/Person" AND current:"active")',order_by:"desc",order_field:"relevance",nresults:1e3,start:"0",source:["3dspace","usersgroup"],tenant:e.tenant,login:{"3dspace":{SecurityContext:`ctx::${e.ctx}`}}}),type:"json",onComplete(d){t&&t(d)},onFailure(d){n&&n(d)}})}},onFailure(o){n&&n(o)}})})}u.UUID=F,u._3DSearch_usersGroup=pt,u._3DSpace_Create_Doc=be,u._3DSpace_bookmark_addSubsciptions=Ue,u._3DSpace_bookmark_newWorkspace=ke,u._3DSpace_csrf=O,u._3DSpace_download_doc=P,u._3DSpace_download_multidoc=W,u._3DSpace_file_update=K,u._3DSpace_file_update_csr=V,u._3DSpace_file_url_csr=Oe,u._3DSpace_get_csrf=U,u._3DSpace_get_docInfo=x,u._3DSpace_get_downloadTicket_multidoc=B,u._3DSpace_get_multiDocInfo=Te,u._3DSpace_get_securityContexts=D,u._3DSpace_get_ticket=$,u._3DSpace_lifecycle_changeRevision=Ae,u._3DSpace_lifecycle_changeState=Ie,u._3DSpace_lifecycle_getGraph=ve,u._3DSpace_lifecycle_getNextRevision=Ne,u._3DSpace_lifecycle_getNextStates=De,u._3DSwym_buildDirectMessage=He,u._3DSwym_deleteIdea=et,u._3DSwym_findCommunityToInstantMSG=Z,u._3DSwym_getAllCommunities=Ye,u._3DSwym_getAllNews=Be,u._3DSwym_getFamiliarPeople=Xe,u._3DSwym_getIdeaStatusMaturity=qe,u._3DSwym_getMembersCommunity=Q,u._3DSwym_getSWYMIdea=tt,u._3DSwym_get_AllSWYMIdeas=nt,u._3DSwym_get_currentUser=it,u._3DSwym_get_findUser=at,u._3DSwym_get_version=C,u._3DSwym_postIdea=Ze,u._3DSwym_sendMessageData=R,u._AppMngt_get_info_user=ue,u._AppMngt_get_users=le,u._Iterop_Auth_CAS=rt,u._Iterop_ListUsers=ct,u._Iterop_getAllBusinessTables=dt,u._Iterop_runProcess=lt,u._getPlateformInfos=J,u._getPlatformServices=re,u._getServiceUrl=I,u._getServiceUrl_3DPassport=ce,u._getServiceUrl_Iterop=ot,u._httpCallAuthenticated=g,u._setDraggable=ie,u._setDroppable=oe,u._setupTagger=ae,u.addTagToDoc=xe,u.compass_getListAdditionalApps=de,u.couleurs=L,u.createUserGroups=pe,u.dataMixing=H,u.deleteUserGroups=ge,u.findAdresse=te,u.getAllContextSecurity=$e,u.getCSRFToken=E,u.getCommunes=ee,u.getComplementUG=fe,u.getDataFrom3DSpace=Fe,u.getDataFromGouvFr=ne,u.getDatasByTenant=Me,u.getDatasFrom3DSpace=Le,u.getDownloadDocument=je,u.getInfoDocTags=We,u.getUserGroupsList=me,u.getUsersGroupRules=G,u.get_3DSpace_csrf=Re,u.patchUserGroups=_e,u.patchUserGroupsControl=Se,u.pushDataIn3DSpace=Pe,u.readUserGroupControl=he,u.removeTagToDoc=Ve,u.sayHello=ut,u.updateEvent=se,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
79
79
  //# sourceMappingURL=wb3Api.umd.cjs.map