import { p as p2 } from "./chunk-7IBV2TRE.js"; import { l } from "./chunk-5UVJ64RB.js"; import { d } from "./chunk-SFEFRQCL.js"; import { m as m2 } from "./chunk-YFSLJIO4.js"; import { U, r as r2 } from "./chunk-DVUG3KID.js"; import { s as s3 } from "./chunk-FWSQEIAR.js"; import { o, w2 } from "./chunk-6T6G6LCQ.js"; import { e, m, n5 as n, u2 as u, y3 as y } from "./chunk-2Z2TG5CU.js"; import { b } from "./chunk-SQOPWYIT.js"; import { a, f, p, w } from "./chunk-V6P2MAQQ.js"; import { s, s3 as s2 } from "./chunk-E5O6P5I2.js"; import { h, r } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/portal/PortalQueryResult.js var e2 = class extends m { constructor(r3) { super(r3), this.nextQueryParams = null, this.queryParams = null, this.results = null, this.total = null; } }; 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); var p3 = e2; // node_modules/@arcgis/core/portal/Portal.js var G; var U2; var B = { PortalGroup: () => import("./PortalGroup-DFOLQPKP.js"), PortalItem: () => import("./PortalItem-N6U3KORV.js"), PortalUser: () => import("./PortalUser-MGM4OD2S.js") }; var D = G = class extends u(m2) { constructor(e3) { 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; } normalizeCtorArgs(e3) { return "string" == typeof e3 ? { url: e3 } : e3; } destroy() { this._esriIdCredentialCreateHandle = h(this._esriIdCredentialCreateHandle); } readAuthorizedCrossOriginDomains(e3) { if (e3) for (const r3 of e3) s.request.trustedServers.includes(r3) || s.request.trustedServers.push(r3); return e3; } readDefaultBasemap(e3) { return this._readBasemap(e3); } readDefaultDevBasemap(e3) { return this._readBasemap(e3); } readDefaultVectorBasemap(e3) { return this._readBasemap(e3); } get extraQuery() { const e3 = !(this.user && this.user.orgId) || this.canSearchPublic; return this.id && !e3 ? ` AND orgid:${this.id}` : null; } get isOrganization() { return !!this.access; } get itemPageUrl() { return this.url ? `${this.url}/home/item.html` : null; } get restUrl() { let e3 = this.url; if (e3) { const t = e3.indexOf("/sharing"); e3 = t > 0 ? e3.substring(0, t) : this.url.replace(/\/+$/, ""), e3 += "/sharing/rest"; } return e3; } get thumbnailUrl() { const e3 = this.restUrl, t = this.thumbnail; return e3 && t ? this._normalizeSSL(e3 + "/portals/self/resources/" + t) : null; } readUrlKey(e3) { return e3 ? e3.toLowerCase() : e3; } readUser(e3) { let t = null; return e3 && (t = p2.fromJSON(e3), t.portal = this), t; } load(e3) { const t = import("./Basemap-3LMXWUPF.js").then(({ default: t2 }) => { f(e3), U2 = t2; }).then(() => this.sourceJSON ? this.sourceJSON : this._fetchSelf(this.authMode, false, e3)).then((e4) => { if (s3) { const e5 = s3; this.credential = e5.findCredential(this.restUrl), this.credential || this.authMode !== G.AUTH_MODE_AUTO || (this._esriIdCredentialCreateHandle = e5.on("credential-create", () => { e5.findCredential(this.restUrl) && this._signIn().catch(() => { }); })); } this.sourceJSON = e4, this.read(e4); }); return this.addResolvingPromise(t), Promise.resolve(this); } async createElevationLayers() { await this.load(); const e3 = this._getHelperService("defaultElevationLayers"), t = (await import("./ElevationLayer-NYCVL5EQ.js")).default; return e3 ? e3.map((e4) => new t({ id: e4.id, url: e4.url })) : []; } fetchBasemaps(e3, r3) { const o2 = new d(); 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) => { if (o2.num = 100, o2.query = 'type:"Web Map" -type:"Web Application"', e4.total) { const t = e4.results[0]; return o2.sortField = t.sortField || "name", o2.sortOrder = t.sortOrder || "desc", t.queryItems(o2, r3); } return null; }).then((e4) => { let t; return t = e4 && e4.total ? e4.results.filter((e5) => "Web Map" === e5.type).map((e5) => new U2({ portalItem: e5 })) : [], t; }); } fetchCategorySchema(e3) { return this.hasCategorySchema ? this._request(this.restUrl + "/portals/self/categorySchema", e3).then((e4) => e4.categorySchema) : p(e3) ? Promise.reject(a()) : Promise.resolve([]); } fetchFeaturedGroups(e3) { const t = this.featuredGroups, r3 = new d(); if (r3.num = 100, r3.sortField = "title", t && t.length) { const o2 = []; for (const e4 of t) o2.push(`(title:"${e4.title}" AND owner:${e4.owner})`); return r3.query = o2.join(" OR "), this.queryGroups(r3, e3).then((e4) => e4.results); } return p(e3) ? Promise.reject(a()) : Promise.resolve([]); } fetchRegions(e3) { var _a; const t = ((_a = this.user) == null ? void 0 : _a.culture) || this.culture || l(); return this._request(this.restUrl + "/portals/regions", { ...e3, query: { culture: t } }); } fetchSettings(e3) { var _a; const t = ((_a = this.user) == null ? void 0 : _a.culture) || this.culture || l(); return this._request(this.restUrl + "/portals/self/settings", { ...e3, query: { culture: t } }); } static getDefault() { return G._default && !G._default.destroyed || (G._default = new G()), G._default; } queryGroups(e3, t) { return this._queryPortal("/community/groups", e3, "PortalGroup", t); } queryItems(e3, t) { return this._queryPortal("/search", e3, "PortalItem", t); } queryUsers(e3, t) { return e3.sortField || (e3.sortField = "username"), this._queryPortal("/community/users", e3, "PortalUser", t); } toJSON() { throw new s2("internal:not-yet-implemented", "Portal.toJSON is not yet implemented"); } static fromJSON(e3) { if (!e3) return null; if (e3.declaredClass) throw new Error("JSON object is already hydrated"); return new G({ sourceJSON: e3 }); } _getHelperService(e3) { const t = this.helperServices && this.helperServices[e3]; if (!t) throw new s2("portal:service-not-found", `The \`helperServices\` do not include an entry named "${e3}"`); return t; } _getHelperServiceUrl(e3) { const t = this._getHelperService(e3); if (!(t == null ? void 0 : t.url)) throw new s2("portal:service-url-not-found", `The \`helperServices\` entry "${e3}" does not include a \`url\` value`); return t.url; } _fetchSelf(e3 = this.authMode, t = false, r3) { const o2 = this.restUrl + "/portals/self", s4 = { authMode: e3, query: { culture: l().toLowerCase() }, ...r3 }; return "auto" === s4.authMode && (s4.authMode = "no-prompt"), t && (s4.query.default = true), this._request(o2, s4); } _queryPortal(e3, t, r3, o2) { const s4 = b(d, t), i = (t2) => this._request(this.restUrl + e3, { ...s4.toRequestOptions(this), ...o2 }).then((e4) => { const r4 = s4.clone(); return r4.start = e4.nextStart, new p3({ nextQueryParams: r4, queryParams: s4, total: e4.total, results: G._resultsToTypedArray(t2, { portal: this }, e4, o2) }); }).then((e4) => Promise.all(e4.results.map((t3) => "function" == typeof t3.when ? t3.when() : e4)).then(() => e4, (t3) => (w(t3), e4))); return r3 && B[r3] ? B[r3]().then(({ default: e4 }) => (f(o2), i(e4))) : i(); } _signIn() { if (this.authMode === G.AUTH_MODE_ANONYMOUS) return Promise.reject(new s2("portal:invalid-auth-mode", `Current "authMode"' is "${this.authMode}"`)); if ("failed" === this.loadStatus) return Promise.reject(this.loadError); 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) => { e5 && (this.sourceJSON = e5, this.read(e5)); }); return s3 ? s3.getCredential(this.restUrl).then((t) => e3(t)) : e3(this.credential); } _normalizeSSL(e3) { return e3.replace(/^http:/i, "https:").replace(":7080", ":7443"); } _normalizeUrl(e3) { const t = this.credential && this.credential.token; return this._normalizeSSL(t ? e3 + (e3.includes("?") ? "&" : "?") + "token=" + t : e3); } _requestToTypedArray(e3, t, r3) { return this._request(e3, t).then((e4) => { const t2 = G._resultsToTypedArray(r3, { portal: this }, e4); return Promise.all(t2.map((t3) => "function" == typeof t3.when ? t3.when() : e4)).then(() => t2, () => t2); }); } _readBasemap(e3) { if (e3) { const t = U2.fromJSON(e3); return t.portalItem = { portal: this }, t; } return null; } _request(e3, t = {}) { 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 }; return U(this._normalizeSSL(e3), p4).then((e4) => e4.data); } static _resultsToTypedArray(e3, t, r3, o2) { let s4; if (r3) { const i = r(o2) ? o2.signal : null; 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) => { const o3 = Object.assign(e3 ? e3.fromJSON(r4) : r4, t); return "function" == typeof o3.load && o3.load(i), o3; })); } else s4 = []; return s4; } }; 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); var j = D; export { j }; //# sourceMappingURL=chunk-LU5IJZB4.js.map