@evergis/api 3.0.42 → 3.0.46

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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("ky"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@evergis/event-emitter"),s=require("query-string"),o=require("nanoid"),i=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),a=require("@evergis/sgis/es/Map"),u=require("@evergis/sgis/es/layers/TileLayer"),l=require("@evergis/sgis/es/layers/DynamicLayer"),c=require("@evergis/sgis");function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){if(null==e)return{};var n,r,s={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(s[n]=e[n]);return s}function k(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=v(e);if(t){var s=v(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return k(this,n)}}function b(e,t,n){return(b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(n):s.value}})(e,t,n||e)}let T=function e(t){p(this,e),this.http=t},w=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"findUserByName",value:function(e){return this.http.get("/security/users",e).json()}},{key:"getPolicyList",value:function(e){return this.http.get("/security/policies",e).json()}},{key:"removePolicy",value:function(e){return this.http.delete("/security/policies",null,e).then(()=>{})}},{key:"setPolicy",value:function(e){return this.http.post("/security/policies",e).then(()=>{})}}]),n}(),x=function(e){d(n,w);var t=m(n);function n(e,r){var s;let{username:o,roles:i}=r;return p(this,n),(s=t.call(this,e)).ownerName="",s.ownerRoles=[],s.ownerName=o,s.ownerRoles=i,s}return y(n,[{key:"reset",value:function(){this.ownerName="",this.ownerRoles=[]}}]),n}(),j=function(){function e(t){var r;void 0===t&&(t={}),p(this,e),this.ky=n.extend(t),this.prefixUrl=(null==(r=t.prefixUrl)?void 0:r.toString())||""}return y(e,[{key:"extend",value:function(e){var t;this.ky=n.extend(e),this.prefixUrl=(null==(t=e.prefixUrl)?void 0:t.toString())||""}},{key:"get",value:function(e,t){return this.ky.get(this.stripSlashes(e),{searchParams:P(t)})}},{key:"post",value:function(e,t,n){const r=S(n,t);return this.ky.post(this.stripSlashes(e),r)}},{key:"put",value:function(e,t,n){const r=S(n,t);return this.ky.put(this.stripSlashes(e),r)}},{key:"patch",value:function(e,t,n){const r=S(n,t);return this.ky.patch(this.stripSlashes(e),r)}},{key:"delete",value:function(e,t,n){const r=S(n,t);return this.ky.delete(this.stripSlashes(e),r)}},{key:"createUrl",value:function(e,t){const n=t?"?"+P(t):"";return this.prefixUrl+this.stripSlashes(e)+n}},{key:"stripSlashes",value:function(e){return this.prefixUrl?e.replace(/^\//g,""):e}}]),e}();function S(e,t){const n={searchParams:P(e)};var r;return void 0!==(r=t)&&"object"==typeof r&&null!==r&&r.constructor===Object||Array.isArray(t)?n.json=t:n.body=t,n}function P(e){return void 0===e&&(e={}),s.stringify(e,{arrayFormat:"comma"})}function R(e){return Object.keys(e).reduce((t,n)=>(t.append(n,e[n]),t),new FormData)}let I=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"downloadFile",value:function(e){return this.http.get("/upload/file",e).blob()}},{key:"uploadFile",value:function(e){return this.http.post("/upload/file",R(e)).json()}}]),n}(),C=function(e){d(n,I);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"upload",value:function(e,t){return this.uploadFile({file:e,rewrite:!!t})}}]),n}(),E=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getDataSchema",value:function(e){return this.http.get("/import/dataSchema",e).json()}},{key:"getExcelDataSchema",value:function(e){return this.http.get("/import/excelDataSchema",e).json()}},{key:"getCsvDataSchema",value:function(e){return this.http.get("/import/csvDataSchema",e).json()}},{key:"getRasterAttributes",value:function(e){return this.http.get("/import/rasterAttributes",e).json()}}]),n}(),L=function(e){d(n,E);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),U=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getSubscriptionList",value:function(){return this.http.get("/notifications/subscribes").json()}},{key:"subscribeOperation",value:function(e){return this.http.post("/notifications/subscribes",null,e).then(()=>{})}},{key:"unsubscribeOperation",value:function(e){return this.http.delete("/notifications/subscribes",null,e).then(()=>{})}},{key:"subscribeListOperation",value:function(e){return this.http.post("/notifications/subscribe-list",e).then(()=>{})}},{key:"unsubscribeListOperation",value:function(e){return this.http.post("/notifications/unsubscribe-list",e).then(()=>{})}}]),n}();var N;(N=exports.ConnectionStatus||(exports.ConnectionStatus={})).Initialized="Initialized",N.Connected="Connected",N.Break="Break",N.Lost="Lost",N.SessionClosed="SessionClosed";let F=function(e){d(n,U);var t=m(n);function n(e){var s;return p(this,n),(s=t.call(this,e)).MAX_WS_RECONNECT_TRIES=10,s.reconnectTries=0,s.subscriptions=[],s._connectStatus=exports.ConnectionStatus.Initialized,s.onWsConnected=()=>{s.connectStatus=exports.ConnectionStatus.Connected},s.onWsClosed=e=>{4001===e.code||4002===e.code?s.connectStatus=exports.ConnectionStatus.SessionClosed:s.reconnectTries<s.MAX_WS_RECONNECT_TRIES?(s.connectStatus=exports.ConnectionStatus.Break,s.reconnectTries++,s.ws&&(s.ws.onopen=null,s.ws.onclose=null,s.ws.onmessage=null,s.ws=void 0),setTimeout(()=>{s.connect()},0)):s.connectStatus=exports.ConnectionStatus.Lost},s.onWsMessage=e=>{let t={};try{t=JSON.parse(e.data)}catch(e){console.debug("Failed to parse ws message from sp.")}if("notification"===t.type&&t.data){const{tag:e,data:n}=t.data;e&&s.emitter.emit(e,new A(n))}},s.emitter=new r.EventEmitter,s}return y(n,[{key:"on",value:function(e,t){this.emitter.on(e,t)}},{key:"off",value:function(e,t){this.emitter.off(e,t)}},{key:"subscribe",value:async function(e){this.subscriptions.push(e),setTimeout(()=>{this.subscriptions.length&&this.subscribeListOperation(this.subscriptions),this.subscriptions=[]},500)}},{key:"unsubscribe",value:async function(e){if((await this.getSubscriptionList()).includes(e))return this.unsubscribeOperation({tag:e})}},{key:"connectWs",value:function(e){const t=e.replace("http://","ws://").replace("https://","wss://");this.wsUrl=t,this.connect()}},{key:"connect",value:function(){this.wsUrl?(this.ws=new WebSocket(this.wsUrl),this.ws.onopen=this.onWsConnected,this.ws.onclose=this.onWsClosed,this.ws.onmessage=this.onWsMessage):console.warn("Connection to WebSocket not allowed. wsUrl not provided")}},{key:"connectStatus",get:function(){return this._connectStatus},set:function(e){this.emitter.emit("ConnectionStatus",new A(e)),this._connectStatus=e}}]),n}(),A=function e(t){p(this,e),this.data=t},D=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTaskList",value:function(e){return this.http.get("/scheduler/tasks",e).json()}},{key:"getTaskInfo",value:function(e){return this.http.get("/scheduler/tasks/"+e).json()}},{key:"getTaskProgress",value:function(e){return this.http.get("/scheduler/tasks/"+e+"/progress").json()}},{key:"cancelTask",value:function(e){return this.http.post("/scheduler/tasks/"+e+"/cancel",null).json()}},{key:"startCopyTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"copy"}).json()}},{key:"startAggregateTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"aggregate"}).json()}},{key:"startBufferTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"buffer"}).json()}},{key:"startPrintTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"print"}).json()}},{key:"startTilingTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"tiling"}).json()}},{key:"startRouteTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"route"}).json()}},{key:"startUnionTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"union"}).json()}},{key:"startOverlayTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"overlay"}).json()}},{key:"startFilterCopyTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"filterCopy"}).json()}},{key:"startPipelineTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"pipeline"}).json()}},{key:"startEditAttributesBatch",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"editAttributes"}).json()}}]),n}(),O=function(e){d(n,D);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"init",value:function(e){return this.notification=e,this.notification.subscribe("server_task")}},{key:"runCopyTask",value:async function(e){const{taskId:t}=await this.startCopyTask(e);return this.processTaskId(t)}},{key:"runBufferTask",value:async function(e){const{taskId:t}=await this.startBufferTask(e);return this.processTaskId(t)}},{key:"runUnionTask",value:async function(e){const{taskId:t}=await this.startUnionTask(e);return this.processTaskId(t)}},{key:"runPrintTask",value:async function(e){const{taskId:t}=await this.startPrintTask(e);return this.processTaskId(t)}},{key:"runTilingTask",value:async function(e){const{taskId:t}=await this.startTilingTask(e);return this.processTaskId(t)}},{key:"runRouteTask",value:async function(e){const{taskId:t}=await this.startRouteTask(e);return this.processTaskId(t)}},{key:"runOverlayTask",value:async function(e){const{taskId:t}=await this.startOverlayTask(e);return this.processTaskId(t)}},{key:"runFilterCopyTask",value:async function(e){const{taskId:t}=await this.startFilterCopyTask(e);return this.processTaskId(t)}},{key:"runPipelineTask",value:async function(e){const{taskId:t}=await this.startPipelineTask(e);return this.processTaskId(t)}},{key:"runEditAttributesTask",value:async function(e){const{taskId:t}=await this.startEditAttributesBatch(e);return this.processTaskId(t)}},{key:"waitTaskCompleted",value:async function(e){return new Promise(async(t,n)=>{const r=await this.getTaskProgress(e);this.resolveTaskStatus(r,t,n);const s=async r=>{let{data:o}=r;if(o.taskId===e&&o.status&&["Completed","Failed","Canceled"].includes(o.status)){const r=await this.getTaskProgress(e);this.notification&&this.notification.off("server_task",s),this.resolveTaskStatus(r,t,n)}};this.notification&&this.notification.on("server_task",s)})}},{key:"resolveTaskStatus",value:function(e,t,n){"Completed"===e.status?t(e):"Failed"!==e.status&&"Canceled"!==e.status||n(e.status)}},{key:"processTaskId",value:function(e){if(e)return this.waitTaskCompleted(e);throw new Error("Task was started with no testId")}}]),n}(),B=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getLayersList",value:function(e){return this.http.get("/layers",e).json()}},{key:"getLayerInfo",value:function(e){return this.http.get("/layers/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/layers/"+e,null).then(()=>{})}},{key:"publishProxyService",value:function(e){return this.http.post("/layers",e,{type:"ProxyService"}).json()}},{key:"publishRemoteTileService",value:function(e){return this.http.post("/layers",e,{type:"RemoteTileService"}).json()}},{key:"publishLocalTileService",value:function(e){return this.http.post("/layers",e,{type:"LocalTileService"}).json()}},{key:"publishPostgresLayerService",value:function(e){return this.http.post("/layers",e,{type:"PostgresLayerService"}).json()}},{key:"publishPostgresTileCatalogService",value:function(e){return this.http.post("/layers",e,{type:"PostgresTileLayerService"}).json()}},{key:"updateProxyService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"ProxyService"}).json()}},{key:"updateTileCatalogService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"PostgresTileLayerService"}).json()}},{key:"publishStyledLayerService",value:function(e){return this.http.post("/layers",e,{type:"StyledFeatureLayer"}).json()}},{key:"publishCompositeService",value:function(e){return this.http.post("/layers",e,{type:"CompositeService"}).json()}},{key:"updateRemoteTileService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"RemoteTileService"}).json()}},{key:"updateLocalTileService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"LocalTileService"}).json()}},{key:"updatePostgresLayerService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"PostgresLayerService"}).json()}},{key:"updateCompositeService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"CompositeService"}).json()}},{key:"reloadService",value:function(e){return this.http.get("/layers/"+e+"/reload").json()}},{key:"getFeatures",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features",n).json()}},{key:"deleteFeature",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.delete("/layers/"+t+"/features",null,n).json()}},{key:"createFeatures",value:function(e,t){return this.http.post("/layers/"+e+"/features",t).json()}},{key:"updateFeature",value:function(e,t){return this.http.patch("/layers/"+e+"/features",t).json()}},{key:"getById",value:function(e){let{name:t,id:n}=e,r=g(e,["name","id"]);return this.http.get("/layers/"+t+"/features/"+n,r).json()}},{key:"unite",value:function(e,t){let{name:n,id:r}=e,s=g(e,["name","id"]);return this.http.post("/layers/"+n+"/features/"+r+"/unite",t,s).json()}},{key:"subtract",value:function(e,t){let{name:n,id:r}=e,s=g(e,["name","id"]);return this.http.post("/layers/"+n+"/features/"+r+"/subtract",t,s).json()}},{key:"getTilesLayerImage",value:function(e){let{name:t,x:n,y:r,z:s}=e,o=g(e,["name","x","y","z"]);return this.http.createUrl("/layers/"+t+"/tile/"+s+"/"+n+"/"+r,o)}},{key:"getLayerImage",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.createUrl("/layers/"+t+"/export",n)}},{key:"getLayerExtent",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/extent",n).json()}},{key:"getByGeometry",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features/getByGeometry",n).json()}},{key:"getByGeometryPost",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.post("/layers/"+n+"/features/getByGeometry",t,r).json()}},{key:"deleteFeatures",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.delete("/layers/"+t+"/features/deleteByIds",null,n).json()}},{key:"getByGeometryGet",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features/getByGeometryByClick",n).json()}},{key:"classify",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/classify",n).json()}},{key:"distincts",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/distincts",n).json()}},{key:"aggregateAttribute",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/aggregate-values",n).json()}},{key:"getFilteredFeaturesCount",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features/count",n).json()}},{key:"editAttributes",value:function(e,t){return this.http.post("/layers/"+e+"/features/edit-attributes",t).json()}},{key:"selectFeatures",value:function(e){return this.http.get("/layers/features/select",e).json()}},{key:"validateExpression",value:function(e){let{layerName:t}=e,n=g(e,["layerName"]);return this.http.get("/layers/"+t+"/validateExpression",n).json()}},{key:"getPreview",value:function(e){return this.http.createUrl("/layers/"+e+"/preview")}},{key:"setPreview",value:function(e,t){return this.http.post("/layers/"+e+"/preview",R(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/layers/"+e+"/preview",null).then(()=>{})}},{key:"getResourceDependencies",value:function(e){return this.http.get("/layers/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/layers/"+e+"/references").json()}},{key:"getPermissions",value:function(e){return this.http.get("/layers/"+e+"/permissions").json()}},{key:"addPermissions",value:function(e,t){return this.http.post("/layers/"+e+"/permissions",t).json()}},{key:"setPermissions",value:function(e,t){return this.http.put("/layers/"+e+"/permissions",t).json()}},{key:"removePermissions",value:function(e,t){return this.http.delete("/layers/"+e+"/permissions/"+t,null).json()}}]),n}();async function M(e){return(await Promise.all(e.map(e=>e.catch(e=>q(e)?e:new Error(e))))).filter(_)}function q(e){return e instanceof Error}function _(e){return!q(e)}let G=function(e){d(n,B);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getLayerInfos",value:function(e){return M(e.map(e=>this.getLayerInfo(e)))}},{key:"getLayersDeps",value:function(e){return M(e.map(e=>this.getResourceDependencies(e)))}},{key:"getBasemaps",value:function(e){return this.getLayersList(f({},e,{types:["LocalTileService","RemoteTileService"]}))}},{key:"createSubLayer",value:function(e){return this.publishStyledLayerService(e)}},{key:"createTileLayer",value:function(e){let{remote:t}=e,n=g(e,["remote"]);return t?this.publishRemoteTileService(n):this.publishLocalTileService(n)}},{key:"uploadPreview",value:function(e,t){return this.setPreview(e,{file:t})}},{key:"findOne",value:function(e){return this.getLayerInfo(e)}},{key:"findAll",value:function(e){return this.getLayersList(e)}},{key:"create",value:function(e){return this.publishPostgresLayerService(e)}},{key:"update",value:function(e){return this.updatePostgresLayerService(e.name,e)}},{key:"remove",value:async function(e){return await this.deleteResource(e),e}}]),n}(),V=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTableList",value:function(e){return this.http.get("/tables",e).json()}},{key:"createTable",value:function(e){return this.http.post("/tables",e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/tables/"+e,null).then(()=>{})}},{key:"updateTable",value:function(e,t){return this.http.patch("/tables/"+e,t).json()}},{key:"getTableInfo",value:function(e){return this.http.get("/tables/"+e).json()}},{key:"updateTableData",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.patch("/tables/"+n+"/data",t,r).then(()=>{})}},{key:"deleteTableData",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.delete("/tables/"+t+"/data",null,n).then(()=>{})}},{key:"getUniqueDataRows",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/tables/"+t+"/data/unique-values",n).json()}},{key:"mapTable",value:function(e,t){return this.http.post("/tables/map-table",t,f({type:"Table"},e)).json()}},{key:"mapView",value:function(e,t){return this.http.post("/tables/map-table",t,f({type:"MaterializedView"},e)).json()}},{key:"mapRemoteTable",value:function(e,t){return this.http.post("/tables/map-table",t,f({type:"RemoteTable"},e)).json()}},{key:"unmapTable",value:function(e){return this.http.delete("/tables/map-table/"+e,null).then(()=>{})}},{key:"getPreview",value:function(e){return this.http.createUrl("/tables/"+e+"/preview")}},{key:"setPreview",value:function(e,t){return this.http.post("/tables/"+e+"/preview",R(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/tables/"+e+"/preview",null).then(()=>{})}},{key:"getResourceDependencies",value:function(e){return this.http.get("/tables/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/tables/"+e+"/references").json()}},{key:"getPermissions",value:function(e){return this.http.get("/tables/"+e+"/permissions").json()}},{key:"addPermissions",value:function(e,t){return this.http.post("/tables/"+e+"/permissions",t).json()}},{key:"setPermissions",value:function(e,t){return this.http.put("/tables/"+e+"/permissions",t).json()}},{key:"removePermissions",value:function(e,t){return this.http.delete("/tables/"+e+"/permissions/"+t,null).json()}}]),n}(),H=function(e){d(n,V);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTableInfos",value:function(e){return M(e.map(e=>this.getTableInfo(e)))}},{key:"uploadPreview",value:function(e,t){return this.setPreview(e,{file:t})}},{key:"findOne",value:function(e){return this.getTableInfo(e)}},{key:"findAll",value:function(e){return this.getTableList(e)}},{key:"create",value:function(e){return this.createTable(e)}},{key:"update",value:function(e){return this.updateTable(e.name,e)}},{key:"remove",value:async function(e){return await this.deleteResource(e),e}}]),n}(),W=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getProjectLayersExtendedInfo",value:function(e){return this.http.get("/projects/"+e+"/extended-info").json()}},{key:"getProjectsList",value:function(e){return this.http.get("/projects",e).json()}},{key:"createProject",value:function(e){return this.http.post("/projects",e).json()}},{key:"createShareProject",value:function(e,t){return this.http.post("/projects/"+e+"/share",t).json()}},{key:"removeShareProject",value:function(e){return this.http.delete("/projects/"+e+"/share",null).then(()=>{})}},{key:"updateProject",value:function(e,t){return this.http.patch("/projects/"+e,t).json()}},{key:"getProjectInfo",value:function(e){return this.http.get("/projects/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/projects/"+e,null).then(()=>{})}},{key:"getPreview",value:function(e){return this.http.createUrl("/projects/"+e+"/preview")}},{key:"setPreview",value:function(e,t){return this.http.post("/projects/"+e+"/preview",R(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/projects/"+e+"/preview",null).then(()=>{})}},{key:"getResourceDependencies",value:function(e){return this.http.get("/projects/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/projects/"+e+"/references").json()}},{key:"getPermissions",value:function(e){return this.http.get("/projects/"+e+"/permissions").json()}},{key:"addPermissions",value:function(e,t){return this.http.post("/projects/"+e+"/permissions",t).json()}},{key:"setPermissions",value:function(e,t){return this.http.put("/projects/"+e+"/permissions",t).json()}},{key:"removePermissions",value:function(e,t){return this.http.delete("/projects/"+e+"/permissions/"+t,null).json()}}]),n}(),z=function(e){d(n,W);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getProjectInfos",value:function(e){return M(e.map(e=>this.getProjectInfo(e)))}},{key:"getProjectsDeps",value:function(e){return M(e.map(e=>this.getResourceDependencies(e)))}},{key:"uploadPreview",value:function(e,t){return this.setPreview(e,{file:t})}},{key:"findOne",value:function(e){return this.getProjectInfo(e)}},{key:"findAll",value:function(e){return this.getProjectsList(e)}},{key:"create",value:function(e){return this.createProject(e)}},{key:"update",value:function(e){return this.updateProject(e.name,e)}},{key:"remove",value:async function(e){return await this.deleteResource(e),e}}]),n}();function J(e,t,n){return n.indexOf(e)===t}function K(e){return"string"==typeof e}var Q;(Q=exports.DependencyType||(exports.DependencyType={})).Layer="Layer",Q.Table="Table";let X=function(){function e(t,n,r){p(this,e),this.projects=t,this.layers=n,this.tables=r}return y(e,[{key:"getProjectInfosWithDeps",value:async function(e){const t=await this.projects.getProjectInfos(e),n=await this.projects.getProjectsDeps(e),{layers:r,tables:s}=await this.getDependencies(n,!0,!0);return{projects:t,deps:{layers:r,tables:s}}}},{key:"getLayerInfosWithDeps",value:async function(e){const t=await this.layers.getLayerInfos(e),n=await this.layers.getLayersDeps(e),{tables:r}=await this.getDependencies(n,!1,!0);return{layers:t,deps:{tables:r}}}},{key:"getDependencies",value:async function(e,t,n){const{tables:r,layers:s}=e.reduce((e,r)=>{const s=r.dependencies||[];if(t){const t=this.getDependentNames(s,exports.DependencyType.Layer);e.layers.push(...t)}if(n){const t=this.getDependentNames(s,exports.DependencyType.Table);e.tables.push(...t)}return e},{tables:[],layers:[]});return{tables:await this.tables.getTableInfos(r.filter(J)),layers:await this.layers.getLayerInfos(s.filter(J))}}},{key:"getDependentNames",value:function(e,t){return e.filter(e=>{let{type:n}=e;return n===t}).map(e=>{let{name:t}=e;return t}).filter(K)}}]),e}(),Y=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getStyle",value:function(e){return this.http.get("/styles/"+e).json()}},{key:"updateStyle",value:function(e,t){return this.http.post("/styles/"+e,t).json()}},{key:"createStyle",value:function(e){return this.http.post("/styles",e).json()}},{key:"getAllFonts",value:function(){return this.http.get("/styles/fonts").json()}}]),n}(),Z=function(e){d(n,Y);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),$=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"geocode",value:function(e){let{providerName:t}=e,n=g(e,["providerName"]);return this.http.get("/geocode/"+t,n).json()}},{key:"geocodeByPoint",value:function(e){let{providerName:t}=e,n=g(e,["providerName"]);return this.http.get("/geocode/"+t+"/geocodeByPoint",n).json()}},{key:"suggest",value:function(e){let{providerName:t}=e,n=g(e,["providerName"]);return this.http.get("/geocode/"+t+"/suggest",n).json()}}]),n}(),ee=function(e){d(n,$);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"geocode2Gis",value:function(e){return this.geocode(f({providerName:"geocode2gis"},e))}},{key:"suggest2Gis",value:function(e){return this.suggest(f({providerName:"geocode2gis"},e))}}]),n}(),te=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getProjects",value:function(e){return this.http.get("/resources/projects",e).json()}},{key:"getTables",value:function(e){return this.http.get("/resources/tables",e).json()}},{key:"getLayers",value:function(e){return this.http.get("/resources/layers",e).json()}},{key:"addResource",value:function(e,t){return this.http.post("/resources/"+e+"/add",t).then(()=>{})}},{key:"addResources",value:function(e,t){return this.http.post("/resources/add",t,e).then(()=>{})}},{key:"removeResource",value:function(e,t){return this.http.post("/resources/"+e+"/remove",t).then(()=>{})}},{key:"getNewResources",value:function(){return this.http.get("/resources/getNewResources").json()}},{key:"touchResources",value:function(e,t){return this.http.post("/resources/"+e+"/touchResources",t).then(()=>{})}},{key:"shareResources",value:function(e,t){return this.http.post("/resources/"+e+"/shareAll",t).then(()=>{})}},{key:"unshareResources",value:function(e,t){return this.http.post("/resources/"+e+"/unshareAll",t).then(()=>{})}},{key:"getResource",value:function(e,t){return this.http.get("/resources/"+e+"/"+t).json()}},{key:"removeResource1",value:function(e){let{resourceType:t}=e,n=g(e,["resourceType"]);return this.http.delete("/resources/"+t,null,n).then(()=>{})}},{key:"checkLimits",value:function(){return this.http.get("/resources/checkLimits").json()}},{key:"copyResources",value:function(e){return this.http.post("/resources/copy",e).json()}}]),n}(),ne=function(e){d(n,te);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),re=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTools",value:function(e){return this.http.get("/tools",e).json()}},{key:"createTool",value:function(e){return this.http.post("/tools",e).json()}},{key:"loadToolInfo",value:function(e){return this.http.get("/tools/"+e+"/info").json()}},{key:"loadToolDefinition",value:function(e){return this.http.get("/tools/"+e).json()}},{key:"updateTool",value:function(e,t){return this.http.patch("/tools/"+e,t).then(()=>{})}},{key:"deleteTool",value:function(e){return this.http.delete("/tools/"+e,null).then(()=>{})}},{key:"addToolPermissions",value:function(e,t){return this.http.post("/tools/"+e+"/add-permissions",t).then(()=>{})}},{key:"removeToolPermissions",value:function(e,t){return this.http.post("/tools/"+e+"/remove-permissions",t).then(()=>{})}},{key:"replaceToolPermissions",value:function(e,t){return this.http.put("/tools/"+e+"/set-permissions",t).then(()=>{})}},{key:"loadToolPermission",value:function(e){return this.http.get("/tools/"+e+"/permissions").json()}},{key:"reloadTool",value:function(e){return this.http.get("/tools/"+e+"/reload").then(()=>{})}},{key:"getToolsNames",value:function(e){return this.http.get("/tools/list-names",e).json()}},{key:"addToolToGroups",value:function(e,t){return this.http.post("/tools/"+e+"/add-groups",t).then(()=>{})}},{key:"removeFromGroups",value:function(e,t){return this.http.post("/tools/"+e+"/remove-groups",t).then(()=>{})}},{key:"getGroups",value:function(e){return this.http.get("/tools/groups",e).json()}},{key:"createGroup",value:function(e){return this.http.post("/tools/groups",e).json()}},{key:"loadGroup",value:function(e){return this.http.get("/tools/groups/"+e).json()}},{key:"updateGroup",value:function(e,t){return this.http.post("/tools/groups/"+e,t).then(()=>{})}},{key:"deleteGroup",value:function(e){return this.http.delete("/tools/groups/"+e,null).then(()=>{})}},{key:"addToolsToGroup",value:function(e){return this.http.post("/tools/groups/add-tools",e).then(()=>{})}},{key:"removeToolsFromGroup",value:function(e){return this.http.post("/tools/groups/remove-tools",e).then(()=>{})}},{key:"getGroupsInfo",value:function(e){return this.http.get("/tools/groups/list-info",e).json()}},{key:"evaluateTool",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.post("/tools/"+n+"/evaluate",t,r).json()}},{key:"executeTool",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.post("/tools/"+n+"/run",t,r).json()}},{key:"getToolsLists",value:function(e){return this.http.get("/tools/journal",e).json()}},{key:"getTool",value:function(e){return this.http.get("/tools/journal/"+e).json()}},{key:"cancelExecute",value:function(e){return this.http.post("/tools/"+e+"/cancel",null).then(()=>{})}},{key:"getToolResult",value:function(e,t){return this.http.post("/tools/"+e+"/result",t).json()}}]),n}(),se=function(e){d(n,re);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),oe=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getServerInfo",value:function(){return this.http.get("/").json()}},{key:"favicon",value:function(){return this.http.createUrl("/favicon.ico")}},{key:"getFunctionsList",value:function(){return this.http.get("/functions").json()}}]),n}(),ie=function(e){d(n,oe);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),ae=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getNamespaces",value:function(e){return this.http.get("/namespaces",e).json()}},{key:"createNamespace",value:function(e){return this.http.post("/namespaces",null,e).json()}},{key:"getNamespace",value:function(e){return this.http.get("/namespaces/"+e).json()}},{key:"removeNamespace",value:function(e){return this.http.delete("/namespaces/"+e,null).then(()=>{})}}]),n}(),ue=function(e){d(n,ae);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),le=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getUsers",value:function(e){return this.http.get("/account/user/list",e).json()}},{key:"getExtendedUsers",value:function(e){return this.http.get("/account/user/extendedlist",e).json()}},{key:"getUserInfo",value:function(e){return this.http.get("/account/"+e).json()}},{key:"getExtendedUserInfo",value:function(e){return this.http.get("/account/extended/"+e).json()}},{key:"isUsernameExists",value:function(e){return this.http.get("/account/user/exists",e).json()}},{key:"isEmailExists",value:function(e){return this.http.get("/account/user/email/exists",e).json()}},{key:"registerUser",value:function(e){return this.http.post("/account/register",e).text()}},{key:"createUser",value:function(e,t){return this.http.post("/account/user",t,e).then(()=>{})}},{key:"updateUser",value:function(e){return this.http.patch("/account/user",e).then(()=>{})}},{key:"confirmEmail",value:function(e){return this.http.post("/account/user/"+e+"/email/confirm",null).then(()=>{})}},{key:"verifyEmail",value:function(e){return this.http.post("/account/user/"+e+"/email/verify",null).then(()=>{})}},{key:"setEmail",value:function(e){return this.http.post("/account/setEmail",R(e)).then(()=>{})}},{key:"confirmEmail1",value:function(e){return this.http.post("/account/user/email/confirm",null,e).then(()=>{})}},{key:"changeEmail",value:function(e){return this.http.post("/account/user/email/change",null,e).then(()=>{})}},{key:"confirmChangeEmail",value:function(e){return this.http.post("/account/user/email/change/confirm",null,e).then(()=>{})}},{key:"setUserPassword",value:function(e,t){return this.http.patch("/account/user/"+e+"/password",t).then(()=>{})}},{key:"changePassword",value:function(e){return this.http.patch("/account/password/change",R(e)).then(()=>{})}},{key:"resetPassword",value:function(e){return this.http.post("/account/password/reset",null,e).then(()=>{})}},{key:"resetPasswordCallback",value:function(e){return this.http.post("/account/password/reset/confirm",R(e)).then(()=>{})}},{key:"removeUser",value:function(e){return this.http.delete("/account/user/"+e,null).then(()=>{})}},{key:"activateUser",value:function(e){return this.http.post("/account/user/"+e+"/activate",null).then(()=>{})}},{key:"deactivateUser",value:function(e){return this.http.post("/account/user/"+e+"/deactivate",null).then(()=>{})}},{key:"authenticate",value:function(e){return this.http.post("/account/login",e).text()}},{key:"refreshToken",value:function(){return this.http.post("/account/refresh-token",null).text()}},{key:"revokeToken",value:function(){return this.http.delete("/account/revoke-token",null).then(()=>{})}},{key:"getRoles",value:function(e){return this.http.get("/account/role/list",e).json()}},{key:"createRole",value:function(e){return this.http.post("/account/role",e).then(()=>{})}},{key:"updateRole",value:function(e){return this.http.patch("/account/role",e).then(()=>{})}},{key:"removeRole",value:function(e){return this.http.delete("/account/role/"+e,null).then(()=>{})}},{key:"addToRole",value:function(e,t){return this.http.post("/account/user/"+e+"/role/"+t,null).then(()=>{})}},{key:"removeFromRole",value:function(e,t){return this.http.delete("/account/user/"+e+"/role/"+t,null).then(()=>{})}},{key:"postUsedProjects",value:function(e){return this.http.post("/account/latest_projects",e).json()}},{key:"getUsedProjects",value:function(){return this.http.get("/account/latest_projects").json()}},{key:"truncateUsedProjects",value:function(){return this.http.delete("/account/latest_projects",null).then(()=>{})}}]),n}();const ce=()=>JSON.parse(localStorage.getItem(he)||"null")||void 0,pe=e=>{if(e){const t=ce();localStorage.setItem(he,JSON.stringify(f({},t,e)))}else localStorage.removeItem(he)},he="@evergis/user-info";let ye=function(e){d(n,le);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"login",value:async function(e){e&&await b(v(n.prototype),"authenticate",this).call(this,e)}},{key:"fetchCurrentUser",value:async function(){return this.userInfo=await this.getUserInfo(""),this.userInfo}},{key:"logout",value:async function(){await this.revokeToken(),pe(void 0),this.userInfo={}}},{key:"updateCurrentUser",value:async function(e){await b(v(n.prototype),"updateUser",this).call(this,f({username:this.username},e)),pe(e)}},{key:"setPassword",value:function(e){return this.setUserPassword(this.username,e)}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}},{key:"isAuth",get:function(){var e;return!!(null==(e=this.userInfo)?void 0:e.username)&&"public"!==this.userInfo.username}},{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=ce();return e&&(this.userInfo=e),e}}]),n}(),fe=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getPreview",value:function(e){return this.http.createUrl("/account/user/"+e+"/preview")}},{key:"uploadPreview",value:function(e,t){return this.http.post("/account/user/"+e+"/preview",R(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/account/user/"+e+"/preview",null).then(()=>{})}},{key:"getPreview1",value:function(){return this.http.createUrl("/account/user/preview")}}]),n}(),de=function(e){d(n,fe);var t=m(n);function n(e,r){var s;return p(this,n),(s=t.call(this,e)).userInfo=r,s}return y(n,[{key:"updateCurrentUserPhoto",value:async function(e){const{fileId:t}=await this.uploadPreview(this.username,{file:e});pe({profile_photo:t,has_profile_photo:!0})}},{key:"fetchPreview1",value:async function(){const e=await this.getPreview1();pe({profile_photo:e,has_profile_photo:!0})}},{key:"deleteCurrentUserPhoto",value:async function(){await this.deletePreview(this.username),pe({profile_photo:"",has_profile_photo:!1})}},{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=ce();return e&&(this.userInfo=e),e}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}}]),n}(),ve=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"vkLogin",value:function(){return this.http.createUrl("/account/external/login/vk")}},{key:"googleLogin",value:function(){return this.http.createUrl("/account/external/login/google")}},{key:"facebookLogin",value:function(){return this.http.createUrl("/account/external/login/facebook")}},{key:"loginCallback",value:function(){return this.http.get("/account/external/login/callback").then(()=>{})}},{key:"unbindVk",value:function(){return this.http.delete("/account/external/unbind/vk",null).then(()=>{})}},{key:"unbindGoogle",value:function(){return this.http.delete("/account/external/unbind/google",null).then(()=>{})}},{key:"unbindFacebook",value:function(){return this.http.delete("/account/external/unbind/facebook",null).then(()=>{})}},{key:"bindVk",value:function(){return this.http.createUrl("/account/external/bind/vk")}},{key:"bindGoogle",value:function(){return this.http.createUrl("/account/external/bind/google")}},{key:"bindFacebook",value:function(){return this.http.createUrl("/account/external/bind/facebook")}},{key:"bindCallback",value:function(){return this.http.get("/account/external/bind/callback").then(()=>{})}}]),n}(),ge=function(e){d(n,ve);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"login",value:function(e){switch(e){case"vk":return this.vkLogin();case"google":return this.googleLogin();case"facebook":return this.facebookLogin();default:return""}}},{key:"bind",value:function(e){switch(e){case"vk":return this.bindVk();case"google":return this.bindGoogle();case"facebook":return this.bindFacebook();default:return""}}},{key:"unbind",value:function(e){switch(e){case"vk":return this.unbindVk();case"google":return this.unbindGoogle();case"facebook":return this.unbindFacebook();default:return""}}}]),n}(),ke=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getConfiguration",value:function(e){return this.http.get("/settings",e).text()}},{key:"setConfiguration",value:function(e,t){return this.http.post("/settings",t,e).then(()=>{})}},{key:"getConfig",value:function(e){return this.http.get("/settings/config/"+e).json()}},{key:"removeConfig",value:function(e){return this.http.delete("/settings/config/"+e,null).then(()=>{})}},{key:"getConfigByPath",value:function(e){return this.http.get("/settings/config/getByPath",e).json()}},{key:"getConfig1",value:function(e){return this.http.get("/settings/config",e).json()}},{key:"createConfig",value:function(e){return this.http.post("/settings/config",e).json()}},{key:"updateConfig",value:function(e){return this.http.patch("/settings/config",e).then(()=>{})}},{key:"getValue",value:function(e){return this.http.get("/settings/variable/value/"+e).json()}},{key:"removeValue",value:function(e){return this.http.delete("/settings/variable/value/"+e,null).then(()=>{})}},{key:"getVariables",value:function(e){let{idVariable:t}=e,n=g(e,["idVariable"]);return this.http.get("/settings/variable/"+t+"/value",n).json()}},{key:"createValue",value:function(e){return this.http.post("/settings/variable/value",e).json()}},{key:"updateValue",value:function(e){return this.http.patch("/settings/variable/value",e).then(()=>{})}},{key:"getVariable",value:function(e){return this.http.get("/settings/variable/"+e).json()}},{key:"removeVariabe",value:function(e){return this.http.delete("/settings/variable/"+e,null).then(()=>{})}},{key:"getConfigVariableByName",value:function(e,t){return this.http.get("/settings/config/"+e+"/variable/"+t).json()}},{key:"getVariables1",value:function(e){return this.http.get("/settings/variable",e).json()}},{key:"createVariable",value:function(e){return this.http.post("/settings/variable",e).json()}},{key:"updateVariable",value:function(e){return this.http.patch("/settings/variable",e).then(()=>{})}}]),n}(),me=function(e){d(n,ke);var t=m(n);function n(){var e;return p(this,n),(e=t.apply(this,arguments)).settings={modules:[],connection:{url:""}},e}return y(n,[{key:"fetchClientSettings",value:async function(e){const t=JSON.parse(await this.getConfiguration(e));return this.updateClientSettings(t),t}},{key:"updateClientSettings",value:function(e){Object.assign(this.settings,e)}}]),n}();var be;(be=exports.ErrorReason||(exports.ErrorReason={})).HTTP_OTHER="other",be.HTTP_CLIENT="client",be.HTTP_SERVER="server",be.UNKNOWN="unknown";const Te=e=>e instanceof t.HTTPError?(e=>{const t=e.response.status;let n=exports.ErrorReason.HTTP_OTHER;return t>=400&&t<500&&(n=exports.ErrorReason.HTTP_CLIENT),t>=500&&(n=exports.ErrorReason.HTTP_SERVER),{type:"http",reason:n,status:t,origin:e}})(e):(e=>({type:"base",reason:exports.ErrorReason.UNKNOWN,origin:e}))(e),we=e=>e&&e.type&&e.reason;function xe(e){return function(t){return!!t.type&&e.includes(t.type)}}const je=xe(["PostgresLayerService","PostgresTileLayerService"]),Se=e=>window.location.protocol+"//"+e+"."+window.location.host,Pe=o.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",12);(exports.ResourceSeparator||(exports.ResourceSeparator={})).Server=".";let Re=function(){function e(t){let{account:n}=t;p(this,e),this.account=n}return y(e,[{key:"createId",value:function(){return Pe()}},{key:"createResourceName",value:function(e){void 0===e&&(e={});const t=e.workspace||this.account.user&&this.account.user.namespace||"",n=e.name||this.createId(),r=e.separator||exports.ResourceSeparator.Server;return t||console.warn("Resource should have workspace. Check account api"),""+t+r+n}},{key:"createTempResourceName",value:function(e){return void 0===e&&(e={}),this.createResourceName(f({workspace:"temp"},e))}},{key:"extractResource",value:function(e){if(e&&e.includes(exports.ResourceSeparator.Server)){const[t,n]=e.split(exports.ResourceSeparator.Server,2);return{workspace:t,name:n}}return{name:"",workspace:""}}},{key:"extractResourceName",value:function(e){return this.extractResource(e).name||e||""}},{key:"extractResourceWorkspace",value:function(e){return this.extractResource(e).workspace||""}}]),e}(),Ie=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"print",value:function(e){return this.http.post("/print/print",e).blob()}},{key:"printToHtml",value:function(e){return this.http.post("/print/printHtml",e).text()}},{key:"uploadTemplate",value:function(e,t){return this.http.post("/print/templates",R(t),e).then(()=>{})}},{key:"getTemplates",value:function(){return this.http.get("/print/templates").json()}},{key:"deleteTemplate",value:function(e){return this.http.delete("/print/templates/"+e,null).then(()=>{})}},{key:"getTemplate",value:function(e){return this.http.get("/print/templates/"+e).text()}}]),n}(),Ce=function(e){d(n,Ie);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}();var Ee,Le;(Ee=exports.ApiEvent||(exports.ApiEvent={})).ConnectionLost="ConnectionLost",Ee.Unauthorized="Unauthorized",Ee.SessionClosed="SessionClosed",(Le=exports.UrlPath||(exports.UrlPath={})).Base="/map",Le.Shared="/shared";const Ue={401:exports.ApiEvent.Unauthorized},Ne=Object.values(exports.UrlPath),Fe=Ne[0];let Ae=function(e){d(s,r.EventEmitter);var n=m(s);function s(e){var r;let{url:o,wsUrl:i,http:a,urlPath:u,httpOptions:l}=e;p(this,s),r=n.call(this);const{hooks:c}=l||{};return r.http=a||new j(f({prefixUrl:o,timeout:!1},l||{},{hooks:f({},c||{},{beforeRequest:[...c&&c.beforeRequest||[]],afterResponse:[e=>{const n=Ue[e.status];return n&&r.emit(n,Te(new t.HTTPError(e))),e},...c&&c.afterResponse||[]]})})),r.url=o,r.wsUrl=i||o,r.urlPath=u||r.defineUrlPath(),r.layers=new G(r.http),r.tables=new H(r.http),r.projects=new z(r.http),r.resources=new X(r.projects,r.layers,r.tables),r.styles=new Z(r.http),r.account=new ye(r.http),r.accountPreview=new de(r.http,r.account),r.security=new x(r.http,r.account),r.notification=new F(r.http),r.scheduler=new O(r.http),r.file=new C(r.http),r.import=new L(r.http),r.geocode=new ee(r.http),r.print=new Ce(r.http),r.tools=new se(r.http),r.resourceCatalog=new ne(r.http),r.general=new ie(r.http),r.namespace=new ue(r.http),r.external=new ge(r.http),r.clientSettings=new me(r.http),r.names=new Re({account:r.account}),r}return y(s,[{key:"init",value:async function(e){let{authParams:t,connectWs:n,initScheduler:r,fetchSettings:s,fetchUser:o}=e;try{await this.account.login(t),o&&await this.account.fetchCurrentUser(),n&&await this.connectWs(),r&&await this.initScheduler(),s&&await this.clientSettings.fetchClientSettings({urlPath:this.urlPath})}catch(e){throw Te(e)}}},{key:"isAcceptedNetwork",value:function(e){return["vk","google","facebook"].includes(e)}},{key:"socAuthLogin",value:async function(e){if(this.isAcceptedNetwork(e))try{await this.clientSettings.fetchClientSettings({urlPath:exports.UrlPath.Base})}catch(e){throw Te(e)}}},{key:"connectWs",value:async function(){this.account.isAuth&&(this.notification.connectWs(this.wsUrl),this.notification.on("ConnectionStatus",e=>{e.data===exports.ConnectionStatus.Lost?this.emit(exports.ApiEvent.ConnectionLost,e.data):e.data===exports.ConnectionStatus.SessionClosed&&this.emit(exports.ApiEvent.SessionClosed,e.data)}))}},{key:"logout",value:async function(){await this.account.logout(),await this.security.reset(),this.emit(exports.ApiEvent.Unauthorized,null)}},{key:"initScheduler",value:function(){return this.scheduler.init(this.notification)}},{key:"defineUrlPath",value:function(){const e=(window.location.href.split(window.location.hostname)[1]||"").split("/").filter(Boolean)[0],t=e?"/"+e:void 0;return t&&Ne.includes(t)?t:Fe}},{key:"isShared",get:function(){return this.urlPath===exports.UrlPath.Shared}}]),s}(),De=function(e){d(n,u.TileLayer);var t=m(n);function n(e,r){var s;return p(this,n),(s=t.call(this,"",{crs:e.crs})).api=r,s.name=e.name,s.subDomains=e.subDomains,s}return y(n,[{key:"getTileUrl",value:function(e,t,n){const r=this.subDomains,s=r&&r[(e+t+n)%r.length],o=this.api.layers.getTilesLayerImage({x:e,y:t,z:n,name:this.name});return s?""+Se(s)+o:o}}]),n}(),Oe=function(e){d(n,l.DynamicLayer);var t=m(n);function n(e,r){var s;return p(this,n),(s=t.call(this)).api=r,s.name=e.name,s.styleId=e.style,s.conditionQuery=e.condition,s.subscribeRedraw(),s}return y(n,[{key:"getUrl",value:function(e,t){let n=Math.round((e.xMax-e.xMin)/t),r=Math.round((e.yMax-e.yMin)/t);return this.api.layers.getLayerImage({name:this.name,extent:e.coordinates,size:[n,r],extentSr:e.crs.wkid,styleId:this.styleId,condition:this.conditionQuery})}},{key:"subscribeRedraw",value:function(){const e="service_update_"+this.name.replace(/\//g,"_");this.api.notification.subscribe(e).then(()=>{this.api.notification.on(e,()=>{this.forceUpdate(),this.redraw()})})}},{key:"style",set:function(e){this.styleId=e,this.forceUpdate()},get:function(){return this.styleId}},{key:"condition",set:function(e){this.conditionQuery=e,this.forceUpdate()},get:function(){return this.conditionQuery}}]),n}();const Be={RemoteTileService:De,LocalTileService:De,PostgresLayerService:Oe,StyledFeatureLayer:Oe,CompositeService:null};let Me=function(){function e(t,n){p(this,e),this.layers=t,this.http=n}return y(e,[{key:"getLayerService",value:async function(e){let t=await this.getLayerInfo(e);const n=t.type;if(!(e=>Boolean(e&&Object.keys(Be).includes(e)))(n))return;const r=Be[n];if(r)return new r((e=>f({},e,{name:"services/"+e.name}))(t),this.http);throw new Error('Constructor for service type: "'+t.type+'" not implemented')}},{key:"getLayerInfo",value:async function(e){try{return await this.layers.getLayerInfo(e)}catch(t){throw new Error('Service with name: "'+e+'" not exists')}}}]),e}();var qe;!function(e){e[e.BaseMaps=0]="BaseMaps",e[e.Layers=1]="Layers"}(qe||(qe={}));let _e=function(e){d(n,Ae);var t=m(n);function n(e,r,s){var o;return p(this,n),(o=t.call(this,r)).map=new a.Map,o.painter=new i.DomPainter(o.map),o.mapProps=e,o.auth=s,o.layersManager=new Me(o.layers,o.http),o}return y(n,[{key:"init",value:async function(){await b(v(n.prototype),"init",this).call(this,{authParams:this.auth,connectWs:!0,fetchSettings:!0,initScheduler:!0});const{baseService:e,services:t,projectName:r}=this.mapProps;e&&await this.setBaseMap(e),t&&await Promise.all(t.map(e=>this.addLayer(e))),r&&await this.loadProject(r),this.setMapProps()}},{key:"reset",value:async function(){await this.account.logout(),this.painter.wrapper=null}},{key:"addLayer",value:async function(e){await this.insertLayer(e,qe.Layers)}},{key:"setBaseMap",value:async function(e){await this.insertLayer(e,qe.BaseMaps)}},{key:"loadProject",value:async function(e){const t=await this.projects.getProjectInfo(e);if(!t||!t.content)return;const{baseMapName:n,items:r}=t.content;if(n&&await this.setBaseMap(n),r){const e=r.map(e=>e.name).filter(Ge);await Promise.all(e.map(e=>this.addLayer(e)))}}},{key:"insertLayer",value:async function(e,t){const n=await this.layersManager.getLayerService(e);n&&this.map.insertLayer(n.layer,t)}},{key:"setMapProps",value:function(){const{position:e,centerPoint:t,mapWrapper:n,resolution:r}=this.mapProps;e?this.map.position=e:t&&(this.map.centerPoint=t),r&&(this.map.resolution=r),n&&(this.painter.wrapper=n)}}]),n}();const Ge=e=>void 0!==e;var Ve,He,We,ze,Je,Ke,Qe,Xe,Ye,Ze,$e,et,tt,nt,rt,st,ot,it,at,ut,lt,ct,pt,ht,yt,ft,dt;(Ve=exports.AggregationFunction||(exports.AggregationFunction={})).None="None",Ve.Array="Array",Ve.Min="Min",Ve.Max="Max",Ve.Avg="Avg",Ve.Sum="Sum",Ve.Extent="Extent",Ve.Count="Count",Ve.OnlyValue="OnlyValue",(He=exports.ArgumentType||(exports.ArgumentType={})).String="string",He.Int32="int32",He.Int64="int64",He.Double="double",He.Float="float",He.Boolean="boolean",He.DateTime="datetime",He.Enum="enum",He.DataSource="dataSource",He.Polygon="polygon",He.Polyline="polyline",He.Point="point",He.Envelope="envelope",He.Attribute="attribute",He.Array="array",He.ServiceInfo="serviceInfo",(We=exports.AttributeType||(exports.AttributeType={})).Unknown="Unknown",We.String="String",We.Int32="Int32",We.Int64="Int64",We.Double="Double",We.DateTime="DateTime",We.Boolean="Boolean",We.Point="Point",We.Polyline="Polyline",We.Polygon="Polygon",We.Multipoint="Multipoint",(ze=exports.ClassificationType||(exports.ClassificationType={})).NaturalBreaks="naturalBreaks",ze.EqualInterval="equalInterval",ze.Quantile="quantile",(Je=exports.CombineType||(exports.CombineType={})).Array="Array",Je.Value="Value",(Ke=exports.ConfigurationErrorEnum||(exports.ConfigurationErrorEnum={})).Unknown="Unknown",Ke.SerializeError="SerializeError",Ke.InvalidDataService="InvalidDataService",Ke.InvalidConfiguration="InvalidConfiguration",Ke.InvalidDataServiceName="InvalidDataServiceName",Ke.InvalidTableName="InvalidTableName",Ke.ResourceNotFound="ResourceNotFound",Ke.InvalidCondition="InvalidCondition",Ke.InvalidAttributes="InvalidAttributes",Ke.InvalidIdAttribute="InvalidIdAttribute",Ke.InvalidGeometryAttribute="InvalidGeometryAttribute",Ke.InvalidGeometryAttributeType="InvalidGeometryAttributeType",Ke.InvalidColumnName="InvalidColumnName",Ke.InvalidIdColumnSettings="InvalidIdColumnSettings",Ke.ColumnNotExistsInTable="ColumnNotExistsInTable",Ke.InvalidStyle="InvalidStyle",Ke.InvalidLayerType="InvalidLayerType",Ke.ColumnLoadingError="ColumnLoadingError",Ke.InvalidAttributeFormat="InvalidAttributeFormat",(Qe=exports.ElementType||(exports.ElementType={})).None="none",Qe.Checkbox="checkbox",Qe.Select="select",(Xe=exports.ErrorDetailsType||(exports.ErrorDetailsType={})).ResourceLimitExceeded="ResourceLimitExceeded",Xe.ResourceNotFound="ResourceNotFound",Xe.InternalError="InternalError",Xe.BadRequest="BadRequest",Xe.DuplicateContent="DuplicateContent",(Ye=exports.ErrorType||(exports.ErrorType={})).NotSpecified="NotSpecified",Ye.LimitError="LimitError",Ye.ValidationError="ValidationError",Ye.JwtExpired="JwtExpired",Ye.TokenInvalid="TokenInvalid",Ye.RefreshTokenExpired="RefreshTokenExpired",Ye.RefreshTokenInvalid="RefreshTokenInvalid",Ye.CreateUserFailed="CreateUserFailed",Ye.SetUserPasswordFailed="SetUserPasswordFailed",Ye.SetUserRoleFailed="SetUserRoleFailed",Ye.UpdateUserFailed="UpdateUserFailed",Ye.RemoveUserFailed="RemoveUserFailed",Ye.CreateRoleFailed="CreateRoleFailed",Ye.UpdateRoleFailed="UpdateRoleFailed",Ye.RemoveUserRoleFailed="RemoveUserRoleFailed",Ye.ChangeActiveStateFailed="ChangeActiveStateFailed",Ye.RemoveRoleFailed="RemoveRoleFailed",Ye.UserNotFound="UserNotFound",Ye.RoleNotFound="RoleNotFound",Ye.EmailNotConfirmed="EmailNotConfirmed",Ye.DuplicateEmailError="DuplicateEmailError",Ye.InvalidPassword="InvalidPassword",Ye.RoleExists="RoleExists",Ye.UserExists="UserExists",Ye.UserLockedError="UserLockedError",Ye.InvalidEmail="InvalidEmail",Ye.InvalidUsername="InvalidUsername",Ye.Unauthorized="Unauthorized",Ye.EmailNotChanged="EmailNotChanged",Ye.EmailNotSet="EmailNotSet",(Ze=exports.FeatureType||(exports.FeatureType={})).Unknown="Unknown",Ze.GeometricFeature="GeometricFeature",($e=exports.FontStyle||(exports.FontStyle={})).Normal="normal",$e.Oblique="oblique",$e.Italic="italic",(et=exports.FontWeight||(exports.FontWeight={})).Thin="Thin",et.ExtraLight="ExtraLight",et.UltraLight="UltraLight",et.Light="Light",et.SemiLight="SemiLight",et.Normal="Normal",et.Regular="Regular",et.Medium="Medium",et.DemiBold="DemiBold",et.SemiBold="SemiBold",et.Bold="Bold",et.ExtraBold="ExtraBold",et.UltraBold="UltraBold",et.Black="Black",et.Heavy="Heavy",et.ExtraBlack="ExtraBlack",et.UltraBlack="UltraBlack",(tt=exports.GeometryType||(exports.GeometryType={})).Unknown="unknown",tt.Point="point",tt.Polyline="polyline",tt.Polygon="polygon",tt.Envelope="envelope",tt.Multipoint="multipoint",(nt=exports.HttpStatusCode||(exports.HttpStatusCode={})).Continue="Continue",nt.SwitchingProtocols="SwitchingProtocols",nt.Processing="Processing",nt.EarlyHints="EarlyHints",nt.OK="OK",nt.Created="Created",nt.Accepted="Accepted",nt.NonAuthoritativeInformation="NonAuthoritativeInformation",nt.NoContent="NoContent",nt.ResetContent="ResetContent",nt.PartialContent="PartialContent",nt.MultiStatus="MultiStatus",nt.AlreadyReported="AlreadyReported",nt.IMUsed="IMUsed",nt.MultipleChoices="Ambiguous",nt.Ambiguous="Moved",nt.MovedPermanently="Redirect",nt.Moved="RedirectMethod",nt.Found="NotModified",nt.Redirect="UseProxy",nt.SeeOther="Unused",nt.RedirectMethod="TemporaryRedirect",nt.NotModified="PermanentRedirect",nt.UseProxy="BadRequest",nt.Unused="Unauthorized",nt.TemporaryRedirect="PaymentRequired",nt.RedirectKeepVerb="Forbidden",nt.PermanentRedirect="NotFound",nt.BadRequest="MethodNotAllowed",nt.Unauthorized="NotAcceptable",nt.PaymentRequired="ProxyAuthenticationRequired",nt.Forbidden="RequestTimeout",nt.NotFound="Conflict",nt.MethodNotAllowed="Gone",nt.NotAcceptable="LengthRequired",nt.ProxyAuthenticationRequired="PreconditionFailed",nt.RequestTimeout="RequestEntityTooLarge",nt.Conflict="RequestUriTooLong",nt.Gone="UnsupportedMediaType",nt.LengthRequired="RequestedRangeNotSatisfiable",nt.PreconditionFailed="ExpectationFailed",nt.RequestEntityTooLarge="MisdirectedRequest",nt.RequestUriTooLong="UnprocessableEntity",nt.UnsupportedMediaType="Locked",nt.RequestedRangeNotSatisfiable="FailedDependency",nt.ExpectationFailed="UpgradeRequired",nt.MisdirectedRequest="PreconditionRequired",nt.UnprocessableEntity="TooManyRequests",nt.Locked="RequestHeaderFieldsTooLarge",nt.FailedDependency="UnavailableForLegalReasons",nt.UpgradeRequired="InternalServerError",nt.PreconditionRequired="NotImplemented",nt.TooManyRequests="BadGateway",nt.RequestHeaderFieldsTooLarge="ServiceUnavailable",nt.UnavailableForLegalReasons="GatewayTimeout",nt.InternalServerError="HttpVersionNotSupported",nt.NotImplemented="VariantAlsoNegotiates",nt.BadGateway="InsufficientStorage",nt.ServiceUnavailable="LoopDetected",nt.GatewayTimeout="NotExtended",nt.HttpVersionNotSupported="NetworkAuthenticationRequired",nt.VariantAlsoNegotiates="VariantAlsoNegotiates",nt.InsufficientStorage="InsufficientStorage",nt.LoopDetected="LoopDetected",nt.NotExtended="NotExtended",nt.NetworkAuthenticationRequired="NetworkAuthenticationRequired",(rt=exports.LineEndingSize||(exports.LineEndingSize={})).Small="small",rt.Large="large",(st=exports.LineEndingType||(exports.LineEndingType={})).None="none",st.Arrow="arrow",st.FilledArrow="filledArrow",st.Square="square",st.FilledSquare="filledSquare",st.Circle="circle",st.FilledCircle="filledCircle",(ot=exports.Operation||(exports.Operation={})).Unknown="Unknown",ot.Union="union",ot.Intersection="intersection",ot.Subtraction="subtraction",ot.SymDifference="symDifference",(it=exports.Permissions||(exports.Permissions={})).None="none",it.Configure="configure",it.Write="write",it.Read="read",it.ReadWrite="read,write",it.All="read,write,configure",(at=exports.PolicyType||(exports.PolicyType={})).Unknown="Unknown",at.CreateTable="CreateTable",at.CreateLayer="CreateLayer",at.CreateProject="CreateProject",at.MaxFeaturesInOneTable="MaxFeaturesInOneTable",(ut=exports.ResourceType||(exports.ResourceType={})).Unknown="Unknown",ut.Table="table",ut.Layer="layer",ut.Project="project",ut.File="file",ut.Feature="feature",(lt=exports.ResourceTypeLink||(exports.ResourceTypeLink={})).Table="tables",lt.Layer="layers",lt.Project="projects",(ct=exports.ServerTaskStatus||(exports.ServerTaskStatus={})).None="None",ct.Scheduled="Scheduled",ct.Planning="Planning",ct.Executing="Executing",ct.Completed="Completed",ct.Failed="Failed",ct.Canceled="Canceled",ct.Timeout="Timeout",(pt=exports.StringSubType||(exports.StringSubType={})).None="None",pt.Image="Image",pt.PkkCode="PkkCode",(ht=exports.TextAlignment||(exports.TextAlignment={})).Right="right",ht.Left="left",ht.Center="center",ht.Justified="justified",(yt=exports.TextVerticalAlignment||(exports.TextVerticalAlignment={})).Top="top",yt.Bottom="bottom",yt.Middle="middle",(ft=exports.ToolStatus||(exports.ToolStatus={})).Pending="Pending",ft.Running="Running",ft.Delivered="Delivered",ft.Failed="Failed",ft.Completed="Completed",ft.Canceled="Canceled",(dt=exports.ToolStorageType||(exports.ToolStorageType={})).StaticStorage="staticStorage",dt.LayersStorage="layersStorage",Object.defineProperty(exports,"HTTPError",{enumerable:!0,get:function(){return t.HTTPError}}),Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:function(){return t.TimeoutError}}),exports.API_USER_INFO_KEY=he,exports.Account=ye,exports.AccountPreview=de,exports.Api=Ae,exports.ClientSettings=me,exports.EvergisDynamicLayer=Oe,exports.EvergisTileLayer=De,exports.External=ge,exports.FileUpload=C,exports.GEOCODE_PROVIDER="geocode2gis",exports.General=ie,exports.Geocode=ee,exports.HttpClient=j,exports.Import=L,exports.Layers=G,exports.LayersManager=Me,exports.Names=Re,exports.Namespace=ue,exports.Notification=F,exports.NotificationEvent=A,exports.Projects=z,exports.ResourceCatalog=ne,exports.Resources=X,exports.Scheduler=O,exports.Security=x,exports.SpatialProcessor=_e,exports.Styles=Z,exports.Tables=H,exports.Tools=se,exports.addSubDomainToLocation=Se,exports.errorHandler=Te,exports.formDataFromFile=function(e){const t=new FormData;return t.append("file",e),t},exports.generateId=Pe,exports.isEvergisDynamicLayer=function(e){return e instanceof Oe},exports.isEvergisTileLayer=function(e){return e instanceof De},exports.isFeatureLayer=function(e){return e instanceof c.FeatureLayer},exports.isHTTPError=e=>we(e)&&"http"===e.type,exports.isHandledError=we,exports.isLayer=je,exports.isProjectContentItems=function(e){return null!=e},exports.isString=K,exports.isTileLayerService=function(e){return e.type&&/TileService/.test(e.type)},exports.promiseAllIgnoreErrors=M,exports.stripUselessSlashes=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.join("/").split("/").filter(Boolean).join("/")},exports.toFormData=R,exports.unique=J;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("ky"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@evergis/event-emitter"),s=require("query-string"),o=require("nanoid"),i=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),a=require("@evergis/sgis/es/Map"),u=require("@evergis/sgis/es/layers/TileLayer"),l=require("@evergis/sgis/es/layers/DynamicLayer"),c=require("@evergis/sgis");function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){if(null==e)return{};var n,r,s={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(s[n]=e[n]);return s}function k(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=v(e);if(t){var s=v(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return k(this,n)}}function b(e,t,n){return(b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(n):s.value}})(e,t,n||e)}let T=function e(t){p(this,e),this.http=t},w=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"batchResourcesPermissionsSet",value:function(e){return this.http.put("/bulk/resources/permissions",e).then(()=>{})}}]),n}(),x=function(e){d(n,w);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"updatePermissions",value:function(e){return this.batchResourcesPermissionsSet(e)}}]),n}(),j=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"findUserByName",value:function(e){return this.http.get("/security/users",e).json()}},{key:"getPolicyList",value:function(e){return this.http.get("/security/policies",e).json()}},{key:"removePolicy",value:function(e){return this.http.delete("/security/policies",null,e).then(()=>{})}},{key:"setPolicy",value:function(e){return this.http.post("/security/policies",e).then(()=>{})}}]),n}(),S=function(e){d(n,j);var t=m(n);function n(e,r){var s;let{username:o,roles:i}=r;return p(this,n),(s=t.call(this,e)).ownerName="",s.ownerRoles=[],s.ownerName=o,s.ownerRoles=i,s}return y(n,[{key:"reset",value:function(){this.ownerName="",this.ownerRoles=[]}}]),n}(),P=function(){function e(t){var r;void 0===t&&(t={}),p(this,e),this.ky=n.extend(t),this.prefixUrl=(null==(r=t.prefixUrl)?void 0:r.toString())||""}return y(e,[{key:"extend",value:function(e){var t;this.ky=n.extend(e),this.prefixUrl=(null==(t=e.prefixUrl)?void 0:t.toString())||""}},{key:"get",value:function(e,t){return this.ky.get(this.stripSlashes(e),{searchParams:I(t)})}},{key:"post",value:function(e,t,n){const r=R(n,t);return this.ky.post(this.stripSlashes(e),r)}},{key:"put",value:function(e,t,n){const r=R(n,t);return this.ky.put(this.stripSlashes(e),r)}},{key:"patch",value:function(e,t,n){const r=R(n,t);return this.ky.patch(this.stripSlashes(e),r)}},{key:"delete",value:function(e,t,n){const r=R(n,t);return this.ky.delete(this.stripSlashes(e),r)}},{key:"createUrl",value:function(e,t){const n=t?"?"+I(t):"";return this.prefixUrl+this.stripSlashes(e)+n}},{key:"stripSlashes",value:function(e){return this.prefixUrl?e.replace(/^\//g,""):e}}]),e}();function R(e,t){const n={searchParams:I(e)};var r;return void 0!==(r=t)&&"object"==typeof r&&null!==r&&r.constructor===Object||Array.isArray(t)?n.json=t:n.body=t,n}function I(e){return void 0===e&&(e={}),s.stringify(e,{arrayFormat:"comma"})}function C(e){return Object.keys(e).reduce((t,n)=>(t.append(n,e[n]),t),new FormData)}let E=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"downloadFile",value:function(e){return this.http.get("/upload/file",e).blob()}},{key:"uploadFile",value:function(e){return this.http.post("/upload/file",C(e)).json()}}]),n}(),L=function(e){d(n,E);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"upload",value:function(e,t){return this.uploadFile({file:e,rewrite:!!t})}}]),n}(),U=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getDataSchema",value:function(e){return this.http.get("/import/dataSchema",e).json()}},{key:"getExcelDataSchema",value:function(e){return this.http.get("/import/excelDataSchema",e).json()}},{key:"getCsvDataSchema",value:function(e){return this.http.get("/import/csvDataSchema",e).json()}},{key:"getRasterAttributes",value:function(e){return this.http.get("/import/rasterAttributes",e).json()}}]),n}(),N=function(e){d(n,U);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),F=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getSubscriptionList",value:function(){return this.http.get("/notifications/subscribes").json()}},{key:"subscribeOperation",value:function(e){return this.http.post("/notifications/subscribes",null,e).then(()=>{})}},{key:"unsubscribeOperation",value:function(e){return this.http.delete("/notifications/subscribes",null,e).then(()=>{})}},{key:"subscribeListOperation",value:function(e){return this.http.post("/notifications/subscribe-list",e).then(()=>{})}},{key:"unsubscribeListOperation",value:function(e){return this.http.post("/notifications/unsubscribe-list",e).then(()=>{})}}]),n}();var A;(A=exports.ConnectionStatus||(exports.ConnectionStatus={})).Initialized="Initialized",A.Connected="Connected",A.Break="Break",A.Lost="Lost",A.SessionClosed="SessionClosed";let D=function(e){d(n,F);var t=m(n);function n(e){var s;return p(this,n),(s=t.call(this,e)).MAX_WS_RECONNECT_TRIES=10,s.reconnectTries=0,s.subscriptions=[],s._connectStatus=exports.ConnectionStatus.Initialized,s.onWsConnected=()=>{s.connectStatus=exports.ConnectionStatus.Connected},s.onWsClosed=e=>{4001===e.code||4002===e.code?s.connectStatus=exports.ConnectionStatus.SessionClosed:s.reconnectTries<s.MAX_WS_RECONNECT_TRIES?(s.connectStatus=exports.ConnectionStatus.Break,s.reconnectTries++,s.ws&&(s.ws.onopen=null,s.ws.onclose=null,s.ws.onmessage=null,s.ws=void 0),setTimeout(()=>{s.connect()},0)):s.connectStatus=exports.ConnectionStatus.Lost},s.onWsMessage=e=>{let t={};try{t=JSON.parse(e.data)}catch(e){console.debug("Failed to parse ws message from sp.")}if("notification"===t.type&&t.data){const{tag:e,data:n}=t.data;e&&s.emitter.emit(e,new B(n))}},s.emitter=new r.EventEmitter,s}return y(n,[{key:"on",value:function(e,t){this.emitter.on(e,t)}},{key:"off",value:function(e,t){this.emitter.off(e,t)}},{key:"subscribe",value:async function(e){this.subscriptions.push(e),setTimeout(()=>{this.subscriptions.length&&this.subscribeListOperation(this.subscriptions),this.subscriptions=[]},500)}},{key:"unsubscribe",value:async function(e){if((await this.getSubscriptionList()).includes(e))return this.unsubscribeOperation({tag:e})}},{key:"connectWs",value:function(e){const t=e.replace("http://","ws://").replace("https://","wss://");this.wsUrl=t,this.connect()}},{key:"connect",value:function(){this.wsUrl?(this.ws=new WebSocket(this.wsUrl),this.ws.onopen=this.onWsConnected,this.ws.onclose=this.onWsClosed,this.ws.onmessage=this.onWsMessage):console.warn("Connection to WebSocket not allowed. wsUrl not provided")}},{key:"connectStatus",get:function(){return this._connectStatus},set:function(e){this.emitter.emit("ConnectionStatus",new B(e)),this._connectStatus=e}}]),n}(),B=function e(t){p(this,e),this.data=t},O=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTaskList",value:function(e){return this.http.get("/scheduler/tasks",e).json()}},{key:"getTaskInfo",value:function(e){return this.http.get("/scheduler/tasks/"+e).json()}},{key:"getTaskProgress",value:function(e){return this.http.get("/scheduler/tasks/"+e+"/progress").json()}},{key:"cancelTask",value:function(e){return this.http.post("/scheduler/tasks/"+e+"/cancel",null).json()}},{key:"startCopyTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"copy"}).json()}},{key:"startAggregateTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"aggregate"}).json()}},{key:"startBufferTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"buffer"}).json()}},{key:"startPrintTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"print"}).json()}},{key:"startTilingTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"tiling"}).json()}},{key:"startRouteTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"route"}).json()}},{key:"startUnionTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"union"}).json()}},{key:"startOverlayTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"overlay"}).json()}},{key:"startFilterCopyTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"filterCopy"}).json()}},{key:"startPipelineTask",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"pipeline"}).json()}},{key:"startEditAttributesBatch",value:function(e){return this.http.post("/scheduler/tasks",e,{type:"editAttributes"}).json()}}]),n}(),M=function(e){d(n,O);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"init",value:function(e){return this.notification=e,this.notification.subscribe("server_task")}},{key:"runCopyTask",value:async function(e){const{taskId:t}=await this.startCopyTask(e);return this.processTaskId(t)}},{key:"runBufferTask",value:async function(e){const{taskId:t}=await this.startBufferTask(e);return this.processTaskId(t)}},{key:"runUnionTask",value:async function(e){const{taskId:t}=await this.startUnionTask(e);return this.processTaskId(t)}},{key:"runPrintTask",value:async function(e){const{taskId:t}=await this.startPrintTask(e);return this.processTaskId(t)}},{key:"runTilingTask",value:async function(e){const{taskId:t}=await this.startTilingTask(e);return this.processTaskId(t)}},{key:"runRouteTask",value:async function(e){const{taskId:t}=await this.startRouteTask(e);return this.processTaskId(t)}},{key:"runOverlayTask",value:async function(e){const{taskId:t}=await this.startOverlayTask(e);return this.processTaskId(t)}},{key:"runFilterCopyTask",value:async function(e){const{taskId:t}=await this.startFilterCopyTask(e);return this.processTaskId(t)}},{key:"runPipelineTask",value:async function(e){const{taskId:t}=await this.startPipelineTask(e);return this.processTaskId(t)}},{key:"runEditAttributesTask",value:async function(e){const{taskId:t}=await this.startEditAttributesBatch(e);return this.processTaskId(t)}},{key:"waitTaskCompleted",value:async function(e){return new Promise(async(t,n)=>{const r=await this.getTaskProgress(e);this.resolveTaskStatus(r,t,n);const s=async r=>{let{data:o}=r;if(o.taskId===e&&o.status&&["Completed","Failed","Canceled"].includes(o.status)){const r=await this.getTaskProgress(e);this.notification&&this.notification.off("server_task",s),this.resolveTaskStatus(r,t,n)}};this.notification&&this.notification.on("server_task",s)})}},{key:"resolveTaskStatus",value:function(e,t,n){"Completed"===e.status?t(e):"Failed"!==e.status&&"Canceled"!==e.status||n(e.status)}},{key:"processTaskId",value:function(e){if(e)return this.waitTaskCompleted(e);throw new Error("Task was started with no testId")}}]),n}(),q=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getLayersList",value:function(e){return this.http.get("/layers",e).json()}},{key:"setPermissionsBatch",value:function(e){return this.http.put("/layers",e).then(()=>{})}},{key:"getLayerInfo",value:function(e){return this.http.get("/layers/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/layers/"+e,null).then(()=>{})}},{key:"publishProxyService",value:function(e){return this.http.post("/layers",e,{type:"ProxyService"}).json()}},{key:"publishRemoteTileService",value:function(e){return this.http.post("/layers",e,{type:"RemoteTileService"}).json()}},{key:"publishLocalTileService",value:function(e){return this.http.post("/layers",e,{type:"LocalTileService"}).json()}},{key:"publishPostgresLayerService",value:function(e){return this.http.post("/layers",e,{type:"PostgresLayerService"}).json()}},{key:"publishPostgresTileCatalogService",value:function(e){return this.http.post("/layers",e,{type:"PostgresTileLayerService"}).json()}},{key:"updateProxyService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"ProxyService"}).json()}},{key:"updateTileCatalogService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"PostgresTileLayerService"}).json()}},{key:"publishStyledLayerService",value:function(e){return this.http.post("/layers",e,{type:"StyledFeatureLayer"}).json()}},{key:"publishCompositeService",value:function(e){return this.http.post("/layers",e,{type:"CompositeService"}).json()}},{key:"updateRemoteTileService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"RemoteTileService"}).json()}},{key:"updateLocalTileService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"LocalTileService"}).json()}},{key:"updatePostgresLayerService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"PostgresLayerService"}).json()}},{key:"updateCompositeService",value:function(e,t){return this.http.patch("/layers/"+e,t,{type:"CompositeService"}).json()}},{key:"reloadService",value:function(e){return this.http.get("/layers/"+e+"/reload").json()}},{key:"getFeatures",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features",n).json()}},{key:"deleteFeature",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.delete("/layers/"+t+"/features",null,n).json()}},{key:"createFeatures",value:function(e,t){return this.http.post("/layers/"+e+"/features",t).json()}},{key:"updateFeature",value:function(e,t){return this.http.patch("/layers/"+e+"/features",t).json()}},{key:"getById",value:function(e){let{name:t,id:n}=e,r=g(e,["name","id"]);return this.http.get("/layers/"+t+"/features/"+n,r).json()}},{key:"unite",value:function(e,t){let{name:n,id:r}=e,s=g(e,["name","id"]);return this.http.post("/layers/"+n+"/features/"+r+"/unite",t,s).json()}},{key:"subtract",value:function(e,t){let{name:n,id:r}=e,s=g(e,["name","id"]);return this.http.post("/layers/"+n+"/features/"+r+"/subtract",t,s).json()}},{key:"getTilesLayerImage",value:function(e){let{name:t,x:n,y:r,z:s}=e,o=g(e,["name","x","y","z"]);return this.http.createUrl("/layers/"+t+"/tile/"+s+"/"+n+"/"+r,o)}},{key:"getLayerImage",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.createUrl("/layers/"+t+"/export",n)}},{key:"getLayerExtent",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/extent",n).json()}},{key:"getByGeometry",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features/getByGeometry",n).json()}},{key:"getByGeometryPost",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.post("/layers/"+n+"/features/getByGeometry",t,r).json()}},{key:"deleteFeatures",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.delete("/layers/"+t+"/features/deleteByIds",null,n).json()}},{key:"getByGeometryGet",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features/getByGeometryByClick",n).json()}},{key:"classify",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/classify",n).json()}},{key:"distincts",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/distincts",n).json()}},{key:"aggregateAttribute",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/aggregate-values",n).json()}},{key:"getFilteredFeaturesCount",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/layers/"+t+"/features/count",n).json()}},{key:"editAttributes",value:function(e,t){return this.http.post("/layers/"+e+"/features/edit-attributes",t).json()}},{key:"selectFeatures",value:function(e){return this.http.get("/layers/features/select",e).json()}},{key:"validateExpression",value:function(e){let{layerName:t}=e,n=g(e,["layerName"]);return this.http.get("/layers/"+t+"/validateExpression",n).json()}},{key:"getPreview",value:function(e){return this.http.createUrl("/layers/"+e+"/preview")}},{key:"setPreview",value:function(e,t){return this.http.post("/layers/"+e+"/preview",C(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/layers/"+e+"/preview",null).then(()=>{})}},{key:"getResourceDependencies",value:function(e){return this.http.get("/layers/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/layers/"+e+"/references").json()}},{key:"getPermissions",value:function(e){return this.http.get("/layers/"+e+"/permissions").json()}},{key:"addPermissions",value:function(e,t){return this.http.post("/layers/"+e+"/permissions",t).json()}},{key:"setPermissions",value:function(e,t){return this.http.put("/layers/"+e+"/permissions",t).json()}},{key:"removePermissions",value:function(e,t){return this.http.delete("/layers/"+e+"/permissions/"+t,null).json()}}]),n}();async function _(e){return(await Promise.all(e.map(e=>e.catch(e=>G(e)?e:new Error(e))))).filter(V)}function G(e){return e instanceof Error}function V(e){return!G(e)}let H=function(e){d(n,q);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getLayerInfos",value:function(e){return _(e.map(e=>this.getLayerInfo(e)))}},{key:"getLayersDeps",value:function(e){return _(e.map(e=>this.getResourceDependencies(e)))}},{key:"getBasemaps",value:function(e){return this.getLayersList(f({},e,{types:["LocalTileService","RemoteTileService"]}))}},{key:"createSubLayer",value:function(e){return this.publishStyledLayerService(e)}},{key:"createTileLayer",value:function(e){let{remote:t}=e,n=g(e,["remote"]);return t?this.publishRemoteTileService(n):this.publishLocalTileService(n)}},{key:"uploadPreview",value:function(e,t){return this.setPreview(e,{file:t})}},{key:"findOne",value:function(e){return this.getLayerInfo(e)}},{key:"findAll",value:function(e){return this.getLayersList(e)}},{key:"create",value:function(e){return this.publishPostgresLayerService(e)}},{key:"update",value:function(e){return this.updatePostgresLayerService(e.name,e)}},{key:"remove",value:async function(e){return await this.deleteResource(e),e}}]),n}(),W=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTableList",value:function(e){return this.http.get("/tables",e).json()}},{key:"createTable",value:function(e){return this.http.post("/tables",e).json()}},{key:"setPermissionsBatch",value:function(e){return this.http.put("/tables",e).then(()=>{})}},{key:"deleteResource",value:function(e){return this.http.delete("/tables/"+e,null).then(()=>{})}},{key:"updateTable",value:function(e,t){return this.http.patch("/tables/"+e,t).json()}},{key:"getTableInfo",value:function(e){return this.http.get("/tables/"+e).json()}},{key:"updateTableData",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.patch("/tables/"+n+"/data",t,r).then(()=>{})}},{key:"deleteTableData",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.delete("/tables/"+t+"/data",null,n).then(()=>{})}},{key:"getUniqueDataRows",value:function(e){let{name:t}=e,n=g(e,["name"]);return this.http.get("/tables/"+t+"/data/unique-values",n).json()}},{key:"mapTable",value:function(e,t){return this.http.post("/tables/map-table",t,f({type:"Table"},e)).json()}},{key:"mapView",value:function(e,t){return this.http.post("/tables/map-table",t,f({type:"MaterializedView"},e)).json()}},{key:"mapRemoteTable",value:function(e,t){return this.http.post("/tables/map-table",t,f({type:"RemoteTable"},e)).json()}},{key:"unmapTable",value:function(e){return this.http.delete("/tables/map-table/"+e,null).then(()=>{})}},{key:"getPreview",value:function(e){return this.http.createUrl("/tables/"+e+"/preview")}},{key:"setPreview",value:function(e,t){return this.http.post("/tables/"+e+"/preview",C(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/tables/"+e+"/preview",null).then(()=>{})}},{key:"getResourceDependencies",value:function(e){return this.http.get("/tables/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/tables/"+e+"/references").json()}},{key:"getPermissions",value:function(e){return this.http.get("/tables/"+e+"/permissions").json()}},{key:"addPermissions",value:function(e,t){return this.http.post("/tables/"+e+"/permissions",t).json()}},{key:"setPermissions",value:function(e,t){return this.http.put("/tables/"+e+"/permissions",t).json()}},{key:"removePermissions",value:function(e,t){return this.http.delete("/tables/"+e+"/permissions/"+t,null).json()}}]),n}(),z=function(e){d(n,W);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTableInfos",value:function(e){return _(e.map(e=>this.getTableInfo(e)))}},{key:"uploadPreview",value:function(e,t){return this.setPreview(e,{file:t})}},{key:"findOne",value:function(e){return this.getTableInfo(e)}},{key:"findAll",value:function(e){return this.getTableList(e)}},{key:"create",value:function(e){return this.createTable(e)}},{key:"update",value:function(e){return this.updateTable(e.name,e)}},{key:"remove",value:async function(e){return await this.deleteResource(e),e}}]),n}(),J=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getProjectLayersExtendedInfo",value:function(e){return this.http.get("/projects/"+e+"/extended-info").json()}},{key:"getProjectsList",value:function(e){return this.http.get("/projects",e).json()}},{key:"createProject",value:function(e){return this.http.post("/projects",e).json()}},{key:"setPermissionsBatch",value:function(e){return this.http.put("/projects",e).then(()=>{})}},{key:"createShareProject",value:function(e,t){return this.http.post("/projects/"+e+"/share",t).json()}},{key:"removeShareProject",value:function(e){return this.http.delete("/projects/"+e+"/share",null).then(()=>{})}},{key:"updateProject",value:function(e,t){return this.http.patch("/projects/"+e,t).json()}},{key:"getProjectInfo",value:function(e){return this.http.get("/projects/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/projects/"+e,null).then(()=>{})}},{key:"getPreview",value:function(e){return this.http.createUrl("/projects/"+e+"/preview")}},{key:"setPreview",value:function(e,t){return this.http.post("/projects/"+e+"/preview",C(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/projects/"+e+"/preview",null).then(()=>{})}},{key:"getResourceDependencies",value:function(e){return this.http.get("/projects/"+e+"/dependencies").json()}},{key:"getResourceReferences",value:function(e){return this.http.get("/projects/"+e+"/references").json()}},{key:"getPermissions",value:function(e){return this.http.get("/projects/"+e+"/permissions").json()}},{key:"addPermissions",value:function(e,t){return this.http.post("/projects/"+e+"/permissions",t).json()}},{key:"setPermissions",value:function(e,t){return this.http.put("/projects/"+e+"/permissions",t).json()}},{key:"removePermissions",value:function(e,t){return this.http.delete("/projects/"+e+"/permissions/"+t,null).json()}}]),n}(),K=function(e){d(n,J);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getProjectInfos",value:function(e){return _(e.map(e=>this.getProjectInfo(e)))}},{key:"getProjectsDeps",value:function(e){return _(e.map(e=>this.getResourceDependencies(e)))}},{key:"uploadPreview",value:function(e,t){return this.setPreview(e,{file:t})}},{key:"findOne",value:function(e){return this.getProjectInfo(e)}},{key:"findAll",value:function(e){return this.getProjectsList(e)}},{key:"create",value:function(e){return this.createProject(e)}},{key:"update",value:function(e){return this.updateProject(e.name,e)}},{key:"remove",value:async function(e){return await this.deleteResource(e),e}}]),n}();function Q(e,t,n){return n.indexOf(e)===t}function X(e){return"string"==typeof e}var Y;(Y=exports.DependencyType||(exports.DependencyType={})).Layer="Layer",Y.Table="Table";let Z=function(){function e(t,n,r){p(this,e),this.projects=t,this.layers=n,this.tables=r}return y(e,[{key:"getProjectInfosWithDeps",value:async function(e){const t=await this.projects.getProjectInfos(e),n=await this.projects.getProjectsDeps(e),{layers:r,tables:s}=await this.getDependencies(n,!0,!0);return{projects:t,deps:{layers:r,tables:s}}}},{key:"getLayerInfosWithDeps",value:async function(e){const t=await this.layers.getLayerInfos(e),n=await this.layers.getLayersDeps(e),{tables:r}=await this.getDependencies(n,!1,!0);return{layers:t,deps:{tables:r}}}},{key:"getDependencies",value:async function(e,t,n){const{tables:r,layers:s}=e.reduce((e,r)=>{const s=r.dependencies||[];if(t){const t=this.getDependentNames(s,exports.DependencyType.Layer);e.layers.push(...t)}if(n){const t=this.getDependentNames(s,exports.DependencyType.Table);e.tables.push(...t)}return e},{tables:[],layers:[]});return{tables:await this.tables.getTableInfos(r.filter(Q)),layers:await this.layers.getLayerInfos(s.filter(Q))}}},{key:"getDependentNames",value:function(e,t){return e.filter(e=>{let{type:n}=e;return n===t}).map(e=>{let{name:t}=e;return t}).filter(X)}}]),e}(),$=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getStyle",value:function(e){return this.http.get("/styles/"+e).json()}},{key:"updateStyle",value:function(e,t){return this.http.post("/styles/"+e,t).json()}},{key:"createStyle",value:function(e){return this.http.post("/styles",e).json()}},{key:"getAllFonts",value:function(){return this.http.get("/styles/fonts").json()}}]),n}(),ee=function(e){d(n,$);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),te=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"geocode",value:function(e){let{providerName:t}=e,n=g(e,["providerName"]);return this.http.get("/geocode/"+t,n).json()}},{key:"geocodeByPoint",value:function(e){let{providerName:t}=e,n=g(e,["providerName"]);return this.http.get("/geocode/"+t+"/geocodeByPoint",n).json()}},{key:"suggest",value:function(e){let{providerName:t}=e,n=g(e,["providerName"]);return this.http.get("/geocode/"+t+"/suggest",n).json()}}]),n}(),ne=function(e){d(n,te);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"geocode2Gis",value:function(e){return this.geocode(f({providerName:"geocode2gis"},e))}},{key:"suggest2Gis",value:function(e){return this.suggest(f({providerName:"geocode2gis"},e))}}]),n}(),re=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getProjects",value:function(e){return this.http.get("/resources/projects",e).json()}},{key:"getTables",value:function(e){return this.http.get("/resources/tables",e).json()}},{key:"getLayers",value:function(e){return this.http.get("/resources/layers",e).json()}},{key:"addResource",value:function(e,t){return this.http.post("/resources/"+e+"/add",t).then(()=>{})}},{key:"addResources",value:function(e,t){return this.http.post("/resources/add",t,e).then(()=>{})}},{key:"removeResource",value:function(e,t){return this.http.post("/resources/"+e+"/remove",t).then(()=>{})}},{key:"getNewResources",value:function(){return this.http.get("/resources/getNewResources").json()}},{key:"touchResources",value:function(e,t){return this.http.post("/resources/"+e+"/touchResources",t).then(()=>{})}},{key:"shareResources",value:function(e,t){return this.http.post("/resources/"+e+"/shareAll",t).then(()=>{})}},{key:"unshareResources",value:function(e,t){return this.http.post("/resources/"+e+"/unshareAll",t).then(()=>{})}},{key:"getResource",value:function(e,t){return this.http.get("/resources/"+e+"/"+t).json()}},{key:"removeResource1",value:function(e){let{resourceType:t}=e,n=g(e,["resourceType"]);return this.http.delete("/resources/"+t,null,n).then(()=>{})}},{key:"checkLimits",value:function(){return this.http.get("/resources/checkLimits").json()}},{key:"copyResources",value:function(e){return this.http.post("/resources/copy",e).json()}}]),n}(),se=function(e){d(n,re);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),oe=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getTools",value:function(e){return this.http.get("/tools",e).json()}},{key:"createTool",value:function(e){return this.http.post("/tools",e).json()}},{key:"loadToolInfo",value:function(e){return this.http.get("/tools/"+e+"/info").json()}},{key:"loadToolDefinition",value:function(e){return this.http.get("/tools/"+e).json()}},{key:"updateTool",value:function(e,t){return this.http.patch("/tools/"+e,t).then(()=>{})}},{key:"deleteTool",value:function(e){return this.http.delete("/tools/"+e,null).then(()=>{})}},{key:"addToolPermissions",value:function(e,t){return this.http.post("/tools/"+e+"/add-permissions",t).then(()=>{})}},{key:"removeToolPermissions",value:function(e,t){return this.http.post("/tools/"+e+"/remove-permissions",t).then(()=>{})}},{key:"replaceToolPermissions",value:function(e,t){return this.http.put("/tools/"+e+"/set-permissions",t).then(()=>{})}},{key:"loadToolPermission",value:function(e){return this.http.get("/tools/"+e+"/permissions").json()}},{key:"reloadTool",value:function(e){return this.http.get("/tools/"+e+"/reload").then(()=>{})}},{key:"getToolsNames",value:function(e){return this.http.get("/tools/list-names",e).json()}},{key:"addToolToGroups",value:function(e,t){return this.http.post("/tools/"+e+"/add-groups",t).then(()=>{})}},{key:"removeFromGroups",value:function(e,t){return this.http.post("/tools/"+e+"/remove-groups",t).then(()=>{})}},{key:"getGroups",value:function(e){return this.http.get("/tools/groups",e).json()}},{key:"createGroup",value:function(e){return this.http.post("/tools/groups",e).json()}},{key:"loadGroup",value:function(e){return this.http.get("/tools/groups/"+e).json()}},{key:"updateGroup",value:function(e,t){return this.http.post("/tools/groups/"+e,t).then(()=>{})}},{key:"deleteGroup",value:function(e){return this.http.delete("/tools/groups/"+e,null).then(()=>{})}},{key:"addToolsToGroup",value:function(e){return this.http.post("/tools/groups/add-tools",e).then(()=>{})}},{key:"removeToolsFromGroup",value:function(e){return this.http.post("/tools/groups/remove-tools",e).then(()=>{})}},{key:"getGroupsInfo",value:function(e){return this.http.get("/tools/groups/list-info",e).json()}},{key:"evaluateTool",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.post("/tools/"+n+"/evaluate",t,r).json()}},{key:"executeTool",value:function(e,t){let{name:n}=e,r=g(e,["name"]);return this.http.post("/tools/"+n+"/run",t,r).json()}},{key:"getToolsLists",value:function(e){return this.http.get("/tools/journal",e).json()}},{key:"getTool",value:function(e){return this.http.get("/tools/journal/"+e).json()}},{key:"cancelExecute",value:function(e){return this.http.post("/tools/"+e+"/cancel",null).then(()=>{})}},{key:"getToolResult",value:function(e,t){return this.http.post("/tools/"+e+"/result",t).json()}}]),n}(),ie=function(e){d(n,oe);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),ae=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getServerInfo",value:function(){return this.http.get("/").json()}},{key:"favicon",value:function(){return this.http.createUrl("/favicon.ico")}},{key:"getFunctionsList",value:function(){return this.http.get("/functions").json()}}]),n}(),ue=function(e){d(n,ae);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),le=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getNamespaces",value:function(e){return this.http.get("/namespaces",e).json()}},{key:"createNamespace",value:function(e){return this.http.post("/namespaces",null,e).json()}},{key:"getNamespace",value:function(e){return this.http.get("/namespaces/"+e).json()}},{key:"removeNamespace",value:function(e){return this.http.delete("/namespaces/"+e,null).then(()=>{})}}]),n}(),ce=function(e){d(n,le);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}(),pe=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getUsers",value:function(e){return this.http.get("/account/user/list",e).json()}},{key:"getExtendedUsers",value:function(e){return this.http.get("/account/user/extendedlist",e).json()}},{key:"getUserInfo",value:function(e){return this.http.get("/account/"+e).json()}},{key:"getExtendedUserInfo",value:function(e){return this.http.get("/account/extended/"+e).json()}},{key:"isUsernameExists",value:function(e){return this.http.get("/account/user/exists",e).json()}},{key:"isEmailExists",value:function(e){return this.http.get("/account/user/email/exists",e).json()}},{key:"registerUser",value:function(e){return this.http.post("/account/register",e).text()}},{key:"createUser",value:function(e,t){return this.http.post("/account/user",t,e).then(()=>{})}},{key:"updateUser",value:function(e){return this.http.patch("/account/user",e).then(()=>{})}},{key:"confirmEmail",value:function(e){return this.http.post("/account/user/"+e+"/email/confirm",null).then(()=>{})}},{key:"verifyEmail",value:function(e){return this.http.post("/account/user/"+e+"/email/verify",null).then(()=>{})}},{key:"setEmail",value:function(e){return this.http.post("/account/setEmail",C(e)).then(()=>{})}},{key:"confirmEmail1",value:function(e){return this.http.post("/account/user/email/confirm",null,e).then(()=>{})}},{key:"changeEmail",value:function(e){return this.http.post("/account/user/email/change",null,e).then(()=>{})}},{key:"confirmChangeEmail",value:function(e){return this.http.post("/account/user/email/change/confirm",null,e).then(()=>{})}},{key:"setUserPassword",value:function(e,t){return this.http.patch("/account/user/"+e+"/password",t).then(()=>{})}},{key:"changePassword",value:function(e){return this.http.patch("/account/password/change",C(e)).then(()=>{})}},{key:"resetPassword",value:function(e){return this.http.post("/account/password/reset",null,e).then(()=>{})}},{key:"resetPasswordCallback",value:function(e){return this.http.post("/account/password/reset/confirm",C(e)).then(()=>{})}},{key:"removeUser",value:function(e){return this.http.delete("/account/user/"+e,null).then(()=>{})}},{key:"activateUser",value:function(e){return this.http.post("/account/user/"+e+"/activate",null).then(()=>{})}},{key:"deactivateUser",value:function(e){return this.http.post("/account/user/"+e+"/deactivate",null).then(()=>{})}},{key:"authenticate",value:function(e){return this.http.post("/account/login",e).text()}},{key:"refreshToken",value:function(){return this.http.post("/account/refresh-token",null).text()}},{key:"revokeToken",value:function(){return this.http.delete("/account/revoke-token",null).then(()=>{})}},{key:"getRoles",value:function(e){return this.http.get("/account/role/list",e).json()}},{key:"createRole",value:function(e){return this.http.post("/account/role",e).then(()=>{})}},{key:"updateRole",value:function(e){return this.http.patch("/account/role",e).then(()=>{})}},{key:"removeRole",value:function(e){return this.http.delete("/account/role/"+e,null).then(()=>{})}},{key:"addToRole",value:function(e,t){return this.http.post("/account/user/"+e+"/role/"+t,null).then(()=>{})}},{key:"removeFromRole",value:function(e,t){return this.http.delete("/account/user/"+e+"/role/"+t,null).then(()=>{})}},{key:"postUsedProjects",value:function(e){return this.http.post("/account/latest_projects",e).json()}},{key:"getUsedProjects",value:function(){return this.http.get("/account/latest_projects").json()}},{key:"truncateUsedProjects",value:function(){return this.http.delete("/account/latest_projects",null).then(()=>{})}}]),n}();const he=()=>JSON.parse(localStorage.getItem(fe)||"null")||void 0,ye=e=>{if(e){const t=he();localStorage.setItem(fe,JSON.stringify(f({},t,e)))}else localStorage.removeItem(fe)},fe="@evergis/user-info";let de=function(e){d(n,pe);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"login",value:async function(e){e&&await b(v(n.prototype),"authenticate",this).call(this,e)}},{key:"fetchCurrentUser",value:async function(){return this.userInfo=await this.getUserInfo(""),this.userInfo}},{key:"logout",value:async function(){await this.revokeToken(),ye(void 0),this.userInfo={}}},{key:"updateCurrentUser",value:async function(e){await b(v(n.prototype),"updateUser",this).call(this,f({username:this.username},e)),ye(e)}},{key:"setPassword",value:function(e){return this.setUserPassword(this.username,e)}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}},{key:"isAuth",get:function(){var e;return!!(null==(e=this.userInfo)?void 0:e.username)&&"public"!==this.userInfo.username}},{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=he();return e&&(this.userInfo=e),e}}]),n}(),ve=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getPreview",value:function(e){return this.http.createUrl("/account/user/"+e+"/preview")}},{key:"uploadPreview",value:function(e,t){return this.http.post("/account/user/"+e+"/preview",C(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/account/user/"+e+"/preview",null).then(()=>{})}},{key:"getPreview1",value:function(){return this.http.createUrl("/account/user/preview")}}]),n}(),ge=function(e){d(n,ve);var t=m(n);function n(e,r){var s;return p(this,n),(s=t.call(this,e)).userInfo=r,s}return y(n,[{key:"updateCurrentUserPhoto",value:async function(e){const{fileId:t}=await this.uploadPreview(this.username,{file:e});ye({profile_photo:t,has_profile_photo:!0})}},{key:"fetchPreview1",value:async function(){const e=await this.getPreview1();ye({profile_photo:e,has_profile_photo:!0})}},{key:"deleteCurrentUserPhoto",value:async function(){await this.deletePreview(this.username),ye({profile_photo:"",has_profile_photo:!1})}},{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=he();return e&&(this.userInfo=e),e}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}}]),n}(),ke=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"vkLogin",value:function(){return this.http.createUrl("/account/external/login/vk")}},{key:"googleLogin",value:function(){return this.http.createUrl("/account/external/login/google")}},{key:"facebookLogin",value:function(){return this.http.createUrl("/account/external/login/facebook")}},{key:"loginCallback",value:function(){return this.http.get("/account/external/login/callback").then(()=>{})}},{key:"unbindVk",value:function(){return this.http.delete("/account/external/unbind/vk",null).then(()=>{})}},{key:"unbindGoogle",value:function(){return this.http.delete("/account/external/unbind/google",null).then(()=>{})}},{key:"unbindFacebook",value:function(){return this.http.delete("/account/external/unbind/facebook",null).then(()=>{})}},{key:"bindVk",value:function(){return this.http.createUrl("/account/external/bind/vk")}},{key:"bindGoogle",value:function(){return this.http.createUrl("/account/external/bind/google")}},{key:"bindFacebook",value:function(){return this.http.createUrl("/account/external/bind/facebook")}},{key:"bindCallback",value:function(){return this.http.get("/account/external/bind/callback").then(()=>{})}}]),n}(),me=function(e){d(n,ke);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"login",value:function(e){switch(e){case"vk":return this.vkLogin();case"google":return this.googleLogin();case"facebook":return this.facebookLogin();default:return""}}},{key:"bind",value:function(e){switch(e){case"vk":return this.bindVk();case"google":return this.bindGoogle();case"facebook":return this.bindFacebook();default:return""}}},{key:"unbind",value:function(e){switch(e){case"vk":return this.unbindVk();case"google":return this.unbindGoogle();case"facebook":return this.unbindFacebook();default:return""}}}]),n}(),be=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"getConfiguration",value:function(e){return this.http.get("/settings",e).text()}},{key:"setConfiguration",value:function(e,t){return this.http.post("/settings",t,e).then(()=>{})}},{key:"getConfig",value:function(e){return this.http.get("/settings/config/"+e).json()}},{key:"removeConfig",value:function(e){return this.http.delete("/settings/config/"+e,null).then(()=>{})}},{key:"getConfigByPath",value:function(e){return this.http.get("/settings/config/getByPath",e).json()}},{key:"getConfig1",value:function(e){return this.http.get("/settings/config",e).json()}},{key:"createConfig",value:function(e){return this.http.post("/settings/config",e).json()}},{key:"updateConfig",value:function(e){return this.http.patch("/settings/config",e).then(()=>{})}},{key:"getValue",value:function(e){return this.http.get("/settings/variable/value/"+e).json()}},{key:"removeValue",value:function(e){return this.http.delete("/settings/variable/value/"+e,null).then(()=>{})}},{key:"getVariables",value:function(e){let{idVariable:t}=e,n=g(e,["idVariable"]);return this.http.get("/settings/variable/"+t+"/value",n).json()}},{key:"createValue",value:function(e){return this.http.post("/settings/variable/value",e).json()}},{key:"updateValue",value:function(e){return this.http.patch("/settings/variable/value",e).then(()=>{})}},{key:"getVariable",value:function(e){return this.http.get("/settings/variable/"+e).json()}},{key:"removeVariabe",value:function(e){return this.http.delete("/settings/variable/"+e,null).then(()=>{})}},{key:"getConfigVariableByName",value:function(e,t){return this.http.get("/settings/config/"+e+"/variable/"+t).json()}},{key:"getVariables1",value:function(e){return this.http.get("/settings/variable",e).json()}},{key:"createVariable",value:function(e){return this.http.post("/settings/variable",e).json()}},{key:"updateVariable",value:function(e){return this.http.patch("/settings/variable",e).then(()=>{})}}]),n}(),Te=function(e){d(n,be);var t=m(n);function n(){var e;return p(this,n),(e=t.apply(this,arguments)).settings={modules:[],connection:{url:""}},e}return y(n,[{key:"fetchClientSettings",value:async function(e){const t=JSON.parse(await this.getConfiguration(e));return this.updateClientSettings(t),t}},{key:"updateClientSettings",value:function(e){Object.assign(this.settings,e)}}]),n}();var we;(we=exports.ErrorReason||(exports.ErrorReason={})).HTTP_OTHER="other",we.HTTP_CLIENT="client",we.HTTP_SERVER="server",we.UNKNOWN="unknown";const xe=e=>e instanceof t.HTTPError?(e=>{const t=e.response.status;let n=exports.ErrorReason.HTTP_OTHER;return t>=400&&t<500&&(n=exports.ErrorReason.HTTP_CLIENT),t>=500&&(n=exports.ErrorReason.HTTP_SERVER),{type:"http",reason:n,status:t,origin:e}})(e):(e=>({type:"base",reason:exports.ErrorReason.UNKNOWN,origin:e}))(e),je=e=>e&&e.type&&e.reason;function Se(e){return function(t){return!!t.type&&e.includes(t.type)}}const Pe=Se(["PostgresLayerService","PostgresTileLayerService"]),Re=e=>window.location.protocol+"//"+e+"."+window.location.host,Ie=o.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",12);(exports.ResourceSeparator||(exports.ResourceSeparator={})).Server=".";let Ce=function(){function e(t){let{account:n}=t;p(this,e),this.account=n}return y(e,[{key:"createId",value:function(){return Ie()}},{key:"createResourceName",value:function(e){void 0===e&&(e={});const t=e.workspace||this.account.user&&this.account.user.namespace||"",n=e.name||this.createId(),r=e.separator||exports.ResourceSeparator.Server;return t||console.warn("Resource should have workspace. Check account api"),""+t+r+n}},{key:"createTempResourceName",value:function(e){return void 0===e&&(e={}),this.createResourceName(f({workspace:"temp"},e))}},{key:"extractResource",value:function(e){if(e&&e.includes(exports.ResourceSeparator.Server)){const[t,n]=e.split(exports.ResourceSeparator.Server,2);return{workspace:t,name:n}}return{name:"",workspace:""}}},{key:"extractResourceName",value:function(e){return this.extractResource(e).name||e||""}},{key:"extractResourceWorkspace",value:function(e){return this.extractResource(e).workspace||""}}]),e}(),Ee=function(e){d(n,T);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return y(n,[{key:"print",value:function(e){return this.http.post("/print/print",e).blob()}},{key:"printToHtml",value:function(e){return this.http.post("/print/printHtml",e).text()}},{key:"uploadTemplate",value:function(e,t){return this.http.post("/print/templates",C(t),e).then(()=>{})}},{key:"getTemplates",value:function(){return this.http.get("/print/templates").json()}},{key:"deleteTemplate",value:function(e){return this.http.delete("/print/templates/"+e,null).then(()=>{})}},{key:"getTemplate",value:function(e){return this.http.get("/print/templates/"+e).text()}}]),n}(),Le=function(e){d(n,Ee);var t=m(n);function n(){return p(this,n),t.apply(this,arguments)}return n}();var Ue,Ne;(Ue=exports.ApiEvent||(exports.ApiEvent={})).ConnectionLost="ConnectionLost",Ue.Unauthorized="Unauthorized",Ue.SessionClosed="SessionClosed",(Ne=exports.UrlPath||(exports.UrlPath={})).Base="/map",Ne.Shared="/shared";const Fe={401:exports.ApiEvent.Unauthorized},Ae=Object.values(exports.UrlPath),De=Ae[0];let Be=function(e){d(s,r.EventEmitter);var n=m(s);function s(e){var r;let{url:o,wsUrl:i,http:a,urlPath:u,httpOptions:l}=e;p(this,s),r=n.call(this);const{hooks:c}=l||{};return r.http=a||new P(f({prefixUrl:o,timeout:!1},l||{},{hooks:f({},c||{},{beforeRequest:[...c&&c.beforeRequest||[]],afterResponse:[e=>{const n=Fe[e.status];return n&&r.emit(n,xe(new t.HTTPError(e))),e},...c&&c.afterResponse||[]]})})),r.url=o,r.wsUrl=i||o,r.urlPath=u||r.defineUrlPath(),r.layers=new H(r.http),r.tables=new z(r.http),r.projects=new K(r.http),r.resources=new Z(r.projects,r.layers,r.tables),r.styles=new ee(r.http),r.account=new de(r.http),r.accountPreview=new ge(r.http,r.account),r.bulk=new x(r.http),r.security=new S(r.http,r.account),r.notification=new D(r.http),r.scheduler=new M(r.http),r.file=new L(r.http),r.import=new N(r.http),r.geocode=new ne(r.http),r.print=new Le(r.http),r.tools=new ie(r.http),r.resourceCatalog=new se(r.http),r.general=new ue(r.http),r.namespace=new ce(r.http),r.external=new me(r.http),r.clientSettings=new Te(r.http),r.names=new Ce({account:r.account}),r}return y(s,[{key:"init",value:async function(e){let{authParams:t,connectWs:n,initScheduler:r,fetchSettings:s,fetchUser:o}=e;try{await this.account.login(t),o&&await this.account.fetchCurrentUser(),n&&await this.connectWs(),r&&await this.initScheduler(),s&&await this.clientSettings.fetchClientSettings({urlPath:this.urlPath})}catch(e){throw xe(e)}}},{key:"isAcceptedNetwork",value:function(e){return["vk","google","facebook"].includes(e)}},{key:"socAuthLogin",value:async function(e){if(this.isAcceptedNetwork(e))try{await this.clientSettings.fetchClientSettings({urlPath:exports.UrlPath.Base})}catch(e){throw xe(e)}}},{key:"connectWs",value:async function(){this.account.isAuth&&(this.notification.connectWs(this.wsUrl),this.notification.on("ConnectionStatus",e=>{e.data===exports.ConnectionStatus.Lost?this.emit(exports.ApiEvent.ConnectionLost,e.data):e.data===exports.ConnectionStatus.SessionClosed&&this.emit(exports.ApiEvent.SessionClosed,e.data)}))}},{key:"logout",value:async function(){await this.account.logout(),await this.security.reset(),this.emit(exports.ApiEvent.Unauthorized,null)}},{key:"initScheduler",value:function(){return this.scheduler.init(this.notification)}},{key:"defineUrlPath",value:function(){const e=(window.location.href.split(window.location.hostname)[1]||"").split("/").filter(Boolean)[0],t=e?"/"+e:void 0;return t&&Ae.includes(t)?t:De}},{key:"isShared",get:function(){return this.urlPath===exports.UrlPath.Shared}}]),s}(),Oe=function(e){d(n,u.TileLayer);var t=m(n);function n(e,r){var s;return p(this,n),(s=t.call(this,"",{crs:e.crs})).api=r,s.name=e.name,s.subDomains=e.subDomains,s}return y(n,[{key:"getTileUrl",value:function(e,t,n){const r=this.subDomains,s=r&&r[(e+t+n)%r.length],o=this.api.layers.getTilesLayerImage({x:e,y:t,z:n,name:this.name});return s?""+Re(s)+o:o}}]),n}(),Me=function(e){d(n,l.DynamicLayer);var t=m(n);function n(e,r){var s;return p(this,n),(s=t.call(this)).api=r,s.name=e.name,s.styleId=e.style,s.conditionQuery=e.condition,s.subscribeRedraw(),s}return y(n,[{key:"getUrl",value:function(e,t){let n=Math.round((e.xMax-e.xMin)/t),r=Math.round((e.yMax-e.yMin)/t);return this.api.layers.getLayerImage({name:this.name,extent:e.coordinates,size:[n,r],extentSr:e.crs.wkid,styleId:this.styleId,condition:this.conditionQuery})}},{key:"subscribeRedraw",value:function(){const e="service_update_"+this.name.replace(/\//g,"_");this.api.notification.subscribe(e).then(()=>{this.api.notification.on(e,()=>{this.forceUpdate(),this.redraw()})})}},{key:"style",set:function(e){this.styleId=e,this.forceUpdate()},get:function(){return this.styleId}},{key:"condition",set:function(e){this.conditionQuery=e,this.forceUpdate()},get:function(){return this.conditionQuery}}]),n}();const qe={RemoteTileService:Oe,LocalTileService:Oe,PostgresLayerService:Me,StyledFeatureLayer:Me,CompositeService:null};let _e=function(){function e(t,n){p(this,e),this.layers=t,this.http=n}return y(e,[{key:"getLayerService",value:async function(e){let t=await this.getLayerInfo(e);const n=t.type;if(!(e=>Boolean(e&&Object.keys(qe).includes(e)))(n))return;const r=qe[n];if(r)return new r((e=>f({},e,{name:"services/"+e.name}))(t),this.http);throw new Error('Constructor for service type: "'+t.type+'" not implemented')}},{key:"getLayerInfo",value:async function(e){try{return await this.layers.getLayerInfo(e)}catch(t){throw new Error('Service with name: "'+e+'" not exists')}}}]),e}();var Ge;!function(e){e[e.BaseMaps=0]="BaseMaps",e[e.Layers=1]="Layers"}(Ge||(Ge={}));let Ve=function(e){d(n,Be);var t=m(n);function n(e,r,s){var o;return p(this,n),(o=t.call(this,r)).map=new a.Map,o.painter=new i.DomPainter(o.map),o.mapProps=e,o.auth=s,o.layersManager=new _e(o.layers,o.http),o}return y(n,[{key:"init",value:async function(){await b(v(n.prototype),"init",this).call(this,{authParams:this.auth,connectWs:!0,fetchSettings:!0,initScheduler:!0});const{baseService:e,services:t,projectName:r}=this.mapProps;e&&await this.setBaseMap(e),t&&await Promise.all(t.map(e=>this.addLayer(e))),r&&await this.loadProject(r),this.setMapProps()}},{key:"reset",value:async function(){await this.account.logout(),this.painter.wrapper=null}},{key:"addLayer",value:async function(e){await this.insertLayer(e,Ge.Layers)}},{key:"setBaseMap",value:async function(e){await this.insertLayer(e,Ge.BaseMaps)}},{key:"loadProject",value:async function(e){const t=await this.projects.getProjectInfo(e);if(!t||!t.content)return;const{baseMapName:n,items:r}=t.content;if(n&&await this.setBaseMap(n),r){const e=r.map(e=>e.name).filter(He);await Promise.all(e.map(e=>this.addLayer(e)))}}},{key:"insertLayer",value:async function(e,t){const n=await this.layersManager.getLayerService(e);n&&this.map.insertLayer(n.layer,t)}},{key:"setMapProps",value:function(){const{position:e,centerPoint:t,mapWrapper:n,resolution:r}=this.mapProps;e?this.map.position=e:t&&(this.map.centerPoint=t),r&&(this.map.resolution=r),n&&(this.painter.wrapper=n)}}]),n}();const He=e=>void 0!==e;var We,ze,Je,Ke,Qe,Xe,Ye,Ze,$e,et,tt,nt,rt,st,ot,it,at,ut,lt,ct,pt,ht,yt,ft,dt,vt,gt;(We=exports.AggregationFunction||(exports.AggregationFunction={})).None="None",We.Array="Array",We.Min="Min",We.Max="Max",We.Avg="Avg",We.Sum="Sum",We.Extent="Extent",We.Count="Count",We.OnlyValue="OnlyValue",(ze=exports.ArgumentType||(exports.ArgumentType={})).String="string",ze.Int32="int32",ze.Int64="int64",ze.Double="double",ze.Float="float",ze.Boolean="boolean",ze.DateTime="datetime",ze.Enum="enum",ze.DataSource="dataSource",ze.Polygon="polygon",ze.Polyline="polyline",ze.Point="point",ze.Envelope="envelope",ze.Attribute="attribute",ze.Array="array",ze.ServiceInfo="serviceInfo",(Je=exports.AttributeType||(exports.AttributeType={})).Unknown="Unknown",Je.String="String",Je.Int32="Int32",Je.Int64="Int64",Je.Double="Double",Je.DateTime="DateTime",Je.Boolean="Boolean",Je.Point="Point",Je.Polyline="Polyline",Je.Polygon="Polygon",Je.Multipoint="Multipoint",(Ke=exports.ClassificationType||(exports.ClassificationType={})).NaturalBreaks="naturalBreaks",Ke.EqualInterval="equalInterval",Ke.Quantile="quantile",(Qe=exports.CombineType||(exports.CombineType={})).Array="Array",Qe.Value="Value",(Xe=exports.ConfigurationErrorEnum||(exports.ConfigurationErrorEnum={})).Unknown="Unknown",Xe.SerializeError="SerializeError",Xe.InvalidDataService="InvalidDataService",Xe.InvalidConfiguration="InvalidConfiguration",Xe.InvalidDataServiceName="InvalidDataServiceName",Xe.InvalidTableName="InvalidTableName",Xe.ResourceNotFound="ResourceNotFound",Xe.InvalidCondition="InvalidCondition",Xe.InvalidAttributes="InvalidAttributes",Xe.InvalidIdAttribute="InvalidIdAttribute",Xe.InvalidGeometryAttribute="InvalidGeometryAttribute",Xe.InvalidGeometryAttributeType="InvalidGeometryAttributeType",Xe.InvalidColumnName="InvalidColumnName",Xe.InvalidIdColumnSettings="InvalidIdColumnSettings",Xe.ColumnNotExistsInTable="ColumnNotExistsInTable",Xe.InvalidStyle="InvalidStyle",Xe.InvalidLayerType="InvalidLayerType",Xe.ColumnLoadingError="ColumnLoadingError",Xe.InvalidAttributeFormat="InvalidAttributeFormat",(Ye=exports.ElementType||(exports.ElementType={})).None="none",Ye.Checkbox="checkbox",Ye.Select="select",(Ze=exports.ErrorDetailsType||(exports.ErrorDetailsType={})).ResourceLimitExceeded="ResourceLimitExceeded",Ze.ResourceNotFound="ResourceNotFound",Ze.InternalError="InternalError",Ze.BadRequest="BadRequest",Ze.DuplicateContent="DuplicateContent",($e=exports.ErrorType||(exports.ErrorType={})).NotSpecified="NotSpecified",$e.LimitError="LimitError",$e.ValidationError="ValidationError",$e.JwtExpired="JwtExpired",$e.TokenInvalid="TokenInvalid",$e.RefreshTokenExpired="RefreshTokenExpired",$e.RefreshTokenInvalid="RefreshTokenInvalid",$e.CreateUserFailed="CreateUserFailed",$e.SetUserPasswordFailed="SetUserPasswordFailed",$e.SetUserRoleFailed="SetUserRoleFailed",$e.UpdateUserFailed="UpdateUserFailed",$e.RemoveUserFailed="RemoveUserFailed",$e.CreateRoleFailed="CreateRoleFailed",$e.UpdateRoleFailed="UpdateRoleFailed",$e.RemoveUserRoleFailed="RemoveUserRoleFailed",$e.ChangeActiveStateFailed="ChangeActiveStateFailed",$e.RemoveRoleFailed="RemoveRoleFailed",$e.UserNotFound="UserNotFound",$e.RoleNotFound="RoleNotFound",$e.EmailNotConfirmed="EmailNotConfirmed",$e.DuplicateEmailError="DuplicateEmailError",$e.InvalidPassword="InvalidPassword",$e.RoleExists="RoleExists",$e.UserExists="UserExists",$e.UserLockedError="UserLockedError",$e.InvalidEmail="InvalidEmail",$e.InvalidUsername="InvalidUsername",$e.Unauthorized="Unauthorized",$e.EmailNotChanged="EmailNotChanged",$e.EmailNotSet="EmailNotSet",(et=exports.FeatureType||(exports.FeatureType={})).Unknown="Unknown",et.GeometricFeature="GeometricFeature",(tt=exports.FontStyle||(exports.FontStyle={})).Normal="normal",tt.Oblique="oblique",tt.Italic="italic",(nt=exports.FontWeight||(exports.FontWeight={})).Thin="Thin",nt.ExtraLight="ExtraLight",nt.UltraLight="UltraLight",nt.Light="Light",nt.SemiLight="SemiLight",nt.Normal="Normal",nt.Regular="Regular",nt.Medium="Medium",nt.DemiBold="DemiBold",nt.SemiBold="SemiBold",nt.Bold="Bold",nt.ExtraBold="ExtraBold",nt.UltraBold="UltraBold",nt.Black="Black",nt.Heavy="Heavy",nt.ExtraBlack="ExtraBlack",nt.UltraBlack="UltraBlack",(rt=exports.GeometryType||(exports.GeometryType={})).Unknown="unknown",rt.Point="point",rt.Polyline="polyline",rt.Polygon="polygon",rt.Envelope="envelope",rt.Multipoint="multipoint",(st=exports.HttpStatusCode||(exports.HttpStatusCode={})).Continue="Continue",st.SwitchingProtocols="SwitchingProtocols",st.Processing="Processing",st.EarlyHints="EarlyHints",st.OK="OK",st.Created="Created",st.Accepted="Accepted",st.NonAuthoritativeInformation="NonAuthoritativeInformation",st.NoContent="NoContent",st.ResetContent="ResetContent",st.PartialContent="PartialContent",st.MultiStatus="MultiStatus",st.AlreadyReported="AlreadyReported",st.IMUsed="IMUsed",st.MultipleChoices="Ambiguous",st.Ambiguous="Moved",st.MovedPermanently="Redirect",st.Moved="RedirectMethod",st.Found="NotModified",st.Redirect="UseProxy",st.SeeOther="Unused",st.RedirectMethod="TemporaryRedirect",st.NotModified="PermanentRedirect",st.UseProxy="BadRequest",st.Unused="Unauthorized",st.TemporaryRedirect="PaymentRequired",st.RedirectKeepVerb="Forbidden",st.PermanentRedirect="NotFound",st.BadRequest="MethodNotAllowed",st.Unauthorized="NotAcceptable",st.PaymentRequired="ProxyAuthenticationRequired",st.Forbidden="RequestTimeout",st.NotFound="Conflict",st.MethodNotAllowed="Gone",st.NotAcceptable="LengthRequired",st.ProxyAuthenticationRequired="PreconditionFailed",st.RequestTimeout="RequestEntityTooLarge",st.Conflict="RequestUriTooLong",st.Gone="UnsupportedMediaType",st.LengthRequired="RequestedRangeNotSatisfiable",st.PreconditionFailed="ExpectationFailed",st.RequestEntityTooLarge="MisdirectedRequest",st.RequestUriTooLong="UnprocessableEntity",st.UnsupportedMediaType="Locked",st.RequestedRangeNotSatisfiable="FailedDependency",st.ExpectationFailed="UpgradeRequired",st.MisdirectedRequest="PreconditionRequired",st.UnprocessableEntity="TooManyRequests",st.Locked="RequestHeaderFieldsTooLarge",st.FailedDependency="UnavailableForLegalReasons",st.UpgradeRequired="InternalServerError",st.PreconditionRequired="NotImplemented",st.TooManyRequests="BadGateway",st.RequestHeaderFieldsTooLarge="ServiceUnavailable",st.UnavailableForLegalReasons="GatewayTimeout",st.InternalServerError="HttpVersionNotSupported",st.NotImplemented="VariantAlsoNegotiates",st.BadGateway="InsufficientStorage",st.ServiceUnavailable="LoopDetected",st.GatewayTimeout="NotExtended",st.HttpVersionNotSupported="NetworkAuthenticationRequired",st.VariantAlsoNegotiates="VariantAlsoNegotiates",st.InsufficientStorage="InsufficientStorage",st.LoopDetected="LoopDetected",st.NotExtended="NotExtended",st.NetworkAuthenticationRequired="NetworkAuthenticationRequired",(ot=exports.LineEndingSize||(exports.LineEndingSize={})).Small="small",ot.Large="large",(it=exports.LineEndingType||(exports.LineEndingType={})).None="none",it.Arrow="arrow",it.FilledArrow="filledArrow",it.Square="square",it.FilledSquare="filledSquare",it.Circle="circle",it.FilledCircle="filledCircle",(at=exports.Operation||(exports.Operation={})).Unknown="Unknown",at.Union="union",at.Intersection="intersection",at.Subtraction="subtraction",at.SymDifference="symDifference",(ut=exports.Permissions||(exports.Permissions={})).None="none",ut.Configure="configure",ut.Write="write",ut.Read="read",ut.ReadConfigure="read,configure",ut.ReadWrite="read,write",ut.All="read,write,configure",(lt=exports.PolicyType||(exports.PolicyType={})).Unknown="Unknown",lt.CreateTable="CreateTable",lt.CreateLayer="CreateLayer",lt.CreateProject="CreateProject",lt.MaxFeaturesInOneTable="MaxFeaturesInOneTable",(ct=exports.ResourceType||(exports.ResourceType={})).Unknown="Unknown",ct.Table="table",ct.Layer="layer",ct.Project="project",ct.File="file",ct.Feature="feature",(pt=exports.ResourceTypeLink||(exports.ResourceTypeLink={})).Table="tables",pt.Layer="layers",pt.Project="projects",(ht=exports.ServerTaskStatus||(exports.ServerTaskStatus={})).None="None",ht.Scheduled="Scheduled",ht.Planning="Planning",ht.Executing="Executing",ht.Completed="Completed",ht.Failed="Failed",ht.Canceled="Canceled",ht.Timeout="Timeout",(yt=exports.StringSubType||(exports.StringSubType={})).None="None",yt.Image="Image",yt.PkkCode="PkkCode",(ft=exports.TextAlignment||(exports.TextAlignment={})).Right="right",ft.Left="left",ft.Center="center",ft.Justified="justified",(dt=exports.TextVerticalAlignment||(exports.TextVerticalAlignment={})).Top="top",dt.Bottom="bottom",dt.Middle="middle",(vt=exports.ToolStatus||(exports.ToolStatus={})).Pending="Pending",vt.Running="Running",vt.Delivered="Delivered",vt.Failed="Failed",vt.Completed="Completed",vt.Canceled="Canceled",(gt=exports.ToolStorageType||(exports.ToolStorageType={})).StaticStorage="staticStorage",gt.LayersStorage="layersStorage",Object.defineProperty(exports,"HTTPError",{enumerable:!0,get:function(){return t.HTTPError}}),Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:function(){return t.TimeoutError}}),exports.API_USER_INFO_KEY=fe,exports.Account=de,exports.AccountPreview=ge,exports.Api=Be,exports.BulkOperations=x,exports.ClientSettings=Te,exports.EvergisDynamicLayer=Me,exports.EvergisTileLayer=Oe,exports.External=me,exports.FileUpload=L,exports.GEOCODE_PROVIDER="geocode2gis",exports.General=ue,exports.Geocode=ne,exports.HttpClient=P,exports.Import=N,exports.Layers=H,exports.LayersManager=_e,exports.Names=Ce,exports.Namespace=ce,exports.Notification=D,exports.NotificationEvent=B,exports.Projects=K,exports.ResourceCatalog=se,exports.Resources=Z,exports.Scheduler=M,exports.Security=S,exports.SpatialProcessor=Ve,exports.Styles=ee,exports.Tables=z,exports.Tools=ie,exports.addSubDomainToLocation=Re,exports.errorHandler=xe,exports.formDataFromFile=function(e){const t=new FormData;return t.append("file",e),t},exports.generateId=Ie,exports.isEvergisDynamicLayer=function(e){return e instanceof Me},exports.isEvergisTileLayer=function(e){return e instanceof Oe},exports.isFeatureLayer=function(e){return e instanceof c.FeatureLayer},exports.isHTTPError=e=>je(e)&&"http"===e.type,exports.isHandledError=je,exports.isLayer=Pe,exports.isProjectContentItems=function(e){return null!=e},exports.isString=X,exports.isTileLayerService=function(e){return e.type&&/TileService/.test(e.type)},exports.promiseAllIgnoreErrors=_,exports.stripUselessSlashes=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.join("/").split("/").filter(Boolean).join("/")},exports.toFormData=C,exports.unique=Q;
2
2
  //# sourceMappingURL=api.cjs.production.min.js.map