@mapbox/mapbox-gl-style-spec 14.27.0 → 14.28.0-alpha.fa7f708fbcc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1629,7 +1629,6 @@ declare const _exports: {
1629
1629
  type: string;
1630
1630
  value: string;
1631
1631
  "supported-layer-types": string[];
1632
- experimental: boolean;
1633
1632
  doc: string;
1634
1633
  };
1635
1634
  };
@@ -7956,7 +7955,6 @@ declare const _exports: {
7956
7955
  };
7957
7956
  "line-border-width": {
7958
7957
  type: string;
7959
- private: boolean;
7960
7958
  doc: string;
7961
7959
  default: number;
7962
7960
  minimum: number;
@@ -7981,7 +7979,6 @@ declare const _exports: {
7981
7979
  };
7982
7980
  "line-border-color": {
7983
7981
  type: string;
7984
- private: boolean;
7985
7982
  doc: string;
7986
7983
  default: string;
7987
7984
  "use-theme": boolean;
@@ -8004,6 +8001,38 @@ declare const _exports: {
8004
8001
  };
8005
8002
  "property-type": string;
8006
8003
  };
8004
+ "line-border-gradient": {
8005
+ type: string;
8006
+ experimental: boolean;
8007
+ doc: string;
8008
+ example: (string | number | string[])[];
8009
+ "use-theme": boolean;
8010
+ transition: boolean;
8011
+ requires: ({
8012
+ "!": string;
8013
+ source?: undefined;
8014
+ has?: undefined;
8015
+ } | {
8016
+ source: string;
8017
+ has: {
8018
+ lineMetrics: boolean;
8019
+ };
8020
+ "!"?: undefined;
8021
+ })[];
8022
+ "sdk-support": {
8023
+ "basic functionality": {
8024
+ js: string;
8025
+ android: string;
8026
+ ios: string;
8027
+ };
8028
+ "data-driven styling": {};
8029
+ };
8030
+ expression: {
8031
+ interpolated: boolean;
8032
+ parameters: string[];
8033
+ };
8034
+ "property-type": string;
8035
+ };
8007
8036
  "line-occlusion-opacity": {
8008
8037
  type: string;
8009
8038
  default: number;
@@ -9386,6 +9415,21 @@ declare const _exports: {
9386
9415
  };
9387
9416
  "property-type": string;
9388
9417
  };
9418
+ "raster-allow-draping": {
9419
+ type: string;
9420
+ default: boolean;
9421
+ experimental: boolean;
9422
+ doc: string;
9423
+ transition: boolean;
9424
+ "property-type": string;
9425
+ "sdk-support": {
9426
+ "basic functionality": {
9427
+ js: string;
9428
+ android: string;
9429
+ ios: string;
9430
+ };
9431
+ };
9432
+ };
9389
9433
  };
9390
9434
  "paint_raster-particle": {
9391
9435
  "raster-particle-array-band": {
@@ -11095,9 +11139,6 @@ type FillLayerSpecification = {
11095
11139
  "fill-tunnel-structure-color-transition"?: TransitionSpecification;
11096
11140
  "fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>;
11097
11141
  };
11098
- /**
11099
- * @experimental This property is experimental and subject to change in future versions.
11100
- */
11101
11142
  "appearances"?: Array<AppearanceSpecification>;
11102
11143
  };
11103
11144
  /**
@@ -11178,6 +11219,11 @@ type LineLayerSpecification = {
11178
11219
  "line-border-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
11179
11220
  "line-border-color-transition"?: TransitionSpecification;
11180
11221
  "line-border-color-use-theme"?: PropertyValueSpecification<string>;
11222
+ /**
11223
+ * @experimental This property is experimental and subject to change in future versions.
11224
+ */
11225
+ "line-border-gradient"?: ColorSpecification | ExpressionSpecification;
11226
+ "line-border-gradient-use-theme"?: PropertyValueSpecification<string>;
11181
11227
  "line-occlusion-opacity"?: PropertyValueSpecification<number>;
11182
11228
  "line-occlusion-opacity-transition"?: TransitionSpecification;
11183
11229
  /**
@@ -11189,9 +11235,6 @@ type LineLayerSpecification = {
11189
11235
  */
11190
11236
  "line-blend-additive-clamp"?: PropertyValueSpecification<number>;
11191
11237
  };
11192
- /**
11193
- * @experimental This property is experimental and subject to change in future versions.
11194
- */
11195
11238
  "appearances"?: Array<AppearanceSpecification>;
