@theseam/ui-common 2.0.1-beta.111 → 2.0.1-beta.114

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.
@@ -54,6 +54,9 @@ class ToggleGroupDirective {
54
54
  optionDirectives;
55
55
  onChange;
56
56
  onTouched;
57
+ _selectedSet;
58
+ _selectedSetSource;
59
+ _selectedSetMultiple;
57
60
  get value() {
58
61
  return this.val;
59
62
  }
@@ -85,17 +88,42 @@ class ToggleGroupDirective {
85
88
  this.disabled = isDisabled;
86
89
  }
87
90
  isSelected(value) {
88
- if (this.multiple) {
89
- const idx = (this.value || []).findIndex((v) => v === value);
90
- return idx !== -1;
91
+ if (value === null || value === undefined) {
92
+ return false;
91
93
  }
92
- else {
93
- // TODO: Clean this up when the directive no longer allows array value type when multiple is false
94
- const v = Array.isArray(this.value) && this.value.length === 1
95
- ? this.value[0]
96
- : this.value;
97
- return v === value;
94
+ return this._selected().has(value);
95
+ }
96
+ /**
97
+ * The current selection as a set, rebuilt only when the value (or `multiple`)
98
+ * changes.
99
+ *
100
+ * `isSelected` is called from templates and from every option's host binding,
101
+ * so it runs several times per option per change detection pass. Hashing the
102
+ * selection once keeps those lookups O(1) instead of scanning the value array
103
+ * on every call.
104
+ *
105
+ * Invalidation is keyed on the `val` reference rather than done in the `value`
106
+ * setter, because `val` is also written directly by the `[value]` input, which
107
+ * does not go through the setter.
108
+ */
109
+ _selected() {
110
+ if (this._selectedSet === undefined ||
111
+ this.val !== this._selectedSetSource ||
112
+ this.multiple !== this._selectedSetMultiple) {
113
+ this._selectedSetSource = this.val;
114
+ this._selectedSetMultiple = this.multiple;
115
+ this._selectedSet = this._buildSelectedSet();
116
+ }
117
+ return this._selectedSet;
118
+ }
119
+ _buildSelectedSet() {
120
+ const val = this.val;
121
+ if (this.multiple) {
122
+ return new Set(val ?? []);
98
123
  }
124
+ // TODO: Clean this up when the directive no longer allows array value type when multiple is false
125
+ const v = Array.isArray(val) && val.length === 1 ? val[0] : val;
126
+ return typeof v === 'string' ? new Set([v]) : new Set();
99
127
  }
100
128
  /**
101
129
  * Toggles an option's selected state by value.
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-toggle-group.mjs","sources":["../../../projects/ui-common/toggle-group/toggle-group-parent.ts","../../../projects/ui-common/toggle-group/toggle-group-option.directive.ts","../../../projects/ui-common/toggle-group/toggle-group.directive.ts","../../../projects/ui-common/toggle-group/toggle-group.module.ts","../../../projects/ui-common/toggle-group/theseam-ui-common-toggle-group.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\n\n/**\n * The part of the toggle group that an option needs in order to resolve its own\n * selected state.\n *\n * This exists as a separate token so `ToggleGroupOptionDirective` can reach its\n * parent group without importing `ToggleGroupDirective`, which would create a\n * circular import between the two directives.\n */\nexport interface TheSeamToggleGroupParent {\n isSelected(value: string | undefined | null): boolean\n}\n\nexport const THESEAM_TOGGLE_GROUP_PARENT =\n new InjectionToken<TheSeamToggleGroupParent>('TheSeamToggleGroupParent')\n","import { Directive, HostBinding, inject, Input } from '@angular/core'\n\nimport { THESEAM_TOGGLE_GROUP_PARENT } from './toggle-group-parent'\n\n@Directive({\n selector: '[seamToggleGroupOption]',\n exportAs: 'seamToggleGroupOption',\n})\nexport class ToggleGroupOptionDirective {\n private readonly _group = inject(THESEAM_TOGGLE_GROUP_PARENT, {\n optional: true,\n })\n\n @Input() seamToggleGroupOption: string | undefined | null\n\n @HostBinding('class.lib-toggle-group-option-selected')\n get _checkioSelectedClass() {\n return this._group?.isSelected(this.value) || false\n }\n\n get value(): string | undefined | null {\n return this.seamToggleGroupOption\n }\n}\n","import { BooleanInput, coerceArray } from '@angular/cdk/coercion'\nimport {\n ContentChildren,\n Directive,\n EventEmitter,\n forwardRef,\n Input,\n Output,\n QueryList,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { InputBoolean } from '@theseam/ui-common/core'\n\nimport { THESEAM_TOGGLE_GROUP_PARENT } from './toggle-group-parent'\nimport { ToggleGroupOptionDirective } from './toggle-group-option.directive'\n\nexport const TOGGLE_GROUP_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleGroupDirective),\n multi: true,\n}\n\n@Directive({\n selector: '[seamToggleGroup]',\n exportAs: 'seamToggleGroup',\n providers: [\n TOGGLE_GROUP_VALUE_ACCESSOR,\n {\n provide: THESEAM_TOGGLE_GROUP_PARENT,\n useExisting: forwardRef(() => ToggleGroupDirective),\n },\n ],\n})\nexport class ToggleGroupDirective implements ControlValueAccessor {\n static ngAcceptInputType_disabled: BooleanInput\n static ngAcceptInputType_multiple: BooleanInput\n static ngAcceptInputType_selectionToggleable: BooleanInput\n\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('value') val: string | string[] | undefined | null\n\n @Input() @InputBoolean() disabled = false\n @Input() @InputBoolean() multiple = false\n @Input() @InputBoolean() selectionToggleable = true\n\n // TODO: Add min/max selected inputs to make toggling better for multi select\n\n // eslint-disable-next-line @angular-eslint/no-output-native\n @Output() readonly change = new EventEmitter<\n string | string[] | undefined | null\n >()\n\n @ContentChildren(ToggleGroupOptionDirective)\n optionDirectives?: QueryList<ToggleGroupOptionDirective>\n\n onChange: any\n onTouched: any\n\n get value(): string | string[] | undefined | null {\n return this.val\n }\n\n set value(value: string | string[] | undefined | null) {\n const _value = this.multiple\n ? value !== null && value !== undefined\n ? coerceArray(value)\n : value\n : value\n\n this.val = this.multiple ? [...((_value as string[]) || [])] : _value || ''\n this.change.emit(this.val)\n if (this.onChange) {\n this.onChange(_value)\n }\n if (this.onTouched) {\n this.onTouched()\n }\n }\n\n writeValue(value: any): void {\n this.value = value\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled\n }\n\n isSelected(value: string | undefined | null) {\n if (this.multiple) {\n const idx = ((this.value as string[]) || []).findIndex((v) => v === value)\n return idx !== -1\n } else {\n // TODO: Clean this up when the directive no longer allows array value type when multiple is false\n const v =\n Array.isArray(this.value) && this.value.length === 1\n ? this.value[0]\n : this.value\n return v === value\n }\n }\n\n /**\n * Toggles an option's selected state by value.\n */\n toggleOptionSelect(value: string | undefined | null): void {\n if (this.isSelected(value)) {\n if (!this.selectionToggleable && this._selectedCount() <= 1) {\n // Unselecting would leave nothing selected.\n return\n }\n this.unselectValue(value)\n return\n }\n\n this.selectValue(value)\n }\n\n private _selectedCount(): number {\n if (this.multiple) {\n return ((this.value as string[]) || []).length\n }\n const v = this.value\n return v === null || v === undefined || v === '' ? 0 : 1\n }\n\n unselectValue(value: string | undefined | null) {\n if (this.multiple) {\n this.value = ((this.value as string[]) || []).filter((v) => v !== value)\n } else {\n this.value = undefined\n }\n }\n\n selectValue(value: string | undefined | null) {\n if (this.multiple) {\n const _value = [...((this.value as string[]) || [])]\n this.value = value ? [..._value, value] : _value\n } else {\n this.value = value\n }\n }\n\n getOptionDirectiveByValue(\n value: string,\n ): ToggleGroupOptionDirective | null | undefined {\n if (!this.optionDirectives || this.optionDirectives.length < 1) {\n return null\n }\n\n return this.optionDirectives.toArray().find((opt) => opt.value === value)\n }\n}\n","import { NgModule } from '@angular/core'\n\nimport { ToggleGroupOptionDirective } from './toggle-group-option.directive'\nimport { ToggleGroupDirective } from './toggle-group.directive'\n\n@NgModule({\n imports: [ToggleGroupDirective, ToggleGroupOptionDirective],\n exports: [ToggleGroupDirective, ToggleGroupOptionDirective],\n})\nexport class TheSeamToggleGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAca,2BAA2B,GACtC,IAAI,cAAc,CAA2B,0BAA0B;;MCP5D,0BAA0B,CAAA;AACpB,IAAA,MAAM,GAAG,MAAM,CAAC,2BAA2B,EAAE;AAC5D,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC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AwB,EAAA,CAAA;;4FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAJpC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;AAC3D,oBAAA,OAAO,EAAE,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;AAC5D,iBAAA;;;ACRD;;AAEG;;;;"}
1
+ {"version":3,"file":"theseam-ui-common-toggle-group.mjs","sources":["../../../projects/ui-common/toggle-group/toggle-group-parent.ts","../../../projects/ui-common/toggle-group/toggle-group-option.directive.ts","../../../projects/ui-common/toggle-group/toggle-group.directive.ts","../../../projects/ui-common/toggle-group/toggle-group.module.ts","../../../projects/ui-common/toggle-group/theseam-ui-common-toggle-group.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\n\n/**\n * The part of the toggle group that an option needs in order to resolve its own\n * selected state.\n *\n * This exists as a separate token so `ToggleGroupOptionDirective` can reach its\n * parent group without importing `ToggleGroupDirective`, which would create a\n * circular import between the two directives.\n */\nexport interface TheSeamToggleGroupParent {\n isSelected(value: string | undefined | null): boolean\n}\n\nexport const THESEAM_TOGGLE_GROUP_PARENT =\n new InjectionToken<TheSeamToggleGroupParent>('TheSeamToggleGroupParent')\n","import { Directive, HostBinding, inject, Input } from '@angular/core'\n\nimport { THESEAM_TOGGLE_GROUP_PARENT } from './toggle-group-parent'\n\n@Directive({\n selector: '[seamToggleGroupOption]',\n exportAs: 'seamToggleGroupOption',\n})\nexport class ToggleGroupOptionDirective {\n private readonly _group = inject(THESEAM_TOGGLE_GROUP_PARENT, {\n optional: true,\n })\n\n @Input() seamToggleGroupOption: string | undefined | null\n\n @HostBinding('class.lib-toggle-group-option-selected')\n get _checkioSelectedClass() {\n return this._group?.isSelected(this.value) || false\n }\n\n get value(): string | undefined | null {\n return this.seamToggleGroupOption\n }\n}\n","import { BooleanInput, coerceArray } from '@angular/cdk/coercion'\nimport {\n ContentChildren,\n Directive,\n EventEmitter,\n forwardRef,\n Input,\n Output,\n QueryList,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { InputBoolean } from '@theseam/ui-common/core'\n\nimport { THESEAM_TOGGLE_GROUP_PARENT } from './toggle-group-parent'\nimport { ToggleGroupOptionDirective } from './toggle-group-option.directive'\n\nexport const TOGGLE_GROUP_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleGroupDirective),\n multi: true,\n}\n\n@Directive({\n selector: '[seamToggleGroup]',\n exportAs: 'seamToggleGroup',\n providers: [\n TOGGLE_GROUP_VALUE_ACCESSOR,\n {\n provide: THESEAM_TOGGLE_GROUP_PARENT,\n useExisting: forwardRef(() => ToggleGroupDirective),\n },\n ],\n})\nexport class ToggleGroupDirective implements ControlValueAccessor {\n static ngAcceptInputType_disabled: BooleanInput\n static ngAcceptInputType_multiple: BooleanInput\n static ngAcceptInputType_selectionToggleable: BooleanInput\n\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('value') val: string | string[] | undefined | null\n\n @Input() @InputBoolean() disabled = false\n @Input() @InputBoolean() multiple = false\n @Input() @InputBoolean() selectionToggleable = true\n\n // TODO: Add min/max selected inputs to make toggling better for multi select\n\n // eslint-disable-next-line @angular-eslint/no-output-native\n @Output() readonly change = new EventEmitter<\n string | string[] | undefined | null\n >()\n\n @ContentChildren(ToggleGroupOptionDirective)\n optionDirectives?: QueryList<ToggleGroupOptionDirective>\n\n onChange: any\n onTouched: any\n\n private _selectedSet: Set<string> | undefined\n private _selectedSetSource: string | string[] | undefined | null\n private _selectedSetMultiple: boolean | undefined\n\n get value(): string | string[] | undefined | null {\n return this.val\n }\n\n set value(value: string | string[] | undefined | null) {\n const _value = this.multiple\n ? value !== null && value !== undefined\n ? coerceArray(value)\n : value\n : value\n\n this.val = this.multiple ? [...((_value as string[]) || [])] : _value || ''\n this.change.emit(this.val)\n if (this.onChange) {\n this.onChange(_value)\n }\n if (this.onTouched) {\n this.onTouched()\n }\n }\n\n writeValue(value: any): void {\n this.value = value\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled\n }\n\n isSelected(value: string | undefined | null): boolean {\n if (value === null || value === undefined) {\n return false\n }\n return this._selected().has(value)\n }\n\n /**\n * The current selection as a set, rebuilt only when the value (or `multiple`)\n * changes.\n *\n * `isSelected` is called from templates and from every option's host binding,\n * so it runs several times per option per change detection pass. Hashing the\n * selection once keeps those lookups O(1) instead of scanning the value array\n * on every call.\n *\n * Invalidation is keyed on the `val` reference rather than done in the `value`\n * setter, because `val` is also written directly by the `[value]` input, which\n * does not go through the setter.\n */\n private _selected(): ReadonlySet<string> {\n if (\n this._selectedSet === undefined ||\n this.val !== this._selectedSetSource ||\n this.multiple !== this._selectedSetMultiple\n ) {\n this._selectedSetSource = this.val\n this._selectedSetMultiple = this.multiple\n this._selectedSet = this._buildSelectedSet()\n }\n return this._selectedSet\n }\n\n private _buildSelectedSet(): Set<string> {\n const val = this.val\n\n if (this.multiple) {\n return new Set((val as string[]) ?? [])\n }\n\n // TODO: Clean this up when the directive no longer allows array value type when multiple is false\n const v = Array.isArray(val) && val.length === 1 ? val[0] : val\n return typeof v === 'string' ? new Set([v]) : new Set()\n }\n\n /**\n * Toggles an option's selected state by value.\n */\n toggleOptionSelect(value: string | undefined | null): void {\n if (this.isSelected(value)) {\n if (!this.selectionToggleable && this._selectedCount() <= 1) {\n // Unselecting would leave nothing selected.\n return\n }\n this.unselectValue(value)\n return\n }\n\n this.selectValue(value)\n }\n\n private _selectedCount(): number {\n if (this.multiple) {\n return ((this.value as string[]) || []).length\n }\n const v = this.value\n return v === null || v === undefined || v === '' ? 0 : 1\n }\n\n unselectValue(value: string | undefined | null) {\n if (this.multiple) {\n this.value = ((this.value as string[]) || []).filter((v) => v !== value)\n } else {\n this.value = undefined\n }\n }\n\n selectValue(value: string | undefined | null) {\n if (this.multiple) {\n const _value = [...((this.value as string[]) || [])]\n this.value = value ? [..._value, value] : _value\n } else {\n this.value = value\n }\n }\n\n getOptionDirectiveByValue(\n value: string,\n ): ToggleGroupOptionDirective | null | undefined {\n if (!this.optionDirectives || this.optionDirectives.length < 1) {\n return null\n }\n\n return this.optionDirectives.toArray().find((opt) => opt.value === value)\n }\n}\n","import { NgModule } from '@angular/core'\n\nimport { ToggleGroupOptionDirective } from './toggle-group-option.directive'\nimport { ToggleGroupDirective } from './toggle-group.directive'\n\n@NgModule({\n imports: [ToggleGroupDirective, ToggleGroupOptionDirective],\n exports: [ToggleGroupDirective, ToggleGroupOptionDirective],\n})\nexport class TheSeamToggleGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAca,2BAA2B,GACtC,IAAI,cAAc,CAA2B,0BAA0B;;MCP5D,0BAA0B,CAAA;AACpB,IAAA,MAAM,GAAG,MAAM,CAAC,2BAA2B,EAAE;AAC5D,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;AAEO,IAAA,qBAAqB;AAE9B,IAAA,IACI,qBAAqB,GAAA;AACvB,QAAA,OAAO,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK;IACrD;AAEA,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,qBAAqB;IACnC;wGAdW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,MAAA,EAAA,EAAA,qBAAA,EAAA,uBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,wCAAA,EAAA,4BAAA,EAAA,EAAA,EAAA,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AwB,YAHzB,oBAAoB,EAAE,0BAA0B,CAAA,EAAA,OAAA,EAAA,CAChD,oBAAoB,EAAE,0BAA0B,CAAA,EAAA,CAAA;yGAE/C,wBAAwB,EAAA,CAAA;;4FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAJpC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;AAC3D,oBAAA,OAAO,EAAE,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;AAC5D,iBAAA;;;ACRD;;AAEG;;;;"}
@@ -4,7 +4,7 @@ import area from '@turf/area';
4
4
  import { convertArea, polygon } from '@turf/helpers';
5
5
  import kinks from '@turf/kinks';
6
6
  import { fileTypeFromBuffer } from 'file-type';
7
- import shp from 'shpjs';
7
+ import { parseShp, parseZip } from 'shpjs';
8
8
  import booleanContains from '@turf/boolean-contains';
9
9
 
10
10
  /**
@@ -763,7 +763,7 @@ async function coerceToArrayBuffer(fileOrBuffer) {
763
763
  return fileOrBuffer;
764
764
  }
765
765
  async function parseShpFile(buffer) {
766
- const geometries = await shp.parseShp(buffer, undefined);
766
+ const geometries = parseShp(buffer);
767
767
  const featCollection = {
768
768
  type: 'FeatureCollection',
769
769
  features: geometries.map((geom) => ({
@@ -775,7 +775,7 @@ async function parseShpFile(buffer) {
775
775
  return featCollection;
776
776
  }
777
777
  async function parseShpZip(buffer) {
778
- let featCollection = await shp.parseZip(buffer, undefined);
778
+ let featCollection = await parseZip(buffer);
779
779
  if (Array.isArray(featCollection)) {
780
780
  if (featCollection.length === 0) {
781
781
  throw Error(`Shape data not found.`);
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-utils.mjs","sources":["../../../projects/ui-common/utils/get-attribute.ts","../../../projects/ui-common/utils/has-attribute.ts","../../../projects/ui-common/utils/cdk/get-closest-widget-cdk-drag.ts","../../../projects/ui-common/utils/form/get-control-name.ts","../../../projects/ui-common/utils/form/get-control-path.ts","../../../projects/ui-common/utils/form/observe-control-value.ts","../../../projects/ui-common/utils/form/observe-control-is-different.ts","../../../projects/ui-common/utils/form/wait-on-non-pending-status.ts","../../../projects/ui-common/utils/form/observe-control-status.ts","../../../projects/ui-common/utils/form/observe-control-valid.ts","../../../projects/ui-common/utils/form/observe-control-value-change.ts","../../../projects/ui-common/utils/has-property.ts","../../../projects/ui-common/utils/form/has-required-control.ts","../../../projects/ui-common/utils/form/is-empty-input-value.ts","../../../projects/ui-common/utils/operators/map-each.ts","../../../projects/ui-common/utils/operators/tap-first.ts","../../../projects/ui-common/utils/router/leaf-child-route.ts","../../../projects/ui-common/utils/router/will-have-data-prop.ts","../../../projects/ui-common/utils/router/operators/activated-routes-with-data-property.ts","../../../projects/ui-common/utils/router/route-snapshot-path-relative.ts","../../../projects/ui-common/utils/router/route-snapshot-path-full.ts","../../../projects/ui-common/utils/router/is-empty-url-route.ts","../../../projects/ui-common/utils/geo-json/coerce-feature-collection.ts","../../../projects/ui-common/utils/geo-json/geo-json-to-area.ts","../../../projects/ui-common/utils/geo-json/is-feature-collection.validator.ts","../../../projects/ui-common/utils/geo-json/is-only-geometry-types.ts","../../../projects/ui-common/utils/geo-json/is-only-geometry-types.validator.ts","../../../projects/ui-common/utils/geo-json/merge-polygons.ts","../../../projects/ui-common/utils/not-null-or-undefined.ts","../../../projects/ui-common/utils/geo-json/polygon-violates-min-max.ts","../../../projects/ui-common/utils/geo-json/min-max-points.validator.ts","../../../projects/ui-common/utils/geo-json/no-empty-feature-collection.validator.ts","../../../projects/ui-common/utils/geo-json/no-inner-rings.validator.ts","../../../projects/ui-common/utils/geo-json/no-kinks.validator.ts","../../../projects/ui-common/utils/file-utils.ts","../../../projects/ui-common/utils/obj-utils.ts","../../../projects/ui-common/utils/geo-json/read-geo-file.ts","../../../projects/ui-common/utils/geo-json/split-multi-polygons.ts","../../../projects/ui-common/utils/geo-json/close-polygons.ts","../../../projects/ui-common/utils/geo-json/polygon-has-min-distinct-vertices.ts","../../../projects/ui-common/utils/geo-json/polygon-contains.ts","../../../projects/ui-common/utils/geo-json/add-hole-to-polygon.ts","../../../projects/ui-common/utils/array-move.ts","../../../projects/ui-common/utils/calc-percentage.ts","../../../projects/ui-common/utils/toggle-attribute.ts","../../../projects/ui-common/utils/input-masks.ts","../../../projects/ui-common/utils/is-null-or-undefined.ts","../../../projects/ui-common/utils/is-null-or-undefined-or-empty.ts","../../../projects/ui-common/utils/load-style.ts","../../../projects/ui-common/utils/load-style-sheet.ts","../../../projects/ui-common/utils/not-null-or-undefined-or-empty.ts","../../../projects/ui-common/utils/wait-on-condition-async.ts","../../../projects/ui-common/utils/polling-ticker.ts","../../../projects/ui-common/utils/refreshable.ts","../../../projects/ui-common/utils/wrap-into-observable.ts","../../../projects/ui-common/utils/is-absolute-url.ts","../../../projects/ui-common/utils/subscriber-count.ts","../../../projects/ui-common/utils/observe-query-list.ts","../../../projects/ui-common/utils/create-padding.ts","../../../projects/ui-common/utils/pad-end.ts","../../../projects/ui-common/utils/pad-start.ts","../../../projects/ui-common/utils/is-numeric.ts","../../../projects/ui-common/utils/fractional-digits-count.ts","../../../projects/ui-common/utils/strip-outer.ts","../../../projects/ui-common/utils/trim-repeated.ts","../../../projects/ui-common/utils/sanitize-filename.ts","../../../projects/ui-common/utils/theseam-ui-common-utils.ts"],"sourcesContent":["/**\n *\n */\nexport function getAttribute<E extends HTMLElement>(\n element: E,\n name: string,\n): string | null {\n return element.getAttribute(name)\n}\n","/**\n *\n */\nexport function hasAttribute<E extends HTMLElement>(\n element: E,\n name: string,\n): boolean {\n return element.hasAttribute(name)\n}\n","import { CdkDrag } from '@angular/cdk/drag-drop'\nimport { ElementRef } from '@angular/core'\n\nimport { getAttribute } from '../get-attribute'\nimport { hasAttribute } from '../has-attribute'\n\n/**\n * Finds the closest CdkDrag to an element by looking at the DOM.\n * @param element Element relative to which to look for a cdkDrag.\n * @param openDialogs References to the currently available cdkDrag.\n */\nexport function getClosestWidgetCdkDrag(\n element: ElementRef<HTMLElement>,\n dragDirectives: CdkDrag<any>[],\n) {\n let parent: HTMLElement | null = element.nativeElement.parentElement\n\n while (\n parent &&\n !(\n parent.classList.contains('cdk-drag') &&\n hasAttribute(parent, 'data-widget-id')\n )\n ) {\n parent = parent.parentElement\n }\n\n const parentId = parent ? getAttribute(parent, 'data-widget-id') : null\n return parentId\n ? dragDirectives.find(\n (drag) =>\n getAttribute(drag.getRootElement(), 'data-widget-id') === parentId,\n )\n : null\n}\n","import { AbstractControl } from '@angular/forms'\n\n/**\n * Get the name of the control.\n *\n * Example:\n *\n * ```js\n * const group = new FormGroup({\n * name: new Control(),\n * age: new Control()\n * })\n *\n * for (const c of group.controls) {\n * console.log(getControlName(c))\n * }\n *\n * // Output:\n * // >> 'name'\n * // >> 'age'\n * ```\n */\nexport function getControlName(c: AbstractControl): string | null {\n if (!c.parent) {\n return null\n }\n // NOTE: Typed as 'any' because using string for array index is not valid for\n // array index type, but it works and we actually want the index as a string\n // anyway.\n const controls: any = c.parent.controls\n return Object.keys(controls).find((name) => c === controls[name]) || null\n}\n","import { AbstractControl } from '@angular/forms'\n\nimport { getControlName } from './get-control-name'\n\n/**\n * Get the path to a control.\n *\n * The path is built by walking back the `parent` properties until `parent` is\n * `null`.\n *\n * Example:\n *\n * ```js\n * const group = new FormGroup({\n * name: new FormControl(),\n * address: new FormGroup({\n * city: new FormControl(),\n * state: new FormControl()\n * })\n * })\n *\n * const control = group.get('address.city')\n * console.log(getControlPath(control))\n *\n * // Output:\n * >> 'address.city'\n * ```\n *\n */\nexport function getControlPath(\n c: AbstractControl,\n path: string = '',\n): string | null {\n let _path = path\n _path = getControlName(c) + _path\n\n if (c.parent && getControlName(c.parent)) {\n _path = `.${_path}`\n return getControlPath(c.parent, _path)\n } else {\n return _path\n }\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable, of } from 'rxjs'\nimport { startWith, switchMap } from 'rxjs/operators'\n\n/**\n * Observe the value of a control.\n */\nexport function observeControlValue<T = any>(\n control: AbstractControl,\n): Observable<T> {\n return of(control).pipe(\n switchMap((_control) =>\n _control.valueChanges.pipe(startWith(_control.value)),\n ),\n )\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { distinctUntilChanged, map } from 'rxjs/operators'\n\nimport { observeControlValue } from './observe-control-value'\n\n/**\n * Observe the changed state of the input value from the time this function is\n * called.\n *\n * When this function is called the value is stored. Each time the control's\n * value changes the value is compared with the initial value. Currenly the\n * values are compared as stringified objects using `JSON.stringify`.\n *\n * TODO: Allow the value compare implementation to be optionally changed.\n */\nexport function observeControlIsDifferent(\n control: AbstractControl,\n): Observable<boolean> {\n const _initial = JSON.stringify(control.value)\n return observeControlValue(control).pipe(\n map((value) => JSON.stringify(value) !== _initial),\n distinctUntilChanged(),\n )\n}\n","import { AbstractControl } from '@angular/forms'\nimport { interval, merge, Observable } from 'rxjs'\nimport { filter, map, mapTo, startWith, take } from 'rxjs/operators'\n\n/**\n * Wait on the status of a form control to not be `'PENDING'`.\n *\n * NOTE: This function is mainly just a work around for an issue where\n * `statusChanges` sometimes emits `'Pending'` without emitting another state\n * when complete. Seems to happen with async validators if the value changes\n * before completing, even if the validator completes(subscription `complete`\n * if observable).\n */\nexport function waitOnNonPendingStatus(\n control: AbstractControl,\n): Observable<string> {\n return merge(\n control.statusChanges,\n interval(30).pipe(\n mapTo(control),\n map((c) => c.status),\n ),\n )\n .pipe(startWith(control.status))\n .pipe(filter((v) => v !== 'PENDING'))\n .pipe(take(1))\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable, of } from 'rxjs'\nimport { startWith, switchMap } from 'rxjs/operators'\n\nimport { waitOnNonPendingStatus } from './wait-on-non-pending-status'\n\n/**\n * Observe the status of a control using a work around for status not changing\n * after pending.\n */\nexport function observeControlStatus(\n control: AbstractControl,\n): Observable<string> {\n return of(control).pipe(\n switchMap((_control) =>\n _control.statusChanges\n .pipe(startWith(_control.status))\n .pipe(\n switchMap((status) =>\n status === 'PENDING'\n ? waitOnNonPendingStatus(control).pipe(startWith(status))\n : of(status),\n ),\n ),\n ),\n )\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { distinctUntilChanged, map, pairwise, startWith } from 'rxjs/operators'\n\nimport { observeControlStatus } from './observe-control-status'\n\n/**\n * Observe the valid state of a control.\n *\n * By default `waitOnPending` is false and the control states map to:\n * 'VALID' => true\n * 'INVALID' => false\n * 'PENDING' => false\n *\n * If `waitOnPending` is true the valid result when 'PENDING' remains the same\n * as it was before 'PENDING' until it is no longer 'PENDING'.\n */\nexport function observeControlValid(\n control: AbstractControl,\n waitOnPending: boolean = false,\n): Observable<boolean> {\n if (waitOnPending) {\n return observeControlStatus(control)\n .pipe(distinctUntilChanged())\n .pipe(startWith(undefined))\n .pipe(pairwise())\n .pipe(map((v) => ({ previous: v[0], current: v[1] })))\n .pipe(map((v) => (v.current === 'PENDING' ? v.previous : v.current)))\n .pipe(map((status) => status === 'VALID'))\n } else {\n return observeControlStatus(control)\n .pipe(distinctUntilChanged())\n .pipe(map((status) => status === 'VALID'))\n }\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { map, pairwise, startWith } from 'rxjs/operators'\n\nimport { observeControlValue } from './observe-control-value'\n\n/**\n * Observe the value of a control with the previous.\n */\nexport function observeControlValueChange(\n control: AbstractControl,\n): Observable<{ previous: any; current: any }> {\n return observeControlValue(control).pipe(\n startWith(undefined),\n pairwise(),\n map((v) => ({ previous: v[0], current: v[1] })),\n )\n}\n","// Source: https://stackoverflow.com/a/59361497/7926298\nexport function hasProperty<T extends object, K extends keyof T>(\n style: T,\n prop: K,\n // ): style is T & { [P in K]-?: Exclude<T[K], undefined> } {\n): style is T & Required<Record<K, Exclude<T[K], undefined>>> {\n return (\n Object.prototype.hasOwnProperty.call(style, prop) &&\n style[prop] !== undefined\n )\n}\n","import { AbstractControl } from '@angular/forms'\n\nimport { hasProperty } from '../has-property'\n\n/**\n * Check if control has a required control.\n *\n * ----------------------------------------------------------------------------\n * NOTE: I am not sure about if this should be used or not.\n *\n * From my understanding this assumes that all the validators do not have some\n * unexpected side-effect from being called like this. It could be argued that\n * the validator is flawed and should be fixed if that is the case, but I am not\n * convinced that is correct yet.\n *\n * An example that I think is valid for this argument: A FormControl configured\n * to only check validators when a specific condition happens, because of a\n * reason that it has to do a long process. In that situation should this\n * function be smart enough to consider that or is it up to the validator to\n * consider this function possibly being used.\n *\n * This seems to assume the required validator will always be a synchronous\n * validator. That is a valid assumption if thinking about showing a required\n * state in the UI, but a FormControl does not neccessarily have to be used in\n * UI. So, I think it could be valid to have an async validator that uses the\n * name `required` for it error, but I do not have a good example, so I could be\n * wrong.\n * ----------------------------------------------------------------------------\n *\n * Source: https://gist.github.com/jsdevtom/5589af349a395b37e699b67417ef025b\n * @experimental\n * @ignore\n */\nexport function hasRequiredControl(abstractControl: AbstractControl): boolean {\n if (abstractControl.validator) {\n const validator = abstractControl.validator({} as AbstractControl)\n if (validator && validator.required) {\n return true\n }\n }\n\n const _abstractControl: any = abstractControl\n if (hasProperty(_abstractControl, 'controls')) {\n for (const controlName in _abstractControl.controls) {\n if (_abstractControl.controls[controlName]) {\n if (hasRequiredControl(_abstractControl.controls[controlName])) {\n return true\n }\n }\n }\n }\n\n return false\n}\n","// Source: https://github.com/angular/angular/blob/master/packages/forms/src/validators.ts#L16\nexport function isEmptyInputValue(value: any): boolean {\n // we don't check for string here so it also works with arrays\n return value == null || value.length === 0\n}\n","import { from, Observable } from 'rxjs'\nimport { map, switchMap, toArray } from 'rxjs/operators'\n\nexport function mapEach<T, R>(predicate: (value: T) => R) {\n return (source$: Observable<T[]>): Observable<R[]> =>\n source$.pipe(\n switchMap((v) =>\n from(v).pipe(\n map((m) => predicate(m)),\n toArray(),\n ),\n ),\n )\n}\n","import { Observable } from 'rxjs'\nimport { tap } from 'rxjs/operators'\n\n/**\n * Like tap, but only calls predicate on first emission.\n */\nexport function tapFirst<T>(predicate: (value: T) => void) {\n let _initialized = false\n return (source$: Observable<T>): Observable<T> =>\n source$.pipe(\n tap((v) => {\n if (!_initialized) {\n predicate(v)\n _initialized = true\n }\n }),\n )\n}\n","import { ActivatedRoute } from '@angular/router'\n\nexport function leafChildRoute(activatedRoute: ActivatedRoute): ActivatedRoute {\n let route = activatedRoute\n while (route.firstChild) {\n route = route.firstChild\n }\n return route\n}\n","import { ActivatedRoute } from '@angular/router'\n\nfunction hasRouteConfigDataProp(route: ActivatedRoute, prop: string): boolean {\n return !!(\n route &&\n route.routeConfig &&\n route.routeConfig.data &&\n Object.prototype.hasOwnProperty.call(route.routeConfig.data, prop)\n )\n}\n\nfunction hasRouteConfigResolveProp(\n route: ActivatedRoute,\n prop: string,\n): boolean {\n return !!(\n route &&\n route.routeConfig &&\n route.routeConfig.resolve &&\n Object.prototype.hasOwnProperty.call(route.routeConfig.resolve, prop)\n )\n}\n\nexport function willHaveDataProp(route: ActivatedRoute, prop: string): boolean {\n return (\n hasRouteConfigDataProp(route, prop) ||\n hasRouteConfigResolveProp(route, prop)\n )\n}\n","import { ActivatedRoute, Data } from '@angular/router'\nimport { combineLatest, Observable } from 'rxjs'\nimport { map, switchMap } from 'rxjs/operators'\n\nimport { leafChildRoute } from '../leaf-child-route'\nimport { willHaveDataProp } from '../will-have-data-prop'\n\nexport interface IActivatedRouteWithData {\n route: ActivatedRoute\n data: Data\n}\n\nexport function activatedRoutesWithDataProperty(\n prop: string,\n mustHaveDefined: boolean = false,\n) {\n const _data = (r: ActivatedRoute) =>\n r.data.pipe(map((_d) => ({ route: r, data: _d })))\n return (\n source$: Observable<ActivatedRoute>,\n ): Observable<IActivatedRouteWithData[]> =>\n source$.pipe(\n map((route) => leafChildRoute(route)),\n map((route) => route.pathFromRoot),\n switchMap((routes) => combineLatest(routes.map((r) => _data(r)))),\n map((v) =>\n v.filter((_v) => Object.prototype.hasOwnProperty.call(_v.data, prop)),\n ),\n map((v) =>\n mustHaveDefined\n ? v.filter((_v) => willHaveDataProp(_v.route, prop))\n : v,\n ),\n )\n}\n","import { ActivatedRouteSnapshot } from '@angular/router'\n\nexport function routeSnapshotPathRelative(route: ActivatedRouteSnapshot) {\n return route.url.reduce(\n (path, urlSegment) => `${path}/${urlSegment.path}`,\n '',\n )\n}\n","import { ActivatedRouteSnapshot } from '@angular/router'\n\nimport { routeSnapshotPathRelative } from './route-snapshot-path-relative'\n\nexport function routeSnapshotPathFull(route: ActivatedRouteSnapshot) {\n return route.pathFromRoot.reduce(\n (path, _route) => path + routeSnapshotPathRelative(_route),\n '',\n )\n}\n","import { ActivatedRoute } from '@angular/router'\n\nexport function isEmptyUrlRoute(activatedRoute: ActivatedRoute): boolean {\n return activatedRoute.snapshot.url.length === 0\n}\n","import { FeatureCollection } from 'geojson'\n\n// TODO: Make this more thorough and maybe error on unrecognized.\nexport function coerceFeatureCollection(value: any): FeatureCollection | null {\n return parseValue(value)\n}\n\n/**\n * Parses the value to a FeatureCollection object or null if it is not a\n * FeatureCollection.\n */\nfunction parseValue(value: any): FeatureCollection | null {\n const _value = parseStringValue(value)\n if (isFeatureCollectionValue(_value)) {\n return _value\n }\n return null\n}\n\n/**\n * Tries to parse the value to an object, in case the value is a stringified\n * json.\n */\nfunction parseStringValue(value: any): any {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value)\n } catch {\n return null\n }\n }\n\n return value\n}\n\n/**\n * Checks if the value is a FeatureCollection.\n *\n * NOTE: This is not a thorough FeatureCollection check. It only checks that the\n * value is an object resembling a GeoJSON.FeatureCollection, enough for the\n * validator.\n */\nfunction isFeatureCollectionValue(value: any): value is FeatureCollection {\n if (value === undefined || value === null) {\n return false\n }\n return value.type === 'FeatureCollection' && Array.isArray(value.features)\n}\n","import area from '@turf/area'\nimport { AreaUnits, convertArea } from '@turf/helpers'\nimport {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n GeoJsonProperties,\n} from 'geojson'\n\n/**\n *\n */\nexport function geoJsonToArea(\n geoJson:\n | GeoJSON\n | Feature<any, GeoJsonProperties>\n | FeatureCollection<any, GeoJsonProperties>\n | Geometry,\n units: AreaUnits = 'acres',\n): number {\n const areaMSqr = area(geoJson as any)\n const acres = convertArea(areaMSqr, 'meters', units)\n return acres\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nexport const IS_FEATURE_COLLECTION_VALIDATOR_NAME = 'is-feature-collection'\n\nexport function isFeatureCollectionValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return {\n [IS_FEATURE_COLLECTION_VALIDATOR_NAME]: {\n reason: `Must be a FeatureCollection.`,\n },\n }\n }\n\n return null\n }\n}\n","import { FeatureCollection, Geometry } from 'geojson'\n\n/**\n * Returns true if the GeoJSON is only specifies geometries.\n */\nexport function isOnlyGeometryTypes(\n featureCollection: FeatureCollection,\n types: Geometry['type'][],\n): boolean {\n if (types.length === 0) {\n if (featureCollection.features.length > 0) {\n // If no types are specified then there can't be any specified types found.\n return false\n } else {\n // If no types are specified and there are no features then there is\n // nothing to say a specified type isn't found.\n return true\n }\n }\n\n for (const f of featureCollection.features) {\n if (types.indexOf(f.geometry.type) === -1) {\n return false\n }\n }\n\n return true\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { Geometry } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\nimport { isOnlyGeometryTypes } from './is-only-geometry-types'\n\nexport const IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME = 'is-only-geometry-types'\n\nexport function isOnlyGeometryTypesValidator(\n types: Geometry['type'][],\n): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n // If there isn't a FeatureCollection then there is nothing to validate.\n // Use 'isFeatureCollection' to validate the value is a FeatureCollection.\n return null\n }\n\n if (!isOnlyGeometryTypes(value, types)) {\n const typesNotAllowed = value.features\n .map((f) => f.geometry.type)\n .filter((t) => types.indexOf(t) === -1)\n const distinctTypesNotAllowed = Array.from(new Set(typesNotAllowed))\n return {\n [IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME]: {\n reason: `Only geometry type${types.length === 1 ? '' : 's'} ${types.join(', ')} allowed.`,\n notAllowedGeometryTypesFound: distinctTypesNotAllowed,\n },\n }\n }\n\n return null\n }\n}\n","import { Feature, FeatureCollection, MultiPolygon } from 'geojson'\n\n/**\n * Merge Polygon and MultiPolygon geometries into a single MultiPolygon. Any\n * properties, other than 'coordinates', of the Polygons and MultiPolygons will\n * be lost.\n *\n * NOTE: Polygons and MultPolygons in a GeometryCollection will not be merged.\n */\nexport function mergePolygons(featureCollection: FeatureCollection): void {\n const multiPolygon: MultiPolygon = {\n type: 'MultiPolygon',\n coordinates: [],\n }\n\n for (let i = 0; i < featureCollection.features.length; i++) {\n const f = featureCollection.features[i]\n if (f.geometry.type === 'Polygon') {\n multiPolygon.coordinates.push(f.geometry.coordinates)\n featureCollection.features.splice(i, 1)\n i--\n } else if (f.geometry.type === 'MultiPolygon') {\n multiPolygon.coordinates.push(...f.geometry.coordinates)\n featureCollection.features.splice(i, 1)\n i--\n }\n }\n\n if (multiPolygon.coordinates.length > 0) {\n const feature: Feature = {\n type: 'Feature',\n geometry: multiPolygon,\n properties: {},\n }\n featureCollection.features.push(feature)\n }\n}\n","export function notNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined\n}\n","import { notNullOrUndefined } from '../not-null-or-undefined'\n\n/**\n * Checks if a single polygon ring's coordinate count violates the given\n * min/max point bounds. `max` is only applied when it is greater than `min`.\n */\nexport function polygonViolatesMinMax(\n coordinateLength: number,\n min: number,\n max?: number | undefined,\n): boolean {\n if (\n coordinateLength < min ||\n (notNullOrUndefined(max) && max > min && coordinateLength > max)\n ) {\n return true\n }\n\n return false\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { FeatureCollection } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { notNullOrUndefined } from '../not-null-or-undefined'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\nimport { polygonViolatesMinMax } from './polygon-violates-min-max'\n\nexport const MIN_MAX_POINTS_VALIDATOR_NAME = 'min-max-points'\n\nexport function minMaxPointsValidator(\n min: number | undefined = 3,\n max?: number | undefined,\n): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return null\n }\n\n if (collectionViolatesMinMax(value, min, max)) {\n const reason = notNullOrUndefined(max)\n ? `A polygon must have between ${min} and ${max} points.`\n : `A polygon must have at least ${min} points.`\n return {\n [MIN_MAX_POINTS_VALIDATOR_NAME]: {\n reason,\n },\n }\n }\n return null\n }\n}\n\n/**\n * Checks if a FeatureCollection contains any geometries with an incomplete polygon.\n *\n * NOTE: Does not consider GeometryCollection.\n */\nfunction collectionViolatesMinMax(\n featureCollection: FeatureCollection,\n min: number,\n max: number | undefined,\n): boolean {\n for (const f of featureCollection.features) {\n if (f.geometry.type === 'Polygon') {\n if (polygonViolatesMinMax(f.geometry.coordinates[0].length, min, max)) {\n return true\n }\n } else if (f.geometry.type === 'MultiPolygon') {\n for (const coords of f.geometry.coordinates) {\n if (polygonViolatesMinMax(coords[0].length, min, max)) {\n return true\n }\n }\n }\n }\n\n return false\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nexport const NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME =\n 'no-empty-feature-collection'\n\nexport function noEmptyFeatureCollectionValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return null\n }\n\n if (value.features.length === 0) {\n return {\n [NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME]: {\n reason: `FeatureCollection must have a value.`,\n },\n }\n }\n\n return null\n }\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { FeatureCollection } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nexport const NO_INNER_RINGS_VALIDATOR_NAME = 'no-inner-rings'\n\n/**\n * Validates that a FeatureCollection does not contain any Polygon with inner\n * rings(\"holes\").\n *\n * NOTE: Only considers Polygon and MultiPolygon. Does not consider\n * GeometryCollection.\n */\nexport function noInnerRingsValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n // If there isn't a FeatureCollection then there is nothing to validate.\n // Use 'isFeatureCollection' to validate the value is a FeatureCollection.\n return null\n }\n\n if (hasInnerRing(value)) {\n return {\n [NO_INNER_RINGS_VALIDATOR_NAME]: {\n reason: `A shape cannot have an inner ring.`,\n },\n }\n }\n\n return null\n }\n}\n\n/**\n * Checks if a FeatureCollection contains any geometries with an inner\n * ring(\"hole\").\n *\n * NOTE: Does not consider GeometryCollection.\n */\nfunction hasInnerRing(featureCollection: FeatureCollection): boolean {\n for (const f of featureCollection.features) {\n // The spec says the right-hand rule must be followed, but also specifies\n // that tools should not reject polygons that do not follow the right-hand\n // rule. It does specify that the first ring must be the exterior ring and\n // the others must be the interior. So, this should be safe to just check\n // if there are multiple rings, instead of checking their winding orders.\n //\n // Polygon spec: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6\n if (f.geometry.type === 'Polygon') {\n if (f.geometry.coordinates.length > 1) {\n return true\n }\n } else if (f.geometry.type === 'MultiPolygon') {\n for (const coords of f.geometry.coordinates) {\n if (coords.length > 1) {\n return true\n }\n }\n }\n }\n\n return false\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport kinks from '@turf/kinks'\nimport { Feature, FeatureCollection } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nconst kinkableGeometryTypes = [\n 'LineString',\n 'MultiLineString',\n 'MultiPolygon',\n 'Polygon',\n]\n\nexport const NO_KINKS_VALIDATOR_NAME = 'no-kinks'\n\nexport function noKinksValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return null\n }\n\n const kinksFound: { feature: Feature; kinks: FeatureCollection }[] = []\n for (const f of value.features) {\n if (kinkableGeometryTypes.indexOf(f.geometry.type) !== -1) {\n const _kinks = kinks(f as any)\n if (_kinks.features.length > 0) {\n kinksFound.push({\n feature: f,\n kinks: _kinks,\n })\n }\n }\n }\n\n if (kinksFound.length > 0) {\n return {\n [NO_KINKS_VALIDATOR_NAME]: {\n reason: 'Paths should not intersect themselves.',\n featuresWithKink: kinksFound,\n },\n }\n }\n\n return null\n }\n}\n","import { fileTypeFromBuffer } from 'file-type'\n\nexport function readFileAsync(file: Blob): Promise<ArrayBuffer | null> {\n return new Promise<ArrayBuffer | null>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as ArrayBuffer | null)\n }\n reader.readAsArrayBuffer(file)\n })\n}\n\nexport async function readFileAsDataUrlAsync(\n file: Blob,\n): Promise<string | null> {\n return new Promise<string | null>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string | null)\n }\n reader.readAsDataURL(file)\n })\n}\n\n/** Coerce a buffer to an ArrayBuffer suitable for use as a BlobPart. */\nfunction toArrayBuffer(buffer: Uint8Array | ArrayBuffer): ArrayBuffer {\n if (buffer instanceof ArrayBuffer) {\n return buffer\n }\n // Slice to get an owned ArrayBuffer, avoiding SharedArrayBuffer TS issues with BlobPart.\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength,\n ) as ArrayBuffer\n}\n\nexport async function fileBufferToBlob(\n buffer: Uint8Array | ArrayBuffer,\n defaultMime: string = 'application/octet-stream',\n): Promise<Blob> {\n const fType = await fileTypeFromBuffer(buffer)\n const mime = fType ? fType.mime : defaultMime\n return new Blob([toArrayBuffer(buffer)], { type: mime })\n}\n\nexport async function fileBufferToObjectUrl(\n buffer: Uint8Array | ArrayBuffer,\n defaultMime: string = 'application/octet-stream',\n): Promise<string> {\n const file = await fileBufferToBlob(buffer, defaultMime)\n return URL.createObjectURL(file)\n}\n\nexport interface IFileData {\n ext?: string\n mime?: string\n blob: Blob\n}\n\nexport async function fileDataFromBuffer(\n buffer: Uint8Array | ArrayBuffer,\n defaultMime: string = 'application/octet-stream',\n): Promise<IFileData> {\n const fType = await fileTypeFromBuffer(buffer)\n const ext = fType?.ext\n const mime = fType ? fType.mime : defaultMime\n const blob = new Blob([toArrayBuffer(buffer)], { type: mime })\n return { ext, mime, blob }\n}\n\nexport function openBlob(blob: Blob, target?: string, filename?: string) {\n const url = URL.createObjectURL(blob)\n const win = window.open(url, target)\n // TODO: Consider if always setting opener to null is to restrictive\n // if (win && target && target.toLowerCase() === '_blank') {\n // win.opener = null\n // }\n}\n","/** Returns object without property */\nexport function withoutProperty<T, K extends keyof T>(\n obj: T,\n propName: K,\n): Pick<T, Exclude<keyof T, K>> {\n const { [propName]: _, ...without } = obj\n return without\n}\n\n/** Returns object without properties */\nexport function withoutProperties<T, K extends keyof T>(\n obj: T,\n propNames: K[],\n): Pick<T, Exclude<keyof T, K>> {\n let without: any = obj\n for (const propName of propNames) {\n without = withoutProperty(without, propName)\n }\n return without\n}\n\n/** Delete property of object */\nexport function deleteProperty<T extends object, K extends keyof T>(\n obj: T,\n propName: K,\n): void {\n if (Object.prototype.hasOwnProperty.call(obj, propName)) {\n delete obj[propName]\n }\n}\n\n/** Delete properties of object */\nexport function deleteProperties<T extends object, K extends keyof T>(\n obj: T,\n propNames: K[],\n): void {\n for (const propName of propNames) {\n deleteProperty(obj, propName)\n }\n}\n","import { fileTypeFromBuffer } from 'file-type'\nimport { FeatureCollection } from 'geojson'\nimport shp from 'shpjs'\n\nimport { readFileAsync } from '../file-utils'\nimport { withoutProperty } from '../obj-utils'\n\n/**\n * Reads a File, or buffer of file content, in GeoJSON or ESRI Shapefile format\n * and returns a GeoJSON `FeatureCollection`.\n */\nexport async function readGeoFile(\n fileOrBuffer: File | ArrayBuffer,\n): Promise<FeatureCollection> {\n const buffer = await coerceToArrayBuffer(fileOrBuffer)\n const fType = await fileTypeFromBuffer(buffer)\n\n if (fType?.ext === 'shp') {\n return parseShpFile(buffer)\n } else if (fType?.mime === 'application/zip') {\n return parseShpZip(buffer)\n }\n\n return parseGeoJson(buffer)\n}\n\nasync function coerceToArrayBuffer(\n fileOrBuffer: File | ArrayBuffer,\n): Promise<ArrayBuffer> {\n if (fileOrBuffer instanceof File) {\n const arrBuf = await readFileAsync(fileOrBuffer)\n if (arrBuf === null) {\n throw new Error('Could not read file.')\n }\n return arrBuf\n }\n\n return fileOrBuffer\n}\n\nasync function parseShpFile(buffer: ArrayBuffer): Promise<FeatureCollection> {\n const geometries = await shp.parseShp(buffer, undefined as any)\n const featCollection: FeatureCollection = {\n type: 'FeatureCollection',\n features: geometries.map((geom) => ({\n type: 'Feature',\n geometry: geom,\n properties: {},\n })),\n }\n return featCollection\n}\n\nasync function parseShpZip(buffer: ArrayBuffer): Promise<FeatureCollection> {\n let featCollection = await shp.parseZip(buffer, undefined as any)\n if (Array.isArray(featCollection)) {\n if (featCollection.length === 0) {\n throw Error(`Shape data not found.`)\n } else if (featCollection.length > 1) {\n throw Error(`Multiple shape files not supported.`)\n }\n featCollection = featCollection[0]\n }\n return withoutProperty(featCollection, 'fileName')\n}\n\nfunction parseGeoJson(buffer: ArrayBuffer): FeatureCollection {\n const json = JSON.parse(new TextDecoder().decode(buffer))\n\n if (json?.type === 'FeatureCollection' && Array.isArray(json?.features)) {\n return json as FeatureCollection\n }\n\n throw Error(`Unable to parse as GeoJSON.`)\n}\n","import { Feature, FeatureCollection, MultiPolygon, Polygon } from 'geojson'\n\n/**\n * Split all MultiPolygon into Polygon. Any properties, other than\n * 'coordinates', of the MultiPolygons will be lost.\n *\n * NOTE: MultiPolygons in a GeometryCollection will not be split.\n */\nexport function splitMultiPolygons(featureCollection: FeatureCollection): void {\n for (let i = 0; i < featureCollection.features.length; i++) {\n if (featureCollection.features[i]) {\n const geometry = featureCollection.features[i].geometry\n if (geometry.type === 'MultiPolygon') {\n const features = splitMultPolygon(geometry).map(\n (p) =>\n ({\n type: 'Feature',\n geometry: p,\n properties: {},\n }) as Feature,\n )\n featureCollection.features.splice(i, 1, ...features)\n i += Math.max(features.length - 1, 0)\n }\n }\n }\n}\n\nfunction splitMultPolygon(multiPolygon: MultiPolygon): Polygon[] {\n return multiPolygon.coordinates.map((c) => ({\n type: 'Polygon',\n coordinates: c,\n }))\n}\n","import {\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n Position,\n} from 'geojson'\n\n/**\n * Close all polygons in the GeoJSON so the first and last position of every\n * ring are identical.\n *\n * Google Maps requires closed polygon rings, but not all libraries produce\n * them. This is idempotent: rings that are already closed are left unchanged.\n */\nexport function closePolygons(\n geoJson: FeatureCollection | Feature | Polygon | MultiPolygon,\n): void {\n if (geoJson.type === 'FeatureCollection') {\n for (const f of geoJson.features) {\n closePolygonsFeature(f)\n }\n } else if (geoJson.type === 'Feature') {\n closePolygonsFeature(geoJson)\n } else if (geoJson.type === 'Polygon') {\n closePolygon(geoJson)\n } else if (geoJson.type === 'MultiPolygon') {\n closeMultiPolygon(geoJson)\n }\n}\n\nfunction closePolygonsFeature(feature: Feature): void {\n if (feature.geometry.type === 'Polygon') {\n closePolygon(feature.geometry)\n } else if (feature.geometry.type === 'MultiPolygon') {\n closeMultiPolygon(feature.geometry)\n }\n}\n\nfunction closePolygon(polygon: Polygon): void {\n for (const ring of polygon.coordinates) {\n closeRing(ring)\n }\n}\n\nfunction closeMultiPolygon(multiPolygon: MultiPolygon): void {\n for (const polygon of multiPolygon.coordinates) {\n for (const ring of polygon) {\n closeRing(ring)\n }\n }\n}\n\n/**\n * Appends the first position to the end of a ring only when it is not already\n * closed. Exact equality is correct here: the closing point is a copy of the\n * first point, so we compare a value against its own copy.\n */\nfunction closeRing(ring: Position[]): void {\n if (ring.length < 1) {\n return\n }\n const first = ring[0]\n const last = ring[ring.length - 1]\n if (first[0] === last[0] && first[1] === last[1]) {\n return\n }\n ring.push([...first])\n}\n","import { Polygon, Position } from 'geojson'\n\nimport { polygonViolatesMinMax } from './polygon-violates-min-max'\n\n/** Count distinct vertices in a ring, ignoring an explicit closing point. */\nfunction distinctVertexCount(ring: Position[]): number {\n if (ring.length === 0) {\n return 0\n }\n const first = ring[0]\n const last = ring[ring.length - 1]\n const isClosed =\n ring.length > 1 && first[0] === last[0] && first[1] === last[1]\n return isClosed ? ring.length - 1 : ring.length\n}\n\n/**\n * Whether a polygon's outer ring has at least `min` distinct vertices.\n * Ring closure (a repeated first/last point) does not count toward the total,\n * so this behaves the same for closed and unclosed rings.\n */\nexport function polygonHasMinDistinctVertices(\n polygon: Polygon,\n min: number = 3,\n): boolean {\n const outer = polygon.coordinates[0] ?? []\n return !polygonViolatesMinMax(distinctVertexCount(outer), min, undefined)\n}\n","import { Polygon } from 'geojson'\n\nimport booleanContains from '@turf/boolean-contains'\nimport { polygon as turfPolygon } from '@turf/helpers'\n\n/**\n * Whether `outer` fully contains `inner`, using turf's boolean-contains on the\n * GeoJSON geometries directly (no Google Maps dependency).\n */\nexport function polygonContains(outer: Polygon, inner: Polygon): boolean {\n return booleanContains(\n turfPolygon(outer.coordinates),\n turfPolygon(inner.coordinates),\n )\n}\n","import { Polygon, Position } from 'geojson'\n\n/**\n * Whether a ring is wound clockwise, via the shoelace signed-area sign.\n * Sum of (x2 - x1) * (y2 + y1) is positive for clockwise rings in standard\n * (x = lng, y = lat) orientation.\n */\nexport function ringIsClockwise(ring: Position[]): boolean {\n let sum = 0\n for (let i = 0; i < ring.length - 1; i++) {\n const [x1, y1] = ring[i]\n const [x2, y2] = ring[i + 1]\n sum += (x2 - x1) * (y2 + y1)\n }\n return sum > 0\n}\n\n/** Return `ring` wound opposite to `reference`, reversing a copy if needed. */\nfunction ringWoundOpposite(\n reference: Position[],\n ring: Position[],\n): Position[] {\n if (ringIsClockwise(reference) === ringIsClockwise(ring)) {\n return [...ring].reverse()\n }\n return [...ring]\n}\n\n/**\n * Append the outer ring of `hole` to `exterior` as an interior ring (a\n * cutout), wound opposite the exterior ring so it renders as a hole. Returns a\n * new Polygon; inputs are not mutated.\n */\nexport function addHoleToPolygon(exterior: Polygon, hole: Polygon): Polygon {\n const exteriorRing = exterior.coordinates[0]\n const holeRing = ringWoundOpposite(exteriorRing, hole.coordinates[0])\n return {\n type: 'Polygon',\n coordinates: [...exterior.coordinates, holeRing],\n }\n}\n","// Based on source: https://github.com/sindresorhus/array-move/blob/main/index.js\n\n/**\n Moves the item to the new position in the input array. Useful for huge arrays\n where absolute performance is needed.\n\n @param array - The array to modify.\n @param fromIndex - The index of item to move. If negative, it will begin that\n many elements from the end.\n @param toIndex - The index of where to move the item. If negative, it will\n begin that many elements from the end.\n @example\n ```\n import { arrayMoveMutable } from '@theseam/ui-common/utils';\n\n const input = ['a', 'b', 'c'];\n arrayMoveMutable(input, 1, 2);\n console.log(input);\n //=> ['a', 'c', 'b']\n ```\n*/\nexport function arrayMoveMutable(\n array: unknown[],\n fromIndex: number,\n toIndex: number,\n): void {\n const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex\n\n if (startIndex >= 0 && startIndex < array.length) {\n const endIndex = toIndex < 0 ? array.length + toIndex : toIndex\n\n const [item] = array.splice(fromIndex, 1)\n array.splice(endIndex, 0, item)\n }\n}\n\n/**\n Clones the given `array`, moves the item to a new position in the new array,\n and then returns the new array. The given `array` is not mutated.\n\n @param array - The array with the item to move.\n @param fromIndex - The index of item to move. If negative, it will begin that\n many elements from the end.\n @param toIndex - The index of where to move the item. If negative, it will\n begin that many elements from the end.\n @returns A new array with the item moved to the new position.\n @example\n ```\n import { arrayMoveImmutable } from '@theseam/ui-common/utils';\n\n const input = ['a', 'b', 'c'];\n const array1 = arrayMoveImmutable(input, 1, 2);\n console.log(array1);\n //=> ['a', 'c', 'b']\n\n const array2 = arrayMoveImmutable(input, -1, 0);\n console.log(array2);\n //=> ['c', 'a', 'b']\n\n const array3 = arrayMoveImmutable(input, -2, -3);\n console.log(array3);\n //=> ['b', 'a', 'c']\n ```\n*/\nexport function arrayMoveImmutable<ValueType>(\n array: readonly ValueType[],\n fromIndex: number,\n toIndex: number,\n): ValueType[] {\n const newArray = [...array]\n arrayMoveMutable(newArray, fromIndex, toIndex)\n return newArray\n}\n","export function calcPercentage(total: number, n: number) {\n return total && total > 0 ? (n / total) * 100 : 0\n}\n","/**\n * Polyfil for `Element.toggleAttribute`\n *\n * Toggles a value without a value. Useful for attributes, such as `disabled`,\n * `readonly`, and `hidden`, that only needs to exist on the `Element` without\n * requiring a value.\n *\n * Most browsers natively support this feature, but IE, which we still try to\n * support for at least the main parts of the app, has \"Unknown\" support of this\n * feature. Until IE support is dropped this polyfil should be used to toggle an\n * attribute.\n *\n * Source:\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute#Polyfill\n */\nexport function toggleAttribute(\n element: HTMLElement,\n name: string,\n force: boolean,\n): boolean {\n let _force = force\n if (_force !== void 0) {\n _force = !!_force\n }\n\n if (element.getAttribute(name) !== null) {\n if (_force) {\n return true\n }\n\n element.removeAttribute(name)\n return false\n } else {\n if (_force === false) {\n return false\n }\n\n element.setAttribute(name, '')\n return true\n }\n}\n","export const phoneNumberMask = [\n '(',\n /[1-9]/,\n /\\d/,\n /\\d/,\n ')',\n ' ',\n /\\d/,\n /\\d/,\n /\\d/,\n '-',\n /\\d/,\n /\\d/,\n /\\d/,\n /\\d/,\n]\n","export function isNullOrUndefined<T>(\n value: T | null | undefined,\n): value is null | undefined {\n return value === undefined || value === null\n}\n","export function isNullOrUndefinedOrEmpty(\n value: string | null | undefined,\n trim: boolean = true,\n): value is string | null | undefined {\n return (\n value === undefined ||\n value === null ||\n (trim ? value.trim() : value).length === 0\n )\n}\n","export function loadStyle(content: string): Promise<HTMLStyleElement> {\n return new Promise((resolve, reject) => {\n const s = document.createElement('style')\n s.onload = () => resolve(s)\n s.onerror = (e) => {\n document.head.removeChild(s)\n reject(e)\n }\n s.innerHTML = content\n document.head.appendChild(s)\n })\n}\n","export function loadStyleSheet(path: string): Promise<HTMLLinkElement> {\n return new Promise((resolve, reject) => {\n const s = document.createElement('link')\n s.onload = () => resolve(s)\n s.onerror = (e) => {\n document.head.removeChild(s)\n reject(e)\n }\n s.rel = 'stylesheet'\n s.href = path\n document.head.appendChild(s)\n })\n}\n","export function notNullOrUndefinedOrEmpty(\n value: string | null | undefined,\n trim: boolean = true,\n): value is string {\n return (\n value !== null &&\n value !== undefined &&\n (trim ? value.trim() : value).length > 0\n )\n}\n","export async function waitOnConditionAsync(\n condition: () => boolean,\n timeoutDuration: number = -1,\n throwOnTimeout: boolean = true,\n): Promise<any> {\n const timeStart: any = new Date()\n\n const _waitFunc = (callbackFn: (boolean: boolean) => any) => {\n let conditionSuccess = false\n\n if (condition()) {\n callbackFn(true)\n conditionSuccess = true\n }\n\n if (!conditionSuccess) {\n const timeNow: any = new Date()\n const duration = timeNow - timeStart\n if (timeoutDuration > -1 && duration > timeoutDuration) {\n if (throwOnTimeout) {\n throw new Error('Timed out waiting on condition.')\n } else {\n callbackFn(false)\n }\n }\n\n setTimeout(() => {\n _waitFunc(callbackFn)\n }, 30)\n }\n }\n\n return new Promise((resolve, reject) => {\n const fn = (b: boolean) => {\n resolve(b)\n }\n _waitFunc(fn)\n })\n}\n","import { isObservable, Observable, Subscriber, Subscription } from 'rxjs'\n\nclass IntervalTimer {\n private _intervalTime: number\n private _intervalId: number | null = null\n\n constructor(\n private _callback: () => void,\n intervalTime: number,\n startOnInit: boolean = true,\n ) {\n this._intervalTime = intervalTime\n if (startOnInit) {\n this.start()\n }\n }\n\n set intervalTime(time: number) {\n this._intervalTime = time\n }\n\n public start(): void {\n if (this._intervalId === null) {\n this._intervalId = window.setInterval(() => {\n this._callback()\n }, this._intervalTime)\n }\n }\n\n public stop(): void {\n if (this._intervalId !== null) {\n clearInterval(this._intervalId)\n this._intervalId = null\n }\n }\n\n public reset(newIntervalTime?: number): void {\n if (newIntervalTime) {\n this.intervalTime = newIntervalTime\n }\n this.stop()\n this.start()\n }\n}\n\nexport type PollingActionFn<R> = () => R | Observable<R>\n\nexport class PollingTickerOptions {\n emitOnInit?: boolean = true\n}\n\n// TODO: Simplify complexity.\n\n/**\n * Call an action and emits the result to its subscriber on an interval or when\n * ticker emits. When the ticker emits, the interval time will reset.\n *\n * When subscribed to, the action will be called and emitted right away unless\n * the `emitOnInit` option is set to false.\n */\nexport function pollingTicker<R>(\n action: PollingActionFn<R>,\n pollingInterval?: number,\n ticker?: Observable<number | void>,\n options?: PollingTickerOptions,\n): Observable<R> {\n return new Observable((subscriber: Subscriber<R>) => {\n const _opts = { ...new PollingTickerOptions(), ...(options || {}) }\n\n let timer: IntervalTimer | null = null\n let actionSub: Subscription | null = null\n let tickerSub: Subscription | null = null\n\n try {\n const handleAction = () => {\n if (timer) {\n timer.stop()\n }\n\n const actionResult = action()\n\n if (isObservable(actionResult)) {\n if (actionSub) {\n actionSub.unsubscribe()\n }\n actionSub = actionResult.subscribe(\n (v: R) => {\n subscriber.next(v)\n if (timer) {\n timer.reset()\n }\n },\n (err) => {\n subscriber.error(err)\n },\n () => {\n actionSub = null\n if (timer) {\n timer.start()\n }\n },\n )\n } else {\n subscriber.next(actionResult)\n }\n if (timer) {\n timer.start()\n }\n }\n\n if (_opts.emitOnInit) {\n handleAction()\n }\n\n if (pollingInterval) {\n timer = new IntervalTimer(() => {\n handleAction()\n }, pollingInterval)\n }\n\n if (ticker) {\n tickerSub = ticker.subscribe((newPollingInterval) => {\n if (newPollingInterval && timer) {\n timer.stop()\n if (newPollingInterval) {\n timer.intervalTime = newPollingInterval\n }\n }\n handleAction()\n if (timer) {\n timer.reset()\n }\n })\n }\n } catch (err) {\n subscriber.error(err)\n }\n\n return () => {\n if (timer) {\n timer.stop()\n }\n if (actionSub) {\n actionSub.unsubscribe()\n }\n if (tickerSub) {\n tickerSub.unsubscribe()\n }\n }\n })\n}\n","import { BehaviorSubject, EMPTY, merge, Observable, Subject } from 'rxjs'\nimport {\n auditTime,\n distinctUntilChanged,\n filter,\n map,\n share,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators'\n\nexport interface RefreshableOptions<T> {\n action: () => Observable<T>\n invalidate$?: Observable<unknown>\n poll$?: Observable<unknown>\n}\n\nconst NO_VALUE: unique symbol = Symbol('refreshable.no-value')\ntype Cached<T> = T | typeof NO_VALUE\n\nexport class Refreshable<T> {\n private readonly _refresh$ = new Subject<void>()\n private readonly _cache$ = new BehaviorSubject<Cached<T>>(NO_VALUE)\n private readonly _loading$ = new BehaviorSubject<boolean>(false)\n private _dataSubCount = 0\n\n public readonly loading$: Observable<boolean> = this._loading$.pipe(\n distinctUntilChanged(),\n )\n\n public readonly initialized$: Observable<boolean> = this._cache$.pipe(\n map((v) => v !== NO_VALUE),\n distinctUntilChanged(),\n )\n\n public readonly data$: Observable<T>\n\n constructor(opts: RefreshableOptions<T>) {\n const { action } = opts\n\n const invalidateSig$ = (opts.invalidate$ ?? EMPTY).pipe(\n tap(() => this._cache$.next(NO_VALUE)),\n )\n\n const driver$ = merge(\n this._refresh$,\n opts.poll$ ?? EMPTY,\n invalidateSig$,\n ).pipe(\n startWith(undefined as unknown),\n auditTime(0),\n tap(() => this._loading$.next(true)),\n switchMap(() => action()),\n tap({\n next: (v) => {\n this._cache$.next(v)\n this._loading$.next(false)\n },\n error: () => this._loading$.next(false),\n }),\n share({\n resetOnRefCountZero: true,\n resetOnComplete: true,\n resetOnError: true,\n }),\n )\n\n this.data$ = new Observable<T>((subscriber) => {\n this._dataSubCount++\n const driverSub = driver$.subscribe({\n error: (e) => subscriber.error(e),\n })\n const cacheSub = this._cache$\n .pipe(filter((v): v is T => v !== NO_VALUE))\n .subscribe(subscriber)\n return () => {\n cacheSub.unsubscribe()\n driverSub.unsubscribe()\n this._dataSubCount--\n if (this._dataSubCount === 0) {\n this._cache$.next(NO_VALUE)\n this._loading$.next(false)\n }\n }\n })\n }\n\n public refresh(): void {\n this._refresh$.next()\n }\n}\n","import { from, isObservable, Observable } from 'rxjs'\n\nexport function wrapIntoObservable<T>(\n value: T | Promise<T> | Observable<T>,\n): Observable<T> {\n if (isObservable(value)) {\n return value\n }\n\n return from(Promise.resolve(value))\n}\n","/**\n * Explaination:\n * ^ - beginning of the string\n * (?: - beginning of a non-captured group\n * [a-z]+ - any character of 'a' to 'z' 1 or more times\n * : - string (colon character)\n * )? - end of the non-captured group. Group appearing 0 or 1 times\n * // - string (two forward slash characters)\n * 'i' - non case-sensitive flag\n *\n * source: https://stackoverflow.com/a/19709846\n */\nconst IS_ABSOLUTE_URL_REGEX = new RegExp('^(?:[a-z]+:)?//', 'i')\n\nexport function isAbsoluteUrl(url: string): boolean {\n return IS_ABSOLUTE_URL_REGEX.test(url)\n}\n","import { Observable, Subscriber } from 'rxjs'\n\nexport type SubscriberCountChangedFn = (\n description: string,\n count: number,\n reason: 'subscribed' | 'unsubscribed',\n) => void\n\n/**\n * This is just for helping debug observables that aren't being unsubscribed\n * from correctly.\n *\n * If description is 'foo' then you can check the how many observers are\n * subscribed with the expression `__subscriberCounts['foo']`. In a debugger you\n * can add the expression to the \"Watch\" expressions or in Chrome Devtools\n * Console you can add it to the live expressions(Add live expressions by\n * clicking the eye the the left of the Console filter input).\n */\nexport function subscriberCount<T>(\n sourceObservable: Observable<T>,\n description: string,\n countChangedFn: SubscriberCountChangedFn | undefined | null = logOnChange,\n) {\n let counter = 0\n return new Observable((subscriber: Subscriber<T>) => {\n const subscription = sourceObservable.subscribe(subscriber)\n counter++\n if (countChangedFn !== undefined && countChangedFn !== null) {\n countChangedFn(description, counter, 'subscribed')\n }\n setGlobalSubscriberCount(description, counter)\n\n return () => {\n subscription.unsubscribe()\n counter--\n if (countChangedFn !== undefined && countChangedFn !== null) {\n countChangedFn(description, counter, 'unsubscribed')\n }\n setGlobalSubscriberCount(description, counter)\n }\n })\n}\n\nconst logOnChange: SubscriberCountChangedFn = (\n description: string,\n count: number,\n reason: 'subscribed' | 'unsubscribed',\n) => {\n // eslint-disable-next-line no-console\n console.log(`${description} subscriptions: ${count} [${reason}]`)\n}\n\nfunction getGlobalSubscriberCounts(): { [description: string]: number } {\n const w = window as any\n if (w.__subscriberCounts === undefined || w.__subscriberCounts === null) {\n w.__subscriberCounts = {}\n }\n return w.__subscriberCounts\n}\n\nfunction setGlobalSubscriberCount(description: string, count: number): void {\n getGlobalSubscriberCounts()[description] = count\n}\n","import { QueryList } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { map, startWith } from 'rxjs/operators'\n\nexport function observeQueryList<T>(\n queryList: QueryList<T>,\n emitCurrentValue = true,\n): Observable<T[]> {\n return queryList.changes.pipe(\n startWith(queryList),\n map((v) => v.toArray() as T[]),\n )\n}\n","export function createPadding(len: number, chars: string): string {\n // if (chars.length <= len) {\n // return chars\n // }\n\n if (chars.length === 0) {\n throw Error(`Padding characters must be at least 1 char length.`)\n }\n\n let str = chars\n while (str.length < len) {\n str += chars\n }\n\n if (str.length > len) {\n str = str.slice(0, len)\n }\n\n return str\n}\n","import { createPadding } from './create-padding'\n\nexport function padEnd(\n stringToPad: string,\n paddingLength: number | undefined = 0,\n paddingChars: string | undefined = ' ',\n): string {\n const strLength = paddingLength ? stringToPad.length : 0\n\n if (!paddingLength || strLength >= paddingLength) {\n return stringToPad\n }\n\n return stringToPad + createPadding(paddingLength - strLength, paddingChars)\n}\n","import { createPadding } from './create-padding'\n\nexport function padStart(\n stringToPad: string,\n paddingLength: number | undefined = 0,\n paddingChars: string | undefined = ' ',\n): string {\n const strLength = paddingLength ? stringToPad.length : 0\n\n if (!paddingLength || strLength >= paddingLength) {\n return stringToPad\n }\n\n return createPadding(paddingLength - strLength, paddingChars) + stringToPad\n}\n","export function isNumeric(value: any): boolean {\n return !isNaN(Number(value) - parseFloat(value))\n}\n","import { isNumeric } from './is-numeric'\n\n/**\n * Returns the number of fractional digits.\n *\n * NOTE: This is intended for input validation, so trailing 0's will be included\n * in the total. Also, localization is not considered, so '.' is assumed to be\n * the fractional separator.\n */\nexport function fractionalDigitsCount(value: string): number | null {\n if (!isNumeric(value)) {\n return null\n }\n\n const a = value.split('.')\n if (a.length !== 2) {\n return null\n }\n\n return a[1].length\n}\n","// NOTE: Based on https://www.npmjs.com/package/strip-outer\n\nconst escapeRegExp = (s: string) =>\n s.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d')\n\n/**\n * Strip a substring from the start/end of a string.\n */\nexport function stripOuter(input: string, substring: string): string {\n const escaped = escapeRegExp(substring)\n return input.replace(new RegExp(`^${escaped}|${escaped}$`, 'g'), '')\n}\n","// NOTE: Based on https://www.npmjs.com/package/trim-repeated\n\nconst escapeRegExp = (s: string) =>\n s.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d')\n\n/**\n * Trim a consecutively repeated substring: foo--bar---baz → foo-bar-baz.\n */\nexport function trimRepeated(str: string, target: string): string {\n return str.replace(new RegExp(`(?:${escapeRegExp(target)}){2,}`, 'g'), target)\n}\n","import { stripOuter } from './strip-outer'\nimport { trimRepeated } from './trim-repeated'\n\n// NOTE: Mostly based on https://www.npmjs.com/package/filenamify\n\nconst MAX_FILENAME_LENGTH = 100\n\n// eslint-disable-next-line no-control-regex\nconst reReserved = /[<>:\"/\\\\|?*\\x00-\\x1F]/g\nconst reWindowsNames = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i\nconst reControlChars = /[\\u0000-\\u001f\\u0080-\\u009f]/g // eslint-disable-line no-control-regex\nconst reRelativePath = /^\\.+/\n\nexport interface SanitizeFilenameOptions {\n /**\n * Replacement string.\n *\n * @default '_'\n */\n replacement?: string\n /**\n * Max file length.\n *\n * @default 100\n */\n maxLength?: number\n}\n\nconst defaultOptions: SanitizeFilenameOptions = {\n replacement: '_',\n maxLength: MAX_FILENAME_LENGTH,\n}\n\nexport function sanitizeFilename(\n filename: string,\n options?: SanitizeFilenameOptions,\n): string {\n const opts = {\n ...defaultOptions,\n ...(options || {}),\n }\n\n const replacement = opts.replacement === undefined ? '!' : opts.replacement\n\n if (reReserved.test(replacement) && reControlChars.test(replacement)) {\n throw new Error(\n 'Replacement string cannot contain reserved filename characters',\n )\n }\n\n let s = filename\n\n s = s.replace(reReserved, replacement)\n s = s.replace(reControlChars, replacement)\n s = s.replace(reRelativePath, replacement)\n\n if (replacement.length > 0) {\n s = trimRepeated(s, replacement)\n s = s.length > 1 ? stripOuter(s, replacement) : s\n }\n\n s = reWindowsNames.test(s) ? s + replacement : s\n s = s.slice(0, opts.maxLength)\n\n return s\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["turfPolygon","escapeRegExp"],"mappings":";;;;;;;;;AAAA;;AAEG;AACG,SAAU,YAAY,CAC1B,OAAU,EACV,IAAY,EAAA;AAEZ,IAAA,OAAO,OAAO,C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IAC1C,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,WAAW,CAAC;AAE1C,IAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AAC1B,QAAA,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,WAAW,CAAC;AAChC,QAAA,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC;IACnD;AAEA,IAAA,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,GAAG,CAAC;IAChD,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;AAE9B,IAAA,OAAO,CAAC;AACV;;ACjEA;;AAEG;;;;"}
1
+ {"version":3,"file":"theseam-ui-common-utils.mjs","sources":["../../../projects/ui-common/utils/get-attribute.ts","../../../projects/ui-common/utils/has-attribute.ts","../../../projects/ui-common/utils/cdk/get-closest-widget-cdk-drag.ts","../../../projects/ui-common/utils/form/get-control-name.ts","../../../projects/ui-common/utils/form/get-control-path.ts","../../../projects/ui-common/utils/form/observe-control-value.ts","../../../projects/ui-common/utils/form/observe-control-is-different.ts","../../../projects/ui-common/utils/form/wait-on-non-pending-status.ts","../../../projects/ui-common/utils/form/observe-control-status.ts","../../../projects/ui-common/utils/form/observe-control-valid.ts","../../../projects/ui-common/utils/form/observe-control-value-change.ts","../../../projects/ui-common/utils/has-property.ts","../../../projects/ui-common/utils/form/has-required-control.ts","../../../projects/ui-common/utils/form/is-empty-input-value.ts","../../../projects/ui-common/utils/operators/map-each.ts","../../../projects/ui-common/utils/operators/tap-first.ts","../../../projects/ui-common/utils/router/leaf-child-route.ts","../../../projects/ui-common/utils/router/will-have-data-prop.ts","../../../projects/ui-common/utils/router/operators/activated-routes-with-data-property.ts","../../../projects/ui-common/utils/router/route-snapshot-path-relative.ts","../../../projects/ui-common/utils/router/route-snapshot-path-full.ts","../../../projects/ui-common/utils/router/is-empty-url-route.ts","../../../projects/ui-common/utils/geo-json/coerce-feature-collection.ts","../../../projects/ui-common/utils/geo-json/geo-json-to-area.ts","../../../projects/ui-common/utils/geo-json/is-feature-collection.validator.ts","../../../projects/ui-common/utils/geo-json/is-only-geometry-types.ts","../../../projects/ui-common/utils/geo-json/is-only-geometry-types.validator.ts","../../../projects/ui-common/utils/geo-json/merge-polygons.ts","../../../projects/ui-common/utils/not-null-or-undefined.ts","../../../projects/ui-common/utils/geo-json/polygon-violates-min-max.ts","../../../projects/ui-common/utils/geo-json/min-max-points.validator.ts","../../../projects/ui-common/utils/geo-json/no-empty-feature-collection.validator.ts","../../../projects/ui-common/utils/geo-json/no-inner-rings.validator.ts","../../../projects/ui-common/utils/geo-json/no-kinks.validator.ts","../../../projects/ui-common/utils/file-utils.ts","../../../projects/ui-common/utils/obj-utils.ts","../../../projects/ui-common/utils/geo-json/read-geo-file.ts","../../../projects/ui-common/utils/geo-json/split-multi-polygons.ts","../../../projects/ui-common/utils/geo-json/close-polygons.ts","../../../projects/ui-common/utils/geo-json/polygon-has-min-distinct-vertices.ts","../../../projects/ui-common/utils/geo-json/polygon-contains.ts","../../../projects/ui-common/utils/geo-json/add-hole-to-polygon.ts","../../../projects/ui-common/utils/array-move.ts","../../../projects/ui-common/utils/calc-percentage.ts","../../../projects/ui-common/utils/toggle-attribute.ts","../../../projects/ui-common/utils/input-masks.ts","../../../projects/ui-common/utils/is-null-or-undefined.ts","../../../projects/ui-common/utils/is-null-or-undefined-or-empty.ts","../../../projects/ui-common/utils/load-style.ts","../../../projects/ui-common/utils/load-style-sheet.ts","../../../projects/ui-common/utils/not-null-or-undefined-or-empty.ts","../../../projects/ui-common/utils/wait-on-condition-async.ts","../../../projects/ui-common/utils/polling-ticker.ts","../../../projects/ui-common/utils/refreshable.ts","../../../projects/ui-common/utils/wrap-into-observable.ts","../../../projects/ui-common/utils/is-absolute-url.ts","../../../projects/ui-common/utils/subscriber-count.ts","../../../projects/ui-common/utils/observe-query-list.ts","../../../projects/ui-common/utils/create-padding.ts","../../../projects/ui-common/utils/pad-end.ts","../../../projects/ui-common/utils/pad-start.ts","../../../projects/ui-common/utils/is-numeric.ts","../../../projects/ui-common/utils/fractional-digits-count.ts","../../../projects/ui-common/utils/strip-outer.ts","../../../projects/ui-common/utils/trim-repeated.ts","../../../projects/ui-common/utils/sanitize-filename.ts","../../../projects/ui-common/utils/theseam-ui-common-utils.ts"],"sourcesContent":["/**\n *\n */\nexport function getAttribute<E extends HTMLElement>(\n element: E,\n name: string,\n): string | null {\n return element.getAttribute(name)\n}\n","/**\n *\n */\nexport function hasAttribute<E extends HTMLElement>(\n element: E,\n name: string,\n): boolean {\n return element.hasAttribute(name)\n}\n","import { CdkDrag } from '@angular/cdk/drag-drop'\nimport { ElementRef } from '@angular/core'\n\nimport { getAttribute } from '../get-attribute'\nimport { hasAttribute } from '../has-attribute'\n\n/**\n * Finds the closest CdkDrag to an element by looking at the DOM.\n * @param element Element relative to which to look for a cdkDrag.\n * @param openDialogs References to the currently available cdkDrag.\n */\nexport function getClosestWidgetCdkDrag(\n element: ElementRef<HTMLElement>,\n dragDirectives: CdkDrag<any>[],\n) {\n let parent: HTMLElement | null = element.nativeElement.parentElement\n\n while (\n parent &&\n !(\n parent.classList.contains('cdk-drag') &&\n hasAttribute(parent, 'data-widget-id')\n )\n ) {\n parent = parent.parentElement\n }\n\n const parentId = parent ? getAttribute(parent, 'data-widget-id') : null\n return parentId\n ? dragDirectives.find(\n (drag) =>\n getAttribute(drag.getRootElement(), 'data-widget-id') === parentId,\n )\n : null\n}\n","import { AbstractControl } from '@angular/forms'\n\n/**\n * Get the name of the control.\n *\n * Example:\n *\n * ```js\n * const group = new FormGroup({\n * name: new Control(),\n * age: new Control()\n * })\n *\n * for (const c of group.controls) {\n * console.log(getControlName(c))\n * }\n *\n * // Output:\n * // >> 'name'\n * // >> 'age'\n * ```\n */\nexport function getControlName(c: AbstractControl): string | null {\n if (!c.parent) {\n return null\n }\n // NOTE: Typed as 'any' because using string for array index is not valid for\n // array index type, but it works and we actually want the index as a string\n // anyway.\n const controls: any = c.parent.controls\n return Object.keys(controls).find((name) => c === controls[name]) || null\n}\n","import { AbstractControl } from '@angular/forms'\n\nimport { getControlName } from './get-control-name'\n\n/**\n * Get the path to a control.\n *\n * The path is built by walking back the `parent` properties until `parent` is\n * `null`.\n *\n * Example:\n *\n * ```js\n * const group = new FormGroup({\n * name: new FormControl(),\n * address: new FormGroup({\n * city: new FormControl(),\n * state: new FormControl()\n * })\n * })\n *\n * const control = group.get('address.city')\n * console.log(getControlPath(control))\n *\n * // Output:\n * >> 'address.city'\n * ```\n *\n */\nexport function getControlPath(\n c: AbstractControl,\n path: string = '',\n): string | null {\n let _path = path\n _path = getControlName(c) + _path\n\n if (c.parent && getControlName(c.parent)) {\n _path = `.${_path}`\n return getControlPath(c.parent, _path)\n } else {\n return _path\n }\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable, of } from 'rxjs'\nimport { startWith, switchMap } from 'rxjs/operators'\n\n/**\n * Observe the value of a control.\n */\nexport function observeControlValue<T = any>(\n control: AbstractControl,\n): Observable<T> {\n return of(control).pipe(\n switchMap((_control) =>\n _control.valueChanges.pipe(startWith(_control.value)),\n ),\n )\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { distinctUntilChanged, map } from 'rxjs/operators'\n\nimport { observeControlValue } from './observe-control-value'\n\n/**\n * Observe the changed state of the input value from the time this function is\n * called.\n *\n * When this function is called the value is stored. Each time the control's\n * value changes the value is compared with the initial value. Currenly the\n * values are compared as stringified objects using `JSON.stringify`.\n *\n * TODO: Allow the value compare implementation to be optionally changed.\n */\nexport function observeControlIsDifferent(\n control: AbstractControl,\n): Observable<boolean> {\n const _initial = JSON.stringify(control.value)\n return observeControlValue(control).pipe(\n map((value) => JSON.stringify(value) !== _initial),\n distinctUntilChanged(),\n )\n}\n","import { AbstractControl } from '@angular/forms'\nimport { interval, merge, Observable } from 'rxjs'\nimport { filter, map, mapTo, startWith, take } from 'rxjs/operators'\n\n/**\n * Wait on the status of a form control to not be `'PENDING'`.\n *\n * NOTE: This function is mainly just a work around for an issue where\n * `statusChanges` sometimes emits `'Pending'` without emitting another state\n * when complete. Seems to happen with async validators if the value changes\n * before completing, even if the validator completes(subscription `complete`\n * if observable).\n */\nexport function waitOnNonPendingStatus(\n control: AbstractControl,\n): Observable<string> {\n return merge(\n control.statusChanges,\n interval(30).pipe(\n mapTo(control),\n map((c) => c.status),\n ),\n )\n .pipe(startWith(control.status))\n .pipe(filter((v) => v !== 'PENDING'))\n .pipe(take(1))\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable, of } from 'rxjs'\nimport { startWith, switchMap } from 'rxjs/operators'\n\nimport { waitOnNonPendingStatus } from './wait-on-non-pending-status'\n\n/**\n * Observe the status of a control using a work around for status not changing\n * after pending.\n */\nexport function observeControlStatus(\n control: AbstractControl,\n): Observable<string> {\n return of(control).pipe(\n switchMap((_control) =>\n _control.statusChanges\n .pipe(startWith(_control.status))\n .pipe(\n switchMap((status) =>\n status === 'PENDING'\n ? waitOnNonPendingStatus(control).pipe(startWith(status))\n : of(status),\n ),\n ),\n ),\n )\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { distinctUntilChanged, map, pairwise, startWith } from 'rxjs/operators'\n\nimport { observeControlStatus } from './observe-control-status'\n\n/**\n * Observe the valid state of a control.\n *\n * By default `waitOnPending` is false and the control states map to:\n * 'VALID' => true\n * 'INVALID' => false\n * 'PENDING' => false\n *\n * If `waitOnPending` is true the valid result when 'PENDING' remains the same\n * as it was before 'PENDING' until it is no longer 'PENDING'.\n */\nexport function observeControlValid(\n control: AbstractControl,\n waitOnPending: boolean = false,\n): Observable<boolean> {\n if (waitOnPending) {\n return observeControlStatus(control)\n .pipe(distinctUntilChanged())\n .pipe(startWith(undefined))\n .pipe(pairwise())\n .pipe(map((v) => ({ previous: v[0], current: v[1] })))\n .pipe(map((v) => (v.current === 'PENDING' ? v.previous : v.current)))\n .pipe(map((status) => status === 'VALID'))\n } else {\n return observeControlStatus(control)\n .pipe(distinctUntilChanged())\n .pipe(map((status) => status === 'VALID'))\n }\n}\n","import { AbstractControl } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { map, pairwise, startWith } from 'rxjs/operators'\n\nimport { observeControlValue } from './observe-control-value'\n\n/**\n * Observe the value of a control with the previous.\n */\nexport function observeControlValueChange(\n control: AbstractControl,\n): Observable<{ previous: any; current: any }> {\n return observeControlValue(control).pipe(\n startWith(undefined),\n pairwise(),\n map((v) => ({ previous: v[0], current: v[1] })),\n )\n}\n","// Source: https://stackoverflow.com/a/59361497/7926298\nexport function hasProperty<T extends object, K extends keyof T>(\n style: T,\n prop: K,\n // ): style is T & { [P in K]-?: Exclude<T[K], undefined> } {\n): style is T & Required<Record<K, Exclude<T[K], undefined>>> {\n return (\n Object.prototype.hasOwnProperty.call(style, prop) &&\n style[prop] !== undefined\n )\n}\n","import { AbstractControl } from '@angular/forms'\n\nimport { hasProperty } from '../has-property'\n\n/**\n * Check if control has a required control.\n *\n * ----------------------------------------------------------------------------\n * NOTE: I am not sure about if this should be used or not.\n *\n * From my understanding this assumes that all the validators do not have some\n * unexpected side-effect from being called like this. It could be argued that\n * the validator is flawed and should be fixed if that is the case, but I am not\n * convinced that is correct yet.\n *\n * An example that I think is valid for this argument: A FormControl configured\n * to only check validators when a specific condition happens, because of a\n * reason that it has to do a long process. In that situation should this\n * function be smart enough to consider that or is it up to the validator to\n * consider this function possibly being used.\n *\n * This seems to assume the required validator will always be a synchronous\n * validator. That is a valid assumption if thinking about showing a required\n * state in the UI, but a FormControl does not neccessarily have to be used in\n * UI. So, I think it could be valid to have an async validator that uses the\n * name `required` for it error, but I do not have a good example, so I could be\n * wrong.\n * ----------------------------------------------------------------------------\n *\n * Source: https://gist.github.com/jsdevtom/5589af349a395b37e699b67417ef025b\n * @experimental\n * @ignore\n */\nexport function hasRequiredControl(abstractControl: AbstractControl): boolean {\n if (abstractControl.validator) {\n const validator = abstractControl.validator({} as AbstractControl)\n if (validator && validator.required) {\n return true\n }\n }\n\n const _abstractControl: any = abstractControl\n if (hasProperty(_abstractControl, 'controls')) {\n for (const controlName in _abstractControl.controls) {\n if (_abstractControl.controls[controlName]) {\n if (hasRequiredControl(_abstractControl.controls[controlName])) {\n return true\n }\n }\n }\n }\n\n return false\n}\n","// Source: https://github.com/angular/angular/blob/master/packages/forms/src/validators.ts#L16\nexport function isEmptyInputValue(value: any): boolean {\n // we don't check for string here so it also works with arrays\n return value == null || value.length === 0\n}\n","import { from, Observable } from 'rxjs'\nimport { map, switchMap, toArray } from 'rxjs/operators'\n\nexport function mapEach<T, R>(predicate: (value: T) => R) {\n return (source$: Observable<T[]>): Observable<R[]> =>\n source$.pipe(\n switchMap((v) =>\n from(v).pipe(\n map((m) => predicate(m)),\n toArray(),\n ),\n ),\n )\n}\n","import { Observable } from 'rxjs'\nimport { tap } from 'rxjs/operators'\n\n/**\n * Like tap, but only calls predicate on first emission.\n */\nexport function tapFirst<T>(predicate: (value: T) => void) {\n let _initialized = false\n return (source$: Observable<T>): Observable<T> =>\n source$.pipe(\n tap((v) => {\n if (!_initialized) {\n predicate(v)\n _initialized = true\n }\n }),\n )\n}\n","import { ActivatedRoute } from '@angular/router'\n\nexport function leafChildRoute(activatedRoute: ActivatedRoute): ActivatedRoute {\n let route = activatedRoute\n while (route.firstChild) {\n route = route.firstChild\n }\n return route\n}\n","import { ActivatedRoute } from '@angular/router'\n\nfunction hasRouteConfigDataProp(route: ActivatedRoute, prop: string): boolean {\n return !!(\n route &&\n route.routeConfig &&\n route.routeConfig.data &&\n Object.prototype.hasOwnProperty.call(route.routeConfig.data, prop)\n )\n}\n\nfunction hasRouteConfigResolveProp(\n route: ActivatedRoute,\n prop: string,\n): boolean {\n return !!(\n route &&\n route.routeConfig &&\n route.routeConfig.resolve &&\n Object.prototype.hasOwnProperty.call(route.routeConfig.resolve, prop)\n )\n}\n\nexport function willHaveDataProp(route: ActivatedRoute, prop: string): boolean {\n return (\n hasRouteConfigDataProp(route, prop) ||\n hasRouteConfigResolveProp(route, prop)\n )\n}\n","import { ActivatedRoute, Data } from '@angular/router'\nimport { combineLatest, Observable } from 'rxjs'\nimport { map, switchMap } from 'rxjs/operators'\n\nimport { leafChildRoute } from '../leaf-child-route'\nimport { willHaveDataProp } from '../will-have-data-prop'\n\nexport interface IActivatedRouteWithData {\n route: ActivatedRoute\n data: Data\n}\n\nexport function activatedRoutesWithDataProperty(\n prop: string,\n mustHaveDefined: boolean = false,\n) {\n const _data = (r: ActivatedRoute) =>\n r.data.pipe(map((_d) => ({ route: r, data: _d })))\n return (\n source$: Observable<ActivatedRoute>,\n ): Observable<IActivatedRouteWithData[]> =>\n source$.pipe(\n map((route) => leafChildRoute(route)),\n map((route) => route.pathFromRoot),\n switchMap((routes) => combineLatest(routes.map((r) => _data(r)))),\n map((v) =>\n v.filter((_v) => Object.prototype.hasOwnProperty.call(_v.data, prop)),\n ),\n map((v) =>\n mustHaveDefined\n ? v.filter((_v) => willHaveDataProp(_v.route, prop))\n : v,\n ),\n )\n}\n","import { ActivatedRouteSnapshot } from '@angular/router'\n\nexport function routeSnapshotPathRelative(route: ActivatedRouteSnapshot) {\n return route.url.reduce(\n (path, urlSegment) => `${path}/${urlSegment.path}`,\n '',\n )\n}\n","import { ActivatedRouteSnapshot } from '@angular/router'\n\nimport { routeSnapshotPathRelative } from './route-snapshot-path-relative'\n\nexport function routeSnapshotPathFull(route: ActivatedRouteSnapshot) {\n return route.pathFromRoot.reduce(\n (path, _route) => path + routeSnapshotPathRelative(_route),\n '',\n )\n}\n","import { ActivatedRoute } from '@angular/router'\n\nexport function isEmptyUrlRoute(activatedRoute: ActivatedRoute): boolean {\n return activatedRoute.snapshot.url.length === 0\n}\n","import { FeatureCollection } from 'geojson'\n\n// TODO: Make this more thorough and maybe error on unrecognized.\nexport function coerceFeatureCollection(value: any): FeatureCollection | null {\n return parseValue(value)\n}\n\n/**\n * Parses the value to a FeatureCollection object or null if it is not a\n * FeatureCollection.\n */\nfunction parseValue(value: any): FeatureCollection | null {\n const _value = parseStringValue(value)\n if (isFeatureCollectionValue(_value)) {\n return _value\n }\n return null\n}\n\n/**\n * Tries to parse the value to an object, in case the value is a stringified\n * json.\n */\nfunction parseStringValue(value: any): any {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value)\n } catch {\n return null\n }\n }\n\n return value\n}\n\n/**\n * Checks if the value is a FeatureCollection.\n *\n * NOTE: This is not a thorough FeatureCollection check. It only checks that the\n * value is an object resembling a GeoJSON.FeatureCollection, enough for the\n * validator.\n */\nfunction isFeatureCollectionValue(value: any): value is FeatureCollection {\n if (value === undefined || value === null) {\n return false\n }\n return value.type === 'FeatureCollection' && Array.isArray(value.features)\n}\n","import area from '@turf/area'\nimport { AreaUnits, convertArea } from '@turf/helpers'\nimport {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n GeoJsonProperties,\n} from 'geojson'\n\n/**\n *\n */\nexport function geoJsonToArea(\n geoJson:\n | GeoJSON\n | Feature<any, GeoJsonProperties>\n | FeatureCollection<any, GeoJsonProperties>\n | Geometry,\n units: AreaUnits = 'acres',\n): number {\n const areaMSqr = area(geoJson as any)\n const acres = convertArea(areaMSqr, 'meters', units)\n return acres\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nexport const IS_FEATURE_COLLECTION_VALIDATOR_NAME = 'is-feature-collection'\n\nexport function isFeatureCollectionValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return {\n [IS_FEATURE_COLLECTION_VALIDATOR_NAME]: {\n reason: `Must be a FeatureCollection.`,\n },\n }\n }\n\n return null\n }\n}\n","import { FeatureCollection, Geometry } from 'geojson'\n\n/**\n * Returns true if the GeoJSON is only specifies geometries.\n */\nexport function isOnlyGeometryTypes(\n featureCollection: FeatureCollection,\n types: Geometry['type'][],\n): boolean {\n if (types.length === 0) {\n if (featureCollection.features.length > 0) {\n // If no types are specified then there can't be any specified types found.\n return false\n } else {\n // If no types are specified and there are no features then there is\n // nothing to say a specified type isn't found.\n return true\n }\n }\n\n for (const f of featureCollection.features) {\n if (types.indexOf(f.geometry.type) === -1) {\n return false\n }\n }\n\n return true\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { Geometry } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\nimport { isOnlyGeometryTypes } from './is-only-geometry-types'\n\nexport const IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME = 'is-only-geometry-types'\n\nexport function isOnlyGeometryTypesValidator(\n types: Geometry['type'][],\n): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n // If there isn't a FeatureCollection then there is nothing to validate.\n // Use 'isFeatureCollection' to validate the value is a FeatureCollection.\n return null\n }\n\n if (!isOnlyGeometryTypes(value, types)) {\n const typesNotAllowed = value.features\n .map((f) => f.geometry.type)\n .filter((t) => types.indexOf(t) === -1)\n const distinctTypesNotAllowed = Array.from(new Set(typesNotAllowed))\n return {\n [IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME]: {\n reason: `Only geometry type${types.length === 1 ? '' : 's'} ${types.join(', ')} allowed.`,\n notAllowedGeometryTypesFound: distinctTypesNotAllowed,\n },\n }\n }\n\n return null\n }\n}\n","import { Feature, FeatureCollection, MultiPolygon } from 'geojson'\n\n/**\n * Merge Polygon and MultiPolygon geometries into a single MultiPolygon. Any\n * properties, other than 'coordinates', of the Polygons and MultiPolygons will\n * be lost.\n *\n * NOTE: Polygons and MultPolygons in a GeometryCollection will not be merged.\n */\nexport function mergePolygons(featureCollection: FeatureCollection): void {\n const multiPolygon: MultiPolygon = {\n type: 'MultiPolygon',\n coordinates: [],\n }\n\n for (let i = 0; i < featureCollection.features.length; i++) {\n const f = featureCollection.features[i]\n if (f.geometry.type === 'Polygon') {\n multiPolygon.coordinates.push(f.geometry.coordinates)\n featureCollection.features.splice(i, 1)\n i--\n } else if (f.geometry.type === 'MultiPolygon') {\n multiPolygon.coordinates.push(...f.geometry.coordinates)\n featureCollection.features.splice(i, 1)\n i--\n }\n }\n\n if (multiPolygon.coordinates.length > 0) {\n const feature: Feature = {\n type: 'Feature',\n geometry: multiPolygon,\n properties: {},\n }\n featureCollection.features.push(feature)\n }\n}\n","export function notNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined\n}\n","import { notNullOrUndefined } from '../not-null-or-undefined'\n\n/**\n * Checks if a single polygon ring's coordinate count violates the given\n * min/max point bounds. `max` is only applied when it is greater than `min`.\n */\nexport function polygonViolatesMinMax(\n coordinateLength: number,\n min: number,\n max?: number | undefined,\n): boolean {\n if (\n coordinateLength < min ||\n (notNullOrUndefined(max) && max > min && coordinateLength > max)\n ) {\n return true\n }\n\n return false\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { FeatureCollection } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { notNullOrUndefined } from '../not-null-or-undefined'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\nimport { polygonViolatesMinMax } from './polygon-violates-min-max'\n\nexport const MIN_MAX_POINTS_VALIDATOR_NAME = 'min-max-points'\n\nexport function minMaxPointsValidator(\n min: number | undefined = 3,\n max?: number | undefined,\n): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return null\n }\n\n if (collectionViolatesMinMax(value, min, max)) {\n const reason = notNullOrUndefined(max)\n ? `A polygon must have between ${min} and ${max} points.`\n : `A polygon must have at least ${min} points.`\n return {\n [MIN_MAX_POINTS_VALIDATOR_NAME]: {\n reason,\n },\n }\n }\n return null\n }\n}\n\n/**\n * Checks if a FeatureCollection contains any geometries with an incomplete polygon.\n *\n * NOTE: Does not consider GeometryCollection.\n */\nfunction collectionViolatesMinMax(\n featureCollection: FeatureCollection,\n min: number,\n max: number | undefined,\n): boolean {\n for (const f of featureCollection.features) {\n if (f.geometry.type === 'Polygon') {\n if (polygonViolatesMinMax(f.geometry.coordinates[0].length, min, max)) {\n return true\n }\n } else if (f.geometry.type === 'MultiPolygon') {\n for (const coords of f.geometry.coordinates) {\n if (polygonViolatesMinMax(coords[0].length, min, max)) {\n return true\n }\n }\n }\n }\n\n return false\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nexport const NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME =\n 'no-empty-feature-collection'\n\nexport function noEmptyFeatureCollectionValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return null\n }\n\n if (value.features.length === 0) {\n return {\n [NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME]: {\n reason: `FeatureCollection must have a value.`,\n },\n }\n }\n\n return null\n }\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { FeatureCollection } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nexport const NO_INNER_RINGS_VALIDATOR_NAME = 'no-inner-rings'\n\n/**\n * Validates that a FeatureCollection does not contain any Polygon with inner\n * rings(\"holes\").\n *\n * NOTE: Only considers Polygon and MultiPolygon. Does not consider\n * GeometryCollection.\n */\nexport function noInnerRingsValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n // If there isn't a FeatureCollection then there is nothing to validate.\n // Use 'isFeatureCollection' to validate the value is a FeatureCollection.\n return null\n }\n\n if (hasInnerRing(value)) {\n return {\n [NO_INNER_RINGS_VALIDATOR_NAME]: {\n reason: `A shape cannot have an inner ring.`,\n },\n }\n }\n\n return null\n }\n}\n\n/**\n * Checks if a FeatureCollection contains any geometries with an inner\n * ring(\"hole\").\n *\n * NOTE: Does not consider GeometryCollection.\n */\nfunction hasInnerRing(featureCollection: FeatureCollection): boolean {\n for (const f of featureCollection.features) {\n // The spec says the right-hand rule must be followed, but also specifies\n // that tools should not reject polygons that do not follow the right-hand\n // rule. It does specify that the first ring must be the exterior ring and\n // the others must be the interior. So, this should be safe to just check\n // if there are multiple rings, instead of checking their winding orders.\n //\n // Polygon spec: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6\n if (f.geometry.type === 'Polygon') {\n if (f.geometry.coordinates.length > 1) {\n return true\n }\n } else if (f.geometry.type === 'MultiPolygon') {\n for (const coords of f.geometry.coordinates) {\n if (coords.length > 1) {\n return true\n }\n }\n }\n }\n\n return false\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport kinks from '@turf/kinks'\nimport { Feature, FeatureCollection } from 'geojson'\n\nimport { isEmptyInputValue } from '../form/is-empty-input-value'\nimport { coerceFeatureCollection } from './coerce-feature-collection'\n\nconst kinkableGeometryTypes = [\n 'LineString',\n 'MultiLineString',\n 'MultiPolygon',\n 'Polygon',\n]\n\nexport const NO_KINKS_VALIDATOR_NAME = 'no-kinks'\n\nexport function noKinksValidator(): ValidatorFn {\n return (control: AbstractControl) => {\n // Don't need to validate if there isn't a value. Use `Validators.required` for that.\n if (isEmptyInputValue(control.value)) {\n return null // don't validate empty values to allow optional controls\n }\n\n const value = coerceFeatureCollection(control.value)\n\n if (value === null) {\n return null\n }\n\n const kinksFound: { feature: Feature; kinks: FeatureCollection }[] = []\n for (const f of value.features) {\n if (kinkableGeometryTypes.indexOf(f.geometry.type) !== -1) {\n const _kinks = kinks(f as any)\n if (_kinks.features.length > 0) {\n kinksFound.push({\n feature: f,\n kinks: _kinks,\n })\n }\n }\n }\n\n if (kinksFound.length > 0) {\n return {\n [NO_KINKS_VALIDATOR_NAME]: {\n reason: 'Paths should not intersect themselves.',\n featuresWithKink: kinksFound,\n },\n }\n }\n\n return null\n }\n}\n","import { fileTypeFromBuffer } from 'file-type'\n\nexport function readFileAsync(file: Blob): Promise<ArrayBuffer | null> {\n return new Promise<ArrayBuffer | null>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as ArrayBuffer | null)\n }\n reader.readAsArrayBuffer(file)\n })\n}\n\nexport async function readFileAsDataUrlAsync(\n file: Blob,\n): Promise<string | null> {\n return new Promise<string | null>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string | null)\n }\n reader.readAsDataURL(file)\n })\n}\n\n/** Coerce a buffer to an ArrayBuffer suitable for use as a BlobPart. */\nfunction toArrayBuffer(buffer: Uint8Array | ArrayBuffer): ArrayBuffer {\n if (buffer instanceof ArrayBuffer) {\n return buffer\n }\n // Slice to get an owned ArrayBuffer, avoiding SharedArrayBuffer TS issues with BlobPart.\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength,\n ) as ArrayBuffer\n}\n\nexport async function fileBufferToBlob(\n buffer: Uint8Array | ArrayBuffer,\n defaultMime: string = 'application/octet-stream',\n): Promise<Blob> {\n const fType = await fileTypeFromBuffer(buffer)\n const mime = fType ? fType.mime : defaultMime\n return new Blob([toArrayBuffer(buffer)], { type: mime })\n}\n\nexport async function fileBufferToObjectUrl(\n buffer: Uint8Array | ArrayBuffer,\n defaultMime: string = 'application/octet-stream',\n): Promise<string> {\n const file = await fileBufferToBlob(buffer, defaultMime)\n return URL.createObjectURL(file)\n}\n\nexport interface IFileData {\n ext?: string\n mime?: string\n blob: Blob\n}\n\nexport async function fileDataFromBuffer(\n buffer: Uint8Array | ArrayBuffer,\n defaultMime: string = 'application/octet-stream',\n): Promise<IFileData> {\n const fType = await fileTypeFromBuffer(buffer)\n const ext = fType?.ext\n const mime = fType ? fType.mime : defaultMime\n const blob = new Blob([toArrayBuffer(buffer)], { type: mime })\n return { ext, mime, blob }\n}\n\nexport function openBlob(blob: Blob, target?: string, filename?: string) {\n const url = URL.createObjectURL(blob)\n const win = window.open(url, target)\n // TODO: Consider if always setting opener to null is to restrictive\n // if (win && target && target.toLowerCase() === '_blank') {\n // win.opener = null\n // }\n}\n","/** Returns object without property */\nexport function withoutProperty<T, K extends keyof T>(\n obj: T,\n propName: K,\n): Pick<T, Exclude<keyof T, K>> {\n const { [propName]: _, ...without } = obj\n return without\n}\n\n/** Returns object without properties */\nexport function withoutProperties<T, K extends keyof T>(\n obj: T,\n propNames: K[],\n): Pick<T, Exclude<keyof T, K>> {\n let without: any = obj\n for (const propName of propNames) {\n without = withoutProperty(without, propName)\n }\n return without\n}\n\n/** Delete property of object */\nexport function deleteProperty<T extends object, K extends keyof T>(\n obj: T,\n propName: K,\n): void {\n if (Object.prototype.hasOwnProperty.call(obj, propName)) {\n delete obj[propName]\n }\n}\n\n/** Delete properties of object */\nexport function deleteProperties<T extends object, K extends keyof T>(\n obj: T,\n propNames: K[],\n): void {\n for (const propName of propNames) {\n deleteProperty(obj, propName)\n }\n}\n","import { fileTypeFromBuffer } from 'file-type'\nimport { FeatureCollection } from 'geojson'\nimport { parseShp, parseZip } from 'shpjs'\n\nimport { readFileAsync } from '../file-utils'\nimport { withoutProperty } from '../obj-utils'\n\n/**\n * Reads a File, or buffer of file content, in GeoJSON or ESRI Shapefile format\n * and returns a GeoJSON `FeatureCollection`.\n */\nexport async function readGeoFile(\n fileOrBuffer: File | ArrayBuffer,\n): Promise<FeatureCollection> {\n const buffer = await coerceToArrayBuffer(fileOrBuffer)\n const fType = await fileTypeFromBuffer(buffer)\n\n if (fType?.ext === 'shp') {\n return parseShpFile(buffer)\n } else if (fType?.mime === 'application/zip') {\n return parseShpZip(buffer)\n }\n\n return parseGeoJson(buffer)\n}\n\nasync function coerceToArrayBuffer(\n fileOrBuffer: File | ArrayBuffer,\n): Promise<ArrayBuffer> {\n if (fileOrBuffer instanceof File) {\n const arrBuf = await readFileAsync(fileOrBuffer)\n if (arrBuf === null) {\n throw new Error('Could not read file.')\n }\n return arrBuf\n }\n\n return fileOrBuffer\n}\n\nasync function parseShpFile(buffer: ArrayBuffer): Promise<FeatureCollection> {\n const geometries = parseShp(buffer)\n const featCollection: FeatureCollection = {\n type: 'FeatureCollection',\n features: geometries.map((geom) => ({\n type: 'Feature',\n geometry: geom,\n properties: {},\n })),\n }\n return featCollection\n}\n\nasync function parseShpZip(buffer: ArrayBuffer): Promise<FeatureCollection> {\n let featCollection = await parseZip(buffer)\n if (Array.isArray(featCollection)) {\n if (featCollection.length === 0) {\n throw Error(`Shape data not found.`)\n } else if (featCollection.length > 1) {\n throw Error(`Multiple shape files not supported.`)\n }\n featCollection = featCollection[0]\n }\n return withoutProperty(featCollection, 'fileName')\n}\n\nfunction parseGeoJson(buffer: ArrayBuffer): FeatureCollection {\n const json = JSON.parse(new TextDecoder().decode(buffer))\n\n if (json?.type === 'FeatureCollection' && Array.isArray(json?.features)) {\n return json as FeatureCollection\n }\n\n throw Error(`Unable to parse as GeoJSON.`)\n}\n","import { Feature, FeatureCollection, MultiPolygon, Polygon } from 'geojson'\n\n/**\n * Split all MultiPolygon into Polygon. Any properties, other than\n * 'coordinates', of the MultiPolygons will be lost.\n *\n * NOTE: MultiPolygons in a GeometryCollection will not be split.\n */\nexport function splitMultiPolygons(featureCollection: FeatureCollection): void {\n for (let i = 0; i < featureCollection.features.length; i++) {\n if (featureCollection.features[i]) {\n const geometry = featureCollection.features[i].geometry\n if (geometry.type === 'MultiPolygon') {\n const features = splitMultPolygon(geometry).map(\n (p) =>\n ({\n type: 'Feature',\n geometry: p,\n properties: {},\n }) as Feature,\n )\n featureCollection.features.splice(i, 1, ...features)\n i += Math.max(features.length - 1, 0)\n }\n }\n }\n}\n\nfunction splitMultPolygon(multiPolygon: MultiPolygon): Polygon[] {\n return multiPolygon.coordinates.map((c) => ({\n type: 'Polygon',\n coordinates: c,\n }))\n}\n","import {\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n Position,\n} from 'geojson'\n\n/**\n * Close all polygons in the GeoJSON so the first and last position of every\n * ring are identical.\n *\n * Google Maps requires closed polygon rings, but not all libraries produce\n * them. This is idempotent: rings that are already closed are left unchanged.\n */\nexport function closePolygons(\n geoJson: FeatureCollection | Feature | Polygon | MultiPolygon,\n): void {\n if (geoJson.type === 'FeatureCollection') {\n for (const f of geoJson.features) {\n closePolygonsFeature(f)\n }\n } else if (geoJson.type === 'Feature') {\n closePolygonsFeature(geoJson)\n } else if (geoJson.type === 'Polygon') {\n closePolygon(geoJson)\n } else if (geoJson.type === 'MultiPolygon') {\n closeMultiPolygon(geoJson)\n }\n}\n\nfunction closePolygonsFeature(feature: Feature): void {\n if (feature.geometry.type === 'Polygon') {\n closePolygon(feature.geometry)\n } else if (feature.geometry.type === 'MultiPolygon') {\n closeMultiPolygon(feature.geometry)\n }\n}\n\nfunction closePolygon(polygon: Polygon): void {\n for (const ring of polygon.coordinates) {\n closeRing(ring)\n }\n}\n\nfunction closeMultiPolygon(multiPolygon: MultiPolygon): void {\n for (const polygon of multiPolygon.coordinates) {\n for (const ring of polygon) {\n closeRing(ring)\n }\n }\n}\n\n/**\n * Appends the first position to the end of a ring only when it is not already\n * closed. Exact equality is correct here: the closing point is a copy of the\n * first point, so we compare a value against its own copy.\n */\nfunction closeRing(ring: Position[]): void {\n if (ring.length < 1) {\n return\n }\n const first = ring[0]\n const last = ring[ring.length - 1]\n if (first[0] === last[0] && first[1] === last[1]) {\n return\n }\n ring.push([...first])\n}\n","import { Polygon, Position } from 'geojson'\n\nimport { polygonViolatesMinMax } from './polygon-violates-min-max'\n\n/** Count distinct vertices in a ring, ignoring an explicit closing point. */\nfunction distinctVertexCount(ring: Position[]): number {\n if (ring.length === 0) {\n return 0\n }\n const first = ring[0]\n const last = ring[ring.length - 1]\n const isClosed =\n ring.length > 1 && first[0] === last[0] && first[1] === last[1]\n return isClosed ? ring.length - 1 : ring.length\n}\n\n/**\n * Whether a polygon's outer ring has at least `min` distinct vertices.\n * Ring closure (a repeated first/last point) does not count toward the total,\n * so this behaves the same for closed and unclosed rings.\n */\nexport function polygonHasMinDistinctVertices(\n polygon: Polygon,\n min: number = 3,\n): boolean {\n const outer = polygon.coordinates[0] ?? []\n return !polygonViolatesMinMax(distinctVertexCount(outer), min, undefined)\n}\n","import { Polygon } from 'geojson'\n\nimport booleanContains from '@turf/boolean-contains'\nimport { polygon as turfPolygon } from '@turf/helpers'\n\n/**\n * Whether `outer` fully contains `inner`, using turf's boolean-contains on the\n * GeoJSON geometries directly (no Google Maps dependency).\n */\nexport function polygonContains(outer: Polygon, inner: Polygon): boolean {\n return booleanContains(\n turfPolygon(outer.coordinates),\n turfPolygon(inner.coordinates),\n )\n}\n","import { Polygon, Position } from 'geojson'\n\n/**\n * Whether a ring is wound clockwise, via the shoelace signed-area sign.\n * Sum of (x2 - x1) * (y2 + y1) is positive for clockwise rings in standard\n * (x = lng, y = lat) orientation.\n */\nexport function ringIsClockwise(ring: Position[]): boolean {\n let sum = 0\n for (let i = 0; i < ring.length - 1; i++) {\n const [x1, y1] = ring[i]\n const [x2, y2] = ring[i + 1]\n sum += (x2 - x1) * (y2 + y1)\n }\n return sum > 0\n}\n\n/** Return `ring` wound opposite to `reference`, reversing a copy if needed. */\nfunction ringWoundOpposite(\n reference: Position[],\n ring: Position[],\n): Position[] {\n if (ringIsClockwise(reference) === ringIsClockwise(ring)) {\n return [...ring].reverse()\n }\n return [...ring]\n}\n\n/**\n * Append the outer ring of `hole` to `exterior` as an interior ring (a\n * cutout), wound opposite the exterior ring so it renders as a hole. Returns a\n * new Polygon; inputs are not mutated.\n */\nexport function addHoleToPolygon(exterior: Polygon, hole: Polygon): Polygon {\n const exteriorRing = exterior.coordinates[0]\n const holeRing = ringWoundOpposite(exteriorRing, hole.coordinates[0])\n return {\n type: 'Polygon',\n coordinates: [...exterior.coordinates, holeRing],\n }\n}\n","// Based on source: https://github.com/sindresorhus/array-move/blob/main/index.js\n\n/**\n Moves the item to the new position in the input array. Useful for huge arrays\n where absolute performance is needed.\n\n @param array - The array to modify.\n @param fromIndex - The index of item to move. If negative, it will begin that\n many elements from the end.\n @param toIndex - The index of where to move the item. If negative, it will\n begin that many elements from the end.\n @example\n ```\n import { arrayMoveMutable } from '@theseam/ui-common/utils';\n\n const input = ['a', 'b', 'c'];\n arrayMoveMutable(input, 1, 2);\n console.log(input);\n //=> ['a', 'c', 'b']\n ```\n*/\nexport function arrayMoveMutable(\n array: unknown[],\n fromIndex: number,\n toIndex: number,\n): void {\n const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex\n\n if (startIndex >= 0 && startIndex < array.length) {\n const endIndex = toIndex < 0 ? array.length + toIndex : toIndex\n\n const [item] = array.splice(fromIndex, 1)\n array.splice(endIndex, 0, item)\n }\n}\n\n/**\n Clones the given `array`, moves the item to a new position in the new array,\n and then returns the new array. The given `array` is not mutated.\n\n @param array - The array with the item to move.\n @param fromIndex - The index of item to move. If negative, it will begin that\n many elements from the end.\n @param toIndex - The index of where to move the item. If negative, it will\n begin that many elements from the end.\n @returns A new array with the item moved to the new position.\n @example\n ```\n import { arrayMoveImmutable } from '@theseam/ui-common/utils';\n\n const input = ['a', 'b', 'c'];\n const array1 = arrayMoveImmutable(input, 1, 2);\n console.log(array1);\n //=> ['a', 'c', 'b']\n\n const array2 = arrayMoveImmutable(input, -1, 0);\n console.log(array2);\n //=> ['c', 'a', 'b']\n\n const array3 = arrayMoveImmutable(input, -2, -3);\n console.log(array3);\n //=> ['b', 'a', 'c']\n ```\n*/\nexport function arrayMoveImmutable<ValueType>(\n array: readonly ValueType[],\n fromIndex: number,\n toIndex: number,\n): ValueType[] {\n const newArray = [...array]\n arrayMoveMutable(newArray, fromIndex, toIndex)\n return newArray\n}\n","export function calcPercentage(total: number, n: number) {\n return total && total > 0 ? (n / total) * 100 : 0\n}\n","/**\n * Polyfil for `Element.toggleAttribute`\n *\n * Toggles a value without a value. Useful for attributes, such as `disabled`,\n * `readonly`, and `hidden`, that only needs to exist on the `Element` without\n * requiring a value.\n *\n * Most browsers natively support this feature, but IE, which we still try to\n * support for at least the main parts of the app, has \"Unknown\" support of this\n * feature. Until IE support is dropped this polyfil should be used to toggle an\n * attribute.\n *\n * Source:\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute#Polyfill\n */\nexport function toggleAttribute(\n element: HTMLElement,\n name: string,\n force: boolean,\n): boolean {\n let _force = force\n if (_force !== void 0) {\n _force = !!_force\n }\n\n if (element.getAttribute(name) !== null) {\n if (_force) {\n return true\n }\n\n element.removeAttribute(name)\n return false\n } else {\n if (_force === false) {\n return false\n }\n\n element.setAttribute(name, '')\n return true\n }\n}\n","export const phoneNumberMask = [\n '(',\n /[1-9]/,\n /\\d/,\n /\\d/,\n ')',\n ' ',\n /\\d/,\n /\\d/,\n /\\d/,\n '-',\n /\\d/,\n /\\d/,\n /\\d/,\n /\\d/,\n]\n","export function isNullOrUndefined<T>(\n value: T | null | undefined,\n): value is null | undefined {\n return value === undefined || value === null\n}\n","export function isNullOrUndefinedOrEmpty(\n value: string | null | undefined,\n trim: boolean = true,\n): value is string | null | undefined {\n return (\n value === undefined ||\n value === null ||\n (trim ? value.trim() : value).length === 0\n )\n}\n","export function loadStyle(content: string): Promise<HTMLStyleElement> {\n return new Promise((resolve, reject) => {\n const s = document.createElement('style')\n s.onload = () => resolve(s)\n s.onerror = (e) => {\n document.head.removeChild(s)\n reject(e)\n }\n s.innerHTML = content\n document.head.appendChild(s)\n })\n}\n","export function loadStyleSheet(path: string): Promise<HTMLLinkElement> {\n return new Promise((resolve, reject) => {\n const s = document.createElement('link')\n s.onload = () => resolve(s)\n s.onerror = (e) => {\n document.head.removeChild(s)\n reject(e)\n }\n s.rel = 'stylesheet'\n s.href = path\n document.head.appendChild(s)\n })\n}\n","export function notNullOrUndefinedOrEmpty(\n value: string | null | undefined,\n trim: boolean = true,\n): value is string {\n return (\n value !== null &&\n value !== undefined &&\n (trim ? value.trim() : value).length > 0\n )\n}\n","export async function waitOnConditionAsync(\n condition: () => boolean,\n timeoutDuration: number = -1,\n throwOnTimeout: boolean = true,\n): Promise<any> {\n const timeStart: any = new Date()\n\n const _waitFunc = (callbackFn: (boolean: boolean) => any) => {\n let conditionSuccess = false\n\n if (condition()) {\n callbackFn(true)\n conditionSuccess = true\n }\n\n if (!conditionSuccess) {\n const timeNow: any = new Date()\n const duration = timeNow - timeStart\n if (timeoutDuration > -1 && duration > timeoutDuration) {\n if (throwOnTimeout) {\n throw new Error('Timed out waiting on condition.')\n } else {\n callbackFn(false)\n }\n }\n\n setTimeout(() => {\n _waitFunc(callbackFn)\n }, 30)\n }\n }\n\n return new Promise((resolve, reject) => {\n const fn = (b: boolean) => {\n resolve(b)\n }\n _waitFunc(fn)\n })\n}\n","import { isObservable, Observable, Subscriber, Subscription } from 'rxjs'\n\nclass IntervalTimer {\n private _intervalTime: number\n private _intervalId: number | null = null\n\n constructor(\n private _callback: () => void,\n intervalTime: number,\n startOnInit: boolean = true,\n ) {\n this._intervalTime = intervalTime\n if (startOnInit) {\n this.start()\n }\n }\n\n set intervalTime(time: number) {\n this._intervalTime = time\n }\n\n public start(): void {\n if (this._intervalId === null) {\n this._intervalId = window.setInterval(() => {\n this._callback()\n }, this._intervalTime)\n }\n }\n\n public stop(): void {\n if (this._intervalId !== null) {\n clearInterval(this._intervalId)\n this._intervalId = null\n }\n }\n\n public reset(newIntervalTime?: number): void {\n if (newIntervalTime) {\n this.intervalTime = newIntervalTime\n }\n this.stop()\n this.start()\n }\n}\n\nexport type PollingActionFn<R> = () => R | Observable<R>\n\nexport class PollingTickerOptions {\n emitOnInit?: boolean = true\n}\n\n// TODO: Simplify complexity.\n\n/**\n * Call an action and emits the result to its subscriber on an interval or when\n * ticker emits. When the ticker emits, the interval time will reset.\n *\n * When subscribed to, the action will be called and emitted right away unless\n * the `emitOnInit` option is set to false.\n */\nexport function pollingTicker<R>(\n action: PollingActionFn<R>,\n pollingInterval?: number,\n ticker?: Observable<number | void>,\n options?: PollingTickerOptions,\n): Observable<R> {\n return new Observable((subscriber: Subscriber<R>) => {\n const _opts = { ...new PollingTickerOptions(), ...(options || {}) }\n\n let timer: IntervalTimer | null = null\n let actionSub: Subscription | null = null\n let tickerSub: Subscription | null = null\n\n try {\n const handleAction = () => {\n if (timer) {\n timer.stop()\n }\n\n const actionResult = action()\n\n if (isObservable(actionResult)) {\n if (actionSub) {\n actionSub.unsubscribe()\n }\n actionSub = actionResult.subscribe(\n (v: R) => {\n subscriber.next(v)\n if (timer) {\n timer.reset()\n }\n },\n (err) => {\n subscriber.error(err)\n },\n () => {\n actionSub = null\n if (timer) {\n timer.start()\n }\n },\n )\n } else {\n subscriber.next(actionResult)\n }\n if (timer) {\n timer.start()\n }\n }\n\n if (_opts.emitOnInit) {\n handleAction()\n }\n\n if (pollingInterval) {\n timer = new IntervalTimer(() => {\n handleAction()\n }, pollingInterval)\n }\n\n if (ticker) {\n tickerSub = ticker.subscribe((newPollingInterval) => {\n if (newPollingInterval && timer) {\n timer.stop()\n if (newPollingInterval) {\n timer.intervalTime = newPollingInterval\n }\n }\n handleAction()\n if (timer) {\n timer.reset()\n }\n })\n }\n } catch (err) {\n subscriber.error(err)\n }\n\n return () => {\n if (timer) {\n timer.stop()\n }\n if (actionSub) {\n actionSub.unsubscribe()\n }\n if (tickerSub) {\n tickerSub.unsubscribe()\n }\n }\n })\n}\n","import { BehaviorSubject, EMPTY, merge, Observable, Subject } from 'rxjs'\nimport {\n auditTime,\n distinctUntilChanged,\n filter,\n map,\n share,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators'\n\nexport interface RefreshableOptions<T> {\n action: () => Observable<T>\n invalidate$?: Observable<unknown>\n poll$?: Observable<unknown>\n}\n\nconst NO_VALUE: unique symbol = Symbol('refreshable.no-value')\ntype Cached<T> = T | typeof NO_VALUE\n\nexport class Refreshable<T> {\n private readonly _refresh$ = new Subject<void>()\n private readonly _cache$ = new BehaviorSubject<Cached<T>>(NO_VALUE)\n private readonly _loading$ = new BehaviorSubject<boolean>(false)\n private _dataSubCount = 0\n\n public readonly loading$: Observable<boolean> = this._loading$.pipe(\n distinctUntilChanged(),\n )\n\n public readonly initialized$: Observable<boolean> = this._cache$.pipe(\n map((v) => v !== NO_VALUE),\n distinctUntilChanged(),\n )\n\n public readonly data$: Observable<T>\n\n constructor(opts: RefreshableOptions<T>) {\n const { action } = opts\n\n const invalidateSig$ = (opts.invalidate$ ?? EMPTY).pipe(\n tap(() => this._cache$.next(NO_VALUE)),\n )\n\n const driver$ = merge(\n this._refresh$,\n opts.poll$ ?? EMPTY,\n invalidateSig$,\n ).pipe(\n startWith(undefined as unknown),\n auditTime(0),\n tap(() => this._loading$.next(true)),\n switchMap(() => action()),\n tap({\n next: (v) => {\n this._cache$.next(v)\n this._loading$.next(false)\n },\n error: () => this._loading$.next(false),\n }),\n share({\n resetOnRefCountZero: true,\n resetOnComplete: true,\n resetOnError: true,\n }),\n )\n\n this.data$ = new Observable<T>((subscriber) => {\n this._dataSubCount++\n const driverSub = driver$.subscribe({\n error: (e) => subscriber.error(e),\n })\n const cacheSub = this._cache$\n .pipe(filter((v): v is T => v !== NO_VALUE))\n .subscribe(subscriber)\n return () => {\n cacheSub.unsubscribe()\n driverSub.unsubscribe()\n this._dataSubCount--\n if (this._dataSubCount === 0) {\n this._cache$.next(NO_VALUE)\n this._loading$.next(false)\n }\n }\n })\n }\n\n public refresh(): void {\n this._refresh$.next()\n }\n}\n","import { from, isObservable, Observable } from 'rxjs'\n\nexport function wrapIntoObservable<T>(\n value: T | Promise<T> | Observable<T>,\n): Observable<T> {\n if (isObservable(value)) {\n return value\n }\n\n return from(Promise.resolve(value))\n}\n","/**\n * Explaination:\n * ^ - beginning of the string\n * (?: - beginning of a non-captured group\n * [a-z]+ - any character of 'a' to 'z' 1 or more times\n * : - string (colon character)\n * )? - end of the non-captured group. Group appearing 0 or 1 times\n * // - string (two forward slash characters)\n * 'i' - non case-sensitive flag\n *\n * source: https://stackoverflow.com/a/19709846\n */\nconst IS_ABSOLUTE_URL_REGEX = new RegExp('^(?:[a-z]+:)?//', 'i')\n\nexport function isAbsoluteUrl(url: string): boolean {\n return IS_ABSOLUTE_URL_REGEX.test(url)\n}\n","import { Observable, Subscriber } from 'rxjs'\n\nexport type SubscriberCountChangedFn = (\n description: string,\n count: number,\n reason: 'subscribed' | 'unsubscribed',\n) => void\n\n/**\n * This is just for helping debug observables that aren't being unsubscribed\n * from correctly.\n *\n * If description is 'foo' then you can check the how many observers are\n * subscribed with the expression `__subscriberCounts['foo']`. In a debugger you\n * can add the expression to the \"Watch\" expressions or in Chrome Devtools\n * Console you can add it to the live expressions(Add live expressions by\n * clicking the eye the the left of the Console filter input).\n */\nexport function subscriberCount<T>(\n sourceObservable: Observable<T>,\n description: string,\n countChangedFn: SubscriberCountChangedFn | undefined | null = logOnChange,\n) {\n let counter = 0\n return new Observable((subscriber: Subscriber<T>) => {\n const subscription = sourceObservable.subscribe(subscriber)\n counter++\n if (countChangedFn !== undefined && countChangedFn !== null) {\n countChangedFn(description, counter, 'subscribed')\n }\n setGlobalSubscriberCount(description, counter)\n\n return () => {\n subscription.unsubscribe()\n counter--\n if (countChangedFn !== undefined && countChangedFn !== null) {\n countChangedFn(description, counter, 'unsubscribed')\n }\n setGlobalSubscriberCount(description, counter)\n }\n })\n}\n\nconst logOnChange: SubscriberCountChangedFn = (\n description: string,\n count: number,\n reason: 'subscribed' | 'unsubscribed',\n) => {\n // eslint-disable-next-line no-console\n console.log(`${description} subscriptions: ${count} [${reason}]`)\n}\n\nfunction getGlobalSubscriberCounts(): { [description: string]: number } {\n const w = window as any\n if (w.__subscriberCounts === undefined || w.__subscriberCounts === null) {\n w.__subscriberCounts = {}\n }\n return w.__subscriberCounts\n}\n\nfunction setGlobalSubscriberCount(description: string, count: number): void {\n getGlobalSubscriberCounts()[description] = count\n}\n","import { QueryList } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { map, startWith } from 'rxjs/operators'\n\nexport function observeQueryList<T>(\n queryList: QueryList<T>,\n emitCurrentValue = true,\n): Observable<T[]> {\n return queryList.changes.pipe(\n startWith(queryList),\n map((v) => v.toArray() as T[]),\n )\n}\n","export function createPadding(len: number, chars: string): string {\n // if (chars.length <= len) {\n // return chars\n // }\n\n if (chars.length === 0) {\n throw Error(`Padding characters must be at least 1 char length.`)\n }\n\n let str = chars\n while (str.length < len) {\n str += chars\n }\n\n if (str.length > len) {\n str = str.slice(0, len)\n }\n\n return str\n}\n","import { createPadding } from './create-padding'\n\nexport function padEnd(\n stringToPad: string,\n paddingLength: number | undefined = 0,\n paddingChars: string | undefined = ' ',\n): string {\n const strLength = paddingLength ? stringToPad.length : 0\n\n if (!paddingLength || strLength >= paddingLength) {\n return stringToPad\n }\n\n return stringToPad + createPadding(paddingLength - strLength, paddingChars)\n}\n","import { createPadding } from './create-padding'\n\nexport function padStart(\n stringToPad: string,\n paddingLength: number | undefined = 0,\n paddingChars: string | undefined = ' ',\n): string {\n const strLength = paddingLength ? stringToPad.length : 0\n\n if (!paddingLength || strLength >= paddingLength) {\n return stringToPad\n }\n\n return createPadding(paddingLength - strLength, paddingChars) + stringToPad\n}\n","export function isNumeric(value: any): boolean {\n return !isNaN(Number(value) - parseFloat(value))\n}\n","import { isNumeric } from './is-numeric'\n\n/**\n * Returns the number of fractional digits.\n *\n * NOTE: This is intended for input validation, so trailing 0's will be included\n * in the total. Also, localization is not considered, so '.' is assumed to be\n * the fractional separator.\n */\nexport function fractionalDigitsCount(value: string): number | null {\n if (!isNumeric(value)) {\n return null\n }\n\n const a = value.split('.')\n if (a.length !== 2) {\n return null\n }\n\n return a[1].length\n}\n","// NOTE: Based on https://www.npmjs.com/package/strip-outer\n\nconst escapeRegExp = (s: string) =>\n s.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d')\n\n/**\n * Strip a substring from the start/end of a string.\n */\nexport function stripOuter(input: string, substring: string): string {\n const escaped = escapeRegExp(substring)\n return input.replace(new RegExp(`^${escaped}|${escaped}$`, 'g'), '')\n}\n","// NOTE: Based on https://www.npmjs.com/package/trim-repeated\n\nconst escapeRegExp = (s: string) =>\n s.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d')\n\n/**\n * Trim a consecutively repeated substring: foo--bar---baz → foo-bar-baz.\n */\nexport function trimRepeated(str: string, target: string): string {\n return str.replace(new RegExp(`(?:${escapeRegExp(target)}){2,}`, 'g'), target)\n}\n","import { stripOuter } from './strip-outer'\nimport { trimRepeated } from './trim-repeated'\n\n// NOTE: Mostly based on https://www.npmjs.com/package/filenamify\n\nconst MAX_FILENAME_LENGTH = 100\n\n// eslint-disable-next-line no-control-regex\nconst reReserved = /[<>:\"/\\\\|?*\\x00-\\x1F]/g\nconst reWindowsNames = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i\nconst reControlChars = /[\\u0000-\\u001f\\u0080-\\u009f]/g // eslint-disable-line no-control-regex\nconst reRelativePath = /^\\.+/\n\nexport interface SanitizeFilenameOptions {\n /**\n * Replacement string.\n *\n * @default '_'\n */\n replacement?: string\n /**\n * Max file length.\n *\n * @default 100\n */\n maxLength?: number\n}\n\nconst defaultOptions: SanitizeFilenameOptions = {\n replacement: '_',\n maxLength: MAX_FILENAME_LENGTH,\n}\n\nexport function sanitizeFilename(\n filename: string,\n options?: SanitizeFilenameOptions,\n): string {\n const opts = {\n ...defaultOptions,\n ...(options || {}),\n }\n\n const replacement = opts.replacement === undefined ? '!' : opts.replacement\n\n if (reReserved.test(replacement) && reControlChars.test(replacement)) {\n throw new Error(\n 'Replacement string cannot contain reserved filename characters',\n )\n }\n\n let s = filename\n\n s = s.replace(reReserved, replacement)\n s = s.replace(reControlChars, replacement)\n s = s.replace(reRelativePath, replacement)\n\n if (replacement.length > 0) {\n s = trimRepeated(s, replacement)\n s = s.length > 1 ? stripOuter(s, replacement) : s\n }\n\n s = reWindowsNames.test(s) ? s + replacement : s\n s = s.slice(0, opts.maxLength)\n\n return s\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["turfPolygon","escapeRegExp"],"mappings":";;;;;;;;;AAAA;;AAEG;AACG,SAAU,YAAY,CAC1B,OAAU,EACV,IAAY,EAAA;AAEZ,IAAA,OAAO,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC;AACnC;;ACRA;;AAEG;AACG,SAAU,YAAY,CAC1B,OAAU,EACV,IAAY,EAAA;AAEZ,IAAA,OAAO,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC;AACnC;;ACFA;;;;AAIG;AACG,SAAU,uBAAuB,CACrC,OAAgC,EAChC,cAA8B,EAAA;AAE9B,IAAA,IAAI,MAAM,GAAuB,OAAO,CAAC,aAAa,CAAC,aAAa;AAEpE,IAAA,OACE,MAAM;QACN,EACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC;AACrC,YAAA,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CACvC,EACD;AACA,QAAA,MAAM,GAAG,MAAM,CAAC,aAAa;IAC/B;AAEA,IAAA,MAAM,QAAQ,GAAG,MAAM,GAAG,YAAY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name": "@theseam/ui-common",
3
- "version": "2.0.1-beta.111",
3
+ "version": "2.0.1-beta.114",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^20.2.3",
6
6
  "@angular/common": "^20.3.0",
@@ -38,6 +38,9 @@ declare class ToggleGroupDirective implements ControlValueAccessor {
38
38
  optionDirectives?: QueryList<ToggleGroupOptionDirective>;
39
39
  onChange: any;
40
40
  onTouched: any;
41
+ private _selectedSet;
42
+ private _selectedSetSource;
43
+ private _selectedSetMultiple;
41
44
  get value(): string | string[] | undefined | null;
42
45
  set value(value: string | string[] | undefined | null);
43
46
  writeValue(value: any): void;
@@ -45,6 +48,21 @@ declare class ToggleGroupDirective implements ControlValueAccessor {
45
48
  registerOnTouched(fn: any): void;
46
49
  setDisabledState(isDisabled: boolean): void;
47
50
  isSelected(value: string | undefined | null): boolean;
51
+ /**
52
+ * The current selection as a set, rebuilt only when the value (or `multiple`)
53
+ * changes.
54
+ *
55
+ * `isSelected` is called from templates and from every option's host binding,
56
+ * so it runs several times per option per change detection pass. Hashing the
57
+ * selection once keeps those lookups O(1) instead of scanning the value array
58
+ * on every call.
59
+ *
60
+ * Invalidation is keyed on the `val` reference rather than done in the `value`
61
+ * setter, because `val` is also written directly by the `[value]` input, which
62
+ * does not go through the setter.
63
+ */
64
+ private _selected;
65
+ private _buildSelectedSet;
48
66
  /**
49
67
  * Toggles an option's selected state by value.
50
68
  */