@geotrekce/geotrek-rando-widget 0.0.6 → 0.0.9

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.
Files changed (59) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/grw-app.cjs.entry.js +14 -5
  3. package/dist/cjs/grw-filter_6.cjs.entry.js +109 -63
  4. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +2 -2
  5. package/dist/cjs/grw-trek-card.cjs.entry.js +3 -3
  6. package/dist/cjs/{index-c2c4531d.js → index-4c76daa3.js} +8 -3
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/{store-fd04a216.js → store-b4c3c507.js} +6 -4
  9. package/dist/collection/components/grw-app/grw-app.css +17 -11
  10. package/dist/collection/components/grw-app/grw-app.js +21 -9
  11. package/dist/collection/components/grw-filter/grw-filter.js +11 -12
  12. package/dist/collection/components/grw-map/grw-map.js +24 -15
  13. package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
  14. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +11 -3
  15. package/dist/collection/components/grw-treks-list/grw-treks-list.css +0 -12
  16. package/dist/collection/components/grw-treks-list/grw-treks-list.js +16 -9
  17. package/dist/collection/store/grw-trek-provider.js +28 -15
  18. package/dist/collection/store/grw-treks-provider.js +16 -8
  19. package/dist/collection/store/store.js +5 -3
  20. package/dist/components/grw-app.js +14 -5
  21. package/dist/components/grw-filter2.js +11 -12
  22. package/dist/components/grw-map2.js +24 -15
  23. package/dist/components/grw-trek-card2.js +1 -1
  24. package/dist/components/grw-trek-detail2.js +11 -3
  25. package/dist/components/grw-trek-provider2.js +28 -15
  26. package/dist/components/grw-treks-list2.js +18 -9
  27. package/dist/components/grw-treks-provider2.js +16 -8
  28. package/dist/components/store.js +5 -3
  29. package/dist/esm/geotrek-rando-widget.js +2 -2
  30. package/dist/esm/grw-app.entry.js +14 -5
  31. package/dist/esm/grw-filter_6.entry.js +109 -63
  32. package/dist/esm/grw-information-desk-detail_3.entry.js +2 -2
  33. package/dist/esm/grw-trek-card.entry.js +3 -3
  34. package/dist/esm/{index-192d910f.js → index-ee473772.js} +8 -3
  35. package/dist/esm/loader.js +2 -2
  36. package/dist/esm/{store-b2c76c0c.js → store-a5f523fd.js} +6 -4
  37. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  38. package/dist/geotrek-rando-widget/{p-7715153d.entry.js → p-0510e16b.entry.js} +1 -1
  39. package/dist/geotrek-rando-widget/p-22562f4d.js +1 -0
  40. package/dist/geotrek-rando-widget/p-28db12ba.entry.js +1 -0
  41. package/dist/geotrek-rando-widget/{p-1b2ba86d.entry.js → p-500436f1.entry.js} +1 -1
  42. package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +1 -0
  43. package/dist/geotrek-rando-widget/p-b62909db.js +2 -0
  44. package/dist/types/components/grw-app/grw-app.d.ts +2 -2
  45. package/dist/types/components/grw-filter/grw-filter.d.ts +1 -1
  46. package/dist/types/components/grw-map/grw-map.d.ts +1 -1
  47. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +1 -1
  48. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -1
  49. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +3 -2
  50. package/dist/types/components.d.ts +2 -2
  51. package/dist/types/store/grw-trek-provider.d.ts +4 -1
  52. package/dist/types/store/grw-treks-provider.d.ts +4 -1
  53. package/dist/types/store/store.d.ts +4 -0
  54. package/package.json +1 -1
  55. package/readme.md +4 -0
  56. package/dist/geotrek-rando-widget/p-5f17d340.entry.js +0 -1
  57. package/dist/geotrek-rando-widget/p-6716c635.entry.js +0 -1
  58. package/dist/geotrek-rando-widget/p-6dce5e6c.js +0 -2
  59. package/dist/geotrek-rando-widget/p-e6710c64.js +0 -1
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-192d910f.js';
2
- import { s as state, o as onChange } from './store-b2c76c0c.js';
1
+ import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-ee473772.js';
2
+ import { s as state, o as onChange } from './store-a5f523fd.js';
3
3
  import { d as durationImage, f as formatDuration, l as lengthImage, a as formatLength, b as ascentImage, c as formatAscent } from './length-d82189db.js';
4
4
 
5
5
  const grwFilterCss = ".filter-name{margin-left:8px;color:var(--color-primary);font-size:24px;font-weight:bold}.filter-button-container{display:flex;flex-direction:row;flex-wrap:wrap}.filter-button-container .filter-button,.filter-button-container .selected-filter-button{user-select:none;cursor:pointer;border:1px var(--color-primary) solid;border-radius:8px;margin:8px 0px 0px 8px;padding:8px}.filter-button-container .filter-button{color:var(--color-primary);background-color:#ffffff}.filter-button-container .selected-filter-button{color:#ffffff;background-color:var(--color-primary)}";
@@ -28,18 +28,17 @@ const GrwFilter = class {
28
28
  filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
29
29
  }
30
30
  else if (filter.type === 'interval') {
31
- let minValue;
32
- let maxValue;
33
- for (const currentFilterId of currentFiltersId) {
34
- const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
35
- if (isNaN(minValue) || currentFilter.minValue < minValue) {
36
- minValue = currentFilter.minValue;
37
- }
38
- if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
39
- maxValue = currentFilter.maxValue;
40
- }
41
- }
42
- filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
31
+ filtersTreks = [
32
+ ...filtersTreks.filter(trek => {
33
+ for (const currentFilterId of currentFiltersId) {
34
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
35
+ if (trek[filter.trekProperty] >= currentFilter.minValue && trek[filter.trekProperty] <= currentFilter.maxValue) {
36
+ return true;
37
+ }
38
+ }
39
+ return false;
40
+ }),
41
+ ];
43
42
  }
