@octostar/map-component 0.2.17 → 0.2.19

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.cjs CHANGED
@@ -86,38 +86,85 @@ function hasAltitudeData(feature) {
86
86
  }
87
87
  return false;
88
88
  }
89
+ function yieldToMain() {
90
+ const scheduler = globalThis.scheduler;
91
+ if (typeof (scheduler == null ? void 0 : scheduler.yield) === "function") {
92
+ return scheduler.yield();
93
+ }
94
+ const channelCtor = globalThis.MessageChannel;
95
+ if (typeof channelCtor === "function") {
96
+ return new Promise((resolve) => {
97
+ const channel = new channelCtor();
98
+ channel.port1.onmessage = () => {
99
+ channel.port1.close();
100
+ resolve();
101
+ };
102
+ channel.port2.postMessage(void 0);
103
+ });
104
+ }
105
+ return new Promise((resolve) => setTimeout(resolve, 0));
106
+ }
89
107
  const PRETTY_EXPORT_MAX_FEATURES = 1e4;
90
108
  const TARGET_PART_CHARS = 8 * 1024 * 1024;
91
- function featureCollectionBlobParts(collection, options) {
92
- const prettyMax = PRETTY_EXPORT_MAX_FEATURES;
93
- if (collection.features.length <= prettyMax) {
94
- return [JSON.stringify(collection, null, 2)];
95
- }
96
- const targetChars = TARGET_PART_CHARS;
97
- const { features, ...rest } = collection;
98
- const head = JSON.stringify(rest);
109
+ function createBlobPartCoalescer(targetChars) {
99
110
  const parts = [];
100
111
  let pending = [];
101
112
  let pendingChars = 0;
102
- const push = (piece) => {
103
- pending.push(piece);
104
- pendingChars += piece.length;
105
- if (pendingChars >= targetChars) {
106
- parts.push(pending.join(""));
107
- pending = [];
108
- pendingChars = 0;
113
+ return {
114
+ push(piece) {
115
+ pending.push(piece);
116
+ pendingChars += piece.length;
117
+ if (pendingChars >= targetChars) {
118
+ parts.push(pending.join(""));
119
+ pending = [];
120
+ pendingChars = 0;
121
+ }
122
+ },
123
+ finish() {
124
+ if (pending.length > 0) parts.push(pending.join(""));
125
+ return parts;
109
126
  }
110
127
  };
111
- push(head.slice(0, -1));
112
- push(head.length > 2 ? ',"features":[' : '"features":[');
128
+ }
129
+ function pushCollectionHead(coalescer, rest) {
130
+ const head = JSON.stringify(rest);
131
+ coalescer.push(head.slice(0, -1));
132
+ coalescer.push(head.length > 2 ? ',"features":[' : '"features":[');
133
+ }
134
+ function serializeFeatureAt(feature, index) {
135
+ return index === 0 ? JSON.stringify(feature) : "," + JSON.stringify(feature);
136
+ }
137
+ const DEFAULT_SLICE_BUDGET_MS = 12;
138
+ async function featureCollectionBlobPartsAsync(collection, options) {
139
+ var _a, _b, _c;
140
+ const prettyMax = (options == null ? void 0 : options.prettyMaxFeatures) ?? PRETTY_EXPORT_MAX_FEATURES;
141
+ const mapFeature = options == null ? void 0 : options.mapFeature;
142
+ const total = collection.features.length;
143
+ if (total <= prettyMax) {
144
+ const mapped = mapFeature ? { ...collection, features: collection.features.map(mapFeature) } : collection;
145
+ (_a = options == null ? void 0 : options.onProgress) == null ? void 0 : _a.call(options, total, total);
146
+ return [JSON.stringify(mapped, null, 2)];
147
+ }
148
+ const { features, ...rest } = collection;
149
+ const coalescer = createBlobPartCoalescer((options == null ? void 0 : options.targetPartChars) ?? TARGET_PART_CHARS);
150
+ const yieldFn = (options == null ? void 0 : options.yieldFn) ?? yieldToMain;
151
+ const budget = (options == null ? void 0 : options.sliceBudgetMs) ?? DEFAULT_SLICE_BUDGET_MS;
152
+ pushCollectionHead(coalescer, rest);
153
+ let sliceStart = performance.now();
113
154
  for (let i = 0; i < features.length; i++) {
114
- push(i === 0 ? JSON.stringify(features[i]) : "," + JSON.stringify(features[i]));
155
+ const feature = mapFeature ? mapFeature(features[i], i) : features[i];
156
+ coalescer.push(serializeFeatureAt(feature, i));
157
+ if (performance.now() - sliceStart >= budget) {
158
+ (_b = options == null ? void 0 : options.onProgress) == null ? void 0 : _b.call(options, i + 1, total);
159
+ await yieldFn();
160
+ sliceStart = performance.now();
161
+ }
115
162
  }
116
- push("]}");
117
- if (pending.length > 0) parts.push(pending.join(""));
118
- return parts;
163
+ coalescer.push("]}");
164
+ (_c = options == null ? void 0 : options.onProgress) == null ? void 0 : _c.call(options, total, total);
165
+ return coalescer.finish();
119
166
  }
120
- const ingestWorkerSource = '"use strict";(()=>{function p(e){let t=e.crs?.properties?.name,n=null;if(t){let r=t.match(/EPSG::?(\\d+)/i);r&&(n=`EPSG:${r[1]}`)}if(!n&&e.features.length>0){let r=w(e.features[0].geometry);if(r){let[s,a]=r;if(Math.abs(s)<=180&&Math.abs(a)<=90)return{sourceCRS:"EPSG:4326",needsReprojection:!1}}return{sourceCRS:null,needsReprojection:!1}}return{sourceCRS:n,needsReprojection:n!==null&&n!=="EPSG:4326"}}function w(e){if(!e)return null;switch(e.type){case"Point":return e.coordinates;case"MultiPoint":case"LineString":return e.coordinates[0];case"MultiLineString":case"Polygon":return e.coordinates[0]?.[0];case"MultiPolygon":return e.coordinates[0]?.[0]?.[0];default:return null}}function S(e){return e.geometry?.type==="LineString"?e.geometry.coordinates.some(n=>n.length>=3&&n[2]!==0):e.geometry?.type==="MultiLineString"?e.geometry.coordinates.some(n=>n.some(r=>r.length>=3&&r[2]!==0)):!1}function i(e){if(!e)return null;if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function b(e){return!!(e.startDate||e.startdate||e.start_date||e.start_time||e.date||e.timestamp||e.flightDate||e.time||e.datetime||e.endDate||e.enddate||e.end_date||e.end_time)}function I(e){let t=i(e.startDate)||i(e.startdate)||i(e.start_date)||i(e.start_time)||i(e.date)||i(e.timestamp)||i(e.flightDate)||i(e.time)||i(e.datetime),n=i(e.endDate)||i(e.enddate)||i(e.end_date)||i(e.end_time);return t&&n&&n<t&&([t,n]=[n,t]),{startDate:t,endDate:n}}function h(e){return"kind"in e&&e.kind==="ack"}function J(){let e=globalThis.crypto?.randomUUID?.bind(globalThis.crypto);return e?e():`f-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function D(e,t,n){switch(n.idStrategy){case"preserve":return e.id;case"layer-index":return e.id!==void 0&&e.id!==null?String(e.id):`${n.layerId}-f${t}`;case"uuid-fallback":return e.id?String(e.id):J()}}function C(e,t){if(Array.isArray(e)){if(typeof e[0]=="number"){let n=e[0],r=e[1];t[0]=Math.min(t[0],n),t[1]=Math.min(t[1],r),t[2]=Math.max(t[2],n),t[3]=Math.max(t[3],r);return}for(let n of e)C(n,t)}}function R(e,t){if(e){if(e.type==="GeometryCollection"){for(let n of e.geometries)R(n,t);return}C(e.coordinates,t)}}function M(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)R(n.geometry,t);return t.every(n=>isFinite(n))?t:null}function x(e,t){let n;if(e.type==="text")try{n=JSON.parse(e.text)}catch(d){return{kind:"error",code:"parse-error",message:d instanceof Error?d.message:"Invalid file"}}else n=e.data;if(n&&n.type==="Feature"&&(n={type:"FeatureCollection",features:[n]}),!n||n.type!=="FeatureCollection"||!Array.isArray(n.features))return{kind:"error",code:"invalid-format",message:"Invalid GeoJSON format"};if(t.emptyIsError&&n.features.length===0)return{kind:"error",code:"empty",message:"The file contains no features"};if(n["octostar:map"])return{kind:"enriched",data:n};let{sourceCRS:r,needsReprojection:s}=p(n),a=!1,o=!1,u=[];n.features.forEach((d,G)=>{let m=D(d,G,t);!o&&S(d)&&(o=!0);let g=d.properties||{};if(!b(g)){u.push(t.idStrategy==="preserve"?d:{...d,id:m});return}let{startDate:y,endDate:k}=I(g);(y||k)&&(a=!0),u.push({...d,...m!==void 0&&{id:m},properties:{...g,startDate:y?.toISOString()||null,endDate:k?.toISOString()||null}})});let c=n.properties?.layerMetadata;return{kind:"features",features:u,featureCount:u.length,bbox:M(u),hasTemporal:a,hasAltitude:o,reprojected:!1,sourceCRS:r,...s&&{needsReprojection:s},...c&&{layerMetadata:c}}}var O=5e3;function P(e,t){let n=Number.isNaN(t)?O:Math.max(1,Math.floor(t)),r=[];for(let s=0;s<e.length;s+=n)r.push(e.slice(s,s+n));return r}function f(e){if(e===void 0)return!1;if(typeof e=="number")return Number.isFinite(e)&&!Object.is(e,-0);if(e===null||typeof e!="object")return!0;if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(!f(e[t]))return!1;return!0}for(let t in e)if(!f(e[t]))return!1;return!0}function A(e){for(let t=0;t<e.length;t++)if(!f(e[t]))return e;try{return JSON.stringify(e)}catch{return e}}function E(e){let{kind:t,features:n,...r}=e;return r}async function N(e,t,n,r){let s;try{s=x(t,n)}catch(a){r.post({kind:"result",id:e,ok:!1,error:a instanceof Error?a.message:String(a)});return}if(s.kind!=="features"){r.post({kind:"result",id:e,ok:!0,result:s});return}try{let a=r.encode??A,o=P(s.features,r.chunkSize??O);r.post({kind:"head",id:e,summary:E(s)});let u=o.length>0?a(o[0]):null;for(let c=0;c<o.length;c++){let d=r.waitAck(c);r.post({kind:"chunk",id:e,seq:c,payload:u}),u=c+1<o.length?a(o[c+1]):null,await d}r.post({kind:"done",id:e,chunkCount:o.length})}catch(a){r.post({kind:"error",id:e,message:a instanceof Error?a.message:String(a)})}}var F=e=>self.postMessage(e),l=new Map;self.onmessage=async e=>{let t=e.data;if(h(t)){let o=`${t.id}:${t.seq}`,u=l.get(o);l.delete(o),u?.();return}let{id:n,source:r,options:s,tuning:a}=t;try{let o=r.type==="blob"?{type:"text",text:await r.blob.text()}:r;await N(n,o,s,{post:F,waitAck:u=>new Promise(c=>{l.set(`${n}:${u}`,c)}),...a?.chunkSize!==void 0&&{chunkSize:a.chunkSize},...a?.featureArrayChunks&&{encode:u=>u}})}catch(o){F({kind:"result",id:n,ok:!1,error:o instanceof Error?o.message:String(o)})}finally{l.forEach((o,u)=>{u.startsWith(`${n}:`)&&l.delete(u)})}};})();\n';
167
+ const ingestWorkerSource = '"use strict";(()=>{function b(e,t){let n=e.length,r=Math.max(0,t.max-(t.existing??0));return n<=r?{features:e,dropped:0,sourceCount:n}:{features:e.slice(0,r),dropped:n-r,sourceCount:n}}function S(e){let t=e.crs?.properties?.name,n=null;if(t){let r=t.match(/EPSG::?(\\d+)/i);r&&(n=`EPSG:${r[1]}`)}if(!n&&e.features.length>0){let r=G(e.features[0].geometry);if(r){let[s,a]=r;if(Math.abs(s)<=180&&Math.abs(a)<=90)return{sourceCRS:"EPSG:4326",needsReprojection:!1}}return{sourceCRS:null,needsReprojection:!1}}return{sourceCRS:n,needsReprojection:n!==null&&n!=="EPSG:4326"}}function G(e){if(!e)return null;switch(e.type){case"Point":return e.coordinates;case"MultiPoint":case"LineString":return e.coordinates[0];case"MultiLineString":case"Polygon":return e.coordinates[0]?.[0];case"MultiPolygon":return e.coordinates[0]?.[0]?.[0];default:return null}}function I(e){return e.geometry?.type==="LineString"?e.geometry.coordinates.some(n=>n.length>=3&&n[2]!==0):e.geometry?.type==="MultiLineString"?e.geometry.coordinates.some(n=>n.some(r=>r.length>=3&&r[2]!==0)):!1}function c(e){if(!e)return null;if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function h(e){return!!(e.startDate||e.startdate||e.start_date||e.start_time||e.date||e.timestamp||e.flightDate||e.time||e.datetime||e.endDate||e.enddate||e.end_date||e.end_time)}function F(e){let t=c(e.startDate)||c(e.startdate)||c(e.start_date)||c(e.start_time)||c(e.date)||c(e.timestamp)||c(e.flightDate)||c(e.time)||c(e.datetime),n=c(e.endDate)||c(e.enddate)||c(e.end_date)||c(e.end_time);return t&&n&&n<t&&([t,n]=[n,t]),{startDate:t,endDate:n}}function C(e){return"kind"in e&&e.kind==="ack"}function T(){let e=globalThis.crypto?.randomUUID?.bind(globalThis.crypto);return e?e():`f-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function _(e,t,n){switch(n.idStrategy){case"preserve":return e.id;case"layer-index":return e.id!==void 0&&e.id!==null?String(e.id):`${n.layerId}-f${t}`;case"uuid-fallback":return e.id?String(e.id):T()}}function x(e,t){if(Array.isArray(e)){if(typeof e[0]=="number"){let n=e[0],r=e[1];t[0]=Math.min(t[0],n),t[1]=Math.min(t[1],r),t[2]=Math.max(t[2],n),t[3]=Math.max(t[3],r);return}for(let n of e)x(n,t)}}function R(e,t){if(e){if(e.type==="GeometryCollection"){for(let n of e.geometries)R(n,t);return}x(e.coordinates,t)}}function D(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)R(n.geometry,t);return t.every(n=>isFinite(n))?t:null}function O(e,t){let n;if(e.type==="text")try{n=JSON.parse(e.text)}catch(d){return{kind:"error",code:"parse-error",message:d instanceof Error?d.message:"Invalid file"}}else n=e.data;if(n&&n.type==="Feature"&&(n={type:"FeatureCollection",features:[n]}),!n||n.type!=="FeatureCollection"||!Array.isArray(n.features))return{kind:"error",code:"invalid-format",message:"Invalid GeoJSON format"};if(t.emptyIsError&&n.features.length===0)return{kind:"error",code:"empty",message:"The file contains no features"};if(n["octostar:map"])return{kind:"enriched",data:n};let{sourceCRS:r,needsReprojection:s}=S(n),a=b(n.features,{max:t.maxFeatures??1/0}),o=!1,u=!1,i=[];a.features.forEach((d,w)=>{let f=_(d,w,t);!u&&I(d)&&(u=!0);let g=d.properties||{};if(!h(g)){i.push(t.idStrategy==="preserve"?d:{...d,id:f});return}let{startDate:y,endDate:k}=F(g);(y||k)&&(o=!0),i.push({...d,...f!==void 0&&{id:f},properties:{...g,startDate:y?.toISOString()||null,endDate:k?.toISOString()||null}})});let m=n.properties?.layerMetadata;return{kind:"features",features:i,featureCount:i.length,bbox:D(i),hasTemporal:o,hasAltitude:u,reprojected:!1,sourceCRS:r,...s&&{needsReprojection:s},...m&&{layerMetadata:m},...a.dropped>0&&{truncated:{droppedCount:a.dropped,sourceFeatureCount:a.sourceCount,maxFeatures:t.maxFeatures}}}}var N=5e3;function M(e,t){let n=Number.isNaN(t)?N:Math.max(1,Math.floor(t)),r=[];for(let s=0;s<e.length;s+=n)r.push(e.slice(s,s+n));return r}function p(e){if(e===void 0)return!1;if(typeof e=="number")return Number.isFinite(e)&&!Object.is(e,-0);if(e===null||typeof e!="object")return!0;if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(!p(e[t]))return!1;return!0}for(let t in e)if(!p(e[t]))return!1;return!0}function P(e){for(let t=0;t<e.length;t++)if(!p(e[t]))return e;try{return JSON.stringify(e)}catch{return e}}function J(e){let{kind:t,features:n,...r}=e;return r}async function A(e,t,n,r){let s;try{s=O(t,n)}catch(a){r.post({kind:"result",id:e,ok:!1,error:a instanceof Error?a.message:String(a)});return}if(s.kind!=="features"){r.post({kind:"result",id:e,ok:!0,result:s});return}try{let a=r.encode??P,o=M(s.features,r.chunkSize??N);r.post({kind:"head",id:e,summary:J(s)});let u=o.length>0?a(o[0]):null;for(let i=0;i<o.length;i++){let m=r.waitAck(i);r.post({kind:"chunk",id:e,seq:i,payload:u}),u=i+1<o.length?a(o[i+1]):null,await m}r.post({kind:"done",id:e,chunkCount:o.length})}catch(a){r.post({kind:"error",id:e,message:a instanceof Error?a.message:String(a)})}}var E=e=>self.postMessage(e),l=new Map;self.onmessage=async e=>{let t=e.data;if(C(t)){let o=`${t.id}:${t.seq}`,u=l.get(o);l.delete(o),u?.();return}let{id:n,source:r,options:s,tuning:a}=t;try{let o=r.type==="blob"?{type:"text",text:await r.blob.text()}:r;await A(n,o,s,{post:E,waitAck:u=>new Promise(i=>{l.set(`${n}:${u}`,i)}),...a?.chunkSize!==void 0&&{chunkSize:a.chunkSize},...a?.featureArrayChunks&&{encode:u=>u}})}catch(o){E({kind:"result",id:n,ok:!1,error:o instanceof Error?o.message:String(o)})}finally{l.forEach((o,u)=>{u.startsWith(`${n}:`)&&l.delete(u)})}};})();\n';
121
168
  proj4.defs("EPSG:27700", "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
122
169
  proj4.defs("EPSG:3857", "+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs");
123
170
  proj4.defs("EPSG:32630", "+proj=utm +zone=30 +datum=WGS84 +units=m +no_defs");
@@ -158,6 +205,55 @@ function reprojectGeometry(geometry, fromCRS) {
158
205
  coordinates: reprojectCoords(geomWithCoords.coordinates)
159
206
  };
160
207
  }
208
+ const DEFAULT_MAX_FEATURES_PER_LAYER = 2e5;
209
+ function resolveFeatureCap(value) {
210
+ if (value === void 0) return DEFAULT_MAX_FEATURES_PER_LAYER;
211
+ if (value === Infinity) return Infinity;
212
+ if (!Number.isFinite(value) || value < 1) {
213
+ console.warn(
214
+ `[map-editor] Ignoring maxFeaturesPerLayer=${String(value)} — expected a number >= 1 or Infinity. Falling back to ${DEFAULT_MAX_FEATURES_PER_LAYER}.`
215
+ );
216
+ return DEFAULT_MAX_FEATURES_PER_LAYER;
217
+ }
218
+ return Math.floor(value);
219
+ }
220
+ function capFeatures(features, options) {
221
+ const sourceCount = features.length;
222
+ const room = Math.max(0, options.max - (options.existing ?? 0));
223
+ if (sourceCount <= room) {
224
+ return { features, dropped: 0, sourceCount };
225
+ }
226
+ return {
227
+ features: features.slice(0, room),
228
+ dropped: sourceCount - room,
229
+ sourceCount
230
+ };
231
+ }
232
+ function formatCount(value) {
233
+ return value.toLocaleString("en-US");
234
+ }
235
+ function formatFeatureCapToast(info) {
236
+ const isRestore = info.source === "restore";
237
+ const variant = isRestore ? "destructive" : "default";
238
+ const withNote = (text) => isRestore ? `${text} Re-saving this map will persist only the loaded features.` : text;
239
+ const layerCount = info.layerCount ?? 1;
240
+ if (layerCount > 1) {
241
+ return {
242
+ title: "Feature limit reached",
243
+ description: withNote(
244
+ `${formatCount(layerCount)} layers were larger than the ${formatCount(info.max)}-feature limit; ${formatCount(info.dropped)} features in total were not loaded.`
245
+ ),
246
+ variant
247
+ };
248
+ }
249
+ return {
250
+ title: "Feature limit reached",
251
+ description: withNote(
252
+ `Only the first ${formatCount(info.kept)} of ${formatCount(info.sourceCount)} features were added to "${info.layerName}"; ${formatCount(info.dropped)} were skipped (per-layer limit).`
253
+ ),
254
+ variant
255
+ };
256
+ }
161
257
  function parseDate(value) {
162
258
  if (!value) return null;
163
259
  if (value instanceof Date) return value;
@@ -251,10 +347,11 @@ function runIngestPipeline(source, options) {
251
347
  return { kind: "enriched", data };
252
348
  }
253
349
  const { sourceCRS, needsReprojection } = detectSourceCRS(data);
350
+ const capped = capFeatures(data.features, { max: options.maxFeatures ?? Infinity });
254
351
  let hasTemporal = false;
255
352
  let hasAltitude = false;
256
353
  const features = [];
257
- data.features.forEach((f, index) => {
354
+ capped.features.forEach((f, index) => {
258
355
  const id = assignId(f, index, options);
259
356
  if (!hasAltitude && hasAltitudeData(f)) hasAltitude = true;
260
357
  const props = f.properties || {};
@@ -289,7 +386,14 @@ function runIngestPipeline(source, options) {
289
386
  reprojected: false,
290
387
  sourceCRS,
291
388
  ...needsReprojection && { needsReprojection },
292
- ...layerMetadata && { layerMetadata }
389
+ ...layerMetadata && { layerMetadata },
390
+ ...capped.dropped > 0 && {
391
+ truncated: {
392
+ droppedCount: capped.dropped,
393
+ sourceFeatureCount: capped.sourceCount,
394
+ maxFeatures: options.maxFeatures
395
+ }
396
+ }
293
397
  };
294
398
  }
295
399
  function decodeChunkPayload(payload) {
@@ -609,9 +713,9 @@ function createIngestProgressStore() {
609
713
  listeners.forEach((listener) => listener());
610
714
  };
611
715
  return {
612
- begin(label) {
716
+ begin(label, options) {
613
717
  const id = nextId++;
614
- entries.set(id, { label, received: 0, total: null });
718
+ entries.set(id, { label, received: 0, total: null, ...(options == null ? void 0 : options.verb) && { verb: options.verb } });
615
719
  notify();
616
720
  return {
617
721
  setTotal(total) {
@@ -707,7 +811,8 @@ function IngestProgressOverlay({
707
811
  className: "rounded-md border bg-background/90 px-3 py-1.5 text-xs text-muted-foreground shadow-md",
708
812
  children: [
709
813
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
710
- "Importing ",
814
+ entry.verb ?? "Importing",
815
+ " ",
711
816
  entry.label,
712
817
  "…",
713
818
  entry.total !== null ? ` ${entry.received.toLocaleString()} / ${entry.total.toLocaleString()} features` : ""
@@ -1106,15 +1211,28 @@ function collectLayerFeatures(layer, sources) {
1106
1211
  if (readOnly) pushAll(features, readOnly);
1107
1212
  return features;
1108
1213
  }
1109
- function stripInternalProperties(features, keep) {
1110
- return features.map((f) => ({
1111
- ...f,
1214
+ function countLayerFeatures(layer, stores) {
1215
+ var _a;
1216
+ if (layer.readOnly) return ((_a = stores.readOnlyFeatures.get(layer.id)) == null ? void 0 : _a.length) ?? 0;
1217
+ const hidden = stores.hiddenFeatures.get(layer.id);
1218
+ if (!hidden || hidden.length === 0) return layer.featureIds.length;
1219
+ if (layer.featureIds.length === 0) return hidden.length;
1220
+ const ids = new Set(layer.featureIds);
1221
+ let count = layer.featureIds.length;
1222
+ for (const feature of hidden) {
1223
+ if (!ids.has(String(feature.id))) count++;
1224
+ }
1225
+ return count;
1226
+ }
1227
+ function stripInternalPropertiesFromFeature(feature, keep) {
1228
+ return {
1229
+ ...feature,
1112
1230
  properties: Object.fromEntries(
1113
- Object.entries(f.properties ?? {}).filter(
1231
+ Object.entries(feature.properties ?? {}).filter(
1114
1232
  ([key]) => !key.startsWith("_") || ((keep == null ? void 0 : keep.has(key)) ?? false)
1115
1233
  )
1116
1234
  )
1117
- }));
1235
+ };
1118
1236
  }
1119
1237
  const ToastContext = react.createContext(null);
1120
1238
  function useToast() {
@@ -2248,6 +2366,32 @@ function DrawingToolbar({
2248
2366
  }
2249
2367
  );
2250
2368
  }
2369
+ const BUILT_IN_BASEMAP_IDS = ["streets", "satellite", "dark"];
2370
+ const BUILT_IN_NAMES = {
2371
+ streets: "Streets",
2372
+ satellite: "Satellite",
2373
+ dark: "Dark"
2374
+ };
2375
+ function resolveBasemapChoices(order, customBasemaps) {
2376
+ const describe = (id) => {
2377
+ if (BUILT_IN_BASEMAP_IDS.includes(id)) {
2378
+ return { id, name: BUILT_IN_NAMES[id] ?? id, builtIn: true };
2379
+ }
2380
+ const custom = customBasemaps == null ? void 0 : customBasemaps[id];
2381
+ if (!custom) return void 0;
2382
+ return { id, name: custom.name || id, builtIn: false };
2383
+ };
2384
+ if (order) {
2385
+ return order.map(describe).filter((choice) => !!choice);
2386
+ }
2387
+ const customIds = Object.keys(customBasemaps ?? {}).filter(
2388
+ (id) => !BUILT_IN_BASEMAP_IDS.includes(id)
2389
+ );
2390
+ return [
2391
+ ...BUILT_IN_BASEMAP_IDS.map((id) => describe(id)),
2392
+ ...customIds.map(describe).filter((choice) => !!choice)
2393
+ ];
2394
+ }
2251
2395
  const PRESET_COLORS$1 = [
2252
2396
  "#3b82f6",
2253
2397
  "#ef4444",
@@ -2598,6 +2742,7 @@ function LayersPanel({
2598
2742
  is3DTerrainEnabled = false,
2599
2743
  onToggle3DTerrain,
2600
2744
  onUpdateAltitudeDisplayMode,
2745
+ availableBasemaps,
2601
2746
  hideSatellite = false,
2602
2747
  hideDark = false,
2603
2748
  hideTerrain = false,
@@ -3604,7 +3749,7 @@ function LayersPanel({
3604
3749
  )
3605
3750
  ] }),
3606
3751
  !hideBasemapSwitcher && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
3607
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1 flex-1", children: MAP_STYLES.filter((style) => {
3752
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1 flex-1", children: (availableBasemaps ?? MAP_STYLES).filter((style) => {
3608
3753
  if (hideSatellite && style.id === "satellite") return false;
3609
3754
  if (hideDark && style.id === "dark") return false;
3610
3755
  return true;
@@ -6561,9 +6706,11 @@ function geometryEquals(a, b) {
6561
6706
  b.coordinates
6562
6707
  );
6563
6708
  }
6564
- function prepareFeaturesForLayer(input, caller) {
6709
+ function prepareFeaturesForLayer(input, caller, cap) {
6565
6710
  const logging = mapPerfLogEnabled();
6566
6711
  const started = logging ? performance.now() : 0;
6712
+ const capped = cap ? capFeatures(input, cap) : null;
6713
+ if (capped) input = capped.features;
6567
6714
  const count = input.length;
6568
6715
  const features = new Array(count);
6569
6716
  const featureIds = new Array(count);
@@ -6606,10 +6753,17 @@ function prepareFeaturesForLayer(input, caller) {
6606
6753
  withTemporalKeys: temporalCount,
6607
6754
  hasTemporal,
6608
6755
  reused,
6609
- copied: count - reused
6756
+ copied: count - reused,
6757
+ ...capped && capped.dropped > 0 && { dropped: capped.dropped }
6610
6758
  });
6611
6759
  }
6612
- return { features, featureIds, hasTemporal };
6760
+ return {
6761
+ features,
6762
+ featureIds,
6763
+ hasTemporal,
6764
+ dropped: (capped == null ? void 0 : capped.dropped) ?? 0,
6765
+ sourceCount: (capped == null ? void 0 : capped.sourceCount) ?? count
6766
+ };
6613
6767
  }
6614
6768
  function scanTemporalFeatures(features, resolveLayerId, out) {
6615
6769
  let foundTemporal = false;
@@ -7540,7 +7694,13 @@ function extract3DFlightPaths(features) {
7540
7694
  });
7541
7695
  return paths;
7542
7696
  }
7697
+ const CAP_NOTICE_INTERVAL_MS = 5e3;
7543
7698
  const DEFAULT_LOCAL_GLYPHS_URL = "/fonts/{fontstack}/{range}.pbf";
7699
+ function basemapInsertAnchor(map) {
7700
+ if (map.getLayer("satellite-layer")) return "satellite-layer";
7701
+ if (map.getLayer("custom-polygon-fill")) return "custom-polygon-fill";
7702
+ return void 0;
7703
+ }
7544
7704
  function createBaseStyle(options) {
7545
7705
  const sources = {};
7546
7706
  const layers = [
@@ -7658,6 +7818,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7658
7818
  enableProperties = true,
7659
7819
  autoOpenProperties = true,
7660
7820
  toastProvider,
7821
+ maxFeaturesPerLayer,
7822
+ onFeaturesTruncated,
7661
7823
  customGlobalMenuItems,
7662
7824
  extraLayerToolbarButtons,
7663
7825
  extraNewLayerButtons,
@@ -7687,6 +7849,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7687
7849
  const timelineUpdateTimerRef = react.useRef(null);
7688
7850
  const loadedBasemaps = react.useRef(new Set(enableSatellite ? ["satellite"] : []));
7689
7851
  const basemapLayerIds = react.useRef(new Map(enableSatellite ? [["satellite", ["satellite-layer"]]] : []));
7852
+ const availableBasemaps = react.useMemo(() => {
7853
+ const iconFor = (id) => {
7854
+ var _a;
7855
+ return ((_a = MAP_STYLES.find((style) => style.id === id)) == null ? void 0 : _a.icon) ?? lucideReact.Map;
7856
+ };
7857
+ return resolveBasemapChoices(basemapOrder, customBasemaps).map((choice) => ({
7858
+ id: choice.id,
7859
+ name: choice.name,
7860
+ icon: iconFor(choice.id)
7861
+ }));
7862
+ }, [basemapOrder, customBasemaps]);
7690
7863
  const loadingBasemaps = react.useRef(/* @__PURE__ */ new Set());
7691
7864
  const customBasemapRegistry = react.useRef(/* @__PURE__ */ new Map());
7692
7865
  const clusterPieManagers = react.useRef(/* @__PURE__ */ new Map());
@@ -7754,6 +7927,31 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
7754
7927
  const timelineStore = zustand.useStore(timelineStoreApi);
7755
7928
  const { toast: internalToast } = useToast();
7756
7929
  const toast = toastProvider ?? internalToast;
7930
+ const featureCap = react.useMemo(() => resolveFeatureCap(maxFeaturesPerLayer), [maxFeaturesPerLayer]);
7931
+ const featureCapRef = react.useRef(featureCap);
7932
+ featureCapRef.current = featureCap;
7933
+ const capNoticeRef = react.useRef(/* @__PURE__ */ new Map());
7934
+ const notifyFeatureCap = react.useCallback((info) => {
7935
+ if (onFeaturesTruncated) {
7936
+ onFeaturesTruncated(info);
7937
+ return;
7938
+ }
7939
+ if (info.source !== "restore") {
7940
+ const key = info.layerId ?? info.layerName;
7941
+ const now = Date.now();
7942
+ const last = capNoticeRef.current.get(key);
7943
+ if (last != null && now - last < CAP_NOTICE_INTERVAL_MS) return;
7944
+ capNoticeRef.current.set(key, now);
7945
+ }
7946
+ toast(formatFeatureCapToast(info));
7947
+ }, [onFeaturesTruncated, toast]);
7948
+ const countExisting = react.useCallback(
7949
+ (layer) => countLayerFeatures(layer, {
7950
+ hiddenFeatures: hiddenFeatures.current,
7951
+ readOnlyFeatures: readOnlyFeatures.current
7952
+ }),
7953
+ []
7954
+ );
7757
7955
  react.useEffect(() => {
7758
7956
  const handleError = (event) => {
7759
7957
  const msg = event.message || "";
@@ -9796,7 +9994,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9796
9994
  newLayer.source = `${prefix}${newLayer.source}`;
9797
9995
  }
9798
9996
  try {
9799
- const beforeLayer = mapInstance.getLayer("satellite-layer") ? "satellite-layer" : mapInstance.getLayer("custom-polygon-fill") ? "custom-polygon-fill" : void 0;
9997
+ const beforeLayer = basemapInsertAnchor(mapInstance);
9800
9998
  mapInstance.addLayer(newLayer, beforeLayer);
9801
9999
  addedLayerIds.push(prefixedLayerId);
9802
10000
  } catch (e) {
@@ -9825,7 +10023,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9825
10023
  console.error("Failed to load initial basemap:", err);
9826
10024
  });
9827
10025
  }
9828
- } else {
10026
+ } else if (mapInstance.getLayer("satellite-layer")) {
9829
10027
  mapInstance.setLayoutProperty("satellite-layer", "visibility", "visible");
9830
10028
  }
9831
10029
  if (customBasemaps) {
@@ -9849,12 +10047,12 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9849
10047
  type: "raster",
9850
10048
  source: sourceId,
9851
10049
  layout: { visibility: isInitialStyle ? "visible" : "none" }
9852
- }, "satellite-layer");
10050
+ }, basemapInsertAnchor(mapInstance));
9853
10051
  loadedBasemaps.current.add(id);
9854
10052
  basemapLayerIds.current.set(id, [layerId]);
9855
10053
  }
9856
10054
  } else if (definition.type === "vector" && definition.style) {
9857
- loadedBasemaps.current.add(id);
10055
+ if (baseMapStyle === id) loadedBasemaps.current.add(id);
9858
10056
  }
9859
10057
  }
9860
10058
  }
@@ -10441,16 +10639,22 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10441
10639
  clusterConfig: options == null ? void 0 : options.clusterConfig,
10442
10640
  altitudeDisplayMode: options == null ? void 0 : options.altitudeDisplayMode
10443
10641
  };
10642
+ let addedFeatures = (geojson == null ? void 0 : geojson.features) ?? [];
10643
+ let capDropped = 0;
10444
10644
  if (geojson) {
10645
+ const max = featureCapRef.current;
10445
10646
  if (options == null ? void 0 : options.readOnly) {
10446
- const prepared = prepareFeaturesForLayer(geojson.features, "addLayer");
10647
+ const prepared = prepareFeaturesForLayer(geojson.features, "addLayer", { max });
10447
10648
  readOnlyFeatures.current.set(layerId, prepared.features);
10448
10649
  layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
10449
10650
  newLayer.featureIds = prepared.featureIds;
10651
+ addedFeatures = prepared.features;
10652
+ capDropped = prepared.dropped;
10450
10653
  } else if (draw.current) {
10654
+ const capped = capFeatures(geojson.features, { max });
10451
10655
  isApiAddingRef.current = true;
10452
10656
  try {
10453
- const addedIds = geojson.features.map((f) => {
10657
+ const addedIds = capped.features.map((f) => {
10454
10658
  const ids = draw.current.add(f);
10455
10659
  return ids[0];
10456
10660
  });
@@ -10458,8 +10662,21 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10458
10662
  } finally {
10459
10663
  isApiAddingRef.current = false;
10460
10664
  }
10665
+ addedFeatures = capped.features;
10666
+ capDropped = capped.dropped;
10461
10667
  }
10462
10668
  }
10669
+ if (capDropped > 0) {
10670
+ notifyFeatureCap({
10671
+ layerId,
10672
+ layerName: name,
10673
+ kept: addedFeatures.length,
10674
+ dropped: capDropped,
10675
+ sourceCount: (geojson == null ? void 0 : geojson.features.length) ?? 0,
10676
+ max: featureCapRef.current,
10677
+ source: "api"
10678
+ });
10679
+ }
10463
10680
  if (newLayer.visible === false && !(options == null ? void 0 : options.readOnly) && draw.current && newLayer.featureIds.length > 0) {
10464
10681
  const features = newLayer.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
10465
10682
  hiddenFeatures.current.set(layerId, features);
@@ -10477,9 +10694,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10477
10694
  updateFeatureCount();
10478
10695
  scheduleTimelineUpdate();
10479
10696
  scheduleSync();
10480
- if (!(options == null ? void 0 : options.skipFit) && geojson && geojson.features.length > 0 && map.current) {
10697
+ if (!(options == null ? void 0 : options.skipFit) && addedFeatures.length > 0 && map.current) {
10481
10698
  try {
10482
- const bbox = turf__namespace.bbox(geojson);
10699
+ const bbox = turf__namespace.bbox(
10700
+ capDropped > 0 ? { type: "FeatureCollection", features: addedFeatures } : geojson
10701
+ );
10483
10702
  if (bbox.every((v) => isFinite(v))) {
10484
10703
  map.current.fitBounds(
10485
10704
  [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
@@ -10572,7 +10791,21 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10572
10791
  if (options == null ? void 0 : options.recordHistory) saveStateForUndo("add features");
10573
10792
  if (layer.readOnly) {
10574
10793
  const existing = readOnlyFeatures.current.get(layerId) || [];
10575
- const prepared = prepareFeaturesForLayer(features, "addFeatures");
10794
+ const prepared = prepareFeaturesForLayer(features, "addFeatures", {
10795
+ max: featureCapRef.current,
10796
+ existing: existing.length
10797
+ });
10798
+ if (prepared.dropped > 0) {
10799
+ notifyFeatureCap({
10800
+ layerId,
10801
+ layerName: layer.name,
10802
+ kept: prepared.features.length,
10803
+ dropped: prepared.dropped,
10804
+ sourceCount: prepared.sourceCount,
10805
+ max: featureCapRef.current,
10806
+ source: "api"
10807
+ });
10808
+ }
10576
10809
  const layerHasTemporal = (((_a = layerTemporalCacheRef.current.get(layerId)) == null ? void 0 : _a.hasTemporal) ?? false) || prepared.hasTemporal;
10577
10810
  const combined = [...existing, ...prepared.features];
10578
10811
  readOnlyFeatures.current.set(layerId, combined);
@@ -10592,9 +10825,24 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10592
10825
  }
10593
10826
  if (!draw.current) return [];
10594
10827
  const addedIds = [];
10828
+ const cappedForDraw = capFeatures(features, {
10829
+ max: featureCapRef.current,
10830
+ existing: countExisting(layer)
10831
+ });
10832
+ if (cappedForDraw.dropped > 0) {
10833
+ notifyFeatureCap({
10834
+ layerId,
10835
+ layerName: layer.name,
10836
+ kept: cappedForDraw.features.length,
10837
+ dropped: cappedForDraw.dropped,
10838
+ sourceCount: cappedForDraw.sourceCount,
10839
+ max: featureCapRef.current,
10840
+ source: "api"
10841
+ });
10842
+ }
10595
10843
  isApiAddingRef.current = true;
10596
10844
  try {
10597
- features.forEach((f) => {
10845
+ cappedForDraw.features.forEach((f) => {
10598
10846
  const { startDate, endDate } = normalizeTemporalProperties(f.properties || {});
10599
10847
  const normalizedFeature = {
10600
10848
  ...f,
@@ -10703,12 +10951,27 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10703
10951
  return { type: "FeatureCollection", features: cleanedFeatures };
10704
10952
  },
10705
10953
  importGeoJSON: (layerId, geojson) => {
10706
- const layer = layers.find((l) => l.id === layerId);
10954
+ const layer = layersRef.current.find((l) => l.id === layerId);
10707
10955
  if (!layer || !draw.current || !isMapLoaded) return [];
10708
10956
  const addedIds = [];
10957
+ const capped = capFeatures(geojson.features, {
10958
+ max: featureCapRef.current,
10959
+ existing: countExisting(layer)
10960
+ });
10961
+ if (capped.dropped > 0) {
10962
+ notifyFeatureCap({
10963
+ layerId,
10964
+ layerName: layer.name,
10965
+ kept: capped.features.length,
10966
+ dropped: capped.dropped,
10967
+ sourceCount: capped.sourceCount,
10968
+ max: featureCapRef.current,
10969
+ source: "api"
10970
+ });
10971
+ }
10709
10972
  isApiAddingRef.current = true;
10710
10973
  try {
10711
- geojson.features.forEach((f) => {
10974
+ capped.features.forEach((f) => {
10712
10975
  const { startDate, endDate } = normalizeTemporalProperties(f.properties || {});
10713
10976
  const normalizedFeature = {
10714
10977
  ...f,
@@ -10764,7 +11027,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10764
11027
  type: "raster",
10765
11028
  source: sourceId,
10766
11029
  layout: { visibility: "none" }
10767
- }, "satellite-layer");
11030
+ }, basemapInsertAnchor(map.current));
10768
11031
  loadedBasemaps.current.add(id);
10769
11032
  basemapLayerIds.current.set(id, [layerId]);
10770
11033
  }
@@ -10812,9 +11075,20 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10812
11075
  updateReadOnlyLayer: (layerId, features) => {
10813
11076
  const layer = layersRef.current.find((l) => l.id === layerId);
10814
11077
  if (!layer || !layer.readOnly || !isMapLoadedRef.current) return false;
10815
- const prepared = prepareFeaturesForLayer(features, "updateReadOnlyLayer");
11078
+ const prepared = prepareFeaturesForLayer(features, "updateReadOnlyLayer", { max: featureCapRef.current });
11079
+ if (prepared.dropped > 0) {
11080
+ notifyFeatureCap({
11081
+ layerId,
11082
+ layerName: layer.name,
11083
+ kept: prepared.features.length,
11084
+ dropped: prepared.dropped,
11085
+ sourceCount: prepared.sourceCount,
11086
+ max: featureCapRef.current,
11087
+ source: "api"
11088
+ });
11089
+ }
10816
11090
  readOnlyFeatures.current.set(layerId, prepared.features);
10817
- layerTemporalCacheRef.current.set(layerId, { featureCount: features.length, hasTemporal: prepared.hasTemporal });
11091
+ layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
10818
11092
  if (prepared.hasTemporal) {
10819
11093
  scheduleTimelineUpdate();
10820
11094
  }
@@ -10830,9 +11104,20 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10830
11104
  },
10831
11105
  setLayerData: (name, geojson, options) => {
10832
11106
  if (!isMapLoadedRef.current) return "";
10833
- const prepared = prepareFeaturesForLayer(geojson.features, "setLayerData");
11107
+ const prepared = prepareFeaturesForLayer(geojson.features, "setLayerData", { max: featureCapRef.current });
10834
11108
  const newFeatureIds = prepared.featureIds;
10835
11109
  const layerId = `managed-${name}`;
11110
+ if (prepared.dropped > 0) {
11111
+ notifyFeatureCap({
11112
+ layerId,
11113
+ layerName: name,
11114
+ kept: prepared.features.length,
11115
+ dropped: prepared.dropped,
11116
+ sourceCount: prepared.sourceCount,
11117
+ max: featureCapRef.current,
11118
+ source: "api"
11119
+ });
11120
+ }
10836
11121
  readOnlyFeatures.current.set(layerId, prepared.features);
10837
11122
  layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
10838
11123
  const buildLayerObj = (existing) => {
@@ -10882,9 +11167,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
10882
11167
  });
10883
11168
  updateFeatureCount();
10884
11169
  scheduleSync();
10885
- if ((options == null ? void 0 : options.fitPadding) != null && geojson.features.length > 0 && map.current) {
11170
+ if ((options == null ? void 0 : options.fitPadding) != null && prepared.features.length > 0 && map.current) {
10886
11171
  try {
10887
- const bbox = turf__namespace.bbox(geojson);
11172
+ const bbox = turf__namespace.bbox(
11173
+ prepared.dropped > 0 ? { type: "FeatureCollection", features: prepared.features } : geojson
11174
+ );
10888
11175
  if (bbox.every((v) => isFinite(v))) {
10889
11176
  map.current.fitBounds(
10890
11177
  [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
@@ -11901,11 +12188,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11901
12188
  }
11902
12189
  }, []);
11903
12190
  moveLabelsBeforeBasemapSymbolsRef.current = moveLabelsBeforeBasemapSymbols;
11904
- const loadBasemapStyle = react.useCallback(async (styleName) => {
12191
+ const loadBasemapStyle = react.useCallback(async (styleName, overrideStyleUrl) => {
11905
12192
  if (!map.current) return [];
11906
12193
  const mapInstance = map.current;
11907
12194
  const prefix = BASEMAP_LAYER_PREFIXES[styleName] || `${styleName}-`;
11908
- const styleUrl = EXTERNAL_STYLE_URLS[styleName];
12195
+ const styleUrl = overrideStyleUrl || EXTERNAL_STYLE_URLS[styleName];
11909
12196
  if (!styleUrl) {
11910
12197
  console.warn(`No external style URL for: ${styleName}`);
11911
12198
  return [];
@@ -11955,7 +12242,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
11955
12242
  newLayer.source = `${prefix}${newLayer.source}`;
11956
12243
  }
11957
12244
  try {
11958
- const beforeLayer = mapInstance.getLayer("satellite-layer") ? "satellite-layer" : mapInstance.getLayer("custom-polygon-fill") ? "custom-polygon-fill" : void 0;
12245
+ const beforeLayer = basemapInsertAnchor(mapInstance);
11959
12246
  mapInstance.addLayer(newLayer, beforeLayer);
11960
12247
  addedLayerIds.push(prefixedLayerId);
11961
12248
  } catch (e) {
@@ -12007,10 +12294,16 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
12007
12294
  type: "raster",
12008
12295
  source: sourceId,
12009
12296
  layout: { visibility: "none" }
12010
- }, "satellite-layer");
12297
+ }, basemapInsertAnchor(mapInstance));
12011
12298
  }
12012
12299
  loadedBasemaps.current.add(style);
12013
12300
  basemapLayerIds.current.set(style, [layerId]);
12301
+ } else if (customDef.type === "vector" && typeof customDef.style === "string") {
12302
+ loadingBasemaps.current.add(style);
12303
+ const layerIds = await loadBasemapStyle(style, customDef.style);
12304
+ basemapLayerIds.current.set(style, layerIds);
12305
+ loadedBasemaps.current.add(style);
12306
+ loadingBasemaps.current.delete(style);
12014
12307
  }
12015
12308
  }
12016
12309
  } else if (!loadedBasemaps.current.has(style) && !loadingBasemaps.current.has(style)) {
@@ -13193,9 +13486,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13193
13486
  source.setData({ type: "FeatureCollection", features });
13194
13487
  }
13195
13488
  }, [measurePoints, measureMode, isMapLoaded]);
13196
- const handleSaveLayerGeoJSON = react.useCallback((layerId) => {
13489
+ const [ingestProgressStore] = react.useState(createIngestProgressStore);
13490
+ const exportInFlightRef = react.useRef(false);
13491
+ const handleSaveLayerGeoJSON = react.useCallback(async (layerId) => {
13197
13492
  const layer = layers.find((l) => l.id === layerId);
13198
- if (!layer) return;
13493
+ if (!layer || exportInFlightRef.current) return;
13199
13494
  const features = collectLayerFeatures(layer, {
13200
13495
  getDrawFeature: (id) => {
13201
13496
  var _a;
@@ -13210,17 +13505,30 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13210
13505
  if (layer.traceConfig) layerMetadata.traceConfig = layer.traceConfig;
13211
13506
  if (layer.heatmapConfig) layerMetadata.heatmapConfig = layer.heatmapConfig;
13212
13507
  if (layer.visualConfig) layerMetadata.visualConfig = layer.visualConfig;
13213
- const cleanedFeatures = stripInternalProperties(features);
13214
13508
  const geojson = {
13215
13509
  type: "FeatureCollection",
13216
- features: cleanedFeatures,
13510
+ features,
13217
13511
  properties: {
13218
13512
  layerMetadata
13219
13513
  }
13220
13514
  };
13221
- const blob = new Blob(featureCollectionBlobParts(geojson), { type: "application/json" });
13222
- downloadBlob(blob, `${layer.name.replace(/[^a-z0-9]/gi, "_")}.geojson`);
13223
- }, [layers]);
13515
+ exportInFlightRef.current = true;
13516
+ const progress = ingestProgressStore.begin(layer.name, { verb: "Preparing download" });
13517
+ progress.setTotal(features.length);
13518
+ try {
13519
+ const parts = await featureCollectionBlobPartsAsync(geojson, {
13520
+ mapFeature: (f) => stripInternalPropertiesFromFeature(f),
13521
+ onProgress: (done) => progress.update(done)
13522
+ });
13523
+ downloadBlob(
13524
+ new Blob(parts, { type: "application/json" }),
13525
+ `${layer.name.replace(/[^a-z0-9]/gi, "_")}.geojson`
13526
+ );
13527
+ } finally {
13528
+ progress.end();
13529
+ exportInFlightRef.current = false;
13530
+ }
13531
+ }, [layers, ingestProgressStore]);
13224
13532
  const handleLoadLayerGeoJSON = react.useCallback((layerId) => {
13225
13533
  const input = fileInputRef.current;
13226
13534
  if (!input) return;
@@ -13235,7 +13543,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13235
13543
  input.dataset.createNewLayer = "true";
13236
13544
  input.click();
13237
13545
  }, []);
13238
- const buildEnrichedGeoJSON = react.useCallback(() => {
13546
+ const buildEnrichedExport = react.useCallback(() => {
13239
13547
  const allFeatures = [];
13240
13548
  const layerStates = [];
13241
13549
  layers.forEach((layer, idx) => {
@@ -13260,7 +13568,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13260
13568
  const { id: _id, featureIds: _fids, hasAltitudeData: _alt, ...persistable } = layer;
13261
13569
  layerStates.push({ index: idx, ...persistable });
13262
13570
  });
13263
- const cleanedFeatures = stripInternalProperties(allFeatures, ENRICHED_EXPORT_KEEP_KEYS);
13571
+ const rawCount = allFeatures.length;
13264
13572
  let viewport;
13265
13573
  if (map.current && isMapLoaded) {
13266
13574
  const c = map.current.getCenter();
@@ -13276,17 +13584,35 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13276
13584
  ...hostState
13277
13585
  };
13278
13586
  return {
13279
- type: "FeatureCollection",
13280
- features: [...cleanedFeatures, ...extraFeatures],
13281
- "octostar:map": octostarMap
13587
+ collection: {
13588
+ type: "FeatureCollection",
13589
+ features: [...allFeatures, ...extraFeatures],
13590
+ "octostar:map": octostarMap
13591
+ },
13592
+ mapFeature: (feature, index) => index < rawCount ? stripInternalPropertiesFromFeature(feature, ENRICHED_EXPORT_KEEP_KEYS) : feature
13282
13593
  };
13283
13594
  }, [layers, isMapLoaded, getAdditionalSaveState]);
13284
- const handleSaveAllGeoJSON = react.useCallback(() => {
13285
- if (!draw.current) return;
13286
- const geojson = buildEnrichedGeoJSON();
13287
- const blob = new Blob(featureCollectionBlobParts(geojson), { type: "application/geo+json" });
13288
- downloadBlob(blob, "map_export.geojson");
13289
- }, [buildEnrichedGeoJSON]);
13595
+ const buildEnrichedGeoJSON = react.useCallback(() => {
13596
+ const { collection, mapFeature } = buildEnrichedExport();
13597
+ return { ...collection, features: collection.features.map(mapFeature) };
13598
+ }, [buildEnrichedExport]);
13599
+ const handleSaveAllGeoJSON = react.useCallback(async () => {
13600
+ if (!draw.current || exportInFlightRef.current) return;
13601
+ const { collection, mapFeature } = buildEnrichedExport();
13602
+ exportInFlightRef.current = true;
13603
+ const progress = ingestProgressStore.begin("map_export.geojson", { verb: "Preparing download" });
13604
+ progress.setTotal(collection.features.length);
13605
+ try {
13606
+ const parts = await featureCollectionBlobPartsAsync(collection, {
13607
+ mapFeature,
13608
+ onProgress: (done) => progress.update(done)
13609
+ });
13610
+ downloadBlob(new Blob(parts, { type: "application/geo+json" }), "map_export.geojson");
13611
+ } finally {
13612
+ progress.end();
13613
+ exportInFlightRef.current = false;
13614
+ }
13615
+ }, [buildEnrichedExport, ingestProgressStore]);
13290
13616
  const handleSearchAndAddToNewLayer = react.useCallback(async () => {
13291
13617
  if (!onSearchEngineRequest || !map.current || !draw.current) return;
13292
13618
  const mapInstance = map.current;
@@ -13319,10 +13645,16 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13319
13645
  });
13320
13646
  if (result && result.features && result.features.length > 0) {
13321
13647
  saveStateForUndo();
13648
+ const activeId = activeEditingLayerIdRef.current;
13649
+ const activeLayer = activeId ? layersRef.current.find((l) => l.id === activeId && !l.readOnly) : null;
13650
+ const capped = capFeatures(result.features, {
13651
+ max: featureCapRef.current,
13652
+ existing: activeLayer ? countExisting(activeLayer) : 0
13653
+ });
13322
13654
  const addedIds = [];
13323
13655
  isApiAddingRef.current = true;
13324
13656
  try {
13325
- result.features.forEach((f) => {
13657
+ capped.features.forEach((f) => {
13326
13658
  const { startDate, endDate } = normalizeTemporalProperties(f.properties || {});
13327
13659
  const normalizedFeature = {
13328
13660
  ...f,
@@ -13338,17 +13670,19 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13338
13670
  } finally {
13339
13671
  isApiAddingRef.current = false;
13340
13672
  }
13341
- const activeId = activeEditingLayerIdRef.current;
13342
- const activeLayer = activeId ? layersRef.current.find((l) => l.id === activeId && !l.readOnly) : null;
13673
+ let targetLayerId;
13674
+ let targetLayerName;
13343
13675
  if (activeLayer) {
13344
13676
  activeLayer.featureIds = [...activeLayer.featureIds, ...addedIds];
13345
13677
  setLayers([...layersRef.current]);
13678
+ targetLayerId = activeLayer.id;
13679
+ targetLayerName = activeLayer.name;
13346
13680
  toast({
13347
13681
  title: "Features added",
13348
- description: `Added ${result.features.length} features to "${activeLayer.name}"`
13682
+ description: `Added ${addedIds.length} features to "${activeLayer.name}"`
13349
13683
  });
13350
13684
  } else {
13351
- const layerName = `${result.features.length} workspace features`;
13685
+ const layerName = `${addedIds.length} workspace features`;
13352
13686
  const newLayerId = `layer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
13353
13687
  const newLayer = {
13354
13688
  id: newLayerId,
@@ -13359,9 +13693,22 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13359
13693
  layersRef.current = [...layersRef.current, newLayer];
13360
13694
  setLayers(layersRef.current);
13361
13695
  setActiveEditingLayerId(newLayerId);
13696
+ targetLayerId = newLayerId;
13697
+ targetLayerName = layerName;
13362
13698
  toast({
13363
13699
  title: "Layer created",
13364
- description: `Added ${result.features.length} features to "${layerName}"`
13700
+ description: `Added ${addedIds.length} features to "${layerName}"`
13701
+ });
13702
+ }
13703
+ if (capped.dropped > 0) {
13704
+ notifyFeatureCap({
13705
+ layerId: targetLayerId,
13706
+ layerName: targetLayerName,
13707
+ kept: addedIds.length,
13708
+ dropped: capped.dropped,
13709
+ sourceCount: capped.sourceCount,
13710
+ max: featureCapRef.current,
13711
+ source: "search"
13365
13712
  });
13366
13713
  }
13367
13714
  updateFeatureCount();
@@ -13375,7 +13722,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13375
13722
  variant: "destructive"
13376
13723
  });
13377
13724
  }
13378
- }, [onSearchEngineRequest, saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, toast]);
13725
+ }, [onSearchEngineRequest, saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, toast, notifyFeatureCap]);
13379
13726
  const restoreEnrichedGeoJSON = react.useCallback((enriched) => {
13380
13727
  var _a;
13381
13728
  const mapState = enriched["octostar:map"];
@@ -13398,9 +13745,22 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13398
13745
  });
13399
13746
  const sortedLayers = [...mapState.layers].sort((a, b) => a.index - b.index);
13400
13747
  const newLayers = [];
13748
+ let restoreDropped = 0;
13749
+ let restoreSourceCount = 0;
13750
+ let restoreKept = 0;
13751
+ let truncatedLayerCount = 0;
13752
+ let firstTruncatedLayer = "";
13401
13753
  for (const ls of sortedLayers) {
13402
13754
  if (((_a = ls.metadata) == null ? void 0 : _a.dataViewing) === true) continue;
13403
- const rawFeatures = featuresByIndex.get(ls.index) ?? [];
13755
+ const capped = capFeatures(featuresByIndex.get(ls.index) ?? [], { max: featureCapRef.current });
13756
+ const rawFeatures = capped.features;
13757
+ if (capped.dropped > 0) {
13758
+ restoreDropped += capped.dropped;
13759
+ restoreSourceCount += capped.sourceCount;
13760
+ restoreKept += rawFeatures.length;
13761
+ truncatedLayerCount += 1;
13762
+ if (!firstTruncatedLayer) firstTruncatedLayer = ls.name;
13763
+ }
13404
13764
  const normalized = rawFeatures.map((f) => {
13405
13765
  const cleanProps = Object.fromEntries(
13406
13766
  Object.entries(f.properties || {}).filter(([k]) => !k.startsWith("_"))
@@ -13462,7 +13822,18 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13462
13822
  title: "Map restored",
13463
13823
  description: `Restored ${newLayers.length} layers with ${totalFeatures} features`
13464
13824
  });
13465
- }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, onMapStateLoaded, toast]);
13825
+ if (restoreDropped > 0) {
13826
+ notifyFeatureCap({
13827
+ layerName: firstTruncatedLayer,
13828
+ kept: restoreKept,
13829
+ dropped: restoreDropped,
13830
+ sourceCount: restoreSourceCount,
13831
+ max: featureCapRef.current,
13832
+ source: "restore",
13833
+ layerCount: truncatedLayerCount
13834
+ });
13835
+ }
13836
+ }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, onMapStateLoaded, toast, notifyFeatureCap]);
13466
13837
  restoreEnrichedGeoJSONRef.current = restoreEnrichedGeoJSON;
13467
13838
  const handleWorkspaceLoad = react.useCallback(async () => {
13468
13839
  if (!onWorkspaceLoad) return;
@@ -13475,12 +13846,24 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13475
13846
  }
13476
13847
  saveStateForUndo();
13477
13848
  const layerId = `layer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
13478
- const prepared = prepareFeaturesForLayer(result.features, "workspaceLoad");
13849
+ const layerName = "Loaded from workspace";
13850
+ const prepared = prepareFeaturesForLayer(result.features, "workspaceLoad", { max: featureCapRef.current });
13851
+ if (prepared.dropped > 0) {
13852
+ notifyFeatureCap({
13853
+ layerId,
13854
+ layerName,
13855
+ kept: prepared.features.length,
13856
+ dropped: prepared.dropped,
13857
+ sourceCount: prepared.sourceCount,
13858
+ max: featureCapRef.current,
13859
+ source: "workspace"
13860
+ });
13861
+ }
13479
13862
  readOnlyFeatures.current.set(layerId, prepared.features);
13480
13863
  layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
13481
13864
  const newLayer = {
13482
13865
  id: layerId,
13483
- name: "Loaded from workspace",
13866
+ name: layerName,
13484
13867
  visible: true,
13485
13868
  featureIds: prepared.featureIds,
13486
13869
  readOnly: true
@@ -13578,20 +13961,23 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13578
13961
  duration: 1e3
13579
13962
  });
13580
13963
  }, [layers, toast]);
13581
- const [ingestProgressStore] = react.useState(createIngestProgressStore);
13582
13964
  const ingestWithProgress = react.useCallback(async (label, input, options) => {
13583
13965
  const progress = ingestProgressStore.begin(label);
13584
13966
  try {
13585
- return await getSharedIngestClient().ingest(input, options, {
13586
- onHead: (summary) => progress.setTotal(summary.featureCount),
13587
- onProgress: (received) => progress.update(received)
13588
- });
13967
+ return await getSharedIngestClient().ingest(
13968
+ input,
13969
+ { ...options, maxFeatures: featureCapRef.current },
13970
+ {
13971
+ onHead: (summary) => progress.setTotal(summary.featureCount),
13972
+ onProgress: (received) => progress.update(received)
13973
+ }
13974
+ );
13589
13975
  } finally {
13590
13976
  progress.end();
13591
13977
  }
13592
13978
  }, [ingestProgressStore]);
13593
13979
  const loadGeoJSONFile = react.useCallback(async (file, requestedTargetLayerId, createNewLayer) => {
13594
- var _a;
13980
+ var _a, _b, _c;
13595
13981
  let result;
13596
13982
  try {
13597
13983
  result = await ingestWithProgress(file.name, file, {
@@ -13641,7 +14027,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13641
14027
  data: { type: "FeatureCollection", features: normalizedFeatures },
13642
14028
  file,
13643
14029
  reprojected,
13644
- sourceCRS: sourceCRS ?? void 0
14030
+ sourceCRS: sourceCRS ?? void 0,
14031
+ ...result.truncated && { truncated: result.truncated }
13645
14032
  }) === true) {
13646
14033
  return;
13647
14034
  }
@@ -13661,6 +14048,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13661
14048
  readOnlyFeatures.current.set(layerId, normalizedFeatures);
13662
14049
  layerTemporalCacheRef.current.set(layerId, { featureCount: normalizedFeatures.length, hasTemporal: fileHasTemporal });
13663
14050
  newLayer.featureIds = addedIds;
14051
+ if (result.truncated) {
14052
+ notifyFeatureCap({
14053
+ layerId,
14054
+ layerName: newLayer.name,
14055
+ kept: normalizedFeatures.length,
14056
+ dropped: result.truncated.droppedCount,
14057
+ sourceCount: result.truncated.sourceFeatureCount,
14058
+ max: result.truncated.maxFeatures,
14059
+ source: "file"
14060
+ });
14061
+ }
13664
14062
  setLayers((prev) => [...prev, newLayer]);
13665
14063
  updateFeatureCount();
13666
14064
  scheduleTimelineUpdate();
@@ -13704,6 +14102,23 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13704
14102
  return;
13705
14103
  }
13706
14104
  const targetId = targetLayer.id;
14105
+ const appendCapped = capFeatures(normalizedFeatures, {
14106
+ max: featureCapRef.current,
14107
+ existing: countExisting(targetLayer)
14108
+ });
14109
+ const appendFeatures = appendCapped.features;
14110
+ const totalDropped = (((_b = result.truncated) == null ? void 0 : _b.droppedCount) ?? 0) + appendCapped.dropped;
14111
+ if (totalDropped > 0) {
14112
+ notifyFeatureCap({
14113
+ layerId: targetId,
14114
+ layerName: targetLayer.name,
14115
+ kept: appendFeatures.length,
14116
+ dropped: totalDropped,
14117
+ sourceCount: ((_c = result.truncated) == null ? void 0 : _c.sourceFeatureCount) ?? appendCapped.sourceCount,
14118
+ max: featureCapRef.current,
14119
+ source: "file"
14120
+ });
14121
+ }
13707
14122
  const withLayerMetadata = (l, addedIds) => ({
13708
14123
  ...l,
13709
14124
  featureIds: [...l.featureIds, ...addedIds],
@@ -13712,7 +14127,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13712
14127
  ...(layerMetadata == null ? void 0 : layerMetadata.visualConfig) && { visualConfig: layerMetadata.visualConfig }
13713
14128
  });
13714
14129
  if (targetLayer.readOnly) {
13715
- const addedFeatures = normalizedFeatures.map((f) => ({ ...f, id: crypto.randomUUID() }));
14130
+ const addedFeatures = appendFeatures.map((f) => ({ ...f, id: crypto.randomUUID() }));
13716
14131
  const addedIds = addedFeatures.map((f) => String(f.id));
13717
14132
  const existing = readOnlyFeatures.current.get(targetId) || [];
13718
14133
  readOnlyFeatures.current.set(targetId, [...existing, ...addedFeatures]);
@@ -13726,7 +14141,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13726
14141
  const addedIds = [];
13727
14142
  isApiAddingRef.current = true;
13728
14143
  try {
13729
- normalizedFeatures.forEach((f) => {
14144
+ appendFeatures.forEach((f) => {
13730
14145
  const ids = draw.current.add(f);
13731
14146
  addedIds.push(ids[0]);
13732
14147
  });
@@ -13735,9 +14150,9 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13735
14150
  }
13736
14151
  setLayers((prev) => prev.map((l) => l.id === targetId ? withLayerMetadata(l, addedIds) : l));
13737
14152
  } else {
13738
- const addedIds = normalizedFeatures.map((f) => String(f.id));
14153
+ const addedIds = appendFeatures.map((f) => String(f.id));
13739
14154
  const existing = hiddenFeatures.current.get(targetId) || [];
13740
- hiddenFeatures.current.set(targetId, [...existing, ...normalizedFeatures]);
14155
+ hiddenFeatures.current.set(targetId, [...existing, ...appendFeatures]);
13741
14156
  setLayers((prev) => prev.map((l) => l.id === targetId ? withLayerMetadata(l, addedIds) : l));
13742
14157
  }
13743
14158
  updateFeatureCount();
@@ -13746,9 +14161,9 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13746
14161
  const reprojectMsg = reprojected ? ` (reprojected from ${sourceCRS})` : "";
13747
14162
  toast({
13748
14163
  title: "GeoJSON loaded",
13749
- description: `Added ${normalizedFeatures.length} features${reprojectMsg}${!(targetLayer == null ? void 0 : targetLayer.visible) ? " (layer hidden)" : ""}`
14164
+ description: `Added ${appendFeatures.length} features${reprojectMsg}${!(targetLayer == null ? void 0 : targetLayer.visible) ? " (layer hidden)" : ""}`
13750
14165
  });
13751
- }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress]);
14166
+ }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress, notifyFeatureCap]);
13752
14167
  const handleFileChange = react.useCallback((e) => {
13753
14168
  var _a;
13754
14169
  const file = (_a = e.target.files) == null ? void 0 : _a[0];
@@ -13810,6 +14225,17 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13810
14225
  readOnlyFeatures.current.set(layerId, normalizedFeatures);
13811
14226
  layerTemporalCacheRef.current.set(layerId, { featureCount: normalizedFeatures.length, hasTemporal: result.hasTemporal });
13812
14227
  newLayer.featureIds = addedIds;
14228
+ if (result.truncated) {
14229
+ notifyFeatureCap({
14230
+ layerId,
14231
+ layerName: newLayer.name,
14232
+ kept: normalizedFeatures.length,
14233
+ dropped: result.truncated.droppedCount,
14234
+ sourceCount: result.truncated.sourceFeatureCount,
14235
+ max: result.truncated.maxFeatures,
14236
+ source: "drop"
14237
+ });
14238
+ }
13813
14239
  const nextLayers = [...layersRef.current, newLayer];
13814
14240
  layersRef.current = nextLayers;
13815
14241
  setLayers(nextLayers);
@@ -13832,7 +14258,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
13832
14258
  title: "Layer added",
13833
14259
  description: `Created "${newLayer.name}" with ${addedIds.length} features${reprojectMsg} (high-performance)`
13834
14260
  });
13835
- }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress]);
14261
+ }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress, notifyFeatureCap]);
13836
14262
  const handleDropGeoJSON = react.useCallback((name, data) => {
13837
14263
  void ingestDroppedLayer(name, data);
13838
14264
  }, [ingestDroppedLayer]);
@@ -14696,6 +15122,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
14696
15122
  is3DTerrainEnabled,
14697
15123
  onToggle3DTerrain: handleToggle3DTerrain,
14698
15124
  onUpdateAltitudeDisplayMode: handleUpdateAltitudeDisplayMode,
15125
+ availableBasemaps,
14699
15126
  hideSatellite: !enableSatellite,
14700
15127
  hideDark: !enableDark,
14701
15128
  hideTerrain: !enableTerrain,
@@ -15821,6 +16248,7 @@ function DebugSidebar({ onAddRandomPoints, onImportKML, onAddDomMarkers, onRemov
15821
16248
  exports.ActionPanel = ActionPanel;
15822
16249
  exports.ClusterPieManager = ClusterPieManager;
15823
16250
  exports.ColorPickerPopover = ColorPickerPopover;
16251
+ exports.DEFAULT_MAX_FEATURES_PER_LAYER = DEFAULT_MAX_FEATURES_PER_LAYER;
15824
16252
  exports.DebugSidebar = DebugSidebar;
15825
16253
  exports.DrawingToolbar = DrawingToolbar;
15826
16254
  exports.INTERNAL_PROPERTY_KEYS = INTERNAL_PROPERTY_KEYS;
@@ -15839,6 +16267,7 @@ exports.Timebar = Timebar;
15839
16267
  exports.TimebarToggle = TimebarToggle;
15840
16268
  exports.cn = cn;
15841
16269
  exports.createClusterPieManager = createClusterPieManager;
16270
+ exports.featureCollectionBlobPartsAsync = featureCollectionBlobPartsAsync;
15842
16271
  exports.getIconEmoji = getIconEmoji;
15843
16272
  exports.isFeatureInRange = isFeatureInRange;
15844
16273
  exports.isInternalProperty = isInternalProperty;