@inweb/client 25.12.0 → 25.12.2

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
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ODA=t.ODA||{},t.ODA.Api=t.ODA.Api||{}))}(this,(function(t){"use strict";const e={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};function s(t){return e[t]||`Error ${t}`}function i(t,e="400"){try{return JSON.parse(t).description}catch{return e}}class r extends Error{constructor(t,e){super(e||s(t)),this.name="FetchError",this.status=t,this.statusText=s(t)}}class n{constructor(t,e){this.path=`${e.path}/downloads`,this.httpClient=e.httpClient,this._file=e,this._data=t}get assembly(){return this._file}get data(){return this._data}set data(t){this._data=t}get database(){return this.data.database}get default(){return this.data.default}get file(){return this._file}get fileId(){return this.data.fileId}get geometry(){return this.data.geometry}get id(){return this.data.id}get name(){return this.data.name}get type(){return this.file.type}get version(){return this.data.version}getModels(){return Promise.resolve([this])}getModelTransformMatrix(t){return this.file.getModelTransformMatrix(t)}setModelTransformMatrix(t,e){return this.file.setModelTransformMatrix(t,e).then((()=>this))}getViewpoints(){return this._file.getViewpoints().then((t=>t.filter((({custom_fields:t={}})=>t.modelId===this.id||t.modelName===this.name))))}saveViewpoint(t){return this._file.saveViewpoint({...t,custom_fields:{...t.custom_fields,modelId:this.id,modelName:this.name}})}deleteViewpoint(t){return this._file.deleteViewpoint(t)}getSnapshot(t){return this._file.getSnapshot(t)}getSnapshotData(t,e){return this._file.getSnapshotData(t,e)}downloadResource(t,e,s){return this._file.downloadResource(t,e,s)}downloadResourceRange(t,e,s,i,r){return this._file.downloadResourceRange(t,e,s,i,r)}partialDownloadResource(t,e,s){return console.warn("Model.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Model.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,i,r){if(!e)return;let n=[];if(e.length)n=e.map((t=>({begin:Number(t.begin),end:Number(t.end),requestId:t.reqId})));else for(let s=0;s<e.size();s++){const i=e.get(s);n.push({begin:Number(i.begin),end:Number(i.end),requestId:t}),i.delete()}await this.downloadResourceRange(s,t,n,i,r)}getReferences(t){return this._file.getReferences(t)}}function a(t,e){return new Promise((s=>{let i=0;const r=()=>{clearTimeout(i),s(!0)};i=window.setTimeout((()=>{e.removeEventListener("abort",r),s(!1)}),t),e.addEventListener("abort",r,{once:!0})}))}async function o(t,e={}){var s,i,r;const n=e.timeout||6e5,o=e.interval||3e3,h=null!==(s=e.signal)&&void 0!==s?s:(new AbortController).signal,l=null!==(i=e.abortError)&&void 0!==i?i:new DOMException("Aborted","AbortError"),d=null!==(r=e.timeoutError)&&void 0!==r?r:new DOMException("Timeout","TimeoutError"),u=performance.now()+n;let p=n/o;do{if(await t(e))return Promise.resolve(e.result);if(await a(o,h)||h.aborted)return Promise.reject(l)}while(performance.now()<u&&--p>0);return Promise.reject(d)}function h(t){if("string"==typeof t){const e=t.indexOf("--");-1!==e&&(t=t.slice(e));const s=t.split("--").map((t=>t.split("=").map((t=>t.split(" "))).flat())).filter((t=>t[0])).map((t=>t.concat([""])));return Object.fromEntries(s)}return t||{}}function l(t,e="",s=""){var i;return t&&"string"!=typeof t?l(null!==(i=t.firstName)&&void 0!==i?i:t.name,t.lastName,t.userName):`${null!=t?t:""} ${null!=e?e:""}`.trim()||s}function d(t=""){const e=t.split(" ").filter((t=>t));return e.reduce(((t,s,i)=>(0!==i&&i!==e.length-1||(t+=s.charAt(0)),t)),"").toUpperCase()}class u{constructor(t,e,s){this.httpClient=s,this.basePath=e,this.data=t}internalGet(t){return this.httpClient.get(`${this.basePath}/clashes/${this.id}${t}`)}internalPut(t,e){return this.httpClient.put(`${this.basePath}/clashes/${this.id}${t}`,e)}internalDelete(t){return this.httpClient.delete(`${this.basePath}/clashes/${this.id}${t}`)}get clearance(){return this.data.clearance}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName)}get id(){return this.data.id}get lastModifiedAt(){return this.data.lastModifiedAt}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get selectionSetA(){return this.data.selectionSetA}get selectionTypeA(){return this.data.selectionTypeA}get selectionSetB(){return this.data.selectionSetB}get selectionTypeB(){return this.data.selectionTypeB}get status(){return this.data.status}get tolerance(){return this.data.tolerance}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.json()))}save(){return this.update(this.data)}waitForDone(t){return o((()=>this.checkout().then((e=>{var s;const i=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,i))||i}))),t).then((()=>this))}getReport(){return this.internalGet("/report").then((t=>t.json()))}}class p{constructor(t,e){this.path=`/assemblies/${t.id}`,this.httpClient=e,this.data=t}appendVersionParam(t){if(void 0===this._useVersion)return t;const e=t.includes("?")?"&":"?";return`${t}${e}version=${this._useVersion}`}internalGet(t,e){return t=this.appendVersionParam(t),this.httpClient.get(`${this.path}${t}`,e)}internalPost(t,e){return t=this.appendVersionParam(t),this.httpClient.post(`${this.path}${t}`,e)}internalPut(t,e){return t=this.appendVersionParam(t),this.httpClient.put(`${this.path}${t}`,e)}internalDelete(t){return t=this.appendVersionParam(t),this.httpClient.delete(`${this.path}${t}`)}get activeVersion(){return this.data.activeVersion}get associatedFiles(){return this.data.associatedFiles}get created(){return this.data.created}get data(){return this._data}set data(t){var e,s;this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName),null!==(e=(s=this._data).associatedFiles)&&void 0!==e||(s.associatedFiles=[]),this._data.associatedFiles.forEach((t=>t.link=`${this.httpClient.serverUrl}/files/${t.fileId}`))}get files(){return this.data.files}get geometryType(){return"done"===this.status?"vsfx":""}get id(){return this.data.id}get name(){return this.data.name}set name(t){this.data.name=t}get originalAssemblyId(){return this.data.originalAssemblyId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl||""}get relatedJobs(){return this.data.relatedJobs}get status(){return this.data.status}get type(){return"assembly"}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.json()))}save(){return this.update(this.data)}setPreview(t){return console.warn("Assembly does not support preview"),Promise.resolve(this)}deletePreview(){return console.warn("Assembly does not support preview"),Promise.resolve(this)}getModels(){return this.internalGet("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){return this.data.transform[t]}setModelTransformMatrix(t,e){const s={...this.data.transform};return s[t]=e,this.update({transform:s})}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.internalGet(e).then((t=>t.json()))}searchProperties(t){return this.internalPost("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.internalGet("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.internalGet("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.internalPost("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return this.internalDelete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.internalGet(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.internalGet(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}downloadResource(t,e,s){const i=this.appendVersionParam(`/downloads/${t}`);return this.httpClient.downloadFile(`${this.path}${i}`,e,s).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,i,r){const n=this.appendVersionParam(`/downloads/${t}?requestId=${e}`);return this.httpClient.downloadFileRange(`${this.path}${n}`,e,s,i,r).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("Assembly.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Assembly.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,i,r){await this.downloadResourceRange(s,t,e,i,r)}async getReferences(t){return{id:"",references:await Promise.all(this.associatedFiles.map((t=>`/files/${t.fileId}/references`)).map((e=>this.httpClient.get(e,t).then((t=>t.json()))))).then((t=>t.map((t=>t.references)))).then((t=>t.reduce(((t,e)=>[...e,...t]),[]))).then((t=>[...new Set(t.map(JSON.stringify))].map((t=>JSON.parse(t)))))}}waitForDone(t){return o((()=>this.checkout().then((e=>{var s;const i=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,i))||i}))),t).then((()=>this))}getClashTests(t,e,s,i,r,n){const a=new URLSearchParams;t>0&&a.set("start",t.toString()),e>0&&a.set("limit",e.toString()),s&&a.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.trim()),i&&a.set("id",i)),void 0!==r&&a.set("sortBy",r?"desc":"asc"),n&&a.set("sortField",n);let o=a.toString();return o&&(o="?"+o),this.internalGet(`/clashes${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new u(t,this.path,this.httpClient)))})))}getClashTest(t){return this.internalGet(`/clashes/${t}`).then((t=>t.json())).then((t=>new u(t,this.path,this.httpClient)))}createClashTest(t,e,s,i,r,n){const{tolerance:a,clearance:o,waitForDone:h}=null!=n?n:{};return Array.isArray(i)||(i=[i]),Array.isArray(r)||(r=[r]),this.internalPost("/clashes",{name:t,selectionTypeA:e,selectionTypeB:s,selectionSetA:i,selectionSetB:r,tolerance:a,clearance:o}).then((t=>t.json())).then((t=>new u(t,this.path,this.httpClient))).then((t=>h?t.waitForDone(n):t))}deleteClashTest(t){return this.internalDelete(`/clashes/${t}`).then((t=>t.json()))}updateVersion(t,e={waitForDone:!1}){return Promise.reject(new Error("Assembly version support will be implemeted in a future release"))}getVersions(){return Promise.resolve(void 0)}getVersion(t){return Promise.reject(new r(404))}deleteVersion(t){return Promise.reject(new r(404))}setActiveVersion(t){return this.update({activeVersion:t})}useVersion(t){return this._useVersion=void 0,this}}class c{constructor(){this._listeners={}}addEventListener(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this}removeEventListener(t,e){if(void 0===this._listeners[t])return this;const s=this._listeners[t].filter((t=>t!==e));return 0!==s.length?this._listeners[t]=s:delete this._listeners[t],this}removeAllListeners(t){return t?delete this._listeners[t]:this._listeners={},this}emitEvent(t){if(void 0===this._listeners[t.type])return!1;return this._listeners[t.type].slice().forEach((e=>e.call(this,t))),!0}on(t,e){return this.addEventListener(t,e)}off(t,e){return this.removeEventListener(t,e)}emit(t,...e){return"string"==typeof t?this.emitEvent({type:t,args:e}):"object"==typeof t&&this.emitEvent(t)}}function m(t){if(!t.ok)switch(t.status){case 400:return t.text().then((t=>(console.error(t),Promise.reject(new r(400,i(t))))));case 500:return t.text().then((t=>(console.error(i(t,t)),Promise.reject(new r(500)))));default:return Promise.reject(new r(t.status))}return Promise.resolve(t)}function g(t,e={method:"GET"}){const s={...e.headers};let i;delete s["Content-Type"],"POST"!==e.method&&"PUT"!==e.method||(e.body instanceof FormData?i=e.body:e.body instanceof Blob?(i=new FormData,i.append("file",e.body)):e.body instanceof ArrayBuffer?(i=new FormData,i.append("file",new Blob([e.body]))):"object"==typeof e.body?(i=JSON.stringify(e.body),s["Content-Type"]="application/json"):"string"==typeof e.body&&(i=e.body,s["Content-Type"]="text/plain"));const r={method:e.method,headers:s};return i&&(r.body=i),e.signal&&(r.signal=e.signal),fetch(t,r).then(m)}function w(t,e={method:"GET"}){return new Promise(((s,n)=>{const a=new XMLHttpRequest;a.open(e.method,t,!0);for(const t in e.headers)a.setRequestHeader(t,e.headers[t]);function o(t){return t.lengthComputable?t.loaded/t.total:1}a.upload.onprogress=t=>e.uploadProgress&&e.uploadProgress(o(t)),a.onprogress=t=>e.downloadProgress&&e.downloadProgress(o(t)),a.onloadend=t=>function(t){if(0===t.status)return Promise.reject(new r(0,"Network error"));if(t.status<200||t.status>299)switch(t.status){case 400:return console.error(t.responseText),Promise.reject(new r(400,i(t.responseText)));case 500:return console.error(i(t.responseText,t.responseText)),Promise.reject(new r(500));default:return Promise.reject(new r(t.status))}return Promise.resolve(t)}(t.target).then(s,n),a.send(e.body)}))}class f{constructor(t){this.headers={},this.signInUserId="",this.signInUserIsAdmin=!1,this.serverUrl=t}get(t,e){return g(`${this.serverUrl}${t}`,{method:"GET",headers:this.headers,signal:e})}post(t,e){return g(`${this.serverUrl}${t}`,{method:"POST",headers:this.headers,body:e})}put(t,e){return g(`${this.serverUrl}${t}`,{method:"PUT",headers:this.headers,body:e})}delete(t){return g(`${this.serverUrl}${t}`,{method:"DELETE",headers:this.headers})}uploadFile(t,e,s){const i=new FormData;return i.append("file",e),w(`${this.serverUrl}${t}`,{method:"POST",headers:this.headers,body:i,uploadProgress:s})}async downloadFile(t,e,s){const i=await this.get(t,s),r=i.headers.get("Content-Length"),n=parseInt(r||"",10)||1;return new Response(new ReadableStream({async start(t){const s=i.body.getReader();let r=0;for(;;){const{done:i,value:a}=await s.read();if(i)break;t.enqueue(a),r+=a.length,e&&e(r/n,a)}t.close()}}))}async downloadFileRange(t,e,s,i,r){const n={...this.headers};n.Range="bytes="+s.map((t=>`${t.begin}-${t.end}`)).join(",");const a=await g(`${this.serverUrl}${t}`,{method:"GET",headers:n,signal:r}),o=a.headers.get("content-length"),h=parseInt(o||"",10)||1;return new Response(new ReadableStream({async start(t){const e=a.body.getReader();let r=0,n=0,o=0;for(;;){const{done:a,value:l}=await e.read();if(a)break;t.enqueue(l),r+=l.length;let d=l.length,u=0;for(;d>0;){const t=s[n],e=t.end-t.begin-o;if(d<e){const e=l.subarray(u,u+d);i&&i(r/h,e,t.requestId),o+=d,d=0}else{const s=l.subarray(u,u+e);i&&i(r/h,s,t.requestId),u+=e,d-=e,n++,o=0}}}t.close()}}))}}class v{constructor(t,e,s){this.httpClient=s,this.fileId=e,this.data=t}internalGet(){return this.httpClient.get(`/files/${this.fileId}/permissions/${this.id}`)}internalPut(t){return this.httpClient.put(`/files/${this.fileId}/permissions/${this.id}`,t)}internalDelete(){return this.httpClient.delete(`/files/${this.fileId}/permissions/${this.id}`)}get actions(){return this.data.actions}set actions(t){this._data.actions=t}get data(){return this._data}set data(t){this._data=t}get id(){return this.data.id}get grantedTo(){return this.data.grantedTo}set grantedTo(t){this.data.grantedTo=t}get public(){return this.data.public}set public(t){this.data.public=t}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}}class y{constructor(t,e){this.httpClient=e,this.data=t}internalGet(){return this.httpClient.get(`/jobs/${this.data.id}`)}internalPut(t){return this.httpClient.put(`/jobs/${this.data.id}`,t)}internalDelete(){return this.httpClient.delete(`/jobs/${this.data.id}`)}get assemblyId(){return this.data.assemblyId}get authorId(){return this.data.authorId}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t}get done(){return"done"===this.data.status||"failed"===this.data.status}get fileId(){return this.data.fileId}get id(){return this.data.id}get lastUpdate(){return this.data.lastUpdate}get outputFormat(){return this.data.outputFormat}get parameters(){return this.data.parameters}get status(){return this.data.status}get statusMessage(){return this.data.statusMessage}get startedAt(){return this.data.startedAt}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}waitForDone(t){return o((()=>this.checkout().then((e=>{var s;const i=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,i))||i}))),t).then((()=>this))}}class C{constructor(t,e){this.path=`/files/${t.id}`,this.httpClient=e,this.data=t}appendVersionParam(t){if(void 0===this._useVersion)return t;const e=t.includes("?")?"&":"?";return`${t}${e}version=${this._useVersion}`}internalGet(t,e){return t=this.appendVersionParam(t),this.httpClient.get(`${this.path}${t}`,e)}internalPost(t,e){return t=this.appendVersionParam(t),this.httpClient.post(`${this.path}${t}`,e)}internalPut(t,e){return t=this.appendVersionParam(t),this.httpClient.put(`${this.path}${t}`,e)}internalDelete(t){return t=this.appendVersionParam(t),this.httpClient.delete(`${this.path}${t}`)}get activeVersion(){return this.data.activeVersion}get created(){return this.data.created}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){var e,s,i,r,n,a,o,h,u,p,c,m,g,w,f,v,y,C,j,_,$;this._data=t,this._data.previewUrl=t.preview?`${this.httpClient.serverUrl}${this.path}/preview?updated=${t.updatedAt}`:"","string"==typeof this._data.owner&&(this._data.owner={userId:this._data.owner}),null!==(e=(g=this._data).owner)&&void 0!==e||(g.owner={}),this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName),null!==(s=(w=this._data).status)&&void 0!==s||(w.status={}),null!==(i=(f=this._data.status).geometry)&&void 0!==i||(f.geometry={state:null!==(r=this._data.geometryStatus)&&void 0!==r?r:"none"}),null!==(n=(v=this._data.status).properties)&&void 0!==n||(v.properties={state:null!==(a=this._data.propertiesStatus)&&void 0!==a?a:"none"}),null!==(o=(y=this._data.status).validation)&&void 0!==o||(y.validation={state:null!==(h=this._data.validationStatus)&&void 0!==h?h:"none"}),null!==(u=(C=this._data).updatedBy)&&void 0!==u||(C.updatedBy={}),this._data.updatedBy.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`,this._data.updatedBy.fullName=l(this._data.updatedBy),this._data.updatedBy.initials=d(this._data.updatedBy.fullName),null!==(p=(j=this._data).versions)&&void 0!==p||(j.versions=[{...t}]),null!==(c=(_=this._data.status).geometryGltf)&&void 0!==c||(_.geometryGltf={state:"none"}),null!==(m=($=this._data).isFileDeleted)&&void 0!==m||($.isFileDeleted=!1)}get exports(){return this.data.exports}get geometryType(){return"done"===this.status.geometryGltf.state?"gltf":"done"===this.status.geometry.state?"vsfx":""}get id(){return this.data.id}get isFileDeleted(){return this.data.isFileDeleted}get name(){return this.data.name}set name(t){this.data.name=t}get originalFileId(){return this.data.originalFileId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl}get size(){return this.data.size}get sizeTotal(){return this.data.sizeTotal}get status(){return this.data.status}get type(){return this.data.type}get updatedAt(){return this.data.updatedAt}get updatedBy(){return this.data.updatedBy}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.json()))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.internalPost("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await this.internalDelete("/preview");return this.data=await t.json(),this}getModels(){return this.internalGet("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){}setModelTransformMatrix(t,e){return console.warn("File does not support model transformation"),Promise.resolve(this)}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.internalGet(e).then((t=>t.json()))}searchProperties(t){return this.internalPost("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.internalGet("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.internalGet("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.internalPost("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return this.internalDelete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.internalGet(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.internalGet(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}download(t,e){const s=this.appendVersionParam("/downloads");return this.httpClient.downloadFile(`${this.path}${s}`,t,e).then((t=>t.arrayBuffer()))}downloadResource(t,e,s){const i=this.appendVersionParam(`/downloads/${t}`);return this.httpClient.downloadFile(`${this.path}${i}`,e,s).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,i,r){const n=this.appendVersionParam(`/downloads/${t}?requestId=${e}`);return this.httpClient.downloadFileRange(`${this.path}${n}`,e,s,i,r).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("File.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use File.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,i,r){await this.downloadResourceRange(s,t,e,i,r)}getReferences(t){return this.internalGet("/references",t).then((t=>t.json()))}setReferences(t){return this.internalPut("/references",t).then((t=>t.json()))}createJob(t,e){const s=this.appendVersionParam("/jobs");return this.httpClient.post(s,{fileId:this.id,outputFormat:t,parameters:h(e)}).then((t=>t.json())).then((t=>new y(t,this.httpClient)))}extractGeometry(t,e){return this.createJob("gltf"===t?"geometryGltf":"geometry",e)}extractProperties(t){return this.createJob("properties",t)}validate(t){return this.createJob("validation",t)}waitForDone(t,e,s){const i=Array.isArray(t)?t:[t];void 0===e&&(e=!0);return o((()=>this.checkout().then((t=>{var r;const n=i.filter((e=>{const s=t.status[e]||{};return["none","done","failed"].includes(s.state||"none")})),a=e?n.length===i.length:n.length>0;return(null===(r=null==s?void 0:s.onCheckout)||void 0===r?void 0:r.call(s,t,a))||a}))),s).then((()=>this))}getPermissions(){return this.internalGet("/permissions").then((t=>t.json())).then((t=>t.map((t=>new v(t,this.id,this.httpClient)))))}getPermission(t){return this.internalGet(`/permissions/${t}`).then((t=>t.json())).then((t=>new v(t,this.id,this.httpClient)))}createPermission(t,e,s){return this.internalPost("/permissions",{actions:Array.isArray(t)?t:[t],grantedTo:e,public:s}).then((t=>t.json())).then((t=>new v(t,this.id,this.httpClient)))}deletePermission(t){return this.internalDelete(`/permissions/${t}`).then((t=>t.json()))}async uploadVersion(t,e={waitForDone:!1}){const s=await this.httpClient.uploadFile(`${this.path}/versions`,t,(s=>{var i;return null===(i=e.onProgress)||void 0===i?void 0:i.call(e,s,t)})).then((t=>JSON.parse(t.responseText))).then((t=>new C(t,this.httpClient)));let i="";"none"!==this.versions[0].status.geometryGltf.state&&(i="gltf"),"none"!==this.versions[0].status.geometry.state&&(i="vsfx"),void 0===(e={...e}).geometry&&(e.geometry=""!==i),void 0===e.properties&&(e.properties="none"!==this.versions[0].status.properties.state);const r=[];return e.geometry&&r.push((await s.extractGeometry(i)).outputFormat),e.properties&&r.push((await s.extractProperties()).outputFormat),r.length>0&&(e.waitForDone?await s.waitForDone(r,!0,e):await s.checkout()),await this.checkout(),s}getVersions(){return this.internalGet("/versions").then((t=>t.json())).then((t=>t.map((t=>new C(t,this.httpClient))))).then((t=>t.map((t=>t.id==t.originalFileId?t.useVersion(0):t))))}getVersion(t){return this.internalGet(`/versions/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient))).then((t=>t.id==t.originalFileId?t.useVersion(0):t))}async deleteVersion(t){const e=await this.internalDelete(`/versions/${t}`),s=await e.json();return await this.checkout(),s}setActiveVersion(t){return this.update({activeVersion:t})}useVersion(t){return this._useVersion=t,this}async deleteSource(){const t=await this.internalDelete("/source");return this.data=await t.json(),this}}class j{constructor(t,e,s){this.httpClient=s,this.projectId=e,this.data=t}internalGet(){return this.httpClient.get(`/projects/${this.projectId}/roles/${this.name}`)}internalPut(t){return this.httpClient.put(`/projects/${this.projectId}/roles/${this.name}`,t)}internalDelete(){return this.httpClient.delete(`/projects/${this.projectId}/roles/${this.name}`)}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t}get name(){return this.data.name}set name(t){this._data.name=t}get permissions(){return this.data.permissions}set permissions(t){this.data.permissions=t||{}}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}}class _{constructor(t,e,s){this.httpClient=s,this.projectId=e,this.data=t}internalGet(){return this.httpClient.get(`/projects/${this.projectId}/members/${this.id}`)}internalPut(t){return this.httpClient.put(`/projects/${this.projectId}/members/${this.id}`,t)}internalDelete(){return this.httpClient.delete(`/projects/${this.projectId}/members/${this.id}`)}get data(){return this._data}set data(t){this._data=t,this._data.user.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.user.userId}/avatar`,this._data.user.fullName=l(this._data.user),this._data.user.initials=d(this._data.user.fullName)}get id(){return this.data.id}get role(){return this.data.role}set role(t){this.data.role=t}get type(){return this.data.type}get user(){return this.data.user}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}}class ${constructor(t,e){this.httpClient=e,this.data=t}internalGet(t){return this.httpClient.get(`/projects/${this.id}${t}`)}internalPost(t,e){return this.httpClient.post(`/projects/${this.id}${t}`,e)}internalPut(t,e){return this.httpClient.put(`/projects/${this.id}${t}`,e)}internalDelete(t){return this.httpClient.delete(`/projects/${this.id}${t}`)}get authorization(){return this.data.authorization}get createdAt(){return this.data.createdAt}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.previewUrl=t.avatarUrl?`${this.httpClient.serverUrl}/projects/${this._data.id}/preview?updated=${t.updatedAt}`:"",this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName)}get description(){return this.data.description}set description(t){this.data.description=t}get endDate(){return this.data.endDate}set endDate(t){this.data.endDate=t instanceof Date?t.toISOString():t}get id(){return this.data.id}get memberCount(){return this.data.memberCount}get modelCount(){return this.data.modelCount}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get previewUrl(){return this._data.previewUrl}get public(){return this.data.public}set public(t){this.data.public=t}get startDate(){return this.data.startDate}set startDate(t){this.data.startDate=t instanceof Date?t.toISOString():t}get topicCount(){return this.data.topicCount}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.text())).then((t=>{try{return JSON.parse(t)}catch{return{id:this.id}}}))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.internalPost("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await this.internalDelete("/preview");return this.data=await t.json(),this}getRoles(){return this.internalGet("/roles").then((t=>t.json())).then((t=>t.map((t=>new j(t,this.id,this.httpClient)))))}getRole(t){return this.internalGet(`/roles/${t}`).then((t=>t.json())).then((t=>new j(t,this.id,this.httpClient)))}createRole(t,e,s){return this.internalPost("/roles",{name:t,description:e,permissions:s||{}}).then((t=>t.json())).then((t=>new j(t,this.id,this.httpClient)))}deleteRole(t){return this.internalDelete(`/roles/${t}`).then((t=>t.json()))}getMembers(){return this.internalGet("/members").then((t=>t.json())).then((t=>t.map((t=>new _(t,this.id,this.httpClient)))))}getMember(t){return this.internalGet(`/members/${t}`).then((t=>t.json())).then((t=>new _(t,this.id,this.httpClient)))}addMember(t,e){return this.internalPost("/members",{userId:t,role:e}).then((t=>t.json())).then((t=>new _(t,this.id,this.httpClient)))}removeMember(t){return this.internalDelete(`/members/${t}`).then((t=>t.json()))}getFilesInformation(){return this.httpClient.get(`/bcf/3.0/projects/${this.data.id}/files_information`).then((t=>t.json())).then((t=>(t.forEach((t=>{const e=e=>(t.display_information.find((t=>t.field_display_name===e))||{}).field_value,s=`${this.httpClient.serverUrl}/files/${t.file.reference}/preview`,i=`${this.httpClient.serverUrl}/users/${e("Owner")}/avatar`,r=l(e("Owner First Name"),e("Owner Last Name"),e("Owner User Name")),n=d(r);t.display_information.push({field_display_name:"Preview URL",field_value:s}),t.display_information.push({field_display_name:"Owner Avatar URL",field_value:i}),t.display_information.push({field_display_name:"Owner Full Name",field_value:r}),t.display_information.push({field_display_name:"Owner Initials",field_value:n});const a=`${this.httpClient.serverUrl}/users/${e("Updated By")}/avatar`,o=l(e("Updated By First Name"),e("Updated By Last Name"),e("Updated By User Name")),h=d(o);t.display_information.push({field_display_name:"Updated By Avatar URL",field_value:a}),t.display_information.push({field_display_name:"Updated By Full Name",field_value:o}),t.display_information.push({field_display_name:"Updated By Initials",field_value:h});const u=e("Geometry Status"),p=e("GeometryGltf Status"),c="done"===u?"vsfx":"done"===p?"gltf":"";t.display_information.push({field_display_name:"Geometry Type",field_value:c})})),t)))}getModels(){return this.getFilesInformation().then((t=>t.map((t=>t.file.reference)))).then((t=>{const e=new URLSearchParams;return e.set("id",t.join("|")),this.httpClient.get(`/files?${e.toString()}`)})).then((t=>t.json())).then((t=>t.result.map((t=>new C(t,this.httpClient)))))}async addModel(t,e,s){const i=await this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient))),r=[{project:{id:this.id,name:this.name}}];return await i.createPermission(e,r,s),i}async removeModel(t){const e=await this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient))),s=await e.getPermissions();return await Promise.allSettled(s.filter((t=>t.grantedTo.some((t=>{var e;return(null===(e=t.project)||void 0===e?void 0:e.id)===this.id})))).map((t=>t.delete()))),e}}class P{constructor(t,e){this.httpClient=e,this.data=t}get avatarUrl(){return this._data.avatarUrl}get canCreateProject(){return this.data.canCreateProject}set canCreateProject(t){this._data.canCreateProject=t}get createAt(){return this.data.createAt}get customFields(){return this.data.customFields}set customFields(t){this._data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.avatarUrl=t.avatarImage?`${this.httpClient.serverUrl}/users/${this._data.id}/avatar?updated=${t.lastModified}`:"",this._data.fullName=l(this._data),this._data.initials=d(this._data.fullName)}get email(){return this.data.email}set email(t){this._data.email=t}get emailConfirmationId(){return this.data.emailConfirmationId}get firstName(){return this.data.firstName}set firstName(t){this._data.firstName=t}get fullName(){return this.data.fullName}get id(){return this.data.id}get initials(){return this.data.initials}get isAdmin(){return this.data.isAdmin}set isAdmin(t){this._data.isAdmin=t}get isEmailConfirmed(){return this.data.isEmailConfirmed}get lastModified(){return this.data.lastModified}get lastName(){return this.data.lastName}set lastName(t){this._data.lastName=t}get lastSignIn(){return this.data.lastSignIn}get projectsLimit(){return this.data.projectsLimit}set projectsLimit(t){this._data.projectsLimit=t}get providerType(){return this.data.providerType}get storageLimit(){return this.data.storageLimit}set storageLimit(t){this._data.storageLimit=t}get storageUsed(){return this.data.storageUsed}get token(){return this.data.tokenInfo.token}get userName(){return this.data.userName}set userName(t){this._data.userName=t}async checkout(){if(this.httpClient.signInUserIsAdmin){const t=await this.httpClient.get(`/users/${this.id}`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const t=await this.httpClient.get("/user"),e=await t.json();this.data={id:this.id,...e}}}return this}async update(t){if(this.httpClient.signInUserIsAdmin){const e=await this.httpClient.put(`/users/${this.id}`,{isAdmin:t.isAdmin,userBrief:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const e=await this.httpClient.put("/user",t),s=await e.json();this.data={id:this.id,...s}}}return this}delete(){return this.httpClient.signInUserIsAdmin?this.httpClient.delete(`/users/${this.id}`).then((t=>t.json())).then((t=>(this.id===this.httpClient.signInUserId&&(this.httpClient.headers={},this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1),t))):Promise.reject(new r(403))}save(){return this.update(this.data)}async setAvatar(t){if(t)if(this.httpClient.signInUserIsAdmin){const e=await this.httpClient.post(`/users/${this.id}/avatar`,t),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const e=await this.httpClient.post("/user/avatar",t),s=await e.json();this.data={id:this.id,...s}}}else await this.deleteAvatar();return this}async deleteAvatar(){if(this.httpClient.signInUserIsAdmin){const t=await this.httpClient.delete(`/users/${this.id}/avatar`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const t=await this.httpClient.delete("/user/avatar"),e=await t.json();this.data={id:this.id,...e}}}return this}async changePassword(t,e){if(this.httpClient.signInUserIsAdmin){const e=await this.httpClient.put(`/users/${this.id}/password`,{new:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const s=await this.httpClient.put("/user/password",{old:e,new:t}),i=await s.json();this.data={id:this.id,...i}}}return this}}class b{constructor(t,e){this.httpClient=e,this.data=t}internalGet(){return this.httpClient.get(`/oauth/clients/${this.clientId}`)}internalPost(t,e){return this.httpClient.post(`/oauth/clients/${this.clientId}${t}`,e)}internalPut(t){return this.httpClient.put(`/oauth/clients/${this.clientId}`,t)}internalDelete(){return this.httpClient.delete(`/oauth/clients/${this.clientId}`)}get authUrl(){return this.data.authUrl}get accessTokenUrl(){return this.data.accessTokenUrl}get clientId(){return this.data.clientId}get createdAt(){return this.data.createdAt}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t}get name(){return this.data.name}set name(t){this._data.name=t}get redirectUrl(){return this.data.redirectUrl}set redirectUrl(t){this.data.redirectUrl=t}get secret(){return this.data.secret}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}async revoke(){return await this.internalPost("/revoke"),this}}t.Assembly=p,t.ClashTest=u,t.Client=class extends c{constructor(t={}){super(),this._serverUrl="",this._httpClient=new f(""),this._user=null,this.eventEmitter=this,this.configure(t)}get serverUrl(){return this._serverUrl}get httpClient(){return this._httpClient}get options(){console.warn("Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead.");const t={showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0};return{...t,data:t,defaults:()=>t,resetToDefaults:()=>{},saveToStorage:()=>{},loadFromStorage:()=>{}}}configure(t){return this._serverUrl=(t.serverUrl||"").replace(/\/+$/,""),this._httpClient=new f(this.serverUrl),this._user=null,this}version(){return this.httpClient.get("/version").then((t=>t.json())).then((t=>({...t,server:t.version,client:"25.12.0"})))}registerUser(t,e,s){return this.httpClient.post("/register",{email:t,password:e,userName:null!=s?s:(t+"").split("@").at(0)}).then((t=>t.json()))}resendConfirmationEmail(t,e){return this.httpClient.post("/register/email-confirmation",{email:t,password:e}).then((t=>t.json()))}confirmUserEmail(t){return this.httpClient.get(`/register/email-confirmation/${t}`).then((t=>t.json()))}async signInWithEmail(t,e){const s=btoa(unescape(encodeURIComponent(t+":"+e)));this.httpClient.headers={Authorization:"Basic "+s};const i=await this.httpClient.get("/token"),r=await i.json();return this.setCurrentUser(r)}async signInWithToken(t){this.httpClient.headers={Authorization:t};const e=await this.httpClient.get("/user"),s=await e.json();return this.setCurrentUser(s)}setCurrentUser(t){return this._user=new P(t,this.httpClient),this.httpClient.headers={Authorization:t.tokenInfo.token},this.httpClient.signInUserId=this._user.id,this.httpClient.signInUserIsAdmin=this._user.isAdmin,this._user}clearCurrentUser(){this._user=null,this.httpClient.headers={},this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1}getCurrentUser(){return this._user&&!this.httpClient.signInUserId&&(this._user=null),this._user}getIdentityProviders(){return this.httpClient.get("/identity").then((t=>t.json()))}getServerSettings(){return this.httpClient.get("/settings").then((t=>t.json()))}updateServerSettings(t){return this.httpClient.put("/settings",t).then((t=>t.json()))}getOAuthClients(t,e){const s=new URLSearchParams;t>0&&s.set("start",t.toString()),e>0&&s.set("limit",e.toString());let i=s.toString();return i&&(i="?"+i),this.httpClient.get(`/oauth/clients${i}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new b(t,this.httpClient)))})))}getOAuthClient(t){return this.httpClient.get(`/oauth/clients/${t}`).then((t=>t.json())).then((t=>new b(t,this.httpClient)))}createOAuthClient(t,e,s){return this.httpClient.post("/oauth/clients",{name:t,redirectUrl:e,description:s}).then((t=>t.json())).then((t=>new b(t,this.httpClient)))}deleteOAuthClient(t){return this.httpClient.delete(`/oauth/clients/${t}`).then((t=>t.json()))}getUsers(){return this.httpClient.get("/users").then((t=>t.json())).then((t=>t.map((t=>({id:t.id,...t.userBrief}))))).then((t=>t.map((t=>new P(t,this.httpClient)))))}getUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.get(`/users/${t}`).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new P(t,this.httpClient))):t===this.httpClient.signInUserId?this.httpClient.get("/user").then((t=>t.json())).then((e=>({id:t,...e}))).then((t=>new P(t,this.httpClient))):Promise.reject(new r(403))}createUser(t,e,s={}){const{isAdmin:i,userName:r,...n}=s;return this.httpClient.post("/users",{isAdmin:i,userBrief:{...n,email:t,userName:null!=r?r:(t+"").split("@").at(0)},password:e}).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new P(t,this.httpClient)))}deleteUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.delete(`/users/${t}`).then((t=>t.json())).then((e=>(t===this.httpClient.signInUserId&&this.clearCurrentUser(),e))):Promise.reject(new r(403))}getFiles(t,e,s,i,r,n,a){const o=new URLSearchParams;t>0&&o.set("start",t.toString()),e>0&&o.set("limit",e.toString()),s&&o.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.toLowerCase()),i&&o.set("ext",i)),r&&(Array.isArray(r)&&(r=r.join("|")),o.set("id",r)),void 0!==n&&o.set("sortBy",n?"desc":"asc"),a&&o.set("sortField",a);let h=o.toString();return h&&(h="?"+h),this.httpClient.get(`/files${h}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new C(t,this.httpClient)))})))}getFile(t){return this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}async uploadFile(t,e={geometry:!0,properties:!1,waitForDone:!1}){const s=await this.httpClient.uploadFile("/files",t,(s=>{var i;this.emitEvent({type:"uploadprogress",data:s,file:t}),null===(i=e.onProgress)||void 0===i||i.call(e,s,t)})).then((t=>JSON.parse(t.responseText))).then((t=>new C(t,this.httpClient))),i="string"==typeof e.geometry?e.geometry:"vsfx",r=[];return e.geometry&&r.push((await s.extractGeometry(i)).outputFormat),e.properties&&r.push((await s.extractProperties()).outputFormat),r.length>0&&(e.waitForDone?await s.waitForDone(r,!0,e):await s.checkout()),s}deleteFile(t){return this.httpClient.delete(`/files/${t}`).then((t=>t.json()))}downloadFile(t,e,s){return this.httpClient.downloadFile(`/files/${t}/downloads`,e,s).then((t=>t.arrayBuffer()))}getJobs(t,e,s,i,r){const n=new URLSearchParams;s>0&&n.set("start",s.toString()),e>0&&n.set("limit",e.toString()),t&&(Array.isArray(t)&&(t=t.join("|")),"string"==typeof t&&(t=t.trim().toLowerCase()),t&&n.set("status",t)),void 0!==i&&n.set("sortBy",i?"desc":"asc"),r&&n.set("sortField",r);let a=n.toString();return a&&(a="?"+a),this.httpClient.get(`/jobs${a}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new y(t,this.httpClient)))})))}getJob(t){return this.httpClient.get(`/jobs/${t}`).then((t=>t.json())).then((t=>new y(t,this.httpClient)))}createJob(t,e,s){return this.httpClient.post("/jobs",{fileId:t,outputFormat:e,parameters:h(s)}).then((t=>t.json())).then((t=>new y(t,this.httpClient)))}deleteJob(t){return this.httpClient.delete(`/jobs/${t}`).then((t=>t.json()))}getAssemblies(t,e,s,i,r,n){const a=new URLSearchParams;t>0&&a.set("start",t.toString()),e>0&&a.set("limit",e.toString()),s&&a.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.trim()),i&&a.set("id",i)),void 0!==r&&a.set("sortBy",r?"desc":"asc"),n&&a.set("sortField",n);let o=a.toString();return o&&(o="?"+o),this.httpClient.get(`/assemblies${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new p(t,this.httpClient)))})))}getAssembly(t){return this.httpClient.get(`/assemblies/${t}`).then((t=>t.json())).then((t=>new p(t,this.httpClient)))}createAssembly(t,e,s){const{waitForDone:i}=null!=s?s:{};return this.httpClient.post("/assemblies",{name:e,files:t}).then((t=>t.json())).then((t=>new p(t,this.httpClient))).then((t=>i?t.waitForDone(s):t))}deleteAssembly(t){return this.httpClient.delete(`/assemblies/${t}`).then((t=>t.json()))}getProjects(t,e,s,i,r){const n=new URLSearchParams;t>0&&n.set("start",t.toString()),e>0&&n.set("limit",e.toString()),s&&n.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.trim()),i&&n.set("id",i)),void 0!==r&&n.set("sortBy",r?"desc":"asc");let a=n.toString();return a&&(a="?"+a),this.httpClient.get(`/projects${a}`).then((t=>t.json())).then((r=>{if(Array.isArray(r)){let n=r;if(i&&(n=n.filter((t=>i.includes(t.id)))),s&&(n=n.filter((t=>t.name.includes(s)))),e>0){const s=t>0?t:0;n=n.slice(s,s+e)}return{allSize:r.length,start:t,limit:e,result:n,size:n.length}}return r})).then((t=>({...t,result:t.result.map((t=>new $(t,this.httpClient)))})))}getProject(t){return this.httpClient.get(`/projects/${t}`).then((t=>t.json())).then((t=>new $(t,this.httpClient)))}createProject(t,e,s,i){return this.httpClient.post("/projects",{name:t,description:e,startDate:s instanceof Date?s.toISOString():s,endDate:i instanceof Date?i.toISOString():i}).then((t=>t.json())).then((t=>new $(t,this.httpClient)))}deleteProject(t){return this.httpClient.delete(`/projects/${t}`).then((t=>t.text())).then((e=>{try{return JSON.parse(e)}catch{return{id:t}}}))}},t.FetchError=r,t.File=C,t.Job=y,t.Member=_,t.Model=n,t.OAuthClient=b,t.Permission=v,t.Project=$,t.Role=j,t.User=P,t.parseArgs=h,t.statusText=s,t.userFullName=l,t.userInitials=d,t.version="25.12.0",t.waitFor=o}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ODA=t.ODA||{},t.ODA.Api=t.ODA.Api||{}))}(this,(function(t){"use strict";const e={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};function s(t){return e[t]||`Error ${t}`}function i(t,e="400"){try{return JSON.parse(t).description}catch{return e}}class r extends Error{constructor(t,e){super(e||s(t)),this.name="FetchError",this.status=t,this.statusText=s(t)}}class n{constructor(t,e){this.path=`${e.path}/downloads`,this.httpClient=e.httpClient,this._file=e,this._data=t}get assembly(){return this._file}get data(){return this._data}set data(t){this._data=t}get database(){return this.data.database}get default(){return this.data.default}get file(){return this._file}get fileId(){return this.data.fileId}get geometry(){return this.data.geometry}get id(){return this.data.id}get name(){return this.data.name}get type(){return this.file.type}get version(){return this.data.version}getModels(){return Promise.resolve([this])}getModelTransformMatrix(t){return this.file.getModelTransformMatrix(t)}setModelTransformMatrix(t,e){return this.file.setModelTransformMatrix(t,e).then((()=>this))}getViewpoints(){return this._file.getViewpoints().then((t=>t.filter((({custom_fields:t={}})=>t.modelId===this.id||t.modelName===this.name))))}saveViewpoint(t){return this._file.saveViewpoint({...t,custom_fields:{...t.custom_fields,modelId:this.id,modelName:this.name}})}deleteViewpoint(t){return this._file.deleteViewpoint(t)}getSnapshot(t){return this._file.getSnapshot(t)}getSnapshotData(t,e){return this._file.getSnapshotData(t,e)}downloadResource(t,e,s){return this._file.downloadResource(t,e,s)}downloadResourceRange(t,e,s,i,r){return this._file.downloadResourceRange(t,e,s,i,r)}partialDownloadResource(t,e,s){return console.warn("Model.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Model.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,i,r){if(!e)return;let n=[];if(e.length)n=e.map((t=>({begin:Number(t.begin),end:Number(t.end),requestId:t.reqId})));else for(let s=0;s<e.size();s++){const i=e.get(s);n.push({begin:Number(i.begin),end:Number(i.end),requestId:t}),i.delete()}await this.downloadResourceRange(s,t,n,i,r)}getReferences(t){return this._file.getReferences(t)}}function a(t,e){return new Promise((s=>{let i=0;const r=()=>{clearTimeout(i),s(!0)};i=window.setTimeout((()=>{e.removeEventListener("abort",r),s(!1)}),t),e.addEventListener("abort",r,{once:!0})}))}async function o(t,e={}){var s,i,r;const n=e.timeout||6e5,o=e.interval||3e3,h=null!==(s=e.signal)&&void 0!==s?s:(new AbortController).signal,l=null!==(i=e.abortError)&&void 0!==i?i:new DOMException("Aborted","AbortError"),d=null!==(r=e.timeoutError)&&void 0!==r?r:new DOMException("Timeout","TimeoutError"),u=performance.now()+n;let p=n/o;do{if(await t(e))return Promise.resolve(e.result);if(await a(o,h)||h.aborted)return Promise.reject(l)}while(performance.now()<u&&--p>0);return Promise.reject(d)}function h(t){if("string"==typeof t){const e=t.indexOf("--");-1!==e&&(t=t.slice(e));const s=t.split("--").map((t=>t.split("=").map((t=>t.split(" "))).flat())).filter((t=>t[0])).map((t=>t.concat([""])));return Object.fromEntries(s)}return t||{}}function l(t,e="",s=""){var i;return t&&"string"!=typeof t?l(null!==(i=t.firstName)&&void 0!==i?i:t.name,t.lastName,t.userName):`${null!=t?t:""} ${null!=e?e:""}`.trim()||s}function d(t=""){const e=t.split(" ").filter((t=>t));return e.reduce(((t,s,i)=>(0!==i&&i!==e.length-1||(t+=s.charAt(0)),t)),"").toUpperCase()}class u{constructor(t,e,s){this.httpClient=s,this.basePath=e,this.data=t}internalGet(t){return this.httpClient.get(`${this.basePath}/clashes/${this.id}${t}`)}internalPut(t,e){return this.httpClient.put(`${this.basePath}/clashes/${this.id}${t}`,e)}internalDelete(t){return this.httpClient.delete(`${this.basePath}/clashes/${this.id}${t}`)}get clearance(){return this.data.clearance}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName)}get id(){return this.data.id}get lastModifiedAt(){return this.data.lastModifiedAt}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get selectionSetA(){return this.data.selectionSetA}get selectionTypeA(){return this.data.selectionTypeA}get selectionSetB(){return this.data.selectionSetB}get selectionTypeB(){return this.data.selectionTypeB}get status(){return this.data.status}get tolerance(){return this.data.tolerance}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.json()))}save(){return this.update(this.data)}waitForDone(t){return o((()=>this.checkout().then((e=>{var s;const i=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,i))||i}))),t).then((()=>this))}getReport(){return this.internalGet("/report").then((t=>t.json()))}}class p{constructor(t,e){this.path=`/assemblies/${t.id}`,this.httpClient=e,this.data=t}appendVersionParam(t){if(void 0===this._useVersion)return t;const e=t.includes("?")?"&":"?";return`${t}${e}version=${this._useVersion}`}internalGet(t,e){return t=this.appendVersionParam(t),this.httpClient.get(`${this.path}${t}`,e)}internalPost(t,e){return t=this.appendVersionParam(t),this.httpClient.post(`${this.path}${t}`,e)}internalPut(t,e){return t=this.appendVersionParam(t),this.httpClient.put(`${this.path}${t}`,e)}internalDelete(t){return t=this.appendVersionParam(t),this.httpClient.delete(`${this.path}${t}`)}get activeVersion(){return this.data.activeVersion}get associatedFiles(){return this.data.associatedFiles}get created(){return this.data.created}get data(){return this._data}set data(t){var e,s;this._data=t,this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName),null!==(e=(s=this._data).associatedFiles)&&void 0!==e||(s.associatedFiles=[]),this._data.associatedFiles.forEach((t=>t.link=`${this.httpClient.serverUrl}/files/${t.fileId}`))}get files(){return this.data.files}get geometryType(){return"done"===this.status?"vsfx":""}get id(){return this.data.id}get name(){return this.data.name}set name(t){this.data.name=t}get originalAssemblyId(){return this.data.originalAssemblyId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl||""}get relatedJobs(){return this.data.relatedJobs}get status(){return this.data.status}get type(){return"assembly"}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.json()))}save(){return this.update(this.data)}setPreview(t){return console.warn("Assembly does not support preview"),Promise.resolve(this)}deletePreview(){return console.warn("Assembly does not support preview"),Promise.resolve(this)}getModels(){return this.internalGet("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){return this.data.transform[t]}setModelTransformMatrix(t,e){const s={...this.data.transform};return s[t]=e,this.update({transform:s})}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.internalGet(e).then((t=>t.json()))}searchProperties(t){return this.internalPost("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.internalGet("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.internalGet("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.internalPost("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return this.internalDelete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.internalGet(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.internalGet(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}downloadResource(t,e,s){const i=this.appendVersionParam(`/downloads/${t}`);return this.httpClient.downloadFile(`${this.path}${i}`,e,s).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,i,r){const n=this.appendVersionParam(`/downloads/${t}?requestId=${e}`);return this.httpClient.downloadFileRange(`${this.path}${n}`,e,s,i,r).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("Assembly.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use Assembly.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,i,r){await this.downloadResourceRange(s,t,e,i,r)}async getReferences(t){return{id:"",references:await Promise.all(this.associatedFiles.map((t=>`/files/${t.fileId}/references`)).map((e=>this.httpClient.get(e,t).then((t=>t.json()))))).then((t=>t.map((t=>t.references)))).then((t=>t.reduce(((t,e)=>[...e,...t]),[]))).then((t=>[...new Set(t.map(JSON.stringify))].map((t=>JSON.parse(t)))))}}waitForDone(t){return o((()=>this.checkout().then((e=>{var s;const i=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,i))||i}))),t).then((()=>this))}getClashTests(t,e,s,i,r,n){const a=new URLSearchParams;t>0&&a.set("start",t.toString()),e>0&&a.set("limit",e.toString()),s&&a.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.trim()),i&&a.set("id",i)),void 0!==r&&a.set("sortBy",r?"desc":"asc"),n&&a.set("sortField",n);let o=a.toString();return o&&(o="?"+o),this.internalGet(`/clashes${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new u(t,this.path,this.httpClient)))})))}getClashTest(t){return this.internalGet(`/clashes/${t}`).then((t=>t.json())).then((t=>new u(t,this.path,this.httpClient)))}createClashTest(t,e,s,i,r,n){const{tolerance:a,clearance:o,waitForDone:h}=null!=n?n:{};return Array.isArray(i)||(i=[i]),Array.isArray(r)||(r=[r]),this.internalPost("/clashes",{name:t,selectionTypeA:e,selectionTypeB:s,selectionSetA:i,selectionSetB:r,tolerance:a,clearance:o}).then((t=>t.json())).then((t=>new u(t,this.path,this.httpClient))).then((t=>h?t.waitForDone(n):t))}deleteClashTest(t){return this.internalDelete(`/clashes/${t}`).then((t=>t.json()))}updateVersion(t,e={waitForDone:!1}){return Promise.reject(new Error("Assembly version support will be implemeted in a future release"))}getVersions(){return Promise.resolve(void 0)}getVersion(t){return Promise.reject(new r(404))}deleteVersion(t){return Promise.reject(new r(404))}setActiveVersion(t){return this.update({activeVersion:t})}useVersion(t){return this._useVersion=void 0,this}}class c{constructor(){this._listeners={}}addEventListener(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this}removeEventListener(t,e){if(void 0===this._listeners[t])return this;const s=this._listeners[t].filter((t=>t!==e));return 0!==s.length?this._listeners[t]=s:delete this._listeners[t],this}removeAllListeners(t){return t?delete this._listeners[t]:this._listeners={},this}emitEvent(t){if(void 0===this._listeners[t.type])return!1;return this._listeners[t.type].slice().forEach((e=>e.call(this,t))),!0}on(t,e){return this.addEventListener(t,e)}off(t,e){return this.removeEventListener(t,e)}emit(t,...e){return"string"==typeof t?this.emitEvent({type:t,args:e}):"object"==typeof t&&this.emitEvent(t)}}function m(t){if(!t.ok)switch(t.status){case 400:return t.text().then((t=>(console.error(t),Promise.reject(new r(400,i(t))))));case 500:return t.text().then((t=>(console.error(i(t,t)),Promise.reject(new r(500)))));default:return Promise.reject(new r(t.status))}return Promise.resolve(t)}function g(t,e={method:"GET"}){const s={...e.headers};let i;delete s["Content-Type"],"POST"!==e.method&&"PUT"!==e.method||(e.body instanceof FormData?i=e.body:e.body instanceof Blob?(i=new FormData,i.append("file",e.body)):e.body instanceof ArrayBuffer?(i=new FormData,i.append("file",new Blob([e.body]))):"object"==typeof e.body?(i=JSON.stringify(e.body),s["Content-Type"]="application/json"):"string"==typeof e.body&&(i=e.body,s["Content-Type"]="text/plain"));const r={method:e.method,headers:s};return i&&(r.body=i),e.signal&&(r.signal=e.signal),fetch(t,r).then(m)}function w(t,e={method:"GET"}){return new Promise(((s,n)=>{const a=new XMLHttpRequest;a.open(e.method,t,!0);for(const t in e.headers)a.setRequestHeader(t,e.headers[t]);function o(t){return t.lengthComputable?t.loaded/t.total:1}a.upload.onprogress=t=>e.uploadProgress&&e.uploadProgress(o(t)),a.onprogress=t=>e.downloadProgress&&e.downloadProgress(o(t)),a.onloadend=t=>function(t){if(0===t.status)return Promise.reject(new r(0,"Network error"));if(t.status<200||t.status>299)switch(t.status){case 400:return console.error(t.responseText),Promise.reject(new r(400,i(t.responseText)));case 500:return console.error(i(t.responseText,t.responseText)),Promise.reject(new r(500));default:return Promise.reject(new r(t.status))}return Promise.resolve(t)}(t.target).then(s,n),a.send(e.body)}))}class f{constructor(t){this.headers={},this.signInUserId="",this.signInUserIsAdmin=!1,this.serverUrl=t}get(t,e){return g(`${this.serverUrl}${t}`,{method:"GET",headers:this.headers,signal:e})}post(t,e){return g(`${this.serverUrl}${t}`,{method:"POST",headers:this.headers,body:e})}put(t,e){return g(`${this.serverUrl}${t}`,{method:"PUT",headers:this.headers,body:e})}delete(t){return g(`${this.serverUrl}${t}`,{method:"DELETE",headers:this.headers})}uploadFile(t,e,s){const i=new FormData;return i.append("file",e),w(`${this.serverUrl}${t}`,{method:"POST",headers:this.headers,body:i,uploadProgress:s})}async downloadFile(t,e,s){const i=await this.get(t,s),r=i.headers.get("Content-Length"),n=parseInt(r||"",10)||1;return new Response(new ReadableStream({async start(t){const s=i.body.getReader();let r=0;for(;;){const{done:i,value:a}=await s.read();if(i)break;t.enqueue(a),r+=a.length,e&&e(r/n,a)}t.close()}}))}async downloadFileRange(t,e,s,i,r){const n={...this.headers};n.Range="bytes="+s.map((t=>`${t.begin}-${t.end}`)).join(",");const a=await g(`${this.serverUrl}${t}`,{method:"GET",headers:n,signal:r}),o=a.headers.get("content-length"),h=parseInt(o||"",10)||1;return new Response(new ReadableStream({async start(t){const e=a.body.getReader();let r=0,n=0,o=0;for(;;){const{done:a,value:l}=await e.read();if(a)break;t.enqueue(l),r+=l.length;let d=l.length,u=0;for(;d>0;){const t=s[n],e=t.end-t.begin-o;if(d<e){const e=l.subarray(u,u+d);i&&i(r/h,e,t.requestId),o+=d,d=0}else{const s=l.subarray(u,u+e);i&&i(r/h,s,t.requestId),u+=e,d-=e,n++,o=0}}}t.close()}}))}}class v{constructor(t,e,s){this.httpClient=s,this.fileId=e,this.data=t}internalGet(){return this.httpClient.get(`/files/${this.fileId}/permissions/${this.id}`)}internalPut(t){return this.httpClient.put(`/files/${this.fileId}/permissions/${this.id}`,t)}internalDelete(){return this.httpClient.delete(`/files/${this.fileId}/permissions/${this.id}`)}get actions(){return this.data.actions}set actions(t){this._data.actions=t}get data(){return this._data}set data(t){this._data=t}get id(){return this.data.id}get grantedTo(){return this.data.grantedTo}set grantedTo(t){this.data.grantedTo=t}get public(){return this.data.public}set public(t){this.data.public=t}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}}class y{constructor(t,e){this.httpClient=e,this.data=t}internalGet(){return this.httpClient.get(`/jobs/${this.data.id}`)}internalPut(t){return this.httpClient.put(`/jobs/${this.data.id}`,t)}internalDelete(){return this.httpClient.delete(`/jobs/${this.data.id}`)}get assemblyId(){return this.data.assemblyId}get authorId(){return this.data.authorId}get createdAt(){return this.data.createdAt}get data(){return this._data}set data(t){this._data=t}get done(){return"done"===this.data.status||"failed"===this.data.status}get fileId(){return this.data.fileId}get id(){return this.data.id}get lastUpdate(){return this.data.lastUpdate}get outputFormat(){return this.data.outputFormat}get parameters(){return this.data.parameters}get status(){return this.data.status}get statusMessage(){return this.data.statusMessage}get startedAt(){return this.data.startedAt}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}waitForDone(t){return o((()=>this.checkout().then((e=>{var s;const i=["done","failed"].includes(e.status);return(null===(s=null==t?void 0:t.onCheckout)||void 0===s?void 0:s.call(t,e,i))||i}))),t).then((()=>this))}}class C{constructor(t,e){this.path=`/files/${t.id}`,this.httpClient=e,this.data=t}appendVersionParam(t){if(void 0===this._useVersion)return t;const e=t.includes("?")?"&":"?";return`${t}${e}version=${this._useVersion}`}internalGet(t,e){return t=this.appendVersionParam(t),this.httpClient.get(`${this.path}${t}`,e)}internalPost(t,e){return t=this.appendVersionParam(t),this.httpClient.post(`${this.path}${t}`,e)}internalPut(t,e){return t=this.appendVersionParam(t),this.httpClient.put(`${this.path}${t}`,e)}internalDelete(t){return t=this.appendVersionParam(t),this.httpClient.delete(`${this.path}${t}`)}get activeVersion(){return this.data.activeVersion}get created(){return this.data.created}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){var e,s,i,r,n,a,o,h,u,p,c,m,g,w,f,v,y,C,j,_,$;this._data=t,this._data.previewUrl=t.preview?`${this.httpClient.serverUrl}${this.path}/preview?updated=${t.updatedAt}`:"","string"==typeof this._data.owner&&(this._data.owner={userId:this._data.owner}),null!==(e=(g=this._data).owner)&&void 0!==e||(g.owner={}),this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName),null!==(s=(w=this._data).status)&&void 0!==s||(w.status={}),null!==(i=(f=this._data.status).geometry)&&void 0!==i||(f.geometry={state:null!==(r=this._data.geometryStatus)&&void 0!==r?r:"none"}),null!==(n=(v=this._data.status).properties)&&void 0!==n||(v.properties={state:null!==(a=this._data.propertiesStatus)&&void 0!==a?a:"none"}),null!==(o=(y=this._data.status).validation)&&void 0!==o||(y.validation={state:null!==(h=this._data.validationStatus)&&void 0!==h?h:"none"}),null!==(u=(C=this._data).updatedBy)&&void 0!==u||(C.updatedBy={}),this._data.updatedBy.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`,this._data.updatedBy.fullName=l(this._data.updatedBy),this._data.updatedBy.initials=d(this._data.updatedBy.fullName),null!==(p=(j=this._data).versions)&&void 0!==p||(j.versions=[{...t}]),null!==(c=(_=this._data.status).geometryGltf)&&void 0!==c||(_.geometryGltf={state:"none"}),null!==(m=($=this._data).isFileDeleted)&&void 0!==m||($.isFileDeleted=!1)}get exports(){return this.data.exports}get geometryType(){return"done"===this.status.geometryGltf.state?"gltf":"done"===this.status.geometry.state?"vsfx":""}get id(){return this.data.id}get isFileDeleted(){return this.data.isFileDeleted}get name(){return this.data.name}set name(t){this.data.name=t}get originalFileId(){return this.data.originalFileId}get owner(){return this.data.owner}get previewUrl(){return this.data.previewUrl}get size(){return this.data.size}get sizeTotal(){return this.data.sizeTotal}get status(){return this.data.status}get type(){return this.data.type}get updatedAt(){return this.data.updatedAt}get updatedBy(){return this.data.updatedBy}get version(){return this.data.version}get versions(){return this.data.versions}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.json()))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.internalPost("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await this.internalDelete("/preview");return this.data=await t.json(),this}getModels(){return this.internalGet("/geometry").then((t=>t.json())).then((t=>t.map((t=>new n(t,this)))))}getModelTransformMatrix(t){}setModelTransformMatrix(t,e){return console.warn("File does not support model transformation"),Promise.resolve(this)}getProperties(t){const e=void 0!==t?`/properties?handles=${t}`:"/properties";return this.internalGet(e).then((t=>t.json()))}searchProperties(t){return this.internalPost("/properties/search",t).then((t=>t.json()))}getCdaTree(){return this.internalGet("/properties/tree").then((t=>t.json()))}getViewpoints(){return this.internalGet("/viewpoints").then((t=>t.json())).then((t=>t.result))}saveViewpoint(t){return this.internalPost("/viewpoints",t).then((t=>t.json()))}deleteViewpoint(t){return this.internalDelete(`/viewpoints/${t}`).then((t=>t.json()))}getSnapshot(t){return this.internalGet(`/viewpoints/${t}/snapshot`).then((t=>t.text()))}getSnapshotData(t,e){return this.internalGet(`/viewpoints/${t}/bitmaps/${e}`).then((t=>t.text()))}download(t,e){const s=this.appendVersionParam("/downloads");return this.httpClient.downloadFile(`${this.path}${s}`,t,e).then((t=>t.arrayBuffer()))}downloadResource(t,e,s){const i=this.appendVersionParam(`/downloads/${t}`);return this.httpClient.downloadFile(`${this.path}${i}`,e,s).then((t=>t.arrayBuffer()))}downloadResourceRange(t,e,s,i,r){const n=this.appendVersionParam(`/downloads/${t}?requestId=${e}`);return this.httpClient.downloadFileRange(`${this.path}${n}`,e,s,i,r).then((t=>t.arrayBuffer()))}partialDownloadResource(t,e,s){return console.warn("File.partialDownloadResource() has been deprecated since 25.3 and will be removed in a future release, use File.downloadResource() instead."),this.downloadResource(t,e,s)}async downloadFileRange(t,e,s,i,r){await this.downloadResourceRange(s,t,e,i,r)}getReferences(t){return this.internalGet("/references",t).then((t=>t.json()))}setReferences(t){return this.internalPut("/references",t).then((t=>t.json()))}createJob(t,e){const s=this.appendVersionParam("/jobs");return this.httpClient.post(s,{fileId:this.id,outputFormat:t,parameters:h(e)}).then((t=>t.json())).then((t=>new y(t,this.httpClient)))}extractGeometry(t,e){return this.createJob("gltf"===t?"geometryGltf":"geometry",e)}extractProperties(t){return this.createJob("properties",t)}validate(t){return this.createJob("validation",t)}waitForDone(t,e,s){const i=Array.isArray(t)?t:[t];void 0===e&&(e=!0);return o((()=>this.checkout().then((t=>{var r;const n=i.filter((e=>{const s=t.status[e]||{};return["none","done","failed"].includes(s.state||"none")})),a=e?n.length===i.length:n.length>0;return(null===(r=null==s?void 0:s.onCheckout)||void 0===r?void 0:r.call(s,t,a))||a}))),s).then((()=>this))}getPermissions(){return this.internalGet("/permissions").then((t=>t.json())).then((t=>t.map((t=>new v(t,this.id,this.httpClient)))))}getPermission(t){return this.internalGet(`/permissions/${t}`).then((t=>t.json())).then((t=>new v(t,this.id,this.httpClient)))}createPermission(t,e,s){return this.internalPost("/permissions",{actions:Array.isArray(t)?t:[t],grantedTo:e,public:s}).then((t=>t.json())).then((t=>new v(t,this.id,this.httpClient)))}deletePermission(t){return this.internalDelete(`/permissions/${t}`).then((t=>t.json()))}async uploadVersion(t,e={waitForDone:!1}){const s=await this.httpClient.uploadFile(`${this.path}/versions`,t,(s=>{var i;return null===(i=e.onProgress)||void 0===i?void 0:i.call(e,s,t)})).then((t=>JSON.parse(t.responseText))).then((t=>new C(t,this.httpClient)));let i="";"none"!==this.versions[0].status.geometryGltf.state&&(i="gltf"),"none"!==this.versions[0].status.geometry.state&&(i="vsfx"),void 0===(e={...e}).geometry&&(e.geometry=""!==i),void 0===e.properties&&(e.properties="none"!==this.versions[0].status.properties.state);const r=[];return e.geometry&&r.push((await s.extractGeometry(i)).outputFormat),e.properties&&r.push((await s.extractProperties()).outputFormat),r.length>0&&(e.waitForDone?await s.waitForDone(r,!0,e):await s.checkout()),await this.checkout(),s}getVersions(){return this.internalGet("/versions").then((t=>t.json())).then((t=>t.map((t=>new C(t,this.httpClient))))).then((t=>t.map((t=>t.id==t.originalFileId?t.useVersion(0):t))))}getVersion(t){return this.internalGet(`/versions/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient))).then((t=>t.id==t.originalFileId?t.useVersion(0):t))}async deleteVersion(t){const e=await this.internalDelete(`/versions/${t}`),s=await e.json();return await this.checkout(),s}setActiveVersion(t){return this.update({activeVersion:t})}useVersion(t){return this._useVersion=t,this}async deleteSource(){const t=await this.internalDelete("/source");return this.data=await t.json(),this}}class j{constructor(t,e,s){this.httpClient=s,this.projectId=e,this.data=t}internalGet(){return this.httpClient.get(`/projects/${this.projectId}/roles/${this.name}`)}internalPut(t){return this.httpClient.put(`/projects/${this.projectId}/roles/${this.name}`,t)}internalDelete(){return this.httpClient.delete(`/projects/${this.projectId}/roles/${this.name}`)}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t}get name(){return this.data.name}set name(t){this._data.name=t}get permissions(){return this.data.permissions}set permissions(t){this.data.permissions=t||{}}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}}class _{constructor(t,e,s){this.httpClient=s,this.projectId=e,this.data=t}internalGet(){return this.httpClient.get(`/projects/${this.projectId}/members/${this.id}`)}internalPut(t){return this.httpClient.put(`/projects/${this.projectId}/members/${this.id}`,t)}internalDelete(){return this.httpClient.delete(`/projects/${this.projectId}/members/${this.id}`)}get data(){return this._data}set data(t){this._data=t,this._data.user.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.user.userId}/avatar`,this._data.user.fullName=l(this._data.user),this._data.user.initials=d(this._data.user.fullName)}get id(){return this.data.id}get role(){return this.data.role}set role(t){this.data.role=t}get type(){return this.data.type}get user(){return this.data.user}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}}class ${constructor(t,e){this.httpClient=e,this.data=t}internalGet(t){return this.httpClient.get(`/projects/${this.id}${t}`)}internalPost(t,e){return this.httpClient.post(`/projects/${this.id}${t}`,e)}internalPut(t,e){return this.httpClient.put(`/projects/${this.id}${t}`,e)}internalDelete(t){return this.httpClient.delete(`/projects/${this.id}${t}`)}get authorization(){return this.data.authorization}get createdAt(){return this.data.createdAt}get customFields(){return this.data.customFields}set customFields(t){this.data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.previewUrl=t.avatarUrl?`${this.httpClient.serverUrl}/projects/${this._data.id}/preview?updated=${t.updatedAt}`:"",this._data.owner.avatarUrl=`${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`,this._data.owner.fullName=l(this._data.owner),this._data.owner.initials=d(this._data.owner.fullName)}get description(){return this.data.description}set description(t){this.data.description=t}get endDate(){return this.data.endDate}set endDate(t){this.data.endDate=t instanceof Date?t.toISOString():t}get id(){return this.data.id}get memberCount(){return this.data.memberCount}get modelCount(){return this.data.modelCount}get name(){return this.data.name}set name(t){this.data.name=t}get owner(){return this.data.owner}get previewUrl(){return this._data.previewUrl}get public(){return this.data.public}set public(t){this.data.public=t}get startDate(){return this.data.startDate}set startDate(t){this.data.startDate=t instanceof Date?t.toISOString():t}get topicCount(){return this.data.topicCount}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.internalGet("");return this.data=await t.json(),this}async update(t){const e=await this.internalPut("",t);return this.data=await e.json(),this}delete(){return this.internalDelete("").then((t=>t.text())).then((t=>{try{return JSON.parse(t)}catch{return{id:this.id}}}))}save(){return this.update(this.data)}async setPreview(t){if(t){const e=await this.internalPost("/preview",t);this.data=await e.json()}else await this.deletePreview();return this}async deletePreview(){const t=await this.internalDelete("/preview");return this.data=await t.json(),this}getRoles(){return this.internalGet("/roles").then((t=>t.json())).then((t=>t.map((t=>new j(t,this.id,this.httpClient)))))}getRole(t){return this.internalGet(`/roles/${t}`).then((t=>t.json())).then((t=>new j(t,this.id,this.httpClient)))}createRole(t,e,s){return this.internalPost("/roles",{name:t,description:e,permissions:s||{}}).then((t=>t.json())).then((t=>new j(t,this.id,this.httpClient)))}deleteRole(t){return this.internalDelete(`/roles/${t}`).then((t=>t.json()))}getMembers(){return this.internalGet("/members").then((t=>t.json())).then((t=>t.map((t=>new _(t,this.id,this.httpClient)))))}getMember(t){return this.internalGet(`/members/${t}`).then((t=>t.json())).then((t=>new _(t,this.id,this.httpClient)))}addMember(t,e){return this.internalPost("/members",{userId:t,role:e}).then((t=>t.json())).then((t=>new _(t,this.id,this.httpClient)))}removeMember(t){return this.internalDelete(`/members/${t}`).then((t=>t.json()))}getFilesInformation(){return this.httpClient.get(`/bcf/3.0/projects/${this.data.id}/files_information`).then((t=>t.json())).then((t=>(t.forEach((t=>{const e=e=>(t.display_information.find((t=>t.field_display_name===e))||{}).field_value,s=`${this.httpClient.serverUrl}/files/${t.file.reference}/preview`,i=`${this.httpClient.serverUrl}/users/${e("Owner")}/avatar`,r=l(e("Owner First Name"),e("Owner Last Name"),e("Owner User Name")),n=d(r);t.display_information.push({field_display_name:"Preview URL",field_value:s}),t.display_information.push({field_display_name:"Owner Avatar URL",field_value:i}),t.display_information.push({field_display_name:"Owner Full Name",field_value:r}),t.display_information.push({field_display_name:"Owner Initials",field_value:n});const a=`${this.httpClient.serverUrl}/users/${e("Updated By")}/avatar`,o=l(e("Updated By First Name"),e("Updated By Last Name"),e("Updated By User Name")),h=d(o);t.display_information.push({field_display_name:"Updated By Avatar URL",field_value:a}),t.display_information.push({field_display_name:"Updated By Full Name",field_value:o}),t.display_information.push({field_display_name:"Updated By Initials",field_value:h});const u=e("Geometry Status"),p=e("GeometryGltf Status"),c="done"===u?"vsfx":"done"===p?"gltf":"";t.display_information.push({field_display_name:"Geometry Type",field_value:c})})),t)))}getModels(){return this.getFilesInformation().then((t=>t.map((t=>t.file.reference)))).then((t=>{const e=new URLSearchParams;return e.set("id",t.join("|")),this.httpClient.get(`/files?${e.toString()}`)})).then((t=>t.json())).then((t=>t.result.map((t=>new C(t,this.httpClient)))))}async addModel(t,e,s){const i=await this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient))),r=[{project:{id:this.id,name:this.name}}];return await i.createPermission(e,r,s),i}async removeModel(t){const e=await this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient))),s=await e.getPermissions();return await Promise.allSettled(s.filter((t=>t.grantedTo.some((t=>{var e;return(null===(e=t.project)||void 0===e?void 0:e.id)===this.id})))).map((t=>t.delete()))),e}}class P{constructor(t,e){this.httpClient=e,this.data=t}get avatarUrl(){return this._data.avatarUrl}get canCreateProject(){return this.data.canCreateProject}set canCreateProject(t){this._data.canCreateProject=t}get createAt(){return this.data.createAt}get customFields(){return this.data.customFields}set customFields(t){this._data.customFields=t}get data(){return this._data}set data(t){this._data=t,this._data.avatarUrl=t.avatarImage?`${this.httpClient.serverUrl}/users/${this._data.id}/avatar?updated=${t.lastModified}`:"",this._data.fullName=l(this._data),this._data.initials=d(this._data.fullName)}get email(){return this.data.email}set email(t){this._data.email=t}get emailConfirmationId(){return this.data.emailConfirmationId}get firstName(){return this.data.firstName}set firstName(t){this._data.firstName=t}get fullName(){return this.data.fullName}get id(){return this.data.id}get initials(){return this.data.initials}get isAdmin(){return this.data.isAdmin}set isAdmin(t){this._data.isAdmin=t}get isEmailConfirmed(){return this.data.isEmailConfirmed}get lastModified(){return this.data.lastModified}get lastName(){return this.data.lastName}set lastName(t){this._data.lastName=t}get lastSignIn(){return this.data.lastSignIn}get projectsLimit(){return this.data.projectsLimit}set projectsLimit(t){this._data.projectsLimit=t}get providerType(){return this.data.providerType}get storageLimit(){return this.data.storageLimit}set storageLimit(t){this._data.storageLimit=t}get storageUsed(){return this.data.storageUsed}get token(){return this.data.tokenInfo.token}get userName(){return this.data.userName}set userName(t){this._data.userName=t}async checkout(){if(this.httpClient.signInUserIsAdmin){const t=await this.httpClient.get(`/users/${this.id}`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const t=await this.httpClient.get("/user"),e=await t.json();this.data={id:this.id,...e}}}return this}async update(t){if(this.httpClient.signInUserIsAdmin){const e=await this.httpClient.put(`/users/${this.id}`,{isAdmin:t.isAdmin,userBrief:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const e=await this.httpClient.put("/user",t),s=await e.json();this.data={id:this.id,...s}}}return this}delete(){return this.httpClient.signInUserIsAdmin?this.httpClient.delete(`/users/${this.id}`).then((t=>t.json())).then((t=>(this.id===this.httpClient.signInUserId&&(this.httpClient.headers={},this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1),t))):Promise.reject(new r(403))}save(){return this.update(this.data)}async setAvatar(t){if(t)if(this.httpClient.signInUserIsAdmin){const e=await this.httpClient.post(`/users/${this.id}/avatar`,t),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const e=await this.httpClient.post("/user/avatar",t),s=await e.json();this.data={id:this.id,...s}}}else await this.deleteAvatar();return this}async deleteAvatar(){if(this.httpClient.signInUserIsAdmin){const t=await this.httpClient.delete(`/users/${this.id}/avatar`),e=await t.json();this.data={id:e.id,...e.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const t=await this.httpClient.delete("/user/avatar"),e=await t.json();this.data={id:this.id,...e}}}return this}async changePassword(t,e){if(this.httpClient.signInUserIsAdmin){const e=await this.httpClient.put(`/users/${this.id}/password`,{new:t}),s=await e.json();this.data={id:s.id,...s.userBrief}}else{if(this.id!==this.httpClient.signInUserId)return Promise.reject(new r(403));{const s=await this.httpClient.put("/user/password",{old:e,new:t}),i=await s.json();this.data={id:this.id,...i}}}return this}}class b{constructor(t,e){this.httpClient=e,this.data=t}internalGet(){return this.httpClient.get(`/oauth/clients/${this.clientId}`)}internalPost(t,e){return this.httpClient.post(`/oauth/clients/${this.clientId}${t}`,e)}internalPut(t){return this.httpClient.put(`/oauth/clients/${this.clientId}`,t)}internalDelete(){return this.httpClient.delete(`/oauth/clients/${this.clientId}`)}get authUrl(){return this.data.authUrl}get accessTokenUrl(){return this.data.accessTokenUrl}get clientId(){return this.data.clientId}get createdAt(){return this.data.createdAt}get description(){return this.data.description}set description(t){this._data.description=t}get data(){return this._data}set data(t){this._data=t}get name(){return this.data.name}set name(t){this._data.name=t}get redirectUrl(){return this.data.redirectUrl}set redirectUrl(t){this.data.redirectUrl=t}get secret(){return this.data.secret}get updatedAt(){return this.data.updatedAt}async checkout(){const t=await this.internalGet();return this.data=await t.json(),this}async update(t){const e=await this.internalPut(t);return this.data=await e.json(),this}delete(){return this.internalDelete().then((t=>t.json()))}save(){return this.update(this.data)}async revoke(){return await this.internalPost("/revoke"),this}}t.Assembly=p,t.ClashTest=u,t.Client=class extends c{constructor(t={}){super(),this._serverUrl="",this._httpClient=new f(""),this._user=null,this.eventEmitter=this,this.configure(t)}get serverUrl(){return this._serverUrl}get httpClient(){return this._httpClient}get options(){console.warn("Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead.");const t={showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0};return{...t,data:t,defaults:()=>t,resetToDefaults:()=>{},saveToStorage:()=>{},loadFromStorage:()=>{}}}configure(t){return this._serverUrl=(t.serverUrl||"").replace(/\/+$/,""),this._httpClient=new f(this.serverUrl),this._user=null,this}version(){return this.httpClient.get("/version").then((t=>t.json())).then((t=>({...t,server:t.version,client:"25.12.2"})))}registerUser(t,e,s){return this.httpClient.post("/register",{email:t,password:e,userName:null!=s?s:(t+"").split("@").at(0)}).then((t=>t.json()))}resendConfirmationEmail(t,e){return this.httpClient.post("/register/email-confirmation",{email:t,password:e}).then((t=>t.json()))}confirmUserEmail(t){return this.httpClient.get(`/register/email-confirmation/${t}`).then((t=>t.json()))}async signInWithEmail(t,e){const s=btoa(unescape(encodeURIComponent(t+":"+e)));this.httpClient.headers={Authorization:"Basic "+s};const i=await this.httpClient.get("/token"),r=await i.json();return this.setCurrentUser(r)}async signInWithToken(t){this.httpClient.headers={Authorization:t};const e=await this.httpClient.get("/user"),s=await e.json();return this.setCurrentUser(s)}setCurrentUser(t){return this._user=new P(t,this.httpClient),this.httpClient.headers={Authorization:t.tokenInfo.token},this.httpClient.signInUserId=this._user.id,this.httpClient.signInUserIsAdmin=this._user.isAdmin,this._user}clearCurrentUser(){this._user=null,this.httpClient.headers={},this.httpClient.signInUserId="",this.httpClient.signInUserIsAdmin=!1}getCurrentUser(){return this._user&&!this.httpClient.signInUserId&&(this._user=null),this._user}getIdentityProviders(){return this.httpClient.get("/identity").then((t=>t.json()))}getServerSettings(){return this.httpClient.get("/settings").then((t=>t.json()))}updateServerSettings(t){return this.httpClient.put("/settings",t).then((t=>t.json()))}getOAuthClients(t,e){const s=new URLSearchParams;t>0&&s.set("start",t.toString()),e>0&&s.set("limit",e.toString());let i=s.toString();return i&&(i="?"+i),this.httpClient.get(`/oauth/clients${i}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new b(t,this.httpClient)))})))}getOAuthClient(t){return this.httpClient.get(`/oauth/clients/${t}`).then((t=>t.json())).then((t=>new b(t,this.httpClient)))}createOAuthClient(t,e,s){return this.httpClient.post("/oauth/clients",{name:t,redirectUrl:e,description:s}).then((t=>t.json())).then((t=>new b(t,this.httpClient)))}deleteOAuthClient(t){return this.httpClient.delete(`/oauth/clients/${t}`).then((t=>t.json()))}getUsers(){return this.httpClient.get("/users").then((t=>t.json())).then((t=>t.map((t=>({id:t.id,...t.userBrief}))))).then((t=>t.map((t=>new P(t,this.httpClient)))))}getUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.get(`/users/${t}`).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new P(t,this.httpClient))):t===this.httpClient.signInUserId?this.httpClient.get("/user").then((t=>t.json())).then((e=>({id:t,...e}))).then((t=>new P(t,this.httpClient))):Promise.reject(new r(403))}createUser(t,e,s={}){const{isAdmin:i,userName:r,...n}=s;return this.httpClient.post("/users",{isAdmin:i,userBrief:{...n,email:t,userName:null!=r?r:(t+"").split("@").at(0)},password:e}).then((t=>t.json())).then((t=>({id:t.id,...t.userBrief}))).then((t=>new P(t,this.httpClient)))}deleteUser(t){return this.httpClient.signInUserIsAdmin?this.httpClient.delete(`/users/${t}`).then((t=>t.json())).then((e=>(t===this.httpClient.signInUserId&&this.clearCurrentUser(),e))):Promise.reject(new r(403))}getFiles(t,e,s,i,r,n,a){const o=new URLSearchParams;t>0&&o.set("start",t.toString()),e>0&&o.set("limit",e.toString()),s&&o.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.toLowerCase()),i&&o.set("ext",i)),r&&(Array.isArray(r)&&(r=r.join("|")),o.set("id",r)),void 0!==n&&o.set("sortBy",n?"desc":"asc"),a&&o.set("sortField",a);let h=o.toString();return h&&(h="?"+h),this.httpClient.get(`/files${h}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new C(t,this.httpClient)))})))}getFile(t){return this.httpClient.get(`/files/${t}`).then((t=>t.json())).then((t=>new C(t,this.httpClient)))}async uploadFile(t,e={geometry:!0,properties:!1,waitForDone:!1}){const s=await this.httpClient.uploadFile("/files",t,(s=>{var i;this.emitEvent({type:"uploadprogress",data:s,file:t}),null===(i=e.onProgress)||void 0===i||i.call(e,s,t)})).then((t=>JSON.parse(t.responseText))).then((t=>new C(t,this.httpClient))),i="string"==typeof e.geometry?e.geometry:"vsfx",r=[];return e.geometry&&r.push((await s.extractGeometry(i)).outputFormat),e.properties&&r.push((await s.extractProperties()).outputFormat),r.length>0&&(e.waitForDone?await s.waitForDone(r,!0,e):await s.checkout()),s}deleteFile(t){return this.httpClient.delete(`/files/${t}`).then((t=>t.json()))}downloadFile(t,e,s){return this.httpClient.downloadFile(`/files/${t}/downloads`,e,s).then((t=>t.arrayBuffer()))}getJobs(t,e,s,i,r){const n=new URLSearchParams;s>0&&n.set("start",s.toString()),e>0&&n.set("limit",e.toString()),t&&(Array.isArray(t)&&(t=t.join("|")),"string"==typeof t&&(t=t.trim().toLowerCase()),t&&n.set("status",t)),void 0!==i&&n.set("sortBy",i?"desc":"asc"),r&&n.set("sortField",r);let a=n.toString();return a&&(a="?"+a),this.httpClient.get(`/jobs${a}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new y(t,this.httpClient)))})))}getJob(t){return this.httpClient.get(`/jobs/${t}`).then((t=>t.json())).then((t=>new y(t,this.httpClient)))}createJob(t,e,s){return this.httpClient.post("/jobs",{fileId:t,outputFormat:e,parameters:h(s)}).then((t=>t.json())).then((t=>new y(t,this.httpClient)))}deleteJob(t){return this.httpClient.delete(`/jobs/${t}`).then((t=>t.json()))}getAssemblies(t,e,s,i,r,n){const a=new URLSearchParams;t>0&&a.set("start",t.toString()),e>0&&a.set("limit",e.toString()),s&&a.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.trim()),i&&a.set("id",i)),void 0!==r&&a.set("sortBy",r?"desc":"asc"),n&&a.set("sortField",n);let o=a.toString();return o&&(o="?"+o),this.httpClient.get(`/assemblies${o}`).then((t=>t.json())).then((t=>({...t,result:t.result.map((t=>new p(t,this.httpClient)))})))}getAssembly(t){return this.httpClient.get(`/assemblies/${t}`).then((t=>t.json())).then((t=>new p(t,this.httpClient)))}createAssembly(t,e,s){const{waitForDone:i}=null!=s?s:{};return this.httpClient.post("/assemblies",{name:e,files:t}).then((t=>t.json())).then((t=>new p(t,this.httpClient))).then((t=>i?t.waitForDone(s):t))}deleteAssembly(t){return this.httpClient.delete(`/assemblies/${t}`).then((t=>t.json()))}getProjects(t,e,s,i,r){const n=new URLSearchParams;t>0&&n.set("start",t.toString()),e>0&&n.set("limit",e.toString()),s&&n.set("name",s),i&&(Array.isArray(i)&&(i=i.join("|")),"string"==typeof i&&(i=i.trim()),i&&n.set("id",i)),void 0!==r&&n.set("sortBy",r?"desc":"asc");let a=n.toString();return a&&(a="?"+a),this.httpClient.get(`/projects${a}`).then((t=>t.json())).then((r=>{if(Array.isArray(r)){let n=r;if(i&&(n=n.filter((t=>i.includes(t.id)))),s&&(n=n.filter((t=>t.name.includes(s)))),e>0){const s=t>0?t:0;n=n.slice(s,s+e)}return{allSize:r.length,start:t,limit:e,result:n,size:n.length}}return r})).then((t=>({...t,result:t.result.map((t=>new $(t,this.httpClient)))})))}getProject(t){return this.httpClient.get(`/projects/${t}`).then((t=>t.json())).then((t=>new $(t,this.httpClient)))}createProject(t,e,s,i){return this.httpClient.post("/projects",{name:t,description:e,startDate:s instanceof Date?s.toISOString():s,endDate:i instanceof Date?i.toISOString():i}).then((t=>t.json())).then((t=>new $(t,this.httpClient)))}deleteProject(t){return this.httpClient.delete(`/projects/${t}`).then((t=>t.text())).then((e=>{try{return JSON.parse(e)}catch{return{id:t}}}))}},t.FetchError=r,t.File=C,t.Job=y,t.Member=_,t.Model=n,t.OAuthClient=b,t.Permission=v,t.Project=$,t.Role=j,t.User=P,t.parseArgs=h,t.statusText=s,t.userFullName=l,t.userInitials=d,t.version="25.12.2",t.waitFor=o}));
@@ -217,9 +217,9 @@ async function waitFor(func, params = {}) {
217
217
  var _a, _b, _c;
218
218
  const timeout = params.timeout || 6e5;
219
219
  const interval = params.interval || 3e3;
220
- const signal = (_a = params.signal) !== null && _a !== void 0 ? _a : (new AbortController).signal;
221
- const abortError = (_b = params.abortError) !== null && _b !== void 0 ? _b : new DOMException("Aborted", "AbortError");
222
- const timeoutError = (_c = params.timeoutError) !== null && _c !== void 0 ? _c : new DOMException("Timeout", "TimeoutError");
220
+ const signal = (_a = params.signal) !== null && _a !== undefined ? _a : (new AbortController).signal;
221
+ const abortError = (_b = params.abortError) !== null && _b !== undefined ? _b : new DOMException("Aborted", "AbortError");
222
+ const timeoutError = (_c = params.timeoutError) !== null && _c !== undefined ? _c : new DOMException("Timeout", "TimeoutError");
223
223
  const end = performance.now() + timeout;
224
224
  let count = timeout / interval;
225
225
  do {
@@ -242,9 +242,9 @@ function parseArgs(args) {
242
242
  function userFullName(firstName, lastName = "", userName = "") {
243
243
  var _a;
244
244
  if (firstName && typeof firstName !== "string") {
245
- return userFullName((_a = firstName.firstName) !== null && _a !== void 0 ? _a : firstName.name, firstName.lastName, firstName.userName);
245
+ return userFullName((_a = firstName.firstName) !== null && _a !== undefined ? _a : firstName.name, firstName.lastName, firstName.userName);
246
246
  }
247
- return `${firstName !== null && firstName !== void 0 ? firstName : ""} ${lastName !== null && lastName !== void 0 ? lastName : ""}`.trim() || userName;
247
+ return `${firstName !== null && firstName !== undefined ? firstName : ""} ${lastName !== null && lastName !== undefined ? lastName : ""}`.trim() || userName;
248
248
  }
249
249
 
250
250
  function userInitials(fullName = "") {
@@ -338,7 +338,7 @@ class ClashTest {
338
338
  const checkDone = () => this.checkout().then((test => {
339
339
  var _a;
340
340
  const ready = [ "done", "failed" ].includes(test.status);
341
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, test, ready);
341
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, test, ready);
342
342
  return cancel || ready;
343
343
  }));
344
344
  return waitFor(checkDone, params).then((() => this));
@@ -394,7 +394,7 @@ class Assembly {
394
394
  this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
395
395
  this._data.owner.fullName = userFullName(this._data.owner);
396
396
  this._data.owner.initials = userInitials(this._data.owner.fullName);
397
- (_a = (_b = this._data).associatedFiles) !== null && _a !== void 0 ? _a : _b.associatedFiles = [];
397
+ (_a = (_b = this._data).associatedFiles) !== null && _a !== undefined ? _a : _b.associatedFiles = [];
398
398
  this._data.associatedFiles.forEach((file => file.link = `${this.httpClient.serverUrl}/files/${file.fileId}`));
399
399
  }
400
400
  get files() {
@@ -526,7 +526,7 @@ class Assembly {
526
526
  const checkDone = () => this.checkout().then((assembly => {
527
527
  var _a;
528
528
  const ready = [ "done", "failed" ].includes(assembly.status);
529
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, assembly, ready);
529
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, assembly, ready);
530
530
  return cancel || ready;
531
531
  }));
532
532
  return waitFor(checkDone, params).then((() => this));
@@ -554,7 +554,7 @@ class Assembly {
554
554
  return this.internalGet(`/clashes/${testId}`).then((response => response.json())).then((data => new ClashTest(data, this.path, this.httpClient)));
555
555
  }
556
556
  createClashTest(name, selectionTypeA, selectionTypeB, selectionSetA, selectionSetB, params) {
557
- const {tolerance: tolerance, clearance: clearance, waitForDone: waitForDone} = params !== null && params !== void 0 ? params : {};
557
+ const {tolerance: tolerance, clearance: clearance, waitForDone: waitForDone} = params !== null && params !== undefined ? params : {};
558
558
  if (!Array.isArray(selectionSetA)) selectionSetA = [ selectionSetA ];
559
559
  if (!Array.isArray(selectionSetB)) selectionSetB = [ selectionSetB ];
560
560
  return this.internalPost("/clashes", {
@@ -985,7 +985,7 @@ class Job {
985
985
  const checkDone = () => this.checkout().then((job => {
986
986
  var _a;
987
987
  const ready = [ "done", "failed" ].includes(job.status);
988
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, job, ready);
988
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, job, ready);
989
989
  return cancel || ready;
990
990
  }));
991
991
  return waitFor(checkDone, params).then((() => this));
@@ -1042,31 +1042,31 @@ class File {
1042
1042
  if (typeof this._data.owner === "string") this._data.owner = {
1043
1043
  userId: this._data.owner
1044
1044
  };
1045
- (_a = (_o = this._data).owner) !== null && _a !== void 0 ? _a : _o.owner = {};
1045
+ (_a = (_o = this._data).owner) !== null && _a !== undefined ? _a : _o.owner = {};
1046
1046
  this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
1047
1047
  this._data.owner.fullName = userFullName(this._data.owner);
1048
1048
  this._data.owner.initials = userInitials(this._data.owner.fullName);
1049
- (_b = (_p = this._data).status) !== null && _b !== void 0 ? _b : _p.status = {};
1050
- (_c = (_q = this._data.status).geometry) !== null && _c !== void 0 ? _c : _q.geometry = {
1051
- state: (_d = this._data.geometryStatus) !== null && _d !== void 0 ? _d : "none"
1049
+ (_b = (_p = this._data).status) !== null && _b !== undefined ? _b : _p.status = {};
1050
+ (_c = (_q = this._data.status).geometry) !== null && _c !== undefined ? _c : _q.geometry = {
1051
+ state: (_d = this._data.geometryStatus) !== null && _d !== undefined ? _d : "none"
1052
1052
  };
1053
- (_e = (_r = this._data.status).properties) !== null && _e !== void 0 ? _e : _r.properties = {
1054
- state: (_f = this._data.propertiesStatus) !== null && _f !== void 0 ? _f : "none"
1053
+ (_e = (_r = this._data.status).properties) !== null && _e !== undefined ? _e : _r.properties = {
1054
+ state: (_f = this._data.propertiesStatus) !== null && _f !== undefined ? _f : "none"
1055
1055
  };
1056
- (_g = (_s = this._data.status).validation) !== null && _g !== void 0 ? _g : _s.validation = {
1057
- state: (_h = this._data.validationStatus) !== null && _h !== void 0 ? _h : "none"
1056
+ (_g = (_s = this._data.status).validation) !== null && _g !== undefined ? _g : _s.validation = {
1057
+ state: (_h = this._data.validationStatus) !== null && _h !== undefined ? _h : "none"
1058
1058
  };
1059
- (_j = (_t = this._data).updatedBy) !== null && _j !== void 0 ? _j : _t.updatedBy = {};
1059
+ (_j = (_t = this._data).updatedBy) !== null && _j !== undefined ? _j : _t.updatedBy = {};
1060
1060
  this._data.updatedBy.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.updatedBy.userId}/avatar`;
1061
1061
  this._data.updatedBy.fullName = userFullName(this._data.updatedBy);
1062
1062
  this._data.updatedBy.initials = userInitials(this._data.updatedBy.fullName);
1063
- (_k = (_u = this._data).versions) !== null && _k !== void 0 ? _k : _u.versions = [ {
1063
+ (_k = (_u = this._data).versions) !== null && _k !== undefined ? _k : _u.versions = [ {
1064
1064
  ...value
1065
1065
  } ];
1066
- (_l = (_v = this._data.status).geometryGltf) !== null && _l !== void 0 ? _l : _v.geometryGltf = {
1066
+ (_l = (_v = this._data.status).geometryGltf) !== null && _l !== undefined ? _l : _v.geometryGltf = {
1067
1067
  state: "none"
1068
1068
  };
1069
- (_m = (_w = this._data).isFileDeleted) !== null && _m !== void 0 ? _m : _w.isFileDeleted = false;
1069
+ (_m = (_w = this._data).isFileDeleted) !== null && _m !== undefined ? _m : _w.isFileDeleted = false;
1070
1070
  }
1071
1071
  get exports() {
1072
1072
  return this.data.exports;
@@ -1236,7 +1236,7 @@ class File {
1236
1236
  return [ "none", "done", "failed" ].includes(jobStatus.state || "none");
1237
1237
  }));
1238
1238
  const ready = waitAll ? readyJobs.length === waitJobs.length : readyJobs.length > 0;
1239
- const cancel = (_a = params === null || params === void 0 ? void 0 : params.onCheckout) === null || _a === void 0 ? void 0 : _a.call(params, file, ready);
1239
+ const cancel = (_a = params === null || params === undefined ? undefined : params.onCheckout) === null || _a === undefined ? undefined : _a.call(params, file, ready);
1240
1240
  return cancel || ready;
1241
1241
  }));
1242
1242
  return waitFor(checkDone, params).then((() => this));
@@ -1262,7 +1262,7 @@ class File {
1262
1262
  }) {
1263
1263
  const result = await this.httpClient.uploadFile(`${this.path}/versions`, file, (progress => {
1264
1264
  var _a;
1265
- return (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
1265
+ return (_a = params.onProgress) === null || _a === undefined ? undefined : _a.call(params, progress, file);
1266
1266
  })).then((xhr => JSON.parse(xhr.responseText))).then((data => new File(data, this.httpClient)));
1267
1267
  let geometryType = "";
1268
1268
  if (this.versions[0].status.geometryGltf.state !== "none") geometryType = "gltf";
@@ -1659,7 +1659,7 @@ class Project {
1659
1659
  const permissions = await file.getPermissions();
1660
1660
  await Promise.allSettled(permissions.filter((permission => permission.grantedTo.some((x => {
1661
1661
  var _a;
1662
- return ((_a = x.project) === null || _a === void 0 ? void 0 : _a.id) === this.id;
1662
+ return ((_a = x.project) === null || _a === undefined ? undefined : _a.id) === this.id;
1663
1663
  })))).map((permission => permission.delete())));
1664
1664
  return file;
1665
1665
  }
@@ -2053,14 +2053,14 @@ class Client extends EventEmitter2 {
2053
2053
  return this.httpClient.get("/version").then((response => response.json())).then((data => ({
2054
2054
  ...data,
2055
2055
  server: data.version,
2056
- client: "25.12.0"
2056
+ client: "25.12.2"
2057
2057
  })));
2058
2058
  }
2059
2059
  registerUser(email, password, userName) {
2060
2060
  return this.httpClient.post("/register", {
2061
2061
  email: email,
2062
2062
  password: password,
2063
- userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").at(0)
2063
+ userName: userName !== null && userName !== undefined ? userName : (email + "").split("@").at(0)
2064
2064
  }).then((response => response.json()));
2065
2065
  }
2066
2066
  resendConfirmationEmail(email, password) {
@@ -2169,7 +2169,7 @@ class Client extends EventEmitter2 {
2169
2169
  userBrief: {
2170
2170
  ...rest,
2171
2171
  email: email,
2172
- userName: userName !== null && userName !== void 0 ? userName : (email + "").split("@").at(0)
2172
+ userName: userName !== null && userName !== undefined ? userName : (email + "").split("@").at(0)
2173
2173
  },
2174
2174
  password: password
2175
2175
  }).then((response => response.json())).then((data => ({
@@ -2227,7 +2227,7 @@ class Client extends EventEmitter2 {
2227
2227
  data: progress,
2228
2228
  file: file
2229
2229
  });
2230
- (_a = params.onProgress) === null || _a === void 0 ? void 0 : _a.call(params, progress, file);
2230
+ (_a = params.onProgress) === null || _a === undefined ? undefined : _a.call(params, progress, file);
2231
2231
  })).then((xhr => JSON.parse(xhr.responseText))).then((data => new File(data, this.httpClient)));
2232
2232
  const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
2233
2233
  const jobs = [];
@@ -2296,7 +2296,7 @@ class Client extends EventEmitter2 {
2296
2296
  return this.httpClient.get(`/assemblies/${assemblyId}`).then((response => response.json())).then((data => new Assembly(data, this.httpClient)));
2297
2297
  }
2298
2298
  createAssembly(files, name, params) {
2299
- const {waitForDone: waitForDone} = params !== null && params !== void 0 ? params : {};
2299
+ const {waitForDone: waitForDone} = params !== null && params !== undefined ? params : {};
2300
2300
  return this.httpClient.post("/assemblies", {
2301
2301
  name: name,
2302
2302
  files: files
@@ -2365,7 +2365,7 @@ class Client extends EventEmitter2 {
2365
2365
  }
2366
2366
  }
2367
2367
 
2368
- const version = "25.12.0";
2368
+ const version = "25.12.2";
2369
2369
 
2370
2370
  export { Assembly, ClashTest, Client, FetchError, File, Job, Member, Model, OAuthClient, Permission, Project, Role, User, parseArgs, statusText, userFullName, userInitials, version, waitFor };
2371
2371
  //# sourceMappingURL=client.module.js.map