{"version":3,"sources":["node_modules/@arcgis/core/layers/support/FieldsIndex.js"],"sourcesContent":["/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport e from \"../../core/Error.js\";\nimport { isSerializable as i } from \"../../core/JSONSupport.js\";\nimport t from \"../../core/Logger.js\";\nimport { getOrCreateMapValue as s } from \"../../core/MapUtils.js\";\nimport { UnknownTimeZone as n } from \"../../core/sql/UnknownTimeZone.js\";\nimport { isDateField as r, isNumericField as l, isObjectIDField as o, isGlobalIDField as d, getFieldDefaultValue as a, isTimeOnlyField as m, normalizeFieldName as u } from \"./fieldUtils.js\";\nimport { utc as f, unknown as F, fromTimeReference as h } from \"../../time/timeZoneUtils.js\";\nimport { FixedOffsetZone as c, IANAZone as p } from \"luxon\";\nfunction y(e) {\n return \"timeZone\" in e;\n}\nfunction _(e) {\n return \"timeZone\" in e;\n}\nfunction g(e) {\n return \"dateFieldsTimeZone\" in e;\n}\nconst T = new Map();\nclass Z {\n static fromJSON(e) {\n return new Z(e.fields, e.timeZoneByFieldName);\n }\n static fromLayer(e) {\n return new Z(e.fields ?? [], S(e));\n }\n static fromLayerJSON(e) {\n return new Z(e.fields ?? [], S(e));\n }\n constructor(e = [], i) {\n this._fieldsMap = new Map(), this._normalizedFieldsMap = new Map(), this._dateFieldsSet = new Set(), this._numericFieldsSet = new Set(), this._requiredFields = null, this.dateFields = [], this.numericFields = [], this.fields = e || [], this._timeZoneByFieldName = i ? new Map(i) : null;\n const t = [];\n for (const s of this.fields) {\n const e = s?.name,\n i = M(e);\n if (e && i) {\n const n = w(e);\n this._fieldsMap.set(e, s), this._fieldsMap.set(n, s), this._normalizedFieldsMap.set(i, s), t.push(`${n}:${s.type}:${this._timeZoneByFieldName?.get(e)}`), r(s) ? (this.dateFields.push(s), this._dateFieldsSet.add(s)) : l(s) && (this._numericFieldsSet.add(s), this.numericFields.push(s)), o(s) || d(s) || (s.editable = null == s.editable || !!s.editable, s.nullable = null == s.nullable || !!s.nullable);\n }\n }\n t.sort(), this.uid = t.join();\n }\n get requiredFields() {\n if (!this._requiredFields) {\n this._requiredFields = [];\n for (const e of this.fields) o(e) || d(e) || e.nullable || void 0 !== a(e) || this._requiredFields.push(e);\n }\n return this._requiredFields;\n }\n equals(e) {\n return this.uid === e?.uid;\n }\n has(e) {\n return null != this.get(e);\n }\n get(e) {\n if (!e) return;\n let i = this._fieldsMap.get(e);\n return i || (i = this._fieldsMap.get(w(e)) ?? this._normalizedFieldsMap.get(M(e)), i && this._fieldsMap.set(e, i), i);\n }\n getTimeZone(i) {\n const s = this.get(i && \"string\" != typeof i ? i.name : i);\n return s ? this._timeZoneByFieldName ? this._timeZoneByFieldName.get(s.name) : \"date\" === s.type || \"esriFieldTypeDate\" === s.type ? (t.getLogger(\"esri.layers.support.FieldsIndex\").error(new e(\"getTimeZone:no-timezone-information\", `no time zone information for field '${s.name}'`)), f) : N.has(s.type) ? F : null : null;\n }\n getLuxonTimeZone(e) {\n const i = this.getTimeZone(e);\n return i ? i === F ? n.instance : i === f ? c.utcInstance : s(T, i, () => p.create(i)) : null;\n }\n isDateField(e) {\n return this._dateFieldsSet.has(this.get(e));\n }\n isTimeOnlyField(e) {\n return m(this.get(e));\n }\n isNumericField(e) {\n return this._numericFieldsSet.has(this.get(e));\n }\n normalizeFieldName(e) {\n return this.get(e)?.name ?? void 0;\n }\n toJSON() {\n return {\n fields: this.fields.map(e => i(e) ? e.toJSON() : e),\n timeZoneByFieldName: this._timeZoneByFieldName ? Array.from(this._timeZoneByFieldName.entries()) : null\n };\n }\n}\nfunction w(e) {\n return e.trim().toLowerCase();\n}\nfunction M(e) {\n return u(e)?.toLowerCase() ?? \"\";\n}\nconst N = new Set([\"time-only\", \"date-only\", \"timestamp-offset\", \"esriFieldTypeDateOnly\", \"esriFieldTypeTimeOnly\", \"esriFieldTypeTimestampOffset\"]);\nfunction S(e) {\n const i = new Map();\n if (!e.fields) return i;\n const t = !0 === e.datesInUnknownTimezone,\n {\n timeInfo: s,\n editFieldsInfo: n\n } = e,\n r = (s ? \"startField\" in s ? s.startField : s.startTimeField : \"\") ?? \"\",\n l = (s ? \"endField\" in s ? s.endField : s.endTimeField : \"\") ?? \"\",\n o = g(e) ? e.dateFieldsTimeZone ?? null : e.dateFieldsTimeReference ? h(e.dateFieldsTimeReference) : null,\n d = n ? y(n) ? n.timeZone ?? o : n.dateFieldsTimeReference ? h(n.dateFieldsTimeReference) : o ?? f : null,\n a = s ? _(s) ? s.timeZone ?? o : s.timeReference ? h(s.timeReference) : o : null,\n m = new Map([[w(n?.creationDateField ?? \"\"), d], [w(n?.editDateField ?? \"\"), d], [w(r), a], [w(l), a]]);\n for (const {\n name: u,\n type: f\n } of e.fields) if (N.has(f)) i.set(u, F);else if (\"date\" !== f && \"esriFieldTypeDate\" !== f) i.set(u, null);else if (t) i.set(u, F);else {\n const e = m.get(w(u ?? \"\")) ?? o;\n i.set(u, e);\n }\n return i;\n}\nexport { Z as default };"],"mappings":"yVAYA,SAASA,EAAEC,EAAG,CACZ,MAAO,aAAcA,CACvB,CACA,SAASC,EAAED,EAAG,CACZ,MAAO,aAAcA,CACvB,CACA,SAASE,EAAEF,EAAG,CACZ,MAAO,uBAAwBA,CACjC,CACA,IAAMG,EAAI,IAAI,IACRC,EAAN,MAAMC,CAAE,CACN,OAAO,SAAS,EAAG,CACjB,OAAO,IAAIA,EAAE,EAAE,OAAQ,EAAE,mBAAmB,CAC9C,CACA,OAAO,UAAU,EAAG,CAClB,OAAO,IAAIA,EAAE,EAAE,QAAU,CAAC,EAAGC,EAAE,CAAC,CAAC,CACnC,CACA,OAAO,cAAc,EAAG,CACtB,OAAO,IAAID,EAAE,EAAE,QAAU,CAAC,EAAGC,EAAE,CAAC,CAAC,CACnC,CACA,YAAY,EAAI,CAAC,EAAGC,EAAG,CACrB,KAAK,WAAa,IAAI,IAAO,KAAK,qBAAuB,IAAI,IAAO,KAAK,eAAiB,IAAI,IAAO,KAAK,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,CAAC,EACxG,OAAW,CACT,KAAMM,EACN,KAAMC,CACR,IAAK9B,EAAE,OAAQ,GAAIkB,EAAE,IAAIY,CAAC,EAAGvB,EAAE,IAAIsB,EAAGV,CAAC,UAAsBW,IAAX,QAAwCA,IAAxB,oBAA2BvB,EAAE,IAAIsB,EAAG,IAAI,UAAW,EAAGtB,EAAE,IAAIsB,EAAGV,CAAC,MAAO,CACvI,IAAMnB,EAAI4B,EAAE,IAAIhB,EAAEiB,GAAK,EAAE,CAAC,GAAKH,EAC/BnB,EAAE,IAAIsB,EAAG7B,CAAC,CACZ,CACA,OAAOO,CACT","names":["y","e","_","g","T","Z","_Z","S","i","t","s","M","n","w","ge","pe","we","xe","H","N","r","FixedOffsetZone","IANAZone","be","a","c","l","o","d","m","u","f"],"x_google_ignoreList":[0]}