@evergis/api 3.0.64 → 3.0.67

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