chunk-LU5IJZB4.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. import {
  2. p as p2
  3. } from "./chunk-7IBV2TRE.js";
  4. import {
  5. l
  6. } from "./chunk-5UVJ64RB.js";
  7. import {
  8. d
  9. } from "./chunk-SFEFRQCL.js";
  10. import {
  11. m as m2
  12. } from "./chunk-YFSLJIO4.js";
  13. import {
  14. U,
  15. r as r2
  16. } from "./chunk-DVUG3KID.js";
  17. import {
  18. s as s3
  19. } from "./chunk-FWSQEIAR.js";
  20. import {
  21. o,
  22. w2
  23. } from "./chunk-6T6G6LCQ.js";
  24. import {
  25. e,
  26. m,
  27. n5 as n,
  28. u2 as u,
  29. y3 as y
  30. } from "./chunk-2Z2TG5CU.js";
  31. import {
  32. b
  33. } from "./chunk-SQOPWYIT.js";
  34. import {
  35. a,
  36. f,
  37. p,
  38. w
  39. } from "./chunk-V6P2MAQQ.js";
  40. import {
  41. s,
  42. s3 as s2
  43. } from "./chunk-E5O6P5I2.js";
  44. import {
  45. h,
  46. r
  47. } from "./chunk-YXWMMD76.js";
  48. // node_modules/@arcgis/core/portal/PortalQueryResult.js
  49. var e2 = class extends m {
  50. constructor(r3) {
  51. super(r3), this.nextQueryParams = null, this.queryParams = null, this.results = null, this.total = null;
  52. }
  53. };
  54. e([y()], e2.prototype, "nextQueryParams", void 0), e([y()], e2.prototype, "queryParams", void 0), e([y()], e2.prototype, "results", void 0), e([y()], e2.prototype, "total", void 0), e2 = e([n("esri.portal.PortalQueryResult")], e2);
  55. var p3 = e2;
  56. // node_modules/@arcgis/core/portal/Portal.js
  57. var G;
  58. var U2;
  59. var B = { PortalGroup: () => import("./PortalGroup-DFOLQPKP.js"), PortalItem: () => import("./PortalItem-N6U3KORV.js"), PortalUser: () => import("./PortalUser-MGM4OD2S.js") };
  60. var D = G = class extends u(m2) {
  61. constructor(e3) {
  62. super(e3), this._esriIdCredentialCreateHandle = null, this.access = null, this.allSSL = false, this.authMode = "auto", this.authorizedCrossOriginDomains = null, this.basemapGalleryGroupQuery = null, this.bingKey = null, this.canListApps = false, this.canListData = false, this.canListPreProvisionedItems = false, this.canProvisionDirectPurchase = false, this.canSearchPublic = true, this.canShareBingPublic = false, this.canSharePublic = false, this.canSignInArcGIS = false, this.canSignInIDP = false, this.colorSetsGroupQuery = null, this.commentsEnabled = false, this.created = null, this.culture = null, this.customBaseUrl = null, this.defaultBasemap = null, this.defaultDevBasemap = null, this.defaultExtent = null, this.defaultVectorBasemap = null, this.description = null, this.devBasemapGalleryGroupQuery = null, this.eueiEnabled = null, this.featuredGroups = null, this.featuredItemsGroupQuery = null, this.galleryTemplatesGroupQuery = null, this.livingAtlasGroupQuery = null, this.hasCategorySchema = false, this.helperServices = null, this.homePageFeaturedContent = null, this.homePageFeaturedContentCount = null, this.httpPort = null, this.httpsPort = null, this.id = null, this.ipCntryCode = null, this.isPortal = false, this.isReadOnly = false, this.layerTemplatesGroupQuery = null, this.maxTokenExpirationMinutes = null, this.modified = null, this.name = null, this.portalHostname = null, this.portalMode = null, this.portalProperties = null, this.region = null, this.rotatorPanels = null, this.showHomePageDescription = false, this.sourceJSON = null, this.supportsHostedServices = false, this.symbolSetsGroupQuery = null, this.templatesGroupQuery = null, this.units = null, this.url = s.portalUrl, this.urlKey = null, this.user = null, this.useStandardizedQuery = false, this.useVectorBasemaps = false, this.vectorBasemapGalleryGroupQuery = null;
  63. }
  64. normalizeCtorArgs(e3) {
  65. return "string" == typeof e3 ? { url: e3 } : e3;
  66. }
  67. destroy() {
  68. this._esriIdCredentialCreateHandle = h(this._esriIdCredentialCreateHandle);
  69. }
  70. readAuthorizedCrossOriginDomains(e3) {
  71. if (e3)
  72. for (const r3 of e3)
  73. s.request.trustedServers.includes(r3) || s.request.trustedServers.push(r3);
  74. return e3;
  75. }
  76. readDefaultBasemap(e3) {
  77. return this._readBasemap(e3);
  78. }
  79. readDefaultDevBasemap(e3) {
  80. return this._readBasemap(e3);
  81. }
  82. readDefaultVectorBasemap(e3) {
  83. return this._readBasemap(e3);
  84. }
  85. get extraQuery() {
  86. const e3 = !(this.user && this.user.orgId) || this.canSearchPublic;
  87. return this.id && !e3 ? ` AND orgid:${this.id}` : null;
  88. }
  89. get isOrganization() {
  90. return !!this.access;
  91. }
  92. get itemPageUrl() {
  93. return this.url ? `${this.url}/home/item.html` : null;
  94. }
  95. get restUrl() {
  96. let e3 = this.url;
  97. if (e3) {
  98. const t = e3.indexOf("/sharing");
  99. e3 = t > 0 ? e3.substring(0, t) : this.url.replace(/\/+$/, ""), e3 += "/sharing/rest";
  100. }
  101. return e3;
  102. }
  103. get thumbnailUrl() {
  104. const e3 = this.restUrl, t = this.thumbnail;
  105. return e3 && t ? this._normalizeSSL(e3 + "/portals/self/resources/" + t) : null;
  106. }
  107. readUrlKey(e3) {
  108. return e3 ? e3.toLowerCase() : e3;
  109. }
  110. readUser(e3) {
  111. let t = null;
  112. return e3 && (t = p2.fromJSON(e3), t.portal = this), t;
  113. }
  114. load(e3) {
  115. const t = import("./Basemap-3LMXWUPF.js").then(({ default: t2 }) => {
  116. f(e3), U2 = t2;
  117. }).then(() => this.sourceJSON ? this.sourceJSON : this._fetchSelf(this.authMode, false, e3)).then((e4) => {
  118. if (s3) {
  119. const e5 = s3;
  120. this.credential = e5.findCredential(this.restUrl), this.credential || this.authMode !== G.AUTH_MODE_AUTO || (this._esriIdCredentialCreateHandle = e5.on("credential-create", () => {
  121. e5.findCredential(this.restUrl) && this._signIn().catch(() => {
  122. });
  123. }));
  124. }
  125. this.sourceJSON = e4, this.read(e4);
  126. });
  127. return this.addResolvingPromise(t), Promise.resolve(this);
  128. }
  129. async createElevationLayers() {
  130. await this.load();
  131. const e3 = this._getHelperService("defaultElevationLayers"), t = (await import("./ElevationLayer-NYCVL5EQ.js")).default;
  132. return e3 ? e3.map((e4) => new t({ id: e4.id, url: e4.url })) : [];
  133. }
  134. fetchBasemaps(e3, r3) {
  135. const o2 = new d();
  136. return o2.query = e3 || (s.apiKey && r2(this.url) ? this.devBasemapGalleryGroupQuery : this.useVectorBasemaps ? this.vectorBasemapGalleryGroupQuery : this.basemapGalleryGroupQuery), o2.disableExtraQuery = true, this.queryGroups(o2, r3).then((e4) => {
  137. if (o2.num = 100, o2.query = 'type:"Web Map" -type:"Web Application"', e4.total) {
  138. const t = e4.results[0];
  139. return o2.sortField = t.sortField || "name", o2.sortOrder = t.sortOrder || "desc", t.queryItems(o2, r3);
  140. }
  141. return null;
  142. }).then((e4) => {
  143. let t;
  144. return t = e4 && e4.total ? e4.results.filter((e5) => "Web Map" === e5.type).map((e5) => new U2({ portalItem: e5 })) : [], t;
  145. });
  146. }
  147. fetchCategorySchema(e3) {
  148. return this.hasCategorySchema ? this._request(this.restUrl + "/portals/self/categorySchema", e3).then((e4) => e4.categorySchema) : p(e3) ? Promise.reject(a()) : Promise.resolve([]);
  149. }
  150. fetchFeaturedGroups(e3) {
  151. const t = this.featuredGroups, r3 = new d();
  152. if (r3.num = 100, r3.sortField = "title", t && t.length) {
  153. const o2 = [];
  154. for (const e4 of t)
  155. o2.push(`(title:"${e4.title}" AND owner:${e4.owner})`);
  156. return r3.query = o2.join(" OR "), this.queryGroups(r3, e3).then((e4) => e4.results);
  157. }
  158. return p(e3) ? Promise.reject(a()) : Promise.resolve([]);
  159. }
  160. fetchRegions(e3) {
  161. var _a;
  162. const t = ((_a = this.user) == null ? void 0 : _a.culture) || this.culture || l();
  163. return this._request(this.restUrl + "/portals/regions", { ...e3, query: { culture: t } });
  164. }
  165. fetchSettings(e3) {
  166. var _a;
  167. const t = ((_a = this.user) == null ? void 0 : _a.culture) || this.culture || l();
  168. return this._request(this.restUrl + "/portals/self/settings", { ...e3, query: { culture: t } });
  169. }
  170. static getDefault() {
  171. return G._default && !G._default.destroyed || (G._default = new G()), G._default;
  172. }
  173. queryGroups(e3, t) {
  174. return this._queryPortal("/community/groups", e3, "PortalGroup", t);
  175. }
  176. queryItems(e3, t) {
  177. return this._queryPortal("/search", e3, "PortalItem", t);
  178. }
  179. queryUsers(e3, t) {
  180. return e3.sortField || (e3.sortField = "username"), this._queryPortal("/community/users", e3, "PortalUser", t);
  181. }
  182. toJSON() {
  183. throw new s2("internal:not-yet-implemented", "Portal.toJSON is not yet implemented");
  184. }
  185. static fromJSON(e3) {
  186. if (!e3)
  187. return null;
  188. if (e3.declaredClass)
  189. throw new Error("JSON object is already hydrated");
  190. return new G({ sourceJSON: e3 });
  191. }
  192. _getHelperService(e3) {
  193. const t = this.helperServices && this.helperServices[e3];
  194. if (!t)
  195. throw new s2("portal:service-not-found", `The \`helperServices\` do not include an entry named "${e3}"`);
  196. return t;
  197. }
  198. _getHelperServiceUrl(e3) {
  199. const t = this._getHelperService(e3);
  200. if (!(t == null ? void 0 : t.url))
  201. throw new s2("portal:service-url-not-found", `The \`helperServices\` entry "${e3}" does not include a \`url\` value`);
  202. return t.url;
  203. }
  204. _fetchSelf(e3 = this.authMode, t = false, r3) {
  205. const o2 = this.restUrl + "/portals/self", s4 = { authMode: e3, query: { culture: l().toLowerCase() }, ...r3 };
  206. return "auto" === s4.authMode && (s4.authMode = "no-prompt"), t && (s4.query.default = true), this._request(o2, s4);
  207. }
  208. _queryPortal(e3, t, r3, o2) {
  209. const s4 = b(d, t), i = (t2) => this._request(this.restUrl + e3, { ...s4.toRequestOptions(this), ...o2 }).then((e4) => {
  210. const r4 = s4.clone();
  211. return r4.start = e4.nextStart, new p3({ nextQueryParams: r4, queryParams: s4, total: e4.total, results: G._resultsToTypedArray(t2, { portal: this }, e4, o2) });
  212. }).then((e4) => Promise.all(e4.results.map((t3) => "function" == typeof t3.when ? t3.when() : e4)).then(() => e4, (t3) => (w(t3), e4)));
  213. return r3 && B[r3] ? B[r3]().then(({ default: e4 }) => (f(o2), i(e4))) : i();
  214. }
  215. _signIn() {
  216. if (this.authMode === G.AUTH_MODE_ANONYMOUS)
  217. return Promise.reject(new s2("portal:invalid-auth-mode", `Current "authMode"' is "${this.authMode}"`));
  218. if ("failed" === this.loadStatus)
  219. return Promise.reject(this.loadError);
  220. const e3 = (e4) => Promise.resolve().then(() => "not-loaded" === this.loadStatus ? (e4 || (this.authMode = "immediate"), this.load().then(() => null)) : "loading" === this.loadStatus ? this.load().then(() => this.credential ? null : (this.credential = e4, this._fetchSelf("immediate"))) : this.user && this.credential === e4 ? null : (this.credential = e4, this._fetchSelf("immediate"))).then((e5) => {
  221. e5 && (this.sourceJSON = e5, this.read(e5));
  222. });
  223. return s3 ? s3.getCredential(this.restUrl).then((t) => e3(t)) : e3(this.credential);
  224. }
  225. _normalizeSSL(e3) {
  226. return e3.replace(/^http:/i, "https:").replace(":7080", ":7443");
  227. }
  228. _normalizeUrl(e3) {
  229. const t = this.credential && this.credential.token;
  230. return this._normalizeSSL(t ? e3 + (e3.includes("?") ? "&" : "?") + "token=" + t : e3);
  231. }
  232. _requestToTypedArray(e3, t, r3) {
  233. return this._request(e3, t).then((e4) => {
  234. const t2 = G._resultsToTypedArray(r3, { portal: this }, e4);
  235. return Promise.all(t2.map((t3) => "function" == typeof t3.when ? t3.when() : e4)).then(() => t2, () => t2);
  236. });
  237. }
  238. _readBasemap(e3) {
  239. if (e3) {
  240. const t = U2.fromJSON(e3);
  241. return t.portalItem = { portal: this }, t;
  242. }
  243. return null;
  244. }
  245. _request(e3, t = {}) {
  246. const r3 = { f: "json", ...t.query }, { authMode: s4 = this.authMode === G.AUTH_MODE_ANONYMOUS ? "anonymous" : "auto", body: i = null, cacheBust: a2 = false, method: l2 = "auto", responseType: u2 = "json", signal: n2 } = t, p4 = { authMode: s4, body: i, cacheBust: a2, method: l2, query: r3, responseType: u2, timeout: 0, signal: n2 };
  247. return U(this._normalizeSSL(e3), p4).then((e4) => e4.data);
  248. }
  249. static _resultsToTypedArray(e3, t, r3, o2) {
  250. let s4;
  251. if (r3) {
  252. const i = r(o2) ? o2.signal : null;
  253. s4 = r3.listings || r3.notifications || r3.userInvitations || r3.tags || r3.items || r3.groups || r3.comments || r3.provisions || r3.results || r3.relatedItems || r3, (e3 || t) && (s4 = s4.map((r4) => {
  254. const o3 = Object.assign(e3 ? e3.fromJSON(r4) : r4, t);
  255. return "function" == typeof o3.load && o3.load(i), o3;
  256. }));
  257. } else
  258. s4 = [];
  259. return s4;
  260. }
  261. };
  262. D.AUTH_MODE_ANONYMOUS = "anonymous", D.AUTH_MODE_AUTO = "auto", D.AUTH_MODE_IMMEDIATE = "immediate", e([y()], D.prototype, "access", void 0), e([y()], D.prototype, "allSSL", void 0), e([y()], D.prototype, "authMode", void 0), e([y()], D.prototype, "authorizedCrossOriginDomains", void 0), e([o("authorizedCrossOriginDomains")], D.prototype, "readAuthorizedCrossOriginDomains", null), e([y()], D.prototype, "basemapGalleryGroupQuery", void 0), e([y()], D.prototype, "bingKey", void 0), e([y()], D.prototype, "canListApps", void 0), e([y()], D.prototype, "canListData", void 0), e([y()], D.prototype, "canListPreProvisionedItems", void 0), e([y()], D.prototype, "canProvisionDirectPurchase", void 0), e([y()], D.prototype, "canSearchPublic", void 0), e([y()], D.prototype, "canShareBingPublic", void 0), e([y()], D.prototype, "canSharePublic", void 0), e([y()], D.prototype, "canSignInArcGIS", void 0), e([y()], D.prototype, "canSignInIDP", void 0), e([y()], D.prototype, "colorSetsGroupQuery", void 0), e([y()], D.prototype, "commentsEnabled", void 0), e([y({ type: Date })], D.prototype, "created", void 0), e([y()], D.prototype, "credential", void 0), e([y()], D.prototype, "culture", void 0), e([y()], D.prototype, "currentVersion", void 0), e([y()], D.prototype, "customBaseUrl", void 0), e([y()], D.prototype, "defaultBasemap", void 0), e([o("defaultBasemap")], D.prototype, "readDefaultBasemap", null), e([y()], D.prototype, "defaultDevBasemap", void 0), e([o("defaultDevBasemap")], D.prototype, "readDefaultDevBasemap", null), e([y({ type: w2 })], D.prototype, "defaultExtent", void 0), e([y()], D.prototype, "defaultVectorBasemap", void 0), e([o("defaultVectorBasemap")], D.prototype, "readDefaultVectorBasemap", null), e([y()], D.prototype, "description", void 0), e([y()], D.prototype, "devBasemapGalleryGroupQuery", void 0), e([y()], D.prototype, "eueiEnabled", void 0), e([y({ readOnly: true })], D.prototype, "extraQuery", null), e([y()], D.prototype, "featuredGroups", void 0), e([y()], D.prototype, "featuredItemsGroupQuery", void 0), e([y()], D.prototype, "galleryTemplatesGroupQuery", void 0), e([y()], D.prototype, "livingAtlasGroupQuery", void 0), e([y()], D.prototype, "hasCategorySchema", void 0), e([y()], D.prototype, "helpBase", void 0), e([y()], D.prototype, "helperServices", void 0), e([y()], D.prototype, "helpMap", void 0), e([y()], D.prototype, "homePageFeaturedContent", void 0), e([y()], D.prototype, "homePageFeaturedContentCount", void 0), e([y()], D.prototype, "httpPort", void 0), e([y()], D.prototype, "httpsPort", void 0), e([y()], D.prototype, "id", void 0), e([y()], D.prototype, "ipCntryCode", void 0), e([y({ readOnly: true })], D.prototype, "isOrganization", null), e([y()], D.prototype, "isPortal", void 0), e([y()], D.prototype, "isReadOnly", void 0), e([y({ readOnly: true })], D.prototype, "itemPageUrl", null), e([y()], D.prototype, "layerTemplatesGroupQuery", void 0), e([y()], D.prototype, "maxTokenExpirationMinutes", void 0), e([y({ type: Date })], D.prototype, "modified", void 0), e([y()], D.prototype, "name", void 0), e([y()], D.prototype, "portalHostname", void 0), e([y()], D.prototype, "portalMode", void 0), e([y()], D.prototype, "portalProperties", void 0), e([y()], D.prototype, "region", void 0), e([y({ readOnly: true })], D.prototype, "restUrl", null), e([y()], D.prototype, "rotatorPanels", void 0), e([y()], D.prototype, "showHomePageDescription", void 0), e([y()], D.prototype, "sourceJSON", void 0), e([y()], D.prototype, "staticImagesUrl", void 0), e([y({ json: { name: "2DStylesGroupQuery" } })], D.prototype, "stylesGroupQuery2d", void 0), e([y({ json: { name: "stylesGroupQuery" } })], D.prototype, "stylesGroupQuery3d", void 0), e([y()], D.prototype, "supportsHostedServices", void 0), e([y()], D.prototype, "symbolSetsGroupQuery", void 0), e([y()], D.prototype, "templatesGroupQuery", void 0), e([y()], D.prototype, "thumbnail", void 0), e([y({ readOnly: true })], D.prototype, "thumbnailUrl", null), e([y()], D.prototype, "units", void 0), e([y()], D.prototype, "url", void 0), e([y()], D.prototype, "urlKey", void 0), e([o("urlKey")], D.prototype, "readUrlKey", null), e([y()], D.prototype, "user", void 0), e([o("user")], D.prototype, "readUser", null), e([y()], D.prototype, "useStandardizedQuery", void 0), e([y()], D.prototype, "useVectorBasemaps", void 0), e([y()], D.prototype, "vectorBasemapGalleryGroupQuery", void 0), D = G = e([n("esri.portal.Portal")], D);
  263. var j = D;
  264. export {
  265. j
  266. };
  267. //# sourceMappingURL=chunk-LU5IJZB4.js.map