44
43
  }
45
44
  else {
@@ -14233,7 +14232,7 @@ const GrwMap = class {
14233
14232
  this.colorPoiIcon = '#974c6e';
14234
14233
  this.handleTreksWithinBoundsBind = this.handleTreksWithinBounds.bind(this);
14235
14234
  }
14236
- componentDidLoad() {
14235
+ connectedCallback() {
14237
14236
  this.map = leafletSrc.map(this.element, {
14238
14237
  center: this.center.split(',').map(Number),
14239
14238
  zoom: this.zoom,
@@ -14246,15 +14245,17 @@ const GrwMap = class {
14246
14245
  if (state.currentTrek) {
14247
14246
  this.addTrek();
14248
14247
  }
14249
- else if (state.currentTrek) {
14248
+ else if (state.currentTreks) {
14250
14249
  this.addTreks();
14251
14250
  }
14252
14251
  onChange('currentTreks', () => {
14253
14252
  if (state.currentTrek) {
14253
+ this.removeTreks();
14254
14254
  this.addTrek();
14255
14255
  }
14256
14256
  else if (state.currentTreks) {
14257
14257
  this.addTreks();
14258
+ this.removeTrek();
14258
14259
  }
14259
14260
  });
14260
14261
  onChange('currentTrek', () => {
@@ -14275,18 +14276,20 @@ const GrwMap = class {
14275
14276
  type: 'FeatureCollection',
14276
14277
  features: [],
14277
14278
  };
14278
- for (const trek of state.currentTreks) {
14279
- trekscurrentDepartureCoordinates.push(trek.departure_geom);
14280
- treksFeatureCollection.features.push({
14281
- type: 'Feature',
14282
- geometry: { type: 'Point', coordinates: trek.departure_geom },
14283
- properties: {
14284
- id: trek.id,
14285
- name: trek.name,
14286
- practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
14287
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
14288
- },
14289
- });
14279
+ if (state.currentTreks) {
14280
+ for (const trek of state.currentTreks) {
14281
+ trekscurrentDepartureCoordinates.push(trek.departure_geom);
14282
+ treksFeatureCollection.features.push({
14283
+ type: 'Feature',
14284
+ geometry: { type: 'Point', coordinates: trek.departure_geom },
14285
+ properties: {
14286
+ id: trek.id,
14287
+ name: trek.name,
14288
+ practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
14289
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
14290
+ },
14291
+ });
14292
+ }
14290
14293
  }
14291
14294
  if (!this.treksLayer) {
14292
14295
  if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
@@ -14294,7 +14297,9 @@ const GrwMap = class {
14294
14297
  this.map.fitBounds(bounds);
14295
14298
  }
14296
14299
  else {
14297
- this.map.fitBounds(state.currentMapTreksBounds);
14300
+ if (state.currentMapTreksBounds) {
14301
+ this.map.fitBounds(state.currentMapTreksBounds);
14302
+ }
14298
14303
  }
14299
14304
  this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
14300
14305
  pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
@@ -14330,6 +14335,9 @@ const GrwMap = class {
14330
14335
  const bounds = leafletSrc.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
14331
14336
  this.map.fitBounds(bounds);
14332
14337
  }
14338
+ else {
14339
+ this.map.fire('moveend');
14340
+ }
14333
14341
  this.treksLayer.clearLayers();
14334
14342
  this.treksLayer.addData(treksFeatureCollection);
14335
14343
  }
@@ -14612,7 +14620,7 @@ const GrwTrekDetail = class {
14612
14620
  this.colorPrimaryShade = '#4a0021';
14613
14621
  this.colorPrimaryTint = '#974c6e';
14614
14622
  }
14615
- componentWillLoad() {
14623
+ connectedCallback() {
14616
14624
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
14617
14625
  if (this.currentTrek) {
14618
14626
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
@@ -14622,7 +14630,9 @@ const GrwTrekDetail = class {
14622
14630
  this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
14623
14631
  this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
14624
14632
  this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
14625
- this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
14633
+ if (state.accessibilitiesLevel) {
14634
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
14635
+ }
14626
14636
  }
14627
14637
  onChange('currentTrek', () => {
14628
14638
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -14633,6 +14643,10 @@ const GrwTrekDetail = class {
14633
14643
  this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
14634
14644
  this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
14635
14645
  this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
14646
+ this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
14647
+ if (state.accessibilitiesLevel) {
14648
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
14649
+ }
14636
14650
  }
14637
14651
  });
14638
14652
  }
@@ -14641,7 +14655,9 @@ const GrwTrekDetail = class {
14641
14655
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-shade': this.colorPrimaryShade, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-detail-container" }, h("div", { class: "name" }, this.currentTrek.name), this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })), h("div", { class: "sub-container" }, h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_a = this.difficulty) === null || _a === void 0 ? void 0 : _a.pictogram) && h("img", { src: this.difficulty.pictogram }), (_b = this.difficulty) === null || _b === void 0 ? void 0 :
14642
14656
  _b.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)), h("div", { class: "icon-label route" }, ((_d = this.route) === null || _d === void 0 ? void 0 : _d.pictogram) && h("img", { src: this.route.pictogram }), (_e = this.route) === null || _e === void 0 ? void 0 :
14643
14657
  _e.route)), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), h("div", { class: "icon-label practice" }, ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
14644
- _g.name)))), h("div", { class: "downloads-container" }, h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), h("div", { class: "links-container" }, h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), h("a", { href: `${this.currentTrek.kml}` }, "KML"), h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (h("div", { class: "description-container" }, h("div", { class: "description-title" }, "Description"), h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (h("div", { class: "departure-container" }, h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (h("div", { class: "arrival-container" }, h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" }, h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), h("img", { src: this.currentTrek.altimetric_profile }))), this.currentTrek.access && (h("div", { class: "access-container" }, h("div", { class: "access-title" }, "Acc\u00E8s routier"), h("div", { class: "access", innerHTML: this.currentTrek.access }))), this.currentTrek.public_transport && (h("div", { class: "public-transport-container" }, h("div", { class: "public-transport-title" }, "Transport"), h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))), (this.currentTrek.advice || this.labels.length > 0) && (h("div", { class: "advice-container" }, h("div", { class: "advice-title" }, "Recommandations"), this.currentTrek.advice && h("div", { class: "advice", innerHTML: this.currentTrek.advice }), this.labels.map(label => (h("div", { class: "label-container" }, h("div", { class: "label-sub-container" }, label.pictogram && h("img", { src: label.pictogram }), h("div", { class: "label-name", innerHTML: label.name })), h("div", { class: "label-advice", innerHTML: label.advice })))))), this.currentTrek.advised_parking && (h("div", { class: "advised-parking-container" }, h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"), h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))), this.currentTrek.gear && (h("div", { class: "gear-container" }, h("div", { class: "gear-title" }, "\u00C9quipements"), h("div", { class: "gear", innerHTML: this.currentTrek.gear }))), state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" }, h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"), state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))), state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" }, h("div", { class: "information-desks-title" }, "Lieux de renseignement"), state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))), (this.currentTrek.disabled_infrastructure ||
14658
+ _g.name)))), h("div", { class: "downloads-container" }, h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), h("div", { class: "links-container" }, h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), h("a", { href: `${this.currentTrek.kml}` }, "KML"), h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (h("div", { class: "description-container" }, h("div", { class: "description-title" }, "Description"), h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (h("div", { class: "departure-container" }, h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (h("div", { class: "arrival-container" }, h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" }, h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), h("img", { src: this.currentTrek.altimetric_profile.endsWith('.json')
14659
+ ? this.currentTrek.altimetric_profile.replace('.json', '.svg')
14660
+ : `${this.currentTrek.altimetric_profile}?format=svg` }))), this.currentTrek.access && (h("div", { class: "access-container" }, h("div", { class: "access-title" }, "Acc\u00E8s routier"), h("div", { class: "access", innerHTML: this.currentTrek.access }))), this.currentTrek.public_transport && (h("div", { class: "public-transport-container" }, h("div", { class: "public-transport-title" }, "Transport"), h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))), (this.currentTrek.advice || this.labels.length > 0) && (h("div", { class: "advice-container" }, h("div", { class: "advice-title" }, "Recommandations"), this.currentTrek.advice && h("div", { class: "advice", innerHTML: this.currentTrek.advice }), this.labels.map(label => (h("div", { class: "label-container" }, h("div", { class: "label-sub-container" }, label.pictogram && h("img", { src: label.pictogram }), h("div", { class: "label-name", innerHTML: label.name })), h("div", { class: "label-advice", innerHTML: label.advice })))))), this.currentTrek.advised_parking && (h("div", { class: "advised-parking-container" }, h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"), h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))), this.currentTrek.gear && (h("div", { class: "gear-container" }, h("div", { class: "gear-title" }, "\u00C9quipements"), h("div", { class: "gear", innerHTML: this.currentTrek.gear }))), state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" }, h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"), state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))), state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" }, h("div", { class: "information-desks-title" }, "Lieux de renseignement"), state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))), (this.currentTrek.disabled_infrastructure ||
14645
14661
  (this.accessibilities && this.accessibilities.length > 0) ||
14646
14662
  this.currentTrek.accessibility_level ||
14647
14663
  this.currentTrek.accessibility_slope ||
@@ -14658,27 +14674,33 @@ const GrwTrekProvider = class {
14658
14674
  constructor(hostRef) {
14659
14675
  registerInstance(this, hostRef);
14660
14676
  this.language = 'fr';
14677
+ this.trekNetworkError = false;
14678
+ this.controller = new AbortController();
14679
+ this.signal = this.controller.signal;
14661
14680
  }
14662
- componentWillLoad() {
14681
+ connectedCallback() {
14663
14682
  state.api = this.api;
14664
14683
  const requests = [];
14665
- requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14666
- requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`) : new Response('null'));
14667
- requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`) : new Response('null'));
14668
- requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14669
- return Promise.all([
14684
+ requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
14685
+ requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }) : new Response('null'));
14686
+ requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }) : new Response('null'));
14687
+ requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
14688
+ Promise.all([
14670
14689
  ...requests,
14671
- fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`).catch(() => new Response('null')),
14672
- fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`),
14673
- fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`),
14674
- fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`),
14675
- fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`),
14676
- fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`),
14677
- fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`),
14678
- fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`),
14690
+ fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`, {
14691
+ signal: this.signal,
14692
+ }).catch(() => new Response('null')),
14693
+ fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`, { signal: this.signal }),
14694
+ fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
14695
+ fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
14696
+ fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
14697
+ fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`, { signal: this.signal }),
14698
+ fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
14699
+ fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
14679
14700
  ])
14680
14701
  .then(responses => Promise.all(responses.map(response => response.json())))
14681
14702
  .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
14703
+ state.trekNetworkError = false;
14682
14704
  if (difficulties) {
14683
14705
  state.difficulties = difficulties.results;
14684
14706
  }
@@ -14697,21 +14719,28 @@ const GrwTrekProvider = class {
14697
14719
  state.labels = labels.results;
14698
14720
  state.sources = sources.results;
14699
14721
  state.accessibilities = accessibilities.results;
14700
- state.accessibilitiesLevel = accessibilitiesLevel.results;
14722
+ if (accessibilitiesLevel) {
14723
+ state.accessibilitiesLevel = accessibilitiesLevel.results;
14724
+ }
14701
14725
  state.currentPois = pois.results;
14702
14726
  state.currentInformationDesks = informationDesks.results;
14703
14727
  state.currentTrek = trek;
14728
+ })
14729
+ .catch(() => {
14730
+ state.trekNetworkError = true;
14704
14731
  });
14705
14732
  }
14706
14733
  disconnectedCallback() {
14734
+ this.controller.abort();
14707
14735
  state.currentTrek = null;
14736
+ state.trekNetworkError = false;
14708
14737
  }
14709
14738
  render() {
14710
14739
  return h(Host, null);
14711
14740
  }
14712
14741
  };
14713
14742
 
14714
- const grwTreksListCss = ":host{font-family:\"Roboto\";width:100%;height:100%;max-height:100vh;overflow-y:auto}.current-treks-length{width:100%;text-align:center;padding:32px 0px;color:var(--color-primary);font-size:24px;font-weight:bold}.current-treks-container{display:flex;flex-wrap:wrap;justify-content:space-around}grw-trek-card{margin:6px}";
14743
+ const grwTreksListCss = ":host{font-family:\"Roboto\";width:100%;height:100%;max-height:100vh;overflow-y:auto;display:flex;flex-wrap:wrap;justify-content:space-around}grw-trek-card{margin:6px}";
14715
14744
 
14716
14745
  const GrwTreksList = class {
14717
14746
  constructor(hostRef) {
@@ -14720,19 +14749,25 @@ const GrwTreksList = class {
14720
14749
  this.colorPrimary = '#6b0030';
14721
14750
  this.colorPrimaryTint = '#974c6e';
14722
14751
  this.isLargeView = false;
14723
- this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14724
14752
  this.step = 10;
14753
+ this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
14725
14754
  }
14726
- componentWillLoad() {
14755
+ connectedCallback() {
14756
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14757
+ if (state.currentTreks) {
14758
+ this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14759
+ }
14727
14760
  onChange('currentTreks', () => {
14728
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14729
14761
  this.element.scroll({ top: 0 });
14730
- this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14762
+ if (state.currentTreks) {
14763
+ this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
14764
+ }
14731
14765
  });
14732
14766
  onChange('treksWithinBounds', () => {
14733
- this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
14734
14767
  this.element.scroll({ top: 0 });
14735
- this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
14768
+ if (state.treksWithinBounds) {
14769
+ this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
14770
+ }
14736
14771
  });
14737
14772
  }
14738
14773
  handleInfiniteScroll(event) {
@@ -14745,8 +14780,11 @@ const GrwTreksList = class {
14745
14780
  }
14746
14781
  }
14747
14782
  }
14783
+ disconnectedCallback() {
14784
+ this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
14785
+ }
14748
14786
  render() {
14749
- return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("div", { class: "current-treks-length" }, `${state.treksWithinBounds.length} résultat${state.treksWithinBounds.length > 1 ? 's' : ''}`), h("div", { class: "current-treks-container" }, this.treksToDisplay.map(trek => (h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint }))))));
14787
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
14750
14788
  }
14751
14789
  get element() { return getElement(this); }
14752
14790
  };
@@ -14756,8 +14794,10 @@ const GrwTreksProvider = class {
14756
14794
  constructor(hostRef) {
14757
14795
  registerInstance(this, hostRef);
14758
14796
  this.language = 'fr';
14797
+ this.controller = new AbortController();
14798
+ this.signal = this.controller.signal;
14759
14799
  }
14760
- componentWillLoad() {
14800
+ connectedCallback() {
14761
14801
  state.api = this.api;
14762
14802
  let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
14763
14803
  this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
@@ -14769,15 +14809,16 @@ const GrwTreksProvider = class {
14769
14809
  this.routes && (treksRequest += `&routes=${this.routes}`);
14770
14810
  this.practices && (treksRequest += `&practices=${this.practices}`);
14771
14811
  treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
14772
- return Promise.all([
14773
- fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
14774
- fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
14775
- fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
14776
- fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`),
14777
- fetch(treksRequest),
14812
+ Promise.all([
14813
+ fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
14814
+ fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }),
14815
+ fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
14816
+ fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
14817
+ fetch(treksRequest, { signal: this.signal }),
14778
14818
  ])