11196
11239
  };
11197
11240
  /**
@@ -11320,9 +11363,6 @@ type SymbolLayerSpecification = {
11320
11363
  "symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>;
11321
11364
  "symbol-z-offset-transition"?: TransitionSpecification;
11322
11365
  };
11323
- /**
11324
- * @experimental This property is experimental and subject to change in future versions.
11325
- */
11326
11366
  "appearances"?: Array<AppearanceSpecification>;
11327
11367
  };
11328
11368
  /**
@@ -11376,9 +11416,6 @@ type CircleLayerSpecification = {
11376
11416
  "circle-emissive-strength"?: PropertyValueSpecification<number>;
11377
11417
  "circle-emissive-strength-transition"?: TransitionSpecification;
11378
11418
  };
11379
- /**
11380
- * @experimental This property is experimental and subject to change in future versions.
11381
- */
11382
11419
  "appearances"?: Array<AppearanceSpecification>;
11383
11420
  };
11384
11421
  /**
@@ -11413,9 +11450,6 @@ type HeatmapLayerSpecification = {
11413
11450
  "heatmap-opacity"?: PropertyValueSpecification<number>;
11414
11451
  "heatmap-opacity-transition"?: TransitionSpecification;
11415
11452
  };
11416
- /**
11417
- * @experimental This property is experimental and subject to change in future versions.
11418
- */
11419
11453
  "appearances"?: Array<AppearanceSpecification>;
11420
11454
  };
11421
11455
  /**
@@ -11539,9 +11573,6 @@ type FillExtrusionLayerSpecification = {
11539
11573
  "fill-extrusion-line-width-transition"?: TransitionSpecification;
11540
11574
  "fill-extrusion-cast-shadows"?: boolean;
11541
11575
  };
11542
- /**
11543
- * @experimental This property is experimental and subject to change in future versions.
11544
- */
11545
11576
  "appearances"?: Array<AppearanceSpecification>;
11546
11577
  };
11547
11578
  /**
@@ -11611,9 +11642,6 @@ type BuildingLayerSpecification = {
11611
11642
  "building-flood-light-ground-attenuation"?: PropertyValueSpecification<number>;
11612
11643
  "building-flood-light-ground-attenuation-transition"?: TransitionSpecification;
11613
11644
  };
11614
- /**
11615
- * @experimental This property is experimental and subject to change in future versions.
11616
- */
11617
11645
  "appearances"?: Array<AppearanceSpecification>;
11618
11646
  };
11619
11647
  /**
@@ -11673,10 +11701,11 @@ type RasterLayerSpecification = {
11673
11701
  * @experimental This property is experimental and subject to change in future versions.
11674
11702
  */
11675
11703
  "raster-elevation-reference"?: "sea" | "ground" | ExpressionSpecification;
11704
+ /**
11705
+ * @experimental This property is experimental and subject to change in future versions.
11706
+ */
11707
+ "raster-allow-draping"?: boolean;
11676
11708
  };
11677
- /**
11678
- * @experimental This property is experimental and subject to change in future versions.
11679
- */
11680
11709
  "appearances"?: Array<AppearanceSpecification>;
11681
11710
  };
11682
11711
  /**
@@ -11714,9 +11743,6 @@ type RasterParticleLayerSpecification = {
11714
11743
  "raster-particle-elevation"?: PropertyValueSpecification<number>;
11715
11744
  "raster-particle-elevation-transition"?: TransitionSpecification;
11716
11745
  };
11717
- /**
11718
- * @experimental This property is experimental and subject to change in future versions.
11719
- */
11720
11746
  "appearances"?: Array<AppearanceSpecification>;
11721
11747
  };
11722
11748
  /**
@@ -11757,9 +11783,6 @@ type HillshadeLayerSpecification = {
11757
11783
  "hillshade-emissive-strength"?: PropertyValueSpecification<number>;
11758
11784
  "hillshade-emissive-strength-transition"?: TransitionSpecification;
11759
11785
  };
11760
- /**
11761
- * @experimental This property is experimental and subject to change in future versions.
11762
- */
11763
11786
  "appearances"?: Array<AppearanceSpecification>;
11764
11787
  };
11765
11788
  /**
@@ -11821,9 +11844,6 @@ type ModelLayerSpecification = {
11821
11844
  */
11822
11845
  "model-line-cutout-mode"?: "enabled" | "disabled" | "enabled-above-cutout" | ExpressionSpecification;
11823
11846
  };
