@evergis/api
Advanced tools
Comparing version 3.0.137 to 3.0.138
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@evergis/event-emitter"),n=require("@microsoft/signalr"),r=require("ky"),s=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,i=require("query-string"),o=require("nanoid"),a=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),u=require("@evergis/sgis/es/Map"),l=require("@evergis/sgis/es/layers/TileLayer"),c=require("@evergis/sgis/es/layers/DynamicLayer"),p=require("@evergis/sgis");function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(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 f(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(){return(v=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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){return(k=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={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(s[n]=e[n]);return s}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function w(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=k(e);if(t){var s=k(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return b(this,n)}}function x(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}function T(){return(T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=x(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}}).apply(this,arguments)}let j=function(){function e(t){var n;void 0===t&&(t={}),h(this,e),this.ky=s.extend(t),this.prefixUrl=(null==(n=t.prefixUrl)?void 0:n.toString())||""}return f(e,[{key:"extend",value:function(e){var t;this.ky=s.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={}),i.stringify(e,{arrayFormat:"comma"})}function I(e){return e instanceof FormData?e:Object.keys(e).reduce((t,n)=>(t.append(n,e[n]),t),new FormData)}var C;(C=exports.ApiEvent||(exports.ApiEvent={})).ConnectionLost="ConnectionLost",C.Unauthorized="Unauthorized",C.SessionClosed="SessionClosed";let R=f((function e(t){h(this,e),this.http=t})),L=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"batchResourcesPermissionsSet",value:function(e){return this.http.put("/bulk/resources/permissions",e).json()}}]),n}(),E=function(e){d(n,L);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),U=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"findUserByNameByRoles",value:function(e){return this.http.get("/security/findUsersWithRoles",e).json()}},{key:"getUsersAndRoles",value:function(e){return this.http.get("/security/usersandroles",e).json()}},{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}(),F=function(e){d(n,U);var t=w(n);function n(e,r){var s;let{username:i,roles:o}=r;return h(this,n),(s=t.call(this,e)).ownerName="",s.ownerRoles=[],s.ownerName=i,s.ownerRoles=o,s}return f(n,[{key:"reset",value:function(){this.ownerName="",this.ownerRoles=[]}}]),n}(),N=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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",I(e)).json()}},{key:"deleteFile",value:function(e){return this.http.delete("/upload/file",null,e).then(()=>{})}},{key:"getFileInfo",value:function(e){return this.http.get("/upload/fileInfo",e).json()}}]),n}(),D=function(e){d(n,N);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"upload",value:function(e,t){return this.uploadFile({file:e,rewrite:!!t})}}]),n}(),A=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"get",value:function(e){return this.http.get("/filters/"+e).text()}},{key:"update",value:function(e,t){return this.http.post("/filters/"+e,t).json()}},{key:"create",value:function(e){return this.http.post("/filters",e).json()}}]),n}(),O=function(e){d(n,A);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),B=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getDataSchema",value:function(e){return this.http.get("/import/dataSchema",e).json()}},{key:"getFeaturesCount",value:function(e){return this.http.post("/import/count",e).json()}},{key:"readPart",value:function(e){return this.http.get("/import/read",e).then(()=>{})}},{key:"getExternalWmsLayers",value:function(e){return this.http.get("/import/wms",e).json()}},{key:"getExternalPbfLayers",value:function(e){return this.http.get("/import/pbf",e).json()}},{key:"getExternalArcGisLayers",value:function(e){return this.http.get("/import/arcgismapservice",e).json()}},{key:"getRasterAttributes",value:function(e){return this.http.get("/import/rasterAttributes",e).json()}}]),n}(),M=function(e){d(n,B);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),_=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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 W;(W=exports.ConnectionStatus||(exports.ConnectionStatus={})).Initialized="Initialized",W.Connected="Connected",W.Break="Break",W.Lost="Lost",W.SessionClosed="SessionClosed";let q=function(e){d(r,_);var n=w(r);function r(e,s,i){var o;return void 0===i&&(i=!1),h(this,r),(o=n.call(this,e)).api=s,o.MAX_WS_RECONNECT_TRIES=10,o.keepAlive=!1,o.reconnectTries=0,o.subscriptions=[],o._connectStatus=exports.ConnectionStatus.Initialized,o.onWsConnected=()=>{o.connectStatus=exports.ConnectionStatus.Connected,o.keepAlive&&(o.keepAliveTimeout=setInterval(()=>{o.ws&&o.ws.send(JSON.stringify({keepAlive:!0}))},5e3))},o.onWsClosed=e=>{4001===e.code||4002===e.code?o.connectStatus=exports.ConnectionStatus.SessionClosed:o.reconnectTries<o.MAX_WS_RECONNECT_TRIES?(o.connectStatus=exports.ConnectionStatus.Break,o.reconnectTries++,o.ws&&(o.ws.onopen=null,o.ws.onclose=null,o.ws.onmessage=null,o.ws=void 0),o.keepAliveTimeout&&clearInterval(o.keepAliveTimeout),setTimeout(()=>{o.connect()},0)):o.connectStatus=exports.ConnectionStatus.Lost},o.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&&o.emitter.emit(e,new H(n))}},o.emitter=new t.EventEmitter,o.keepAlive=i,o}return f(r,[{key:"connectStatus",get:function(){return this._connectStatus},set:function(e){this.emitter.emit("ConnectionStatus",new H(e)),this._connectStatus=e}},{key:"currentWs",get:function(){return this.ws}},{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.api.isShared&&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")}}]),r}(),H=f((function e(t){h(this,e),this.data=t})),G=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),z=function(e){d(n,G);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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:i}=r;if(i.taskId===e&&i.status&&["Completed","Failed","Canceled"].includes(i.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}();const V=["name"],J=["name"],Q=["name"],K=["name","id"],X=["name","id"],Y=["name","id"],Z=["name","x","y","z"],$=["name"],ee=["name"],te=["name"],ne=["name"],re=["name"],se=["name"],ie=["name"],oe=["name"],ae=["name"],ue=["name"],le=["name"],ce=["layerName"];let pe=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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:"deleteResources",value:function(e){return this.http.delete("/layers",null,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:"getLayersInfo",value:function(e){return this.http.get("/layers/batchInfo",e).json()}},{key:"publishProxyService",value:function(e){return this.http.post("/layers",e,{type:"ProxyService"}).json()}},{key:"publishRouteService",value:function(e){return this.http.post("/layers",e,{type:"RouteService"}).then(()=>{})}},{key:"publishLinearService",value:function(e){return this.http.post("/layers",e,{type:"LinearService"}).then(()=>{})}},{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:"publishStyledLayerService",value:function(e){return this.http.post("/layers",e,{type:"StyledFeatureLayer"}).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:"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,V);return this.http.get("/layers/"+t+"/features",n).json()}},{key:"deleteFeature",value:function(e){let{name:t}=e,n=g(e,J);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:"featuresContains",value:function(e){let{name:t}=e,n=g(e,Q);return this.http.get("/layers/"+t+"/features/contains",n).json()}},{key:"getById",value:function(e){let{name:t,id:n}=e,r=g(e,K);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,X);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,Y);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,i=g(e,Z);return this.http.createUrl("/layers/"+t+"/tile/"+s+"/"+n+"/"+r,i)}},{key:"getLayerImage",value:function(e){let{name:t}=e,n=g(e,$);return this.http.createUrl("/layers/"+t+"/export",n)}},{key:"getLayerExtent",value:function(e){let{name:t}=e,n=g(e,ee);return this.http.get("/layers/"+t+"/extent",n).json()}},{key:"getByGeometry",value:function(e){let{name:t}=e,n=g(e,te);return this.http.get("/layers/"+t+"/features/getByGeometry",n).json()}},{key:"getByGeometryPost",value:function(e,t){let{name:n}=e,r=g(e,ne);return this.http.post("/layers/"+n+"/features/getByGeometry",t,r).json()}},{key:"deleteFeatures",value:function(e){let{name:t}=e,n=g(e,re);return this.http.delete("/layers/"+t+"/features/deleteByIds",null,n).json()}},{key:"deleteByCondition",value:function(e){let{name:t}=e,n=g(e,se);return this.http.delete("/layers/"+t+"/features/deleteByCondition",null,n).json()}},{key:"getByGeometryGet",value:function(e){let{name:t}=e,n=g(e,ie);return this.http.get("/layers/"+t+"/features/getByGeometryByClick",n).json()}},{key:"classify",value:function(e){let{name:t}=e,n=g(e,oe);return this.http.get("/layers/"+t+"/classify",n).json()}},{key:"distincts",value:function(e){let{name:t}=e,n=g(e,ae);return this.http.get("/layers/"+t+"/distincts",n).json()}},{key:"aggregateAttribute",value:function(e){let{name:t}=e,n=g(e,ue);return this.http.get("/layers/"+t+"/aggregate-values",n).json()}},{key:"getFilteredFeaturesCount",value:function(e){let{name:t}=e,n=g(e,le);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,ce);return this.http.get("/layers/"+t+"/validateExpression",n).json()}},{key:"createRoute",value:function(e,t){return this.http.post("/layers/"+e+"/createRoute",t).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",I(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/layers/"+e+"/preview",null).then(()=>{})}},{key:"isExists",value:function(e){return this.http.get("/layers/"+e+"/exists").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 he(e){return(await Promise.all(e.map(e=>e.catch(e=>ye(e)?e:new Error(e))))).filter(fe)}function ye(e){return e instanceof Error}function fe(e){return!ye(e)}const ve=["remote"];let de=function(e){d(n,pe);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getLayerInfos",value:function(e){return he(e.map(e=>this.getLayerInfo(e)))}},{key:"getLayersDeps",value:function(e){return he(e.map(e=>this.getResourceDependencies(e)))}},{key:"getBasemaps",value:function(e){return this.getLayersList(v({},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,ve);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}();const ke=["name"],ge=["name"],me=["name"],be=["name"];let we=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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:"deleteResources",value:function(e){return this.http.delete("/tables",null,e).json()}},{key:"updateTable",value:function(e,t){return this.http.patch("/tables/"+e,t).json()}},{key:"putTable",value:function(e,t){return this.http.put("/tables/"+e,t).json()}},{key:"getTableInfo",value:function(e){return this.http.get("/tables/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/tables/"+e,null).then(()=>{})}},{key:"getTablesInfo",value:function(e){return this.http.get("/tables/batchInfo",e).json()}},{key:"getTableData",value:function(e){let{name:t}=e,n=g(e,ke);return this.http.get("/tables/"+t+"/data",n).json()}},{key:"writeTableData",value:function(e,t){return this.http.post("/tables/"+e+"/data",t).then(()=>{})}},{key:"updateTableData",value:function(e,t){let{name:n}=e,r=g(e,ge);return this.http.patch("/tables/"+n+"/data",t,r).then(()=>{})}},{key:"deleteTableData",value:function(e){let{name:t}=e,n=g(e,me);return this.http.delete("/tables/"+t+"/data",null,n).then(()=>{})}},{key:"getUniqueDataRows",value:function(e){let{name:t}=e,n=g(e,be);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,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",I(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/tables/"+e+"/preview",null).then(()=>{})}},{key:"isExists",value:function(e){return this.http.get("/tables/"+e+"/exists").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}(),xe=function(e){d(n,we);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getTableInfos",value:function(e){return he(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}(),Te=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{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:"deleteResources",value:function(e){return this.http.delete("/projects",null,e).json()}},{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:"getProjectsInfo",value:function(e){return this.http.get("/projects/batchInfo",e).json()}},{key:"getProjectLayersExtendedInfo",value:function(e){return this.http.get("/projects/"+e+"/extended-info").json()}},{key:"getTilesLayerImage",value:function(e,t,n,r){return this.http.createUrl("/projects/"+e+"/tile/"+r+"/"+t+"/"+n)}},{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",I(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/projects/"+e+"/preview",null).then(()=>{})}},{key:"isExists",value:function(e){return this.http.get("/projects/"+e+"/exists").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}(),je=function(e){d(n,Te);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getProjectInfos",value:function(e){return he(e.map(e=>this.getProjectInfo(e)))}},{key:"getProjectsDeps",value:function(e){return he(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 Se(e,t,n){return n.indexOf(e)===t}function Pe(e){return"string"==typeof e}var Ie;(Ie=exports.DependencyType||(exports.DependencyType={})).Layer="Layer",Ie.Table="Table",Ie.Project="Project";let Ce=function(){function e(t,n,r){h(this,e),this.projects=t,this.layers=n,this.tables=r}return f(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(Se)),layers:await this.layers.getLayerInfos(s.filter(Se))}}},{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(Pe)}}]),e}(),Re=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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()}},{key:"addFont",value:function(e){return this.http.post("/styles/fonts",I(e)).then(()=>{})}},{key:"removeFont",value:function(e){return this.http.delete("/styles/fonts",null,e).then(()=>{})}}]),n}(),Le=function(e){d(n,Re);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}();const Ee=["providerName"],Ue=["providerName"],Fe=["providerName"];let Ne=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"geocode",value:function(e){let{providerName:t}=e,n=g(e,Ee);return this.http.get("/geocode/"+t,n).json()}},{key:"geocodeByPoint",value:function(e){let{providerName:t}=e,n=g(e,Ue);return this.http.get("/geocode/"+t+"/geocodeByPoint",n).json()}},{key:"suggest",value:function(e){let{providerName:t}=e,n=g(e,Fe);return this.http.get("/geocode/"+t+"/suggest",n).json()}}]),n}(),De=function(e){d(n,Ne);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"geocode2Gis",value:function(e){return this.geocode(v({providerName:"geocode2gis"},e))}},{key:"suggest2Gis",value:function(e){return this.suggest(v({providerName:"geocode2gis"},e))}}]),n}(),Ae=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"checkLimits",value:function(e){return this.http.get("/resources/checkLimits",e).json()}},{key:"copyResources",value:function(e){return this.http.post("/resources/copy",e).json()}}]),n}(),Oe=function(e){d(n,Ae);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),Be=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),Me=function(e){d(n,Be);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),_e=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getServerInfo",value:function(){return this.http.get("/").json()}},{key:"cancelTest",value:function(e){return this.http.get("/cancel",e).then(()=>{})}},{key:"getFunctionsList",value:function(){return this.http.get("/functions").json()}}]),n}(),We=function(e){d(n,_e);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),qe=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),He=function(e){d(n,qe);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),Ge=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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",I(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){return this.http.patch("/account/password/set",e).then(()=>{})}},{key:"changePassword",value:function(e){return this.http.patch("/account/password/change",I(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",I(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:"ldapLogin",value:function(e){return this.http.post("/account/external/login/ldap",e).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 ze=()=>JSON.parse(localStorage.getItem("@evergis/user-info")||"null")||void 0,Ve=e=>{if(e){const t=ze();localStorage.setItem("@evergis/user-info",JSON.stringify(v({},t,e)))}else localStorage.removeItem("@evergis/user-info")};let Je=function(e){d(n,Ge);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"login",value:async function(e){e&&await T(k(n.prototype),"authenticate",this).call(this,e)}},{key:"fetchCurrentUser",value:async function(){return this.userInfo=await this.getUserInfo(""),this.userInfo}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}},{key:"logout",value:async function(){await this.revokeToken(),Ve(void 0),this.userInfo={}}},{key:"updateCurrentUser",value:async function(e){await T(k(n.prototype),"updateUser",this).call(this,v({username:this.username},e)),Ve(e)}},{key:"setPassword",value:function(e){return this.setUserPassword({username:this.username,password:e})}},{key:"isAuth",get:function(){var e;return!(null==(e=this.userInfo)||!e.username)&&"public"!==this.userInfo.username}},{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=ze();return e&&(this.userInfo=e),e}}]),n}();const Qe=["username"];let Ke=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getPreview",value:function(e){return this.http.createUrl("/account/user/preview/"+e)}},{key:"uploadPreview",value:function(e,t){let{username:n}=e,r=g(e,Qe);return this.http.post("/account/user/preview/"+n,I(t),r).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/account/user/preview/"+e,null).then(()=>{})}}]),n}(),Xe=function(e){d(n,Ke);var t=w(n);function n(e,r){var s;return h(this,n),(s=t.call(this,e)).userInfo=r,s}return f(n,[{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=ze();return e&&(this.userInfo=e),e}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}},{key:"updateCurrentUserPhoto",value:async function(e,t){const{fileId:n}=await this.uploadPreview(v({username:this.username},t),{file:e});Ve({profile_photo:n,has_profile_photo:!0})}},{key:"fetchPreview1",value:async function(){var e;const t=this.getPreview(""),n=await fetch(t),r=null!=(e=n.headers.get("content-type"))&&e.includes("text/plain")?await n.text():t+"?r="+Math.random();Ve({profile_photo:r,has_profile_photo:!0})}},{key:"deleteCurrentUserPhoto",value:async function(){await this.deletePreview(this.username),Ve({profile_photo:"",has_profile_photo:!1})}}]),n}(),Ye=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),Ze=function(e){d(n,Ye);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),$e=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getConfigurationsList",value:function(e){return this.http.get("/settings/config",e).json()}},{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:"removeConfiguration",value:function(e){return this.http.delete("/settings",null,e).then(()=>{})}}]),n}(),et=function(e){d(n,$e);var t=w(n);function n(){var e;return h(this,n),(e=t.apply(this,arguments)).settings={modules:[],connection:{url:""}},e}return f(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}(),tt=function(e){d(n,$e);var t=w(n);function n(){var e;return h(this,n),(e=t.apply(this,arguments)).config=null,e}return f(n,[{key:"fetchPortalSettings",value:async function(e){return this.config=JSON.parse(await this.getConfiguration(e)),this.config}}]),n}();var nt;(nt=exports.ErrorReason||(exports.ErrorReason={})).HTTP_OTHER="other",nt.HTTP_CLIENT="client",nt.HTTP_SERVER="server",nt.UNKNOWN="unknown";const rt=e=>e instanceof r.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),st=e=>e&&e.type&&e.reason;function it(e){return function(t){return!!t.type&&e.includes(t.type)}}const ot=it(["PostgresLayerService","PostgresTileLayerService"]),at=o.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",12);(exports.ResourceSeparator||(exports.ResourceSeparator={})).Server=".";let ut=function(){function e(t){let{account:n}=t;h(this,e),this.account=n}return f(e,[{key:"createId",value:function(){return at()}},{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(v({workspace:"temp"},e))}},{key:"extractResource",value:function(e){if(e&&e.includes(exports.ResourceSeparator.Server)){const t=e.split(exports.ResourceSeparator.Server),n=t.pop();return{workspace:t.join(exports.ResourceSeparator.Server),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}(),lt=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"startTask",value:function(e){return this.http.post("/ice-router/tasks",e).text()}},{key:"getResult",value:function(e){return this.http.get("/ice-router/tasks/"+e).json()}}]),n}(),ct=function(e){d(n,lt);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),pt=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"statisticsDb",value:function(e){return this.http.get("/statistics",e).json()}},{key:"classify",value:function(e){return this.http.get("/statistics/classify",e).json()}},{key:"sumOfProduct",value:function(e){return this.http.get("/statistics/sumOfProduct",e).json()}}]),n}(),ht=function(e){d(n,pt);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getStatistic",value:function(e){return this.statisticsDb(e)}},{key:"getClassify",value:function(e){return this.classify(e)}}]),n}(),yt=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"increaseResourcesLimit",value:function(e){return this.http.post("/feedback/limits",null,e).json()}},{key:"moreSymbols",value:function(e){return this.http.post("/feedback/symbol",null,e).json()}},{key:"feedback",value:function(e,t){return this.http.post("/feedback",I(t),e).json()}}]),n}(),ft=function(e){d(n,yt);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"postFeedback",value:function(e,t){return this.feedback(e,t)}}]),n}();const vt=["name","z","x","y"];let dt=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getVectorTile",value:function(e){let{name:t,z:n,x:r,y:s}=e,i=g(e,vt);return this.http.get("/vt/"+t+"/"+n+"/"+r+"/"+s+".pbf",i).then(()=>{})}}]),n}(),kt=function(e){d(n,dt);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getVt",value:function(e,t,n,r,s){return this.getVectorTile({name:e,z:t,x:n,y:r,isProject:s})}}]),n}(),gt=function(e){d(n,R);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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",I(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}(),mt=function(e){d(n,gt);var t=w(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}();var bt;(bt=exports.UrlPath||(exports.UrlPath={})).Base="/map",bt.Shared="/shared",bt.Portal="/portal";const wt={401:exports.ApiEvent.Unauthorized},xt=Object.values(exports.UrlPath),Tt=xt[0];let jt=function(e){d(i,t.EventEmitter);var s=w(i);function i(e){var t;let{url:o,wsUrl:a,wsKeepAlive:u,snappingHubUrl:l,http:c,urlPath:p,httpOptions:y}=e;h(this,i),t=s.call(this);const{hooks:f}=y||{};return t.http=c||new j(v({prefixUrl:o,timeout:!1},y||{},{hooks:v({},f||{},{beforeRequest:[...f&&f.beforeRequest||[]],afterResponse:[e=>{const n=wt[e.status];return n&&t.emit(n,rt(new r.HTTPError(e))),e},...f&&f.afterResponse||[]]})})),t.url=o,t.wsUrl=a||o,t.urlPath=p||t.defineUrlPath(),t.layers=new de(t.http),t.tables=new xe(t.http),t.projects=new je(t.http),t.resources=new Ce(t.projects,t.layers,t.tables),t.styles=new Le(t.http),t.account=new Je(t.http),t.accountPreview=new Xe(t.http,t.account),t.bulk=new E(t.http),t.security=new F(t.http,t.account),t.notification=new q(t.http,m(t),u),t.scheduler=new z(t.http),t.file=new D(t.http),t.filters=new O(t.http),t.import=new M(t.http),t.geocode=new De(t.http),t.print=new mt(t.http),t.tools=new Me(t.http),t.resourceCatalog=new Oe(t.http),t.general=new We(t.http),t.namespace=new He(t.http),t.external=new Ze(t.http),t.clientSettings=new et(t.http),t.portalSettings=new tt(t.http),t.iceRouter=new ct(t.http),t.statistic=new ht(t.http),t.feedback=new ft(t.http),t.vectorTiles=new kt(t.http),t.names=new ut({account:t.account}),t.snappingHub=l?(new n.HubConnectionBuilder).withUrl(l,{withCredentials:!0,skipNegotiation:!0,transport:n.HttpTransportType.WebSockets}).withAutomaticReconnect().build():null,t}return f(i,[{key:"init",value:async function(e){let{authParams:t,connectWs:n,initScheduler:r,fetchSettings:s,fetchUser:i}=e;try{await this.account.login(t),i&&await this.account.fetchCurrentUser(),n&&await this.connectWs(),r&&await this.initScheduler(),s&&await this.clientSettings.fetchClientSettings({urlPath:this.urlPath}),await this.notification.subscribe("service_update")}catch(e){throw rt(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 rt(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:"connectSignalR",value:async function(){this.account.isAuth&&this.snappingHub&&this.snappingHub.state!==n.HubConnectionState.Connected&&await this.snappingHub.start()}},{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&&xt.includes(t)?t:Tt}},{key:"isShared",get:function(){return this.urlPath===exports.UrlPath.Shared}}]),i}(),St=function(e){d(n,l.TileLayer);var t=w(n);function n(e,r){var s;return h(this,n),(s=t.call(this,"",{crs:e.crs,opacity:e.opacity})).api=r,s.name=e.name,s.sourceUrl=e.sourceUrl,s.subDomains=e.subDomains,s}return f(n,[{key:"getTileUrl",value:function(e,t,n){var r;const s=this.name,i=this.subDomains?function(e,t){void 0===e&&(e=0),void 0===t&&(t=100);let n=t-e,r=Math.random();return r=Math.floor(r*n),r+=e,r}(0,(null==(r=this.subDomains)?void 0:r.length)-1):void 0;return this.sourceUrl?(this.subDomains&&void 0!==i?this.sourceUrl.replace("{0}",this.subDomains[i]):this.sourceUrl).replace("{1}",""+n).replace("{2}",""+e).replace("{3}",""+t):this.api.layers.getTilesLayerImage({x:e,y:t,z:n,name:s})}}]),n}();const Pt=["name","style","condition","dataFilterId"];let It=function(e){d(n,c.DynamicLayer);var t=w(n);function n(e,r){var s;let{name:i,style:o,condition:a,dataFilterId:u}=e,l=g(e,Pt);return h(this,n),(s=t.call(this,l)).api=r,s.name=i,s.styleId=o,s.conditionQuery=a,s.filterId=u,s.subscribeRedraw(),s}return f(n,[{key:"style",get:function(){return this.styleId},set:function(e){this.styleId=e,this.forceUpdate()}},{key:"condition",get:function(){return this.conditionQuery},set:function(e){this.conditionQuery=e,this.forceUpdate()}},{key:"dataFilterId",get:function(){return this.filterId},set:function(e){this.filterId=e,this.forceUpdate()}},{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,dataFilterId:this.filterId})}},{key:"subscribeRedraw",value:function(){this.api.notification.on("service_update",e=>{(null==e?void 0:e.data.layerName)===this.name&&(this.forceUpdate(),this.redraw())})}}]),n}();const Ct={RemoteTileService:St,LocalTileService:St,PostgresLayerService:It,StyledFeatureLayer:It,CompositeService:null};let Rt=function(){function e(t,n){h(this,e),this.layers=t,this.http=n}return f(e,[{key:"getLayerService",value:async function(e){let t=await this.getLayerInfo(e);const n=t.type;if(!(e=>Boolean(e&&Object.keys(Ct).includes(e)))(n))return;const r=Ct[n];if(r)return new r((e=>v({},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 Lt;!function(e){e[e.BaseMaps=0]="BaseMaps",e[e.Layers=1]="Layers"}(Lt||(Lt={}));let Et=function(e){d(n,jt);var t=w(n);function n(e,r,s){var i;return h(this,n),(i=t.call(this,r)).map=new u.Map,i.painter=new a.DomPainter(i.map),i.mapProps=e,i.auth=s,i.layersManager=new Rt(i.layers,i.http),i}return f(n,[{key:"init",value:async function(){await T(k(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,Lt.Layers)}},{key:"setBaseMap",value:async function(e){await this.insertLayer(e,Lt.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(Ut);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 Ut=e=>void 0!==e;var Ft,Nt,Dt,At,Ot,Bt,Mt,_t,Wt,qt,Ht,Gt,zt,Vt,Jt,Qt,Kt,Xt,Yt,Zt,$t,en,tn,nn,rn,sn;(Ft=exports.AggregationFunction||(exports.AggregationFunction={})).None="None",Ft.Array="Array",Ft.Min="Min",Ft.Max="Max",Ft.Avg="Avg",Ft.Sum="Sum",Ft.Extent="Extent",Ft.H3="H3",Ft.Count="Count",Ft.TotalCount="TotalCount",Ft.DistinctCount="DistinctCount",Ft.First="First",Ft.Last="Last",Ft.Median="Median",Ft.Mod="Mod",Ft.StdDeviation="StdDeviation",Ft.SumOfProduct="SumOfProduct",Ft.OnlyValue="OnlyValue",Ft.WeightedAvg="WeightedAvg",Ft.DensityIndicators="DensityIndicators",Ft.DividedSum="DividedSum",(Nt=exports.AttributeType||(exports.AttributeType={})).Unknown="Unknown",Nt.String="String",Nt.Int32="Int32",Nt.Int64="Int64",Nt.Double="Double",Nt.DateTime="DateTime",Nt.Boolean="Boolean",Nt.Point="Point",Nt.Polyline="Polyline",Nt.Polygon="Polygon",Nt.Multipoint="Multipoint",Nt.H3Index="H3Index",(Dt=exports.ClassificationType||(exports.ClassificationType={})).None="none",Dt.NaturalBreaks="naturalBreaks",Dt.EqualInterval="equalInterval",Dt.Quantile="quantile",Dt.Unique="unique",(At=exports.ClassifyAttributeType||(exports.ClassifyAttributeType={})).Decimal="decimal",At.DateTime="dateTime",At.Text="text",(Ot=exports.ConfigurationErrorEnum||(exports.ConfigurationErrorEnum={})).Unknown="Unknown",Ot.SerializeError="SerializeError",Ot.InvalidDataService="InvalidDataService",Ot.InvalidConfiguration="InvalidConfiguration",Ot.InvalidDataServiceName="InvalidDataServiceName",Ot.InvalidTableName="InvalidTableName",Ot.InvalidLayerName="InvalidLayerName",Ot.ResourceNotFound="ResourceNotFound",Ot.InvalidCondition="InvalidCondition",Ot.InvalidAttributes="InvalidAttributes",Ot.InvalidIdAttribute="InvalidIdAttribute",Ot.InvalidGeometryAttribute="InvalidGeometryAttribute",Ot.InvalidGeometryAttributeType="InvalidGeometryAttributeType",Ot.InvalidColumnName="InvalidColumnName",Ot.InvalidIdColumnSettings="InvalidIdColumnSettings",Ot.ColumnNotExistsInTable="ColumnNotExistsInTable",Ot.InvalidStyle="InvalidStyle",Ot.InvalidLayerType="InvalidLayerType",Ot.ColumnLoadingError="ColumnLoadingError",Ot.InvalidAttributeFormat="InvalidAttributeFormat",Ot.DataSourceNotFound="DataSourceNotFound",Ot.DuplicateColumns="DuplicateColumns",Ot.DuplicateAttributes="DuplicateAttributes",Ot.TableWithoutColumns="TableWithoutColumns",Ot.InvalidTableReferenceConfiguration="InvalidTableReferenceConfiguration",(Bt=exports.ErrorDetailsType||(exports.ErrorDetailsType={})).ResourceLimitExceeded="ResourceLimitExceeded",Bt.ResourceNotFound="ResourceNotFound",Bt.InternalError="InternalError",Bt.BadRequest="BadRequest",Bt.DuplicateContent="DuplicateContent",(Mt=exports.ErrorType||(exports.ErrorType={})).NotSpecified="NotSpecified",Mt.LimitError="LimitError",Mt.ValidationError="ValidationError",Mt.JwtExpired="JwtExpired",Mt.TokenInvalid="TokenInvalid",Mt.RefreshTokenExpired="RefreshTokenExpired",Mt.RefreshTokenInvalid="RefreshTokenInvalid",Mt.CreateUserFailed="CreateUserFailed",Mt.SetUserPasswordFailed="SetUserPasswordFailed",Mt.SetUserRoleFailed="SetUserRoleFailed",Mt.UpdateUserFailed="UpdateUserFailed",Mt.RemoveUserFailed="RemoveUserFailed",Mt.CreateRoleFailed="CreateRoleFailed",Mt.UpdateRoleFailed="UpdateRoleFailed",Mt.RemoveUserRoleFailed="RemoveUserRoleFailed",Mt.ChangeActiveStateFailed="ChangeActiveStateFailed",Mt.RemoveRoleFailed="RemoveRoleFailed",Mt.UserNotFound="UserNotFound",Mt.RoleNotFound="RoleNotFound",Mt.EmailNotConfirmed="EmailNotConfirmed",Mt.DuplicateEmailError="DuplicateEmailError",Mt.InvalidPassword="InvalidPassword",Mt.RoleExists="RoleExists",Mt.UserExists="UserExists",Mt.UserLockedError="UserLockedError",Mt.InvalidEmail="InvalidEmail",Mt.InvalidUsername="InvalidUsername",Mt.Unauthorized="Unauthorized",Mt.EmailNotChanged="EmailNotChanged",Mt.EmailNotSet="EmailNotSet",(_t=exports.FeatureType||(exports.FeatureType={})).Unknown="Unknown",_t.GeometricFeature="GeometricFeature",(Wt=exports.FontStyle||(exports.FontStyle={})).Normal="normal",Wt.Oblique="oblique",Wt.Italic="italic",(qt=exports.FontWeight||(exports.FontWeight={})).Thin="Thin",qt.ExtraLight="ExtraLight",qt.Light="Light",qt.SemiLight="SemiLight",qt.Normal="Normal",qt.Medium="Medium",qt.DemiBold="DemiBold",qt.Bold="Bold",qt.ExtraBold="ExtraBold",qt.Black="Black",qt.ExtraBlack="ExtraBlack",(Ht=exports.GeometryType||(exports.GeometryType={})).Unknown="unknown",Ht.Point="point",Ht.Polyline="polyline",Ht.Polygon="multipolygon",Ht.Envelope="envelope",Ht.Multipoint="multipoint",(Gt=exports.Group||(exports.Group={})).My="my",Gt.Role="role",Gt.Public="public",Gt.All="all",(zt=exports.LineEndingSize||(exports.LineEndingSize={})).Small="small",zt.Large="large",(Vt=exports.LineEndingType||(exports.LineEndingType={})).None="none",Vt.Arrow="arrow",Vt.FilledArrow="filledArrow",Vt.Square="square",Vt.FilledSquare="filledSquare",Vt.Circle="circle",Vt.FilledCircle="filledCircle",(Jt=exports.Operation||(exports.Operation={})).Unknown="Unknown",Jt.Union="union",Jt.Intersection="intersection",Jt.Subtraction="subtraction",Jt.SymDifference="symDifference",(Qt=exports.Permissions||(exports.Permissions={})).None="none",Qt.Configure="configure",Qt.Write="write",Qt.Read="read",Qt.ReadConfigure="read,configure",Qt.ReadWrite="read,write",Qt.All="read,write,configure",(Kt=exports.PolicyType||(exports.PolicyType={})).Unknown="Unknown",Kt.CreateTable="CreateTable",Kt.CreateLayer="CreateLayer",Kt.CreateProject="CreateProject",Kt.MaxFeaturesInOneTable="MaxFeaturesInOneTable",Kt.MaxObjectsToExport="MaxObjectsToExport",Kt.MaxUploadContentSize="MaxUploadContentSize",(Xt=exports.ReferenceJoinType||(exports.ReferenceJoinType={})).OneToMany="OneToMany",Xt.OneToOne="OneToOne",Xt.Intersect="Intersect",(Yt=exports.ResourceType||(exports.ResourceType={})).Unknown="Unknown",Yt.Table="table",Yt.Layer="layer",Yt.Project="project",Yt.File="file",Yt.Feature="feature",Yt.Tag="tag",(Zt=exports.ResourceTypeLink||(exports.ResourceTypeLink={})).Table="tables",Zt.Layer="layers",Zt.Project="projects",($t=exports.ServerTaskStatus||(exports.ServerTaskStatus={})).None="None",$t.Scheduled="Scheduled",$t.Planning="Planning",$t.Executing="Executing",$t.Completed="Completed",$t.Failed="Failed",$t.Canceled="Canceled",$t.Timeout="Timeout",(en=exports.SimplifyType||(exports.SimplifyType={})).Basic="Basic",en.PreserveTopology="PreserveTopology",en.VW="VW",(tn=exports.StringSubType||(exports.StringSubType={})).None="None",tn.Image="Image",tn.PkkCode="PkkCode",(nn=exports.TaskGroup||(exports.TaskGroup={})).My="my",nn.All="all",(rn=exports.TextAlignment||(exports.TextAlignment={})).Right="right",rn.Left="left",rn.Center="center",rn.Justified="justified",(sn=exports.TextVerticalAlignment||(exports.TextVerticalAlignment={})).Top="top",sn.Bottom="bottom",sn.Middle="middle",Object.defineProperty(exports,"HTTPError",{enumerable:!0,get:function(){return r.HTTPError}}),Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:function(){return r.TimeoutError}}),exports.Account=Je,exports.AccountPreview=Xe,exports.Api=jt,exports.BulkOperations=E,exports.ClientSettings=et,exports.EvergisDynamicLayer=It,exports.EvergisTileLayer=St,exports.External=Ze,exports.Feedback=ft,exports.FileUpload=D,exports.Filters=O,exports.GEOCODE_PROVIDER="geocode2gis",exports.General=We,exports.Geocode=De,exports.HttpClient=j,exports.IceRouter=ct,exports.Import=M,exports.Layers=de,exports.LayersManager=Rt,exports.Names=ut,exports.Namespace=He,exports.Notification=q,exports.NotificationEvent=H,exports.PortalSettings=tt,exports.Projects=je,exports.ResourceCatalog=Oe,exports.Resources=Ce,exports.Scheduler=z,exports.Security=F,exports.SpatialProcessor=Et,exports.Statistic=ht,exports.Styles=Le,exports.Tables=xe,exports.Tools=Me,exports.VectorTiles=kt,exports.addSubDomainToLocation=e=>window.location.protocol+"//"+e+"."+window.location.host,exports.errorHandler=rt,exports.formDataFromFile=function(e){const t=new FormData;return t.append("file",e),t},exports.generateId=at,exports.isEvergisDynamicLayer=function(e){return e instanceof It},exports.isEvergisTileLayer=function(e){return e instanceof St},exports.isFeatureLayer=function(e){return e instanceof p.FeatureLayer},exports.isHTTPError=e=>st(e)&&"http"===e.type,exports.isHandledError=st,exports.isLayer=ot,exports.isProjectContentItems=function(e){return null!=e},exports.isString=Pe,exports.isTileLayerService=function(e){return e.type&&/TileService/.test(e.type)},exports.promiseAllIgnoreErrors=he,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=I,exports.unique=Se; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@evergis/event-emitter"),n=require("@microsoft/signalr"),r=require("ky"),s=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,i=require("query-string"),o=require("nanoid"),a=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),u=require("@evergis/sgis/es/Map"),l=require("@evergis/sgis/es/layers/TileLayer"),c=require("@evergis/sgis/es/layers/DynamicLayer"),p=require("@evergis/sgis");function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(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 f(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),e}function v(){return(v=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 k(e){return(k=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={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(s[n]=e[n]);return s}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?m(e):t}function x(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=k(e);if(t){var s=k(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return b(this,n)}}function w(e,t,n){return(w="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=k(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(){function e(t){var n;void 0===t&&(t={}),h(this,e),this.ky=s.extend(t),this.prefixUrl=(null==(n=t.prefixUrl)?void 0:n.toString())||""}return f(e,[{key:"extend",value:function(e){var t;this.ky=s.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:S(t)})}},{key:"post",value:function(e,t,n){const r=j(n,t);return this.ky.post(this.stripSlashes(e),r)}},{key:"put",value:function(e,t,n){const r=j(n,t);return this.ky.put(this.stripSlashes(e),r)}},{key:"patch",value:function(e,t,n){const r=j(n,t);return this.ky.patch(this.stripSlashes(e),r)}},{key:"delete",value:function(e,t,n){const r=j(n,t);return this.ky.delete(this.stripSlashes(e),r)}},{key:"createUrl",value:function(e,t){const n=t?"?"+S(t):"";return this.prefixUrl+this.stripSlashes(e)+n}},{key:"stripSlashes",value:function(e){return this.prefixUrl?e.replace(/^\//g,""):e}}]),e}();function j(e,t){const n={searchParams:S(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 S(e){return void 0===e&&(e={}),i.stringify(e,{arrayFormat:"comma"})}function P(e){return e instanceof FormData?e:Object.keys(e).reduce((t,n)=>(t.append(n,e[n]),t),new FormData)}var I;(I=exports.ApiEvent||(exports.ApiEvent={})).ConnectionLost="ConnectionLost",I.Unauthorized="Unauthorized",I.SessionClosed="SessionClosed";let C=f((function e(t){h(this,e),this.http=t})),R=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"batchResourcesPermissionsSet",value:function(e){return this.http.put("/bulk/resources/permissions",e).json()}}]),n}(),L=function(e){d(n,R);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),E=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"findUserByNameByRoles",value:function(e){return this.http.get("/security/findUsersWithRoles",e).json()}},{key:"getUsersAndRoles",value:function(e){return this.http.get("/security/usersandroles",e).json()}},{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}(),U=function(e){d(n,E);var t=x(n);function n(e,r){var s;let{username:i,roles:o}=r;return h(this,n),(s=t.call(this,e)).ownerName="",s.ownerRoles=[],s.ownerName=i,s.ownerRoles=o,s}return f(n,[{key:"reset",value:function(){this.ownerName="",this.ownerRoles=[]}}]),n}(),F=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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",P(e)).json()}},{key:"deleteFile",value:function(e){return this.http.delete("/upload/file",null,e).then(()=>{})}},{key:"getFileInfo",value:function(e){return this.http.get("/upload/fileInfo",e).json()}}]),n}(),N=function(e){d(n,F);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"upload",value:function(e,t){return this.uploadFile({file:e,rewrite:!!t})}}]),n}(),D=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"get",value:function(e){return this.http.get("/filters/"+e).text()}},{key:"update",value:function(e,t){return this.http.post("/filters/"+e,t).json()}},{key:"create",value:function(e){return this.http.post("/filters",e).json()}}]),n}(),A=function(e){d(n,D);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),O=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getDataSchema",value:function(e){return this.http.get("/import/dataSchema",e).json()}},{key:"getFeaturesCount",value:function(e){return this.http.post("/import/count",e).json()}},{key:"readPart",value:function(e){return this.http.get("/import/read",e).then(()=>{})}},{key:"getExternalWmsLayers",value:function(e){return this.http.get("/import/wms",e).json()}},{key:"getExternalPbfLayers",value:function(e){return this.http.get("/import/pbf",e).json()}},{key:"getExternalArcGisLayers",value:function(e){return this.http.get("/import/arcgismapservice",e).json()}},{key:"getRasterAttributes",value:function(e){return this.http.get("/import/rasterAttributes",e).json()}}]),n}(),B=function(e){d(n,O);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),M=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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 _;(_=exports.ConnectionStatus||(exports.ConnectionStatus={})).Initialized="Initialized",_.Connected="Connected",_.Break="Break",_.Lost="Lost",_.SessionClosed="SessionClosed";let W=function(e){d(r,M);var n=x(r);function r(e,s,i){var o;return void 0===i&&(i=!1),h(this,r),(o=n.call(this,e)).api=s,o.MAX_WS_RECONNECT_TRIES=10,o.keepAlive=!1,o.reconnectTries=0,o.subscriptions=[],o._connectStatus=exports.ConnectionStatus.Initialized,o.onWsConnected=()=>{o.connectStatus=exports.ConnectionStatus.Connected,o.keepAlive&&(o.keepAliveTimeout=setInterval(()=>{o.ws&&o.ws.send(JSON.stringify({keepAlive:!0}))},5e3))},o.onWsClosed=e=>{4001===e.code||4002===e.code?o.connectStatus=exports.ConnectionStatus.SessionClosed:o.reconnectTries<o.MAX_WS_RECONNECT_TRIES?(o.connectStatus=exports.ConnectionStatus.Break,o.reconnectTries++,o.ws&&(o.ws.onopen=null,o.ws.onclose=null,o.ws.onmessage=null,o.ws=void 0),o.keepAliveTimeout&&clearInterval(o.keepAliveTimeout),setTimeout(()=>{o.connect()},0)):o.connectStatus=exports.ConnectionStatus.Lost},o.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&&o.emitter.emit(e,new q(n))}},o.emitter=new t.EventEmitter,o.keepAlive=i,o}return f(r,[{key:"connectStatus",get:function(){return this._connectStatus},set:function(e){this.emitter.emit("ConnectionStatus",new q(e)),this._connectStatus=e}},{key:"currentWs",get:function(){return this.ws}},{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.api.isShared&&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")}}]),r}(),q=f((function e(t){h(this,e),this.data=t})),H=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),G=function(e){d(n,H);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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:i}=r;if(i.taskId===e&&i.status&&["Completed","Failed","Canceled"].includes(i.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}();const z=["name"],V=["name"],J=["name"],Q=["name","id"],K=["name","id"],X=["name","id"],Y=["name","x","y","z"],Z=["name"],$=["name"],ee=["name"],te=["name"],ne=["name"],re=["name"],se=["name"],ie=["name"],oe=["name"],ae=["name"],ue=["name"],le=["layerName"];let ce=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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:"deleteResources",value:function(e){return this.http.delete("/layers",null,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:"getLayersInfo",value:function(e){return this.http.get("/layers/batchInfo",e).json()}},{key:"publishProxyService",value:function(e){return this.http.post("/layers",e,{type:"ProxyService"}).json()}},{key:"publishRouteService",value:function(e){return this.http.post("/layers",e,{type:"RouteService"}).then(()=>{})}},{key:"publishLinearService",value:function(e){return this.http.post("/layers",e,{type:"LinearService"}).then(()=>{})}},{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:"publishStyledLayerService",value:function(e){return this.http.post("/layers",e,{type:"StyledFeatureLayer"}).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:"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,z);return this.http.get("/layers/"+t+"/features",n).json()}},{key:"deleteFeature",value:function(e){let{name:t}=e,n=g(e,V);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:"featuresContains",value:function(e){let{name:t}=e,n=g(e,J);return this.http.get("/layers/"+t+"/features/contains",n).json()}},{key:"getById",value:function(e){let{name:t,id:n}=e,r=g(e,Q);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,K);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,X);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,i=g(e,Y);return this.http.createUrl("/layers/"+t+"/tile/"+s+"/"+n+"/"+r,i)}},{key:"getLayerImage",value:function(e){let{name:t}=e,n=g(e,Z);return this.http.createUrl("/layers/"+t+"/export",n)}},{key:"getLayerExtent",value:function(e){let{name:t}=e,n=g(e,$);return this.http.get("/layers/"+t+"/extent",n).json()}},{key:"getByGeometry",value:function(e){let{name:t}=e,n=g(e,ee);return this.http.get("/layers/"+t+"/features/getByGeometry",n).json()}},{key:"getByGeometryPost",value:function(e,t){let{name:n}=e,r=g(e,te);return this.http.post("/layers/"+n+"/features/getByGeometry",t,r).json()}},{key:"deleteFeatures",value:function(e){let{name:t}=e,n=g(e,ne);return this.http.delete("/layers/"+t+"/features/deleteByIds",null,n).json()}},{key:"deleteByCondition",value:function(e){let{name:t}=e,n=g(e,re);return this.http.delete("/layers/"+t+"/features/deleteByCondition",null,n).json()}},{key:"getByGeometryGet",value:function(e){let{name:t}=e,n=g(e,se);return this.http.get("/layers/"+t+"/features/getByGeometryByClick",n).json()}},{key:"classify",value:function(e){let{name:t}=e,n=g(e,ie);return this.http.get("/layers/"+t+"/classify",n).json()}},{key:"distincts",value:function(e){let{name:t}=e,n=g(e,oe);return this.http.get("/layers/"+t+"/distincts",n).json()}},{key:"aggregateAttribute",value:function(e){let{name:t}=e,n=g(e,ae);return this.http.get("/layers/"+t+"/aggregate-values",n).json()}},{key:"getFilteredFeaturesCount",value:function(e){let{name:t}=e,n=g(e,ue);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,le);return this.http.get("/layers/"+t+"/validateExpression",n).json()}},{key:"createRoute",value:function(e,t){return this.http.post("/layers/"+e+"/createRoute",t).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",P(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/layers/"+e+"/preview",null).then(()=>{})}},{key:"isExists",value:function(e){return this.http.get("/layers/"+e+"/exists").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 pe(e){return(await Promise.all(e.map(e=>e.catch(e=>he(e)?e:new Error(e))))).filter(ye)}function he(e){return e instanceof Error}function ye(e){return!he(e)}const fe=["remote"];let ve=function(e){d(n,ce);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getLayerInfos",value:function(e){return pe(e.map(e=>this.getLayerInfo(e)))}},{key:"getLayersDeps",value:function(e){return pe(e.map(e=>this.getResourceDependencies(e)))}},{key:"getBasemaps",value:function(e){return this.getLayersList(v({},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,fe);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}();const de=["name"],ke=["name"],ge=["name"],me=["name"];let be=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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:"deleteResources",value:function(e){return this.http.delete("/tables",null,e).json()}},{key:"updateTable",value:function(e,t){return this.http.patch("/tables/"+e,t).json()}},{key:"putTable",value:function(e,t){return this.http.put("/tables/"+e,t).json()}},{key:"getTableInfo",value:function(e){return this.http.get("/tables/"+e).json()}},{key:"deleteResource",value:function(e){return this.http.delete("/tables/"+e,null).then(()=>{})}},{key:"getTablesInfo",value:function(e){return this.http.get("/tables/batchInfo",e).json()}},{key:"getTableData",value:function(e){let{name:t}=e,n=g(e,de);return this.http.get("/tables/"+t+"/data",n).json()}},{key:"writeTableData",value:function(e,t){return this.http.post("/tables/"+e+"/data",t).then(()=>{})}},{key:"updateTableData",value:function(e,t){let{name:n}=e,r=g(e,ke);return this.http.patch("/tables/"+n+"/data",t,r).then(()=>{})}},{key:"deleteTableData",value:function(e){let{name:t}=e,n=g(e,ge);return this.http.delete("/tables/"+t+"/data",null,n).then(()=>{})}},{key:"getUniqueDataRows",value:function(e){let{name:t}=e,n=g(e,me);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,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",P(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/tables/"+e+"/preview",null).then(()=>{})}},{key:"isExists",value:function(e){return this.http.get("/tables/"+e+"/exists").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}(),xe=function(e){d(n,be);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getTableInfos",value:function(e){return pe(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}(),we=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{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:"deleteResources",value:function(e){return this.http.delete("/projects",null,e).json()}},{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:"getProjectsInfo",value:function(e){return this.http.get("/projects/batchInfo",e).json()}},{key:"getProjectLayersExtendedInfo",value:function(e){return this.http.get("/projects/"+e+"/extended-info").json()}},{key:"getTilesLayerImage",value:function(e,t,n,r){return this.http.createUrl("/projects/"+e+"/tile/"+r+"/"+t+"/"+n)}},{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",P(t)).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/projects/"+e+"/preview",null).then(()=>{})}},{key:"isExists",value:function(e){return this.http.get("/projects/"+e+"/exists").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}(),Te=function(e){d(n,we);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getProjectInfos",value:function(e){return pe(e.map(e=>this.getProjectInfo(e)))}},{key:"getProjectsDeps",value:function(e){return pe(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 je(e,t,n){return n.indexOf(e)===t}function Se(e){return"string"==typeof e}var Pe;(Pe=exports.DependencyType||(exports.DependencyType={})).Layer="Layer",Pe.Table="Table",Pe.Project="Project";let Ie=function(){function e(t,n,r){h(this,e),this.projects=t,this.layers=n,this.tables=r}return f(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(je)),layers:await this.layers.getLayerInfos(s.filter(je))}}},{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(Se)}}]),e}(),Ce=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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()}},{key:"addFont",value:function(e){return this.http.post("/styles/fonts",P(e)).then(()=>{})}},{key:"removeFont",value:function(e){return this.http.delete("/styles/fonts",null,e).then(()=>{})}}]),n}(),Re=function(e){d(n,Ce);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}();const Le=["providerName"],Ee=["providerName"],Ue=["providerName"];let Fe=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"geocode",value:function(e){let{providerName:t}=e,n=g(e,Le);return this.http.get("/geocode/"+t,n).json()}},{key:"geocodeByPoint",value:function(e){let{providerName:t}=e,n=g(e,Ee);return this.http.get("/geocode/"+t+"/geocodeByPoint",n).json()}},{key:"suggest",value:function(e){let{providerName:t}=e,n=g(e,Ue);return this.http.get("/geocode/"+t+"/suggest",n).json()}}]),n}(),Ne=function(e){d(n,Fe);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"geocode2Gis",value:function(e){return this.geocode(v({providerName:"geocode2gis"},e))}},{key:"suggest2Gis",value:function(e){return this.suggest(v({providerName:"geocode2gis"},e))}}]),n}(),De=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"checkLimits",value:function(e){return this.http.get("/resources/checkLimits",e).json()}},{key:"copyResources",value:function(e){return this.http.post("/resources/copy",e).json()}}]),n}(),Ae=function(e){d(n,De);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),Oe=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),Be=function(e){d(n,Oe);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),Me=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getServerInfo",value:function(){return this.http.get("/").json()}},{key:"cancelTest",value:function(e){return this.http.get("/cancel",e).then(()=>{})}},{key:"getFunctionsList",value:function(){return this.http.get("/functions").json()}}]),n}(),_e=function(e){d(n,Me);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),We=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),qe=function(e){d(n,We);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),He=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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",P(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){return this.http.patch("/account/password/set",e).then(()=>{})}},{key:"changePassword",value:function(e){return this.http.patch("/account/password/change",P(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",P(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:"ldapLogin",value:function(e){return this.http.post("/account/external/login/ldap",e).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 Ge=()=>JSON.parse(localStorage.getItem("@evergis/user-info")||"null")||void 0,ze=e=>{if(e){const t=Ge();localStorage.setItem("@evergis/user-info",JSON.stringify(v({},t,e)))}else localStorage.removeItem("@evergis/user-info")};let Ve=function(e){d(n,He);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"login",value:async function(e){e&&await w(k(n.prototype),"authenticate",this).call(this,e)}},{key:"fetchCurrentUser",value:async function(){return this.userInfo=await this.getUserInfo(""),this.userInfo}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}},{key:"logout",value:async function(){await this.revokeToken(),ze(void 0),this.userInfo={}}},{key:"updateCurrentUser",value:async function(e){await w(k(n.prototype),"updateUser",this).call(this,v({username:this.username},e)),ze(e)}},{key:"setPassword",value:function(e){return this.setUserPassword({username:this.username,password:e})}},{key:"isAuth",get:function(){var e;return!(null==(e=this.userInfo)||!e.username)&&"public"!==this.userInfo.username}},{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=Ge();return e&&(this.userInfo=e),e}}]),n}();const Je=["username"];let Qe=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getPreview",value:function(e){return this.http.createUrl("/account/user/preview/"+e)}},{key:"uploadPreview",value:function(e,t){let{username:n}=e,r=g(e,Je);return this.http.post("/account/user/preview/"+n,P(t),r).json()}},{key:"deletePreview",value:function(e){return this.http.delete("/account/user/preview/"+e,null).then(()=>{})}}]),n}(),Ke=function(e){d(n,Qe);var t=x(n);function n(e,r){var s;return h(this,n),(s=t.call(this,e)).userInfo=r,s}return f(n,[{key:"user",get:function(){if(this.userInfo)return this.userInfo;const e=Ge();return e&&(this.userInfo=e),e}},{key:"username",get:function(){var e;return(null==(e=this.userInfo)?void 0:e.username)||""}},{key:"updateCurrentUserPhoto",value:async function(e,t){const{fileId:n}=await this.uploadPreview(v({username:this.username},t),{file:e});ze({profile_photo:n,has_profile_photo:!0})}},{key:"fetchPreview1",value:async function(){var e;const t=this.getPreview(""),n=await fetch(t),r=null!=(e=n.headers.get("content-type"))&&e.includes("text/plain")?await n.text():t+"?r="+Math.random();ze({profile_photo:r,has_profile_photo:!0})}},{key:"deleteCurrentUserPhoto",value:async function(){await this.deletePreview(this.username),ze({profile_photo:"",has_profile_photo:!1})}}]),n}(),Xe=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),Ye=function(e){d(n,Xe);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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}(),Ze=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getConfigurationsList",value:function(e){return this.http.get("/settings/config",e).json()}},{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:"removeConfiguration",value:function(e){return this.http.delete("/settings",null,e).then(()=>{})}}]),n}(),$e=function(e){d(n,Ze);var t=x(n);function n(){var e;return h(this,n),(e=t.apply(this,arguments)).settings={modules:[],connection:{url:""}},e}return f(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}(),et=function(e){d(n,Ze);var t=x(n);function n(){var e;return h(this,n),(e=t.apply(this,arguments)).config=null,e}return f(n,[{key:"fetchPortalSettings",value:async function(e){return this.config=JSON.parse(await this.getConfiguration(e)),this.config}}]),n}();var tt;(tt=exports.ErrorReason||(exports.ErrorReason={})).HTTP_OTHER="other",tt.HTTP_CLIENT="client",tt.HTTP_SERVER="server",tt.UNKNOWN="unknown";const nt=e=>e instanceof r.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),rt=e=>e&&e.type&&e.reason;function st(e){return function(t){return!!t.type&&e.includes(t.type)}}const it=st(["PostgresLayerService","PostgresTileLayerService"]),ot=o.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",12);(exports.ResourceSeparator||(exports.ResourceSeparator={})).Server=".";let at=function(){function e(t){let{account:n}=t;h(this,e),this.account=n}return f(e,[{key:"createId",value:function(){return ot()}},{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(v({workspace:"temp"},e))}},{key:"extractResource",value:function(e){if(e&&e.includes(exports.ResourceSeparator.Server)){const t=e.split(exports.ResourceSeparator.Server),n=t.pop();return{workspace:t.join(exports.ResourceSeparator.Server),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}(),ut=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"startTask",value:function(e){return this.http.post("/ice-router/tasks",e).text()}},{key:"getResult",value:function(e){return this.http.get("/ice-router/tasks/"+e).json()}}]),n}(),lt=function(e){d(n,ut);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}(),ct=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"statisticsDb",value:function(e){return this.http.get("/statistics",e).json()}},{key:"classify",value:function(e){return this.http.get("/statistics/classify",e).json()}},{key:"sumOfProduct",value:function(e){return this.http.get("/statistics/sumOfProduct",e).json()}}]),n}(),pt=function(e){d(n,ct);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getStatistic",value:function(e){return this.statisticsDb(e)}},{key:"getClassify",value:function(e){return this.classify(e)}}]),n}(),ht=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"increaseResourcesLimit",value:function(e){return this.http.post("/feedback/limits",null,e).json()}},{key:"moreSymbols",value:function(e){return this.http.post("/feedback/symbol",null,e).json()}},{key:"feedback",value:function(e,t){return this.http.post("/feedback",P(t),e).json()}}]),n}(),yt=function(e){d(n,ht);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"postFeedback",value:function(e,t){return this.feedback(e,t)}}]),n}();const ft=["name","z","x","y"];let vt=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getVectorTile",value:function(e){let{name:t,z:n,x:r,y:s}=e,i=g(e,ft);return this.http.get("/vt/"+t+"/"+n+"/"+r+"/"+s+".pbf",i).then(()=>{})}}]),n}(),dt=function(e){d(n,vt);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n,[{key:"getVt",value:function(e,t,n,r,s){return this.getVectorTile({name:e,z:t,x:n,y:r,isProject:s})}}]),n}(),kt=function(e){d(n,C);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(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",P(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}(),gt=function(e){d(n,kt);var t=x(n);function n(){return h(this,n),t.apply(this,arguments)}return f(n)}();var mt;(mt=exports.UrlPath||(exports.UrlPath={})).Base="/map",mt.Shared="/shared",mt.Portal="/portal";const bt={401:exports.ApiEvent.Unauthorized},xt=Object.values(exports.UrlPath),wt=xt[0];let Tt=function(e){d(i,t.EventEmitter);var s=x(i);function i(e){var t;let{url:o,wsUrl:a,wsKeepAlive:u,snappingHubUrl:l,http:c,urlPath:p,httpOptions:y}=e;h(this,i),t=s.call(this);const{hooks:f}=y||{};return t.http=c||new T(v({prefixUrl:o,timeout:!1},y||{},{hooks:v({},f||{},{beforeRequest:[...f&&f.beforeRequest||[]],afterResponse:[e=>{const n=bt[e.status];return n&&t.emit(n,nt(new r.HTTPError(e))),e},...f&&f.afterResponse||[]]})})),t.url=o,t.wsUrl=a||o,t.urlPath=p||t.defineUrlPath(),t.layers=new ve(t.http),t.tables=new xe(t.http),t.projects=new Te(t.http),t.resources=new Ie(t.projects,t.layers,t.tables),t.styles=new Re(t.http),t.account=new Ve(t.http),t.accountPreview=new Ke(t.http,t.account),t.bulk=new L(t.http),t.security=new U(t.http,t.account),t.notification=new W(t.http,m(t),u),t.scheduler=new G(t.http),t.file=new N(t.http),t.filters=new A(t.http),t.import=new B(t.http),t.geocode=new Ne(t.http),t.print=new gt(t.http),t.tools=new Be(t.http),t.resourceCatalog=new Ae(t.http),t.general=new _e(t.http),t.namespace=new qe(t.http),t.external=new Ye(t.http),t.clientSettings=new $e(t.http),t.portalSettings=new et(t.http),t.iceRouter=new lt(t.http),t.statistic=new pt(t.http),t.feedback=new yt(t.http),t.vectorTiles=new dt(t.http),t.names=new at({account:t.account}),t.snappingHub=l?(new n.HubConnectionBuilder).withUrl(l,{withCredentials:!0,skipNegotiation:!0,transport:n.HttpTransportType.WebSockets}).withAutomaticReconnect().build():null,t}return f(i,[{key:"init",value:async function(e){let{authParams:t,connectWs:n,initScheduler:r,fetchSettings:s,fetchUser:i}=e;try{await this.account.login(t),i&&await this.account.fetchCurrentUser(),n&&await this.connectWs(),r&&await this.initScheduler(),s&&await this.clientSettings.fetchClientSettings({urlPath:this.urlPath}),await this.notification.subscribe("service_update")}catch(e){throw nt(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 nt(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:"connectSignalR",value:async function(){this.account.isAuth&&this.snappingHub&&this.snappingHub.state!==n.HubConnectionState.Connected&&await this.snappingHub.start()}},{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&&xt.includes(t)?t:wt}},{key:"isShared",get:function(){return this.urlPath===exports.UrlPath.Shared}}]),i}(),jt=function(e){d(n,l.TileLayer);var t=x(n);function n(e,r){var s;return h(this,n),(s=t.call(this,"",{crs:e.crs,opacity:e.opacity})).api=r,s.name=e.name,s.sourceUrl=e.sourceUrl,s.subDomains=e.subDomains,s}return f(n,[{key:"getTileUrl",value:function(e,t,n){var r;const s=this.name,i=this.subDomains?function(e,t){void 0===e&&(e=0),void 0===t&&(t=100);let n=t-e,r=Math.random();return r=Math.floor(r*n),r+=e,r}(0,(null==(r=this.subDomains)?void 0:r.length)-1):void 0;return this.sourceUrl?(this.subDomains&&void 0!==i?this.sourceUrl.replace("{0}",this.subDomains[i]):this.sourceUrl).replace("{1}",""+n).replace("{2}",""+e).replace("{3}",""+t):this.api.layers.getTilesLayerImage({x:e,y:t,z:n,name:s})}}]),n}();const St=["name","style","condition","dataFilterId"];let Pt=function(e){d(n,c.DynamicLayer);var t=x(n);function n(e,r){var s;let{name:i,style:o,condition:a,dataFilterId:u}=e,l=g(e,St);return h(this,n),(s=t.call(this,l)).api=r,s.name=i,s.styleId=o,s.conditionQuery=a,s.filterId=u,s.subscribeRedraw(),s}return f(n,[{key:"style",get:function(){return this.styleId},set:function(e){this.styleId=e,this.forceUpdate()}},{key:"condition",get:function(){return this.conditionQuery},set:function(e){this.conditionQuery=e,this.forceUpdate()}},{key:"dataFilterId",get:function(){return this.filterId},set:function(e){this.filterId=e,this.forceUpdate()}},{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,dataFilterId:this.filterId})}},{key:"subscribeRedraw",value:function(){this.api.notification.on("service_update",e=>{(null==e?void 0:e.data.layerName)===this.name&&(this.forceUpdate(),this.redraw())})}}]),n}();const It={RemoteTileService:jt,LocalTileService:jt,PostgresLayerService:Pt,StyledFeatureLayer:Pt,CompositeService:null};let Ct=function(){function e(t,n){h(this,e),this.layers=t,this.http=n}return f(e,[{key:"getLayerService",value:async function(e){let t=await this.getLayerInfo(e);const n=t.type;if(!(e=>Boolean(e&&Object.keys(It).includes(e)))(n))return;const r=It[n];if(r)return new r((e=>v({},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 Rt;!function(e){e[e.BaseMaps=0]="BaseMaps",e[e.Layers=1]="Layers"}(Rt||(Rt={}));let Lt=function(e){d(n,Tt);var t=x(n);function n(e,r,s){var i;return h(this,n),(i=t.call(this,r)).map=new u.Map,i.painter=new a.DomPainter(i.map),i.mapProps=e,i.auth=s,i.layersManager=new Ct(i.layers,i.http),i}return f(n,[{key:"init",value:async function(){await w(k(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,Rt.Layers)}},{key:"setBaseMap",value:async function(e){await this.insertLayer(e,Rt.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(Et);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 Et=e=>void 0!==e;var Ut,Ft,Nt,Dt,At,Ot,Bt,Mt,_t,Wt,qt,Ht,Gt,zt,Vt,Jt,Qt,Kt,Xt,Yt,Zt,$t,en,tn,nn,rn;(Ut=exports.AggregationFunction||(exports.AggregationFunction={})).None="None",Ut.Array="Array",Ut.Min="Min",Ut.Max="Max",Ut.Avg="Avg",Ut.Sum="Sum",Ut.Extent="Extent",Ut.H3="H3",Ut.Count="Count",Ut.TotalCount="TotalCount",Ut.DistinctCount="DistinctCount",Ut.First="First",Ut.Last="Last",Ut.Median="Median",Ut.Mod="Mod",Ut.StdDeviation="StdDeviation",Ut.SumOfProduct="SumOfProduct",Ut.OnlyValue="OnlyValue",Ut.WeightedAvg="WeightedAvg",Ut.DensityIndicators="DensityIndicators",Ut.DividedSum="DividedSum",(Ft=exports.AttributeType||(exports.AttributeType={})).Unknown="Unknown",Ft.String="String",Ft.Int32="Int32",Ft.Int64="Int64",Ft.Double="Double",Ft.DateTime="DateTime",Ft.Boolean="Boolean",Ft.Point="Point",Ft.Polyline="Polyline",Ft.Polygon="Polygon",Ft.Multipoint="Multipoint",Ft.H3Index="H3Index",(Nt=exports.ClassificationType||(exports.ClassificationType={})).None="none",Nt.NaturalBreaks="naturalBreaks",Nt.EqualInterval="equalInterval",Nt.Quantile="quantile",Nt.Unique="unique",(Dt=exports.ClassifyAttributeType||(exports.ClassifyAttributeType={})).Decimal="decimal",Dt.DateTime="dateTime",Dt.Text="text",(At=exports.ConfigurationErrorEnum||(exports.ConfigurationErrorEnum={})).Unknown="Unknown",At.SerializeError="SerializeError",At.InvalidDataService="InvalidDataService",At.InvalidConfiguration="InvalidConfiguration",At.InvalidDataServiceName="InvalidDataServiceName",At.InvalidTableName="InvalidTableName",At.InvalidLayerName="InvalidLayerName",At.ResourceNotFound="ResourceNotFound",At.InvalidCondition="InvalidCondition",At.InvalidAttributes="InvalidAttributes",At.InvalidIdAttribute="InvalidIdAttribute",At.InvalidGeometryAttribute="InvalidGeometryAttribute",At.InvalidGeometryAttributeType="InvalidGeometryAttributeType",At.InvalidColumnName="InvalidColumnName",At.InvalidIdColumnSettings="InvalidIdColumnSettings",At.ColumnNotExistsInTable="ColumnNotExistsInTable",At.InvalidStyle="InvalidStyle",At.InvalidLayerType="InvalidLayerType",At.ColumnLoadingError="ColumnLoadingError",At.InvalidAttributeFormat="InvalidAttributeFormat",At.DataSourceNotFound="DataSourceNotFound",At.DuplicateColumns="DuplicateColumns",At.DuplicateAttributes="DuplicateAttributes",At.TableWithoutColumns="TableWithoutColumns",At.InvalidTableReferenceConfiguration="InvalidTableReferenceConfiguration",(Ot=exports.ErrorDetailsType||(exports.ErrorDetailsType={})).ResourceLimitExceeded="ResourceLimitExceeded",Ot.ResourceNotFound="ResourceNotFound",Ot.InternalError="InternalError",Ot.BadRequest="BadRequest",Ot.DuplicateContent="DuplicateContent",(Bt=exports.ErrorType||(exports.ErrorType={})).NotSpecified="NotSpecified",Bt.LimitError="LimitError",Bt.ValidationError="ValidationError",Bt.JwtExpired="JwtExpired",Bt.TokenInvalid="TokenInvalid",Bt.RefreshTokenExpired="RefreshTokenExpired",Bt.RefreshTokenInvalid="RefreshTokenInvalid",Bt.CreateUserFailed="CreateUserFailed",Bt.SetUserPasswordFailed="SetUserPasswordFailed",Bt.SetUserRoleFailed="SetUserRoleFailed",Bt.UpdateUserFailed="UpdateUserFailed",Bt.RemoveUserFailed="RemoveUserFailed",Bt.CreateRoleFailed="CreateRoleFailed",Bt.UpdateRoleFailed="UpdateRoleFailed",Bt.RemoveUserRoleFailed="RemoveUserRoleFailed",Bt.ChangeActiveStateFailed="ChangeActiveStateFailed",Bt.RemoveRoleFailed="RemoveRoleFailed",Bt.UserNotFound="UserNotFound",Bt.RoleNotFound="RoleNotFound",Bt.EmailNotConfirmed="EmailNotConfirmed",Bt.DuplicateEmailError="DuplicateEmailError",Bt.InvalidPassword="InvalidPassword",Bt.RoleExists="RoleExists",Bt.UserExists="UserExists",Bt.UserLockedError="UserLockedError",Bt.InvalidEmail="InvalidEmail",Bt.InvalidUsername="InvalidUsername",Bt.Unauthorized="Unauthorized",Bt.EmailNotChanged="EmailNotChanged",Bt.EmailNotSet="EmailNotSet",(Mt=exports.FeatureType||(exports.FeatureType={})).Unknown="Unknown",Mt.GeometricFeature="GeometricFeature",(_t=exports.FontStyle||(exports.FontStyle={})).Normal="normal",_t.Oblique="oblique",_t.Italic="italic",(Wt=exports.FontWeight||(exports.FontWeight={})).Thin="Thin",Wt.ExtraLight="ExtraLight",Wt.Light="Light",Wt.SemiLight="SemiLight",Wt.Normal="Normal",Wt.Medium="Medium",Wt.DemiBold="DemiBold",Wt.Bold="Bold",Wt.ExtraBold="ExtraBold",Wt.Black="Black",Wt.ExtraBlack="ExtraBlack",(qt=exports.GeometryType||(exports.GeometryType={})).Unknown="unknown",qt.Point="point",qt.Polyline="polyline",qt.Polygon="multipolygon",qt.Envelope="envelope",qt.Multipoint="multipoint",(Ht=exports.Group||(exports.Group={})).My="my",Ht.Role="role",Ht.Public="public",Ht.All="all",(Gt=exports.LineEndingSize||(exports.LineEndingSize={})).Small="small",Gt.Large="large",(zt=exports.LineEndingType||(exports.LineEndingType={})).None="none",zt.Arrow="arrow",zt.FilledArrow="filledArrow",zt.Square="square",zt.FilledSquare="filledSquare",zt.Circle="circle",zt.FilledCircle="filledCircle",(Vt=exports.Operation||(exports.Operation={})).Unknown="Unknown",Vt.Union="union",Vt.Intersection="intersection",Vt.Subtraction="subtraction",Vt.SymDifference="symDifference",(Jt=exports.Permissions||(exports.Permissions={})).None="none",Jt.Configure="configure",Jt.Write="write",Jt.Read="read",Jt.ReadConfigure="read,configure",Jt.ReadWrite="read,write",Jt.All="read,write,configure",(Qt=exports.PolicyType||(exports.PolicyType={})).Unknown="Unknown",Qt.CreateTable="CreateTable",Qt.CreateLayer="CreateLayer",Qt.CreateProject="CreateProject",Qt.MaxFeaturesInOneTable="MaxFeaturesInOneTable",Qt.MaxObjectsToExport="MaxObjectsToExport",Qt.MaxUploadContentSize="MaxUploadContentSize",(Kt=exports.ReferenceJoinType||(exports.ReferenceJoinType={})).OneToMany="OneToMany",Kt.OneToOne="OneToOne",Kt.Intersect="Intersect",(Xt=exports.ResourceType||(exports.ResourceType={})).Unknown="Unknown",Xt.Table="table",Xt.Layer="layer",Xt.Project="project",Xt.File="file",Xt.Feature="feature",Xt.Tag="tag",(Yt=exports.ResourceTypeLink||(exports.ResourceTypeLink={})).Table="tables",Yt.Layer="layers",Yt.Project="projects",(Zt=exports.ServerTaskStatus||(exports.ServerTaskStatus={})).None="None",Zt.Scheduled="Scheduled",Zt.Planning="Planning",Zt.Executing="Executing",Zt.Completed="Completed",Zt.Failed="Failed",Zt.Canceled="Canceled",Zt.Timeout="Timeout",($t=exports.SimplifyType||(exports.SimplifyType={})).Basic="Basic",$t.PreserveTopology="PreserveTopology",$t.VW="VW",(en=exports.StringSubType||(exports.StringSubType={})).None="None",en.Image="Image",en.PkkCode="PkkCode",(tn=exports.TaskGroup||(exports.TaskGroup={})).My="my",tn.All="all",(nn=exports.TextAlignment||(exports.TextAlignment={})).Right="right",nn.Left="left",nn.Center="center",nn.Justified="justified",(rn=exports.TextVerticalAlignment||(exports.TextVerticalAlignment={})).Top="top",rn.Bottom="bottom",rn.Middle="middle",Object.defineProperty(exports,"HTTPError",{enumerable:!0,get:function(){return r.HTTPError}}),Object.defineProperty(exports,"TimeoutError",{enumerable:!0,get:function(){return r.TimeoutError}}),exports.Account=Ve,exports.AccountPreview=Ke,exports.Api=Tt,exports.BulkOperations=L,exports.ClientSettings=$e,exports.EvergisDynamicLayer=Pt,exports.EvergisTileLayer=jt,exports.External=Ye,exports.Feedback=yt,exports.FileUpload=N,exports.Filters=A,exports.GEOCODE_PROVIDER="geocode2gis",exports.General=_e,exports.Geocode=Ne,exports.HttpClient=T,exports.IceRouter=lt,exports.Import=B,exports.Layers=ve,exports.LayersManager=Ct,exports.Names=at,exports.Namespace=qe,exports.Notification=W,exports.NotificationEvent=q,exports.PortalSettings=et,exports.Projects=Te,exports.ResourceCatalog=Ae,exports.Resources=Ie,exports.Scheduler=G,exports.Security=U,exports.SpatialProcessor=Lt,exports.Statistic=pt,exports.Styles=Re,exports.Tables=xe,exports.Tools=Be,exports.VectorTiles=dt,exports.addSubDomainToLocation=e=>window.location.protocol+"//"+e+"."+window.location.host,exports.errorHandler=nt,exports.formDataFromFile=function(e){const t=new FormData;return t.append("file",e),t},exports.generateId=ot,exports.isEvergisDynamicLayer=function(e){return e instanceof Pt},exports.isEvergisTileLayer=function(e){return e instanceof jt},exports.isFeatureLayer=function(e){return e instanceof p.FeatureLayer},exports.isHTTPError=e=>rt(e)&&"http"===e.type,exports.isHandledError=rt,exports.isLayer=it,exports.isProjectContentItems=function(e){return null!=e},exports.isString=Se,exports.isTileLayerService=function(e){return e.type&&/TileService/.test(e.type)},exports.promiseAllIgnoreErrors=pe,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=P,exports.unique=je; | ||
//# sourceMappingURL=api.cjs.production.min.js.map |
{ | ||
"version": "3.0.137", | ||
"version": "3.0.138", | ||
"license": "MIT", | ||
@@ -46,3 +46,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "195726d29d8973180c6e2a892dc2cfbf2ae628c6" | ||
"gitHead": "2e5336a7bf271b75b53c8676bfa3cf95bbb467d3" | ||
} |
@@ -0,0 +0,0 @@ # @evergis/api |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2061457
23565