14779
14819
  .then(responses => Promise.all(responses.map(response => response.json())))
14780
14820
  .then(([difficulties, routes, practices, themes, treks]) => {
14821
+ state.treksNetworkError = false;
14781
14822
  state.difficulties = difficulties.results;
14782
14823
  state.routes = routes.results;
14783
14824
  state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
@@ -14791,7 +14832,12 @@ const GrwTreksProvider = class {
14791
14832
  state.treks = treks.results;
14792
14833
  state.currentTreks = treks.results;
14793
14834
  state.treksWithinBounds = treks.results;
14794
- });
14835
+ })
14836
+ .catch(() => (state.treksNetworkError = true));
14837
+ }
14838
+ disconnectedCallback() {
14839
+ this.controller.abort();
14840
+ state.treksNetworkError = false;
14795
14841
  }
14796
14842
  render() {
14797
14843
  return h(Host, null);
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, H as Host } from './index-192d910f.js';
2
- import { s as state } from './store-b2c76c0c.js';
1
+ import { r as registerInstance, h, H as Host } from './index-ee473772.js';
2
+ import { s as state } from './store-a5f523fd.js';
3
3
 
4
4
  const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";
5
5
 
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-192d910f.js';
2
- import { s as state, o as onChange } from './store-b2c76c0c.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-ee473772.js';
2
+ import { s as state, o as onChange } from './store-a5f523fd.js';
3
3
  import { d as durationImage, f as formatDuration, l as lengthImage, a as formatLength, b as ascentImage, c as formatAscent } from './length-d82189db.js';