11824
- /**
11825
- * @experimental This property is experimental and subject to change in future versions.
11826
- */
11827
11847
  "appearances"?: Array<AppearanceSpecification>;
11828
11848
  };
11829
11849
  /**
@@ -11861,9 +11881,6 @@ type BackgroundLayerSpecification = {
11861
11881
  "background-emissive-strength"?: PropertyValueSpecification<number>;
11862
11882
  "background-emissive-strength-transition"?: TransitionSpecification;
11863
11883
  };
11864
- /**
11865
- * @experimental This property is experimental and subject to change in future versions.
11866
- */
11867
11884
  "appearances"?: Array<AppearanceSpecification>;
11868
11885
  };
11869
11886
  /**
@@ -11902,9 +11919,6 @@ type SkyLayerSpecification = {
11902
11919
  "sky-opacity"?: PropertyValueSpecification<number>;
11903
11920
  "sky-opacity-transition"?: TransitionSpecification;
11904
11921
  };
11905
- /**
11906
- * @experimental This property is experimental and subject to change in future versions.
11907
- */
11908
11922
  "appearances"?: Array<AppearanceSpecification>;
11909
11923
  };
11910
11924
  /**
@@ -11925,9 +11939,6 @@ type SlotLayerSpecification = {
11925
11939
  "minzoom"?: never;
11926
11940
  "maxzoom"?: never;
11927
11941
  "filter"?: never;
11928
- /**
11929
- * @experimental This property is experimental and subject to change in future versions.
11930
- */
11931
11942
  "appearances"?: Array<AppearanceSpecification>;
11932
11943
  "layout"?: never;
11933
11944
  "paint"?: never;
@@ -11947,9 +11958,6 @@ type ClipLayerSpecification = {
11947
11958
  "clip-layer-scope"?: Array<string> | ExpressionSpecification;
11948
11959
  "visibility"?: "visible" | "none" | ExpressionSpecification;
11949
11960
  };
11950
- /**
11951
- * @experimental This property is experimental and subject to change in future versions.
11952
- */
11953
11961
  "appearances"?: Array<AppearanceSpecification>;
11954
11962
  "paint"?: never;
11955
11963
  };
package/dist/index.es.js CHANGED
@@ -1675,8 +1675,7 @@ var layer = {
1675
1675
  "supported-layer-types": [
1676
1676
  "symbol"
1677
1677
  ],
1678
- experimental: true,
1679
- doc: "Conditional styling applied to symbol layer features based on dynamic conditions. If multiple conditions are true, only the first matching appearance will be applied. Only properties marked with 'Works with appearances' are supported."
1678
+ doc: "Conditional styling applied to symbol layer features based on dynamic conditions. If multiple conditions are true, only the first matching appearance will be applied. Only properties marked with 'Works with appearances' are supported. Known issue: at the moment having both `appearances` and `text-variable-anchor` in the same layer doesn't work correctly."
1680
1679
  }
1681
1680
  };
1682
1681
  var appearance = {
@@ -3913,7 +3912,7 @@ var layout_symbol = {
3913
3912
  ]
3914
3913
  }
3915
3914
  ],
