@openeo/js-client 2.7.0 → 2.8.0

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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ JavaScript/TypeScript client for the openEO API.
4
4
 
5
5
  * [Documentation](https://open-eo.github.io/openeo-js-client/latest/).
6
6
 
7
- The version of this client is **2.7.0** and supports **openEO API versions 1.x.x**.
7
+ The version of this client is **2.8.0** and supports **openEO API versions 1.x.x**.
8
8
  Legacy versions are available as releases.
9
9
  See the [CHANGELOG](CHANGELOG.md) for recent changes.
10
10
 
@@ -32,7 +32,7 @@ To install it in a NodeJS environment run:
32
32
  Afterwards, you can import the package:
33
33
  `const { OpenEO } = require('@openeo/js-client');`
34
34
 
35
- ### TypeScript
35
+ ### TypeScript
36
36
 
37
37
  Warning: The TypeScript integration is still **experimental**! Please help us improve it by opening issues or pull requests.
38
38
 
package/openeo.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  import { User, UserManager } from 'oidc-client';
4
4
  import { ProcessRegistry } from '@openeo/js-commons';
5
5
  import { Readable } from 'stream';
6
+ import axios from 'axios';
6
7
 
7
8
  declare module OpenEO {
8
9
  /**
@@ -204,7 +205,7 @@ declare module OpenEO {
204
205
  * @type {object}
205
206
  * @static
206
207
  */
207
- static axios: object;
208
+ static axios: axios;
208
209
  /**
209
210
  * Returns the name of the Environment, `Node` or `Browser`.
210
211
  *
@@ -409,6 +410,20 @@ declare module OpenEO {
409
410
  * @returns {Array.<FederationBackend>} Array of backends
410
411
  */
411
412
  listFederation(): Array<FederationBackend>;
413
+ /**
414
+ * Given just the string ID of a backend within the federation, returns that backend's full details as a FederationBackend object.
415
+ *
416
+ * @param {string} backendId - The ID of a backend within the federation
417
+ * @returns {FederationBackend} The full details of the backend
418
+ */
419
+ getFederationBackend(backendId: string): FederationBackend;
420
+ /**
421
+ * Given a list of string IDs of backends within the federation, returns those backends' full details as FederationBackend objects.
422
+ *
423
+ * @param {Array<string>} backendIds - The IDs of backends within the federation
424
+ * @returns {Array<FederationBackend>} An array in the same order as the input, containing for each position the full details of the backend
425
+ */
426
+ getFederationBackends(backendIds: Array<string>): Array<FederationBackend>;
412
427
  /**
413
428
  * Lists all supported features.
414
429
  *
@@ -1887,6 +1902,158 @@ declare module OpenEO {
1887
1902
  */
1888
1903
  generateId(prefix?: string): string;
1889
1904
  }
1905
+ /**
1906
+ * A class to handle pagination of resources.
1907
+ *
1908
+ * @abstract
1909
+ */
1910
+ export class Pages {
1911
+ /**
1912
+ * Creates an instance of Pages.
1913
+ *
1914
+ * @param {Connection} connection
1915
+ * @param {string} endpoint
1916
+ * @param {string} key
1917
+ * @param {Constructor} cls - Class
1918
+ * @param {object} [params={}]
1919
+ * @param {string} primaryKey
1920
+ */
1921
+ constructor(connection: Connection, endpoint: string, key: string, cls: Constructor, params?: object, primaryKey?: string);
1922
+ connection: Connection;
1923
+ nextUrl: string;
1924
+ key: string;
1925
+ primaryKey: string;
1926
+ cls: Constructor;
1927
+ params: any;
1928
+ /**
1929
+ * Returns true if there are more pages to fetch.
1930
+ *
1931
+ * @returns {boolean}
1932
+ */
1933
+ hasNextPage(): boolean;
1934
+ /**
1935
+ * Returns the next page of resources.
1936
+ *
1937
+ * @async
1938
+ * @param {Array.<object>} oldObjects - Existing objects to update, if any.
1939
+ * @param {boolean} [toArray=true] - Whether to return the objects as a simplified array or as an object with all information.
1940
+ * @returns {Array.<object>}
1941
+ * @throws {Error}
1942
+ */
1943
+ nextPage(oldObjects?: Array<object>, toArray?: boolean): Array<object>;
1944
+ /**
1945
+ * Ensures a variable is an array.
1946
+ *
1947
+ * @protected
1948
+ * @param {*} x
1949
+ * @returns {Array}
1950
+ */
1951
+ protected _ensureArray(x: any): any[];
1952
+ /**
1953
+ * Creates a facade for the object, if needed.
1954
+ *
1955
+ * @protected
1956
+ * @param {object} obj
1957
+ * @returns {object}
1958
+ */
1959
+ protected _createObject(obj: object): object;
1960
+ /**
1961
+ * Caches the plain objects if needed.
1962
+ *
1963
+ * @param {Array.<object>} objects
1964
+ * @returns {Array.<object>}
1965
+ */
1966
+ _cache(objects: Array<object>): Array<object>;
1967
+ /**
1968
+ * Get the URL of the next page from a response.
1969
+ *
1970
+ * @protected
1971
+ * @param {AxiosResponse} response
1972
+ * @returns {string | null}
1973
+ */
1974
+ protected _getNextLink(response: AxiosResponse): string | null;
1975
+ /**
1976
+ * Makes this class asynchronously iterable.
1977
+ *
1978
+ * @returns {AsyncIterator}
1979
+ */
1980
+ [Symbol.asyncIterator](): AsyncIterator<any, any, any>;
1981
+ }
1982
+ /**
1983
+ * Paginate through collections.
1984
+ */
1985
+ export class CollectionPages extends Pages {
1986
+ /**
1987
+ * Paginate through collections.
1988
+ *
1989
+ * @param {Connection} connection
1990
+ * @param {?number} limit
1991
+ */
1992
+ constructor(connection: Connection, limit?: number | null);
1993
+ }
1994
+ /**
1995
+ * Paginate through collection items.
1996
+ */
1997
+ export class ItemPages extends Pages {
1998
+ /**
1999
+ * Paginate through collection items.
2000
+ *
2001
+ * @param {Connection} connection
2002
+ * @param {string} collectionId
2003
+ * @param {object} params
2004
+ */
2005
+ constructor(connection: Connection, collectionId: string, params: object);
2006
+ }
2007
+ /**
2008
+ * Paginate through jobs.
2009
+ */
2010
+ export class JobPages extends Pages {
2011
+ /**
2012
+ * Paginate through jobs.
2013
+ *
2014
+ * @param {Connection} connection
2015
+ * @param {?number} limit
2016
+ */
2017
+ constructor(connection: Connection, limit?: number | null);
2018
+ }
2019
+ /**
2020
+ * Paginate through processes.
2021
+ */
2022
+ export class ProcessPages extends Pages {
2023
+ /**
2024
+ * Paginate through processes.
2025
+ *
2026
+ * @param {Connection} connection
2027
+ * @param {?number} limit
2028
+ * @param {?string} namespace
2029
+ */
2030
+ constructor(connection: Connection, limit?: number | null, namespace?: string | null);
2031
+ namespace: string;
2032
+ }
2033
+ /**
2034
+ * Paginate through services.
2035
+ */
2036
+ export class ServicePages extends Pages {
2037
+ /**
2038
+ * Paginate through services.
2039
+ *
2040
+ * @param {Connection} connection
2041
+ * @param {?number} limit
2042
+ */
2043
+ constructor(connection: Connection, limit?: number | null);
2044
+ }
2045
+ /**
2046
+ * Paginate through user files.
2047
+ */
2048
+ export class UserFilePages extends Pages {
2049
+ /**
2050
+ * Paginate through user files.
2051
+ *
2052
+ * @param {Connection} connection
2053
+ * @param {?number} limit
2054
+ */
2055
+ constructor(connection: Connection, limit?: number | null);
2056
+ }
1890
2057
  /**
1891
2058
  * A connection to a back-end.
1892
2059
  */
@@ -2030,15 +2197,12 @@ declare module OpenEO {
2030
2197
  /**
2031
2198
  * Paginate through the collections available on the back-end.
2032
2199
  *
2033
- * The collections returned always complies to the latest STAC version (currently 1.0.0).
2034
- * This function adds a self link to the response if not present.
2200
+ * The collections returned always comply to the latest STAC version (currently 1.0.0).
2035
2201
  *
2036
- * @async
2037
2202
  * @param {?number} [limit=50] - The number of collections per request/page as integer. If `null`, requests all collections.
2038
- * @yields {Promise<Collections>} A response compatible to the API specification.
2039
- * @throws {Error}
2203
+ * @returns {CollectionPages} A paged list of collections.
2040
2204
  */
2041
- paginateCollections(limit?: number | null): AsyncGenerator<any, void, unknown>;
2205
+ paginateCollections(limit?: number | null): CollectionPages;
2042
2206
  /**
2043
2207
  * Get further information about a single collection.
2044
2208
  *
@@ -2051,7 +2215,7 @@ declare module OpenEO {
2051
2215
  */
2052
2216
  describeCollection(collectionId: string): Promise<Collection>;
2053
2217
  /**
2054
- * Loads items for a specific image collection.
2218
+ * Paginate through items for a specific collection.
2055
2219
  *
2056
2220
  * May not be available for all collections.
2057
2221
  *
@@ -2069,10 +2233,10 @@ declare module OpenEO {
2069
2233
  * each must be either an RFC 3339 compatible string or a Date object.
2070
2234
  * Also supports open intervals by setting one of the boundaries to `null`, but never both.
2071
2235
  * @param {?number} [limit=null] - The amount of items per request/page as integer. If `null` (default), the back-end decides.
2072
- * @yields {Promise<ItemCollection>} A response compatible to the API specification.
2236
+ * @returns {Promise<ItemPages>} A response compatible to the API specification.
2073
2237
  * @throws {Error}
2074
2238
  */
2075
- listCollectionItems(collectionId: string, spatialExtent?: Array<number> | null, temporalExtent?: any[] | null, limit?: number | null): AsyncGenerator<any, void, unknown>;
2239
+ listCollectionItems(collectionId: string, spatialExtent?: Array<number> | null, temporalExtent?: any[] | null, limit?: number | null): Promise<ItemPages>;
2076
2240
  /**
2077
2241
  * Normalisation of the namespace to a value that is compatible with the OpenEO specs - EXPERIMENTAL.
2078
2242
  *
@@ -2113,15 +2277,11 @@ declare module OpenEO {
2113
2277
  * Note: The list of namespaces can be retrieved by calling `listProcesses` without a namespace given.
2114
2278
  * The namespaces are then listed in the property `namespaces`.
2115
2279
  *
2116
- * This function adds a self link to the response if not present.
2117
- *
2118
- * @async
2119
2280
  * @param {?string} [namespace=null] - Namespace of the processes (default to `null`, i.e. pre-defined processes). EXPERIMENTAL!
2120
2281
  * @param {?number} [limit=50] - The number of processes per request/page as integer. If `null`, requests all processes.
2121
- * @yields {Promise<Processes>} - A response compatible to the API specification.
2122
- * @throws {Error}
2282
+ * @returns {ProcessPages} A paged list of processes.
2123
2283
  */
2124
- paginateProcesses(namespace?: string | null, limit?: number | null): AsyncGenerator<any, void, unknown>;
2284
+ paginateProcesses(namespace?: string | null, limit?: number | null): ProcessPages;
2125
2285
  /**
2126
2286
  * Get information about a single process.
2127
2287
  *
@@ -2281,12 +2441,10 @@ declare module OpenEO {
2281
2441
  /**
2282
2442
  * Paginate through the files from the user workspace.
2283
2443
  *
2284
- * @async
2285
2444
  * @param {?number} [limit=50] - The number of files per request/page as integer. If `null`, requests all files.
2286
- * @yields {Promise<ResponseArray.<UserFile>>} A list of files.
2287
- * @throws {Error}
2445
+ * @returns {ServicePages} A paged list of files.
2288
2446
  */
2289
- paginateFiles(limit?: number | null): AsyncGenerator<any, void, unknown>;
2447
+ paginateFiles(limit?: number | null): ServicePages;
2290
2448
  /**
2291
2449
  * A callback that is executed on upload progress updates.
2292
2450
  *
@@ -2351,13 +2509,10 @@ declare module OpenEO {
2351
2509
  /**
2352
2510
  * Paginates through the user-defined processes of the authenticated user.
2353
2511
  *
2354
- * @async
2355
2512
  * @param {?number} [limit=50] - The number of processes per request/page as integer. If `null`, requests all processes.
2356
- * @param {Array.<UserProcess>} [oldProcesses=[]] - A list of existing user-defined processes to update.
2357
- * @yields {Promise<ResponseArray.<UserProcess>>} A list of user-defined processes.
2358
- * @throws {Error}
2513
+ * @returns {ProcessPages} A paged list of user-defined processes.
2359
2514
  */
2360
- paginateUserProcesses(limit?: number | null, oldProcesses?: Array<UserProcess>): AsyncGenerator<any, void, unknown>;
2515
+ paginateUserProcesses(limit?: number | null): ProcessPages;
2361
2516
  /**
2362
2517
  * Creates a new stored user-defined process at the back-end.
2363
2518
  *
@@ -2421,13 +2576,10 @@ declare module OpenEO {
2421
2576
  /**
2422
2577
  * Paginate through the batch jobs of the authenticated user.
2423
2578
  *
2424
- * @async
2425
2579
  * @param {?number} [limit=50] - The number of jobs per request/page as integer. If `null`, requests all jobs.
2426
- * @param {Array.<Job>} [oldJobs=[]] - A list of existing jobs to update.
2427
- * @yields {Promise<ResponseArray.<Job>>} A list of jobs.
2428
- * @throws {Error}
2580
+ * @returns {JobPages} A paged list of jobs.
2429
2581
  */
2430
- paginateJobs(limit?: number | null, oldJobs?: Array<Job>): AsyncGenerator<any, void, unknown>;
2582
+ paginateJobs(limit?: number | null): JobPages;
2431
2583
  /**
2432
2584
  * Creates a new batch job at the back-end.
2433
2585
  *
@@ -2463,13 +2615,10 @@ declare module OpenEO {
2463
2615
  /**
2464
2616
  * Paginate through the secondary web services of the authenticated user.
2465
2617
  *
2466
- * @async
2467
2618
  * @param {?number} [limit=50] - The number of services per request/page as integer. If `null` (default), requests all services.
2468
- * @param {Array.<Service>} [oldServices=[]] - A list of existing services to update.
2469
- * @yields {Promise<ResponseArray.<Job>>} A list of services.
2470
- * @throws {Error}
2619
+ * @returns {ServicePages} A paged list of services.
2471
2620
  */
2472
- paginateServices(limit?: number | null, oldServices?: Array<Service>): AsyncGenerator<any, void, unknown>;
2621
+ paginateServices(limit?: number | null): ServicePages;
2473
2622
  /**
2474
2623
  * Creates a new secondary web service at the back-end.
2475
2624
  *
@@ -2496,18 +2645,6 @@ declare module OpenEO {
2496
2645
  * @throws {Error}
2497
2646
  */
2498
2647
  getService(id: string): Promise<Service>;
2499
- /**
2500
- * Adds additional response details to the array.
2501
- *
2502
- * Adds links and federation:missing.
2503
- *
2504
- * @protected
2505
- * @param {Array.<*>} arr
2506
- * @param {object.<string, *>} response
2507
- * @param {string} selfUrl
2508
- * @returns {ResponseArray}
2509
- */
2510
- protected _toResponseArray(arr: Array<any>, response: object<string, any>, selfUrl: string): ResponseArray;
2511
2648
  /**
2512
2649
  * Get the a link with the given rel type.
2513
2650
  *
@@ -2518,22 +2655,6 @@ declare module OpenEO {
2518
2655
  * @throws {Error}
2519
2656
  */
2520
2657
  protected _getLinkHref(links: Array<Link>, rel: string | Array<string>): string | null;
2521
- /**
2522
- * Get the URL of the next page from a response.
2523
- *
2524
- * @protected
2525
- * @param {AxiosResponse} response
2526
- * @returns {string | null}
2527
- */
2528
- protected _getNextLink(response: AxiosResponse): string | null;
2529
- /**
2530
- * Add a self link to the response if not present.
2531
- *
2532
- * @param {object} data - The body of the response as an object.
2533
- * @param {string} selfUrl - The URL of the current request.
2534
- * @returns {object} The modified object.
2535
- */
2536
- _addSelfLink(data: object, selfUrl: string): object;
2537
2658
  /**
2538
2659
  * Makes all links in the list absolute.
2539
2660
  *
@@ -2958,9 +3079,13 @@ declare module OpenEO {
2958
3079
  */
2959
3080
  export type Process = object<string, any>;
2960
3081
  /**
2961
- * An array of backends in the federation.
3082
+ * A back-end in the federation.
2962
3083
  */
2963
3084
  export type FederationBackend = {
3085
+ /**
3086
+ * ID of the back-end within the federation.
3087
+ */
3088
+ id: string;
2964
3089
  /**
2965
3090
  * URL to the versioned API endpoint of the back-end.
2966
3091
  */
@@ -2974,7 +3099,7 @@ declare module OpenEO {
2974
3099
  */
2975
3100
  description: string;
2976
3101
  /**
2977
- * Current status of the back-ends (online or offline).
3102
+ * Current status of the back-end (online or offline).
2978
3103
  */
2979
3104
  status: string;
2980
3105
  /**
@@ -2997,7 +3122,7 @@ declare module OpenEO {
2997
3122
  /**
2998
3123
  * An array, but enriched with additional details from an openEO API response.
2999
3124
  *
3000
- * Adds three properties: `url`, `links` and `federation:missing`.
3125
+ * Adds two properties: `links` and `federation:missing`.
3001
3126
  */
3002
3127
  export type ResponseArray = any;
3003
3128
  export type ServiceType = object<string, any>;
package/openeo.js CHANGED
@@ -4228,7 +4228,44 @@ class Capabilities {
4228
4228
  * @returns {Array.<FederationBackend>} Array of backends
4229
4229
  */
4230
4230
  listFederation() {
4231
- return Array.isArray(this.data.federation) ? this.data.federation : [];
4231
+ let federation = [];
4232
+ if (Utils.isObject(this.data.federation)) {
4233
+ // convert to array and add keys as `id` property
4234
+ for (const [key, backend] of Object.entries(this.data.federation)) {
4235
+ // fresh object to avoid `id` showing up in this.data.federation
4236
+ federation.push({
4237
+ id: key,
4238
+ ...backend
4239
+ });
4240
+ }
4241
+ }
4242
+ return federation;
4243
+ }
4244
+
4245
+ /**
4246
+ * Given just the string ID of a backend within the federation, returns that backend's full details as a FederationBackend object.
4247
+ *
4248
+ * @param {string} backendId - The ID of a backend within the federation
4249
+ * @returns {FederationBackend} The full details of the backend
4250
+ */
4251
+ getFederationBackend(backendId) {
4252
+ // Add `id` property to make it a proper FederationBackend object
4253
+ // If backendId doesn't exist in this.data.federation, will contain just the `id` field (intended behaviour)
4254
+ return {
4255
+ id: backendId,
4256
+ ...this.data.federation[backendId]
4257
+ };
4258
+ }
4259
+
4260
+ /**
4261
+ * Given a list of string IDs of backends within the federation, returns those backends' full details as FederationBackend objects.
4262
+ *
4263
+ * @param {Array<string>} backendIds - The IDs of backends within the federation
4264
+ * @returns {Array<FederationBackend>} An array in the same order as the input, containing for each position the full details of the backend
4265
+ */
4266
+ getFederationBackends(backendIds) {
4267
+ // Let 'single case' function do the work, but pass `this` so that `this.data.federation` can be accessed in the callback context
4268
+ return backendIds.map(this.getFederationBackend, this);
4232
4269
  }
4233
4270
 
4234
4271
  /**
@@ -6608,7 +6645,7 @@ class OpenEO {
6608
6645
  * @returns {string} Version number (according to SemVer).
6609
6646
  */
6610
6647
  static clientVersion() {
6611
- return "2.6.0";
6648
+ return "2.8.0";
6612
6649
  }
6613
6650
  }
6614
6651
  OpenEO.Environment = __webpack_require__(458);
@@ -6659,7 +6696,7 @@ class Pages {
6659
6696
  * @param {Connection} connection
6660
6697
  * @param {string} endpoint
6661
6698
  * @param {string} key
6662
- * @param {Constructor} cls
6699
+ * @param {Constructor} cls - Class
6663
6700
  * @param {object} [params={}]
6664
6701
  * @param {string} primaryKey
6665
6702
  */
package/openeo.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("axios"),require("Oidc"));else if("function"==typeof define&&define.amd)define(["axios","Oidc"],t);else{var s="object"==typeof exports?t(require("axios"),require("Oidc")):t(e.axios,e.Oidc);for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(self,((e,t)=>(()=>{var s={659:(e,t,s)=>{const r=s(768);class i{constructor(e=[],t=!1){if(this.listeners=[],this.processes={},this.addNamespace=t,e instanceof i)for(let t in e.processes)this.addAll(e.processes[t]);else this.addAll(e)}onChange(e,t,s){for(let r of this.listeners)r(e,t,s)}addAll(e,t="backend"){for(var s in e)this.add(e[s],t,!1);this.onChange("addAll",e,t)}add(e,t="backend",s=!0){if(!r.isObject(e))throw new Error("Invalid process; not an object.");if("string"!=typeof e.id)throw new Error("Invalid process; no id specified.");if("string"!=typeof t)throw new Error("Invalid namespace; not a string.");this.processes[t]||(this.processes[t]={}),e=Object.assign(this.addNamespace?{namespace:t}:{},e),this.processes[t][e.id]=e,s&&this.onChange("add",e,t)}count(){return r.size(this.all())}all(){let e=[];for(let t in this.processes)e=e.concat(Object.values(this.processes[t]));return e}hasNamespace(e){return"string"==typeof e&&Boolean(this.processes[e])}namespaces(){return Object.keys(this.processes).sort()}namespace(e){if("string"!=typeof e)return[];let t=this.processes[e];return t?Object.values(t):[]}has(e,t=null){return Boolean(this.get(e,t))}get(e,t=null){return"string"!=typeof e?null:null===t?this.get(e,"user")||this.get(e,"backend"):this.processes[t]&&this.processes[t][e]||null}remove(e=null,t="user"){if("string"!=typeof t)return!1;if(this.processes[t]){if("string"!=typeof e)return delete this.processes[t],this.onChange("remove",null,t),!0;if(this.processes[t][e]){let s=this.processes[t][e];return delete this.processes[t][e],0===r.size(this.processes[t])&&delete this.processes[t],this.onChange("remove",s,t),!0}}return!1}}e.exports=i},779:(e,t,s)=>{const r=s(768);class i{static normalizeJsonSchema(e,t=!1){r.isObject(e)?e=[e]:Array.isArray(e)||(e=[]);let s=[];for(let t of e)if(Array.isArray(t.allOf))s.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=r.omitFromObject(t,["oneOf","anyOf"]),i=t.oneOf||t.anyOf;for(let t of i)s.push(Object.assign({},e,t))}else s.push(t);if(!t)return s;e=[];for(let t of s)Array.isArray(t.type)?e=e.concat(t.type.map((e=>Object.assign({},t,{type:e})))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!r.isObject(e)||!e.schema)return[];let s,n=i.normalizeJsonSchema(e.schema);for(;s=t.shift();)n=n.map((e=>i.normalizeJsonSchema(i.getElementJsonSchema(e,s)))),n=n.concat(...n);let a=[];for(let e of n){let t=null;if(Array.isArray(e.parameters)?t=e.parameters:r.isObject(e.additionalProperties)&&Array.isArray(e.additionalProperties.parameters)&&(t=e.additionalProperties.parameters),Array.isArray(t)){if(a.length>0&&!r.equals(a,t))throw new Error("Multiple schemas with different callback parameters found.");a=t}}return a}static getCallbackParametersForProcess(e,t,s=[]){if(!r.isObject(e)||!Array.isArray(e.parameters))return[];let n=e.parameters.find((e=>e.name===t));return i.getCallbackParameters(n,s)}static getNativeTypesForJsonSchema(e,t=!1){if(r.isObject(e)&&Array.isArray(e.type)){let s=r.unique(e.type).filter((e=>i.JSON_SCHEMA_TYPES.includes(e)));return s.length>0&&s.length<i.JSON_SCHEMA_TYPES.length?s:t?[]:i.JSON_SCHEMA_TYPES}return r.isObject(e)&&"string"==typeof e.type&&i.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:i.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let s=i.getNativeTypesForJsonSchema(e);if(r.isObject(e)&&s.includes("array")&&"string"!=typeof t){if(r.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&r.isObject(e.items[t]))return e.items[t];if(r.isObject(e.additionalItems))return e.additionalItems}}if(r.isObject(e)&&s.includes("object")){if(null!==t&&r.isObject(e.properties)&&r.isObject(e.properties[t]))return e.properties[t];if(r.isObject(e.additionalProperties))return e.additionalProperties}return{}}}i.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=i},768:(e,t,s)=>{var r=s(252);class i{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return r(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const s={};return t.forEach((t=>s[t]=e[t])),s}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var s=Object.assign({},e);for(let e of t)delete s[e];return s}static mapObject(e,t){const s=Object.keys(e),r=new Array(s.length);return s.forEach(((s,i)=>{r[i]=t(e[s],s,e)})),r}static mapObjectValues(e,t){e=Object(e);const s={};return Object.keys(e).forEach((r=>{s[r]=t(e[r],r,e)})),s}static unique(e,t=!1){return t?e.filter(((e,t,s)=>s.findIndex((t=>i.equals(e,t)))===t)):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let s=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),s+=t.replace(/\/$/,"")),s}static replacePlaceholders(e,t={}){if("string"==typeof e&&i.isObject(t))for(var s in t){let r=t[s];e=e.replace("{"+s+"}",Array.isArray(r)?r.join("; "):r)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map((e=>{if(e.length>=3){const t=(e,t,s)=>t+" "+s.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e}))).join(t)}static friendlyLinks(e,t=!0,s=["self"]){let r=[];if(!Array.isArray(e))return r;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&s.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=i.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),r.push(t));return t&&r.sort(((e,t)=>i.compareStringCaseInsensitive(e.title,t.title))),r}}e.exports=i},304:(e,t,s)=>{const{compare:r,compareVersions:i,validate:n}=s(385);class a{static compare(e,t,s=null){return null!==s?r(e,t,s):i(e,t)}static validate(e){return n(e)}static findCompatible(e,t=!0,s=null,r=null){if(!Array.isArray(e)||0===e.length)return[];let i=e.filter((e=>{if("string"==typeof e.url&&a.validate(e.api_version)){let t=a.validate(s),i=a.validate(r);return t&&i?a.compare(e.api_version,s,">=")&&a.compare(e.api_version,r,"<="):t?a.compare(e.api_version,s,">="):!i||a.compare(e.api_version,r,"<=")}return!1}));return 0===i.length?[]:i.sort(((e,s)=>{let r=!0===e.production,i=!0===s.production;return t&&r!==i?r?-1:1:-1*a.compare(e.api_version,s.api_version)}))}static findLatest(e,t=!0,s=null,r=null){let i=a.findCompatible(e,t,s,r);return i.length>0?i[0]:null}}e.exports=a},321:(e,t,s)=>{var r=s(139);const i="1.0.0",n={classification:"https://stac-extensions.github.io/classification/v1.1.0/schema.json",datacube:"https://stac-extensions.github.io/datacube/v2.1.0/schema.json",eo:"https://stac-extensions.github.io/eo/v1.0.0/schema.json",file:"https://stac-extensions.github.io/file/v1.0.0/schema.json","item-assets":"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",label:"https://stac-extensions.github.io/label/v1.0.1/schema.json",pointcloud:"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",processing:"https://stac-extensions.github.io/processing/v1.1.0/schema.json",projection:"https://stac-extensions.github.io/projection/v1.0.0/schema.json",raster:"https://stac-extensions.github.io/raster/v1.1.0/schema.json",sar:"https://stac-extensions.github.io/sar/v1.0.0/schema.json",sat:"https://stac-extensions.github.io/sat/v1.0.0/schema.json",scientific:"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",table:"https://stac-extensions.github.io/table/v1.2.0/schema.json",timestamps:"https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",version:"https://stac-extensions.github.io/version/v1.0.0/schema.json",view:"https://stac-extensions.github.io/view/v1.0.0/schema.json"},a={itemAndCollection:{"cube:":n.datacube,"eo:":n.eo,"file:":n.file,"label:":n.label,"pc:":n.pointcloud,"processing:":n.processing,"proj:":n.projection,"raster:":n.raster,"sar:":n.sar,"sat:":n.sat,"sci:":n.scientific,"view:":n.view,version:n.version,deprecated:n.version,published:n.timestamps,expires:n.timestamps,unpublished:n.timestamps},catalog:{},collection:{item_assets:n["item-assets"]},item:{}};a.collection=Object.assign(a.collection,a.itemAndCollection),a.item=Object.assign(a.item,a.itemAndCollection);var o={parseUrl(e){let t=e.match(/^https?:\/\/stac-extensions.github.io\/([^\/]+)\/v([^\/]+)\/[^.]+.json$/i);if(t)return{id:t[1],version:t[2]}}},l={version:i,extensions:{},set(e){if("string"!=typeof e.stac_version?l.version="0.6.0":l.version=e.stac_version,Array.isArray(e.stac_extensions))for(let t of e.stac_extensions){let e=o.parseUrl(t);e&&(l.extensions[e.id]=e.version)}},before(e,t=null){let s=t?l.extensions[t]:l.version;return void 0!==s&&r.compare(s,e,"<")}},c={type(e){let t=typeof e;if("object"===t){if(null===e)return"null";if(Array.isArray(e))return"array"}return t},is:(e,t)=>c.type(e)===t,isDefined:e=>void 0!==e,isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),rename:(e,t,s)=>void 0!==e[t]&&void 0===e[s]&&(e[s]=e[t],delete e[t],!0),forAll(e,t,s){if(e[t]&&"object"==typeof e[t])for(let r in e[t])s(e[t][r])},toArray:(e,t)=>void 0!==e[t]&&!Array.isArray(e[t])&&(e[t]=[e[t]],!0),flattenArray(e,t,s,r=!1){if(Array.isArray(e[t])){for(let i in e[t])if("string"==typeof s[i]){let n=e[t][i];e[s[i]]=r?[n]:n}return delete e[t],!0}return!1},flattenOneElementArray:(e,t,s=!1)=>!(!s&&Array.isArray(e[t]))||1===e[t].length&&(e[t]=e[t][0],!0),removeFromArray(e,t,s){if(Array.isArray(e[t])){let r=e[t].indexOf(s);return r>-1&&e[t].splice(r,1),!0}return!1},ensure:(e,t,s)=>(c.type(s)!==c.type(e[t])&&(e[t]=s),!0),upgradeExtension(e,t){let{id:s,version:i}=o.parseUrl(t),n=e.stac_extensions.findIndex((e=>{let t=o.parseUrl(e);return t&&t.id===s&&r.compare(t.version,i,"<")}));return-1!==n&&(e.stac_extensions[n]=t,!0)},addExtension(e,t){let{id:s,version:i}=o.parseUrl(t),n=e.stac_extensions.findIndex((e=>{if(e===t)return!0;let n=o.parseUrl(e);return!(!n||n.id!==s||!r.compare(n.version,i,"<"))}));return-1===n?e.stac_extensions.push(t):e.stac_extensions[n]=t,e.stac_extensions.sort(),!0},removeExtension:(e,t)=>c.removeFromArray(e,"stac_extensions",t),migrateExtensionShortnames(e){let t=Object.keys(n),s=Object.values(n);return c.mapValues(e,"stac_extensions",t,s)},populateExtensions(e,t){let s=[];"catalog"!=t&&"collection"!=t||s.push(e),"item"!=t&&"collection"!=t||!c.isObject(e.assets)||(s=s.concat(Object.values(e.assets))),"collection"==t&&c.isObject(e.item_assets)&&(s=s.concat(Object.values(e.item_assets))),"collection"==t&&c.isObject(e.summaries)&&s.push(e.summaries),"item"==t&&c.isObject(e.properties)&&s.push(e.properties);for(let r of s)Object.keys(r).forEach((s=>{let r=s.match(/^(\w+:|[^:]+$)/i);if(Array.isArray(r)){let s=a[t][r[0]];c.is(s,"string")&&c.addExtension(e,s)}}))},mapValues(e,t,s,r){let i=e=>{let t=s.indexOf(e);return t>=0?r[t]:e};return Array.isArray(e[t])?e[t]=e[t].map(i):void 0!==e[t]&&(e[t]=i(e[t])),!0},mapObject(e,t){for(let s in e)e[s]=t(e[s],s)},moveTo(e,t,s,r=!1,i=!1){let n;return n=r?i?e=>Array.isArray(e):e=>Array.isArray(e)&&1===e.length:c.isDefined,!!n(e[t])&&(s[t]=r&&!i?e[t][0]:e[t],delete e[t],!0)},runAll(e,t,s,r){for(let i in e)i.startsWith("migrate")||e[i](t,s,r)},toUTC(e,t){if("string"==typeof e[t])try{return e[t]=this.toISOString(e[t]),!0}catch(e){}return delete e[t],!1},toISOString:e=>(e instanceof Date||(e=new Date(e)),e.toISOString().replace(".000",""))},u={multihash:null,hexToUint8(e){if(0===e.length||e.length%2!=0)throw new Error(`The string "${e}" is not valid hex.`);return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},uint8ToHex:e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),toMultihash(e,t,s){if(!u.multihash||!c.is(e[t],"string"))return!1;try{const r=u.multihash.encode(u.hexToUint8(e[t]),s);return e[t]=u.uint8ToHex(r),!0}catch(e){return console.warn(e),!1}}},p={migrate:(e,t=!0)=>(l.set(e),t&&(e.stac_version=i),e.type="Catalog",c.ensure(e,"stac_extensions",[]),l.before("1.0.0-rc.1")&&c.migrateExtensionShortnames(e),c.ensure(e,"id",""),c.ensure(e,"description",""),c.ensure(e,"links",[]),c.runAll(p,e,e),l.before("0.8.0")&&c.populateExtensions(e,"catalog"),e)},h={migrate:(e,t=!0)=>(p.migrate(e,t),e.type="Collection",l.before("1.0.0-rc.1")&&c.migrateExtensionShortnames(e),c.ensure(e,"license","proprietary"),c.ensure(e,"extent",{spatial:{bbox:[]},temporal:{interval:[]}}),c.runAll(h,e,e),c.isObject(e.properties)&&(c.removeFromArray(e,"stac_extensions","commons"),delete e.properties),l.before("0.8.0")&&c.populateExtensions(e,"collection"),l.before("1.0.0-beta.1")&&c.mapValues(e,"stac_extensions",["assets"],["item-assets"]),e),extent(e){if(c.ensure(e,"extent",{}),l.before("0.8.0")&&(Array.isArray(e.extent.spatial)&&(e.extent.spatial={bbox:[e.extent.spatial]}),Array.isArray(e.extent.temporal)&&(e.extent.temporal={interval:[e.extent.temporal]})),c.ensure(e.extent,"spatial",{}),c.ensure(e.extent.spatial,"bbox",[]),c.ensure(e.extent,"temporal",{}),c.ensure(e.extent.temporal,"interval",[]),l.before("1.0.0-rc.3")){if(e.extent.temporal.interval.length>1){let t,s;for(let r of e.extent.temporal.interval){if(null===r[0])t=null;else if("string"==typeof r[0]&&null!==t)try{let e=new Date(r[0]);(void 0===t||e<t)&&(t=e)}catch(e){}if(null===r[1])s=null;else if("string"==typeof r[1]&&null!==s)try{let e=new Date(r[1]);(void 0===s||e>s)&&(s=e)}catch(e){}}e.extent.temporal.interval.unshift([t?c.toISOString(t):null,s?c.toISOString(s):null])}if(e.extent.spatial.bbox.length>1){let t=e.extent.spatial.bbox.reduce(((e,t)=>Array.isArray(t)?Math.max(t.length,e):e),4);if(t>=4){let s=new Array(t).fill(null),r=t/2;for(let t of e.extent.spatial.bbox){if(!Array.isArray(t)||t.length<4)break;for(let e in t){let i=t[e];null===s[e]?s[e]=i:s[e]=e<r?Math.min(i,s[e]):Math.max(i,s[e])}}-1===s.findIndex((e=>null===e))&&e.extent.spatial.bbox.unshift(s)}}}},collectionAssets(e){l.before("1.0.0-rc.1")&&c.removeExtension(e,"collection-assets"),g.migrateAll(e)},itemAsset(e){l.before("1.0.0-beta.2")&&c.rename(e,"item_assets","assets"),g.migrateAll(e,"item_assets")},summaries(e){if(c.ensure(e,"summaries",{}),l.before("0.8.0")&&c.isObject(e.other_properties)){for(let t in e.other_properties){let s=e.other_properties[t];Array.isArray(s.extent)&&2===s.extent.length?e.summaries[t]={minimum:s.extent[0],maximum:s.extent[1]}:Array.isArray(s.values)&&(s.values.filter((e=>Array.isArray(e))).length===s.values.length?e.summaries[t]=s.values.reduce(((e,t)=>e.concat(t)),[]):e.summaries[t]=s.values)}delete e.other_properties}if(l.before("1.0.0-beta.1")&&c.isObject(e.properties)&&!e.links.find((e=>["child","item"].includes(e.rel))))for(let t in e.properties){let s=e.properties[t];Array.isArray(s)||(s=[s]),e.summaries[t]=s}l.before("1.0.0-rc.1")&&c.mapObject(e.summaries,(e=>(c.rename(e,"min","minimum"),c.rename(e,"max","maximum"),e))),y.migrate(e.summaries,e,!0),c.moveTo(e.summaries,"sci:doi",e,!0)&&c.addExtension(e,n.scientific),c.moveTo(e.summaries,"sci:publications",e,!0,!0)&&c.addExtension(e,n.scientific),c.moveTo(e.summaries,"sci:citation",e,!0)&&c.addExtension(e,n.scientific),c.moveTo(e.summaries,"cube:dimensions",e,!0)&&c.addExtension(e,n.datacube),0===Object.keys(e.summaries).length&&delete e.summaries}},d={migrate(e,t=null,s=!0){l.set(e),s&&(e.stac_version=i),c.ensure(e,"stac_extensions",[]),l.before("1.0.0-rc.1")&&c.migrateExtensionShortnames(e),c.ensure(e,"id",""),c.ensure(e,"type","Feature"),c.isObject(e.geometry)||(e.geometry=null),null!==e.geometry&&c.ensure(e,"bbox",[]),c.ensure(e,"properties",{}),c.ensure(e,"links",[]),c.ensure(e,"assets",{});let r=!1;return c.isObject(t)&&c.isObject(t.properties)&&(c.removeFromArray(e,"stac_extensions","commons"),e.properties=Object.assign({},t.properties,e.properties),r=!0),c.runAll(d,e,e),y.migrate(e.properties,e),g.migrateAll(e),(l.before("0.8.0")||r)&&c.populateExtensions(e,"item"),e}},f={migrate:(e,t=!0)=>(c.ensure(e,"collections",[]),c.ensure(e,"links",[]),c.runAll(f,e,e),e.collections=e.collections.map((e=>h.migrate(e,t))),e)},m={migrate:(e,t=!0)=>(c.ensure(e,"type","FeatureCollection"),c.ensure(e,"features",[]),c.ensure(e,"links",[]),c.runAll(m,e,e),e.features=e.features.map((e=>d.migrate(e,null,t))),e)},g={migrateAll(e,t="assets"){for(let s in e[t])g.migrate(e[t][s],e)},migrate:(e,t)=>(c.runAll(g,e,t),y.migrate(e,t),e),mediaTypes(e){c.is(e.type,"string")&&c.mapValues(e,"type",["image/vnd.stac.geotiff","image/vnd.stac.geotiff; cloud-optimized=true"],["image/tiff; application=geotiff","image/tiff; application=geotiff; profile=cloud-optimized"])},eo(e,t){let s=c.isObject(t.properties)&&Array.isArray(t.properties["eo:bands"])?t.properties["eo:bands"]:[];if(Array.isArray(e["eo:bands"]))for(let t in e["eo:bands"]){let r=e["eo:bands"][t];c.is(r,"number")&&c.isObject(s[r])?r=s[r]:c.isObject(r)||(r={}),e["eo:bands"][t]=r}}},y={migrate:(e,t,s=!1)=>(c.runAll(y,e,t,s),e),_commonMetadata(e){l.before("1.0.0-rc.3")&&(c.toUTC(e,"created"),c.toUTC(e,"updated"))},_timestamps(e,t){c.toUTC(e,"published"),c.toUTC(e,"expires"),c.toUTC(e,"unpublished"),c.upgradeExtension(t,n.timestamps)},_versioningIndicator(e,t){c.upgradeExtension(t,n.version)},checksum(e,t){l.before("0.9.0")&&u.multihash&&(c.rename(e,"checksum:md5","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","md5"),c.rename(e,"checksum:sha1","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","sha1"),c.rename(e,"checksum:sha2","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","sha2-256"),c.rename(e,"checksum:sha3","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","sha3-256")),l.before("1.0.0-rc.1")&&c.rename(e,"checksum:multihash","file:checksum")&&c.addExtension(t,n.file),c.removeExtension(t,"checksum")},classification(e,t){l.before("1.1.0","classification")&&c.forAll(e,"classification:classes",(e=>c.rename(e,"color-hint","color_hint"))),c.upgradeExtension(t,n.classification)},cube(e,t){c.upgradeExtension(t,n.datacube)},dtr(e,t){l.before("0.9.0")&&(c.rename(e,"dtr:start_datetime","start_datetime"),c.rename(e,"dtr:end_datetime","end_datetime"),c.removeExtension(t,"datetime-range"))},eo(e,t){l.before("0.9.0")&&(c.rename(e,"eo:epsg","proj:epsg")&&c.addExtension(t,n.projection),c.rename(e,"eo:platform","platform"),c.rename(e,"eo:instrument","instruments")&&c.toArray(e,"instruments"),c.rename(e,"eo:constellation","constellation"),c.rename(e,"eo:off_nadir","view:off_nadir")&&c.addExtension(t,n.view),c.rename(e,"eo:azimuth","view:azimuth")&&c.addExtension(t,n.view),c.rename(e,"eo:incidence_angle","view:incidence_angle")&&c.addExtension(t,n.view),c.rename(e,"eo:sun_azimuth","view:sun_azimuth")&&c.addExtension(t,n.view),c.rename(e,"eo:sun_elevation","view:sun_elevation")&&c.addExtension(t,n.view)),l.before("1.0.0-beta.1")&&c.rename(e,"eo:gsd","gsd"),c.upgradeExtension(t,n.eo)},file(e,t){c.upgradeExtension(t,n.file)},label(e,t){l.before("0.8.0")&&(c.rename(e,"label:property","label:properties"),c.rename(e,"label:task","label:tasks"),c.rename(e,"label:overview","label:overviews")&&c.toArray(e,"label:overviews"),c.rename(e,"label:method","label:methods"),c.toArray(e,"label:classes")),c.upgradeExtension(t,n.label)},pc(e,t){l.before("0.8.0")&&c.rename(e,"pc:schema","pc:schemas"),c.upgradeExtension(t,n.pointcloud)},processing(e,t){c.upgradeExtension(t,n.processing)},proj(e,t){c.upgradeExtension(t,n.projection)},raster(e,t){c.upgradeExtension(t,n.raster)},sar(e,t,s){c.rename(e,"sar:incidence_angle","view:incidence_angle")&&c.addExtension(t,n.view),c.rename(e,"sar:pass_direction","sat:orbit_state")&&c.mapValues(e,"sat:orbit_state",[null],["geostationary"])&&c.addExtension(t,n.sat),l.before("0.7.0")&&(c.flattenArray(e,"sar:resolution",["sar:resolution_range","sar:resolution_azimuth"],s),c.flattenArray(e,"sar:pixel_spacing",["sar:pixel_spacing_range","sar:pixel_spacing_azimuth"],s),c.flattenArray(e,"sar:looks",["sar:looks_range","sar:looks_azimuth","sar:looks_equivalent_number"],s),c.rename(e,"sar:off_nadir","view:off_nadir")&&c.addExtension(t,n.view)),l.before("0.9.0")&&(c.rename(e,"sar:platform","platform"),c.rename(e,"sar:instrument","instruments")&&c.toArray(e,"instruments"),c.rename(e,"sar:constellation","constellation"),c.rename(e,"sar:type","sar:product_type"),c.rename(e,"sar:polarization","sar:polarizations"),c.flattenOneElementArray(e,"sar:absolute_orbit",s)&&c.rename(e,"sar:absolute_orbit","sat:absolute_orbit")&&c.addExtension(t,n.sat),c.flattenOneElementArray(e,"sar:relative_orbit",s)&&c.rename(e,"sar:relative_orbit","sat:relative_orbit")&&c.addExtension(t,n.sat)),c.upgradeExtension(t,n.sar)},sat(e,t){l.before("0.9.0")&&(c.rename(e,"sat:off_nadir_angle","sat:off_nadir"),c.rename(e,"sat:azimuth_angle","sat:azimuth"),c.rename(e,"sat:sun_azimuth_angle","sat:sun_azimuth"),c.rename(e,"sat:sun_elevation_angle","sat:sun_elevation")),c.upgradeExtension(t,n.sat)},sci(e,t){c.upgradeExtension(t,n.scientific)},item(e){l.before("0.8.0")&&(c.rename(e,"item:license","license"),c.rename(e,"item:providers","providers"))},table(e,t){c.upgradeExtension(t,n.table)},view(e,t){c.upgradeExtension(t,n.view)}},b={item:(e,t=null,s=!0)=>d.migrate(e,t,s),catalog:(e,t=!0)=>p.migrate(e,t),collection:(e,t=!0)=>h.migrate(e,t),collectionCollection:(e,t=!0)=>f.migrate(e,t),itemCollection:(e,t=!0)=>m.migrate(e,t),stac:(e,t=!0)=>"Feature"===e.type?b.item(e,null,t):"FeatureCollection"===e.type?b.itemCollection(e,t):"Collection"===e.type||!e.type&&c.isDefined(e.extent)&&c.isDefined(e.license)?b.collection(e,t):!e.type&&Array.isArray(e.collections)?b.collectionCollection(e,t):b.catalog(e,t),enableMultihash(e){u.multihash=e}};e.exports=b},139:function(e,t){var s,r;void 0===(r="function"==typeof(s=function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(e){var t,s,r=e.replace(/^v/,"").replace(/\+.*$/,""),i=(s="-",-1===(t=r).indexOf(s)?t.length:t.indexOf(s)),n=r.substring(0,i).split(".");return n.push(r.substring(i+1)),n}function s(e){return isNaN(Number(e))?e:Number(e)}function r(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver ('"+t+"' received)")}function i(e,i){[e,i].forEach(r);for(var n=t(e),a=t(i),o=0;o<Math.max(n.length-1,a.length-1);o++){var l=parseInt(n[o]||0,10),c=parseInt(a[o]||0,10);if(l>c)return 1;if(c>l)return-1}var u=n[n.length-1],p=a[a.length-1];if(u&&p){var h=u.split(".").map(s),d=p.split(".").map(s);for(o=0;o<Math.max(h.length,d.length);o++){if(void 0===h[o]||"string"==typeof d[o]&&"number"==typeof h[o])return-1;if(void 0===d[o]||"string"==typeof h[o]&&"number"==typeof d[o])return 1;if(h[o]>d[o])return 1;if(d[o]>h[o])return-1}}else if(u||p)return u?-1:1;return 0}var n=[">",">=","=","<","<="],a={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return i.validate=function(t){return"string"==typeof t&&e.test(t)},i.compare=function(e,t,s){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===n.indexOf(e))throw new TypeError("Invalid operator, expected one of "+n.join("|"))}(s);var r=i(e,t);return a[s].indexOf(r)>-1},i})?s.apply(t,[]):s)||(e.exports=r)},147:e=>{e.exports=class{constructor(e,t,s){this.id=s.id||null,this.title=s.title||"",this.description=s.description||"",this.type=e,this.connection=t,this.token=null}getId(){let e=this.getType();return this.getProviderId().length>0&&(e+="."+this.getProviderId()),e}getDisplayName(){return null}getType(){return this.type}getProviderId(){return"string"==typeof this.id?this.id:""}getTitle(){return this.title}getDescription(){return this.description}getToken(){return"string"==typeof this.token?this.getType()+"/"+this.getProviderId()+"/"+this.token:null}setToken(e){this.token=e,this.connection.emit("tokenChanged",e),null!==this.token?this.connection.setAuthProvider(this):this.connection.setAuthProvider(null)}async login(...e){throw new Error("Not implemented.",e)}async logout(){this.setToken(null)}}},54:e=>{e.exports=class{constructor(e,t=[]){this.connection=e,this.apiToClientNames={},this.clientToApiNames={},this.lastRefreshTime=0,this.extra={};for(let e in t){let s,r;Array.isArray(t[e])?(s=t[e][0],r=t[e][1]):(s=t[e],r=t[e]),this.apiToClientNames[s]=r,this.clientToApiNames[r]=s}}toJSON(){let e={};for(let t in this.clientToApiNames){let s=this.clientToApiNames[t];void 0!==this[t]&&(e[s]=this[t])}return Object.assign(e,this.extra)}setAll(e){for(let t in e)void 0===this.apiToClientNames[t]?this.extra[t]=e[t]:this[this.apiToClientNames[t]]=e[t];return this.lastRefreshTime=Date.now(),this}getDataAge(){return(Date.now()-this.lastRefreshTime)/1e3}getAll(){let e={};for(let t in this.apiToClientNames){let s=this.apiToClientNames[t];void 0!==this[s]&&(e[s]=this[s])}return Object.assign(e,this.extra)}get(e){return void 0!==this.extra[e]?this.extra[e]:null}_convertToRequest(e){let t={};for(let s in e)void 0===this.clientToApiNames[s]?t[s]=e[s]:t[this.clientToApiNames[s]]=e[s];return t}_supports(e){return this.connection.capabilities().hasFeature(e)}}},933:(e,t,s)=>{const r=s(458),i=s(768),n=s(147);e.exports=class extends n{constructor(e){super("basic",e,{id:null,title:"HTTP Basic",description:"Login with username and password using the method HTTP Basic."}),this.username=null}async login(e,t){let s=await this.connection._send({method:"get",responseType:"json",url:"/credentials/basic",headers:{Authorization:"Basic "+r.base64encode(e+":"+t)}});if(!i.isObject(s.data)||"string"!=typeof s.data.access_token)throw new Error("No access_token returned.");this.username=e,this.setToken(s.data.access_token)}getDisplayName(){return this.username}async logout(){this.username=null,await super.logout()}}},458:e=>{e.exports=class{static getName(){return"Browser"}static getUrl(){return window.location.toString()}static setUrl(e){throw new Error("setUrl is not supported in a browser environment.")}static handleErrorResponse(e){return new Promise(((t,s)=>{let r=new FileReader;r.onerror=e=>{r.abort(),s(e.target.error)},r.onload=()=>{let e=r.result instanceof ArrayBuffer?String.fromCharCode.apply(null,new Uint16Array(r.result)):r.result,s="string"==typeof e?JSON.parse(e):e;t(s)},r.readAsText(e.response.data)}))}static getResponseType(){return"blob"}static base64encode(e){return btoa(e)}static fileNameForUpload(e){return e.name.split(/(\\|\/)/g).pop()}static dataForUpload(e){return e}static async downloadResults(e,t,s){throw new Error("downloadResults is not supported in a browser environment.")}static saveToFile(e,t){return new Promise(((s,r)=>{try{e instanceof Blob||(e=new Blob([e],{type:"application/octet-stream"}));let r=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=r,i.setAttribute("download",t||"download"),void 0===i.download&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r),s()}catch(e){console.error(e),r(e)}}))}}},425:(e,t,s)=>{const r=s(804),i=s(897),n=s(742),a=s(768),o=s(779),l=s(659),c=["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links"];class u{static async fromVersion(e=null){let t="https://processes.openeo.org/processes.json";return"string"==typeof e&&(t="https://processes.openeo.org/"+e+"/processes.json"),await u.fromURL(t)}static async fromURL(e){let t=await n(e);return new u(t.data)}constructor(e,t=null,s=void 0){if(this.id=s,this.parent=t,this.parentNode=null,this.parentParameter=null,this.nodes={},this.idCounter={},this.callbackParameterCache={},this.parameters=void 0,this.processes=null,e instanceof l)this.processes=e;else if(a.isObject(e)&&Array.isArray(e.processes))this.processes=new l(e.processes);else{if(!Array.isArray(e))throw new Error("Processes are invalid; must be array or object according to the API.");this.processes=new l(e)}this.processes.all().forEach((e=>this.createFunction(e)))}createFunction(e){if(void 0!==this[e.id])throw new Error("Can't create function for process '"+e.id+"'. Already exists in Builder class.");this[e.id]=function(...t){return this.process(e.id,t)}}addProcessSpec(e,t=null){if(!a.isObject(e))throw new Error("Process '"+e.id+"' must be an object.");t||(t="backend"),this.processes.add(e,t),"backend"===t&&this.createFunction(e)}setParent(e,t){this.parentNode=e,this.parentParameter=t}createCallbackParameter(e){return this.callbackParameterCache[e]||(this.callbackParameterCache[e]=i.create(this,e)),this.callbackParameterCache[e]}getParentCallbackParameters(){let e=[];if(this.parentNode&&this.parentParameter)try{e=o.getCallbackParametersForProcess(this.parentNode.spec,this.parentParameter).map((e=>this.createCallbackParameter(e.name)))}catch(e){console.warn(e)}return e}addParameter(e,t=!0){if(void 0!==this.getParentCallbackParameters().find((t=>t.name===e.name)))return;let s=this;if(t)for(;s.parent;)s=s.parent;Array.isArray(s.parameters)||(s.parameters=[]);let r=s.parameters.findIndex((t=>t.name===e.name));-1!==r?Object.assign(s.parameters[r],e):s.parameters.push(e)}spec(e,t=null){return this.processes.get(e,t)}math(e){let t=new(s(212))(e);return t.setBuilder(this),t.generate(!1)}supports(e,t=null){return Boolean(this.spec(e,t))}process(e,t={},s=null){let i=null;if(e.includes("@")){let t;[e,...t]=e.split("@"),i=t.join("@")}let n=new r(this,e,t,s,i);return this.nodes[n.id]=n,n}toJSON(){let e={process_graph:a.mapObjectValues(this.nodes,(e=>e.toJSON()))};return c.forEach((t=>{void 0!==this[t]&&(e[t]=this[t])})),e}generateId(e=""){return e=e.replace("_","").substr(0,6),this.idCounter[e]?this.idCounter[e]++:this.idCounter[e]=1,e+this.idCounter[e]}}e.exports=u},212:(e,t,s)=>{const r=s(462),i=s(897),n=s(804);class a{constructor(e){let t=new r.Parser;this.tree=t.parse(e),this.builder=null}setBuilder(e){this.builder=e}generate(e=!0){let t=this.parseTree(this.tree);if(!(t instanceof n))throw new Error("Invalid formula specified.");return e&&(t.result=!0),t}parseTree(e){let t=Object.keys(e)[0];switch(t){case"Number":return parseFloat(e.Number);case"Identifier":return this.getRef(e.Identifier);case"Expression":return this.parseTree(e.Expression);case"FunctionCall":{let t=[];for(let s in e.FunctionCall.args)t.push(this.parseTree(e.FunctionCall.args[s]));return this.builder.process(e.FunctionCall.name,t)}case"Binary":return this.addOperatorProcess(e.Binary.operator,this.parseTree(e.Binary.left),this.parseTree(e.Binary.right));case"Unary":{let t=this.parseTree(e.Unary.expression);return"-"===e.Unary.operator?"number"==typeof t?-t:this.addOperatorProcess("*",-1,t):t}default:throw new Error("Operation "+t+" not supported.")}}getRef(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("string"==typeof e&&e.startsWith("#")){let t=e.substring(1);if(t in this.builder.nodes)return{from_node:t}}let t=this.builder.getParentCallbackParameters();if("string"==typeof e&&t.length>0){let s=e.match(/^\$+/),r=s?s[0].length:0;if(r>0&&t.length>=r){let s=e.substring(r);return t[r-1][s]}}let s=new i(e);return this.builder.addParameter(s),s}addOperatorProcess(e,t,s){let r=a.operatorMapping[e],i=this.builder.spec(r);if(r&&i){let n={};if(!Array.isArray(i.parameters)||i.parameters.length<2)throw new Error("Process for operator "+e+" must have at least two parameters");return n[i.parameters[0].name||"x"]=t,n[i.parameters[1].name||"y"]=s,this.builder.process(r,n)}throw new Error("Operator "+e+" not supported")}}a.operatorMapping={"-":"subtract","+":"add","/":"divide","*":"multiply","^":"power"},e.exports=a},804:(e,t,s)=>{const r=s(768),i=s(897);class n{constructor(e,t,s={},r=null,i=null){if(this.parent=e,this.spec=this.parent.spec(t,i),!this.spec)throw new Error("Process doesn't exist: "+t);this.id=e.generateId(t),this.namespace=i,this.arguments=Array.isArray(s)?this.namedArguments(s):s,this._description=r,this.result=!1,this.addParametersToProcess(this.arguments)}namedArguments(e){if(e.length>(this.spec.parameters||[]).length)throw new Error("More arguments specified than parameters available.");let t={};if(Array.isArray(this.spec.parameters))for(let s=0;s<this.spec.parameters.length;s++)t[this.spec.parameters[s].name]=e[s];return t}addParametersToProcess(e){for(let t in e){let s=e[t];s instanceof i?r.isObject(s.spec.schema)&&this.parent.addParameter(s.spec):s instanceof n?this.addParametersToProcess(s.arguments):(Array.isArray(s)||r.isObject(s))&&this.addParametersToProcess(s)}}description(e){return void 0===e?this._description:(this._description=e,this)}exportArgument(e,t){const a=s(212);if(r.isObject(e)){if(e instanceof n||e instanceof i)return e.ref();if(e instanceof a){let s=this.createBuilder(this,t);return e.setBuilder(s),e.generate(),s.toJSON()}if(e instanceof Date)return e.toISOString();if("function"==typeof e.toJSON)return e.toJSON();{let s={};for(let r in e)void 0!==e[r]&&(s[r]=this.exportArgument(e[r],t));return s}}return Array.isArray(e)?e.map((e=>this.exportArgument(e)),t):"function"==typeof e?this.exportCallback(e,t):e}createBuilder(e=null,t=null){let r=new(s(425))(this.parent.processes,this.parent);return null!==e&&null!==t&&r.setParent(e,t),r}exportCallback(e,t){let s=this.createBuilder(this,t),i=s.getParentCallbackParameters(),a=e.bind(s)(...i,s);if(Array.isArray(a)&&s.supports("array_create")?a=s.array_create(a):!r.isObject(a)&&s.supports("constant")&&(a=s.constant(a)),a instanceof n)return a.result=!0,s.toJSON();throw new Error("Callback must return BuilderNode")}toJSON(){let e={process_id:this.spec.id,arguments:{}};this.namespace&&(e.namespace=this.namespace);for(let t in this.arguments)void 0!==this.arguments[t]&&(e.arguments[t]=this.exportArgument(this.arguments[t],t));return"function"!=typeof this.description?e.description=this.description:"string"==typeof this._description&&(e.description=this._description),this.result&&(e.result=!0),e}ref(){return{from_node:this.id}}}e.exports=n},897:e=>{"use strict";class t{static create(e,s){let r=new t(s,null);if("undefined"!=typeof Proxy)return new Proxy(r,{nodeCache:{},get(t,s,i){if(!Reflect.has(t,s)){if(!this.nodeCache[s]){let t={data:r};"string"==typeof s&&s.match(/^(0|[1-9]\d*)$/)?t.index=parseInt(s,10):t.label=s,this.nodeCache[s]=e.process("array_element",t)}return this.nodeCache[s]}return Reflect.get(t,s,i)},set(e,t,s,r){if(!Reflect.has(e,t))throw new Error("Simplified array access is read-only");return Reflect.set(e,t,s,r)}});throw new Error("Simplified array access not supported, use array_element directly")}constructor(e,t={},s="",r=void 0){this.name=e,this.spec={name:e,schema:"string"==typeof t?{type:t}:t,description:s},void 0!==r&&(this.spec.optional=!0,this.spec.default=r)}toJSON(){return this.spec}ref(){return{from_parameter:this.name}}}e.exports=t},462:e=>{let t={Token:{Operator:"Operator",Identifier:"Identifier",Number:"Number"}};const s={"⁰":0,"¹":1,"²":2,"³":3,"⁴":4,"⁵":5,"⁶":6,"⁷":7,"⁸":8,"⁹":9},r=Object.keys(s).join("");t.Lexer=function(){let e="",s=0,i=0,n=0,a=t.Token;function o(){let t=i;return t<s?e.charAt(t):"\0"}function l(){let t="\0",r=i;return r<s&&(t=e.charAt(r),i+=1),t}function c(e){return"\t"===e||" "===e||" "===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function p(e){return e>="0"&&e<="9"}function h(e,t){return{type:e,value:t,start:n,end:i-1}}function d(e,t=!1){return"_"===e||u(e)||p(e)||t&&function(e){return"-"===e||"."===e||"~"===e||"@"===e}(e)}function f(){let e;if(function(){let e;for(;i<s&&(e=o(),c(e));)l()}(),!(i>=s)){if(n=i,e=function(){let e,t;if(e=o(),p(e)||"."===e){if(t="","."!==e)for(t=l();e=o(),p(e);)t+=l();if("."===e)for(t+=l();e=o(),p(e);)t+=l();if("e"===e||"E"===e){if(t+=l(),e=o(),"+"!==e&&"-"!==e&&!p(e))throw e="character "+e,i>=s&&(e="<end>"),new SyntaxError("Unexpected "+e+" after the exponent sign");for(t+=l();e=o(),p(e);)t+=l()}if("."===t)throw new SyntaxError("Expecting decimal digits after the dot sign");return h(a.Number,t)}}(),void 0!==e)return e;if(e=function(){let e=o();if(("+-*/()^,"+r).indexOf(e)>=0)return h(a.Operator,l())}(),void 0!==e)return e;if(e=function(){let e=o();if("_"!==(t=e)&&"#"!==t&&"$"!==t&&!u(t))return;var t;let s=l(),r=!1;for(;;){let t=o();if("$"===e)"$"!==t&&(e="");else if("@"===t)r=!0;else if(!d(t,r))break;s+=l()}return h(a.Identifier,s)}(),void 0!==e)return e;throw new SyntaxError("Unknown token from character "+o())}}return{reset:function(t){e=t,s=t.length,i=0},next:f,peek:function(){let e,t=i;try{e=f(),delete e.start,delete e.end}catch(t){e=void 0}return i=t,e}}},t.Parser=function(){let e=new t.Lexer,i=t.Token;function n(e,t){return void 0!==e&&e.type===i.Operator&&t.includes(e.value)}function a(){let t,s=e.peek();return n(s,"-+")?(s=e.next(),t=a(),{Unary:{operator:s.value,expression:t}}):function(){let t,s=e.peek();if(void 0===s)throw new SyntaxError("Unexpected termination of expression");if(s.type===i.Identifier)return s=e.next(),n(e.peek(),"(")?function(t){let s=[],r=e.next();if(!n(r,"("))throw new SyntaxError('Expecting ( in a function call "'+t+'"');if(r=e.peek(),n(r,")")||(s=function(){let t,s,r=[];for(;s=c(),void 0!==s&&(r.push(s),t=e.peek(),n(t,","));)e.next();return r}()),r=e.next(),!n(r,")"))throw new SyntaxError('Expecting ) in a function call "'+t+'"');return{FunctionCall:{name:t,args:s}}}(s.value):{Identifier:s.value};if(s.type===i.Number)return s=e.next(),{Number:s.value};if(n(s,"(")){if(e.next(),t=c(),s=e.next(),!n(s,")"))throw new SyntaxError("Expecting )");return{Expression:t}}throw new SyntaxError("Parse error, can not process token "+s.value)}()}function o(){let t=a(),i=e.peek();for(;n(i,"^"+r);)i=e.next(),t={Binary:{operator:"^",left:t,right:"^"!==i.value?(o=i.value,"number"==typeof s[o]?{Number:s[o]}:null):a()}},i=e.peek();var o;return t}function l(){let t=o(),s=e.peek();for(;n(s,"*/");)s=e.next(),t={Binary:{operator:s.value,left:t,right:o()}},s=e.peek();return t}function c(){return function(){let t=l(),s=e.peek();for(;n(s,"+-");)s=e.next(),t={Binary:{operator:s.value,left:t,right:l()}},s=e.peek();return t}()}return{parse:function(t){e.reset(t);let s=c(),r=e.next();if(void 0!==r)throw new SyntaxError("Unexpected token "+r.value);return{Expression:s}}}},e.exports=t},26:(e,t,s)=>{const r=s(768),i={capabilities:!0,listFileTypes:"get /file_formats",listServiceTypes:"get /service_types",listUdfRuntimes:"get /udf_runtimes",listCollections:"get /collections",describeCollection:"get /collections/{}",listCollectionItems:"get /collections/{}/items",describeCollectionItem:"get /collections/{}/items/{}",describeCollectionQueryables:"get /collections/{}/queryables",listProcesses:"get /processes",describeProcess:"get /processes",listAuthProviders:!0,authenticateOIDC:"get /credentials/oidc",authenticateBasic:"get /credentials/basic",describeAccount:"get /me",listFiles:"get /files",getFile:"get /files",uploadFile:"put /files/{}",downloadFile:"get /files/{}",deleteFile:"delete /files/{}",validateProcess:"post /validation",listUserProcesses:"get /process_graphs",describeUserProcess:"get /process_graphs/{}",getUserProcess:"get /process_graphs/{}",setUserProcess:"put /process_graphs/{}",replaceUserProcess:"put /process_graphs/{}",deleteUserProcess:"delete /process_graphs/{}",computeResult:"post /result",listJobs:"get /jobs",createJob:"post /jobs",listServices:"get /services",createService:"post /services",getJob:"get /jobs/{}",describeJob:"get /jobs/{}",updateJob:"patch /jobs/{}",deleteJob:"delete /jobs/{}",estimateJob:"get /jobs/{}/estimate",debugJob:"get /jobs/{}/logs",startJob:"post /jobs/{}/results",stopJob:"delete /jobs/{}/results",listResults:"get /jobs/{}/results",downloadResults:"get /jobs/{}/results",describeService:"get /services/{}",getService:"get /services/{}",updateService:"patch /services/{}",deleteService:"delete /services/{}",debugService:"get /services/{}/logs"};e.exports=class{constructor(e){this.data=e,this.featureMap=i,this.features=[],this.validate(),this.init()}validate(){if(!r.isObject(this.data))throw new Error("No capabilities retrieved.");if(!this.data.api_version)throw new Error("Invalid capabilities: No API version retrieved");if(!Array.isArray(this.data.endpoints))throw new Error("Invalid capabilities: No endpoints retrieved")}init(){this.features=this.data.endpoints.map((e=>e.methods.map((t=>`${t} ${e.path.replace(/\{[^}]+\}/g,"{}")}`.toLowerCase())))).reduce(((e,t)=>e.concat(t)),[])}toJSON(){return this.data}apiVersion(){return this.data.api_version}backendVersion(){return this.data.backend_version}title(){return"string"==typeof this.data.title?this.data.title:""}description(){return"string"==typeof this.data.description?this.data.description:""}isStable(){return!0===this.data.production}links(){return Array.isArray(this.data.links)?this.data.links:[]}listFederation(){return Array.isArray(this.data.federation)?this.data.federation:[]}listFeatures(){let e=[];for(let t in this.featureMap)(!0===this.featureMap[t]||this.features.includes(this.featureMap[t]))&&e.push(t);return e.sort()}hasFeature(e){let t=this.featureMap[e];return"string"==typeof t&&(t=t.toLowerCase()),!0===t||this.features.some((e=>e===t))}currency(){return r.isObject(this.data.billing)&&"string"==typeof this.data.billing.currency?this.data.billing.currency:null}listPlans(){if(r.isObject(this.data.billing)&&Array.isArray(this.data.billing.plans)){let e="string"==typeof this.data.billing.default_plan?this.data.billing.default_plan.toLowerCase():null;return this.data.billing.plans.map((t=>{let s={default:e===t.name.toLowerCase()};return Object.assign({},t,s)}))}return[]}migrate(e){return e}}},704:(e,t,s)=>{const r=s(458),i=s(768),n=s(659),a=s(742),o=s(321),l=s(147),c=s(933),u=s(688),p=s(26),h=s(405),d=s(649),f=s(293),m=s(806),g=s(497),y=s(425),b=s(804),{CollectionPages:v,ItemPages:w,JobPages:x,ProcessPages:A,ServicePages:_,UserFilePages:O}=s(226),j=["conformance","http://www.opengis.net/def/rel/ogc/1.0/conformance"];e.exports=class{constructor(e,t={},s=null){this.url=s,this.baseUrl=i.normalizeUrl(e),this.authProviderList=null,this.authProvider=null,this.capabilitiesObject=null,this.listeners={},this.options=t,this.processes=new n([],Boolean(t.addNamespaceToProcess)),this.processes.listeners.push(((...e)=>this.emit("processesChanged",...e)))}async init(){const e=await this._get("/"),t=Object.assign({},e.data);if(t.links=this.makeLinksAbsolute(t.links,e),!Array.isArray(t.conformsTo)&&Array.isArray(t.links)){const e=this._getLinkHref(t.links,j);if(e){const s=await this._get(e);i.isObject(s.data)&&Array.isArray(s.data.conformsTo)&&(t.conformsTo=s.data.conformsTo)}}return this.capabilitiesObject=new p(t),this.capabilitiesObject}async refreshProcessCache(){if(0===this.processes.count())return;const e=this.processes.namespaces().map((e=>{let t=()=>Promise.resolve();if("user"===e){const e=this.processes.namespace("user");this.isAuthenticated()?this.capabilities().hasFeature("listUserProcesses")&&(t=()=>this.listUserProcesses(e)):t=()=>this.processes.remove(null,"user")?Promise.resolve():Promise.reject(new Error("Can't clear user processes"))}else this.capabilities().hasFeature("listProcesses")&&(t=()=>this.listProcesses(e));return t().catch((t=>console.warn(`Could not update processes for namespace '${e}' due to an error: ${t.message}`)))}));return await Promise.all(e)}getBaseUrl(){return this.baseUrl}getUrl(){return this.url||this.baseUrl}capabilities(){return this.capabilitiesObject}async listFileTypes(){const e=await this._get("/file_formats");return new h(e.data)}async listServiceTypes(){return(await this._get("/service_types")).data}async listUdfRuntimes(){return(await this._get("/udf_runtimes")).data}async listCollections(){const e=this.paginateCollections(null);return await e.nextPage([],!1)}paginateCollections(e=50){return new v(this,e)}async describeCollection(e){const t=await this._get("/collections/"+e);return t.data.stac_version?o.collection(t.data):t.data}listCollectionItems(e,t=null,s=null,r=null){let i={};return Array.isArray(t)&&(i.bbox=t.join(",")),Array.isArray(s)&&(i.datetime=s.map((e=>e instanceof Date?e.toISOString():"string"==typeof e?e:"..")).join("/")),r>0&&(i.limit=r),new w(this,e,i,r)}normalizeNamespace(e){const t=e.match(/^https?:\/\/.*\/processes\/(@?[\w\-.~:]+)\/?/i);return t&&t.length>1?t[1]:e}async listProcesses(e=null){const t=this.paginateProcesses(e);return await t.nextPage([],!1)}paginateProcesses(e=null,t=50){return new A(this,t,e)}async describeProcess(e,t=null){if(t||(t="backend"),"backend"===t)await this.listProcesses();else{const s=await this._get(`/processes/${this.normalizeNamespace(t)}/${e}`);if(!i.isObject(s.data)||"string"!=typeof s.data.id)throw new Error("Invalid response received for process");this.processes.add(s.data,t)}return this.processes.get(e,t)}async buildProcess(e){return await this.listProcesses(),new y(this.processes,null,e)}async listAuthProviders(){if(null!==this.authProviderList)return this.authProviderList;this.authProviderList=[];const e=this.capabilities();if(e.hasFeature("authenticateOIDC")){const e=await this._get("/credentials/oidc"),t=this.getOidcProviderFactory();if(i.isObject(e.data)&&Array.isArray(e.data.providers)&&"function"==typeof t)for(let s in e.data.providers){const r=t(e.data.providers[s]);r instanceof l&&this.authProviderList.push(r)}}return e.hasFeature("authenticateBasic")&&this.authProviderList.push(new c(this)),this.authProviderList}setOidcProviderFactory(e){this.oidcProviderFactory=e}getOidcProviderFactory(){return"function"==typeof this.oidcProviderFactory?this.oidcProviderFactory:u.isSupported()?e=>new u(this,e):null}async authenticateBasic(e,t){const s=new c(this);await s.login(e,t)}isAuthenticated(){return null!==this.authProvider}emit(e,...t){"function"==typeof this.listeners[e]&&this.listeners[e](...t)}on(e,t){this.listeners[e]=t}off(e){delete this.listeners[e]}getAuthProvider(){return this.authProvider}setAuthProvider(e){e!==this.authProvider&&(this.authProvider=e instanceof l?e:null,this.emit("authProviderChanged",this.authProvider),this.refreshProcessCache())}setAuthToken(e,t,s){const r=new l(e,this,{id:t,title:"Custom",description:""});return r.setToken(s),this.setAuthProvider(r),r}async describeAccount(){return(await this._get("/me")).data}async listFiles(){const e=this.paginateFiles(null);return await e.nextPage()}paginateFiles(e=50){return new O(this,e)}async uploadFile(e,t=null,s=null,i=null){null===t&&(t=r.fileNameForUpload(e));const n=await this.getFile(t);return await n.uploadFile(e,s,i)}async getFile(e){return new d(this,e)}_normalizeUserProcess(e,t={}){return e instanceof m?e=e.toJSON():e instanceof b?(e.result=!0,e=e.parent.toJSON()):i.isObject(e)&&!i.isObject(e.process_graph)&&(e={process_graph:e}),Object.assign({},t,{process:e})}async validateProcess(e){const t=await this._post("/validation",this._normalizeUserProcess(e).process);if(Array.isArray(t.data.errors)){const e=t.data.errors;return e["federation:backends"]=Array.isArray(t.data["federation:missing"])?t.data["federation:missing"]:[],e}throw new Error("Invalid validation response received.")}async listUserProcesses(e=[]){const t=this.paginateUserProcesses(null);return await t.nextPage(e)}paginateUserProcesses(e=50){return this.paginateProcesses("user",e)}async setUserProcess(e,t){const s=new m(this,e);return await s.replaceUserProcess(t)}async getUserProcess(e){const t=new m(this,e);return await t.describeUserProcess()}async computeResult(e,t=null,s=null,n=null,a={}){const o=this._normalizeUserProcess(e,Object.assign({},a,{plan:t,budget:s})),l=await this._post("/result",o,r.getResponseType(),n),c={data:l.data,costs:null,type:null,logs:[]};"number"==typeof l.headers["openeo-costs"]&&(c.costs=l.headers["openeo-costs"]),"string"==typeof l.headers["content-type"]&&(c.type=l.headers["content-type"]);const u=Array.isArray(l.headers.link)?l.headers.link:[l.headers.link];for(let e of u){if("string"!=typeof e)continue;const t=e.match(/^<([^>]+)>;\s?rel="monitor"/i);if(Array.isArray(t)&&t.length>1)try{const e=await this._get(t[1]);i.isObject(e.data)&&Array.isArray(e.data.logs)&&(c.logs=e.data.logs)}catch(e){console.warn(e)}}return c}async downloadResult(e,t,s=null,i=null,n=null){const a=await this.computeResult(e,s,i,n);await r.saveToFile(a.data,t)}async listJobs(e=[]){const t=this.paginateJobs(null);return await t.nextPage(e)}paginateJobs(e=50){return new x(this,e)}async createJob(e,t=null,s=null,r=null,i=null,n={}){n=Object.assign({},n,{title:t,description:s,plan:r,budget:i});const a=this._normalizeUserProcess(e,n),o=await this._post("/jobs",a);if("string"!=typeof o.headers["openeo-identifier"])throw new Error("Response did not contain a Job ID. Job has likely been created, but may not show up yet.");const l=new f(this,o.headers["openeo-identifier"]).setAll(a);return this.capabilities().hasFeature("describeJob")?await l.describeJob():l}async getJob(e){const t=new f(this,e);return await t.describeJob()}async listServices(e=[]){const t=this.paginateServices(null);return await t.nextPage(e)}paginateServices(e=50){return new _(this,e)}async createService(e,t,s=null,r=null,i=!0,n={},a=null,o=null,l={}){const c=this._normalizeUserProcess(e,Object.assign({title:s,description:r,type:t,enabled:i,configuration:n,plan:a,budget:o},l)),u=await this._post("/services",c);if("string"!=typeof u.headers["openeo-identifier"])throw new Error("Response did not contain a Service ID. Service has likely been created, but may not show up yet.");const p=new g(this,u.headers["openeo-identifier"]).setAll(c);return this.capabilities().hasFeature("describeService")?p.describeService():p}async getService(e){const t=new g(this,e);return await t.describeService()}_getLinkHref(e,t){if(Array.isArray(t)||(t=[t]),Array.isArray(e)){const s=e.find((e=>i.isObject(e)&&t.includes(e.rel)&&"string"==typeof e.href));if(s)return s.href}return null}makeLinksAbsolute(e,t=null){if(!Array.isArray(e))return e;let s=null;return s=i.isObject(t)&&t.headers&&t.config&&t.request?t.config.baseURL+t.config.url:"string"!=typeof t?this._getLinkHref(e,"self"):t,s?e.map((e=>{if(!i.isObject(e)||"string"!=typeof e.href)return e;try{const t=new URL(e.href,s);return Object.assign({},e,{href:t.toString()})}catch(t){return e}})):e}async _get(e,t,s,r=null){return await this._send({method:"get",responseType:s,url:e,timeout:"/"===e?5e3:0,params:t},r)}async _post(e,t,s,r=null){const i={method:"post",responseType:s,url:e,data:t};return await this._send(i,r)}async _put(e,t){return await this._send({method:"put",url:e,data:t})}async _patch(e,t){return await this._send({method:"patch",url:e,data:t})}async _delete(e){return await this._send({method:"delete",url:e})}async download(e,t){return(await this._send({method:"get",responseType:r.getResponseType(),url:e,authorization:t})).data}_getAuthHeaders(){const e={};return this.isAuthenticated()&&(e.Authorization="Bearer "+this.authProvider.getToken()),e}async _send(e,t=null){e.baseURL=this.baseUrl,void 0!==e.authorization&&!0!==e.authorization||(e.headers||(e.headers={}),Object.assign(e.headers,this._getAuthHeaders())),e.responseType||(e.responseType="json"),t&&(e.signal=t.signal);try{let t=await a(e);const s=this.capabilities();return s&&(t=s.migrate(t)),t}catch(t){if(a.isCancel(t))throw t;const s=e=>"string"==typeof e&&-1!==e.indexOf("/json"),n=(e,t)=>("string"==typeof t.message&&(e.message=t.message),e.code="string"==typeof t.code?t.code:"",e.id=t.id,e.links=Array.isArray(t.links)?t.links:[],e);if(i.isObject(t.response)&&i.isObject(t.response.data)&&(s(t.response.data.type)||i.isObject(t.response.headers)&&s(t.response.headers["content-type"]))){if(e.responseType!==r.getResponseType())throw n(t,t.response.data);try{throw n(t,await r.handleErrorResponse(t))}catch(e){console.error(e)}}throw t}}}},405:(e,t,s)=>{const r=s(768);e.exports=class{constructor(e){if(this.data={input:{},output:{}},r.isObject(e)){for(let t of["input","output"])for(let s in e[t])r.isObject(e[t])&&(this.data[t][s.toUpperCase()]=e[t][s]);this["federation:missing"]=e["federation:missing"]}}toJSON(){return this.data}getInputTypes(){return this.data.input}getOutputTypes(){return this.data.output}getInputType(e){return this._findType(e,"input")}getOutputType(e){return this._findType(e,"output")}_findType(e,t){return(e=e.toUpperCase())in this.data[t]?this.data[t][e]:null}}},293:(e,t,s)=>{const r=s(458),i=s(54),n=s(431),a=s(768),o=s(321),l=["finished","canceled","error"];e.exports=class extends i{constructor(e,t){super(e,["id","title","description","process","status","progress","created","updated","plan","costs","budget","usage",["log_level","logLevel"],"links"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.status=void 0,this.progress=void 0,this.created=void 0,this.updated=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeJob(){let e=await this.connection._get("/jobs/"+this.id);return this.setAll(e.data)}async updateJob(e){return await this.connection._patch("/jobs/"+this.id,this._convertToRequest(e)),this._supports("describeJob")?await this.describeJob():this.setAll(e)}async deleteJob(){await this.connection._delete("/jobs/"+this.id)}async estimateJob(){return(await this.connection._get("/jobs/"+this.id+"/estimate")).data}debugJob(e=null){return new n(this.connection,"/jobs/"+this.id+"/logs",e)}monitorJob(e,t=60,s=!0){if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeJob"))throw new Error("Monitoring Jobs not supported by the back-end.");let i=this.status,n=null,a=null;r.hasFeature("debugJob")&&s&&(a=this.debugJob());let o=async()=>{this.getDataAge()>1&&await this.describeJob();let t=a?await a.nextLogs():[];(i!==this.status||t.length>0)&&e(this,t),i=this.status,l.includes(this.status)&&c()};setTimeout(o,0),n=setInterval(o,1e3*t);let c=()=>{n&&(clearInterval(n),n=null)};return c}async startJob(){return await this.connection._post("/jobs/"+this.id+"/results",{}),this._supports("describeJob")?await this.describeJob():this}async stopJob(){return await this.connection._delete("/jobs/"+this.id+"/results"),this._supports("describeJob")?await this.describeJob():this}async getResultsAsStac(){let e=await this.connection._get("/jobs/"+this.id+"/results");if(!a.isObject(e)||!a.isObject(e.data))throw new Error("Results received from the back-end are invalid");let t=o.stac(e.data);return a.isObject(t.assets)||(t.assets={}),"Feature"===t.type?"number"==typeof e.headers["openeo-costs"]&&(t.properties.costs=e.headers["openeo-costs"]):"number"==typeof e.headers["openeo-costs"]&&(t.costs=e.headers["openeo-costs"]),t}async listResults(){let e=await this.getResultsAsStac();return a.isObject(e.assets)?Object.values(e.assets):[]}async downloadResults(e){let t=await this.listResults();return await r.downloadResults(this.connection,t,e)}}},431:(e,t,s)=>{const r=s(768);e.exports=class{constructor(e,t,s=null){this.connection=e,this.endpoint=t,this.lastId="",this.level=s,this.missing=new Set}async nextLogs(e=null){let t=await this.next(e);return Array.isArray(t.logs)?t.logs:[]}getMissingBackends(){return Array.from(this.missing)}async next(e=null){let t={offset:this.lastId};e>0&&(t.limit=e),this.level&&(t.level=this.level);let s=await this.connection._get(this.endpoint,t);return Array.isArray(s.data.logs)&&s.data.logs.length>0?(s.data.logs=s.data.logs.filter((e=>r.isObject(e)&&"string"==typeof e.id)),this.lastId=s.data.logs[s.data.logs.length-1].id):s.data.logs=[],s.data.links=Array.isArray(s.data.links)?s.data.links:[],Array.isArray(s.data["federation:missing"])&&s.data["federation:missing"].forEach((e=>this.missing.add(e))),s.data}}},688:(e,t,s)=>{const r=s(768),i=s(147),n=s(458),a=s(117);class o extends i{static isSupported(){return r.isObject(a)&&Boolean(a.UserManager)}static async signinCallback(e=null,t={}){let s=n.getUrl();e||(e=new o(null,{})).setGrant(s.includes("?")?"authorization_code+pkce":"implicit");let r=e.getOptions(t),i=new a.UserManager(r);return await i.signinCallback(s)}constructor(e,t){super("oidc",e,t),this.manager=null,this.listeners={},this.user=null,this.clientId=null,this.grant="authorization_code+pkce",this.issuer=t.issuer||"",this.scopes=Array.isArray(t.scopes)&&t.scopes.length>0?t.scopes:["openid"],this.refreshTokenScope="offline_access",this.links=Array.isArray(t.links)?t.links:[],this.defaultClients=Array.isArray(t.default_clients)?t.default_clients:[],this.defaultClient=this.detectDefaultClient()}addListener(e,t,s="default"){this.manager.events[`add${e}`](t),this.listeners[`${s}:${e}`]=t}removeListener(e,t="default"){this.manager.events[`remove${e}`](this.listeners[e]),delete this.listeners[`${t}:${e}`]}async login(e={},t=!1){if(!this.issuer||"string"!=typeof this.issuer)throw new Error("No Issuer URL available for OpenID Connect");this.manager=new a.UserManager(this.getOptions(e,t)),this.addListener("UserLoaded",(async()=>this.setUser(await this.manager.getUser())),"js-client"),this.addListener("AccessTokenExpired",(()=>this.setUser(null)),"js-client"),"popup"===o.uiMethod?await this.manager.signinPopup():await this.manager.signinRedirect()}async logout(){if(null!==this.manager){try{"popup"===o.uiMethod?await this.manager.signoutPopup():await this.manager.signoutRedirect({post_logout_redirect_uri:n.getUrl()})}catch(e){console.warn(e)}super.logout(),this.removeListener("UserLoaded","js-client"),this.removeListener("AccessTokenExpired","js-client"),this.manager=null,this.setUser(null)}}getOptions(e={},t=!1){let s=this.getResponseType(),r=this.scopes.slice(0);return t&&!r.includes(this.refreshTokenScope)&&r.push(this.refreshTokenScope),Object.assign({client_id:this.clientId,redirect_uri:o.redirectUrl,authority:this.issuer.replace("/.well-known/openid-configuration",""),scope:r.join(" "),validateSubOnSilentRenew:!0,response_type:s,response_mode:s.includes("code")?"query":"fragment"},e)}getResponseType(){switch(this.grant){case"authorization_code+pkce":return"code";case"implicit":return"token id_token";default:throw new Error("Grant Type not supported")}}setGrant(e){switch(e){case"authorization_code+pkce":case"implicit":this.grant=e;break;default:throw new Error("Grant Type not supported")}}setClientId(e){this.clientId=e}setUser(e){e?(this.user=e,this.setToken(e.access_token)):(this.user=null,this.setToken(null))}getDisplayName(){return this.user&&r.isObject(this.user.profile)&&(this.user.profile.name||this.user.profile.preferred_username||this.user.profile.email)||null}detectDefaultClient(){for(let e of o.grants){let t=this.defaultClients.find((t=>Boolean(t.grant_types.includes(e)&&Array.isArray(t.redirect_urls)&&t.redirect_urls.find((e=>e.startsWith(o.redirectUrl))))));if(t)return this.setGrant(e),this.setClientId(t.id),this.defaultClient=t,t}return null}}o.uiMethod="redirect",o.redirectUrl=n.getUrl().split("#")[0].split("?")[0].replace(/\/$/,""),o.grants=["authorization_code+pkce","implicit"],e.exports=o},224:(e,t,s)=>{const r=s(742),i=s(768),n=s(304),a=s(704),o=s(293),l=s(431),c=s(649),u=s(806),p=s(497),h=s(147),d=s(933),f=s(688),m=s(26),g=s(405),y=s(425),b=s(804),v=s(897),w=s(212),x="1.0.0-rc.2",A="1.x.x";class _{static async connect(e,t={}){let s=i.normalizeUrl(e,"/.well-known/openeo"),a=e,o=null;try{if(o=await r.get(s,{timeout:5e3}),!i.isObject(o.data)||!Array.isArray(o.data.versions))throw new Error("Well-Known Document doesn't list any versions.")}catch(e){console.warn("Can't read well-known document, connecting directly to the specified URL as fallback mechanism. Reason: "+e.message)}if(i.isObject(o)){let e=n.findLatest(o.data.versions,!0,x,A);if(null===e)throw new Error("Server not supported. Client only supports the API versions between "+x+" and "+A);a=e.url}let l=await _.connectDirect(a,t);return l.url=e,l}static async connectDirect(e,t={}){let s=new a(e,t),r=await s.init();if(n.compare(r.apiVersion(),x,"<")||n.compare(r.apiVersion(),A,">"))throw new Error("Client only supports the API versions between "+x+" and "+A);return s}static clientVersion(){return"2.6.0"}}_.Environment=s(458),e.exports={AbortController,AuthProvider:h,BasicProvider:d,Capabilities:m,Connection:a,FileTypes:g,Job:o,Logs:l,OidcProvider:f,OpenEO:_,Service:p,UserFile:c,UserProcess:u,Builder:y,BuilderNode:b,Parameter:v,Formula:w}},226:(e,t,s)=>{const r=s(293),i=s(497),n=s(649),a=s(806),o=s(768),l=s(321),c="federation:missing";class u{constructor(e,t,s,r,i={},n="id"){this.connection=e,this.nextUrl=t,this.key=s,this.primaryKey=n,this.cls=r,i.limit>0||delete i.limit,this.params=i}hasNextPage(){return null!==this.nextUrl}async nextPage(e=[],t=!0){const s=await this.connection._get(this.nextUrl,this.params);let r=s.data;if(!o.isObject(r))throw new Error("Response is invalid, is not an object");if(!Array.isArray(r[this.key]))throw new Error(`Response is invalid, '${this.key}' property is not an array`);let i=r[this.key].map((t=>{let s=e.find((e=>e[this.primaryKey]===t[this.primaryKey]));return s?s.setAll(t):s=this._createObject(t),s}));return i=this._cache(i),r.links=this._ensureArray(r.links),this.connection._getLinkHref(r.links,"self")||r.links.push({rel:"self",href:this.nextUrl}),this.nextUrl=this._getNextLink(s),this.params=null,t?(i.links=r.links,i[c]=this._ensureArray(r[c]),i):(r[this.key]=i,r)}_ensureArray(e){return Array.isArray(e)?e:[]}_createObject(e){if(this.cls){const t=new(0,this.cls)(this.connection,e[this.primaryKey]);return t.setAll(e),t}return e}_cache(e){return e}_getNextLink(e){const t=this.connection.makeLinksAbsolute(e.data.links,e);return this.connection._getLinkHref(t,"next")}[Symbol.asyncIterator](){return{self:this,async next(){const e=!this.self.hasNextPage();let t;return e||(t=await this.self.nextPage()),{done:e,value:t}}}}}e.exports={Pages:u,CollectionPages:class extends u{constructor(e,t=null){super(e,"/collections","collections",null,{limit:t})}_createObject(e){return e.stac_version?l.collection(e):e}},ItemPages:class extends u{constructor(e,t,s){super(e,`/collections/${t}/items`,"features",null,s)}_createObject(e){return e.stac_version?l.item(e):e}},JobPages:class extends u{constructor(e,t=null){super(e,"/jobs","jobs",r,{limit:t})}},ProcessPages:class extends u{constructor(e,t=null,s=null){let r;s||(s="backend");let i=null;"user"===s?(r="/process_graphs",i=a):(r="/processes","backend"!==s&&(r+=`/${e.normalizeNamespace(s)}`)),super(e,r,"processes",i,{limit:t}),this.namespace=s}_cache(e){const t=e.map((e=>"function"==typeof e.toJSON?e.toJSON():e));if(this.connection.processes.addAll(t,this.namespace),!this.cls)for(let t in e)e[t]=this.connection.processes.get(e[t].id,this.namespace);return e}},ServicePages:class extends u{constructor(e,t=null){super(e,"/services","services",i,{limit:t})}},UserFilePages:class extends u{constructor(e,t=null){super(e,"/files","files",n,{limit:t},"path")}}}},497:(e,t,s)=>{const r=s(54),i=s(431);e.exports=class extends r{constructor(e,t){super(e,["id","title","description","process","url","type","enabled","configuration","attributes","created","plan","costs","budget","usage",["log_level","logLevel"],"links"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.url=void 0,this.type=void 0,this.enabled=void 0,this.configuration=void 0,this.attributes=void 0,this.created=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeService(){let e=await this.connection._get("/services/"+this.id);return this.setAll(e.data)}async updateService(e){return await this.connection._patch("/services/"+this.id,this._convertToRequest(e)),this._supports("describeService")?await this.describeService():this.setAll(e)}async deleteService(){await this.connection._delete("/services/"+this.id)}debugService(e=null){return new i(this.connection,"/services/"+this.id+"/logs",e)}monitorService(e,t=60,s=!0){if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeService"))throw new Error("Monitoring Services not supported by the back-end.");let i=this.enabled,n=null,a=null;r.hasFeature("debugService")&&s&&(a=this.debugService());let o=async()=>{this.getDataAge()>1&&await this.describeService();let t=a?await a.nextLogs():[];(i!==this.enabled||t.length>0)&&e(this,t),i=this.enabled};return setTimeout(o,0),n=setInterval(o,1e3*t),()=>{n&&(clearInterval(n),n=null)}}}},649:(e,t,s)=>{const r=s(458),i=s(54);e.exports=class extends i{constructor(e,t){super(e,["path","size","modified"]),this.path=t,this.size=void 0,this.modified=void 0}async retrieveFile(){return await this.connection.download("/files/"+this.path,!0)}async downloadFile(e){let t=await this.connection.download("/files/"+this.path,!0);return await r.saveToFile(t,e)}async uploadFile(e,t=null,s=null){let i={method:"put",url:"/files/"+this.path,data:r.dataForUpload(e),headers:{"Content-Type":"application/octet-stream"}};"function"==typeof t&&(i.onUploadProgress=e=>{let s=Math.round(100*e.loaded/e.total);t(s,this)});let n=await this.connection._send(i,s);return this.setAll(n.data)}async deleteFile(){await this.connection._delete("/files/"+this.path)}}},806:(e,t,s)=>{const r=s(54),i=s(768);e.exports=class extends r{constructor(e,t){super(e,["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links",["process_graph","processGraph"]]),this.id=t,this.summary=void 0,this.description=void 0,this.categories=void 0,this.parameters=void 0,this.returns=void 0,this.deprecated=void 0,this.experimental=void 0,this.exceptions=void 0,this.examples=void 0,this.links=void 0,this.processGraph=void 0}async describeUserProcess(){let e=await this.connection._get("/process_graphs/"+this.id);if(!i.isObject(e.data)||"string"!=typeof e.data.id)throw new Error("Invalid response received for user process");return this.connection.processes.add(e.data,"user"),this.setAll(e.data)}async replaceUserProcess(e){if(await this.connection._put("/process_graphs/"+this.id,this._convertToRequest(e)),this._supports("describeUserProcess"))return this.describeUserProcess();{let t=this.setAll(e);return this.connection.processes.add(t.toJSON(),"user"),t}}async deleteUserProcess(){await this.connection._delete("/process_graphs/"+this.id),this.connection.processes.remove(this.id,"user")}}},385:(e,t,s)=>{"use strict";s.r(t),s.d(t,{compare:()=>u,compareVersions:()=>c,satisfies:()=>f,validate:()=>m,validateStrict:()=>g});const r=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,i=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(r);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},n=e=>"*"===e||"x"===e||"X"===e,a=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},o=(e,t)=>{if(n(e)||n(t))return 0;const[s,r]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(a(e),a(t));return s>r?1:s<r?-1:0},l=(e,t)=>{for(let s=0;s<Math.max(e.length,t.length);s++){const r=o(e[s]||"0",t[s]||"0");if(0!==r)return r}return 0},c=(e,t)=>{const s=i(e),r=i(t),n=s.pop(),a=r.pop(),o=l(s,r);return 0!==o?o:n&&a?l(n.split("."),a.split(".")):n||a?n?-1:1:0},u=(e,t,s)=>{d(s);const r=c(e,t);return p[s].includes(r)},p={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},h=Object.keys(p),d=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===h.indexOf(e))throw new Error(`Invalid operator, expected one of ${h.join("|")}`)},f=(e,t)=>{if((t=t.replace(/([><=]+)\s+/g,"$1")).includes("||"))return t.split("||").some((t=>f(e,t)));if(t.includes(" - ")){const[s,r]=t.split(" - ",2);return f(e,`>=${s} <=${r}`)}if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every((t=>f(e,t)));const s=t.match(/^([<>=~^]+)/),r=s?s[1]:"=";if("^"!==r&&"~"!==r)return u(e,t,r);const[n,a,o,,c]=i(e),[p,h,d,,m]=i(t),g=[n,a,o],y=[p,null!=h?h:"x",null!=d?d:"x"];if(m){if(!c)return!1;if(0!==l(g,y))return!1;if(-1===l(c.split("."),m.split(".")))return!1}const b=y.findIndex((e=>"0"!==e))+1,v="~"===r?2:b>1?b:1;return 0===l(g.slice(0,v),y.slice(0,v))&&-1!==l(g.slice(v),y.slice(v))},m=e=>"string"==typeof e&&/^[v\d]/.test(e)&&r.test(e),g=e=>"string"==typeof e&&/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(e)},252:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(!e(t[i],s[i]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],s.get(i[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(t[i]!==s[i])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(s,n[i]))return!1;for(i=r;0!=i--;){var a=n[i];if(!e(t[a],s[a]))return!1}return!0}return t!=t&&s!=s}},117:e=>{"use strict";e.exports=t},742:t=>{"use strict";t.exports=e}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return s[e].call(n.exports,n,n.exports,i),n.exports}return i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(224)})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("axios"),require("Oidc"));else if("function"==typeof define&&define.amd)define(["axios","Oidc"],t);else{var s="object"==typeof exports?t(require("axios"),require("Oidc")):t(e.axios,e.Oidc);for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(self,((e,t)=>(()=>{var s={659:(e,t,s)=>{const r=s(768);class i{constructor(e=[],t=!1){if(this.listeners=[],this.processes={},this.addNamespace=t,e instanceof i)for(let t in e.processes)this.addAll(e.processes[t]);else this.addAll(e)}onChange(e,t,s){for(let r of this.listeners)r(e,t,s)}addAll(e,t="backend"){for(var s in e)this.add(e[s],t,!1);this.onChange("addAll",e,t)}add(e,t="backend",s=!0){if(!r.isObject(e))throw new Error("Invalid process; not an object.");if("string"!=typeof e.id)throw new Error("Invalid process; no id specified.");if("string"!=typeof t)throw new Error("Invalid namespace; not a string.");this.processes[t]||(this.processes[t]={}),e=Object.assign(this.addNamespace?{namespace:t}:{},e),this.processes[t][e.id]=e,s&&this.onChange("add",e,t)}count(){return r.size(this.all())}all(){let e=[];for(let t in this.processes)e=e.concat(Object.values(this.processes[t]));return e}hasNamespace(e){return"string"==typeof e&&Boolean(this.processes[e])}namespaces(){return Object.keys(this.processes).sort()}namespace(e){if("string"!=typeof e)return[];let t=this.processes[e];return t?Object.values(t):[]}has(e,t=null){return Boolean(this.get(e,t))}get(e,t=null){return"string"!=typeof e?null:null===t?this.get(e,"user")||this.get(e,"backend"):this.processes[t]&&this.processes[t][e]||null}remove(e=null,t="user"){if("string"!=typeof t)return!1;if(this.processes[t]){if("string"!=typeof e)return delete this.processes[t],this.onChange("remove",null,t),!0;if(this.processes[t][e]){let s=this.processes[t][e];return delete this.processes[t][e],0===r.size(this.processes[t])&&delete this.processes[t],this.onChange("remove",s,t),!0}}return!1}}e.exports=i},779:(e,t,s)=>{const r=s(768);class i{static normalizeJsonSchema(e,t=!1){r.isObject(e)?e=[e]:Array.isArray(e)||(e=[]);let s=[];for(let t of e)if(Array.isArray(t.allOf))s.push(Object.assign({},...t.allOf));else if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=r.omitFromObject(t,["oneOf","anyOf"]),i=t.oneOf||t.anyOf;for(let t of i)s.push(Object.assign({},e,t))}else s.push(t);if(!t)return s;e=[];for(let t of s)Array.isArray(t.type)?e=e.concat(t.type.map((e=>Object.assign({},t,{type:e})))):e.push(t);return e}static getCallbackParameters(e,t=[]){if(!r.isObject(e)||!e.schema)return[];let s,n=i.normalizeJsonSchema(e.schema);for(;s=t.shift();)n=n.map((e=>i.normalizeJsonSchema(i.getElementJsonSchema(e,s)))),n=n.concat(...n);let a=[];for(let e of n){let t=null;if(Array.isArray(e.parameters)?t=e.parameters:r.isObject(e.additionalProperties)&&Array.isArray(e.additionalProperties.parameters)&&(t=e.additionalProperties.parameters),Array.isArray(t)){if(a.length>0&&!r.equals(a,t))throw new Error("Multiple schemas with different callback parameters found.");a=t}}return a}static getCallbackParametersForProcess(e,t,s=[]){if(!r.isObject(e)||!Array.isArray(e.parameters))return[];let n=e.parameters.find((e=>e.name===t));return i.getCallbackParameters(n,s)}static getNativeTypesForJsonSchema(e,t=!1){if(r.isObject(e)&&Array.isArray(e.type)){let s=r.unique(e.type).filter((e=>i.JSON_SCHEMA_TYPES.includes(e)));return s.length>0&&s.length<i.JSON_SCHEMA_TYPES.length?s:t?[]:i.JSON_SCHEMA_TYPES}return r.isObject(e)&&"string"==typeof e.type&&i.JSON_SCHEMA_TYPES.includes(e.type)?[e.type]:t?[]:i.JSON_SCHEMA_TYPES}static getElementJsonSchema(e,t=null){let s=i.getNativeTypesForJsonSchema(e);if(r.isObject(e)&&s.includes("array")&&"string"!=typeof t){if(r.isObject(e.items))return e.items;if(Array.isArray(e.items)){if(null!==t&&r.isObject(e.items[t]))return e.items[t];if(r.isObject(e.additionalItems))return e.additionalItems}}if(r.isObject(e)&&s.includes("object")){if(null!==t&&r.isObject(e.properties)&&r.isObject(e.properties[t]))return e.properties[t];if(r.isObject(e.additionalProperties))return e.additionalProperties}return{}}}i.JSON_SCHEMA_TYPES=["string","number","integer","boolean","array","object","null"],e.exports=i},768:(e,t,s)=>{var r=s(252);class i{static isObject(e){return"object"==typeof e&&e===Object(e)&&!Array.isArray(e)}static hasText(e){return"string"==typeof e&&e.length>0}static equals(e,t){return r(e,t)}static pickFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);const s={};return t.forEach((t=>s[t]=e[t])),s}static omitFromObject(e,t){e=Object(e),"string"==typeof t&&(t=[t]);var s=Object.assign({},e);for(let e of t)delete s[e];return s}static mapObject(e,t){const s=Object.keys(e),r=new Array(s.length);return s.forEach(((s,i)=>{r[i]=t(e[s],s,e)})),r}static mapObjectValues(e,t){e=Object(e);const s={};return Object.keys(e).forEach((r=>{s[r]=t(e[r],r,e)})),s}static unique(e,t=!1){return t?e.filter(((e,t,s)=>s.findIndex((t=>i.equals(e,t)))===t)):[...new Set(e)]}static size(e){return"object"==typeof e&&null!==e?Array.isArray(e)?e.length:Object.keys(e).length:0}static isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}static deepClone(e){return JSON.parse(JSON.stringify(e))}static normalizeUrl(e,t=null){let s=e.replace(/\/$/,"");return"string"==typeof t&&("/"!==t.substr(0,1)&&(t="/"+t),s+=t.replace(/\/$/,"")),s}static replacePlaceholders(e,t={}){if("string"==typeof e&&i.isObject(t))for(var s in t){let r=t[s];e=e.replace("{"+s+"}",Array.isArray(r)?r.join("; "):r)}return e}static compareStringCaseInsensitive(e,t){return"string"!=typeof e&&(e=String(e)),"string"!=typeof t&&(t=String(t)),e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}static prettifyString(e,t="; "){return Array.isArray(e)||(e=[String(e)]),(e=e.map((e=>{if(e.length>=3){const t=(e,t,s)=>t+" "+s.toUpperCase();return(e=e.includes("_")?e.replace(/([a-zA-Z\d])_([a-zA-Z\d])/g,t):e.includes("-")?e.replace(/([a-zA-Z\d])-([a-zA-Z\d])/g,t):e.replace(/([a-z])([A-Z])/g,t)).charAt(0).toUpperCase()+e.substr(1)}return e}))).join(t)}static friendlyLinks(e,t=!0,s=["self"]){let r=[];if(!Array.isArray(e))return r;for(let t of e)t=Object.assign({},t),"string"==typeof t.rel&&s.includes(t.rel.toLowerCase())||("string"==typeof t.title&&0!==t.title.length||("string"==typeof t.rel&&t.rel.length>1?t.title=i.prettifyString(t.rel):t.title=t.href.replace(/^https?:\/\/(www.)?/i,"").replace(/\/$/i,"")),r.push(t));return t&&r.sort(((e,t)=>i.compareStringCaseInsensitive(e.title,t.title))),r}}e.exports=i},304:(e,t,s)=>{const{compare:r,compareVersions:i,validate:n}=s(385);class a{static compare(e,t,s=null){return null!==s?r(e,t,s):i(e,t)}static validate(e){return n(e)}static findCompatible(e,t=!0,s=null,r=null){if(!Array.isArray(e)||0===e.length)return[];let i=e.filter((e=>{if("string"==typeof e.url&&a.validate(e.api_version)){let t=a.validate(s),i=a.validate(r);return t&&i?a.compare(e.api_version,s,">=")&&a.compare(e.api_version,r,"<="):t?a.compare(e.api_version,s,">="):!i||a.compare(e.api_version,r,"<=")}return!1}));return 0===i.length?[]:i.sort(((e,s)=>{let r=!0===e.production,i=!0===s.production;return t&&r!==i?r?-1:1:-1*a.compare(e.api_version,s.api_version)}))}static findLatest(e,t=!0,s=null,r=null){let i=a.findCompatible(e,t,s,r);return i.length>0?i[0]:null}}e.exports=a},321:(e,t,s)=>{var r=s(139);const i="1.0.0",n={classification:"https://stac-extensions.github.io/classification/v1.1.0/schema.json",datacube:"https://stac-extensions.github.io/datacube/v2.1.0/schema.json",eo:"https://stac-extensions.github.io/eo/v1.0.0/schema.json",file:"https://stac-extensions.github.io/file/v1.0.0/schema.json","item-assets":"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",label:"https://stac-extensions.github.io/label/v1.0.1/schema.json",pointcloud:"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json",processing:"https://stac-extensions.github.io/processing/v1.1.0/schema.json",projection:"https://stac-extensions.github.io/projection/v1.0.0/schema.json",raster:"https://stac-extensions.github.io/raster/v1.1.0/schema.json",sar:"https://stac-extensions.github.io/sar/v1.0.0/schema.json",sat:"https://stac-extensions.github.io/sat/v1.0.0/schema.json",scientific:"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",table:"https://stac-extensions.github.io/table/v1.2.0/schema.json",timestamps:"https://stac-extensions.github.io/timestamps/v1.0.0/schema.json",version:"https://stac-extensions.github.io/version/v1.0.0/schema.json",view:"https://stac-extensions.github.io/view/v1.0.0/schema.json"},a={itemAndCollection:{"cube:":n.datacube,"eo:":n.eo,"file:":n.file,"label:":n.label,"pc:":n.pointcloud,"processing:":n.processing,"proj:":n.projection,"raster:":n.raster,"sar:":n.sar,"sat:":n.sat,"sci:":n.scientific,"view:":n.view,version:n.version,deprecated:n.version,published:n.timestamps,expires:n.timestamps,unpublished:n.timestamps},catalog:{},collection:{item_assets:n["item-assets"]},item:{}};a.collection=Object.assign(a.collection,a.itemAndCollection),a.item=Object.assign(a.item,a.itemAndCollection);var o={parseUrl(e){let t=e.match(/^https?:\/\/stac-extensions.github.io\/([^\/]+)\/v([^\/]+)\/[^.]+.json$/i);if(t)return{id:t[1],version:t[2]}}},l={version:i,extensions:{},set(e){if("string"!=typeof e.stac_version?l.version="0.6.0":l.version=e.stac_version,Array.isArray(e.stac_extensions))for(let t of e.stac_extensions){let e=o.parseUrl(t);e&&(l.extensions[e.id]=e.version)}},before(e,t=null){let s=t?l.extensions[t]:l.version;return void 0!==s&&r.compare(s,e,"<")}},c={type(e){let t=typeof e;if("object"===t){if(null===e)return"null";if(Array.isArray(e))return"array"}return t},is:(e,t)=>c.type(e)===t,isDefined:e=>void 0!==e,isObject:e=>"object"==typeof e&&e===Object(e)&&!Array.isArray(e),rename:(e,t,s)=>void 0!==e[t]&&void 0===e[s]&&(e[s]=e[t],delete e[t],!0),forAll(e,t,s){if(e[t]&&"object"==typeof e[t])for(let r in e[t])s(e[t][r])},toArray:(e,t)=>void 0!==e[t]&&!Array.isArray(e[t])&&(e[t]=[e[t]],!0),flattenArray(e,t,s,r=!1){if(Array.isArray(e[t])){for(let i in e[t])if("string"==typeof s[i]){let n=e[t][i];e[s[i]]=r?[n]:n}return delete e[t],!0}return!1},flattenOneElementArray:(e,t,s=!1)=>!(!s&&Array.isArray(e[t]))||1===e[t].length&&(e[t]=e[t][0],!0),removeFromArray(e,t,s){if(Array.isArray(e[t])){let r=e[t].indexOf(s);return r>-1&&e[t].splice(r,1),!0}return!1},ensure:(e,t,s)=>(c.type(s)!==c.type(e[t])&&(e[t]=s),!0),upgradeExtension(e,t){let{id:s,version:i}=o.parseUrl(t),n=e.stac_extensions.findIndex((e=>{let t=o.parseUrl(e);return t&&t.id===s&&r.compare(t.version,i,"<")}));return-1!==n&&(e.stac_extensions[n]=t,!0)},addExtension(e,t){let{id:s,version:i}=o.parseUrl(t),n=e.stac_extensions.findIndex((e=>{if(e===t)return!0;let n=o.parseUrl(e);return!(!n||n.id!==s||!r.compare(n.version,i,"<"))}));return-1===n?e.stac_extensions.push(t):e.stac_extensions[n]=t,e.stac_extensions.sort(),!0},removeExtension:(e,t)=>c.removeFromArray(e,"stac_extensions",t),migrateExtensionShortnames(e){let t=Object.keys(n),s=Object.values(n);return c.mapValues(e,"stac_extensions",t,s)},populateExtensions(e,t){let s=[];"catalog"!=t&&"collection"!=t||s.push(e),"item"!=t&&"collection"!=t||!c.isObject(e.assets)||(s=s.concat(Object.values(e.assets))),"collection"==t&&c.isObject(e.item_assets)&&(s=s.concat(Object.values(e.item_assets))),"collection"==t&&c.isObject(e.summaries)&&s.push(e.summaries),"item"==t&&c.isObject(e.properties)&&s.push(e.properties);for(let r of s)Object.keys(r).forEach((s=>{let r=s.match(/^(\w+:|[^:]+$)/i);if(Array.isArray(r)){let s=a[t][r[0]];c.is(s,"string")&&c.addExtension(e,s)}}))},mapValues(e,t,s,r){let i=e=>{let t=s.indexOf(e);return t>=0?r[t]:e};return Array.isArray(e[t])?e[t]=e[t].map(i):void 0!==e[t]&&(e[t]=i(e[t])),!0},mapObject(e,t){for(let s in e)e[s]=t(e[s],s)},moveTo(e,t,s,r=!1,i=!1){let n;return n=r?i?e=>Array.isArray(e):e=>Array.isArray(e)&&1===e.length:c.isDefined,!!n(e[t])&&(s[t]=r&&!i?e[t][0]:e[t],delete e[t],!0)},runAll(e,t,s,r){for(let i in e)i.startsWith("migrate")||e[i](t,s,r)},toUTC(e,t){if("string"==typeof e[t])try{return e[t]=this.toISOString(e[t]),!0}catch(e){}return delete e[t],!1},toISOString:e=>(e instanceof Date||(e=new Date(e)),e.toISOString().replace(".000",""))},u={multihash:null,hexToUint8(e){if(0===e.length||e.length%2!=0)throw new Error(`The string "${e}" is not valid hex.`);return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},uint8ToHex:e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),toMultihash(e,t,s){if(!u.multihash||!c.is(e[t],"string"))return!1;try{const r=u.multihash.encode(u.hexToUint8(e[t]),s);return e[t]=u.uint8ToHex(r),!0}catch(e){return console.warn(e),!1}}},p={migrate:(e,t=!0)=>(l.set(e),t&&(e.stac_version=i),e.type="Catalog",c.ensure(e,"stac_extensions",[]),l.before("1.0.0-rc.1")&&c.migrateExtensionShortnames(e),c.ensure(e,"id",""),c.ensure(e,"description",""),c.ensure(e,"links",[]),c.runAll(p,e,e),l.before("0.8.0")&&c.populateExtensions(e,"catalog"),e)},h={migrate:(e,t=!0)=>(p.migrate(e,t),e.type="Collection",l.before("1.0.0-rc.1")&&c.migrateExtensionShortnames(e),c.ensure(e,"license","proprietary"),c.ensure(e,"extent",{spatial:{bbox:[]},temporal:{interval:[]}}),c.runAll(h,e,e),c.isObject(e.properties)&&(c.removeFromArray(e,"stac_extensions","commons"),delete e.properties),l.before("0.8.0")&&c.populateExtensions(e,"collection"),l.before("1.0.0-beta.1")&&c.mapValues(e,"stac_extensions",["assets"],["item-assets"]),e),extent(e){if(c.ensure(e,"extent",{}),l.before("0.8.0")&&(Array.isArray(e.extent.spatial)&&(e.extent.spatial={bbox:[e.extent.spatial]}),Array.isArray(e.extent.temporal)&&(e.extent.temporal={interval:[e.extent.temporal]})),c.ensure(e.extent,"spatial",{}),c.ensure(e.extent.spatial,"bbox",[]),c.ensure(e.extent,"temporal",{}),c.ensure(e.extent.temporal,"interval",[]),l.before("1.0.0-rc.3")){if(e.extent.temporal.interval.length>1){let t,s;for(let r of e.extent.temporal.interval){if(null===r[0])t=null;else if("string"==typeof r[0]&&null!==t)try{let e=new Date(r[0]);(void 0===t||e<t)&&(t=e)}catch(e){}if(null===r[1])s=null;else if("string"==typeof r[1]&&null!==s)try{let e=new Date(r[1]);(void 0===s||e>s)&&(s=e)}catch(e){}}e.extent.temporal.interval.unshift([t?c.toISOString(t):null,s?c.toISOString(s):null])}if(e.extent.spatial.bbox.length>1){let t=e.extent.spatial.bbox.reduce(((e,t)=>Array.isArray(t)?Math.max(t.length,e):e),4);if(t>=4){let s=new Array(t).fill(null),r=t/2;for(let t of e.extent.spatial.bbox){if(!Array.isArray(t)||t.length<4)break;for(let e in t){let i=t[e];null===s[e]?s[e]=i:s[e]=e<r?Math.min(i,s[e]):Math.max(i,s[e])}}-1===s.findIndex((e=>null===e))&&e.extent.spatial.bbox.unshift(s)}}}},collectionAssets(e){l.before("1.0.0-rc.1")&&c.removeExtension(e,"collection-assets"),g.migrateAll(e)},itemAsset(e){l.before("1.0.0-beta.2")&&c.rename(e,"item_assets","assets"),g.migrateAll(e,"item_assets")},summaries(e){if(c.ensure(e,"summaries",{}),l.before("0.8.0")&&c.isObject(e.other_properties)){for(let t in e.other_properties){let s=e.other_properties[t];Array.isArray(s.extent)&&2===s.extent.length?e.summaries[t]={minimum:s.extent[0],maximum:s.extent[1]}:Array.isArray(s.values)&&(s.values.filter((e=>Array.isArray(e))).length===s.values.length?e.summaries[t]=s.values.reduce(((e,t)=>e.concat(t)),[]):e.summaries[t]=s.values)}delete e.other_properties}if(l.before("1.0.0-beta.1")&&c.isObject(e.properties)&&!e.links.find((e=>["child","item"].includes(e.rel))))for(let t in e.properties){let s=e.properties[t];Array.isArray(s)||(s=[s]),e.summaries[t]=s}l.before("1.0.0-rc.1")&&c.mapObject(e.summaries,(e=>(c.rename(e,"min","minimum"),c.rename(e,"max","maximum"),e))),y.migrate(e.summaries,e,!0),c.moveTo(e.summaries,"sci:doi",e,!0)&&c.addExtension(e,n.scientific),c.moveTo(e.summaries,"sci:publications",e,!0,!0)&&c.addExtension(e,n.scientific),c.moveTo(e.summaries,"sci:citation",e,!0)&&c.addExtension(e,n.scientific),c.moveTo(e.summaries,"cube:dimensions",e,!0)&&c.addExtension(e,n.datacube),0===Object.keys(e.summaries).length&&delete e.summaries}},d={migrate(e,t=null,s=!0){l.set(e),s&&(e.stac_version=i),c.ensure(e,"stac_extensions",[]),l.before("1.0.0-rc.1")&&c.migrateExtensionShortnames(e),c.ensure(e,"id",""),c.ensure(e,"type","Feature"),c.isObject(e.geometry)||(e.geometry=null),null!==e.geometry&&c.ensure(e,"bbox",[]),c.ensure(e,"properties",{}),c.ensure(e,"links",[]),c.ensure(e,"assets",{});let r=!1;return c.isObject(t)&&c.isObject(t.properties)&&(c.removeFromArray(e,"stac_extensions","commons"),e.properties=Object.assign({},t.properties,e.properties),r=!0),c.runAll(d,e,e),y.migrate(e.properties,e),g.migrateAll(e),(l.before("0.8.0")||r)&&c.populateExtensions(e,"item"),e}},f={migrate:(e,t=!0)=>(c.ensure(e,"collections",[]),c.ensure(e,"links",[]),c.runAll(f,e,e),e.collections=e.collections.map((e=>h.migrate(e,t))),e)},m={migrate:(e,t=!0)=>(c.ensure(e,"type","FeatureCollection"),c.ensure(e,"features",[]),c.ensure(e,"links",[]),c.runAll(m,e,e),e.features=e.features.map((e=>d.migrate(e,null,t))),e)},g={migrateAll(e,t="assets"){for(let s in e[t])g.migrate(e[t][s],e)},migrate:(e,t)=>(c.runAll(g,e,t),y.migrate(e,t),e),mediaTypes(e){c.is(e.type,"string")&&c.mapValues(e,"type",["image/vnd.stac.geotiff","image/vnd.stac.geotiff; cloud-optimized=true"],["image/tiff; application=geotiff","image/tiff; application=geotiff; profile=cloud-optimized"])},eo(e,t){let s=c.isObject(t.properties)&&Array.isArray(t.properties["eo:bands"])?t.properties["eo:bands"]:[];if(Array.isArray(e["eo:bands"]))for(let t in e["eo:bands"]){let r=e["eo:bands"][t];c.is(r,"number")&&c.isObject(s[r])?r=s[r]:c.isObject(r)||(r={}),e["eo:bands"][t]=r}}},y={migrate:(e,t,s=!1)=>(c.runAll(y,e,t,s),e),_commonMetadata(e){l.before("1.0.0-rc.3")&&(c.toUTC(e,"created"),c.toUTC(e,"updated"))},_timestamps(e,t){c.toUTC(e,"published"),c.toUTC(e,"expires"),c.toUTC(e,"unpublished"),c.upgradeExtension(t,n.timestamps)},_versioningIndicator(e,t){c.upgradeExtension(t,n.version)},checksum(e,t){l.before("0.9.0")&&u.multihash&&(c.rename(e,"checksum:md5","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","md5"),c.rename(e,"checksum:sha1","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","sha1"),c.rename(e,"checksum:sha2","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","sha2-256"),c.rename(e,"checksum:sha3","checksum:multihash")&&u.toMultihash(e,"checksum:multihash","sha3-256")),l.before("1.0.0-rc.1")&&c.rename(e,"checksum:multihash","file:checksum")&&c.addExtension(t,n.file),c.removeExtension(t,"checksum")},classification(e,t){l.before("1.1.0","classification")&&c.forAll(e,"classification:classes",(e=>c.rename(e,"color-hint","color_hint"))),c.upgradeExtension(t,n.classification)},cube(e,t){c.upgradeExtension(t,n.datacube)},dtr(e,t){l.before("0.9.0")&&(c.rename(e,"dtr:start_datetime","start_datetime"),c.rename(e,"dtr:end_datetime","end_datetime"),c.removeExtension(t,"datetime-range"))},eo(e,t){l.before("0.9.0")&&(c.rename(e,"eo:epsg","proj:epsg")&&c.addExtension(t,n.projection),c.rename(e,"eo:platform","platform"),c.rename(e,"eo:instrument","instruments")&&c.toArray(e,"instruments"),c.rename(e,"eo:constellation","constellation"),c.rename(e,"eo:off_nadir","view:off_nadir")&&c.addExtension(t,n.view),c.rename(e,"eo:azimuth","view:azimuth")&&c.addExtension(t,n.view),c.rename(e,"eo:incidence_angle","view:incidence_angle")&&c.addExtension(t,n.view),c.rename(e,"eo:sun_azimuth","view:sun_azimuth")&&c.addExtension(t,n.view),c.rename(e,"eo:sun_elevation","view:sun_elevation")&&c.addExtension(t,n.view)),l.before("1.0.0-beta.1")&&c.rename(e,"eo:gsd","gsd"),c.upgradeExtension(t,n.eo)},file(e,t){c.upgradeExtension(t,n.file)},label(e,t){l.before("0.8.0")&&(c.rename(e,"label:property","label:properties"),c.rename(e,"label:task","label:tasks"),c.rename(e,"label:overview","label:overviews")&&c.toArray(e,"label:overviews"),c.rename(e,"label:method","label:methods"),c.toArray(e,"label:classes")),c.upgradeExtension(t,n.label)},pc(e,t){l.before("0.8.0")&&c.rename(e,"pc:schema","pc:schemas"),c.upgradeExtension(t,n.pointcloud)},processing(e,t){c.upgradeExtension(t,n.processing)},proj(e,t){c.upgradeExtension(t,n.projection)},raster(e,t){c.upgradeExtension(t,n.raster)},sar(e,t,s){c.rename(e,"sar:incidence_angle","view:incidence_angle")&&c.addExtension(t,n.view),c.rename(e,"sar:pass_direction","sat:orbit_state")&&c.mapValues(e,"sat:orbit_state",[null],["geostationary"])&&c.addExtension(t,n.sat),l.before("0.7.0")&&(c.flattenArray(e,"sar:resolution",["sar:resolution_range","sar:resolution_azimuth"],s),c.flattenArray(e,"sar:pixel_spacing",["sar:pixel_spacing_range","sar:pixel_spacing_azimuth"],s),c.flattenArray(e,"sar:looks",["sar:looks_range","sar:looks_azimuth","sar:looks_equivalent_number"],s),c.rename(e,"sar:off_nadir","view:off_nadir")&&c.addExtension(t,n.view)),l.before("0.9.0")&&(c.rename(e,"sar:platform","platform"),c.rename(e,"sar:instrument","instruments")&&c.toArray(e,"instruments"),c.rename(e,"sar:constellation","constellation"),c.rename(e,"sar:type","sar:product_type"),c.rename(e,"sar:polarization","sar:polarizations"),c.flattenOneElementArray(e,"sar:absolute_orbit",s)&&c.rename(e,"sar:absolute_orbit","sat:absolute_orbit")&&c.addExtension(t,n.sat),c.flattenOneElementArray(e,"sar:relative_orbit",s)&&c.rename(e,"sar:relative_orbit","sat:relative_orbit")&&c.addExtension(t,n.sat)),c.upgradeExtension(t,n.sar)},sat(e,t){l.before("0.9.0")&&(c.rename(e,"sat:off_nadir_angle","sat:off_nadir"),c.rename(e,"sat:azimuth_angle","sat:azimuth"),c.rename(e,"sat:sun_azimuth_angle","sat:sun_azimuth"),c.rename(e,"sat:sun_elevation_angle","sat:sun_elevation")),c.upgradeExtension(t,n.sat)},sci(e,t){c.upgradeExtension(t,n.scientific)},item(e){l.before("0.8.0")&&(c.rename(e,"item:license","license"),c.rename(e,"item:providers","providers"))},table(e,t){c.upgradeExtension(t,n.table)},view(e,t){c.upgradeExtension(t,n.view)}},b={item:(e,t=null,s=!0)=>d.migrate(e,t,s),catalog:(e,t=!0)=>p.migrate(e,t),collection:(e,t=!0)=>h.migrate(e,t),collectionCollection:(e,t=!0)=>f.migrate(e,t),itemCollection:(e,t=!0)=>m.migrate(e,t),stac:(e,t=!0)=>"Feature"===e.type?b.item(e,null,t):"FeatureCollection"===e.type?b.itemCollection(e,t):"Collection"===e.type||!e.type&&c.isDefined(e.extent)&&c.isDefined(e.license)?b.collection(e,t):!e.type&&Array.isArray(e.collections)?b.collectionCollection(e,t):b.catalog(e,t),enableMultihash(e){u.multihash=e}};e.exports=b},139:function(e,t){var s,r;void 0===(r="function"==typeof(s=function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(e){var t,s,r=e.replace(/^v/,"").replace(/\+.*$/,""),i=(s="-",-1===(t=r).indexOf(s)?t.length:t.indexOf(s)),n=r.substring(0,i).split(".");return n.push(r.substring(i+1)),n}function s(e){return isNaN(Number(e))?e:Number(e)}function r(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!e.test(t))throw new Error("Invalid argument not valid semver ('"+t+"' received)")}function i(e,i){[e,i].forEach(r);for(var n=t(e),a=t(i),o=0;o<Math.max(n.length-1,a.length-1);o++){var l=parseInt(n[o]||0,10),c=parseInt(a[o]||0,10);if(l>c)return 1;if(c>l)return-1}var u=n[n.length-1],p=a[a.length-1];if(u&&p){var h=u.split(".").map(s),d=p.split(".").map(s);for(o=0;o<Math.max(h.length,d.length);o++){if(void 0===h[o]||"string"==typeof d[o]&&"number"==typeof h[o])return-1;if(void 0===d[o]||"string"==typeof h[o]&&"number"==typeof d[o])return 1;if(h[o]>d[o])return 1;if(d[o]>h[o])return-1}}else if(u||p)return u?-1:1;return 0}var n=[">",">=","=","<","<="],a={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]};return i.validate=function(t){return"string"==typeof t&&e.test(t)},i.compare=function(e,t,s){!function(e){if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===n.indexOf(e))throw new TypeError("Invalid operator, expected one of "+n.join("|"))}(s);var r=i(e,t);return a[s].indexOf(r)>-1},i})?s.apply(t,[]):s)||(e.exports=r)},147:e=>{e.exports=class{constructor(e,t,s){this.id=s.id||null,this.title=s.title||"",this.description=s.description||"",this.type=e,this.connection=t,this.token=null}getId(){let e=this.getType();return this.getProviderId().length>0&&(e+="."+this.getProviderId()),e}getDisplayName(){return null}getType(){return this.type}getProviderId(){return"string"==typeof this.id?this.id:""}getTitle(){return this.title}getDescription(){return this.description}getToken(){return"string"==typeof this.token?this.getType()+"/"+this.getProviderId()+"/"+this.token:null}setToken(e){this.token=e,this.connection.emit("tokenChanged",e),null!==this.token?this.connection.setAuthProvider(this):this.connection.setAuthProvider(null)}async login(...e){throw new Error("Not implemented.",e)}async logout(){this.setToken(null)}}},54:e=>{e.exports=class{constructor(e,t=[]){this.connection=e,this.apiToClientNames={},this.clientToApiNames={},this.lastRefreshTime=0,this.extra={};for(let e in t){let s,r;Array.isArray(t[e])?(s=t[e][0],r=t[e][1]):(s=t[e],r=t[e]),this.apiToClientNames[s]=r,this.clientToApiNames[r]=s}}toJSON(){let e={};for(let t in this.clientToApiNames){let s=this.clientToApiNames[t];void 0!==this[t]&&(e[s]=this[t])}return Object.assign(e,this.extra)}setAll(e){for(let t in e)void 0===this.apiToClientNames[t]?this.extra[t]=e[t]:this[this.apiToClientNames[t]]=e[t];return this.lastRefreshTime=Date.now(),this}getDataAge(){return(Date.now()-this.lastRefreshTime)/1e3}getAll(){let e={};for(let t in this.apiToClientNames){let s=this.apiToClientNames[t];void 0!==this[s]&&(e[s]=this[s])}return Object.assign(e,this.extra)}get(e){return void 0!==this.extra[e]?this.extra[e]:null}_convertToRequest(e){let t={};for(let s in e)void 0===this.clientToApiNames[s]?t[s]=e[s]:t[this.clientToApiNames[s]]=e[s];return t}_supports(e){return this.connection.capabilities().hasFeature(e)}}},933:(e,t,s)=>{const r=s(458),i=s(768),n=s(147);e.exports=class extends n{constructor(e){super("basic",e,{id:null,title:"HTTP Basic",description:"Login with username and password using the method HTTP Basic."}),this.username=null}async login(e,t){let s=await this.connection._send({method:"get",responseType:"json",url:"/credentials/basic",headers:{Authorization:"Basic "+r.base64encode(e+":"+t)}});if(!i.isObject(s.data)||"string"!=typeof s.data.access_token)throw new Error("No access_token returned.");this.username=e,this.setToken(s.data.access_token)}getDisplayName(){return this.username}async logout(){this.username=null,await super.logout()}}},458:e=>{e.exports=class{static getName(){return"Browser"}static getUrl(){return window.location.toString()}static setUrl(e){throw new Error("setUrl is not supported in a browser environment.")}static handleErrorResponse(e){return new Promise(((t,s)=>{let r=new FileReader;r.onerror=e=>{r.abort(),s(e.target.error)},r.onload=()=>{let e=r.result instanceof ArrayBuffer?String.fromCharCode.apply(null,new Uint16Array(r.result)):r.result,s="string"==typeof e?JSON.parse(e):e;t(s)},r.readAsText(e.response.data)}))}static getResponseType(){return"blob"}static base64encode(e){return btoa(e)}static fileNameForUpload(e){return e.name.split(/(\\|\/)/g).pop()}static dataForUpload(e){return e}static async downloadResults(e,t,s){throw new Error("downloadResults is not supported in a browser environment.")}static saveToFile(e,t){return new Promise(((s,r)=>{try{e instanceof Blob||(e=new Blob([e],{type:"application/octet-stream"}));let r=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=r,i.setAttribute("download",t||"download"),void 0===i.download&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r),s()}catch(e){console.error(e),r(e)}}))}}},425:(e,t,s)=>{const r=s(804),i=s(897),n=s(742),a=s(768),o=s(779),l=s(659),c=["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links"];class u{static async fromVersion(e=null){let t="https://processes.openeo.org/processes.json";return"string"==typeof e&&(t="https://processes.openeo.org/"+e+"/processes.json"),await u.fromURL(t)}static async fromURL(e){let t=await n(e);return new u(t.data)}constructor(e,t=null,s=void 0){if(this.id=s,this.parent=t,this.parentNode=null,this.parentParameter=null,this.nodes={},this.idCounter={},this.callbackParameterCache={},this.parameters=void 0,this.processes=null,e instanceof l)this.processes=e;else if(a.isObject(e)&&Array.isArray(e.processes))this.processes=new l(e.processes);else{if(!Array.isArray(e))throw new Error("Processes are invalid; must be array or object according to the API.");this.processes=new l(e)}this.processes.all().forEach((e=>this.createFunction(e)))}createFunction(e){if(void 0!==this[e.id])throw new Error("Can't create function for process '"+e.id+"'. Already exists in Builder class.");this[e.id]=function(...t){return this.process(e.id,t)}}addProcessSpec(e,t=null){if(!a.isObject(e))throw new Error("Process '"+e.id+"' must be an object.");t||(t="backend"),this.processes.add(e,t),"backend"===t&&this.createFunction(e)}setParent(e,t){this.parentNode=e,this.parentParameter=t}createCallbackParameter(e){return this.callbackParameterCache[e]||(this.callbackParameterCache[e]=i.create(this,e)),this.callbackParameterCache[e]}getParentCallbackParameters(){let e=[];if(this.parentNode&&this.parentParameter)try{e=o.getCallbackParametersForProcess(this.parentNode.spec,this.parentParameter).map((e=>this.createCallbackParameter(e.name)))}catch(e){console.warn(e)}return e}addParameter(e,t=!0){if(void 0!==this.getParentCallbackParameters().find((t=>t.name===e.name)))return;let s=this;if(t)for(;s.parent;)s=s.parent;Array.isArray(s.parameters)||(s.parameters=[]);let r=s.parameters.findIndex((t=>t.name===e.name));-1!==r?Object.assign(s.parameters[r],e):s.parameters.push(e)}spec(e,t=null){return this.processes.get(e,t)}math(e){let t=new(s(212))(e);return t.setBuilder(this),t.generate(!1)}supports(e,t=null){return Boolean(this.spec(e,t))}process(e,t={},s=null){let i=null;if(e.includes("@")){let t;[e,...t]=e.split("@"),i=t.join("@")}let n=new r(this,e,t,s,i);return this.nodes[n.id]=n,n}toJSON(){let e={process_graph:a.mapObjectValues(this.nodes,(e=>e.toJSON()))};return c.forEach((t=>{void 0!==this[t]&&(e[t]=this[t])})),e}generateId(e=""){return e=e.replace("_","").substr(0,6),this.idCounter[e]?this.idCounter[e]++:this.idCounter[e]=1,e+this.idCounter[e]}}e.exports=u},212:(e,t,s)=>{const r=s(462),i=s(897),n=s(804);class a{constructor(e){let t=new r.Parser;this.tree=t.parse(e),this.builder=null}setBuilder(e){this.builder=e}generate(e=!0){let t=this.parseTree(this.tree);if(!(t instanceof n))throw new Error("Invalid formula specified.");return e&&(t.result=!0),t}parseTree(e){let t=Object.keys(e)[0];switch(t){case"Number":return parseFloat(e.Number);case"Identifier":return this.getRef(e.Identifier);case"Expression":return this.parseTree(e.Expression);case"FunctionCall":{let t=[];for(let s in e.FunctionCall.args)t.push(this.parseTree(e.FunctionCall.args[s]));return this.builder.process(e.FunctionCall.name,t)}case"Binary":return this.addOperatorProcess(e.Binary.operator,this.parseTree(e.Binary.left),this.parseTree(e.Binary.right));case"Unary":{let t=this.parseTree(e.Unary.expression);return"-"===e.Unary.operator?"number"==typeof t?-t:this.addOperatorProcess("*",-1,t):t}default:throw new Error("Operation "+t+" not supported.")}}getRef(e){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("string"==typeof e&&e.startsWith("#")){let t=e.substring(1);if(t in this.builder.nodes)return{from_node:t}}let t=this.builder.getParentCallbackParameters();if("string"==typeof e&&t.length>0){let s=e.match(/^\$+/),r=s?s[0].length:0;if(r>0&&t.length>=r){let s=e.substring(r);return t[r-1][s]}}let s=new i(e);return this.builder.addParameter(s),s}addOperatorProcess(e,t,s){let r=a.operatorMapping[e],i=this.builder.spec(r);if(r&&i){let n={};if(!Array.isArray(i.parameters)||i.parameters.length<2)throw new Error("Process for operator "+e+" must have at least two parameters");return n[i.parameters[0].name||"x"]=t,n[i.parameters[1].name||"y"]=s,this.builder.process(r,n)}throw new Error("Operator "+e+" not supported")}}a.operatorMapping={"-":"subtract","+":"add","/":"divide","*":"multiply","^":"power"},e.exports=a},804:(e,t,s)=>{const r=s(768),i=s(897);class n{constructor(e,t,s={},r=null,i=null){if(this.parent=e,this.spec=this.parent.spec(t,i),!this.spec)throw new Error("Process doesn't exist: "+t);this.id=e.generateId(t),this.namespace=i,this.arguments=Array.isArray(s)?this.namedArguments(s):s,this._description=r,this.result=!1,this.addParametersToProcess(this.arguments)}namedArguments(e){if(e.length>(this.spec.parameters||[]).length)throw new Error("More arguments specified than parameters available.");let t={};if(Array.isArray(this.spec.parameters))for(let s=0;s<this.spec.parameters.length;s++)t[this.spec.parameters[s].name]=e[s];return t}addParametersToProcess(e){for(let t in e){let s=e[t];s instanceof i?r.isObject(s.spec.schema)&&this.parent.addParameter(s.spec):s instanceof n?this.addParametersToProcess(s.arguments):(Array.isArray(s)||r.isObject(s))&&this.addParametersToProcess(s)}}description(e){return void 0===e?this._description:(this._description=e,this)}exportArgument(e,t){const a=s(212);if(r.isObject(e)){if(e instanceof n||e instanceof i)return e.ref();if(e instanceof a){let s=this.createBuilder(this,t);return e.setBuilder(s),e.generate(),s.toJSON()}if(e instanceof Date)return e.toISOString();if("function"==typeof e.toJSON)return e.toJSON();{let s={};for(let r in e)void 0!==e[r]&&(s[r]=this.exportArgument(e[r],t));return s}}return Array.isArray(e)?e.map((e=>this.exportArgument(e)),t):"function"==typeof e?this.exportCallback(e,t):e}createBuilder(e=null,t=null){let r=new(s(425))(this.parent.processes,this.parent);return null!==e&&null!==t&&r.setParent(e,t),r}exportCallback(e,t){let s=this.createBuilder(this,t),i=s.getParentCallbackParameters(),a=e.bind(s)(...i,s);if(Array.isArray(a)&&s.supports("array_create")?a=s.array_create(a):!r.isObject(a)&&s.supports("constant")&&(a=s.constant(a)),a instanceof n)return a.result=!0,s.toJSON();throw new Error("Callback must return BuilderNode")}toJSON(){let e={process_id:this.spec.id,arguments:{}};this.namespace&&(e.namespace=this.namespace);for(let t in this.arguments)void 0!==this.arguments[t]&&(e.arguments[t]=this.exportArgument(this.arguments[t],t));return"function"!=typeof this.description?e.description=this.description:"string"==typeof this._description&&(e.description=this._description),this.result&&(e.result=!0),e}ref(){return{from_node:this.id}}}e.exports=n},897:e=>{"use strict";class t{static create(e,s){let r=new t(s,null);if("undefined"!=typeof Proxy)return new Proxy(r,{nodeCache:{},get(t,s,i){if(!Reflect.has(t,s)){if(!this.nodeCache[s]){let t={data:r};"string"==typeof s&&s.match(/^(0|[1-9]\d*)$/)?t.index=parseInt(s,10):t.label=s,this.nodeCache[s]=e.process("array_element",t)}return this.nodeCache[s]}return Reflect.get(t,s,i)},set(e,t,s,r){if(!Reflect.has(e,t))throw new Error("Simplified array access is read-only");return Reflect.set(e,t,s,r)}});throw new Error("Simplified array access not supported, use array_element directly")}constructor(e,t={},s="",r=void 0){this.name=e,this.spec={name:e,schema:"string"==typeof t?{type:t}:t,description:s},void 0!==r&&(this.spec.optional=!0,this.spec.default=r)}toJSON(){return this.spec}ref(){return{from_parameter:this.name}}}e.exports=t},462:e=>{let t={Token:{Operator:"Operator",Identifier:"Identifier",Number:"Number"}};const s={"⁰":0,"¹":1,"²":2,"³":3,"⁴":4,"⁵":5,"⁶":6,"⁷":7,"⁸":8,"⁹":9},r=Object.keys(s).join("");t.Lexer=function(){let e="",s=0,i=0,n=0,a=t.Token;function o(){let t=i;return t<s?e.charAt(t):"\0"}function l(){let t="\0",r=i;return r<s&&(t=e.charAt(r),i+=1),t}function c(e){return"\t"===e||" "===e||" "===e}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function p(e){return e>="0"&&e<="9"}function h(e,t){return{type:e,value:t,start:n,end:i-1}}function d(e,t=!1){return"_"===e||u(e)||p(e)||t&&function(e){return"-"===e||"."===e||"~"===e||"@"===e}(e)}function f(){let e;if(function(){let e;for(;i<s&&(e=o(),c(e));)l()}(),!(i>=s)){if(n=i,e=function(){let e,t;if(e=o(),p(e)||"."===e){if(t="","."!==e)for(t=l();e=o(),p(e);)t+=l();if("."===e)for(t+=l();e=o(),p(e);)t+=l();if("e"===e||"E"===e){if(t+=l(),e=o(),"+"!==e&&"-"!==e&&!p(e))throw e="character "+e,i>=s&&(e="<end>"),new SyntaxError("Unexpected "+e+" after the exponent sign");for(t+=l();e=o(),p(e);)t+=l()}if("."===t)throw new SyntaxError("Expecting decimal digits after the dot sign");return h(a.Number,t)}}(),void 0!==e)return e;if(e=function(){let e=o();if(("+-*/()^,"+r).indexOf(e)>=0)return h(a.Operator,l())}(),void 0!==e)return e;if(e=function(){let e=o();if("_"!==(t=e)&&"#"!==t&&"$"!==t&&!u(t))return;var t;let s=l(),r=!1;for(;;){let t=o();if("$"===e)"$"!==t&&(e="");else if("@"===t)r=!0;else if(!d(t,r))break;s+=l()}return h(a.Identifier,s)}(),void 0!==e)return e;throw new SyntaxError("Unknown token from character "+o())}}return{reset:function(t){e=t,s=t.length,i=0},next:f,peek:function(){let e,t=i;try{e=f(),delete e.start,delete e.end}catch(t){e=void 0}return i=t,e}}},t.Parser=function(){let e=new t.Lexer,i=t.Token;function n(e,t){return void 0!==e&&e.type===i.Operator&&t.includes(e.value)}function a(){let t,s=e.peek();return n(s,"-+")?(s=e.next(),t=a(),{Unary:{operator:s.value,expression:t}}):function(){let t,s=e.peek();if(void 0===s)throw new SyntaxError("Unexpected termination of expression");if(s.type===i.Identifier)return s=e.next(),n(e.peek(),"(")?function(t){let s=[],r=e.next();if(!n(r,"("))throw new SyntaxError('Expecting ( in a function call "'+t+'"');if(r=e.peek(),n(r,")")||(s=function(){let t,s,r=[];for(;s=c(),void 0!==s&&(r.push(s),t=e.peek(),n(t,","));)e.next();return r}()),r=e.next(),!n(r,")"))throw new SyntaxError('Expecting ) in a function call "'+t+'"');return{FunctionCall:{name:t,args:s}}}(s.value):{Identifier:s.value};if(s.type===i.Number)return s=e.next(),{Number:s.value};if(n(s,"(")){if(e.next(),t=c(),s=e.next(),!n(s,")"))throw new SyntaxError("Expecting )");return{Expression:t}}throw new SyntaxError("Parse error, can not process token "+s.value)}()}function o(){let t=a(),i=e.peek();for(;n(i,"^"+r);)i=e.next(),t={Binary:{operator:"^",left:t,right:"^"!==i.value?(o=i.value,"number"==typeof s[o]?{Number:s[o]}:null):a()}},i=e.peek();var o;return t}function l(){let t=o(),s=e.peek();for(;n(s,"*/");)s=e.next(),t={Binary:{operator:s.value,left:t,right:o()}},s=e.peek();return t}function c(){return function(){let t=l(),s=e.peek();for(;n(s,"+-");)s=e.next(),t={Binary:{operator:s.value,left:t,right:l()}},s=e.peek();return t}()}return{parse:function(t){e.reset(t);let s=c(),r=e.next();if(void 0!==r)throw new SyntaxError("Unexpected token "+r.value);return{Expression:s}}}},e.exports=t},26:(e,t,s)=>{const r=s(768),i={capabilities:!0,listFileTypes:"get /file_formats",listServiceTypes:"get /service_types",listUdfRuntimes:"get /udf_runtimes",listCollections:"get /collections",describeCollection:"get /collections/{}",listCollectionItems:"get /collections/{}/items",describeCollectionItem:"get /collections/{}/items/{}",describeCollectionQueryables:"get /collections/{}/queryables",listProcesses:"get /processes",describeProcess:"get /processes",listAuthProviders:!0,authenticateOIDC:"get /credentials/oidc",authenticateBasic:"get /credentials/basic",describeAccount:"get /me",listFiles:"get /files",getFile:"get /files",uploadFile:"put /files/{}",downloadFile:"get /files/{}",deleteFile:"delete /files/{}",validateProcess:"post /validation",listUserProcesses:"get /process_graphs",describeUserProcess:"get /process_graphs/{}",getUserProcess:"get /process_graphs/{}",setUserProcess:"put /process_graphs/{}",replaceUserProcess:"put /process_graphs/{}",deleteUserProcess:"delete /process_graphs/{}",computeResult:"post /result",listJobs:"get /jobs",createJob:"post /jobs",listServices:"get /services",createService:"post /services",getJob:"get /jobs/{}",describeJob:"get /jobs/{}",updateJob:"patch /jobs/{}",deleteJob:"delete /jobs/{}",estimateJob:"get /jobs/{}/estimate",debugJob:"get /jobs/{}/logs",startJob:"post /jobs/{}/results",stopJob:"delete /jobs/{}/results",listResults:"get /jobs/{}/results",downloadResults:"get /jobs/{}/results",describeService:"get /services/{}",getService:"get /services/{}",updateService:"patch /services/{}",deleteService:"delete /services/{}",debugService:"get /services/{}/logs"};e.exports=class{constructor(e){this.data=e,this.featureMap=i,this.features=[],this.validate(),this.init()}validate(){if(!r.isObject(this.data))throw new Error("No capabilities retrieved.");if(!this.data.api_version)throw new Error("Invalid capabilities: No API version retrieved");if(!Array.isArray(this.data.endpoints))throw new Error("Invalid capabilities: No endpoints retrieved")}init(){this.features=this.data.endpoints.map((e=>e.methods.map((t=>`${t} ${e.path.replace(/\{[^}]+\}/g,"{}")}`.toLowerCase())))).reduce(((e,t)=>e.concat(t)),[])}toJSON(){return this.data}apiVersion(){return this.data.api_version}backendVersion(){return this.data.backend_version}title(){return"string"==typeof this.data.title?this.data.title:""}description(){return"string"==typeof this.data.description?this.data.description:""}isStable(){return!0===this.data.production}links(){return Array.isArray(this.data.links)?this.data.links:[]}listFederation(){let e=[];if(r.isObject(this.data.federation))for(const[t,s]of Object.entries(this.data.federation))e.push({id:t,...s});return e}getFederationBackend(e){return{id:e,...this.data.federation[e]}}getFederationBackends(e){return e.map(this.getFederationBackend,this)}listFeatures(){let e=[];for(let t in this.featureMap)(!0===this.featureMap[t]||this.features.includes(this.featureMap[t]))&&e.push(t);return e.sort()}hasFeature(e){let t=this.featureMap[e];return"string"==typeof t&&(t=t.toLowerCase()),!0===t||this.features.some((e=>e===t))}currency(){return r.isObject(this.data.billing)&&"string"==typeof this.data.billing.currency?this.data.billing.currency:null}listPlans(){if(r.isObject(this.data.billing)&&Array.isArray(this.data.billing.plans)){let e="string"==typeof this.data.billing.default_plan?this.data.billing.default_plan.toLowerCase():null;return this.data.billing.plans.map((t=>{let s={default:e===t.name.toLowerCase()};return Object.assign({},t,s)}))}return[]}migrate(e){return e}}},704:(e,t,s)=>{const r=s(458),i=s(768),n=s(659),a=s(742),o=s(321),l=s(147),c=s(933),u=s(688),p=s(26),h=s(405),d=s(649),f=s(293),m=s(806),g=s(497),y=s(425),b=s(804),{CollectionPages:v,ItemPages:w,JobPages:x,ProcessPages:A,ServicePages:_,UserFilePages:O}=s(226),j=["conformance","http://www.opengis.net/def/rel/ogc/1.0/conformance"];e.exports=class{constructor(e,t={},s=null){this.url=s,this.baseUrl=i.normalizeUrl(e),this.authProviderList=null,this.authProvider=null,this.capabilitiesObject=null,this.listeners={},this.options=t,this.processes=new n([],Boolean(t.addNamespaceToProcess)),this.processes.listeners.push(((...e)=>this.emit("processesChanged",...e)))}async init(){const e=await this._get("/"),t=Object.assign({},e.data);if(t.links=this.makeLinksAbsolute(t.links,e),!Array.isArray(t.conformsTo)&&Array.isArray(t.links)){const e=this._getLinkHref(t.links,j);if(e){const s=await this._get(e);i.isObject(s.data)&&Array.isArray(s.data.conformsTo)&&(t.conformsTo=s.data.conformsTo)}}return this.capabilitiesObject=new p(t),this.capabilitiesObject}async refreshProcessCache(){if(0===this.processes.count())return;const e=this.processes.namespaces().map((e=>{let t=()=>Promise.resolve();if("user"===e){const e=this.processes.namespace("user");this.isAuthenticated()?this.capabilities().hasFeature("listUserProcesses")&&(t=()=>this.listUserProcesses(e)):t=()=>this.processes.remove(null,"user")?Promise.resolve():Promise.reject(new Error("Can't clear user processes"))}else this.capabilities().hasFeature("listProcesses")&&(t=()=>this.listProcesses(e));return t().catch((t=>console.warn(`Could not update processes for namespace '${e}' due to an error: ${t.message}`)))}));return await Promise.all(e)}getBaseUrl(){return this.baseUrl}getUrl(){return this.url||this.baseUrl}capabilities(){return this.capabilitiesObject}async listFileTypes(){const e=await this._get("/file_formats");return new h(e.data)}async listServiceTypes(){return(await this._get("/service_types")).data}async listUdfRuntimes(){return(await this._get("/udf_runtimes")).data}async listCollections(){const e=this.paginateCollections(null);return await e.nextPage([],!1)}paginateCollections(e=50){return new v(this,e)}async describeCollection(e){const t=await this._get("/collections/"+e);return t.data.stac_version?o.collection(t.data):t.data}listCollectionItems(e,t=null,s=null,r=null){let i={};return Array.isArray(t)&&(i.bbox=t.join(",")),Array.isArray(s)&&(i.datetime=s.map((e=>e instanceof Date?e.toISOString():"string"==typeof e?e:"..")).join("/")),r>0&&(i.limit=r),new w(this,e,i,r)}normalizeNamespace(e){const t=e.match(/^https?:\/\/.*\/processes\/(@?[\w\-.~:]+)\/?/i);return t&&t.length>1?t[1]:e}async listProcesses(e=null){const t=this.paginateProcesses(e);return await t.nextPage([],!1)}paginateProcesses(e=null,t=50){return new A(this,t,e)}async describeProcess(e,t=null){if(t||(t="backend"),"backend"===t)await this.listProcesses();else{const s=await this._get(`/processes/${this.normalizeNamespace(t)}/${e}`);if(!i.isObject(s.data)||"string"!=typeof s.data.id)throw new Error("Invalid response received for process");this.processes.add(s.data,t)}return this.processes.get(e,t)}async buildProcess(e){return await this.listProcesses(),new y(this.processes,null,e)}async listAuthProviders(){if(null!==this.authProviderList)return this.authProviderList;this.authProviderList=[];const e=this.capabilities();if(e.hasFeature("authenticateOIDC")){const e=await this._get("/credentials/oidc"),t=this.getOidcProviderFactory();if(i.isObject(e.data)&&Array.isArray(e.data.providers)&&"function"==typeof t)for(let s in e.data.providers){const r=t(e.data.providers[s]);r instanceof l&&this.authProviderList.push(r)}}return e.hasFeature("authenticateBasic")&&this.authProviderList.push(new c(this)),this.authProviderList}setOidcProviderFactory(e){this.oidcProviderFactory=e}getOidcProviderFactory(){return"function"==typeof this.oidcProviderFactory?this.oidcProviderFactory:u.isSupported()?e=>new u(this,e):null}async authenticateBasic(e,t){const s=new c(this);await s.login(e,t)}isAuthenticated(){return null!==this.authProvider}emit(e,...t){"function"==typeof this.listeners[e]&&this.listeners[e](...t)}on(e,t){this.listeners[e]=t}off(e){delete this.listeners[e]}getAuthProvider(){return this.authProvider}setAuthProvider(e){e!==this.authProvider&&(this.authProvider=e instanceof l?e:null,this.emit("authProviderChanged",this.authProvider),this.refreshProcessCache())}setAuthToken(e,t,s){const r=new l(e,this,{id:t,title:"Custom",description:""});return r.setToken(s),this.setAuthProvider(r),r}async describeAccount(){return(await this._get("/me")).data}async listFiles(){const e=this.paginateFiles(null);return await e.nextPage()}paginateFiles(e=50){return new O(this,e)}async uploadFile(e,t=null,s=null,i=null){null===t&&(t=r.fileNameForUpload(e));const n=await this.getFile(t);return await n.uploadFile(e,s,i)}async getFile(e){return new d(this,e)}_normalizeUserProcess(e,t={}){return e instanceof m?e=e.toJSON():e instanceof b?(e.result=!0,e=e.parent.toJSON()):i.isObject(e)&&!i.isObject(e.process_graph)&&(e={process_graph:e}),Object.assign({},t,{process:e})}async validateProcess(e){const t=await this._post("/validation",this._normalizeUserProcess(e).process);if(Array.isArray(t.data.errors)){const e=t.data.errors;return e["federation:backends"]=Array.isArray(t.data["federation:missing"])?t.data["federation:missing"]:[],e}throw new Error("Invalid validation response received.")}async listUserProcesses(e=[]){const t=this.paginateUserProcesses(null);return await t.nextPage(e)}paginateUserProcesses(e=50){return this.paginateProcesses("user",e)}async setUserProcess(e,t){const s=new m(this,e);return await s.replaceUserProcess(t)}async getUserProcess(e){const t=new m(this,e);return await t.describeUserProcess()}async computeResult(e,t=null,s=null,n=null,a={}){const o=this._normalizeUserProcess(e,Object.assign({},a,{plan:t,budget:s})),l=await this._post("/result",o,r.getResponseType(),n),c={data:l.data,costs:null,type:null,logs:[]};"number"==typeof l.headers["openeo-costs"]&&(c.costs=l.headers["openeo-costs"]),"string"==typeof l.headers["content-type"]&&(c.type=l.headers["content-type"]);const u=Array.isArray(l.headers.link)?l.headers.link:[l.headers.link];for(let e of u){if("string"!=typeof e)continue;const t=e.match(/^<([^>]+)>;\s?rel="monitor"/i);if(Array.isArray(t)&&t.length>1)try{const e=await this._get(t[1]);i.isObject(e.data)&&Array.isArray(e.data.logs)&&(c.logs=e.data.logs)}catch(e){console.warn(e)}}return c}async downloadResult(e,t,s=null,i=null,n=null){const a=await this.computeResult(e,s,i,n);await r.saveToFile(a.data,t)}async listJobs(e=[]){const t=this.paginateJobs(null);return await t.nextPage(e)}paginateJobs(e=50){return new x(this,e)}async createJob(e,t=null,s=null,r=null,i=null,n={}){n=Object.assign({},n,{title:t,description:s,plan:r,budget:i});const a=this._normalizeUserProcess(e,n),o=await this._post("/jobs",a);if("string"!=typeof o.headers["openeo-identifier"])throw new Error("Response did not contain a Job ID. Job has likely been created, but may not show up yet.");const l=new f(this,o.headers["openeo-identifier"]).setAll(a);return this.capabilities().hasFeature("describeJob")?await l.describeJob():l}async getJob(e){const t=new f(this,e);return await t.describeJob()}async listServices(e=[]){const t=this.paginateServices(null);return await t.nextPage(e)}paginateServices(e=50){return new _(this,e)}async createService(e,t,s=null,r=null,i=!0,n={},a=null,o=null,l={}){const c=this._normalizeUserProcess(e,Object.assign({title:s,description:r,type:t,enabled:i,configuration:n,plan:a,budget:o},l)),u=await this._post("/services",c);if("string"!=typeof u.headers["openeo-identifier"])throw new Error("Response did not contain a Service ID. Service has likely been created, but may not show up yet.");const p=new g(this,u.headers["openeo-identifier"]).setAll(c);return this.capabilities().hasFeature("describeService")?p.describeService():p}async getService(e){const t=new g(this,e);return await t.describeService()}_getLinkHref(e,t){if(Array.isArray(t)||(t=[t]),Array.isArray(e)){const s=e.find((e=>i.isObject(e)&&t.includes(e.rel)&&"string"==typeof e.href));if(s)return s.href}return null}makeLinksAbsolute(e,t=null){if(!Array.isArray(e))return e;let s=null;return s=i.isObject(t)&&t.headers&&t.config&&t.request?t.config.baseURL+t.config.url:"string"!=typeof t?this._getLinkHref(e,"self"):t,s?e.map((e=>{if(!i.isObject(e)||"string"!=typeof e.href)return e;try{const t=new URL(e.href,s);return Object.assign({},e,{href:t.toString()})}catch(t){return e}})):e}async _get(e,t,s,r=null){return await this._send({method:"get",responseType:s,url:e,timeout:"/"===e?5e3:0,params:t},r)}async _post(e,t,s,r=null){const i={method:"post",responseType:s,url:e,data:t};return await this._send(i,r)}async _put(e,t){return await this._send({method:"put",url:e,data:t})}async _patch(e,t){return await this._send({method:"patch",url:e,data:t})}async _delete(e){return await this._send({method:"delete",url:e})}async download(e,t){return(await this._send({method:"get",responseType:r.getResponseType(),url:e,authorization:t})).data}_getAuthHeaders(){const e={};return this.isAuthenticated()&&(e.Authorization="Bearer "+this.authProvider.getToken()),e}async _send(e,t=null){e.baseURL=this.baseUrl,void 0!==e.authorization&&!0!==e.authorization||(e.headers||(e.headers={}),Object.assign(e.headers,this._getAuthHeaders())),e.responseType||(e.responseType="json"),t&&(e.signal=t.signal);try{let t=await a(e);const s=this.capabilities();return s&&(t=s.migrate(t)),t}catch(t){if(a.isCancel(t))throw t;const s=e=>"string"==typeof e&&-1!==e.indexOf("/json"),n=(e,t)=>("string"==typeof t.message&&(e.message=t.message),e.code="string"==typeof t.code?t.code:"",e.id=t.id,e.links=Array.isArray(t.links)?t.links:[],e);if(i.isObject(t.response)&&i.isObject(t.response.data)&&(s(t.response.data.type)||i.isObject(t.response.headers)&&s(t.response.headers["content-type"]))){if(e.responseType!==r.getResponseType())throw n(t,t.response.data);try{throw n(t,await r.handleErrorResponse(t))}catch(e){console.error(e)}}throw t}}}},405:(e,t,s)=>{const r=s(768);e.exports=class{constructor(e){if(this.data={input:{},output:{}},r.isObject(e)){for(let t of["input","output"])for(let s in e[t])r.isObject(e[t])&&(this.data[t][s.toUpperCase()]=e[t][s]);this["federation:missing"]=e["federation:missing"]}}toJSON(){return this.data}getInputTypes(){return this.data.input}getOutputTypes(){return this.data.output}getInputType(e){return this._findType(e,"input")}getOutputType(e){return this._findType(e,"output")}_findType(e,t){return(e=e.toUpperCase())in this.data[t]?this.data[t][e]:null}}},293:(e,t,s)=>{const r=s(458),i=s(54),n=s(431),a=s(768),o=s(321),l=["finished","canceled","error"];e.exports=class extends i{constructor(e,t){super(e,["id","title","description","process","status","progress","created","updated","plan","costs","budget","usage",["log_level","logLevel"],"links"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.status=void 0,this.progress=void 0,this.created=void 0,this.updated=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeJob(){let e=await this.connection._get("/jobs/"+this.id);return this.setAll(e.data)}async updateJob(e){return await this.connection._patch("/jobs/"+this.id,this._convertToRequest(e)),this._supports("describeJob")?await this.describeJob():this.setAll(e)}async deleteJob(){await this.connection._delete("/jobs/"+this.id)}async estimateJob(){return(await this.connection._get("/jobs/"+this.id+"/estimate")).data}debugJob(e=null){return new n(this.connection,"/jobs/"+this.id+"/logs",e)}monitorJob(e,t=60,s=!0){if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeJob"))throw new Error("Monitoring Jobs not supported by the back-end.");let i=this.status,n=null,a=null;r.hasFeature("debugJob")&&s&&(a=this.debugJob());let o=async()=>{this.getDataAge()>1&&await this.describeJob();let t=a?await a.nextLogs():[];(i!==this.status||t.length>0)&&e(this,t),i=this.status,l.includes(this.status)&&c()};setTimeout(o,0),n=setInterval(o,1e3*t);let c=()=>{n&&(clearInterval(n),n=null)};return c}async startJob(){return await this.connection._post("/jobs/"+this.id+"/results",{}),this._supports("describeJob")?await this.describeJob():this}async stopJob(){return await this.connection._delete("/jobs/"+this.id+"/results"),this._supports("describeJob")?await this.describeJob():this}async getResultsAsStac(){let e=await this.connection._get("/jobs/"+this.id+"/results");if(!a.isObject(e)||!a.isObject(e.data))throw new Error("Results received from the back-end are invalid");let t=o.stac(e.data);return a.isObject(t.assets)||(t.assets={}),"Feature"===t.type?"number"==typeof e.headers["openeo-costs"]&&(t.properties.costs=e.headers["openeo-costs"]):"number"==typeof e.headers["openeo-costs"]&&(t.costs=e.headers["openeo-costs"]),t}async listResults(){let e=await this.getResultsAsStac();return a.isObject(e.assets)?Object.values(e.assets):[]}async downloadResults(e){let t=await this.listResults();return await r.downloadResults(this.connection,t,e)}}},431:(e,t,s)=>{const r=s(768);e.exports=class{constructor(e,t,s=null){this.connection=e,this.endpoint=t,this.lastId="",this.level=s,this.missing=new Set}async nextLogs(e=null){let t=await this.next(e);return Array.isArray(t.logs)?t.logs:[]}getMissingBackends(){return Array.from(this.missing)}async next(e=null){let t={offset:this.lastId};e>0&&(t.limit=e),this.level&&(t.level=this.level);let s=await this.connection._get(this.endpoint,t);return Array.isArray(s.data.logs)&&s.data.logs.length>0?(s.data.logs=s.data.logs.filter((e=>r.isObject(e)&&"string"==typeof e.id)),this.lastId=s.data.logs[s.data.logs.length-1].id):s.data.logs=[],s.data.links=Array.isArray(s.data.links)?s.data.links:[],Array.isArray(s.data["federation:missing"])&&s.data["federation:missing"].forEach((e=>this.missing.add(e))),s.data}}},688:(e,t,s)=>{const r=s(768),i=s(147),n=s(458),a=s(117);class o extends i{static isSupported(){return r.isObject(a)&&Boolean(a.UserManager)}static async signinCallback(e=null,t={}){let s=n.getUrl();e||(e=new o(null,{})).setGrant(s.includes("?")?"authorization_code+pkce":"implicit");let r=e.getOptions(t),i=new a.UserManager(r);return await i.signinCallback(s)}constructor(e,t){super("oidc",e,t),this.manager=null,this.listeners={},this.user=null,this.clientId=null,this.grant="authorization_code+pkce",this.issuer=t.issuer||"",this.scopes=Array.isArray(t.scopes)&&t.scopes.length>0?t.scopes:["openid"],this.refreshTokenScope="offline_access",this.links=Array.isArray(t.links)?t.links:[],this.defaultClients=Array.isArray(t.default_clients)?t.default_clients:[],this.defaultClient=this.detectDefaultClient()}addListener(e,t,s="default"){this.manager.events[`add${e}`](t),this.listeners[`${s}:${e}`]=t}removeListener(e,t="default"){this.manager.events[`remove${e}`](this.listeners[e]),delete this.listeners[`${t}:${e}`]}async login(e={},t=!1){if(!this.issuer||"string"!=typeof this.issuer)throw new Error("No Issuer URL available for OpenID Connect");this.manager=new a.UserManager(this.getOptions(e,t)),this.addListener("UserLoaded",(async()=>this.setUser(await this.manager.getUser())),"js-client"),this.addListener("AccessTokenExpired",(()=>this.setUser(null)),"js-client"),"popup"===o.uiMethod?await this.manager.signinPopup():await this.manager.signinRedirect()}async logout(){if(null!==this.manager){try{"popup"===o.uiMethod?await this.manager.signoutPopup():await this.manager.signoutRedirect({post_logout_redirect_uri:n.getUrl()})}catch(e){console.warn(e)}super.logout(),this.removeListener("UserLoaded","js-client"),this.removeListener("AccessTokenExpired","js-client"),this.manager=null,this.setUser(null)}}getOptions(e={},t=!1){let s=this.getResponseType(),r=this.scopes.slice(0);return t&&!r.includes(this.refreshTokenScope)&&r.push(this.refreshTokenScope),Object.assign({client_id:this.clientId,redirect_uri:o.redirectUrl,authority:this.issuer.replace("/.well-known/openid-configuration",""),scope:r.join(" "),validateSubOnSilentRenew:!0,response_type:s,response_mode:s.includes("code")?"query":"fragment"},e)}getResponseType(){switch(this.grant){case"authorization_code+pkce":return"code";case"implicit":return"token id_token";default:throw new Error("Grant Type not supported")}}setGrant(e){switch(e){case"authorization_code+pkce":case"implicit":this.grant=e;break;default:throw new Error("Grant Type not supported")}}setClientId(e){this.clientId=e}setUser(e){e?(this.user=e,this.setToken(e.access_token)):(this.user=null,this.setToken(null))}getDisplayName(){return this.user&&r.isObject(this.user.profile)&&(this.user.profile.name||this.user.profile.preferred_username||this.user.profile.email)||null}detectDefaultClient(){for(let e of o.grants){let t=this.defaultClients.find((t=>Boolean(t.grant_types.includes(e)&&Array.isArray(t.redirect_urls)&&t.redirect_urls.find((e=>e.startsWith(o.redirectUrl))))));if(t)return this.setGrant(e),this.setClientId(t.id),this.defaultClient=t,t}return null}}o.uiMethod="redirect",o.redirectUrl=n.getUrl().split("#")[0].split("?")[0].replace(/\/$/,""),o.grants=["authorization_code+pkce","implicit"],e.exports=o},224:(e,t,s)=>{const r=s(742),i=s(768),n=s(304),a=s(704),o=s(293),l=s(431),c=s(649),u=s(806),p=s(497),h=s(147),d=s(933),f=s(688),m=s(26),g=s(405),y=s(425),b=s(804),v=s(897),w=s(212),x="1.0.0-rc.2",A="1.x.x";class _{static async connect(e,t={}){let s=i.normalizeUrl(e,"/.well-known/openeo"),a=e,o=null;try{if(o=await r.get(s,{timeout:5e3}),!i.isObject(o.data)||!Array.isArray(o.data.versions))throw new Error("Well-Known Document doesn't list any versions.")}catch(e){console.warn("Can't read well-known document, connecting directly to the specified URL as fallback mechanism. Reason: "+e.message)}if(i.isObject(o)){let e=n.findLatest(o.data.versions,!0,x,A);if(null===e)throw new Error("Server not supported. Client only supports the API versions between "+x+" and "+A);a=e.url}let l=await _.connectDirect(a,t);return l.url=e,l}static async connectDirect(e,t={}){let s=new a(e,t),r=await s.init();if(n.compare(r.apiVersion(),x,"<")||n.compare(r.apiVersion(),A,">"))throw new Error("Client only supports the API versions between "+x+" and "+A);return s}static clientVersion(){return"2.8.0"}}_.Environment=s(458),e.exports={AbortController,AuthProvider:h,BasicProvider:d,Capabilities:m,Connection:a,FileTypes:g,Job:o,Logs:l,OidcProvider:f,OpenEO:_,Service:p,UserFile:c,UserProcess:u,Builder:y,BuilderNode:b,Parameter:v,Formula:w}},226:(e,t,s)=>{const r=s(293),i=s(497),n=s(649),a=s(806),o=s(768),l=s(321),c="federation:missing";class u{constructor(e,t,s,r,i={},n="id"){this.connection=e,this.nextUrl=t,this.key=s,this.primaryKey=n,this.cls=r,i.limit>0||delete i.limit,this.params=i}hasNextPage(){return null!==this.nextUrl}async nextPage(e=[],t=!0){const s=await this.connection._get(this.nextUrl,this.params);let r=s.data;if(!o.isObject(r))throw new Error("Response is invalid, is not an object");if(!Array.isArray(r[this.key]))throw new Error(`Response is invalid, '${this.key}' property is not an array`);let i=r[this.key].map((t=>{let s=e.find((e=>e[this.primaryKey]===t[this.primaryKey]));return s?s.setAll(t):s=this._createObject(t),s}));return i=this._cache(i),r.links=this._ensureArray(r.links),this.connection._getLinkHref(r.links,"self")||r.links.push({rel:"self",href:this.nextUrl}),this.nextUrl=this._getNextLink(s),this.params=null,t?(i.links=r.links,i[c]=this._ensureArray(r[c]),i):(r[this.key]=i,r)}_ensureArray(e){return Array.isArray(e)?e:[]}_createObject(e){if(this.cls){const t=new(0,this.cls)(this.connection,e[this.primaryKey]);return t.setAll(e),t}return e}_cache(e){return e}_getNextLink(e){const t=this.connection.makeLinksAbsolute(e.data.links,e);return this.connection._getLinkHref(t,"next")}[Symbol.asyncIterator](){return{self:this,async next(){const e=!this.self.hasNextPage();let t;return e||(t=await this.self.nextPage()),{done:e,value:t}}}}}e.exports={Pages:u,CollectionPages:class extends u{constructor(e,t=null){super(e,"/collections","collections",null,{limit:t})}_createObject(e){return e.stac_version?l.collection(e):e}},ItemPages:class extends u{constructor(e,t,s){super(e,`/collections/${t}/items`,"features",null,s)}_createObject(e){return e.stac_version?l.item(e):e}},JobPages:class extends u{constructor(e,t=null){super(e,"/jobs","jobs",r,{limit:t})}},ProcessPages:class extends u{constructor(e,t=null,s=null){let r;s||(s="backend");let i=null;"user"===s?(r="/process_graphs",i=a):(r="/processes","backend"!==s&&(r+=`/${e.normalizeNamespace(s)}`)),super(e,r,"processes",i,{limit:t}),this.namespace=s}_cache(e){const t=e.map((e=>"function"==typeof e.toJSON?e.toJSON():e));if(this.connection.processes.addAll(t,this.namespace),!this.cls)for(let t in e)e[t]=this.connection.processes.get(e[t].id,this.namespace);return e}},ServicePages:class extends u{constructor(e,t=null){super(e,"/services","services",i,{limit:t})}},UserFilePages:class extends u{constructor(e,t=null){super(e,"/files","files",n,{limit:t},"path")}}}},497:(e,t,s)=>{const r=s(54),i=s(431);e.exports=class extends r{constructor(e,t){super(e,["id","title","description","process","url","type","enabled","configuration","attributes","created","plan","costs","budget","usage",["log_level","logLevel"],"links"]),this.id=t,this.title=void 0,this.description=void 0,this.process=void 0,this.url=void 0,this.type=void 0,this.enabled=void 0,this.configuration=void 0,this.attributes=void 0,this.created=void 0,this.plan=void 0,this.costs=void 0,this.budget=void 0}async describeService(){let e=await this.connection._get("/services/"+this.id);return this.setAll(e.data)}async updateService(e){return await this.connection._patch("/services/"+this.id,this._convertToRequest(e)),this._supports("describeService")?await this.describeService():this.setAll(e)}async deleteService(){await this.connection._delete("/services/"+this.id)}debugService(e=null){return new i(this.connection,"/services/"+this.id+"/logs",e)}monitorService(e,t=60,s=!0){if("function"!=typeof e||t<1)return;let r=this.connection.capabilities();if(!r.hasFeature("describeService"))throw new Error("Monitoring Services not supported by the back-end.");let i=this.enabled,n=null,a=null;r.hasFeature("debugService")&&s&&(a=this.debugService());let o=async()=>{this.getDataAge()>1&&await this.describeService();let t=a?await a.nextLogs():[];(i!==this.enabled||t.length>0)&&e(this,t),i=this.enabled};return setTimeout(o,0),n=setInterval(o,1e3*t),()=>{n&&(clearInterval(n),n=null)}}}},649:(e,t,s)=>{const r=s(458),i=s(54);e.exports=class extends i{constructor(e,t){super(e,["path","size","modified"]),this.path=t,this.size=void 0,this.modified=void 0}async retrieveFile(){return await this.connection.download("/files/"+this.path,!0)}async downloadFile(e){let t=await this.connection.download("/files/"+this.path,!0);return await r.saveToFile(t,e)}async uploadFile(e,t=null,s=null){let i={method:"put",url:"/files/"+this.path,data:r.dataForUpload(e),headers:{"Content-Type":"application/octet-stream"}};"function"==typeof t&&(i.onUploadProgress=e=>{let s=Math.round(100*e.loaded/e.total);t(s,this)});let n=await this.connection._send(i,s);return this.setAll(n.data)}async deleteFile(){await this.connection._delete("/files/"+this.path)}}},806:(e,t,s)=>{const r=s(54),i=s(768);e.exports=class extends r{constructor(e,t){super(e,["id","summary","description","categories","parameters","returns","deprecated","experimental","exceptions","examples","links",["process_graph","processGraph"]]),this.id=t,this.summary=void 0,this.description=void 0,this.categories=void 0,this.parameters=void 0,this.returns=void 0,this.deprecated=void 0,this.experimental=void 0,this.exceptions=void 0,this.examples=void 0,this.links=void 0,this.processGraph=void 0}async describeUserProcess(){let e=await this.connection._get("/process_graphs/"+this.id);if(!i.isObject(e.data)||"string"!=typeof e.data.id)throw new Error("Invalid response received for user process");return this.connection.processes.add(e.data,"user"),this.setAll(e.data)}async replaceUserProcess(e){if(await this.connection._put("/process_graphs/"+this.id,this._convertToRequest(e)),this._supports("describeUserProcess"))return this.describeUserProcess();{let t=this.setAll(e);return this.connection.processes.add(t.toJSON(),"user"),t}}async deleteUserProcess(){await this.connection._delete("/process_graphs/"+this.id),this.connection.processes.remove(this.id,"user")}}},385:(e,t,s)=>{"use strict";s.r(t),s.d(t,{compare:()=>u,compareVersions:()=>c,satisfies:()=>f,validate:()=>m,validateStrict:()=>g});const r=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,i=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(r);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},n=e=>"*"===e||"x"===e||"X"===e,a=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},o=(e,t)=>{if(n(e)||n(t))return 0;const[s,r]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(a(e),a(t));return s>r?1:s<r?-1:0},l=(e,t)=>{for(let s=0;s<Math.max(e.length,t.length);s++){const r=o(e[s]||"0",t[s]||"0");if(0!==r)return r}return 0},c=(e,t)=>{const s=i(e),r=i(t),n=s.pop(),a=r.pop(),o=l(s,r);return 0!==o?o:n&&a?l(n.split("."),a.split(".")):n||a?n?-1:1:0},u=(e,t,s)=>{d(s);const r=c(e,t);return p[s].includes(r)},p={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},h=Object.keys(p),d=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===h.indexOf(e))throw new Error(`Invalid operator, expected one of ${h.join("|")}`)},f=(e,t)=>{if((t=t.replace(/([><=]+)\s+/g,"$1")).includes("||"))return t.split("||").some((t=>f(e,t)));if(t.includes(" - ")){const[s,r]=t.split(" - ",2);return f(e,`>=${s} <=${r}`)}if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every((t=>f(e,t)));const s=t.match(/^([<>=~^]+)/),r=s?s[1]:"=";if("^"!==r&&"~"!==r)return u(e,t,r);const[n,a,o,,c]=i(e),[p,h,d,,m]=i(t),g=[n,a,o],y=[p,null!=h?h:"x",null!=d?d:"x"];if(m){if(!c)return!1;if(0!==l(g,y))return!1;if(-1===l(c.split("."),m.split(".")))return!1}const b=y.findIndex((e=>"0"!==e))+1,v="~"===r?2:b>1?b:1;return 0===l(g.slice(0,v),y.slice(0,v))&&-1!==l(g.slice(v),y.slice(v))},m=e=>"string"==typeof e&&/^[v\d]/.test(e)&&r.test(e),g=e=>"string"==typeof e&&/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(e)},252:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(!e(t[i],s[i]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],s.get(i[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(i of t.entries())if(!s.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((r=t.length)!=s.length)return!1;for(i=r;0!=i--;)if(t[i]!==s[i])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(s,n[i]))return!1;for(i=r;0!=i--;){var a=n[i];if(!e(t[a],s[a]))return!1}return!0}return t!=t&&s!=s}},117:e=>{"use strict";e.exports=t},742:t=>{"use strict";t.exports=e}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return s[e].call(n.exports,n,n.exports,i),n.exports}return i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(224)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openeo/js-client",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "author": "openEO Consortium",
5
5
  "contributors": [
6
6
  {
@@ -198,7 +198,38 @@ class Capabilities {
198
198
  * @returns {Array.<FederationBackend>} Array of backends
199
199
  */
200
200
  listFederation() {
201
- return Array.isArray(this.data.federation) ? this.data.federation : [];
201
+ let federation = [];
202
+ if (Utils.isObject(this.data.federation)) {
203
+ // convert to array and add keys as `id` property
204
+ for(const [key, backend] of Object.entries(this.data.federation)) {
205
+ // fresh object to avoid `id` showing up in this.data.federation
206
+ federation.push({ id: key, ...backend });
207
+ }
208
+ }
209
+ return federation;
210
+ }
211
+
212
+ /**
213
+ * Given just the string ID of a backend within the federation, returns that backend's full details as a FederationBackend object.
214
+ *
215
+ * @param {string} backendId - The ID of a backend within the federation
216
+ * @returns {FederationBackend} The full details of the backend
217
+ */
218
+ getFederationBackend(backendId) {
219
+ // Add `id` property to make it a proper FederationBackend object
220
+ // If backendId doesn't exist in this.data.federation, will contain just the `id` field (intended behaviour)
221
+ return { id: backendId, ...this.data.federation[backendId] }
222
+ }
223
+
224
+ /**
225
+ * Given a list of string IDs of backends within the federation, returns those backends' full details as FederationBackend objects.
226
+ *
227
+ * @param {Array<string>} backendIds - The IDs of backends within the federation
228
+ * @returns {Array<FederationBackend>} An array in the same order as the input, containing for each position the full details of the backend
229
+ */
230
+ getFederationBackends(backendIds) {
231
+ // Let 'single case' function do the work, but pass `this` so that `this.data.federation` can be accessed in the callback context
232
+ return backendIds.map(this.getFederationBackend, this);
202
233
  }
203
234
 
204
235
  /**
package/src/openeo.js CHANGED
@@ -109,7 +109,7 @@ class OpenEO {
109
109
  * @returns {string} Version number (according to SemVer).
110
110
  */
111
111
  static clientVersion() {
112
- return "2.7.0";
112
+ return "2.8.0";
113
113
  }
114
114
 
115
115
  }
package/src/pages.js CHANGED
@@ -21,7 +21,7 @@ class Pages {
21
21
  * @param {Connection} connection
22
22
  * @param {string} endpoint
23
23
  * @param {string} key
24
- * @param {Constructor} cls
24
+ * @param {Constructor} cls - Class
25
25
  * @param {object} [params={}]
26
26
  * @param {string} primaryKey
27
27
  */
package/src/typedefs.js CHANGED
@@ -196,14 +196,15 @@
196
196
  */
197
197
 
198
198
  /**
199
- * An array of backends in the federation.
199
+ * A back-end in the federation.
200
200
  *
201
201
  * @typedef FederationBackend
202
202
  * @type {object}
203
+ * @property {string} id ID of the back-end within the federation.
203
204
  * @property {string} url URL to the versioned API endpoint of the back-end.
204
205
  * @property {string} title Name of the back-end.
205
206
  * @property {string} description A description of the back-end and its specifics.
206
- * @property {string} status Current status of the back-ends (online or offline).
207
+ * @property {string} status Current status of the back-end (online or offline).
207
208
  * @property {string} last_status_check The time at which the status of the back-end was checked last, formatted as a RFC 3339 date-time.
208
209
  * @property {string} last_successful_check If the `status` is `offline`: The time at which the back-end was checked and available the last time. Otherwise, this is equal to the property `last_status_check`. Formatted as a RFC 3339 date-time.
209
210
  * @property {boolean} experimental Declares the back-end to be experimental.
@@ -213,7 +214,7 @@
213
214
  /**
214
215
  * An array, but enriched with additional details from an openEO API response.
215
216
  *
216
- * Adds three properties: `links` and `federation:missing`.
217
+ * Adds two properties: `links` and `federation:missing`.
217
218
  *
218
219
  * @typedef ResponseArray
219
220
  * @augments Array