4
4
 
5
5
  const grwTrekCardCss = ".trek-card-container,.trek-card-large-view-container{font-family:\"Roboto\";border-radius:8px;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25);cursor:pointer}.trek-card-container .image,.trek-card-large-view-container .image{object-fit:cover}.trek-card-container .sub-container,.trek-card-large-view-container .sub-container{display:flex;flex-direction:column;justify-content:center;padding:12px}.trek-card-container .sub-container .name,.trek-card-large-view-container .sub-container .name{color:var(--color-primary);font-size:24px;font-weight:bold;margin-bottom:8px}.trek-card-container .sub-container .departure,.trek-card-large-view-container .sub-container .departure{color:rgba(0, 0, 0, 0.7);font-size:16px;margin:4px 0px}.trek-card-container .sub-container .themes-container,.trek-card-large-view-container .sub-container .themes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .themes-container .theme,.trek-card-large-view-container .sub-container .themes-container .theme{background-color:var(--color-primary-tint);color:#ffffff;border-radius:8px;padding:8px;margin:0px 8px 8px 0px}.trek-card-container .sub-container .icons-labels-container,.trek-card-large-view-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-card-container .sub-container .icons-labels-container .row,.trek-card-large-view-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-card-container .sub-container .icons-labels-container .row:not(:last-child),.trek-card-large-view-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:12px}.trek-card-container .sub-container .icons-labels-container .row .icon-label,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label{display:flex;align-items:center;width:50%}.trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2),.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 4px}.trek-card-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label img,.trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:8px}.trek-card-container .sub-container .icons-labels-container .row .practice img,.trek-card-large-view-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-card-container{width:350px;height:auto}.trek-card-container .image{width:100%}.trek-card-large-view-container{height:auto;display:flex;flex-direction:row}.trek-card-large-view-container .image{width:250px}";