3916
- doc: "To increase the chance of placing high-priority labels on the map, you can provide an array of `text-anchor` locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the `text-radial-offset` or the two-dimensional `text-offset`.",
3915
+ doc: "To increase the chance of placing high-priority labels on the map, you can provide an array of `text-anchor` locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the `text-radial-offset` or the two-dimensional `text-offset`. Known issue: at the moment having both `appearances` and `text-variable-anchor` in the same layer doesn't work correctly.",
3917
3916
  "sdk-support": {
3918
3917
  "basic functionality": {
3919
3918
  js: "0.54.0",
@@ -8088,7 +8087,6 @@ var paint_line = {
8088
8087
  },
8089
8088
  "line-border-width": {
8090
8089
  type: "number",
8091
- "private": true,
8092
8090
  doc: "The width of the line border. A value of zero means no border.",
8093
8091
  "default": 0,
8094
8092
  minimum: 0,
@@ -8117,7 +8115,6 @@ var paint_line = {
8117
8115
  },
8118
8116
  "line-border-color": {
8119
8117
  type: "color",
8120
- "private": true,
8121
8118
  doc: "The color of the line border. If line-border-width is greater than zero and the alpha value of this color is 0 (default), the color for the border will be selected automatically based on the line color.",
8122
8119
  "default": "rgba(0, 0, 0, 0)",
8123
8120
  "use-theme": true,
@@ -8144,6 +8141,49 @@ var paint_line = {
8144
8141
  },
8145
8142
  "property-type": "data-driven"
8146
8143
  },
8144
+ "line-border-gradient": {
8145
+ type: "color",
8146
+ experimental: true,
8147
+ doc: "A gradient used to color the border of a line feature at various distances along its length. Defined using a `step` or `interpolate` expression which outputs a color for each corresponding `line-progress` input value. `line-progress` is a percentage of the line feature's total length as measured on the webmercator projected coordinate plane (a `number` between `0` and `1`). Takes precedence over `line-border-color`. Has no effect unless `line-border-width` is greater than zero. Can only be used with GeoJSON sources that specify `\"lineMetrics\": true`.",
8148
+ example: [
8149
+ "step",
8150
+ [
8151
+ "line-progress"
8152
+ ],
8153
+ "blue",
8154
+ 0.5,
8155
+ "gray"
8156
+ ],
8157
+ "use-theme": true,
8158
+ transition: false,
8159
+ requires: [
8160
+ {
8161
+ "!": "line-pattern"
8162
+ },
8163
+ {
8164
+ source: "geojson",
8165
+ has: {
8166
+ lineMetrics: true
8167
+ }
8168
+ }
8169
+ ],
8170
+ "sdk-support": {
8171
+ "basic functionality": {
8172
+ js: "3.28.0",
8173
+ android: "11.28.0",
8174
+ ios: "11.28.0"
8175
+ },
8176
+ "data-driven styling": {
8177
+ }
8178
+ },
8179
+ expression: {
8180
+ interpolated: true,
8181
+ parameters: [
8182
+ "line-progress"
8183
+ ]
8184
+ },
8185
+ "property-type": "color-ramp"
8186
+ },
8147
8187
  "line-occlusion-opacity": {
8148
8188
  type: "number",
8149
8189
  "default": 0,
@@ -9800,6 +9840,21 @@ var paint_raster = {
9800
9840
  interpolated: false
9801
9841
  },
9802
9842
  "property-type": "data-constant"
9843
+ },
9844
+ "raster-allow-draping": {
9845
+ type: "boolean",
9846
+ "default": true,
9847
+ experimental: true,
9848
+ doc: "Whether the raster layer is allowed to drape over terrain and globe. When disabled, the layer is rendered after all draped layers, which can change its position in the layer order. Disabling draping has a performance cost, since the terrain/globe geometry must be rendered again for each such layer.",
9849
+ transition: false,
9850
+ "property-type": "data-constant",
9851
+ "sdk-support": {
9852
+ "basic functionality": {
9853
+ js: "3.28.0",
9854
+ android: "11.28.0",
9855
+ ios: "11.28.0"
9856
+ }
9857
+ }
9803
9858
  }
9804
9859
  };
9805
9860
  var paint_hillshade = {
@@ -13190,7 +13245,9 @@ class ResolvedImage {
13190
13245
  return new ImageVariant(this.secondaryId, this.secondaryOptions);
13191
13246
  }
13192
13247
  static from(image) {
13193
- return typeof image === "string" ? ResolvedImage.build({ name: image }) : image;
13248
+ if (typeof image !== "string") return image;
13249
+ const resolved = ResolvedImage.build({ name: image });
13250
+ return resolved;
13194
13251
  }
13195
13252
  static build(primaryId, secondaryId, primaryOptions, secondaryOptions) {
13196
13253
  if (!primaryId || typeof primaryId === "object" && !("name" in primaryId)) return null;
@@ -15534,9 +15591,7 @@ class Config {
15534
15591
  }
15535
15592
  static parse(args, context) {
15536
15593
  let type = context.expectedType;
15537
- if (type === null || type === void 0) {
15538
- type = ValueType;
15539
- }
15594
+ type ?? (type = ValueType);
15540
15595
  if (args.length < 2 || args.length > 3) {
15541
15596
  return context.error(`Invalid number of arguments for 'config' expression.`);
15542
15597
  }
@@ -16493,112 +16548,6 @@ class AtInterpolated {
16493
16548
  }
16494
16549
  }
16495
16550
 
16496
- class In {
16497
- constructor(needle, haystack) {
16498
- this.type = BooleanType;
16499
- this.needle = needle;
16500
- this.haystack = haystack;
16501
- }
16502
- static parse(args, context) {
16503
- if (args.length !== 3) {
16504
- context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);
16505
- return null;
16506
- }
16507
- const needle = context.parse(args[1], 1, ValueType);
16508
- const haystack = context.parse(args[2], 2, ValueType);
16509
- if (!needle || !haystack) return null;
16510
- if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {
16511
- context.error(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(needle.type)} instead`);
16512
- return null;
16513
- }
16514
- return new In(needle, haystack);
16515
- }
16516
- evaluate(ctx) {
16517
- const needle = this.needle.evaluate(ctx);
16518
- const haystack = this.haystack.evaluate(ctx);
16519
- if (haystack == null) return false;
16520
- if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
16521
- throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
16522
- }
16523
- if (!isValidNativeType(haystack, ["string", "array"])) {
16524
- throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
16525
- }
16526
- return haystack.includes(needle);
16527
- }
16528
- eachChild(fn) {
16529
- fn(this.needle);
16530
- fn(this.haystack);
16531
- }
16532
- outputDefined() {
16533
- return true;
16534
- }
16535
- serialize() {
16536
- return ["in", this.needle.serialize(), this.haystack.serialize()];
16537
- }
16538
- }
16539
-
16540
- class IndexOf {
16541
- constructor(needle, haystack, fromIndex) {
16542
- this.type = NumberType;
16543
- this.needle = needle;
16544
- this.haystack = haystack;
16545
- this.fromIndex = fromIndex;
16546
- }
16547
- static parse(args, context) {
16548
- if (args.length <= 2 || args.length >= 5) {
16549
- context.error(`Expected 3 or 4 arguments, but found ${args.length - 1} instead.`);
16550
- return null;
16551
- }
16552
- const needle = context.parse(args[1], 1, ValueType);
16553
- const haystack = context.parse(args[2], 2, ValueType);
16554
- if (!needle || !haystack) return null;
16555
- if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {
16556
- context.error(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(needle.type)} instead`);
16557
- return null;
16558
- }
16559
- if (args.length === 4) {
16560
- const fromIndex = context.parse(args[3], 3, NumberType);
16561
- if (!fromIndex) return null;
16562
- return new IndexOf(needle, haystack, fromIndex);
16563
- } else {
16564
- return new IndexOf(needle, haystack);
16565
- }
16566
- }
16567
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16568
- evaluate(ctx) {
16569
- const needle = this.needle.evaluate(ctx);
16570
- const haystack = this.haystack.evaluate(ctx);
16571
- if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
16572
- throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
16573
- }
16574
- if (!isValidNativeType(haystack, ["string", "array"])) {
16575
- throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
16576
- }
16577
- if (this.fromIndex) {
16578
- const fromIndex = this.fromIndex.evaluate(ctx);
16579
- return haystack.indexOf(needle, fromIndex);
16580
- }
16581
- return haystack.indexOf(needle);
16582
- }
16583
- eachChild(fn) {
16584
- fn(this.needle);
16585
- fn(this.haystack);
16586
- if (this.fromIndex) {
16587
- fn(this.fromIndex);
16588
- }
16589
- }
16590
- outputDefined() {
16591
- return false;
16592
- }
16593
- serialize() {
16594
- if (this.fromIndex != null && this.fromIndex !== void 0) {
16595
- const fromIndex = this.fromIndex.serialize();
16596
- return ["index-of", this.needle.serialize(), this.haystack.serialize(), fromIndex];
16597
- }
16598
- return ["index-of", this.needle.serialize(), this.haystack.serialize()];
16599
- }
16600
- }
16601
-
16602
16551
  class Match {
16603
16552
  constructor(inputType, outputType, input, cases, outputs, otherwise) {
16604
16553
  this.inputType = inputType;
@@ -16821,38 +16770,6 @@ class Slice {
16821
16770
  }
16822
16771
  }
16823
16772
 
16824
- class Split {
16825
- constructor(str, delimiter) {
16826
- this.type = array$1(StringType);
16827
- this.str = str;
16828
- this.delimiter = delimiter;
16829
- }
16830
- static parse(args, context) {
16831
- if (args.length !== 3) {
16832
- return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);
16833
- }
16834
- const str = context.parse(args[1], 1, StringType);
16835
- const delimiter = context.parse(args[2], 2, StringType);
16836
- if (!str || !delimiter) return;
16837
- return new Split(str, delimiter);
16838
- }
16839
- evaluate(ctx) {
16840
- const str = this.str.evaluate(ctx);
16841
- const delimiter = this.delimiter.evaluate(ctx);
16842
- return str.split(delimiter);
16843
- }
16844
- eachChild(fn) {
16845
- fn(this.str);
16846
- fn(this.delimiter);
16847
- }
16848
- outputDefined() {
16849
- return false;
16850
- }
16851
- serialize() {
16852
- return ["split", this.str.serialize(), this.delimiter.serialize()];
16853
- }
16854
- }
16855
-
16856
16773
  function isComparableType(op, type) {
16857
16774
  if (op === "==" || op === "!=") {
16858
16775
  return type.kind === "boolean" || type.kind === "string" || type.kind === "number" || type.kind === "null" || type.kind === "value";
@@ -17160,8 +17077,6 @@ const expressions = {
17160
17077
  "collator": CollatorExpression,
17161
17078
  "format": FormatExpression,
17162
17079
  "image": ImageExpression,
17163
- "in": In,
17164
- "index-of": IndexOf,
17165
17080
  "interpolate": Interpolate,
17166
17081
  "interpolate-hcl": Interpolate,
17167
17082
  "interpolate-lab": Interpolate,
@@ -17182,8 +17097,7 @@ const expressions = {
17182
17097
  "var": Var,
17183
17098
  "within": Within,
17184
17099
  "distance": Distance,
17185
- "config": Config,
17186
- "split": Split
17100
+ "config": Config
17187
17101
  };
17188
17102
  function rgba(ctx, [r, g, b, a]) {
17189
17103
  r = r.evaluate(ctx);
@@ -17228,6 +17142,14 @@ function binarySearch(v, a, i, j) {
17228
17142
  function varargs(type) {
17229
17143
  return { type };
17230
17144
  }
17145
+ function assertNeedleHaystack(needle, haystack) {
17146
+ if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
17147
+ throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
17148
+ }
17149
+ if (!isValidNativeType(haystack, ["string", "array"])) {
17150
+ throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
17151
+ }
17152
+ }
17231
17153
  function hashString(str) {
17232
17154
  let hash = 0;
17233
17155
  if (str.length === 0) {
@@ -17777,6 +17699,47 @@ CompoundExpression.register(expressions, {
17777
17699
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
17778
17700
  (ctx, args) => args.map((arg) => toString(arg.evaluate(ctx))).join("")
17779
17701
  ],
17702
+ "split": [
17703
+ array$1(StringType),
17704
+ [StringType, StringType],
17705
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
17706
+ (ctx, [str, delimiter]) => str.evaluate(ctx).split(delimiter.evaluate(ctx))
17707
+ ],
17708
+ "in": [
17709
+ BooleanType,
17710
+ [ValueType, ValueType],
17711
+ (ctx, [needleExpr, haystackExpr]) => {
17712
+ const needle = needleExpr.evaluate(ctx);
17713
+ const haystack = haystackExpr.evaluate(ctx);
17714
+ if (haystack == null) return false;
17715
+ assertNeedleHaystack(needle, haystack);
17716
+ return haystack.includes(needle);
17717
+ }
17718
+ ],
17719
+ "index-of": {
17720
+ type: NumberType,
17721
+ overloads: [
17722
+ [
17723
+ [ValueType, ValueType],
17724
+ (ctx, [needleExpr, haystackExpr]) => {
17725
+ const needle = needleExpr.evaluate(ctx);
17726
+ const haystack = haystackExpr.evaluate(ctx);
17727
+ assertNeedleHaystack(needle, haystack);
17728
+ return haystack.indexOf(needle);
17729
+ }
17730
+ ],
17731
+ [
17732
+ [ValueType, ValueType, NumberType],
17733
+ (ctx, [needleExpr, haystackExpr, fromIndexExpr]) => {
17734
+ const needle = needleExpr.evaluate(ctx);
17735
+ const haystack = haystackExpr.evaluate(ctx);
17736
+ const fromIndex = fromIndexExpr.evaluate(ctx);
17737
+ assertNeedleHaystack(needle, haystack);
17738
+ return haystack.indexOf(needle, fromIndex);
17739
+ }
17740
+ ]
17741
+ ]
17742
+ },
17780
17743
  "resolved-locale": [
17781
17744
  StringType,
17782
17745
  [CollatorType],
@@ -19517,7 +19480,7 @@ class ParsingError {
19517
19480
  this.error = error;
19518
19481
  this.message = error.message;
19519
19482
  const match = error.message.match(LINE_NUMBER_RE);
19520
- this.line = match ? parseInt(match[1], 10) : 0;
19483
+ this.line = match && match[1] ? parseInt(match[1], 10) : 0;
19521
19484
  }
19522
19485
  }
19523
19486