@@ -12,7 +12,7 @@ const GrwTrekCard = class {
12
12
  this.colorPrimaryTint = '#974c6e';
13
13
  this.isLargeView = false;
14
14
  }
15
- componentWillLoad() {
15
+ connectedCallback() {
16
16
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
17
17
  if (this.currentTrek) {
18
18
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
@@ -659,9 +659,6 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
659
659
  hostRef.$queuedListeners$ = null;
660
660
  }
661
661
  }
662
- {
663
- promise = safeCall(instance, 'componentWillLoad');
664
- }
665
662
  }
666
663
  endSchedule();
667
664
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
@@ -1039,6 +1036,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1039
1036
  hostRef.$flags$ |= 128 /* isWatchReady */;
1040
1037
  }
1041
1038
  endNewInstance();
1039
+ fireConnectedCallback(hostRef.$lazyInstance$);
1042
1040
  }
1043
1041
  if (Cstr.style) {
1044
1042
  // this component has styles but we haven't registered them yet
@@ -1067,6 +1065,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1067
1065
  schedule();
1068
1066
  }
1069
1067
  };
1068
+ const fireConnectedCallback = (instance) => {
1069
+ {
1070
+ safeCall(instance, 'connectedCallback');
1071
+ }
1072
+ };
1070
1073
  const connectedCallback = (elm) => {
1071
1074
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1072
1075
  const hostRef = getHostRef(elm);
@@ -1110,6 +1113,8 @@ const connectedCallback = (elm) => {
1110
1113
  // reattach any event listeners to the host
1111
1114
  // since they would have been removed when disconnected
1112
1115
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1116
+ // fire off connectedCallback() on component instance
1117
+ fireConnectedCallback(hostRef.$lazyInstance$);
1113
1118
  }
1114
1119
  endConnected();
1115
1120
  }
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-192d910f.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-ee473772.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["grw-trek-card",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
13
+ return bootstrapLazy([["grw-trek-card",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[2],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
- import { a as getRenderingRef, f as forceUpdate } from './index-192d910f.js';
1
+ import { a as getRenderingRef, f as forceUpdate } from './index-ee473772.js';
2
2
 
3
3
  const appendToMap = (map, propName, value) => {
4
4
  const items = map.get(propName);
@@ -186,9 +186,9 @@ const createStore = (defaultState, shouldUpdate) => {
186
186
 
187
187
  const { state, onChange } = createStore({
188
188
  api: '',
189
- treks: [],
190
- currentTreks: [],
191
- treksWithinBounds: [],
189
+ treks: null,
190
+ currentTreks: null,
191
+ treksWithinBounds: null,
192
192
  currentMapTreksBounds: null,
193
193
  difficulties: [],
194
194
  routes: [],
@@ -203,6 +203,8 @@ const { state, onChange } = createStore({
203
203
  currentTrek: null,
204
204
  currentPois: null,
205
205
  currentInformationDesks: null,
206
+ treksNetworkError: false,
207
+ trekNetworkError: false,
206
208
  });
207
209
 
208
210
  export { onChange as o, state as s };
@@ -1 +1 @@
1
- import{p as r,b as o}from"./p-6dce5e6c.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),r(e)})().then((r=>o([["p-1b2ba86d",[[1,"grw-trek-card",{trek:[16],colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],isLargeView:[4,"is-large-view"],currentTrek:[32],difficulty:[32],route:[32],practice:[32],themes:[32]}]]],["p-7715153d",[[1,"grw-information-desk-detail",{informationDesk:[16]}],[1,"grw-poi-detail",{poi:[16]}],[1,"grw-sensitive-area-detail",{sensitiveArea:[16]}]]],["p-6716c635",[[1,"grw-trek-detail",{trek:[16],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],difficulty:[32],route:[32],practice:[32],themes:[32],labels:[32],sources:[32],accessibilities:[32],accessibilityLevel:[32],currentTrek:[32]}],[1,"grw-treks-list",{colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],isLargeView:[4,"is-large-view"],treksToDisplay:[32]}],[1,"grw-filter",{filterType:[1,"filter-type"],filterName:[1,"filter-name"],filterNameProperty:[1,"filter-name-property"]}],[0,"grw-map",{urlLayer:[1,"url-layer"],attribution:[1],center:[1],zoom:[2],colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],mapIsReady:[32]}],[1,"grw-trek-provider",{language:[1],api:[1],trekId:[1,"trek-id"]}],[1,"grw-treks-provider",{language:[1],api:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1]}]]],["p-5f17d340",[[1,"grw-app",{api:[1],language:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1],urlLayer:[1,"url-layer"],center:[1],zoom:[8],attribution:[1],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],showTrek:[32],showTreksMap:[32],showTrekMap:[32],showFilters:[32],isLargeView:[32],currentTrekId:[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]],r)));
1
+ import{p as r,b as o}from"./p-b62909db.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),r(e)})().then((r=>o([["p-500436f1",[[1,"grw-trek-card",{trek:[16],colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],isLargeView:[4,"is-large-view"],currentTrek:[32],difficulty:[32],route:[32],practice:[32],themes:[32]}]]],["p-0510e16b",[[1,"grw-information-desk-detail",{informationDesk:[16]}],[1,"grw-poi-detail",{poi:[16]}],[1,"grw-sensitive-area-detail",{sensitiveArea:[16]}]]],["p-28db12ba",[[1,"grw-trek-detail",{trek:[16],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],difficulty:[32],route:[32],practice:[32],themes:[32],labels:[32],sources:[32],accessibilities:[32],accessibilityLevel:[32],currentTrek:[32]}],[1,"grw-treks-list",{colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],isLargeView:[4,"is-large-view"],treksToDisplay:[32]}],[1,"grw-filter",{filterType:[1,"filter-type"],filterName:[1,"filter-name"],filterNameProperty:[1,"filter-name-property"]}],[0,"grw-map",{urlLayer:[1,"url-layer"],attribution:[1],center:[1],zoom:[2],colorPrimary:[1,"color-primary"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],mapIsReady:[32]}],[1,"grw-trek-provider",{language:[1],api:[1],trekId:[1,"trek-id"]}],[1,"grw-treks-provider",{language:[1],api:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1]}]]],["p-94f0db4d",[[1,"grw-app",{api:[1],language:[1],inBbox:[1,"in-bbox"],cities:[1],districts:[1],structures:[1],themes:[1],portals:[1],routes:[1],practices:[1],urlLayer:[1,"url-layer"],center:[1],zoom:[2],attribution:[1],colorPrimary:[1,"color-primary"],colorPrimaryShade:[1,"color-primary-shade"],colorPrimaryTint:[1,"color-primary-tint"],colorTrekLine:[1,"color-trek-line"],colorDepartureIcon:[1,"color-departure-icon"],colorArrivalIcon:[1,"color-arrival-icon"],colorSensitiveArea:[1,"color-sensitive-area"],colorPoiIcon:[1,"color-poi-icon"],showTrek:[32],showTreksMap:[32],showTrekMap:[32],showFilters:[32],isLargeView:[32],currentTrekId:[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]],r)));
@@ -1 +1 @@
1
- import{r as i,h as e,H as s}from"./p-6dce5e6c.js";import{s as t}from"./p-e6710c64.js";const a=class{constructor(e){i(this,e)}render(){return e(s,null,this.informationDesk.photo_url&&e("div",{class:"information-desk-img"},e("img",{src:this.informationDesk.photo_url,loading:"lazy"})),e("div",{class:"information-desk-sub-container"},this.informationDesk.name&&e("div",{class:"information-desk-name"},this.informationDesk.name),this.informationDesk.description&&e("div",{class:"information-desk-description",innerHTML:this.informationDesk.description}),this.informationDesk.postal_code||this.informationDesk.municipality||this.informationDesk.street&&e("div",null,this.informationDesk.postal_code,` ${this.informationDesk.municipality}`,` ${this.informationDesk.street}`),this.informationDesk.phone&&e("div",null,e("a",{href:`tel:${this.informationDesk.phone}`},this.informationDesk.phone)),this.informationDesk.email&&e("div",null,e("a",{href:`mailto:${this.informationDesk.email}`},this.informationDesk.email)),this.informationDesk.website&&e("div",null,e("a",{href:`${this.informationDesk.website}`},this.informationDesk.website))))}};a.style=":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";const r=class{constructor(e){i(this,e)}render(){return e(s,null,this.poi.attachments&&this.poi.attachments[0]&&this.poi.attachments[0].thumbnail&&e("div",{class:"poi-img"},e("img",{src:this.poi.attachments[0].thumbnail,loading:"lazy"})),e("div",{class:"poi-sub-container"},e("div",{class:"poi-name"},this.poi.name),e("div",{class:"poi-description",innerHTML:this.poi.description})))}};r.style=":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.poi-img{width:180px}.poi-img img{width:180px;border-radius:8px}.poi-sub-container{display:flex;flex-direction:column}.poi-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.poi-description{font-size:16px}";const n=class{constructor(e){i(this,e)}render(){return e(s,null,e("div",{class:"sensitive-area-title"},this.sensitiveArea.name),e("div",{class:"sensitive-area-description",innerHTML:this.sensitiveArea.description}),this.sensitiveArea.practices&&this.sensitiveArea.practices.length>0&&e("div",{class:"sensitive-area-practice-container"},e("div",{class:"sensitive-area-practice-title"},"Domaines d'activités concernés :"),e("div",{class:"sensitive-area-practice-values"},this.sensitiveArea.practices.map(((i,s)=>e("div",{innerHTML:`${t.practices.find((e=>e.id===i)).name.toUpperCase()}${s+1!==this.sensitiveArea.practices.length?" -&nbsp;":""}`}))))),this.sensitiveArea.period&&this.sensitiveArea.period.length>0&&e("div",{class:"sensitive-area-period-container"},e("div",{class:"sensitive-area-period-title"},"Périodes de sensibilité"),e("div",{class:"sensitive-area-period-values"},this.sensitiveArea.period.map(((i,s)=>{if(i)return e("div",{innerHTML:`${new Date(0,s+1,0).toLocaleDateString("fr",{month:"long"}).toUpperCase()}${this.sensitiveArea.period.slice(s+1).find((i=>i))?" -&nbsp;":""}`})})))),e("div",{class:"sensitive-area-contact-container"},e("div",{class:"sensitive-area-contact-title"},"Contact"),e("div",{innerHTML:this.sensitiveArea.contact,class:"sensitive-area-contact-value"})))}};n.style=":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.sensitive-area-title{color:var(--color-primary);font-size:24px;padding:12px 0px;font-weight:bold}.sensitive-area-description{font-size:16px}.sensitive-area-period-container .sensitive-area-period-title,.sensitive-area-period-container .sensitive-area-practice-title,.sensitive-area-period-container .sensitive-area-contact-title,.sensitive-area-practice-container .sensitive-area-period-title,.sensitive-area-practice-container .sensitive-area-practice-title,.sensitive-area-practice-container .sensitive-area-contact-title,.sensitive-area-contact-container .sensitive-area-period-title,.sensitive-area-contact-container .sensitive-area-practice-title,.sensitive-area-contact-container .sensitive-area-contact-title{color:var(--color-primary);font-size:24px;padding:12px 0px}.sensitive-area-period-container .sensitive-area-period-values,.sensitive-area-period-container .sensitive-area-practice-values,.sensitive-area-practice-container .sensitive-area-period-values,.sensitive-area-practice-container .sensitive-area-practice-values,.sensitive-area-contact-container .sensitive-area-period-values,.sensitive-area-contact-container .sensitive-area-practice-values{display:flex}";export{a as grw_information_desk_detail,r as grw_poi_detail,n as grw_sensitive_area_detail}
1
+ import{r as i,h as e,H as s}from"./p-b62909db.js";import{s as t}from"./p-22562f4d.js";const a=class{constructor(e){i(this,e)}render(){return e(s,null,this.informationDesk.photo_url&&e("div",{class:"information-desk-img"},e("img",{src:this.informationDesk.photo_url,loading:"lazy"})),e("div",{class:"information-desk-sub-container"},this.informationDesk.name&&e("div",{class:"information-desk-name"},this.informationDesk.name),this.informationDesk.description&&e("div",{class:"information-desk-description",innerHTML:this.informationDesk.description}),this.informationDesk.postal_code||this.informationDesk.municipality||this.informationDesk.street&&e("div",null,this.informationDesk.postal_code,` ${this.informationDesk.municipality}`,` ${this.informationDesk.street}`),this.informationDesk.phone&&e("div",null,e("a",{href:`tel:${this.informationDesk.phone}`},this.informationDesk.phone)),this.informationDesk.email&&e("div",null,e("a",{href:`mailto:${this.informationDesk.email}`},this.informationDesk.email)),this.informationDesk.website&&e("div",null,e("a",{href:`${this.informationDesk.website}`},this.informationDesk.website))))}};a.style=":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-sub-container{display:flex;flex-direction:column}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.information-desk-description{font-size:16px}";const r=class{constructor(e){i(this,e)}render(){return e(s,null,this.poi.attachments&&this.poi.attachments[0]&&this.poi.attachments[0].thumbnail&&e("div",{class:"poi-img"},e("img",{src:this.poi.attachments[0].thumbnail,loading:"lazy"})),e("div",{class:"poi-sub-container"},e("div",{class:"poi-name"},this.poi.name),e("div",{class:"poi-description",innerHTML:this.poi.description})))}};r.style=":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.poi-img{width:180px}.poi-img img{width:180px;border-radius:8px}.poi-sub-container{display:flex;flex-direction:column}.poi-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.poi-description{font-size:16px}";const n=class{constructor(e){i(this,e)}render(){return e(s,null,e("div",{class:"sensitive-area-title"},this.sensitiveArea.name),e("div",{class:"sensitive-area-description",innerHTML:this.sensitiveArea.description}),this.sensitiveArea.practices&&this.sensitiveArea.practices.length>0&&e("div",{class:"sensitive-area-practice-container"},e("div",{class:"sensitive-area-practice-title"},"Domaines d'activités concernés :"),e("div",{class:"sensitive-area-practice-values"},this.sensitiveArea.practices.map(((i,s)=>e("div",{innerHTML:`${t.practices.find((e=>e.id===i)).name.toUpperCase()}${s+1!==this.sensitiveArea.practices.length?" -&nbsp;":""}`}))))),this.sensitiveArea.period&&this.sensitiveArea.period.length>0&&e("div",{class:"sensitive-area-period-container"},e("div",{class:"sensitive-area-period-title"},"Périodes de sensibilité"),e("div",{class:"sensitive-area-period-values"},this.sensitiveArea.period.map(((i,s)=>{if(i)return e("div",{innerHTML:`${new Date(0,s+1,0).toLocaleDateString("fr",{month:"long"}).toUpperCase()}${this.sensitiveArea.period.slice(s+1).find((i=>i))?" -&nbsp;":""}`})})))),e("div",{class:"sensitive-area-contact-container"},e("div",{class:"sensitive-area-contact-title"},"Contact"),e("div",{innerHTML:this.sensitiveArea.contact,class:"sensitive-area-contact-value"})))}};n.style=":host{display:flex;flex-direction:column}:host a{color:var(--color-primary)}.sensitive-area-title{color:var(--color-primary);font-size:24px;padding:12px 0px;font-weight:bold}.sensitive-area-description{font-size:16px}.sensitive-area-period-container .sensitive-area-period-title,.sensitive-area-period-container .sensitive-area-practice-title,.sensitive-area-period-container .sensitive-area-contact-title,.sensitive-area-practice-container .sensitive-area-period-title,.sensitive-area-practice-container .sensitive-area-practice-title,.sensitive-area-practice-container .sensitive-area-contact-title,.sensitive-area-contact-container .sensitive-area-period-title,.sensitive-area-contact-container .sensitive-area-practice-title,.sensitive-area-contact-container .sensitive-area-contact-title{color:var(--color-primary);font-size:24px;padding:12px 0px}.sensitive-area-period-container .sensitive-area-period-values,.sensitive-area-period-container .sensitive-area-practice-values,.sensitive-area-practice-container .sensitive-area-period-values,.sensitive-area-practice-container .sensitive-area-practice-values,.sensitive-area-contact-container .sensitive-area-period-values,.sensitive-area-contact-container .sensitive-area-practice-values{display:flex}";export{a as grw_information_desk_detail,r as grw_poi_detail,n as grw_sensitive_area_detail}
@@ -0,0 +1 @@
1
+ import{a as e,f as t}from"./p-b62909db.js";const s=e=>!("isConnected"in e)||e.isConnected,r=(()=>{let e;return(...t)=>{e&&clearTimeout(e),e=setTimeout((()=>{e=0,(e=>{for(let t of e.keys())e.set(t,e.get(t).filter(s))})(...t)}),2e3)}})(),{state:n,onChange:o}=(()=>{const s=((e,t=((e,t)=>e!==t))=>{let s=new Map(Object.entries(null!=e?e:{}));const r={dispose:[],get:[],set:[],reset:[]},n=()=>{s=new Map(Object.entries(null!=e?e:{})),r.reset.forEach((e=>e()))},o=e=>(r.get.forEach((t=>t(e))),s.get(e)),l=(e,n)=>{const o=s.get(e);t(n,o,e)&&(s.set(e,n),r.set.forEach((t=>t(e,n,o))))},u="undefined"==typeof Proxy?{}:new Proxy(e,{get:(e,t)=>o(t),ownKeys:()=>Array.from(s.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,t)=>s.has(t),set:(e,t,s)=>(l(t,s),!0)}),i=(e,t)=>(r[e].push(t),()=>{((e,t)=>{const s=e.indexOf(t);s>=0&&(e[s]=e[e.length-1],e.length--)})(r[e],t)});return{state:u,get:o,set:l,on:i,onChange:(t,s)=>{const r=i("set",((e,r)=>{e===t&&s(r)})),n=i("reset",(()=>s(e[t])));return()=>{r(),n()}},use:(...e)=>{const t=e.reduce(((e,t)=>(t.set&&e.push(i("set",t.set)),t.get&&e.push(i("get",t.get)),t.reset&&e.push(i("reset",t.reset)),t.dispose&&e.push(i("dispose",t.dispose)),e)),[]);return()=>t.forEach((e=>e()))},dispose:()=>{r.dispose.forEach((e=>e())),n()},reset:n,forceUpdate:e=>{const t=s.get(e);r.set.forEach((s=>s(e,t,t)))}}})({api:"",treks:null,currentTreks:null,treksWithinBounds:null,currentMapTreksBounds:null,difficulties:[],routes:[],practices:[],themes:[],durations:[],currentSensitiveAreas:null,labels:null,sources:null,accessibilities:null,accessibilitiesLevel:null,currentTrek:null,currentPois:null,currentInformationDesks:null,treksNetworkError:!1,trekNetworkError:!1},void 0);return s.use((()=>{if("function"!=typeof e)return{};const s=new Map;return{dispose:()=>s.clear(),get:t=>{const r=e();r&&((e,t,s)=>{const r=e.get(t);r?r.includes(s)||r.push(s):e.set(t,[s])})(s,t,r)},set:e=>{const n=s.get(e);n&&s.set(e,n.filter(t)),r(s)},reset:()=>{s.forEach((e=>e.forEach(t))),r(s)}}})()),s})();export{o,n as s}