diff --git a/dist/samples/3d-camera-position/app/index.ts b/dist/samples/3d-camera-position/app/index.ts index fc84e3e24..e6b7ddfc3 100644 --- a/dist/samples/3d-camera-position/app/index.ts +++ b/dist/samples/3d-camera-position/app/index.ts @@ -21,13 +21,13 @@ async function initMap(): Promise { const fovSlider = document.getElementById('fov') as HTMLInputElement; const rollSlider = document.getElementById('roll') as HTMLInputElement; - const headingVal = document.getElementById('heading-val') as HTMLElement; - const tiltVal = document.getElementById('tilt-val') as HTMLElement; - const rangeVal = document.getElementById('range-val') as HTMLElement; - const altitudeVal = document.getElementById('altitude-val') as HTMLElement; - const fovVal = document.getElementById('fov-val') as HTMLElement; - const rollVal = document.getElementById('roll-val') as HTMLElement; - const codeElem = document.getElementById('generated-code') as HTMLElement; + const headingVal = document.getElementById('heading-val')!; + const tiltVal = document.getElementById('tilt-val')!; + const rangeVal = document.getElementById('range-val')!; + const altitudeVal = document.getElementById('altitude-val')!; + const fovVal = document.getElementById('fov-val')!; + const rollVal = document.getElementById('roll-val')!; + const codeElem = document.getElementById('generated-code')!; const copyBtn = document.getElementById('copy-btn') as HTMLButtonElement; let currentAltitude = 30; @@ -82,7 +82,7 @@ async function initMap(): Promise { }); // Listen to slider changes using event delegation. - const panel = document.querySelector('.panel') as HTMLElement; + const panel = document.querySelector('.panel')!; panel.addEventListener('input', (e) => { const target = e.target as HTMLInputElement; @@ -121,7 +121,8 @@ async function initMap(): Promise { }; } } else { - map3DElement[prop] = val; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (map3DElement as any)[prop] = val; } updateUI(); }); diff --git a/dist/samples/3d-camera-position/docs/index.js b/dist/samples/3d-camera-position/docs/index.js index a7b9edfe7..f2c7bad88 100644 --- a/dist/samples/3d-camera-position/docs/index.js +++ b/dist/samples/3d-camera-position/docs/index.js @@ -109,6 +109,7 @@ async function initMap() { } } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any map3DElement[prop] = val; } updateUI(); diff --git a/dist/samples/3d-camera-position/docs/index.ts b/dist/samples/3d-camera-position/docs/index.ts index fc84e3e24..e6b7ddfc3 100644 --- a/dist/samples/3d-camera-position/docs/index.ts +++ b/dist/samples/3d-camera-position/docs/index.ts @@ -21,13 +21,13 @@ async function initMap(): Promise { const fovSlider = document.getElementById('fov') as HTMLInputElement; const rollSlider = document.getElementById('roll') as HTMLInputElement; - const headingVal = document.getElementById('heading-val') as HTMLElement; - const tiltVal = document.getElementById('tilt-val') as HTMLElement; - const rangeVal = document.getElementById('range-val') as HTMLElement; - const altitudeVal = document.getElementById('altitude-val') as HTMLElement; - const fovVal = document.getElementById('fov-val') as HTMLElement; - const rollVal = document.getElementById('roll-val') as HTMLElement; - const codeElem = document.getElementById('generated-code') as HTMLElement; + const headingVal = document.getElementById('heading-val')!; + const tiltVal = document.getElementById('tilt-val')!; + const rangeVal = document.getElementById('range-val')!; + const altitudeVal = document.getElementById('altitude-val')!; + const fovVal = document.getElementById('fov-val')!; + const rollVal = document.getElementById('roll-val')!; + const codeElem = document.getElementById('generated-code')!; const copyBtn = document.getElementById('copy-btn') as HTMLButtonElement; let currentAltitude = 30; @@ -82,7 +82,7 @@ async function initMap(): Promise { }); // Listen to slider changes using event delegation. - const panel = document.querySelector('.panel') as HTMLElement; + const panel = document.querySelector('.panel')!; panel.addEventListener('input', (e) => { const target = e.target as HTMLInputElement; @@ -121,7 +121,8 @@ async function initMap(): Promise { }; } } else { - map3DElement[prop] = val; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (map3DElement as any)[prop] = val; } updateUI(); }); diff --git a/dist/samples/3d-camera-position/jsfiddle/demo.js b/dist/samples/3d-camera-position/jsfiddle/demo.js index 3ef53de3c..405648f3e 100644 --- a/dist/samples/3d-camera-position/jsfiddle/demo.js +++ b/dist/samples/3d-camera-position/jsfiddle/demo.js @@ -105,6 +105,7 @@ async function initMap() { }; } } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any map3DElement[prop] = val; } updateUI(); diff --git a/dist/samples/3d-clamp-mode/app/index.ts b/dist/samples/3d-clamp-mode/app/index.ts index c5cfb8b4b..dfc9ea12f 100644 --- a/dist/samples/3d-clamp-mode/app/index.ts +++ b/dist/samples/3d-clamp-mode/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_clamp_mode] -let polyline; +let polyline: google.maps.maps3d.Polyline3DElement; async function init() { const { Map3DElement, Polyline3DElement } = @@ -56,7 +56,8 @@ const dropdown = document.getElementById( ) as HTMLSelectElement; dropdown.addEventListener('change', () => { if (polyline && dropdown.value) { - polyline.altitudeMode = dropdown.value; + polyline.altitudeMode = + dropdown.value as google.maps.maps3d.AltitudeModeString; } }); diff --git a/dist/samples/3d-clamp-mode/docs/index.ts b/dist/samples/3d-clamp-mode/docs/index.ts index c5cfb8b4b..dfc9ea12f 100644 --- a/dist/samples/3d-clamp-mode/docs/index.ts +++ b/dist/samples/3d-clamp-mode/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_clamp_mode] -let polyline; +let polyline: google.maps.maps3d.Polyline3DElement; async function init() { const { Map3DElement, Polyline3DElement } = @@ -56,7 +56,8 @@ const dropdown = document.getElementById( ) as HTMLSelectElement; dropdown.addEventListener('change', () => { if (polyline && dropdown.value) { - polyline.altitudeMode = dropdown.value; + polyline.altitudeMode = + dropdown.value as google.maps.maps3d.AltitudeModeString; } }); diff --git a/dist/samples/3d-label-toggle/app/index.ts b/dist/samples/3d-label-toggle/app/index.ts index d472ab288..ca42dc892 100644 --- a/dist/samples/3d-label-toggle/app/index.ts +++ b/dist/samples/3d-label-toggle/app/index.ts @@ -27,9 +27,9 @@ async function init() { // Get the button element by its ID const toggleButton = document.getElementById('toggleButton')!; - toggleButton.addEventListener('click', function () { + toggleButton.addEventListener('click', () => { // Toggle the labels. - if (map.mode == 'SATELLITE') { + if (map.mode === 'SATELLITE') { // Setting the map mode to HYBRID turns the labels on. map.mode = 'HYBRID'; toggleButton.innerText = 'Labels are on. (HYBRID)'; diff --git a/dist/samples/3d-label-toggle/dist/assets/index-E8DBn9fK.js b/dist/samples/3d-label-toggle/dist/assets/index-D9pWrcCl.js similarity index 86% rename from dist/samples/3d-label-toggle/dist/assets/index-E8DBn9fK.js rename to dist/samples/3d-label-toggle/dist/assets/index-D9pWrcCl.js index 9846dc3ef..f9915cb95 100644 --- a/dist/samples/3d-label-toggle/dist/assets/index-E8DBn9fK.js +++ b/dist/samples/3d-label-toggle/dist/assets/index-D9pWrcCl.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){let{Map3DElement:t}=await google.maps.importLibrary(`maps3d`);e=new t({center:{lat:37.79810773998413,lng:-122.41784275049939,altitude:89.08476932205978},range:6062.016931506805,tilt:81.17100663963272,heading:-56.047035719765596,gestureHandling:`COOPERATIVE`}),e.mode=`SATELLITE`,document.body.append(e);let n=document.getElementById(`toggleButton`);n.addEventListener(`click`,function(){e.mode==`SATELLITE`?(e.mode=`HYBRID`,n.innerText=`Labels are on. (HYBRID)`):(e.mode=`SATELLITE`,n.innerText=`Labels are off. (SATELLITE)`)})}t(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){let{Map3DElement:t}=await google.maps.importLibrary(`maps3d`);e=new t({center:{lat:37.79810773998413,lng:-122.41784275049939,altitude:89.08476932205978},range:6062.016931506805,tilt:81.17100663963272,heading:-56.047035719765596,gestureHandling:`COOPERATIVE`}),e.mode=`SATELLITE`,document.body.append(e);let n=document.getElementById(`toggleButton`);n.addEventListener(`click`,()=>{e.mode===`SATELLITE`?(e.mode=`HYBRID`,n.innerText=`Labels are on. (HYBRID)`):(e.mode=`SATELLITE`,n.innerText=`Labels are off. (SATELLITE)`)})}t(); \ No newline at end of file diff --git a/dist/samples/3d-label-toggle/dist/index.html b/dist/samples/3d-label-toggle/dist/index.html index 4a92a1160..1482aed37 100644 --- a/dist/samples/3d-label-toggle/dist/index.html +++ b/dist/samples/3d-label-toggle/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/3d-label-toggle/docs/index.js b/dist/samples/3d-label-toggle/docs/index.js index de01bd69e..5218fb056 100644 --- a/dist/samples/3d-label-toggle/docs/index.js +++ b/dist/samples/3d-label-toggle/docs/index.js @@ -28,9 +28,9 @@ async function init() { // Get the button element by its ID const toggleButton = document.getElementById('toggleButton'); - toggleButton.addEventListener('click', function () { + toggleButton.addEventListener('click', () => { // Toggle the labels. - if (map.mode == 'SATELLITE') { + if (map.mode === 'SATELLITE') { // Setting the map mode to HYBRID turns the labels on. map.mode = 'HYBRID'; toggleButton.innerText = 'Labels are on. (HYBRID)'; diff --git a/dist/samples/3d-label-toggle/docs/index.ts b/dist/samples/3d-label-toggle/docs/index.ts index 87612bb68..ca42dc892 100644 --- a/dist/samples/3d-label-toggle/docs/index.ts +++ b/dist/samples/3d-label-toggle/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_label_toggle] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement } = await google.maps.importLibrary('maps3d'); @@ -27,9 +27,9 @@ async function init() { // Get the button element by its ID const toggleButton = document.getElementById('toggleButton')!; - toggleButton.addEventListener('click', function () { + toggleButton.addEventListener('click', () => { // Toggle the labels. - if (map.mode == 'SATELLITE') { + if (map.mode === 'SATELLITE') { // Setting the map mode to HYBRID turns the labels on. map.mode = 'HYBRID'; toggleButton.innerText = 'Labels are on. (HYBRID)'; diff --git a/dist/samples/3d-label-toggle/jsfiddle/demo.js b/dist/samples/3d-label-toggle/jsfiddle/demo.js index d8db7d4cc..82cd6f540 100644 --- a/dist/samples/3d-label-toggle/jsfiddle/demo.js +++ b/dist/samples/3d-label-toggle/jsfiddle/demo.js @@ -27,9 +27,9 @@ async function init() { // Get the button element by its ID const toggleButton = document.getElementById('toggleButton'); - toggleButton.addEventListener('click', function () { + toggleButton.addEventListener('click', () => { // Toggle the labels. - if (map.mode == 'SATELLITE') { + if (map.mode === 'SATELLITE') { // Setting the map mode to HYBRID turns the labels on. map.mode = 'HYBRID'; toggleButton.innerText = 'Labels are on. (HYBRID)'; diff --git a/dist/samples/3d-map-45-degree-locked/app/index.html b/dist/samples/3d-map-45-degree-locked/app/index.html index 33d6e3e33..95e0fdc4e 100644 --- a/dist/samples/3d-map-45-degree-locked/app/index.html +++ b/dist/samples/3d-map-45-degree-locked/app/index.html @@ -10,12 +10,9 @@ 3d map 45-degree perspective - + { - await google.maps.importLibrary('maps3d'); -} - -void initMap(); // [END maps_3d_map_45_degree_locked] diff --git a/dist/samples/3d-map-45-degree-locked/dist/assets/index-DnsoIklU.js b/dist/samples/3d-map-45-degree-locked/dist/assets/index-CGhmJKDO.js similarity index 83% rename from dist/samples/3d-map-45-degree-locked/dist/assets/index-DnsoIklU.js rename to dist/samples/3d-map-45-degree-locked/dist/assets/index-CGhmJKDO.js index 1d6ff88c4..4ec366922 100644 --- a/dist/samples/3d-map-45-degree-locked/dist/assets/index-DnsoIklU.js +++ b/dist/samples/3d-map-45-degree-locked/dist/assets/index-CGhmJKDO.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){await google.maps.importLibrary(`maps3d`)}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(); \ No newline at end of file diff --git a/dist/samples/3d-map-45-degree-locked/dist/index.html b/dist/samples/3d-map-45-degree-locked/dist/index.html index c5ac687c8..86126fb82 100644 --- a/dist/samples/3d-map-45-degree-locked/dist/index.html +++ b/dist/samples/3d-map-45-degree-locked/dist/index.html @@ -8,13 +8,10 @@ 3d map 45-degree perspective - - + + diff --git a/dist/samples/3d-map-45-degree-locked/docs/index.html b/dist/samples/3d-map-45-degree-locked/docs/index.html index 33d6e3e33..95e0fdc4e 100644 --- a/dist/samples/3d-map-45-degree-locked/docs/index.html +++ b/dist/samples/3d-map-45-degree-locked/docs/index.html @@ -10,12 +10,9 @@ 3d map 45-degree perspective - + { - await google.maps.importLibrary('maps3d'); -} - -void initMap(); // [END maps_3d_map_45_degree_locked] diff --git a/dist/samples/3d-map-45-degree-locked/jsfiddle/demo.html b/dist/samples/3d-map-45-degree-locked/jsfiddle/demo.html index 693c37160..05f7c7402 100644 --- a/dist/samples/3d-map-45-degree-locked/jsfiddle/demo.html +++ b/dist/samples/3d-map-45-degree-locked/jsfiddle/demo.html @@ -10,12 +10,9 @@ 3d map 45-degree perspective - + + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> 3D Marker HTML + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> diff --git a/dist/samples/3d-marker-html/docs/index.html b/dist/samples/3d-marker-html/docs/index.html index 9ffb84276..d62dc5760 100644 --- a/dist/samples/3d-marker-html/docs/index.html +++ b/dist/samples/3d-marker-html/docs/index.html @@ -11,7 +11,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> { + async ({ + placePrediction, + }: google.maps.places.PlacePredictionSelectEvent) => { const place = placePrediction.toPlace(); await place.fetchFields({ fields: ['displayName', 'location', 'id'], @@ -52,10 +57,10 @@ async function initAutocomplete() { ); } -const flyToPlace = async (place) => { +const flyToPlace = async (place: google.maps.places.Place) => { const { Marker3DElement } = await google.maps.importLibrary('maps3d'); - const location = place.location; + const location = place.location!; // We need to find the elevation for the point so we place the marker at 50m above the elevation. const elevation = await getElevationforPoint(location, place); @@ -68,7 +73,7 @@ const flyToPlace = async (place) => { }, altitudeMode: 'ABSOLUTE', extruded: true, - label: place.displayName, + label: place.displayName!, }); // Add the marker. @@ -90,7 +95,10 @@ const flyToPlace = async (place) => { }); }; -async function getElevationforPoint(location, place) { +async function getElevationforPoint( + location: google.maps.LatLng, + place: google.maps.places.Place +) { const defaultElevation = 10; const { ElevationService } = await google.maps.importLibrary('elevation'); // Get place elevation using the ElevationService. @@ -99,8 +107,10 @@ async function getElevationforPoint(location, place) { locations: [location], }); - if (!(elevationResponse.results && elevationResponse.results.length)) { - window.alert(`Insufficient elevation data for place: ${place.name}`); + if (!elevationResponse?.results.length) { + window.alert( + `Insufficient elevation data for place: ${place.displayName}` + ); return defaultElevation; } const elevation = diff --git a/dist/samples/3d-places-autocomplete/dist/assets/index-DMj0Nm0b.js b/dist/samples/3d-places-autocomplete/dist/assets/index-D-J-5Zgl.js similarity index 93% rename from dist/samples/3d-places-autocomplete/dist/assets/index-DMj0Nm0b.js rename to dist/samples/3d-places-autocomplete/dist/assets/index-D-J-5Zgl.js index cf4855b81..104127657 100644 --- a/dist/samples/3d-places-autocomplete/dist/assets/index-DMj0Nm0b.js +++ b/dist/samples/3d-places-autocomplete/dist/assets/index-D-J-5Zgl.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){let{Map3DElement:t}=await google.maps.importLibrary(`maps3d`);e=new t({center:{lat:0,lng:0,altitude:16e6},tilt:0,range:0,heading:0,roll:0,mode:`HYBRID`,gestureHandling:`COOPERATIVE`}),document.body.append(e),n()}async function n(){let{PlaceAutocompleteElement:e}=await google.maps.importLibrary(`places`),t=new e;t.id=`place-autocomplete-input`,document.getElementById(`pac-container`).appendChild(t),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();if(await t.fetchFields({fields:[`displayName`,`location`,`id`]}),!t.location){window.alert(`No viewport for input: `+t.displayName);return}r(t)})}var r=async t=>{let{Marker3DElement:n}=await google.maps.importLibrary(`maps3d`),r=t.location,a=await i(r,t),o=new n({position:{lat:r.lat(),lng:r.lng(),altitude:a+50},altitudeMode:`ABSOLUTE`,extruded:!0,label:t.displayName});e.append(o),e.flyCameraTo({endCamera:{center:{lat:r.lat(),lng:r.lng(),altitude:a+50},tilt:65,heading:0,range:1e3},durationMillis:1e4})};async function i(e,t){let{ElevationService:n}=await google.maps.importLibrary(`elevation`),r=await new n().getElevationForLocations({locations:[e]});return r.results&&r.results.length?r.results[0].elevation||10:(window.alert(`Insufficient elevation data for place: ${t.name}`),10)}t(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){let{Map3DElement:t}=await google.maps.importLibrary(`maps3d`);e=new t({center:{lat:0,lng:0,altitude:16e6},tilt:0,range:0,heading:0,roll:0,mode:`HYBRID`,gestureHandling:`COOPERATIVE`}),document.body.append(e),n()}async function n(){let{PlaceAutocompleteElement:e}=await google.maps.importLibrary(`places`),t=new e;t.id=`place-autocomplete-input`,document.getElementById(`pac-container`).appendChild(t),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();if(await t.fetchFields({fields:[`displayName`,`location`,`id`]}),!t.location){window.alert(`No viewport for input: `+t.displayName);return}r(t)})}var r=async t=>{let{Marker3DElement:n}=await google.maps.importLibrary(`maps3d`),r=t.location,a=await i(r,t),o=new n({position:{lat:r.lat(),lng:r.lng(),altitude:a+50},altitudeMode:`ABSOLUTE`,extruded:!0,label:t.displayName});e.append(o),e.flyCameraTo({endCamera:{center:{lat:r.lat(),lng:r.lng(),altitude:a+50},tilt:65,heading:0,range:1e3},durationMillis:1e4})};async function i(e,t){let{ElevationService:n}=await google.maps.importLibrary(`elevation`),r=await new n().getElevationForLocations({locations:[e]});return r?.results.length?r.results[0].elevation||10:(window.alert(`Insufficient elevation data for place: ${t.displayName}`),10)}t(); \ No newline at end of file diff --git a/dist/samples/3d-places-autocomplete/dist/index.html b/dist/samples/3d-places-autocomplete/dist/index.html index 99fb44ff6..2121d1769 100644 --- a/dist/samples/3d-places-autocomplete/dist/index.html +++ b/dist/samples/3d-places-autocomplete/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/3d-places-autocomplete/docs/index.js b/dist/samples/3d-places-autocomplete/docs/index.js index 602cb3bf9..4a28c5f2a 100644 --- a/dist/samples/3d-places-autocomplete/docs/index.js +++ b/dist/samples/3d-places-autocomplete/docs/index.js @@ -27,7 +27,6 @@ async function init() { } async function initAutocomplete() { - // @ts-expect-error - currently missing. bug fix pending const { PlaceAutocompleteElement } = await google.maps.importLibrary('places'); @@ -100,8 +99,10 @@ async function getElevationforPoint(location, place) { locations: [location], }); - if (!(elevationResponse.results && elevationResponse.results.length)) { - window.alert(`Insufficient elevation data for place: ${place.name}`); + if (!elevationResponse?.results.length) { + window.alert( + `Insufficient elevation data for place: ${place.displayName}` + ); return defaultElevation; } const elevation = diff --git a/dist/samples/3d-places-autocomplete/docs/index.ts b/dist/samples/3d-places-autocomplete/docs/index.ts index 7d240c1ff..8512400c3 100644 --- a/dist/samples/3d-places-autocomplete/docs/index.ts +++ b/dist/samples/3d-places-autocomplete/docs/index.ts @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ + // [START maps_3d_places_autocomplete] let map: google.maps.maps3d.Map3DElement; @@ -37,7 +40,9 @@ async function initAutocomplete() { placeAutocomplete.addEventListener( 'gmp-select', - async ({ placePrediction }) => { + async ({ + placePrediction, + }: google.maps.places.PlacePredictionSelectEvent) => { const place = placePrediction.toPlace(); await place.fetchFields({ fields: ['displayName', 'location', 'id'], @@ -52,10 +57,10 @@ async function initAutocomplete() { ); } -const flyToPlace = async (place) => { +const flyToPlace = async (place: google.maps.places.Place) => { const { Marker3DElement } = await google.maps.importLibrary('maps3d'); - const location = place.location; + const location = place.location!; // We need to find the elevation for the point so we place the marker at 50m above the elevation. const elevation = await getElevationforPoint(location, place); @@ -68,7 +73,7 @@ const flyToPlace = async (place) => { }, altitudeMode: 'ABSOLUTE', extruded: true, - label: place.displayName, + label: place.displayName!, }); // Add the marker. @@ -90,7 +95,10 @@ const flyToPlace = async (place) => { }); }; -async function getElevationforPoint(location, place) { +async function getElevationforPoint( + location: google.maps.LatLng, + place: google.maps.places.Place +) { const defaultElevation = 10; const { ElevationService } = await google.maps.importLibrary('elevation'); // Get place elevation using the ElevationService. @@ -99,8 +107,10 @@ async function getElevationforPoint(location, place) { locations: [location], }); - if (!(elevationResponse.results && elevationResponse.results.length)) { - window.alert(`Insufficient elevation data for place: ${place.name}`); + if (!elevationResponse?.results.length) { + window.alert( + `Insufficient elevation data for place: ${place.displayName}` + ); return defaultElevation; } const elevation = diff --git a/dist/samples/3d-places-autocomplete/jsfiddle/demo.js b/dist/samples/3d-places-autocomplete/jsfiddle/demo.js index a758b8e00..81bf272d5 100644 --- a/dist/samples/3d-places-autocomplete/jsfiddle/demo.js +++ b/dist/samples/3d-places-autocomplete/jsfiddle/demo.js @@ -26,7 +26,6 @@ async function init() { } async function initAutocomplete() { - // @ts-expect-error - currently missing. bug fix pending const { PlaceAutocompleteElement } = await google.maps.importLibrary('places'); @@ -99,8 +98,10 @@ async function getElevationforPoint(location, place) { locations: [location], }); - if (!(elevationResponse.results && elevationResponse.results.length)) { - window.alert(`Insufficient elevation data for place: ${place.name}`); + if (!elevationResponse?.results.length) { + window.alert( + `Insufficient elevation data for place: ${place.displayName}` + ); return defaultElevation; } const elevation = diff --git a/dist/samples/3d-polygon-click-event/app/index.ts b/dist/samples/3d-polygon-click-event/app/index.ts index 0490c310b..cf3e584ef 100644 --- a/dist/samples/3d-polygon-click-event/app/index.ts +++ b/dist/samples/3d-polygon-click-event/app/index.ts @@ -37,15 +37,15 @@ async function init() { examplePolygon.addEventListener('gmp-click', function (event) { // change the color of the polygon stroke and fill colors to a random alternatives! - this.fillColor = randomizeHexColor(this.fillColor); - this.strokeColor = randomizeHexColor(this.fillColor); + this.fillColor = randomizeHexColor(this.fillColor!); + this.strokeColor = randomizeHexColor(this.strokeColor!); console.log(event); }); map.append(examplePolygon); } -function randomizeHexColor(originalHexColor) { +function randomizeHexColor(originalHexColor: string) { console.log(originalHexColor); const alpha = originalHexColor.substring(7); diff --git a/dist/samples/3d-polygon-click-event/dist/assets/index-rHnFRpac.js b/dist/samples/3d-polygon-click-event/dist/assets/index-WLwVjEk_.js similarity index 75% rename from dist/samples/3d-polygon-click-event/dist/assets/index-rHnFRpac.js rename to dist/samples/3d-polygon-click-event/dist/assets/index-WLwVjEk_.js index 95eb34a7a..368fc1052 100644 --- a/dist/samples/3d-polygon-click-event/dist/assets/index-rHnFRpac.js +++ b/dist/samples/3d-polygon-click-event/dist/assets/index-WLwVjEk_.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let{Map3DElement:e,Polygon3DInteractiveElement:n}=await google.maps.importLibrary(`maps3d`),r=new e({center:{lat:40.6842,lng:-74.0019,altitude:1e3},heading:340,tilt:70,mode:`HYBRID`,gestureHandling:`COOPERATIVE`});document.body.append(r);let i=new n({strokeColor:`#0000ff80`,strokeWidth:8,fillColor:`#ff000080`,drawsOccludedSegments:!1});i.path=[{lat:40.7144,lng:-74.0208},{lat:40.6993,lng:-74.019},{lat:40.7035,lng:-74.0004},{lat:40.7144,lng:-74.0208}],i.addEventListener(`gmp-click`,function(e){this.fillColor=t(this.fillColor),this.strokeColor=t(this.fillColor),console.log(e)}),r.append(i)}function t(e){console.log(e);let t=e.substring(7),n=Math.floor(Math.random()*256),r=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return console.log(n+` `+r+` `+i),`#${(`0`+n.toString(16)).slice(-2)}${(`0`+r.toString(16)).slice(-2)}${(`0`+i.toString(16)).slice(-2)}${t}`}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let{Map3DElement:e,Polygon3DInteractiveElement:n}=await google.maps.importLibrary(`maps3d`),r=new e({center:{lat:40.6842,lng:-74.0019,altitude:1e3},heading:340,tilt:70,mode:`HYBRID`,gestureHandling:`COOPERATIVE`});document.body.append(r);let i=new n({strokeColor:`#0000ff80`,strokeWidth:8,fillColor:`#ff000080`,drawsOccludedSegments:!1});i.path=[{lat:40.7144,lng:-74.0208},{lat:40.6993,lng:-74.019},{lat:40.7035,lng:-74.0004},{lat:40.7144,lng:-74.0208}],i.addEventListener(`gmp-click`,function(e){this.fillColor=t(this.fillColor),this.strokeColor=t(this.strokeColor),console.log(e)}),r.append(i)}function t(e){console.log(e);let t=e.substring(7),n=Math.floor(Math.random()*256),r=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return console.log(n+` `+r+` `+i),`#${(`0`+n.toString(16)).slice(-2)}${(`0`+r.toString(16)).slice(-2)}${(`0`+i.toString(16)).slice(-2)}${t}`}e(); \ No newline at end of file diff --git a/dist/samples/3d-polygon-click-event/dist/index.html b/dist/samples/3d-polygon-click-event/dist/index.html index 8f01480fc..ed352200b 100644 --- a/dist/samples/3d-polygon-click-event/dist/index.html +++ b/dist/samples/3d-polygon-click-event/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/3d-polygon-click-event/docs/index.js b/dist/samples/3d-polygon-click-event/docs/index.js index da12c7c25..e8d8a61c7 100644 --- a/dist/samples/3d-polygon-click-event/docs/index.js +++ b/dist/samples/3d-polygon-click-event/docs/index.js @@ -39,7 +39,7 @@ async function init() { examplePolygon.addEventListener('gmp-click', function (event) { // change the color of the polygon stroke and fill colors to a random alternatives! this.fillColor = randomizeHexColor(this.fillColor); - this.strokeColor = randomizeHexColor(this.fillColor); + this.strokeColor = randomizeHexColor(this.strokeColor); console.log(event); }); diff --git a/dist/samples/3d-polygon-click-event/docs/index.ts b/dist/samples/3d-polygon-click-event/docs/index.ts index 0490c310b..cf3e584ef 100644 --- a/dist/samples/3d-polygon-click-event/docs/index.ts +++ b/dist/samples/3d-polygon-click-event/docs/index.ts @@ -37,15 +37,15 @@ async function init() { examplePolygon.addEventListener('gmp-click', function (event) { // change the color of the polygon stroke and fill colors to a random alternatives! - this.fillColor = randomizeHexColor(this.fillColor); - this.strokeColor = randomizeHexColor(this.fillColor); + this.fillColor = randomizeHexColor(this.fillColor!); + this.strokeColor = randomizeHexColor(this.strokeColor!); console.log(event); }); map.append(examplePolygon); } -function randomizeHexColor(originalHexColor) { +function randomizeHexColor(originalHexColor: string) { console.log(originalHexColor); const alpha = originalHexColor.substring(7); diff --git a/dist/samples/3d-polygon-click-event/jsfiddle/demo.js b/dist/samples/3d-polygon-click-event/jsfiddle/demo.js index 88795259a..f65acefe1 100644 --- a/dist/samples/3d-polygon-click-event/jsfiddle/demo.js +++ b/dist/samples/3d-polygon-click-event/jsfiddle/demo.js @@ -38,7 +38,7 @@ async function init() { examplePolygon.addEventListener('gmp-click', function (event) { // change the color of the polygon stroke and fill colors to a random alternatives! this.fillColor = randomizeHexColor(this.fillColor); - this.strokeColor = randomizeHexColor(this.fillColor); + this.strokeColor = randomizeHexColor(this.strokeColor); console.log(event); }); diff --git a/dist/samples/3d-polyline-click-event/app/index.ts b/dist/samples/3d-polyline-click-event/app/index.ts index c938fe2b5..6c10881c3 100644 --- a/dist/samples/3d-polyline-click-event/app/index.ts +++ b/dist/samples/3d-polyline-click-event/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_polyline_click_event] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement, Polyline3DInteractiveElement } = await google.maps.importLibrary('maps3d'); diff --git a/dist/samples/3d-polyline-click-event/docs/index.ts b/dist/samples/3d-polyline-click-event/docs/index.ts index c938fe2b5..6c10881c3 100644 --- a/dist/samples/3d-polyline-click-event/docs/index.ts +++ b/dist/samples/3d-polyline-click-event/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_polyline_click_event] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement, Polyline3DInteractiveElement } = await google.maps.importLibrary('maps3d'); diff --git a/dist/samples/3d-polyline-extruded/app/index.ts b/dist/samples/3d-polyline-extruded/app/index.ts index 7f9898d75..ee24a29ef 100644 --- a/dist/samples/3d-polyline-extruded/app/index.ts +++ b/dist/samples/3d-polyline-extruded/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_polyline_extruded] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement, Polyline3DElement } = await google.maps.importLibrary('maps3d'); diff --git a/dist/samples/3d-polyline-extruded/docs/index.ts b/dist/samples/3d-polyline-extruded/docs/index.ts index 7f9898d75..ee24a29ef 100644 --- a/dist/samples/3d-polyline-extruded/docs/index.ts +++ b/dist/samples/3d-polyline-extruded/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_polyline_extruded] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement, Polyline3DElement } = await google.maps.importLibrary('maps3d'); diff --git a/dist/samples/3d-polyline/app/index.ts b/dist/samples/3d-polyline/app/index.ts index c8bf83543..ec18f0d6e 100644 --- a/dist/samples/3d-polyline/app/index.ts +++ b/dist/samples/3d-polyline/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_polyline] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement, Polyline3DElement } = await google.maps.importLibrary('maps3d'); diff --git a/dist/samples/3d-polyline/docs/index.ts b/dist/samples/3d-polyline/docs/index.ts index c8bf83543..ec18f0d6e 100644 --- a/dist/samples/3d-polyline/docs/index.ts +++ b/dist/samples/3d-polyline/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_3d_polyline] -let map; +let map: google.maps.maps3d.Map3DElement; async function init() { const { Map3DElement, Polyline3DElement } = await google.maps.importLibrary('maps3d'); diff --git a/dist/samples/3d-simple-map-declarative/app/index.html b/dist/samples/3d-simple-map-declarative/app/index.html index 335a3373c..945ac2d0f 100644 --- a/dist/samples/3d-simple-map-declarative/app/index.html +++ b/dist/samples/3d-simple-map-declarative/app/index.html @@ -11,13 +11,11 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> - + + diff --git a/dist/samples/3d-simple-map-declarative/dist/index.html b/dist/samples/3d-simple-map-declarative/dist/index.html index 0c4fedfee..bcb60581f 100644 --- a/dist/samples/3d-simple-map-declarative/dist/index.html +++ b/dist/samples/3d-simple-map-declarative/dist/index.html @@ -10,14 +10,12 @@ Map + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> - + + diff --git a/dist/samples/3d-simple-map-declarative/docs/index.html b/dist/samples/3d-simple-map-declarative/docs/index.html index 335a3373c..945ac2d0f 100644 --- a/dist/samples/3d-simple-map-declarative/docs/index.html +++ b/dist/samples/3d-simple-map-declarative/docs/index.html @@ -11,13 +11,11 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> - + + diff --git a/dist/samples/3d-simple-map-declarative/jsfiddle/demo.html b/dist/samples/3d-simple-map-declarative/jsfiddle/demo.html index 64549f1b7..1d43a5d57 100644 --- a/dist/samples/3d-simple-map-declarative/jsfiddle/demo.html +++ b/dist/samples/3d-simple-map-declarative/jsfiddle/demo.html @@ -11,12 +11,10 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps3d"> - + + diff --git a/dist/samples/address-validation/app/index.ts b/dist/samples/address-validation/app/index.ts index 851084b4e..e6f5d92b1 100644 --- a/dist/samples/address-validation/app/index.ts +++ b/dist/samples/address-validation/app/index.ts @@ -6,9 +6,11 @@ // [START maps_address_validation] // DOM Refs -const addressForm = document.getElementById('address-form'); -const clearFormButton = document.getElementById('clear-form-button'); -const resultDisplay = document.getElementById('result-display'); +const addressForm = document.getElementById('address-form') as HTMLFormElement; +const clearFormButton = document.getElementById( + 'clear-form-button' +) as HTMLButtonElement; +const resultDisplay = document.getElementById('result-display')!; // Input field refs const streetAddress1Input = document.getElementById( 'street-address-1' @@ -38,7 +40,7 @@ async function init() { // [START maps_address_validation_form_handler] // Validation Handler -async function handleValidationSubmit(event) { +async function handleValidationSubmit(event: Event) { event.preventDefault(); // Prevent default form submission resultDisplay.textContent = 'Validating...'; // Clear previous results @@ -63,11 +65,11 @@ async function handleValidationSubmit(event) { resultDisplay.textContent = 'Verdict summary\n================\n' + - `Formatted address: ${result.address.formattedAddress}\n` + - `Entered: ${result.verdict.inputGranularity}\n` + - `Validated: ${result.verdict.validationGranularity}\n` + - `Geocoded: ${result.verdict.geocodeGranularity}\n` + - `Possible next action: ${result.verdict.possibleNextAction}\n\n` + + `Formatted address: ${result.address?.formattedAddress}\n` + + `Entered: ${result.verdict?.inputGranularity}\n` + + `Validated: ${result.verdict?.validationGranularity}\n` + + `Geocoded: ${result.verdict?.geocodeGranularity}\n` + + `Possible next action: ${result.verdict?.possibleNextAction}\n\n` + `${getVerdictMessage(result.verdict, 'addressComplete')}\n` + `${getVerdictMessage(result.verdict, 'hasUnconfirmedComponents')}\n` + `${getVerdictMessage(result.verdict, 'hasInferredComponents')}\n` + @@ -84,7 +86,10 @@ async function handleValidationSubmit(event) { // [END maps_address_validation_form_handler] // Verdict messages -const verdictMessages = { +const verdictMessages: Record< + string, + { trueMessage: string; falseMessage: string } +> = { addressComplete: { trueMessage: '- The API found no unresolved, unexpected, or missing address elements.', @@ -107,7 +112,10 @@ const verdictMessages = { }; // Helper function to get the verdict message for a given verdict key -function getVerdictMessage(verdict, key) { +function getVerdictMessage( + verdict: google.maps.addressValidation.Verdict | null, + key: keyof google.maps.addressValidation.Verdict +): string { if (!verdict || !verdictMessages[key]) return 'Unknown'; return verdict[key] ? verdictMessages[key].trueMessage @@ -115,8 +123,8 @@ function getVerdictMessage(verdict, key) { } // Handler for Dropdown Change -function handleExampleSelectChange(event) { - const selectedValue = event.target.value; +function handleExampleSelectChange(event: Event) { + const selectedValue = (event.target as HTMLSelectElement).value; if (selectedValue && examples[selectedValue]) { populateAddressFields(examples[selectedValue]); } else if (!selectedValue) { @@ -137,8 +145,17 @@ function handleClearForm() { console.log('Cleared form'); } +interface ExampleAddress { + streetAddress1: string; + streetAddress2: string | null; + city: string; + state: string; + zipCode: string; + region: string; +} + // Example Address Data -const examples = { +const examples: Record = { google: { streetAddress1: '1600 Amphitheatre Parkway', streetAddress2: '', // Explicitly empty @@ -190,7 +207,7 @@ const examples = { }; // Helper function to populate form fields with example address data -function populateAddressFields(exampleAddress) { +function populateAddressFields(exampleAddress: ExampleAddress | null) { if (!exampleAddress) { console.warn('No example address data provided.'); return; diff --git a/dist/samples/address-validation/app/tsconfig.json b/dist/samples/address-validation/app/tsconfig.json index e80d201f4..976bcc6ef 100644 --- a/dist/samples/address-validation/app/tsconfig.json +++ b/dist/samples/address-validation/app/tsconfig.json @@ -1,9 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "rootDir": ".", - "noImplicitAny": false, - "strict": false + "rootDir": "." }, "include": ["./*.ts"] } diff --git a/dist/samples/address-validation/dist/assets/index-C1ApeF0L.js b/dist/samples/address-validation/dist/assets/index-C1ApeF0L.js deleted file mode 100644 index a1cfe2cf1..000000000 --- a/dist/samples/address-validation/dist/assets/index-C1ApeF0L.js +++ /dev/null @@ -1,3 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.getElementById(`address-form`),t=document.getElementById(`clear-form-button`),n=document.getElementById(`result-display`),r=document.getElementById(`street-address-1`),i=document.getElementById(`street-address-2`),a=document.getElementById(`city`),o=document.getElementById(`state`),s=document.getElementById(`zip-code`),c=document.getElementById(`region-select`),l=document.getElementById(`example-select`);async function u(){await google.maps.importLibrary(`addressValidation`),e.addEventListener(`submit`,d),l.addEventListener(`change`,m),t.addEventListener(`click`,h)}async function d(e){e.preventDefault(),n.textContent=`Validating...`;let{AddressValidation:t}=await google.maps.importLibrary(`addressValidation`);try{let e=await t.fetchAddressValidation({address:{regionCode:c.value.trim(),languageCode:`en`,addressLines:[r.value.trim(),i.value.trim()].filter(Boolean),locality:a.value.trim(),administrativeArea:o.value.trim(),postalCode:s.value.trim()}});n.textContent=`Verdict summary -================ -Formatted address: ${e.address.formattedAddress}\nEntered: ${e.verdict.inputGranularity}\nValidated: ${e.verdict.validationGranularity}\nGeocoded: ${e.verdict.geocodeGranularity}\nPossible next action: ${e.verdict.possibleNextAction}\n\n${p(e.verdict,`addressComplete`)}\n${p(e.verdict,`hasUnconfirmedComponents`)}\n${p(e.verdict,`hasInferredComponents`)}\n${p(e.verdict,`hasReplacedComponents`)}\n\nRaw JSON response\n=================\n`+JSON.stringify(e,null,` `)}catch(e){console.error(`Validation failed:`,e),e instanceof Error&&(n.textContent=`Error: ${e.message}`)}}var f={addressComplete:{trueMessage:`- The API found no unresolved, unexpected, or missing address elements.`,falseMessage:`- At least one address element is unresolved, unexpected, or missing.`},hasUnconfirmedComponents:{trueMessage:`- The API can't confirm at least one address component.`,falseMessage:`- The API confirmed all address components.`},hasInferredComponents:{trueMessage:`- The API inferred (added) at least one address component.`,falseMessage:`- The API did not infer (add) any address components.`},hasReplacedComponents:{trueMessage:`- The API replaced at least one address component.`,falseMessage:`- The API did not replace any address components.`}};function p(e,t){return!e||!f[t]?`Unknown`:e[t]?f[t].trueMessage:f[t].falseMessage}function m(e){let t=e.target.value;t&&g[t]?_(g[t]):t||_(null)}function h(){r.value=``,i.value=``,a.value=``,o.value=``,s.value=``,c.value=``,l.value=``,n.textContent=`Result will appear here...`,console.log(`Cleared form`)}var g={google:{streetAddress1:`1600 Amphitheatre Parkway`,streetAddress2:``,city:`Mountain View`,state:`CA`,zipCode:`94043`,region:`US`},nonExistentSubpremise:{streetAddress1:`2930 Pearl St.`,streetAddress2:`Suite 100`,city:`Boulder`,state:`CO`,zipCode:``,region:`US`},missingSubpremise:{streetAddress1:`500 West 2nd Street`,streetAddress2:null,city:`Austin`,state:`TX`,zipCode:`78701`,region:`US`},misspelledLocality:{streetAddress1:`1600 Amphitheatre Pkwy`,streetAddress2:``,city:`Montan View`,state:`CA`,zipCode:`94043`,region:`US`},missingLocality:{streetAddress1:`Brandschenkestrasse 110 8002`,streetAddress2:``,city:``,state:``,zipCode:``,region:``},usPoBox:{streetAddress1:`PO Box 1108`,streetAddress2:``,city:`Sterling`,state:`VA`,zipCode:`20166-1108`,region:`US`}};function _(e){if(!e){console.warn(`No example address data provided.`);return}r.value=e.streetAddress1||``,i.value=e.streetAddress2||``,a.value=e.city||``,o.value=e.state||``,s.value=e.zipCode||``,c.value=e.region||``,n.textContent=`Result will appear here...`,console.log(`Populated fields with example: `,e)}u(); \ No newline at end of file diff --git a/dist/samples/address-validation/dist/assets/index-Cx75t_fx.js b/dist/samples/address-validation/dist/assets/index-Cx75t_fx.js new file mode 100644 index 000000000..89e62bb9d --- /dev/null +++ b/dist/samples/address-validation/dist/assets/index-Cx75t_fx.js @@ -0,0 +1,3 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.getElementById(`address-form`),t=document.getElementById(`clear-form-button`),n=document.getElementById(`result-display`),r=document.getElementById(`street-address-1`),i=document.getElementById(`street-address-2`),a=document.getElementById(`city`),o=document.getElementById(`state`),s=document.getElementById(`zip-code`),c=document.getElementById(`region-select`),l=document.getElementById(`example-select`);async function u(){await google.maps.importLibrary(`addressValidation`),e.addEventListener(`submit`,d),l.addEventListener(`change`,m),t.addEventListener(`click`,h)}async function d(e){e.preventDefault(),n.textContent=`Validating...`;let{AddressValidation:t}=await google.maps.importLibrary(`addressValidation`);try{let e=await t.fetchAddressValidation({address:{regionCode:c.value.trim(),languageCode:`en`,addressLines:[r.value.trim(),i.value.trim()].filter(Boolean),locality:a.value.trim(),administrativeArea:o.value.trim(),postalCode:s.value.trim()}});n.textContent=`Verdict summary +================ +Formatted address: ${e.address?.formattedAddress}\nEntered: ${e.verdict?.inputGranularity}\nValidated: ${e.verdict?.validationGranularity}\nGeocoded: ${e.verdict?.geocodeGranularity}\nPossible next action: ${e.verdict?.possibleNextAction}\n\n${p(e.verdict,`addressComplete`)}\n${p(e.verdict,`hasUnconfirmedComponents`)}\n${p(e.verdict,`hasInferredComponents`)}\n${p(e.verdict,`hasReplacedComponents`)}\n\nRaw JSON response\n=================\n`+JSON.stringify(e,null,` `)}catch(e){console.error(`Validation failed:`,e),e instanceof Error&&(n.textContent=`Error: ${e.message}`)}}var f={addressComplete:{trueMessage:`- The API found no unresolved, unexpected, or missing address elements.`,falseMessage:`- At least one address element is unresolved, unexpected, or missing.`},hasUnconfirmedComponents:{trueMessage:`- The API can't confirm at least one address component.`,falseMessage:`- The API confirmed all address components.`},hasInferredComponents:{trueMessage:`- The API inferred (added) at least one address component.`,falseMessage:`- The API did not infer (add) any address components.`},hasReplacedComponents:{trueMessage:`- The API replaced at least one address component.`,falseMessage:`- The API did not replace any address components.`}};function p(e,t){return!e||!f[t]?`Unknown`:e[t]?f[t].trueMessage:f[t].falseMessage}function m(e){let t=e.target.value;t&&g[t]?_(g[t]):t||_(null)}function h(){r.value=``,i.value=``,a.value=``,o.value=``,s.value=``,c.value=``,l.value=``,n.textContent=`Result will appear here...`,console.log(`Cleared form`)}var g={google:{streetAddress1:`1600 Amphitheatre Parkway`,streetAddress2:``,city:`Mountain View`,state:`CA`,zipCode:`94043`,region:`US`},nonExistentSubpremise:{streetAddress1:`2930 Pearl St.`,streetAddress2:`Suite 100`,city:`Boulder`,state:`CO`,zipCode:``,region:`US`},missingSubpremise:{streetAddress1:`500 West 2nd Street`,streetAddress2:null,city:`Austin`,state:`TX`,zipCode:`78701`,region:`US`},misspelledLocality:{streetAddress1:`1600 Amphitheatre Pkwy`,streetAddress2:``,city:`Montan View`,state:`CA`,zipCode:`94043`,region:`US`},missingLocality:{streetAddress1:`Brandschenkestrasse 110 8002`,streetAddress2:``,city:``,state:``,zipCode:``,region:``},usPoBox:{streetAddress1:`PO Box 1108`,streetAddress2:``,city:`Sterling`,state:`VA`,zipCode:`20166-1108`,region:`US`}};function _(e){if(!e){console.warn(`No example address data provided.`);return}r.value=e.streetAddress1||``,i.value=e.streetAddress2||``,a.value=e.city||``,o.value=e.state||``,s.value=e.zipCode||``,c.value=e.region||``,n.textContent=`Result will appear here...`,console.log(`Populated fields with example: `,e)}u(); \ No newline at end of file diff --git a/dist/samples/address-validation/dist/index.html b/dist/samples/address-validation/dist/index.html index 1daffcccb..80a7f44c5 100644 --- a/dist/samples/address-validation/dist/index.html +++ b/dist/samples/address-validation/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/address-validation/docs/index.js b/dist/samples/address-validation/docs/index.js index 5d14061fa..e05bdfb47 100644 --- a/dist/samples/address-validation/docs/index.js +++ b/dist/samples/address-validation/docs/index.js @@ -56,11 +56,11 @@ async function handleValidationSubmit(event) { resultDisplay.textContent = 'Verdict summary\n================\n' + - `Formatted address: ${result.address.formattedAddress}\n` + - `Entered: ${result.verdict.inputGranularity}\n` + - `Validated: ${result.verdict.validationGranularity}\n` + - `Geocoded: ${result.verdict.geocodeGranularity}\n` + - `Possible next action: ${result.verdict.possibleNextAction}\n\n` + + `Formatted address: ${result.address?.formattedAddress}\n` + + `Entered: ${result.verdict?.inputGranularity}\n` + + `Validated: ${result.verdict?.validationGranularity}\n` + + `Geocoded: ${result.verdict?.geocodeGranularity}\n` + + `Possible next action: ${result.verdict?.possibleNextAction}\n\n` + `${getVerdictMessage(result.verdict, 'addressComplete')}\n` + `${getVerdictMessage(result.verdict, 'hasUnconfirmedComponents')}\n` + `${getVerdictMessage(result.verdict, 'hasInferredComponents')}\n` + diff --git a/dist/samples/address-validation/docs/index.ts b/dist/samples/address-validation/docs/index.ts index 851084b4e..e6f5d92b1 100644 --- a/dist/samples/address-validation/docs/index.ts +++ b/dist/samples/address-validation/docs/index.ts @@ -6,9 +6,11 @@ // [START maps_address_validation] // DOM Refs -const addressForm = document.getElementById('address-form'); -const clearFormButton = document.getElementById('clear-form-button'); -const resultDisplay = document.getElementById('result-display'); +const addressForm = document.getElementById('address-form') as HTMLFormElement; +const clearFormButton = document.getElementById( + 'clear-form-button' +) as HTMLButtonElement; +const resultDisplay = document.getElementById('result-display')!; // Input field refs const streetAddress1Input = document.getElementById( 'street-address-1' @@ -38,7 +40,7 @@ async function init() { // [START maps_address_validation_form_handler] // Validation Handler -async function handleValidationSubmit(event) { +async function handleValidationSubmit(event: Event) { event.preventDefault(); // Prevent default form submission resultDisplay.textContent = 'Validating...'; // Clear previous results @@ -63,11 +65,11 @@ async function handleValidationSubmit(event) { resultDisplay.textContent = 'Verdict summary\n================\n' + - `Formatted address: ${result.address.formattedAddress}\n` + - `Entered: ${result.verdict.inputGranularity}\n` + - `Validated: ${result.verdict.validationGranularity}\n` + - `Geocoded: ${result.verdict.geocodeGranularity}\n` + - `Possible next action: ${result.verdict.possibleNextAction}\n\n` + + `Formatted address: ${result.address?.formattedAddress}\n` + + `Entered: ${result.verdict?.inputGranularity}\n` + + `Validated: ${result.verdict?.validationGranularity}\n` + + `Geocoded: ${result.verdict?.geocodeGranularity}\n` + + `Possible next action: ${result.verdict?.possibleNextAction}\n\n` + `${getVerdictMessage(result.verdict, 'addressComplete')}\n` + `${getVerdictMessage(result.verdict, 'hasUnconfirmedComponents')}\n` + `${getVerdictMessage(result.verdict, 'hasInferredComponents')}\n` + @@ -84,7 +86,10 @@ async function handleValidationSubmit(event) { // [END maps_address_validation_form_handler] // Verdict messages -const verdictMessages = { +const verdictMessages: Record< + string, + { trueMessage: string; falseMessage: string } +> = { addressComplete: { trueMessage: '- The API found no unresolved, unexpected, or missing address elements.', @@ -107,7 +112,10 @@ const verdictMessages = { }; // Helper function to get the verdict message for a given verdict key -function getVerdictMessage(verdict, key) { +function getVerdictMessage( + verdict: google.maps.addressValidation.Verdict | null, + key: keyof google.maps.addressValidation.Verdict +): string { if (!verdict || !verdictMessages[key]) return 'Unknown'; return verdict[key] ? verdictMessages[key].trueMessage @@ -115,8 +123,8 @@ function getVerdictMessage(verdict, key) { } // Handler for Dropdown Change -function handleExampleSelectChange(event) { - const selectedValue = event.target.value; +function handleExampleSelectChange(event: Event) { + const selectedValue = (event.target as HTMLSelectElement).value; if (selectedValue && examples[selectedValue]) { populateAddressFields(examples[selectedValue]); } else if (!selectedValue) { @@ -137,8 +145,17 @@ function handleClearForm() { console.log('Cleared form'); } +interface ExampleAddress { + streetAddress1: string; + streetAddress2: string | null; + city: string; + state: string; + zipCode: string; + region: string; +} + // Example Address Data -const examples = { +const examples: Record = { google: { streetAddress1: '1600 Amphitheatre Parkway', streetAddress2: '', // Explicitly empty @@ -190,7 +207,7 @@ const examples = { }; // Helper function to populate form fields with example address data -function populateAddressFields(exampleAddress) { +function populateAddressFields(exampleAddress: ExampleAddress | null) { if (!exampleAddress) { console.warn('No example address data provided.'); return; diff --git a/dist/samples/address-validation/jsfiddle/demo.js b/dist/samples/address-validation/jsfiddle/demo.js index 86266133e..c3e66fa34 100644 --- a/dist/samples/address-validation/jsfiddle/demo.js +++ b/dist/samples/address-validation/jsfiddle/demo.js @@ -54,11 +54,11 @@ async function handleValidationSubmit(event) { resultDisplay.textContent = 'Verdict summary\n================\n' + - `Formatted address: ${result.address.formattedAddress}\n` + - `Entered: ${result.verdict.inputGranularity}\n` + - `Validated: ${result.verdict.validationGranularity}\n` + - `Geocoded: ${result.verdict.geocodeGranularity}\n` + - `Possible next action: ${result.verdict.possibleNextAction}\n\n` + + `Formatted address: ${result.address?.formattedAddress}\n` + + `Entered: ${result.verdict?.inputGranularity}\n` + + `Validated: ${result.verdict?.validationGranularity}\n` + + `Geocoded: ${result.verdict?.geocodeGranularity}\n` + + `Possible next action: ${result.verdict?.possibleNextAction}\n\n` + `${getVerdictMessage(result.verdict, 'addressComplete')}\n` + `${getVerdictMessage(result.verdict, 'hasUnconfirmedComponents')}\n` + `${getVerdictMessage(result.verdict, 'hasInferredComponents')}\n` + diff --git a/dist/samples/advanced-markers-animation/app/index.ts b/dist/samples/advanced-markers-animation/app/index.ts index 9fd432c9a..65baeaf25 100644 --- a/dist/samples/advanced-markers-animation/app/index.ts +++ b/dist/samples/advanced-markers-animation/app/index.ts @@ -8,8 +8,8 @@ /** * Returns a random lat lng position within the map bounds. */ -function getRandomPosition(map) { - const bounds = map.getBounds(); +function getRandomPosition(map: google.maps.Map): google.maps.LatLngLiteral { + const bounds = map.getBounds()!; const minLat = bounds.getSouthWest().lat(); const minLng = bounds.getSouthWest().lng(); const maxLat = bounds.getNorthEast().lat(); @@ -54,7 +54,7 @@ async function init(): Promise { const position = { lat: 37.4242011827985, lng: -122.09242296450893 }; - const map = new Map(document.getElementById('map') as HTMLElement, { + const map = new Map(document.getElementById('map')!, { zoom: 14, center: position, mapId: '4504f8b37365c3d0', @@ -81,13 +81,16 @@ async function init(): Promise { map.controls[ControlPosition.TOP_CENTER].push(controlDiv); } -function createMarker(map, AdvancedMarkerElement, PinElement) { - const pinElement = new PinElement(); - const content = pinElement.element; +function createMarker( + map: google.maps.Map, + AdvancedMarkerElement: typeof google.maps.marker.AdvancedMarkerElement, + PinElement: typeof google.maps.marker.PinElement +) { + const content = new PinElement(); new AdvancedMarkerElement({ position: getRandomPosition(map), - map: map, - content: content, + map, + content, }); content.style.opacity = '0'; diff --git a/dist/samples/advanced-markers-animation/dist/assets/index-Mmt6oHWa.js b/dist/samples/advanced-markers-animation/dist/assets/index-DR_3SCX-.js similarity index 78% rename from dist/samples/advanced-markers-animation/dist/assets/index-Mmt6oHWa.js rename to dist/samples/advanced-markers-animation/dist/assets/index-DR_3SCX-.js index a99964180..657209fba 100644 --- a/dist/samples/advanced-markers-animation/dist/assets/index-Mmt6oHWa.js +++ b/dist/samples/advanced-markers-animation/dist/assets/index-DR_3SCX-.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){let t=e.getBounds(),n=t.getSouthWest().lat(),r=t.getSouthWest().lng(),i=t.getNorthEast().lat(),a=t.getNorthEast().lng(),o=i-n,s=a-r;return a{for(let n of e)n.isIntersecting&&(n.target.classList.add(`drop`),t.unobserve(n.target))});async function n(){let[{Map:e},{event:t,ControlPosition:n},{AdvancedMarkerElement:a,PinElement:o}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`core`),google.maps.importLibrary(`marker`)]),s=new e(document.getElementById(`map`),{zoom:14,center:{lat:37.4242011827985,lng:-122.09242296450893},mapId:`4504f8b37365c3d0`});t.addListenerOnce(s,`idle`,()=>{for(let e=0;e<100;e++)r(s,a,o)});let c=document.createElement(`div`),l=document.createElement(`button`);l.classList.add(`ui-button`),l.innerText=`Reset the example`,l.addEventListener(`click`,()=>{i()}),c.appendChild(l),s.controls[n.TOP_CENTER].push(c)}function r(n,r,i){let a=new i().element;new r({position:e(n),map:n,content:a}),a.style.opacity=`0`,a.addEventListener(`animationend`,()=>{a.classList.remove(`drop`),a.style.opacity=`1`});let o=2+Math.random();a.style.setProperty(`--delay-time`,o+`s`),t.observe(a)}function i(){let e=document.getElementById(`mapContainer`);document.getElementById(`map`).remove();let t=document.createElement(`div`);t.id=`map`,e.appendChild(t),n()}n(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){let t=e.getBounds(),n=t.getSouthWest().lat(),r=t.getSouthWest().lng(),i=t.getNorthEast().lat(),a=t.getNorthEast().lng(),o=i-n,s=a-r;return a{for(let n of e)n.isIntersecting&&(n.target.classList.add(`drop`),t.unobserve(n.target))});async function n(){let[{Map:e},{event:t,ControlPosition:n},{AdvancedMarkerElement:a,PinElement:o}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`core`),google.maps.importLibrary(`marker`)]),s=new e(document.getElementById(`map`),{zoom:14,center:{lat:37.4242011827985,lng:-122.09242296450893},mapId:`4504f8b37365c3d0`});t.addListenerOnce(s,`idle`,()=>{for(let e=0;e<100;e++)r(s,a,o)});let c=document.createElement(`div`),l=document.createElement(`button`);l.classList.add(`ui-button`),l.innerText=`Reset the example`,l.addEventListener(`click`,()=>{i()}),c.appendChild(l),s.controls[n.TOP_CENTER].push(c)}function r(n,r,i){let a=new i;new r({position:e(n),map:n,content:a}),a.style.opacity=`0`,a.addEventListener(`animationend`,()=>{a.classList.remove(`drop`),a.style.opacity=`1`});let o=2+Math.random();a.style.setProperty(`--delay-time`,o+`s`),t.observe(a)}function i(){let e=document.getElementById(`mapContainer`);document.getElementById(`map`).remove();let t=document.createElement(`div`);t.id=`map`,e.appendChild(t),n()}n(); \ No newline at end of file diff --git a/dist/samples/advanced-markers-animation/dist/index.html b/dist/samples/advanced-markers-animation/dist/index.html index aa839f8db..e13415867 100644 --- a/dist/samples/advanced-markers-animation/dist/index.html +++ b/dist/samples/advanced-markers-animation/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/advanced-markers-animation/docs/index.js b/dist/samples/advanced-markers-animation/docs/index.js index 0992c9793..8621f43c2 100644 --- a/dist/samples/advanced-markers-animation/docs/index.js +++ b/dist/samples/advanced-markers-animation/docs/index.js @@ -83,12 +83,11 @@ async function init() { } function createMarker(map, AdvancedMarkerElement, PinElement) { - const pinElement = new PinElement(); - const content = pinElement.element; + const content = new PinElement(); new AdvancedMarkerElement({ position: getRandomPosition(map), - map: map, - content: content, + map, + content, }); content.style.opacity = '0'; diff --git a/dist/samples/advanced-markers-animation/docs/index.ts b/dist/samples/advanced-markers-animation/docs/index.ts index 9fd432c9a..65baeaf25 100644 --- a/dist/samples/advanced-markers-animation/docs/index.ts +++ b/dist/samples/advanced-markers-animation/docs/index.ts @@ -8,8 +8,8 @@ /** * Returns a random lat lng position within the map bounds. */ -function getRandomPosition(map) { - const bounds = map.getBounds(); +function getRandomPosition(map: google.maps.Map): google.maps.LatLngLiteral { + const bounds = map.getBounds()!; const minLat = bounds.getSouthWest().lat(); const minLng = bounds.getSouthWest().lng(); const maxLat = bounds.getNorthEast().lat(); @@ -54,7 +54,7 @@ async function init(): Promise { const position = { lat: 37.4242011827985, lng: -122.09242296450893 }; - const map = new Map(document.getElementById('map') as HTMLElement, { + const map = new Map(document.getElementById('map')!, { zoom: 14, center: position, mapId: '4504f8b37365c3d0', @@ -81,13 +81,16 @@ async function init(): Promise { map.controls[ControlPosition.TOP_CENTER].push(controlDiv); } -function createMarker(map, AdvancedMarkerElement, PinElement) { - const pinElement = new PinElement(); - const content = pinElement.element; +function createMarker( + map: google.maps.Map, + AdvancedMarkerElement: typeof google.maps.marker.AdvancedMarkerElement, + PinElement: typeof google.maps.marker.PinElement +) { + const content = new PinElement(); new AdvancedMarkerElement({ position: getRandomPosition(map), - map: map, - content: content, + map, + content, }); content.style.opacity = '0'; diff --git a/dist/samples/advanced-markers-animation/jsfiddle/demo.js b/dist/samples/advanced-markers-animation/jsfiddle/demo.js index c5220296d..5fd895f91 100644 --- a/dist/samples/advanced-markers-animation/jsfiddle/demo.js +++ b/dist/samples/advanced-markers-animation/jsfiddle/demo.js @@ -82,12 +82,11 @@ async function init() { } function createMarker(map, AdvancedMarkerElement, PinElement) { - const pinElement = new PinElement(); - const content = pinElement.element; + const content = new PinElement(); new AdvancedMarkerElement({ position: getRandomPosition(map), - map: map, - content: content, + map, + content, }); content.style.opacity = '0'; diff --git a/dist/samples/advanced-markers-html/app/index.ts b/dist/samples/advanced-markers-html/app/index.ts index 35db51f9a..91d55dbd0 100644 --- a/dist/samples/advanced-markers-html/app/index.ts +++ b/dist/samples/advanced-markers-html/app/index.ts @@ -14,7 +14,7 @@ async function init() { ]); const center = { lat: 37.43238031167444, lng: -122.16795397128632 }; - const map = new Map(document.getElementById('map') as HTMLElement, { + const map = new Map(document.getElementById('map')!, { zoom: 11, center, mapId: '4504f8b37365c3d0', @@ -34,17 +34,30 @@ async function init() { } } -function toggleHighlight(markerView) { - if (markerView.content.classList.contains('highlight')) { - markerView.content.classList.remove('highlight'); +interface Property { + address: string; + description: string; + price: string; + type: string; + bed: number; + bath: number; + size: number; + position: google.maps.LatLngLiteral; +} + +function toggleHighlight(markerView: google.maps.marker.AdvancedMarkerElement) { + const content = markerView.children[0]; + + if (content.classList.contains('highlight')) { + content.classList.remove('highlight'); markerView.zIndex = null; } else { - markerView.content.classList.add('highlight'); + content.classList.add('highlight'); markerView.zIndex = 1; } } -function buildContent(property) { +function buildContent(property: Property) { const content = document.createElement('div'); content.classList.add('property'); content.innerHTML = ` @@ -77,7 +90,7 @@ function buildContent(property) { return content; } -const properties = [ +const properties: Property[] = [ { address: '215 Emily St, MountainView, CA', description: 'Single family house with modern design', diff --git a/dist/samples/advanced-markers-html/dist/assets/index-DXFTvg4w.js b/dist/samples/advanced-markers-html/dist/assets/index-Q5V2RslE.js similarity index 93% rename from dist/samples/advanced-markers-html/dist/assets/index-DXFTvg4w.js rename to dist/samples/advanced-markers-html/dist/assets/index-Q5V2RslE.js index a6e2dd273..856819ebf 100644 --- a/dist/samples/advanced-markers-html/dist/assets/index-DXFTvg4w.js +++ b/dist/samples/advanced-markers-html/dist/assets/index-Q5V2RslE.js @@ -1,4 +1,4 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{Map:e},{AdvancedMarkerElement:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`)]),a=new e(document.getElementById(`map`),{zoom:11,center:{lat:37.43238031167444,lng:-122.16795397128632},mapId:`4504f8b37365c3d0`});for(let e of r){let r=new i({map:a,content:n(e),position:e.position,title:e.description});r.addListener(`click`,()=>{t(r)})}}function t(e){e.content.classList.contains(`highlight`)?(e.content.classList.remove(`highlight`),e.zIndex=null):(e.content.classList.add(`highlight`),e.zIndex=1)}function n(e){let t=document.createElement(`div`);return t.classList.add(`property`),t.innerHTML=` +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{Map:e},{AdvancedMarkerElement:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`)]),a=new e(document.getElementById(`map`),{zoom:11,center:{lat:37.43238031167444,lng:-122.16795397128632},mapId:`4504f8b37365c3d0`});for(let e of r){let r=new i({map:a,content:n(e),position:e.position,title:e.description});r.addListener(`click`,()=>{t(r)})}}function t(e){let t=e.children[0];t.classList.contains(`highlight`)?(t.classList.remove(`highlight`),e.zIndex=null):(t.classList.add(`highlight`),e.zIndex=1)}function n(e){let t=document.createElement(`div`);return t.classList.add(`property`),t.innerHTML=`
${e.type} diff --git a/dist/samples/advanced-markers-html/dist/index.html b/dist/samples/advanced-markers-html/dist/index.html index 29dd9ebfa..d9976bb54 100644 --- a/dist/samples/advanced-markers-html/dist/index.html +++ b/dist/samples/advanced-markers-html/dist/index.html @@ -17,7 +17,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/advanced-markers-html/docs/index.js b/dist/samples/advanced-markers-html/docs/index.js index f6d4882b9..bed59eaf1 100644 --- a/dist/samples/advanced-markers-html/docs/index.js +++ b/dist/samples/advanced-markers-html/docs/index.js @@ -36,11 +36,13 @@ async function init() { } function toggleHighlight(markerView) { - if (markerView.content.classList.contains('highlight')) { - markerView.content.classList.remove('highlight'); + const content = markerView.children[0]; + + if (content.classList.contains('highlight')) { + content.classList.remove('highlight'); markerView.zIndex = null; } else { - markerView.content.classList.add('highlight'); + content.classList.add('highlight'); markerView.zIndex = 1; } } diff --git a/dist/samples/advanced-markers-html/docs/index.ts b/dist/samples/advanced-markers-html/docs/index.ts index 35db51f9a..91d55dbd0 100644 --- a/dist/samples/advanced-markers-html/docs/index.ts +++ b/dist/samples/advanced-markers-html/docs/index.ts @@ -14,7 +14,7 @@ async function init() { ]); const center = { lat: 37.43238031167444, lng: -122.16795397128632 }; - const map = new Map(document.getElementById('map') as HTMLElement, { + const map = new Map(document.getElementById('map')!, { zoom: 11, center, mapId: '4504f8b37365c3d0', @@ -34,17 +34,30 @@ async function init() { } } -function toggleHighlight(markerView) { - if (markerView.content.classList.contains('highlight')) { - markerView.content.classList.remove('highlight'); +interface Property { + address: string; + description: string; + price: string; + type: string; + bed: number; + bath: number; + size: number; + position: google.maps.LatLngLiteral; +} + +function toggleHighlight(markerView: google.maps.marker.AdvancedMarkerElement) { + const content = markerView.children[0]; + + if (content.classList.contains('highlight')) { + content.classList.remove('highlight'); markerView.zIndex = null; } else { - markerView.content.classList.add('highlight'); + content.classList.add('highlight'); markerView.zIndex = 1; } } -function buildContent(property) { +function buildContent(property: Property) { const content = document.createElement('div'); content.classList.add('property'); content.innerHTML = ` @@ -77,7 +90,7 @@ function buildContent(property) { return content; } -const properties = [ +const properties: Property[] = [ { address: '215 Emily St, MountainView, CA', description: 'Single family house with modern design', diff --git a/dist/samples/advanced-markers-html/jsfiddle/demo.js b/dist/samples/advanced-markers-html/jsfiddle/demo.js index d8e6c7dc3..fbc3b59e4 100644 --- a/dist/samples/advanced-markers-html/jsfiddle/demo.js +++ b/dist/samples/advanced-markers-html/jsfiddle/demo.js @@ -34,11 +34,13 @@ async function init() { } function toggleHighlight(markerView) { - if (markerView.content.classList.contains('highlight')) { - markerView.content.classList.remove('highlight'); + const content = markerView.children[0]; + + if (content.classList.contains('highlight')) { + content.classList.remove('highlight'); markerView.zIndex = null; } else { - markerView.content.classList.add('highlight'); + content.classList.add('highlight'); markerView.zIndex = 1; } } diff --git a/dist/samples/ai-powered-summaries-basic/app/index.ts b/dist/samples/ai-powered-summaries-basic/app/index.ts index 08a9a70a5..9dc0888bb 100644 --- a/dist/samples/ai-powered-summaries-basic/app/index.ts +++ b/dist/samples/ai-powered-summaries-basic/app/index.ts @@ -7,7 +7,7 @@ // [START maps_ai_powered_summaries_basic] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let infoWindow; +let infoWindow: google.maps.InfoWindow; async function init() { const { InfoWindow } = await google.maps.importLibrary('maps'); @@ -92,7 +92,11 @@ async function getPlaceDetails() { showInfoWindow(marker, place, content); } -function showInfoWindow(marker, place, content) { +function showInfoWindow( + marker: google.maps.marker.AdvancedMarkerElement, + place: google.maps.places.Place, + content: HTMLElement +) { // Display an info window. infoWindow.setHeaderContent(place.displayName); infoWindow.setContent(content); diff --git a/dist/samples/ai-powered-summaries-basic/docs/index.ts b/dist/samples/ai-powered-summaries-basic/docs/index.ts index 08a9a70a5..9dc0888bb 100644 --- a/dist/samples/ai-powered-summaries-basic/docs/index.ts +++ b/dist/samples/ai-powered-summaries-basic/docs/index.ts @@ -7,7 +7,7 @@ // [START maps_ai_powered_summaries_basic] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let infoWindow; +let infoWindow: google.maps.InfoWindow; async function init() { const { InfoWindow } = await google.maps.importLibrary('maps'); @@ -92,7 +92,11 @@ async function getPlaceDetails() { showInfoWindow(marker, place, content); } -function showInfoWindow(marker, place, content) { +function showInfoWindow( + marker: google.maps.marker.AdvancedMarkerElement, + place: google.maps.places.Place, + content: HTMLElement +) { // Display an info window. infoWindow.setHeaderContent(place.displayName); infoWindow.setContent(content); diff --git a/dist/samples/ai-powered-summaries/app/index.ts b/dist/samples/ai-powered-summaries/app/index.ts index 8a1c371b9..f35ca52a7 100644 --- a/dist/samples/ai-powered-summaries/app/index.ts +++ b/dist/samples/ai-powered-summaries/app/index.ts @@ -8,14 +8,12 @@ // Define DOM elements. const mapElement = document.querySelector('gmp-map')!; const placeAutocomplete = document.querySelector('gmp-place-autocomplete')!; -const summaryPanel = document.getElementById('summary-panel') as HTMLDivElement; -const placeName = document.getElementById('place-name') as HTMLElement; -const placeAddress = document.getElementById('place-address') as HTMLElement; -const tabContainer = document.getElementById('tab-container') as HTMLDivElement; -const summaryContent = document.getElementById( - 'summary-content' -) as HTMLDivElement; -const aiDisclosure = document.getElementById('ai-disclosure') as HTMLDivElement; +const summaryPanel = document.getElementById('summary-panel')!; +const placeName = document.getElementById('place-name')!; +const placeAddress = document.getElementById('place-address')!; +const tabContainer = document.getElementById('tab-container')!; +const summaryContent = document.getElementById('summary-content')!; +const aiDisclosure = document.getElementById('ai-disclosure')!; const flagContentLink = document.getElementById( 'flag-content-link' ) as HTMLAnchorElement; @@ -115,9 +113,9 @@ function updateSummaryPanel(place: google.maps.places.Place) { } // Manage the active class state. - document - .querySelectorAll('.tab-button') - .forEach((b) => b.classList.remove('active')); + document.querySelectorAll('.tab-button').forEach((b) => { + b.classList.remove('active'); + }); btn.classList.add('active'); if (typeof content === 'string') { diff --git a/dist/samples/ai-powered-summaries/dist/assets/index-Cx8LKWV3.js b/dist/samples/ai-powered-summaries/dist/assets/index-BQ2pQaaA.js similarity index 58% rename from dist/samples/ai-powered-summaries/dist/assets/index-Cx8LKWV3.js rename to dist/samples/ai-powered-summaries/dist/assets/index-BQ2pQaaA.js index 155bb1582..0c325aca5 100644 --- a/dist/samples/ai-powered-summaries/dist/assets/index-Cx8LKWV3.js +++ b/dist/samples/ai-powered-summaries/dist/assets/index-BQ2pQaaA.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-autocomplete`),n=document.getElementById(`summary-panel`),r=document.getElementById(`place-name`),i=document.getElementById(`place-address`),a=document.getElementById(`tab-container`),o=document.getElementById(`summary-content`),s=document.getElementById(`ai-disclosure`),c=document.getElementById(`flag-content-link`),l,u;async function d(){let[{AdvancedMarkerElement:n}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`)]);l=e.innerMap,l.setOptions({mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1}),l.addListener(`bounds_changed`,()=>{t.locationRestriction=l.getBounds()}),u=new n({map:l}),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();await t.fetchFields({fields:[`displayName`,`formattedAddress`,`location`,`generativeSummary`,`neighborhoodSummary`,`reviewSummary`,`evChargeAmenitySummary`]}),t.viewport?l.fitBounds(t.viewport):(l.setCenter(t.location),l.setZoom(17)),u.position=t.location,f(t)})}function f(e){n.classList.remove(`hidden`),a.innerHTML=``,o.textContent=``,s.textContent=``,r.textContent=e.displayName||``,i.textContent=e.formattedAddress||``;let t=!1,l=(e,n,r,i)=>{let l=document.createElement(`button`);l.className=`tab-button`,l.textContent=e,l.onclick=()=>{l.classList.contains(`active`)||(document.querySelectorAll(`.tab-button`).forEach(e=>e.classList.remove(`active`)),l.classList.add(`active`),typeof n==`string`?o.textContent=n:o.replaceChildren(n.cloneNode(!0)),s.textContent=r||`AI-generated content.`,i&&(c.href=i,c.textContent=`Report an issue`))},a.appendChild(l),t||=(l.click(),!0)};if(e.generativeSummary?.overview&&l(`Overview`,e.generativeSummary.overview,e.generativeSummary.disclosureText,e.generativeSummary.flagContentURI),e.reviewSummary?.text&&l(`Reviews`,e.reviewSummary.text,e.reviewSummary.disclosureText,e.reviewSummary.flagContentURI),e.neighborhoodSummary?.overview?.content&&l(`Neighborhood`,e.neighborhoodSummary.overview.content,e.neighborhoodSummary.disclosureText,e.neighborhoodSummary.flagContentURI),e.evChargeAmenitySummary){let t=e.evChargeAmenitySummary,n=document.createDocumentFragment(),r=(e,t)=>{let n=document.createElement(`div`);n.style.marginBottom=`15px`;let r=document.createElement(`strong`);r.textContent=e;let i=document.createElement(`div`);return i.textContent=t,n.appendChild(r),n.appendChild(i),n};t.overview?.content&&n.appendChild(r(`Overview`,t.overview.content)),t.coffee?.content&&n.appendChild(r(`Coffee`,t.coffee.content)),t.restaurant?.content&&n.appendChild(r(`Food`,t.restaurant.content)),t.store?.content&&n.appendChild(r(`Shopping`,t.store.content)),n.hasChildNodes()&&l(`EV Amenities`,n,t.disclosureText,t.flagContentURI)}if(!t){let e=document.createElement(`em`);e.textContent=`No AI summaries are available for this specific location.`,o.replaceChildren(e),s.textContent=``}}d(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-autocomplete`),n=document.getElementById(`summary-panel`),r=document.getElementById(`place-name`),i=document.getElementById(`place-address`),a=document.getElementById(`tab-container`),o=document.getElementById(`summary-content`),s=document.getElementById(`ai-disclosure`),c=document.getElementById(`flag-content-link`),l,u;async function d(){let[{AdvancedMarkerElement:n}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`)]);l=e.innerMap,l.setOptions({mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1}),l.addListener(`bounds_changed`,()=>{t.locationRestriction=l.getBounds()}),u=new n({map:l}),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();await t.fetchFields({fields:[`displayName`,`formattedAddress`,`location`,`generativeSummary`,`neighborhoodSummary`,`reviewSummary`,`evChargeAmenitySummary`]}),t.viewport?l.fitBounds(t.viewport):(l.setCenter(t.location),l.setZoom(17)),u.position=t.location,f(t)})}function f(e){n.classList.remove(`hidden`),a.innerHTML=``,o.textContent=``,s.textContent=``,r.textContent=e.displayName||``,i.textContent=e.formattedAddress||``;let t=!1,l=(e,n,r,i)=>{let l=document.createElement(`button`);l.className=`tab-button`,l.textContent=e,l.onclick=()=>{l.classList.contains(`active`)||(document.querySelectorAll(`.tab-button`).forEach(e=>{e.classList.remove(`active`)}),l.classList.add(`active`),typeof n==`string`?o.textContent=n:o.replaceChildren(n.cloneNode(!0)),s.textContent=r||`AI-generated content.`,i&&(c.href=i,c.textContent=`Report an issue`))},a.appendChild(l),t||=(l.click(),!0)};if(e.generativeSummary?.overview&&l(`Overview`,e.generativeSummary.overview,e.generativeSummary.disclosureText,e.generativeSummary.flagContentURI),e.reviewSummary?.text&&l(`Reviews`,e.reviewSummary.text,e.reviewSummary.disclosureText,e.reviewSummary.flagContentURI),e.neighborhoodSummary?.overview?.content&&l(`Neighborhood`,e.neighborhoodSummary.overview.content,e.neighborhoodSummary.disclosureText,e.neighborhoodSummary.flagContentURI),e.evChargeAmenitySummary){let t=e.evChargeAmenitySummary,n=document.createDocumentFragment(),r=(e,t)=>{let n=document.createElement(`div`);n.style.marginBottom=`15px`;let r=document.createElement(`strong`);r.textContent=e;let i=document.createElement(`div`);return i.textContent=t,n.appendChild(r),n.appendChild(i),n};t.overview?.content&&n.appendChild(r(`Overview`,t.overview.content)),t.coffee?.content&&n.appendChild(r(`Coffee`,t.coffee.content)),t.restaurant?.content&&n.appendChild(r(`Food`,t.restaurant.content)),t.store?.content&&n.appendChild(r(`Shopping`,t.store.content)),n.hasChildNodes()&&l(`EV Amenities`,n,t.disclosureText,t.flagContentURI)}if(!t){let e=document.createElement(`em`);e.textContent=`No AI summaries are available for this specific location.`,o.replaceChildren(e),s.textContent=``}}d(); \ No newline at end of file diff --git a/dist/samples/ai-powered-summaries/dist/index.html b/dist/samples/ai-powered-summaries/dist/index.html index 11865ce01..705b3816d 100644 --- a/dist/samples/ai-powered-summaries/dist/index.html +++ b/dist/samples/ai-powered-summaries/dist/index.html @@ -14,7 +14,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/ai-powered-summaries/docs/index.js b/dist/samples/ai-powered-summaries/docs/index.js index 07b47acd8..9ac3fe942 100644 --- a/dist/samples/ai-powered-summaries/docs/index.js +++ b/dist/samples/ai-powered-summaries/docs/index.js @@ -107,9 +107,9 @@ function updateSummaryPanel(place) { } // Manage the active class state. - document - .querySelectorAll('.tab-button') - .forEach((b) => b.classList.remove('active')); + document.querySelectorAll('.tab-button').forEach((b) => { + b.classList.remove('active'); + }); btn.classList.add('active'); if (typeof content === 'string') { diff --git a/dist/samples/ai-powered-summaries/docs/index.ts b/dist/samples/ai-powered-summaries/docs/index.ts index 8a1c371b9..f35ca52a7 100644 --- a/dist/samples/ai-powered-summaries/docs/index.ts +++ b/dist/samples/ai-powered-summaries/docs/index.ts @@ -8,14 +8,12 @@ // Define DOM elements. const mapElement = document.querySelector('gmp-map')!; const placeAutocomplete = document.querySelector('gmp-place-autocomplete')!; -const summaryPanel = document.getElementById('summary-panel') as HTMLDivElement; -const placeName = document.getElementById('place-name') as HTMLElement; -const placeAddress = document.getElementById('place-address') as HTMLElement; -const tabContainer = document.getElementById('tab-container') as HTMLDivElement; -const summaryContent = document.getElementById( - 'summary-content' -) as HTMLDivElement; -const aiDisclosure = document.getElementById('ai-disclosure') as HTMLDivElement; +const summaryPanel = document.getElementById('summary-panel')!; +const placeName = document.getElementById('place-name')!; +const placeAddress = document.getElementById('place-address')!; +const tabContainer = document.getElementById('tab-container')!; +const summaryContent = document.getElementById('summary-content')!; +const aiDisclosure = document.getElementById('ai-disclosure')!; const flagContentLink = document.getElementById( 'flag-content-link' ) as HTMLAnchorElement; @@ -115,9 +113,9 @@ function updateSummaryPanel(place: google.maps.places.Place) { } // Manage the active class state. - document - .querySelectorAll('.tab-button') - .forEach((b) => b.classList.remove('active')); + document.querySelectorAll('.tab-button').forEach((b) => { + b.classList.remove('active'); + }); btn.classList.add('active'); if (typeof content === 'string') { diff --git a/dist/samples/ai-powered-summaries/jsfiddle/demo.js b/dist/samples/ai-powered-summaries/jsfiddle/demo.js index 95579fe08..67396637e 100644 --- a/dist/samples/ai-powered-summaries/jsfiddle/demo.js +++ b/dist/samples/ai-powered-summaries/jsfiddle/demo.js @@ -105,9 +105,9 @@ function updateSummaryPanel(place) { } // Manage the active class state. - document - .querySelectorAll('.tab-button') - .forEach((b) => b.classList.remove('active')); + document.querySelectorAll('.tab-button').forEach((b) => { + b.classList.remove('active'); + }); btn.classList.add('active'); if (typeof content === 'string') { diff --git a/dist/samples/boundaries-choropleth/app/index.ts b/dist/samples/boundaries-choropleth/app/index.ts index de8e916a1..9bb5b46c7 100644 --- a/dist/samples/boundaries-choropleth/app/index.ts +++ b/dist/samples/boundaries-choropleth/app/index.ts @@ -20,12 +20,14 @@ async function init() { ); // [START maps_boundaries_choropleth_style_function] - featureLayer.style = (featureStyleFunctionOptions) => { + featureLayer.style = ( + featureStyleFunctionOptions: google.maps.FeatureStyleFunctionOptions + ) => { const placeFeature = featureStyleFunctionOptions.feature as google.maps.PlaceFeature; const population = states[placeFeature.placeId]; - let fillColor; + let fillColor: string | undefined; // Specify colors using any of the following: // * Named ('green') // * Hexadecimal ('#FF0000') @@ -47,8 +49,9 @@ async function init() { }; }; // [END maps_boundaries_choropleth_style_function] + // Population data by state. - const states = { + const states: Record = { ChIJdf5LHzR_hogR6czIUzU0VV4: 5039877, // Alabama ChIJG8CuwJzfAFQRNduKqSde27w: 732673, // Alaska 'ChIJaxhMy-sIK4cRcc3Bf7EnOUI': 7276316, // Arizona diff --git a/dist/samples/boundaries-choropleth/docs/index.js b/dist/samples/boundaries-choropleth/docs/index.js index 32f94e19a..af01cd623 100644 --- a/dist/samples/boundaries-choropleth/docs/index.js +++ b/dist/samples/boundaries-choropleth/docs/index.js @@ -47,6 +47,7 @@ async function init() { }; }; // [END maps_boundaries_choropleth_style_function] + // Population data by state. const states = { ChIJdf5LHzR_hogR6czIUzU0VV4: 5039877, // Alabama diff --git a/dist/samples/boundaries-choropleth/docs/index.ts b/dist/samples/boundaries-choropleth/docs/index.ts index de8e916a1..9bb5b46c7 100644 --- a/dist/samples/boundaries-choropleth/docs/index.ts +++ b/dist/samples/boundaries-choropleth/docs/index.ts @@ -20,12 +20,14 @@ async function init() { ); // [START maps_boundaries_choropleth_style_function] - featureLayer.style = (featureStyleFunctionOptions) => { + featureLayer.style = ( + featureStyleFunctionOptions: google.maps.FeatureStyleFunctionOptions + ) => { const placeFeature = featureStyleFunctionOptions.feature as google.maps.PlaceFeature; const population = states[placeFeature.placeId]; - let fillColor; + let fillColor: string | undefined; // Specify colors using any of the following: // * Named ('green') // * Hexadecimal ('#FF0000') @@ -47,8 +49,9 @@ async function init() { }; }; // [END maps_boundaries_choropleth_style_function] + // Population data by state. - const states = { + const states: Record = { ChIJdf5LHzR_hogR6czIUzU0VV4: 5039877, // Alabama ChIJG8CuwJzfAFQRNduKqSde27w: 732673, // Alaska 'ChIJaxhMy-sIK4cRcc3Bf7EnOUI': 7276316, // Arizona diff --git a/dist/samples/boundaries-click/app/index.ts b/dist/samples/boundaries-click/app/index.ts index 27912eaa0..12e2c002f 100644 --- a/dist/samples/boundaries-click/app/index.ts +++ b/dist/samples/boundaries-click/app/index.ts @@ -6,21 +6,25 @@ // [START maps_boundaries_click_event] let innerMap: google.maps.Map; -let featureLayer; -let infoWindow; +let featureLayer: google.maps.FeatureLayer; +let infoWindow: google.maps.InfoWindow; let lastInteractedFeatureIds: string[] = []; let lastClickedFeatureIds: string[] = []; // [START maps_boundaries_click_event_handler] -function handleClick(e) { - lastClickedFeatureIds = e.features.map((f) => f.placeId); +function handleClick(event: google.maps.FeatureMouseEvent) { + lastClickedFeatureIds = event.features.map( + (f) => (f as google.maps.PlaceFeature).placeId + ); lastInteractedFeatureIds = []; featureLayer.style = applyStyle; - void createInfoWindow(e); + void createInfoWindow(event); } -function handleMouseMove(e) { - lastInteractedFeatureIds = e.features.map((f) => f.placeId); +function handleMouseMove(event: google.maps.FeatureMouseEvent) { + lastInteractedFeatureIds = event.features.map( + (f) => (f as google.maps.PlaceFeature).placeId + ); featureLayer.style = applyStyle; } // [END maps_boundaries_click_event_handler] @@ -61,14 +65,14 @@ async function init() { // [END maps_boundaries_click_event_add_layer] // Create the infoWindow. - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // Apply style on load, to enable clicking. featureLayer.style = applyStyle; } // Helper function for the infoWindow. -async function createInfoWindow(event) { - const feature = event.features[0]; +async function createInfoWindow(event: google.maps.FeatureMouseEvent) { + const feature = event.features[0] as google.maps.PlaceFeature; if (!feature.placeId) return; // Update the info window. @@ -132,7 +136,10 @@ function applyStyle(params: google.maps.FeatureStyleFunctionOptions) { // [END maps_boundaries_click_event_style] // Helper function to create an info window. -function updateInfoWindow(content, center) { +function updateInfoWindow( + content: HTMLElement, + center: google.maps.LatLng | google.maps.LatLngLiteral | null | undefined +) { infoWindow.setContent(content); infoWindow.setPosition(center); infoWindow.open({ diff --git a/dist/samples/boundaries-click/dist/assets/index-dEzUQzTE.js b/dist/samples/boundaries-click/dist/assets/index-DclLoVIf.js similarity index 57% rename from dist/samples/boundaries-click/dist/assets/index-dEzUQzTE.js rename to dist/samples/boundaries-click/dist/assets/index-DclLoVIf.js index 35e986dda..ec5cb8651 100644 --- a/dist/samples/boundaries-click/dist/assets/index-dEzUQzTE.js +++ b/dist/samples/boundaries-click/dist/assets/index-DclLoVIf.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r=[],i=[];function a(e){i=e.features.map(e=>e.placeId),r=[],t.style=f,c(e)}function o(e){r=e.features.map(e=>e.placeId),t.style=f}async function s(){let{InfoWindow:i}=await google.maps.importLibrary(`maps`);e=document.querySelector(`gmp-map`).innerMap,e.setOptions({mapTypeControl:!1}),t=e.getFeatureLayer(`ADMINISTRATIVE_AREA_LEVEL_2`),t.addListener(`click`,a),t.addListener(`mousemove`,o),e.addListener(`mousemove`,()=>{r?.length&&(r=[],t.style=f)}),n=new i({}),t.style=f}async function c(e){let t=e.features[0];if(!t.placeId)return;let n=await t.fetchPlace(),r=document.createElement(`div`),i=document.createElement(`span`);i.textContent=`Display name: ${n.displayName}`;let a=document.createElement(`span`);a.textContent=`Place ID: ${t.placeId}`;let o=document.createElement(`span`);o.textContent=`Feature type: ${t.featureType}`,r.appendChild(i),r.appendChild(document.createElement(`br`)),r.appendChild(a),r.appendChild(document.createElement(`br`)),r.appendChild(o),p(r,e.latLng)}var l={strokeColor:`#810FCB`,strokeOpacity:1,strokeWeight:2,fillColor:`white`,fillOpacity:.1},u={...l,fillColor:`#810FCB`,fillOpacity:.5},d={...l,strokeWeight:4};function f(e){let t=e.feature.placeId;return i.includes(t)?u:r.includes(t)?d:l}function p(t,r){n.setContent(t),n.setPosition(r),n.open({map:e,shouldFocus:!1})}s(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r=[],i=[];function a(e){i=e.features.map(e=>e.placeId),r=[],t.style=f,c(e)}function o(e){r=e.features.map(e=>e.placeId),t.style=f}async function s(){let{InfoWindow:i}=await google.maps.importLibrary(`maps`);e=document.querySelector(`gmp-map`).innerMap,e.setOptions({mapTypeControl:!1}),t=e.getFeatureLayer(`ADMINISTRATIVE_AREA_LEVEL_2`),t.addListener(`click`,a),t.addListener(`mousemove`,o),e.addListener(`mousemove`,()=>{r?.length&&(r=[],t.style=f)}),n=new i,t.style=f}async function c(e){let t=e.features[0];if(!t.placeId)return;let n=await t.fetchPlace(),r=document.createElement(`div`),i=document.createElement(`span`);i.textContent=`Display name: ${n.displayName}`;let a=document.createElement(`span`);a.textContent=`Place ID: ${t.placeId}`;let o=document.createElement(`span`);o.textContent=`Feature type: ${t.featureType}`,r.appendChild(i),r.appendChild(document.createElement(`br`)),r.appendChild(a),r.appendChild(document.createElement(`br`)),r.appendChild(o),p(r,e.latLng)}var l={strokeColor:`#810FCB`,strokeOpacity:1,strokeWeight:2,fillColor:`white`,fillOpacity:.1},u={...l,fillColor:`#810FCB`,fillOpacity:.5},d={...l,strokeWeight:4};function f(e){let t=e.feature.placeId;return i.includes(t)?u:r.includes(t)?d:l}function p(t,r){n.setContent(t),n.setPosition(r),n.open({map:e,shouldFocus:!1})}s(); \ No newline at end of file diff --git a/dist/samples/boundaries-click/dist/index.html b/dist/samples/boundaries-click/dist/index.html index 739cf0c30..390023670 100644 --- a/dist/samples/boundaries-click/dist/index.html +++ b/dist/samples/boundaries-click/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/boundaries-click/docs/index.js b/dist/samples/boundaries-click/docs/index.js index 3a3c5b027..f5594afa8 100644 --- a/dist/samples/boundaries-click/docs/index.js +++ b/dist/samples/boundaries-click/docs/index.js @@ -13,15 +13,15 @@ let lastInteractedFeatureIds = []; let lastClickedFeatureIds = []; // [START maps_boundaries_click_event_handler] -function handleClick(e) { - lastClickedFeatureIds = e.features.map((f) => f.placeId); +function handleClick(event) { + lastClickedFeatureIds = event.features.map((f) => f.placeId); lastInteractedFeatureIds = []; featureLayer.style = applyStyle; - void createInfoWindow(e); + void createInfoWindow(event); } -function handleMouseMove(e) { - lastInteractedFeatureIds = e.features.map((f) => f.placeId); +function handleMouseMove(event) { + lastInteractedFeatureIds = event.features.map((f) => f.placeId); featureLayer.style = applyStyle; } // [END maps_boundaries_click_event_handler] @@ -62,7 +62,7 @@ async function init() { // [END maps_boundaries_click_event_add_layer] // Create the infoWindow. - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // Apply style on load, to enable clicking. featureLayer.style = applyStyle; } diff --git a/dist/samples/boundaries-click/docs/index.ts b/dist/samples/boundaries-click/docs/index.ts index 27912eaa0..12e2c002f 100644 --- a/dist/samples/boundaries-click/docs/index.ts +++ b/dist/samples/boundaries-click/docs/index.ts @@ -6,21 +6,25 @@ // [START maps_boundaries_click_event] let innerMap: google.maps.Map; -let featureLayer; -let infoWindow; +let featureLayer: google.maps.FeatureLayer; +let infoWindow: google.maps.InfoWindow; let lastInteractedFeatureIds: string[] = []; let lastClickedFeatureIds: string[] = []; // [START maps_boundaries_click_event_handler] -function handleClick(e) { - lastClickedFeatureIds = e.features.map((f) => f.placeId); +function handleClick(event: google.maps.FeatureMouseEvent) { + lastClickedFeatureIds = event.features.map( + (f) => (f as google.maps.PlaceFeature).placeId + ); lastInteractedFeatureIds = []; featureLayer.style = applyStyle; - void createInfoWindow(e); + void createInfoWindow(event); } -function handleMouseMove(e) { - lastInteractedFeatureIds = e.features.map((f) => f.placeId); +function handleMouseMove(event: google.maps.FeatureMouseEvent) { + lastInteractedFeatureIds = event.features.map( + (f) => (f as google.maps.PlaceFeature).placeId + ); featureLayer.style = applyStyle; } // [END maps_boundaries_click_event_handler] @@ -61,14 +65,14 @@ async function init() { // [END maps_boundaries_click_event_add_layer] // Create the infoWindow. - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // Apply style on load, to enable clicking. featureLayer.style = applyStyle; } // Helper function for the infoWindow. -async function createInfoWindow(event) { - const feature = event.features[0]; +async function createInfoWindow(event: google.maps.FeatureMouseEvent) { + const feature = event.features[0] as google.maps.PlaceFeature; if (!feature.placeId) return; // Update the info window. @@ -132,7 +136,10 @@ function applyStyle(params: google.maps.FeatureStyleFunctionOptions) { // [END maps_boundaries_click_event_style] // Helper function to create an info window. -function updateInfoWindow(content, center) { +function updateInfoWindow( + content: HTMLElement, + center: google.maps.LatLng | google.maps.LatLngLiteral | null | undefined +) { infoWindow.setContent(content); infoWindow.setPosition(center); infoWindow.open({ diff --git a/dist/samples/boundaries-click/jsfiddle/demo.js b/dist/samples/boundaries-click/jsfiddle/demo.js index 781ad01f4..a19045b06 100644 --- a/dist/samples/boundaries-click/jsfiddle/demo.js +++ b/dist/samples/boundaries-click/jsfiddle/demo.js @@ -11,15 +11,15 @@ let infoWindow; let lastInteractedFeatureIds = []; let lastClickedFeatureIds = []; -function handleClick(e) { - lastClickedFeatureIds = e.features.map((f) => f.placeId); +function handleClick(event) { + lastClickedFeatureIds = event.features.map((f) => f.placeId); lastInteractedFeatureIds = []; featureLayer.style = applyStyle; - void createInfoWindow(e); + void createInfoWindow(event); } -function handleMouseMove(e) { - lastInteractedFeatureIds = e.features.map((f) => f.placeId); +function handleMouseMove(event) { + lastInteractedFeatureIds = event.features.map((f) => f.placeId); featureLayer.style = applyStyle; } @@ -57,7 +57,7 @@ async function init() { }); // Create the infoWindow. - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // Apply style on load, to enable clicking. featureLayer.style = applyStyle; } diff --git a/dist/samples/boundaries-simple/app/index.ts b/dist/samples/boundaries-simple/app/index.ts index 33be8ca1c..f551950e3 100644 --- a/dist/samples/boundaries-simple/app/index.ts +++ b/dist/samples/boundaries-simple/app/index.ts @@ -10,7 +10,7 @@ */ // [START maps_boundaries_simple] -let featureLayer; +let featureLayer: google.maps.FeatureLayer; async function init() { // Request needed libraries. @@ -38,11 +38,13 @@ async function init() { }; // Apply the style to a single boundary. - featureLayer.style = (options: { feature: { placeId: string } }) => { - if (options.feature.placeId == 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { + featureLayer.style = (options: google.maps.FeatureStyleFunctionOptions) => { + const feature = options.feature as google.maps.PlaceFeature; + if (feature.placeId === 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { // Hana, HI return featureStyleOptions; } + return null; }; // [END maps_boundaries_simple_style_single] } diff --git a/dist/samples/boundaries-simple/dist/assets/index-B1eleAw1.js b/dist/samples/boundaries-simple/dist/assets/index-Jz6AsSgQ.js similarity index 88% rename from dist/samples/boundaries-simple/dist/assets/index-B1eleAw1.js rename to dist/samples/boundaries-simple/dist/assets/index-Jz6AsSgQ.js index f864b3abf..dae44af5f 100644 --- a/dist/samples/boundaries-simple/dist/assets/index-B1eleAw1.js +++ b/dist/samples/boundaries-simple/dist/assets/index-Jz6AsSgQ.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){await google.maps.importLibrary(`maps`),e=document.querySelector(`gmp-map`).innerMap.getFeatureLayer(`LOCALITY`);let t={strokeColor:`#810FCB`,strokeOpacity:1,strokeWeight:3,fillColor:`#810FCB`,fillOpacity:.5};e.style=e=>{if(e.feature.placeId==`ChIJ0zQtYiWsVHkRk8lRoB1RNPo`)return t}}t(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){await google.maps.importLibrary(`maps`),e=document.querySelector(`gmp-map`).innerMap.getFeatureLayer(`LOCALITY`);let t={strokeColor:`#810FCB`,strokeOpacity:1,strokeWeight:3,fillColor:`#810FCB`,fillOpacity:.5};e.style=e=>e.feature.placeId===`ChIJ0zQtYiWsVHkRk8lRoB1RNPo`?t:null}t(); \ No newline at end of file diff --git a/dist/samples/boundaries-simple/dist/index.html b/dist/samples/boundaries-simple/dist/index.html index 5e266b4da..74c2d9e75 100644 --- a/dist/samples/boundaries-simple/dist/index.html +++ b/dist/samples/boundaries-simple/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/boundaries-simple/docs/index.js b/dist/samples/boundaries-simple/docs/index.js index 9cf1a90c7..5c96cb62a 100644 --- a/dist/samples/boundaries-simple/docs/index.js +++ b/dist/samples/boundaries-simple/docs/index.js @@ -40,10 +40,12 @@ async function init() { // Apply the style to a single boundary. featureLayer.style = (options) => { - if (options.feature.placeId == 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { + const feature = options.feature; + if (feature.placeId === 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { // Hana, HI return featureStyleOptions; } + return null; }; // [END maps_boundaries_simple_style_single] } diff --git a/dist/samples/boundaries-simple/docs/index.ts b/dist/samples/boundaries-simple/docs/index.ts index 33be8ca1c..f551950e3 100644 --- a/dist/samples/boundaries-simple/docs/index.ts +++ b/dist/samples/boundaries-simple/docs/index.ts @@ -10,7 +10,7 @@ */ // [START maps_boundaries_simple] -let featureLayer; +let featureLayer: google.maps.FeatureLayer; async function init() { // Request needed libraries. @@ -38,11 +38,13 @@ async function init() { }; // Apply the style to a single boundary. - featureLayer.style = (options: { feature: { placeId: string } }) => { - if (options.feature.placeId == 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { + featureLayer.style = (options: google.maps.FeatureStyleFunctionOptions) => { + const feature = options.feature as google.maps.PlaceFeature; + if (feature.placeId === 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { // Hana, HI return featureStyleOptions; } + return null; }; // [END maps_boundaries_simple_style_single] } diff --git a/dist/samples/boundaries-simple/jsfiddle/demo.js b/dist/samples/boundaries-simple/jsfiddle/demo.js index 90548b8b1..71c694ef0 100644 --- a/dist/samples/boundaries-simple/jsfiddle/demo.js +++ b/dist/samples/boundaries-simple/jsfiddle/demo.js @@ -36,10 +36,12 @@ async function init() { // Apply the style to a single boundary. featureLayer.style = (options) => { - if (options.feature.placeId == 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { + const feature = options.feature; + if (feature.placeId === 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') { // Hana, HI return featureStyleOptions; } + return null; }; } diff --git a/dist/samples/boundaries-text-search/app/index.ts b/dist/samples/boundaries-text-search/app/index.ts index 6e18e407b..bb3cb7988 100644 --- a/dist/samples/boundaries-text-search/app/index.ts +++ b/dist/samples/boundaries-text-search/app/index.ts @@ -6,8 +6,8 @@ // [START maps_boundaries_text_search] let innerMap: google.maps.Map; -let featureLayer; -let center; +let featureLayer: google.maps.FeatureLayer; +let center: google.maps.LatLngLiteral; async function init() { // Load the needed libraries. @@ -47,9 +47,9 @@ async function findBoundary() { } } -function styleBoundary(placeid) { +function styleBoundary(placeid: string) { // Define a style of transparent purple with opaque stroke. - const styleFill = { + const styleFill: google.maps.FeatureStyleOptions = { strokeColor: '#810FCB', strokeOpacity: 1.0, strokeWeight: 3.0, @@ -58,10 +58,12 @@ function styleBoundary(placeid) { }; // Define the feature style function. - featureLayer.style = (params) => { - if (params.feature.placeId == placeid) { + featureLayer.style = (params: google.maps.FeatureStyleFunctionOptions) => { + const placeFeature = params.feature as google.maps.PlaceFeature; + if (placeFeature.placeId === placeid) { return styleFill; } + return null; }; } // [END maps_boundaries_text_search_find_region] diff --git a/dist/samples/boundaries-text-search/dist/assets/index-Cmty_HgL.js b/dist/samples/boundaries-text-search/dist/assets/index-tygSfoZD.js similarity index 96% rename from dist/samples/boundaries-text-search/dist/assets/index-Cmty_HgL.js rename to dist/samples/boundaries-text-search/dist/assets/index-tygSfoZD.js index 7b0d4eddb..7cb7895ae 100644 --- a/dist/samples/boundaries-text-search/dist/assets/index-Cmty_HgL.js +++ b/dist/samples/boundaries-text-search/dist/assets/index-tygSfoZD.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n;async function r(){await google.maps.importLibrary(`maps`),n={lat:41.059,lng:-124.151},e=document.querySelector(`gmp-map`).innerMap,t=e.getFeatureLayer(`LOCALITY`),i()}async function i(){let t={textQuery:`Trinidad, CA`,fields:[`id`,`location`],includedType:`locality`,locationBias:n},{Place:r}=await google.maps.importLibrary(`places`),{places:i}=await r.searchByText(t);if(i.length){let t=i[0];a(t.id),e.setCenter(t.location)}else console.log(`No results`)}function a(e){let n={strokeColor:`#810FCB`,strokeOpacity:1,strokeWeight:3,fillColor:`#810FCB`,fillOpacity:.5};t.style=t=>{if(t.feature.placeId==e)return n}}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n;async function r(){await google.maps.importLibrary(`maps`),n={lat:41.059,lng:-124.151},e=document.querySelector(`gmp-map`).innerMap,t=e.getFeatureLayer(`LOCALITY`),i()}async function i(){let t={textQuery:`Trinidad, CA`,fields:[`id`,`location`],includedType:`locality`,locationBias:n},{Place:r}=await google.maps.importLibrary(`places`),{places:i}=await r.searchByText(t);if(i.length){let t=i[0];a(t.id),e.setCenter(t.location)}else console.log(`No results`)}function a(e){let n={strokeColor:`#810FCB`,strokeOpacity:1,strokeWeight:3,fillColor:`#810FCB`,fillOpacity:.5};t.style=t=>t.feature.placeId===e?n:null}r(); \ No newline at end of file diff --git a/dist/samples/boundaries-text-search/dist/index.html b/dist/samples/boundaries-text-search/dist/index.html index e268a59f0..f7cad0553 100644 --- a/dist/samples/boundaries-text-search/dist/index.html +++ b/dist/samples/boundaries-text-search/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/boundaries-text-search/docs/index.js b/dist/samples/boundaries-text-search/docs/index.js index c94adf8a2..16f55a7d6 100644 --- a/dist/samples/boundaries-text-search/docs/index.js +++ b/dist/samples/boundaries-text-search/docs/index.js @@ -60,9 +60,11 @@ function styleBoundary(placeid) { // Define the feature style function. featureLayer.style = (params) => { - if (params.feature.placeId == placeid) { + const placeFeature = params.feature; + if (placeFeature.placeId === placeid) { return styleFill; } + return null; }; } // [END maps_boundaries_text_search_find_region] diff --git a/dist/samples/boundaries-text-search/docs/index.ts b/dist/samples/boundaries-text-search/docs/index.ts index 6e18e407b..bb3cb7988 100644 --- a/dist/samples/boundaries-text-search/docs/index.ts +++ b/dist/samples/boundaries-text-search/docs/index.ts @@ -6,8 +6,8 @@ // [START maps_boundaries_text_search] let innerMap: google.maps.Map; -let featureLayer; -let center; +let featureLayer: google.maps.FeatureLayer; +let center: google.maps.LatLngLiteral; async function init() { // Load the needed libraries. @@ -47,9 +47,9 @@ async function findBoundary() { } } -function styleBoundary(placeid) { +function styleBoundary(placeid: string) { // Define a style of transparent purple with opaque stroke. - const styleFill = { + const styleFill: google.maps.FeatureStyleOptions = { strokeColor: '#810FCB', strokeOpacity: 1.0, strokeWeight: 3.0, @@ -58,10 +58,12 @@ function styleBoundary(placeid) { }; // Define the feature style function. - featureLayer.style = (params) => { - if (params.feature.placeId == placeid) { + featureLayer.style = (params: google.maps.FeatureStyleFunctionOptions) => { + const placeFeature = params.feature as google.maps.PlaceFeature; + if (placeFeature.placeId === placeid) { return styleFill; } + return null; }; } // [END maps_boundaries_text_search_find_region] diff --git a/dist/samples/boundaries-text-search/jsfiddle/demo.js b/dist/samples/boundaries-text-search/jsfiddle/demo.js index a70131e37..a7179272a 100644 --- a/dist/samples/boundaries-text-search/jsfiddle/demo.js +++ b/dist/samples/boundaries-text-search/jsfiddle/demo.js @@ -59,9 +59,11 @@ function styleBoundary(placeid) { // Define the feature style function. featureLayer.style = (params) => { - if (params.feature.placeId == placeid) { + const placeFeature = params.feature; + if (placeFeature.placeId === placeid) { return styleFill; } + return null; }; } diff --git a/dist/samples/circle-simple/app/index.ts b/dist/samples/circle-simple/app/index.ts index 25f20b01c..04b26629e 100644 --- a/dist/samples/circle-simple/app/index.ts +++ b/dist/samples/circle-simple/app/index.ts @@ -59,7 +59,7 @@ async function init() { mapElement.append(centerMarker); // Wait for the map to finish drawing its tiles. - event.addListenerOnce(innerMap, 'tilesloaded', function () { + event.addListenerOnce(innerMap, 'tilesloaded', () => { // Get the controls div const controls = document.getElementById('control-panel'); @@ -78,12 +78,20 @@ async function init() { }); // Handle user click, reset the map center and position the circle. - innerMap.addListener('click', (mapsMouseEvent) => { - const newCenter = mapsMouseEvent.latLng; - walkingCircle.setCenter(newCenter); - centerMarker.position = newCenter; - innerMap.panTo(newCenter); - }); + innerMap.addListener( + 'click', + ( + mapsMouseEvent: + | google.maps.MapMouseEvent + | google.maps.IconMouseEvent + ) => { + const newCenter = mapsMouseEvent.latLng; + if (!newCenter) return; + walkingCircle.setCenter(newCenter); + centerMarker.position = newCenter; + innerMap.panTo(newCenter); + } + ); // Handle user dragging the circle, update the center marker position. walkingCircle.addListener('center_changed', () => { diff --git a/dist/samples/circle-simple/dist/assets/index-CMbAJ7qx.js b/dist/samples/circle-simple/dist/assets/index-Dj8JV9zC.js similarity index 79% rename from dist/samples/circle-simple/dist/assets/index-CMbAJ7qx.js rename to dist/samples/circle-simple/dist/assets/index-Dj8JV9zC.js index 384557a43..26d2665b6 100644 --- a/dist/samples/circle-simple/dist/assets/index-CMbAJ7qx.js +++ b/dist/samples/circle-simple/dist/assets/index-Dj8JV9zC.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;async function n(){let[{Circle:n},{AdvancedMarkerElement:r},{event:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),a={lat:34.98956821576194,lng:135.74239981260283};t=e.innerMap;let o=document.querySelectorAll(`input[name="radius"]`),s=new n({strokeColor:`#ffdd00ff`,strokeOpacity:.8,strokeWeight:2,fillColor:`#ffdd00ff`,fillOpacity:.35,map:t,center:a,radius:400,draggable:!0,editable:!1}),c=new DOMParser().parseFromString(``,`image/svg+xml`).documentElement,l=new r({position:a,title:`A marker using a custom SVG image.`,anchorLeft:`-50%`,anchorTop:`-50%`});l.append(c),e.append(l),i.addListenerOnce(t,`tilesloaded`,function(){let e=document.getElementById(`control-panel`);e&&(e.style.display=`block`)}),o.forEach(e=>{e.addEventListener(`change`,e=>{let t=e.target;s.setRadius(Number(t.value))})}),t.addListener(`click`,e=>{let n=e.latLng;s.setCenter(n),l.position=n,t.panTo(n)}),s.addListener(`center_changed`,()=>{l.position=s.getCenter()})}n(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;async function n(){let[{Circle:n},{AdvancedMarkerElement:r},{event:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),a={lat:34.98956821576194,lng:135.74239981260283};t=e.innerMap;let o=document.querySelectorAll(`input[name="radius"]`),s=new n({strokeColor:`#ffdd00ff`,strokeOpacity:.8,strokeWeight:2,fillColor:`#ffdd00ff`,fillOpacity:.35,map:t,center:a,radius:400,draggable:!0,editable:!1}),c=new DOMParser().parseFromString(``,`image/svg+xml`).documentElement,l=new r({position:a,title:`A marker using a custom SVG image.`,anchorLeft:`-50%`,anchorTop:`-50%`});l.append(c),e.append(l),i.addListenerOnce(t,`tilesloaded`,()=>{let e=document.getElementById(`control-panel`);e&&(e.style.display=`block`)}),o.forEach(e=>{e.addEventListener(`change`,e=>{let t=e.target;s.setRadius(Number(t.value))})}),t.addListener(`click`,e=>{let n=e.latLng;n&&(s.setCenter(n),l.position=n,t.panTo(n))}),s.addListener(`center_changed`,()=>{l.position=s.getCenter()})}n(); \ No newline at end of file diff --git a/dist/samples/circle-simple/dist/index.html b/dist/samples/circle-simple/dist/index.html index 0a76143bc..9f4a27869 100644 --- a/dist/samples/circle-simple/dist/index.html +++ b/dist/samples/circle-simple/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/circle-simple/docs/index.js b/dist/samples/circle-simple/docs/index.js index bca54c7d2..9e59cf845 100644 --- a/dist/samples/circle-simple/docs/index.js +++ b/dist/samples/circle-simple/docs/index.js @@ -60,7 +60,7 @@ async function init() { mapElement.append(centerMarker); // Wait for the map to finish drawing its tiles. - event.addListenerOnce(innerMap, 'tilesloaded', function () { + event.addListenerOnce(innerMap, 'tilesloaded', () => { // Get the controls div const controls = document.getElementById('control-panel'); @@ -81,6 +81,7 @@ async function init() { // Handle user click, reset the map center and position the circle. innerMap.addListener('click', (mapsMouseEvent) => { const newCenter = mapsMouseEvent.latLng; + if (!newCenter) return; walkingCircle.setCenter(newCenter); centerMarker.position = newCenter; innerMap.panTo(newCenter); diff --git a/dist/samples/circle-simple/docs/index.ts b/dist/samples/circle-simple/docs/index.ts index 25f20b01c..04b26629e 100644 --- a/dist/samples/circle-simple/docs/index.ts +++ b/dist/samples/circle-simple/docs/index.ts @@ -59,7 +59,7 @@ async function init() { mapElement.append(centerMarker); // Wait for the map to finish drawing its tiles. - event.addListenerOnce(innerMap, 'tilesloaded', function () { + event.addListenerOnce(innerMap, 'tilesloaded', () => { // Get the controls div const controls = document.getElementById('control-panel'); @@ -78,12 +78,20 @@ async function init() { }); // Handle user click, reset the map center and position the circle. - innerMap.addListener('click', (mapsMouseEvent) => { - const newCenter = mapsMouseEvent.latLng; - walkingCircle.setCenter(newCenter); - centerMarker.position = newCenter; - innerMap.panTo(newCenter); - }); + innerMap.addListener( + 'click', + ( + mapsMouseEvent: + | google.maps.MapMouseEvent + | google.maps.IconMouseEvent + ) => { + const newCenter = mapsMouseEvent.latLng; + if (!newCenter) return; + walkingCircle.setCenter(newCenter); + centerMarker.position = newCenter; + innerMap.panTo(newCenter); + } + ); // Handle user dragging the circle, update the center marker position. walkingCircle.addListener('center_changed', () => { diff --git a/dist/samples/circle-simple/jsfiddle/demo.js b/dist/samples/circle-simple/jsfiddle/demo.js index 33ec77d9d..86be16af4 100644 --- a/dist/samples/circle-simple/jsfiddle/demo.js +++ b/dist/samples/circle-simple/jsfiddle/demo.js @@ -59,7 +59,7 @@ async function init() { mapElement.append(centerMarker); // Wait for the map to finish drawing its tiles. - event.addListenerOnce(innerMap, 'tilesloaded', function () { + event.addListenerOnce(innerMap, 'tilesloaded', () => { // Get the controls div const controls = document.getElementById('control-panel'); @@ -80,6 +80,7 @@ async function init() { // Handle user click, reset the map center and position the circle. innerMap.addListener('click', (mapsMouseEvent) => { const newCenter = mapsMouseEvent.latLng; + if (!newCenter) return; walkingCircle.setCenter(newCenter); centerMarker.position = newCenter; innerMap.panTo(newCenter); diff --git a/dist/samples/dds-datasets-point/app/index.ts b/dist/samples/dds-datasets-point/app/index.ts index ce4dbe397..642537a9e 100644 --- a/dist/samples/dds-datasets-point/app/index.ts +++ b/dist/samples/dds-datasets-point/app/index.ts @@ -8,15 +8,13 @@ const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; // [START maps_dds_datasets_point_style_function] -function setStyle(params) { +function setStyle(params: { feature: google.maps.Feature }) { // [START maps_dds_datasets_point_style_get_features] // Get the dataset feature, so we can work with all of its attributes. - const datasetFeature = params.feature; + const datasetFeature = params.feature as google.maps.DatasetFeature; // Get all of the needed dataset attributes. const furColors = - datasetFeature.datasetAttributes[ - 'CombinationofPrimaryandHighlightColor' - ]; + datasetFeature.datasetAttributes.CombinationofPrimaryandHighlightColor; // [END maps_dds_datasets_point_style_get_features] // Apply styles. Fill is primary fur color, stroke is secondary fur color. @@ -125,8 +123,8 @@ function makeLegend() { title.innerText = 'Fur Colors'; title.classList.add('title'); legend!.appendChild(title); - let color; - for (color in colors) { + + for (const color of Object.keys(colors) as Iterable) { const wrapper = document.createElement('div'); wrapper.id = 'container'; const box = document.createElement('div'); diff --git a/dist/samples/dds-datasets-point/dist/assets/index-BcBGGFO7.js b/dist/samples/dds-datasets-point/dist/assets/index-BCDaX44v.js similarity index 83% rename from dist/samples/dds-datasets-point/dist/assets/index-BcBGGFO7.js rename to dist/samples/dds-datasets-point/dist/assets/index-BCDaX44v.js index 1b592f257..40eff8e8e 100644 --- a/dist/samples/dds-datasets-point/dist/assets/index-BcBGGFO7.js +++ b/dist/samples/dds-datasets-point/dist/assets/index-BCDaX44v.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;function n(e){switch(e.feature.datasetAttributes.CombinationofPrimaryandHighlightColor){case`Black+`:return{fillColor:`black`,pointRadius:8};case`Cinnamon+`:return{fillColor:`#8b0000`,pointRadius:8};case`Cinnamon+Gray`:return{fillColor:`#8b0000`,strokeColor:`gray`,pointRadius:6};case`Cinnamon+White`:return{fillColor:`#8b0000`,strokeColor:`white`,pointRadius:6};case`Gray+`:return{fillColor:`gray`,pointRadius:8};case`Gray+Cinnamon`:return{fillColor:`gray`,strokeColor:`#8b0000`,pointRadius:6};case`Gray+Cinnamon, White`:return{fillColor:`silver`,strokeColor:`#8b0000`,pointRadius:6};case`Gray+White`:return{fillColor:`gray`,strokeColor:`white`,pointRadius:6};default:return{fillColor:`yellow`,pointRadius:8}}}async function r(){let[{event:r}]=await Promise.all([google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);t=e.innerMap,r.addListenerOnce(t,`idle`,()=>{i()});let a=t.getDatasetFeatureLayer(`a99635b0-5e73-4b2a-8ae3-cb40f4b7f47e`);a.style=n}function i(){let e={black:[`black`],cinnamon:[`#8b0000`],"cinnamon + gray":[`#8b0000`,`gray`],"cinnamon + white":[`#8b0000`,`white`],gray:[`gray`],"gray + cinnamon":[`gray`,`#8b0000`],"gray + cinnamon + white":[`silver`,`#8b0000`],"gray + white":[`gray`,`white`],"no color data":[`yellow`]},t=document.getElementById(`legend`);t.id=`legend`;let n=document.createElement(`div`);n.innerText=`Fur Colors`,n.classList.add(`title`),t.appendChild(n);let r;for(r in e){let n=document.createElement(`div`);n.id=`container`;let i=document.createElement(`div`);i.style.backgroundColor=e[r][0],e[r][1]?i.style.borderColor=e[r][1]:i.style.borderColor=e[r][0],i.classList.add(`box`);let a=document.createElement(`div`);a.classList.add(`legend`),a.innerText=r,n.appendChild(i),n.appendChild(a),t.appendChild(n)}}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;function n(e){switch(e.feature.datasetAttributes.CombinationofPrimaryandHighlightColor){case`Black+`:return{fillColor:`black`,pointRadius:8};case`Cinnamon+`:return{fillColor:`#8b0000`,pointRadius:8};case`Cinnamon+Gray`:return{fillColor:`#8b0000`,strokeColor:`gray`,pointRadius:6};case`Cinnamon+White`:return{fillColor:`#8b0000`,strokeColor:`white`,pointRadius:6};case`Gray+`:return{fillColor:`gray`,pointRadius:8};case`Gray+Cinnamon`:return{fillColor:`gray`,strokeColor:`#8b0000`,pointRadius:6};case`Gray+Cinnamon, White`:return{fillColor:`silver`,strokeColor:`#8b0000`,pointRadius:6};case`Gray+White`:return{fillColor:`gray`,strokeColor:`white`,pointRadius:6};default:return{fillColor:`yellow`,pointRadius:8}}}async function r(){let[{event:r}]=await Promise.all([google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);t=e.innerMap,r.addListenerOnce(t,`idle`,()=>{i()});let a=t.getDatasetFeatureLayer(`a99635b0-5e73-4b2a-8ae3-cb40f4b7f47e`);a.style=n}function i(){let e={black:[`black`],cinnamon:[`#8b0000`],"cinnamon + gray":[`#8b0000`,`gray`],"cinnamon + white":[`#8b0000`,`white`],gray:[`gray`],"gray + cinnamon":[`gray`,`#8b0000`],"gray + cinnamon + white":[`silver`,`#8b0000`],"gray + white":[`gray`,`white`],"no color data":[`yellow`]},t=document.getElementById(`legend`);t.id=`legend`;let n=document.createElement(`div`);n.innerText=`Fur Colors`,n.classList.add(`title`),t.appendChild(n);for(let n of Object.keys(e)){let r=document.createElement(`div`);r.id=`container`;let i=document.createElement(`div`);i.style.backgroundColor=e[n][0],e[n][1]?i.style.borderColor=e[n][1]:i.style.borderColor=e[n][0],i.classList.add(`box`);let a=document.createElement(`div`);a.classList.add(`legend`),a.innerText=n,r.appendChild(i),r.appendChild(a),t.appendChild(r)}}r(); \ No newline at end of file diff --git a/dist/samples/dds-datasets-point/dist/index.html b/dist/samples/dds-datasets-point/dist/index.html index c6eda1ee9..988c30e85 100644 --- a/dist/samples/dds-datasets-point/dist/index.html +++ b/dist/samples/dds-datasets-point/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/dds-datasets-point/docs/index.js b/dist/samples/dds-datasets-point/docs/index.js index 64bf5d26d..b5e5c9048 100644 --- a/dist/samples/dds-datasets-point/docs/index.js +++ b/dist/samples/dds-datasets-point/docs/index.js @@ -15,9 +15,7 @@ function setStyle(params) { const datasetFeature = params.feature; // Get all of the needed dataset attributes. const furColors = - datasetFeature.datasetAttributes[ - 'CombinationofPrimaryandHighlightColor' - ]; + datasetFeature.datasetAttributes.CombinationofPrimaryandHighlightColor; // [END maps_dds_datasets_point_style_get_features] // Apply styles. Fill is primary fur color, stroke is secondary fur color. @@ -126,8 +124,8 @@ function makeLegend() { title.innerText = 'Fur Colors'; title.classList.add('title'); legend.appendChild(title); - let color; - for (color in colors) { + + for (const color of Object.keys(colors)) { const wrapper = document.createElement('div'); wrapper.id = 'container'; const box = document.createElement('div'); diff --git a/dist/samples/dds-datasets-point/docs/index.ts b/dist/samples/dds-datasets-point/docs/index.ts index ce4dbe397..642537a9e 100644 --- a/dist/samples/dds-datasets-point/docs/index.ts +++ b/dist/samples/dds-datasets-point/docs/index.ts @@ -8,15 +8,13 @@ const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; // [START maps_dds_datasets_point_style_function] -function setStyle(params) { +function setStyle(params: { feature: google.maps.Feature }) { // [START maps_dds_datasets_point_style_get_features] // Get the dataset feature, so we can work with all of its attributes. - const datasetFeature = params.feature; + const datasetFeature = params.feature as google.maps.DatasetFeature; // Get all of the needed dataset attributes. const furColors = - datasetFeature.datasetAttributes[ - 'CombinationofPrimaryandHighlightColor' - ]; + datasetFeature.datasetAttributes.CombinationofPrimaryandHighlightColor; // [END maps_dds_datasets_point_style_get_features] // Apply styles. Fill is primary fur color, stroke is secondary fur color. @@ -125,8 +123,8 @@ function makeLegend() { title.innerText = 'Fur Colors'; title.classList.add('title'); legend!.appendChild(title); - let color; - for (color in colors) { + + for (const color of Object.keys(colors) as Iterable) { const wrapper = document.createElement('div'); wrapper.id = 'container'; const box = document.createElement('div'); diff --git a/dist/samples/dds-datasets-point/jsfiddle/demo.js b/dist/samples/dds-datasets-point/jsfiddle/demo.js index 74853ad3e..06d490760 100644 --- a/dist/samples/dds-datasets-point/jsfiddle/demo.js +++ b/dist/samples/dds-datasets-point/jsfiddle/demo.js @@ -13,9 +13,7 @@ function setStyle(params) { const datasetFeature = params.feature; // Get all of the needed dataset attributes. const furColors = - datasetFeature.datasetAttributes[ - 'CombinationofPrimaryandHighlightColor' - ]; + datasetFeature.datasetAttributes.CombinationofPrimaryandHighlightColor; // Apply styles. Fill is primary fur color, stroke is secondary fur color. switch (furColors) { @@ -122,8 +120,8 @@ function makeLegend() { title.innerText = 'Fur Colors'; title.classList.add('title'); legend.appendChild(title); - let color; - for (color in colors) { + + for (const color of Object.keys(colors)) { const wrapper = document.createElement('div'); wrapper.id = 'container'; const box = document.createElement('div'); diff --git a/dist/samples/dds-datasets-polygon-click/app/index.ts b/dist/samples/dds-datasets-polygon-click/app/index.ts index 77e7b6a3c..088beb9eb 100644 --- a/dist/samples/dds-datasets-polygon-click/app/index.ts +++ b/dist/samples/dds-datasets-polygon-click/app/index.ts @@ -3,28 +3,29 @@ * Copyright 2026 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ + // [START maps_dds_datasets_polygon_click] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; let lastInteractedFeatureIds: string[] = []; let lastClickedFeatureIds: string[] = []; -let datasetLayer; +let datasetLayer: google.maps.FeatureLayer; // [START maps_dds_datasets_polygon_click_eventhandler] // Note, 'globalid' is an attribute in this Dataset. -function handleClick(e) { - if (e.features) { - lastClickedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleClick(event: google.maps.FeatureMouseEvent) { + if (event.features) { + lastClickedFeatureIds = event.features.map( + (f) => (f as google.maps.DatasetFeature).datasetAttributes.globalid ); } datasetLayer.style = applyStyle; } -function handleMouseMove(e) { - if (e.features) { - lastInteractedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleMouseMove(event: google.maps.FeatureMouseEvent) { + if (event.features) { + lastInteractedFeatureIds = event.features.map( + (f) => (f as google.maps.DatasetFeature).datasetAttributes.globalid ); } datasetLayer.style = applyStyle; @@ -82,13 +83,14 @@ const styleMouseMove = { strokeWeight: 4.0, }; -function applyStyle(params) { +function applyStyle(params: google.maps.FeatureStyleFunctionOptions) { const datasetFeature = params.feature; // Note, 'globalid' is an attribute in this dataset. if ( lastClickedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + (datasetFeature as google.maps.DatasetFeature).datasetAttributes + .globalid ) ) { return styleClicked; @@ -96,7 +98,8 @@ function applyStyle(params) { if ( lastInteractedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + (datasetFeature as google.maps.DatasetFeature).datasetAttributes + .globalid ) ) { return styleMouseMove; diff --git a/dist/samples/dds-datasets-polygon-click/docs/index.js b/dist/samples/dds-datasets-polygon-click/docs/index.js index 204561967..ab29e7e92 100644 --- a/dist/samples/dds-datasets-polygon-click/docs/index.js +++ b/dist/samples/dds-datasets-polygon-click/docs/index.js @@ -4,6 +4,7 @@ * Copyright 2026 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ + // [START maps_dds_datasets_polygon_click] const mapElement = document.querySelector('gmp-map'); let innerMap; @@ -13,19 +14,19 @@ let datasetLayer; // [START maps_dds_datasets_polygon_click_eventhandler] // Note, 'globalid' is an attribute in this Dataset. -function handleClick(e) { - if (e.features) { - lastClickedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleClick(event) { + if (event.features) { + lastClickedFeatureIds = event.features.map( + (f) => f.datasetAttributes.globalid ); } datasetLayer.style = applyStyle; } -function handleMouseMove(e) { - if (e.features) { - lastInteractedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleMouseMove(event) { + if (event.features) { + lastInteractedFeatureIds = event.features.map( + (f) => f.datasetAttributes.globalid ); } datasetLayer.style = applyStyle; @@ -89,7 +90,7 @@ function applyStyle(params) { // Note, 'globalid' is an attribute in this dataset. if ( lastClickedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + datasetFeature.datasetAttributes.globalid ) ) { return styleClicked; @@ -97,7 +98,7 @@ function applyStyle(params) { if ( lastInteractedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + datasetFeature.datasetAttributes.globalid ) ) { return styleMouseMove; diff --git a/dist/samples/dds-datasets-polygon-click/docs/index.ts b/dist/samples/dds-datasets-polygon-click/docs/index.ts index 77e7b6a3c..088beb9eb 100644 --- a/dist/samples/dds-datasets-polygon-click/docs/index.ts +++ b/dist/samples/dds-datasets-polygon-click/docs/index.ts @@ -3,28 +3,29 @@ * Copyright 2026 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ + // [START maps_dds_datasets_polygon_click] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; let lastInteractedFeatureIds: string[] = []; let lastClickedFeatureIds: string[] = []; -let datasetLayer; +let datasetLayer: google.maps.FeatureLayer; // [START maps_dds_datasets_polygon_click_eventhandler] // Note, 'globalid' is an attribute in this Dataset. -function handleClick(e) { - if (e.features) { - lastClickedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleClick(event: google.maps.FeatureMouseEvent) { + if (event.features) { + lastClickedFeatureIds = event.features.map( + (f) => (f as google.maps.DatasetFeature).datasetAttributes.globalid ); } datasetLayer.style = applyStyle; } -function handleMouseMove(e) { - if (e.features) { - lastInteractedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleMouseMove(event: google.maps.FeatureMouseEvent) { + if (event.features) { + lastInteractedFeatureIds = event.features.map( + (f) => (f as google.maps.DatasetFeature).datasetAttributes.globalid ); } datasetLayer.style = applyStyle; @@ -82,13 +83,14 @@ const styleMouseMove = { strokeWeight: 4.0, }; -function applyStyle(params) { +function applyStyle(params: google.maps.FeatureStyleFunctionOptions) { const datasetFeature = params.feature; // Note, 'globalid' is an attribute in this dataset. if ( lastClickedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + (datasetFeature as google.maps.DatasetFeature).datasetAttributes + .globalid ) ) { return styleClicked; @@ -96,7 +98,8 @@ function applyStyle(params) { if ( lastInteractedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + (datasetFeature as google.maps.DatasetFeature).datasetAttributes + .globalid ) ) { return styleMouseMove; diff --git a/dist/samples/dds-datasets-polygon-click/jsfiddle/demo.js b/dist/samples/dds-datasets-polygon-click/jsfiddle/demo.js index b1a371848..3e8b08407 100644 --- a/dist/samples/dds-datasets-polygon-click/jsfiddle/demo.js +++ b/dist/samples/dds-datasets-polygon-click/jsfiddle/demo.js @@ -12,19 +12,19 @@ let lastClickedFeatureIds = []; let datasetLayer; // Note, 'globalid' is an attribute in this Dataset. -function handleClick(e) { - if (e.features) { - lastClickedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleClick(event) { + if (event.features) { + lastClickedFeatureIds = event.features.map( + (f) => f.datasetAttributes.globalid ); } datasetLayer.style = applyStyle; } -function handleMouseMove(e) { - if (e.features) { - lastInteractedFeatureIds = e.features.map( - (f) => f.datasetAttributes['globalid'] +function handleMouseMove(event) { + if (event.features) { + lastInteractedFeatureIds = event.features.map( + (f) => f.datasetAttributes.globalid ); } datasetLayer.style = applyStyle; @@ -84,7 +84,7 @@ function applyStyle(params) { // Note, 'globalid' is an attribute in this dataset. if ( lastClickedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + datasetFeature.datasetAttributes.globalid ) ) { return styleClicked; @@ -92,7 +92,7 @@ function applyStyle(params) { if ( lastInteractedFeatureIds.includes( - datasetFeature.datasetAttributes['globalid'] + datasetFeature.datasetAttributes.globalid ) ) { return styleMouseMove; diff --git a/dist/samples/dds-datasets-polygon-colors/app/index.ts b/dist/samples/dds-datasets-polygon-colors/app/index.ts index 698f827fb..906520a17 100644 --- a/dist/samples/dds-datasets-polygon-colors/app/index.ts +++ b/dist/samples/dds-datasets-polygon-colors/app/index.ts @@ -8,10 +8,10 @@ const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; // [START maps_dds_datasets_polygon_colors_style_function] -function setStyle(params) { - const datasetFeature = params.feature; +const setStyle: google.maps.FeatureStyleFunction = (params) => { + const datasetFeature = params.feature as google.maps.DatasetFeature; // 'typecategory' is an attribute in this Dataset. - const typeCategory = datasetFeature.datasetAttributes['typecategory']; + const typeCategory = datasetFeature.datasetAttributes.typecategory; switch (typeCategory) { case 'Undeveloped': // Color undeveloped areas blue. @@ -42,7 +42,7 @@ function setStyle(params) { }; break; } -} +}; // [END maps_dds_datasets_polygon_colors_style_function] async function init() { diff --git a/dist/samples/dds-datasets-polygon-colors/dist/assets/index-DZJ-qlil.js b/dist/samples/dds-datasets-polygon-colors/dist/assets/index-CISidZzD.js similarity index 55% rename from dist/samples/dds-datasets-polygon-colors/dist/assets/index-DZJ-qlil.js rename to dist/samples/dds-datasets-polygon-colors/dist/assets/index-CISidZzD.js index dd43d65f9..67d360095 100644 --- a/dist/samples/dds-datasets-polygon-colors/dist/assets/index-DZJ-qlil.js +++ b/dist/samples/dds-datasets-polygon-colors/dist/assets/index-CISidZzD.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;function n(e){switch(e.feature.datasetAttributes.typecategory){case`Undeveloped`:return{strokeColor:`blue`,strokeWeight:2,strokeOpacity:1,fillColor:`blue`,fillOpacity:.3};case`Parkway`:return{strokeColor:`red`,strokeWeight:2,strokeOpacity:1,fillColor:`red`,fillOpacity:.5};default:return{strokeColor:`green`,strokeWeight:2,strokeOpacity:1,fillColor:`green`,fillOpacity:.3}}}async function r(){await google.maps.importLibrary(`maps`),t=e.innerMap;let r=t.getDatasetFeatureLayer(`a75dd002-ad20-4fe6-af60-27cd2ed636b4`);r.style=n}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t,n=e=>{switch(e.feature.datasetAttributes.typecategory){case`Undeveloped`:return{strokeColor:`blue`,strokeWeight:2,strokeOpacity:1,fillColor:`blue`,fillOpacity:.3};case`Parkway`:return{strokeColor:`red`,strokeWeight:2,strokeOpacity:1,fillColor:`red`,fillOpacity:.5};default:return{strokeColor:`green`,strokeWeight:2,strokeOpacity:1,fillColor:`green`,fillOpacity:.3}}};async function r(){await google.maps.importLibrary(`maps`),t=e.innerMap;let r=t.getDatasetFeatureLayer(`a75dd002-ad20-4fe6-af60-27cd2ed636b4`);r.style=n}r(); \ No newline at end of file diff --git a/dist/samples/dds-datasets-polygon-colors/dist/index.html b/dist/samples/dds-datasets-polygon-colors/dist/index.html index f3faedfe3..1e09ae9a8 100644 --- a/dist/samples/dds-datasets-polygon-colors/dist/index.html +++ b/dist/samples/dds-datasets-polygon-colors/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/dds-datasets-polygon-colors/docs/index.js b/dist/samples/dds-datasets-polygon-colors/docs/index.js index 27ad88f65..3a9f7b754 100644 --- a/dist/samples/dds-datasets-polygon-colors/docs/index.js +++ b/dist/samples/dds-datasets-polygon-colors/docs/index.js @@ -9,10 +9,10 @@ const mapElement = document.querySelector('gmp-map'); let innerMap; // [START maps_dds_datasets_polygon_colors_style_function] -function setStyle(params) { +const setStyle = (params) => { const datasetFeature = params.feature; // 'typecategory' is an attribute in this Dataset. - const typeCategory = datasetFeature.datasetAttributes['typecategory']; + const typeCategory = datasetFeature.datasetAttributes.typecategory; switch (typeCategory) { case 'Undeveloped': // Color undeveloped areas blue. @@ -43,7 +43,7 @@ function setStyle(params) { }; break; } -} +}; // [END maps_dds_datasets_polygon_colors_style_function] async function init() { diff --git a/dist/samples/dds-datasets-polygon-colors/docs/index.ts b/dist/samples/dds-datasets-polygon-colors/docs/index.ts index 698f827fb..906520a17 100644 --- a/dist/samples/dds-datasets-polygon-colors/docs/index.ts +++ b/dist/samples/dds-datasets-polygon-colors/docs/index.ts @@ -8,10 +8,10 @@ const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; // [START maps_dds_datasets_polygon_colors_style_function] -function setStyle(params) { - const datasetFeature = params.feature; +const setStyle: google.maps.FeatureStyleFunction = (params) => { + const datasetFeature = params.feature as google.maps.DatasetFeature; // 'typecategory' is an attribute in this Dataset. - const typeCategory = datasetFeature.datasetAttributes['typecategory']; + const typeCategory = datasetFeature.datasetAttributes.typecategory; switch (typeCategory) { case 'Undeveloped': // Color undeveloped areas blue. @@ -42,7 +42,7 @@ function setStyle(params) { }; break; } -} +}; // [END maps_dds_datasets_polygon_colors_style_function] async function init() { diff --git a/dist/samples/dds-datasets-polygon-colors/jsfiddle/demo.js b/dist/samples/dds-datasets-polygon-colors/jsfiddle/demo.js index 648900b27..c57a76b1e 100644 --- a/dist/samples/dds-datasets-polygon-colors/jsfiddle/demo.js +++ b/dist/samples/dds-datasets-polygon-colors/jsfiddle/demo.js @@ -8,10 +8,10 @@ const mapElement = document.querySelector('gmp-map'); let innerMap; -function setStyle(params) { +const setStyle = (params) => { const datasetFeature = params.feature; // 'typecategory' is an attribute in this Dataset. - const typeCategory = datasetFeature.datasetAttributes['typecategory']; + const typeCategory = datasetFeature.datasetAttributes.typecategory; switch (typeCategory) { case 'Undeveloped': // Color undeveloped areas blue. @@ -42,7 +42,7 @@ function setStyle(params) { }; break; } -} +}; async function init() { // Request needed libraries. diff --git a/dist/samples/dds-region-viewer/app/index.ts b/dist/samples/dds-region-viewer/app/index.ts index 121bbd333..58f061e1f 100644 --- a/dist/samples/dds-region-viewer/app/index.ts +++ b/dist/samples/dds-region-viewer/app/index.ts @@ -4,6 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ + /** * Data-driven styling region coverage viewer! * - View feature boundary availability around the world. @@ -12,7 +16,7 @@ // [START maps_dds_region_viewer] const mapElement = document.querySelector('gmp-map')!; -let placeAutocomplete; +let placeAutocomplete: google.maps.places.PlaceAutocompleteElement; let innerMap: google.maps.Map; let countryMenu: HTMLSelectElement; let featureMenu: HTMLSelectElement; @@ -21,13 +25,13 @@ let fillColorPicker: HTMLInputElement; let strokeColorPicker: HTMLInputElement; let contentDiv: HTMLElement; -let allLayers; -let countryLayer; -let admin1Layer; -let admin2Layer; -let localityLayer; -let postalCodeLayer; -let schoolDistrictLayer; +let allLayers: google.maps.FeatureLayer[]; +let countryLayer: google.maps.FeatureLayer; +let admin1Layer: google.maps.FeatureLayer; +let admin2Layer: google.maps.FeatureLayer; +let localityLayer: google.maps.FeatureLayer; +let postalCodeLayer: google.maps.FeatureLayer; +let schoolDistrictLayer: google.maps.FeatureLayer; let selectedPlaceId: string; @@ -50,7 +54,7 @@ async function init() { placeAutocomplete = document.querySelector('gmp-place-autocomplete')!; placeAutocomplete.includedPrimaryTypes = ['(regions)']; - contentDiv = document.getElementById('pac-content') as HTMLElement; + contentDiv = document.getElementById('pac-content')!; searchInputOption = document.getElementById( 'pac-filter-option' ) as HTMLInputElement; @@ -87,7 +91,7 @@ async function init() { // Handle autocomplete widget selection. placeAutocomplete.addEventListener('gmp-select', ({ placePrediction }) => { - const types = placePrediction.types as string[]; + const types = placePrediction.types; // Find the first type that matches a feature menu option. const validFeatureTypes = [ @@ -209,7 +213,7 @@ function styleChanged() { } // Apply styling to a polygon. -function applyStyle(placeid?) { +function applyStyle(placeid?: string) { // Define styles. const styleStrokeOnly = { strokeColor: strokeColorPicker.value, @@ -229,8 +233,9 @@ function applyStyle(placeid?) { revertStyles(); - const featureStyle = (params) => { - if (params.feature.placeId == placeid) { + const featureStyle = (params: google.maps.FeatureStyleFunctionOptions) => { + const placeFeature = params.feature as google.maps.PlaceFeature; + if (placeFeature.placeId === placeid) { return styleStrokeFill; } else { return styleStrokeOnly; @@ -270,13 +275,12 @@ function applyStyle(placeid?) { // Populate the countries menu. function buildMenu() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any for (const item of (countries as any).default) { const countryOption = document.createElement('option'); countryOption.textContent = item.name; countryOption.value = item.code; // Set U.S. as the default. - if (item.code == 'US') { + if (item.code === 'US') { countryOption.selected = true; } countryMenu.appendChild(countryOption); @@ -303,17 +307,16 @@ function updateFeatureMenuAvailability(countryCode: string) { // Do a comparison on the map, and disable any false items. for (const [feature, isAvailable] of featureAvailabilityMap) { - const menuItem = featureMenu.namedItem(feature) as HTMLOptionElement; + const menuItem = featureMenu.namedItem(feature)!; if (menuItem) menuItem.disabled = !isAvailable; } } // Return a map of feature availability for a country. -function getFeatureAvailability(countryName) { +function getFeatureAvailability(countryCode: string) { // Return the data for the selected country. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const selectedCountry = (countries as any).default.find((country) => { - return country.code === countryName; + const selectedCountry = (countries as any).default.find((country: any) => { + return country.code === countryCode; }); // Create a map for our values. @@ -343,14 +346,15 @@ function revertStyles() { } // Apply styling to the clicked place. -function handlePlaceClick(event) { - const clickedPlaceId = event.features[0].placeId; +function handlePlaceClick(event: google.maps.FeatureMouseEvent) { + const placeFeature = event.features[0] as google.maps.PlaceFeature; + const clickedPlaceId = placeFeature.placeId; if (!clickedPlaceId) return; void showSelectedPolygon(clickedPlaceId, 0); } // Get the place ID for the selected country, then call showSelectedPolygon(). -async function showSelectedCountry(countryName) { +async function showSelectedCountry(countryName: string) { const { Place } = await google.maps.importLibrary('places'); contentDiv.textContent = ''; @@ -369,7 +373,7 @@ async function showSelectedCountry(countryName) { // Event handler for when a polygon is selected. // mode 0 = click, mode 1 = autocomplete. -async function showSelectedPolygon(placeid, mode) { +async function showSelectedPolygon(placeid: string, mode: number) { let isFeatureSupported; const { Place } = await google.maps.importLibrary('places'); selectedPlaceId = placeid; @@ -408,14 +412,14 @@ async function showSelectedPolygon(placeid, mode) { // Build the HTML. contentDiv.appendChild(document.createElement('hr')); - const types = place.types as string[]; + const types = place.types!; // Create HTML for place information. const placeInfo = document.createElement('div'); placeInfo.id = 'place-info'; // Show information if boundary was clicked (mode 0). - if (mode == 0) { + if (mode === 0) { const boldAddress = document.createElement('b'); boldAddress.textContent = place.formattedAddress!; const placeIdCode = document.createElement('code'); diff --git a/dist/samples/dds-region-viewer/dist/assets/index-C1HHW6yK.js b/dist/samples/dds-region-viewer/dist/assets/index-COU3pMDt.js similarity index 95% rename from dist/samples/dds-region-viewer/dist/assets/index-C1HHW6yK.js rename to dist/samples/dds-region-viewer/dist/assets/index-COU3pMDt.js index ee93c5e44..056da792e 100644 --- a/dist/samples/dds-region-viewer/dist/assets/index-C1HHW6yK.js +++ b/dist/samples/dds-region-viewer/dist/assets/index-COU3pMDt.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=JSON.parse(`[{"name":"Afghanistan","code":"AF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Åland Islands","code":"AX","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Albania","code":"AL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Algeria","code":"DZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"American Samoa","code":"AS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Andorra","code":"AD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Angola","code":"AO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Anguilla","code":"AI","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Antarctica","code":"AQ","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Antigua & Barbuda","code":"AG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Argentina","code":"AR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Armenia","code":"AM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Aruba","code":"AW","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Australia","code":"AU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Austria","code":"AT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Azerbaijan","code":"AZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bahamas","code":"BS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bahrain","code":"BH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bangladesh","code":"BD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Barbados","code":"BB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Belarus","code":"BY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Belgium","code":"BE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Belize","code":"BZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Benin","code":"BJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bermuda","code":"BM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bhutan","code":"BT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bolivia","code":"BO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bosnia & Herzegovina","code":"BA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Botswana","code":"BW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bouvet Island","code":"BV","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Brazil","code":"BR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"British Indian Ocean Territory","code":"IO","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"British Virgin Islands","code":"VG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Brunei","code":"BN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bulgaria","code":"BG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Burkina Faso","code":"BF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Burundi","code":"BI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cambodia","code":"KH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cameroon","code":"CM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Canada","code":"CA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Canary Islands","code":"IC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cape Verde","code":"CV","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Caribbean Netherlands","code":"BQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cayman Islands","code":"KY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Central African Republic","code":"CF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Chad","code":"TD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Chile","code":"CL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"China","code":"CN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Christmas Island","code":"CX","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Cocos (Keeling) Islands","code":"CC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Colombia","code":"CO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Comoros","code":"KM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Congo - Brazzaville","code":"CG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Congo - Kinshasa","code":"CD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cook Islands","code":"CK","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Costa Rica","code":"CR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Côte d’Ivoire","code":"CI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Croatia","code":"HR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cuba","code":"CU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Curaçao","code":"CW","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cyprus","code":"CY","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Czechia","code":"CZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Denmark","code":"DK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Djibouti","code":"DJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Dominica","code":"DM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Dominican Republic","code":"DO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ecuador","code":"EC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Egypt","code":"EG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"El Salvador","code":"SV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Equatorial Guinea","code":"GQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Eritrea","code":"ER","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Estonia","code":"EE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Eswatini","code":"SZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ethiopia","code":"ET","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Falkland Islands (Islas Malvinas)","code":"FK","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Faroe Islands","code":"FO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Fiji","code":"FJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Finland","code":"FI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"France","code":"FR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"French Guiana","code":"GF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"French Polynesia","code":"PF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"French Southern Territories","code":"TF","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Gabon","code":"GA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Gambia","code":"GM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Georgia","code":"GE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Germany","code":"DE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Ghana","code":"GH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Gibraltar","code":"GI","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Greece","code":"GR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Greenland","code":"GL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Grenada","code":"GD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guadeloupe","code":"GP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guam","code":"GU","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guatemala","code":"GT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guernsey","code":"GG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guinea","code":"GN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guinea-Bissau","code":"GW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guyana","code":"GY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Haiti","code":"HT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Heard & McDonald Islands","code":"HM","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Honduras","code":"HN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Hong Kong","code":"HK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Hungary","code":"HU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Iceland","code":"IS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"India","code":"IN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Indonesia","code":"ID","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Iran","code":"IR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Iraq","code":"IQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ireland","code":"IE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Isle of Man","code":"IM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Israel","code":"IL","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Italy","code":"IT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Jamaica","code":"JM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Japan","code":"JP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Jersey","code":"JE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Jordan","code":"JO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kazakhstan","code":"KZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kenya","code":"KE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kiribati","code":"KI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kosovo","code":"XK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kuwait","code":"KW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kyrgyzstan","code":"KG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Laos","code":"LA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Latvia","code":"LV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Lebanon","code":"LB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Lesotho","code":"LS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Liberia","code":"LR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Libya","code":"LY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Liechtenstein","code":"LI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Lithuania","code":"LT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Luxembourg","code":"LU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":true,"school_district":false}},{"name":"Macao","code":"MO","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Madagascar","code":"MG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Malawi","code":"MW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Malaysia","code":"MY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Maldives","code":"MV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mali","code":"ML","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Malta","code":"MT","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":true,"school_district":false}},{"name":"Marshall Islands","code":"MH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Martinique","code":"MQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mauritania","code":"MR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mauritius","code":"MU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mayotte","code":"YT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mexico","code":"MX","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Micronesia","code":"FM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Moldova","code":"MD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Monaco","code":"MC","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mongolia","code":"MN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Montenegro","code":"ME","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Montserrat","code":"MS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Morocco","code":"MA","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mozambique","code":"MZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Myanmar (Burma)","code":"MM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Namibia","code":"NA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Nauru","code":"NR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Nepal","code":"NP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Netherlands","code":"NL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"New Caledonia","code":"NC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"New Zealand","code":"NZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Nicaragua","code":"NI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Niger","code":"NE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Nigeria","code":"NG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Niue","code":"NU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Norfolk Island","code":"NF","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"North Korea","code":"KP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"North Macedonia","code":"MK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Northern Mariana Islands","code":"MP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Norway","code":"NO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Oman","code":"OM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Pakistan","code":"PK","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Palau","code":"PW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Palestine","code":"PS","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Panama","code":"PA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Papua New Guinea","code":"PG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Paraguay","code":"PY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Peru","code":"PE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Philippines","code":"PH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Pitcairn Islands","code":"PN","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Poland","code":"PL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Portugal","code":"PT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Puerto Rico","code":"PR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Qatar","code":"QA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Réunion","code":"RE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Romania","code":"RO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Russia","code":"RU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Rwanda","code":"RW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Samoa","code":"WS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"San Marino","code":"SM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"São Tomé & Príncipe","code":"ST","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Saudi Arabia","code":"SA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Senegal","code":"SN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Serbia","code":"RS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Seychelles","code":"SC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sierra Leone","code":"SL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Singapore","code":"SG","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sint Maarten","code":"SX","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Slovakia","code":"SK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Slovenia","code":"SI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Solomon Islands","code":"SB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Somalia","code":"SO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"South Africa","code":"ZA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"South Georgia & South Sandwich Islands","code":"GS","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"South Korea","code":"KR","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"South Sudan","code":"SS","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Spain","code":"ES","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Sri Lanka","code":"LK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Barthélemy","code":"BL","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Helena","code":"SH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Kitts & Nevis","code":"KN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Lucia","code":"LC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Martin","code":"MF","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"St. Pierre & Miquelon","code":"PM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"St. Vincent & Grenadines","code":"VC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sudan","code":"SD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Suriname","code":"SR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Svalbard & Jan Mayen","code":"SJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sweden","code":"SE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Switzerland","code":"CH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Syria","code":"SY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Taiwan","code":"TW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tajikistan","code":"TJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tanzania","code":"TZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Thailand","code":"TH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":true,"school_district":false}},{"name":"Timor-Leste","code":"TL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Togo","code":"TG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tokelau","code":"TK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tonga","code":"TO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Trinidad & Tobago","code":"TT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tunisia","code":"TN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Türkiye","code":"TR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Turkmenistan","code":"TM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Turks & Caicos Islands","code":"TC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Tuvalu","code":"TV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"U.S. Outlying Islands","code":"UM","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"U.S. Virgin Islands","code":"VI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Uganda","code":"UG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ukraine","code":"UA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"United Arab Emirates","code":"AE","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"United Kingdom","code":"GB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"United States","code":"US","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":true}},{"name":"Uruguay","code":"UY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Uzbekistan","code":"UZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Vanuatu","code":"VU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Vatican City","code":"VA","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Venezuela","code":"VE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Vietnam","code":"VN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Wallis & Futuna","code":"WF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Yemen","code":"YE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Zambia","code":"ZM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Zimbabwe","code":"ZW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}}]`),t=document.querySelector(`gmp-map`),n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;async function v(){await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`),google.maps.importLibrary(`marker`)]),r=t.innerMap,r.setOptions({mapTypeControl:!1}),n=document.querySelector(`gmp-place-autocomplete`),n.includedPrimaryTypes=[`(regions)`],l=document.getElementById(`pac-content`),o=document.getElementById(`pac-filter-option`),i=document.getElementById(`country-select`),a=document.getElementById(`feature-type-select`),s=document.getElementById(`fill-color-picker`),c=document.getElementById(`stroke-color-picker`),i.addEventListener(`change`,w),a.addEventListener(`change`,y),s.addEventListener(`change`,x),c.addEventListener(`change`,x),o.addEventListener(`change`,()=>{o.checked?(a.item(5).disabled=!0,b()):(a.item(5).disabled=!1,b())}),n.addEventListener(`gmp-select`,({placePrediction:e})=>{let t=e.types,n=[`country`,`administrative_area_level_1`,`administrative_area_level_2`,`locality`,`postal_code`,`school_district`];for(let e of t)if(n.includes(e)){a.value=e;break}b(),A(e.placeId,1)}),d=r.getFeatureLayer(`COUNTRY`),f=r.getFeatureLayer(`ADMINISTRATIVE_AREA_LEVEL_1`),p=r.getFeatureLayer(`ADMINISTRATIVE_AREA_LEVEL_2`),m=r.getFeatureLayer(`LOCALITY`),h=r.getFeatureLayer(`POSTAL_CODE`),g=r.getFeatureLayer(`SCHOOL_DISTRICT`),d.addListener(`click`,O),f.addListener(`click`,O),p.addListener(`click`,O),m.addListener(`click`,O),h.addListener(`click`,O),g.addListener(`click`,O),u=[d,f,p,m,h,g],S(),C(),w(),a.selectedIndex=0}function y(){let e={fillColor:`white`,fillOpacity:.01,strokeColor:c.value,strokeOpacity:1,strokeWeight:2};switch(D(),b(),_=``,l.innerHTML=``,a.value){case`country`:d.style=e,o.disabled=!1;break;case`administrative_area_level_1`:f.style=e,o.disabled=!1;break;case`administrative_area_level_2`:p.style=e,o.disabled=!1;break;case`locality`:m.style=e,o.disabled=!1;break;case`postal_code`:h.style=e,o.disabled=!1;break;case`school_district`:g.style=e,o.disabled=!0;break;default:break}}function b(){o.checked?n.includedPrimaryTypes=[a.value]:n.includedPrimaryTypes=[`(regions)`]}function x(){_&&S(_)}function S(e){let t={strokeColor:c.value,strokeOpacity:1,strokeWeight:2,fillColor:`white`,fillOpacity:.1},n={strokeColor:c.value,strokeOpacity:1,strokeWeight:2,fillColor:s.value,fillOpacity:.5};D();let r=r=>r.feature.placeId==e?n:t;switch(a.value){case`country`:d.style=r,o.disabled=!1;break;case`administrative_area_level_1`:f.style=r,o.disabled=!1;break;case`administrative_area_level_2`:p.style=r,o.disabled=!1;break;case`locality`:m.style=r,o.disabled=!1;break;case`postal_code`:h.style=r,o.disabled=!1;break;case`school_district`:g.style=r,o.disabled=!0;break;default:break}}function C(){for(let t of e){let e=document.createElement(`option`);e.textContent=t.name,e.value=t.code,t.code==`US`&&(e.selected=!0),i.appendChild(e)}}function w(){let e=i.value;T(e),a.namedItem(`country`).selected=!0,k(i.options[i.selectedIndex].text)}function T(e){let t=E(e);for(let[e,n]of t){let t=a.namedItem(e);t&&(t.disabled=!n)}}function E(t){let n=e.find(e=>e.code===t);return new Map([[`country`,n?.feature.country],[`administrative_area_level_1`,n?.feature.administrative_area_level_1],[`administrative_area_level_2`,n?.feature.administrative_area_level_2],[`postal_code`,n?.feature.postal_code],[`locality`,n?.feature.locality],[`school_district`,n?.feature.school_district]])}function D(){for(let e of u)e.style=null}function O(e){let t=e.features[0].placeId;t&&A(t,0)}async function k(e){let{Place:t}=await google.maps.importLibrary(`places`);l.textContent=``;let n={textQuery:e,fields:[`id`]},{places:r}=await t.searchByText(n);r.length>0&&await A(r[0].id,0)}async function A(e,t){let n,{Place:o}=await google.maps.importLibrary(`places`);_=e,l.textContent=``;let s=new o({id:e});await s.fetchFields({fields:[`displayName`,`formattedAddress`,`viewport`,`types`,`addressComponents`]});let c=s.addressComponents?.find(e=>e.types.includes(`country`));c&&(i.value=c.shortText,T(i.value),n=E(i.value).get(a.value));let u=s.viewport;r.fitBounds(u,155),l.appendChild(document.createElement(`hr`));let d=s.types,f=document.createElement(`div`);if(f.id=`place-info`,t==0){let t=document.createElement(`b`);t.textContent=s.formattedAddress;let n=document.createElement(`code`);n.textContent=e;let r=document.createElement(`code`);r.textContent=d[0],f.append(t),f.append(document.createElement(`br`),`Place ID: `,n),f.append(document.createElement(`br`),`Feature type: `,r)}else n?f.textContent=`Click a boundary to see its place ID and feature type.`:f.textContent=`Feature type (${a.value}) is not supported for this country.`;l.appendChild(f),S(e)}v(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=JSON.parse(`[{"name":"Afghanistan","code":"AF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Åland Islands","code":"AX","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Albania","code":"AL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Algeria","code":"DZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"American Samoa","code":"AS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Andorra","code":"AD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Angola","code":"AO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Anguilla","code":"AI","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Antarctica","code":"AQ","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Antigua & Barbuda","code":"AG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Argentina","code":"AR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Armenia","code":"AM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Aruba","code":"AW","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Australia","code":"AU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Austria","code":"AT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Azerbaijan","code":"AZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bahamas","code":"BS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bahrain","code":"BH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bangladesh","code":"BD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Barbados","code":"BB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Belarus","code":"BY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Belgium","code":"BE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Belize","code":"BZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Benin","code":"BJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bermuda","code":"BM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bhutan","code":"BT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bolivia","code":"BO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bosnia & Herzegovina","code":"BA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Botswana","code":"BW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bouvet Island","code":"BV","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Brazil","code":"BR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"British Indian Ocean Territory","code":"IO","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"British Virgin Islands","code":"VG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Brunei","code":"BN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Bulgaria","code":"BG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Burkina Faso","code":"BF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Burundi","code":"BI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cambodia","code":"KH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cameroon","code":"CM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Canada","code":"CA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Canary Islands","code":"IC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cape Verde","code":"CV","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Caribbean Netherlands","code":"BQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cayman Islands","code":"KY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Central African Republic","code":"CF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Chad","code":"TD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Chile","code":"CL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"China","code":"CN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Christmas Island","code":"CX","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Cocos (Keeling) Islands","code":"CC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Colombia","code":"CO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Comoros","code":"KM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Congo - Brazzaville","code":"CG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Congo - Kinshasa","code":"CD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cook Islands","code":"CK","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Costa Rica","code":"CR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Côte d’Ivoire","code":"CI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Croatia","code":"HR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cuba","code":"CU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Curaçao","code":"CW","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Cyprus","code":"CY","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Czechia","code":"CZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Denmark","code":"DK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Djibouti","code":"DJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Dominica","code":"DM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Dominican Republic","code":"DO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ecuador","code":"EC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Egypt","code":"EG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"El Salvador","code":"SV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Equatorial Guinea","code":"GQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Eritrea","code":"ER","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Estonia","code":"EE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Eswatini","code":"SZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ethiopia","code":"ET","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Falkland Islands (Islas Malvinas)","code":"FK","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Faroe Islands","code":"FO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Fiji","code":"FJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Finland","code":"FI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"France","code":"FR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"French Guiana","code":"GF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"French Polynesia","code":"PF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"French Southern Territories","code":"TF","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Gabon","code":"GA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Gambia","code":"GM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Georgia","code":"GE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Germany","code":"DE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Ghana","code":"GH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Gibraltar","code":"GI","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Greece","code":"GR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Greenland","code":"GL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Grenada","code":"GD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guadeloupe","code":"GP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guam","code":"GU","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guatemala","code":"GT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guernsey","code":"GG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guinea","code":"GN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guinea-Bissau","code":"GW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Guyana","code":"GY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Haiti","code":"HT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Heard & McDonald Islands","code":"HM","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Honduras","code":"HN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Hong Kong","code":"HK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Hungary","code":"HU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Iceland","code":"IS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"India","code":"IN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Indonesia","code":"ID","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Iran","code":"IR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Iraq","code":"IQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ireland","code":"IE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Isle of Man","code":"IM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Israel","code":"IL","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Italy","code":"IT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Jamaica","code":"JM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Japan","code":"JP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Jersey","code":"JE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Jordan","code":"JO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kazakhstan","code":"KZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kenya","code":"KE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kiribati","code":"KI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kosovo","code":"XK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kuwait","code":"KW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Kyrgyzstan","code":"KG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Laos","code":"LA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Latvia","code":"LV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Lebanon","code":"LB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Lesotho","code":"LS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Liberia","code":"LR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Libya","code":"LY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Liechtenstein","code":"LI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Lithuania","code":"LT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Luxembourg","code":"LU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":true,"school_district":false}},{"name":"Macao","code":"MO","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Madagascar","code":"MG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Malawi","code":"MW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Malaysia","code":"MY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Maldives","code":"MV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mali","code":"ML","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Malta","code":"MT","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":true,"school_district":false}},{"name":"Marshall Islands","code":"MH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Martinique","code":"MQ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mauritania","code":"MR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mauritius","code":"MU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mayotte","code":"YT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mexico","code":"MX","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Micronesia","code":"FM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Moldova","code":"MD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Monaco","code":"MC","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mongolia","code":"MN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Montenegro","code":"ME","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Montserrat","code":"MS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Morocco","code":"MA","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Mozambique","code":"MZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Myanmar (Burma)","code":"MM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Namibia","code":"NA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Nauru","code":"NR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Nepal","code":"NP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Netherlands","code":"NL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"New Caledonia","code":"NC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"New Zealand","code":"NZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"Nicaragua","code":"NI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Niger","code":"NE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Nigeria","code":"NG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Niue","code":"NU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Norfolk Island","code":"NF","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"North Korea","code":"KP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"North Macedonia","code":"MK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Northern Mariana Islands","code":"MP","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Norway","code":"NO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Oman","code":"OM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Pakistan","code":"PK","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Palau","code":"PW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Palestine","code":"PS","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Panama","code":"PA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Papua New Guinea","code":"PG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Paraguay","code":"PY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Peru","code":"PE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Philippines","code":"PH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Pitcairn Islands","code":"PN","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Poland","code":"PL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Portugal","code":"PT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Puerto Rico","code":"PR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Qatar","code":"QA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Réunion","code":"RE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Romania","code":"RO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Russia","code":"RU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Rwanda","code":"RW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Samoa","code":"WS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"San Marino","code":"SM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"São Tomé & Príncipe","code":"ST","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Saudi Arabia","code":"SA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Senegal","code":"SN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Serbia","code":"RS","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Seychelles","code":"SC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sierra Leone","code":"SL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Singapore","code":"SG","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sint Maarten","code":"SX","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Slovakia","code":"SK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Slovenia","code":"SI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":false}},{"name":"Solomon Islands","code":"SB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Somalia","code":"SO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"South Africa","code":"ZA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"South Georgia & South Sandwich Islands","code":"GS","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"South Korea","code":"KR","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"South Sudan","code":"SS","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Spain","code":"ES","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Sri Lanka","code":"LK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Barthélemy","code":"BL","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Helena","code":"SH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Kitts & Nevis","code":"KN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Lucia","code":"LC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"St. Martin","code":"MF","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"St. Pierre & Miquelon","code":"PM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"St. Vincent & Grenadines","code":"VC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sudan","code":"SD","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Suriname","code":"SR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Svalbard & Jan Mayen","code":"SJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Sweden","code":"SE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Switzerland","code":"CH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":false,"school_district":false}},{"name":"Syria","code":"SY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Taiwan","code":"TW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tajikistan","code":"TJ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tanzania","code":"TZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Thailand","code":"TH","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":true,"school_district":false}},{"name":"Timor-Leste","code":"TL","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Togo","code":"TG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tokelau","code":"TK","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tonga","code":"TO","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Trinidad & Tobago","code":"TT","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Tunisia","code":"TN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Türkiye","code":"TR","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Turkmenistan","code":"TM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Turks & Caicos Islands","code":"TC","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":true,"locality":false,"school_district":false}},{"name":"Tuvalu","code":"TV","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"U.S. Outlying Islands","code":"UM","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"U.S. Virgin Islands","code":"VI","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Uganda","code":"UG","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Ukraine","code":"UA","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"United Arab Emirates","code":"AE","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"United Kingdom","code":"GB","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":true,"school_district":false}},{"name":"United States","code":"US","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":true,"locality":true,"school_district":true}},{"name":"Uruguay","code":"UY","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Uzbekistan","code":"UZ","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Vanuatu","code":"VU","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Vatican City","code":"VA","feature":{"country":true,"administrative_area_level_1":false,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Venezuela","code":"VE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":true,"postal_code":false,"locality":false,"school_district":false}},{"name":"Vietnam","code":"VN","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Wallis & Futuna","code":"WF","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Yemen","code":"YE","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Zambia","code":"ZM","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}},{"name":"Zimbabwe","code":"ZW","feature":{"country":true,"administrative_area_level_1":true,"administrative_area_level_2":false,"postal_code":false,"locality":false,"school_district":false}}]`),t=document.querySelector(`gmp-map`),n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;async function v(){await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`),google.maps.importLibrary(`marker`)]),r=t.innerMap,r.setOptions({mapTypeControl:!1}),n=document.querySelector(`gmp-place-autocomplete`),n.includedPrimaryTypes=[`(regions)`],l=document.getElementById(`pac-content`),o=document.getElementById(`pac-filter-option`),i=document.getElementById(`country-select`),a=document.getElementById(`feature-type-select`),s=document.getElementById(`fill-color-picker`),c=document.getElementById(`stroke-color-picker`),i.addEventListener(`change`,w),a.addEventListener(`change`,y),s.addEventListener(`change`,x),c.addEventListener(`change`,x),o.addEventListener(`change`,()=>{o.checked?(a.item(5).disabled=!0,b()):(a.item(5).disabled=!1,b())}),n.addEventListener(`gmp-select`,({placePrediction:e})=>{let t=e.types,n=[`country`,`administrative_area_level_1`,`administrative_area_level_2`,`locality`,`postal_code`,`school_district`];for(let e of t)if(n.includes(e)){a.value=e;break}b(),A(e.placeId,1)}),d=r.getFeatureLayer(`COUNTRY`),f=r.getFeatureLayer(`ADMINISTRATIVE_AREA_LEVEL_1`),p=r.getFeatureLayer(`ADMINISTRATIVE_AREA_LEVEL_2`),m=r.getFeatureLayer(`LOCALITY`),h=r.getFeatureLayer(`POSTAL_CODE`),g=r.getFeatureLayer(`SCHOOL_DISTRICT`),d.addListener(`click`,O),f.addListener(`click`,O),p.addListener(`click`,O),m.addListener(`click`,O),h.addListener(`click`,O),g.addListener(`click`,O),u=[d,f,p,m,h,g],S(),C(),w(),a.selectedIndex=0}function y(){let e={fillColor:`white`,fillOpacity:.01,strokeColor:c.value,strokeOpacity:1,strokeWeight:2};switch(D(),b(),_=``,l.innerHTML=``,a.value){case`country`:d.style=e,o.disabled=!1;break;case`administrative_area_level_1`:f.style=e,o.disabled=!1;break;case`administrative_area_level_2`:p.style=e,o.disabled=!1;break;case`locality`:m.style=e,o.disabled=!1;break;case`postal_code`:h.style=e,o.disabled=!1;break;case`school_district`:g.style=e,o.disabled=!0;break;default:break}}function b(){o.checked?n.includedPrimaryTypes=[a.value]:n.includedPrimaryTypes=[`(regions)`]}function x(){_&&S(_)}function S(e){let t={strokeColor:c.value,strokeOpacity:1,strokeWeight:2,fillColor:`white`,fillOpacity:.1},n={strokeColor:c.value,strokeOpacity:1,strokeWeight:2,fillColor:s.value,fillOpacity:.5};D();let r=r=>r.feature.placeId===e?n:t;switch(a.value){case`country`:d.style=r,o.disabled=!1;break;case`administrative_area_level_1`:f.style=r,o.disabled=!1;break;case`administrative_area_level_2`:p.style=r,o.disabled=!1;break;case`locality`:m.style=r,o.disabled=!1;break;case`postal_code`:h.style=r,o.disabled=!1;break;case`school_district`:g.style=r,o.disabled=!0;break;default:break}}function C(){for(let t of e){let e=document.createElement(`option`);e.textContent=t.name,e.value=t.code,t.code===`US`&&(e.selected=!0),i.appendChild(e)}}function w(){let e=i.value;T(e),a.namedItem(`country`).selected=!0,k(i.options[i.selectedIndex].text)}function T(e){let t=E(e);for(let[e,n]of t){let t=a.namedItem(e);t&&(t.disabled=!n)}}function E(t){let n=e.find(e=>e.code===t);return new Map([[`country`,n?.feature.country],[`administrative_area_level_1`,n?.feature.administrative_area_level_1],[`administrative_area_level_2`,n?.feature.administrative_area_level_2],[`postal_code`,n?.feature.postal_code],[`locality`,n?.feature.locality],[`school_district`,n?.feature.school_district]])}function D(){for(let e of u)e.style=null}function O(e){let t=e.features[0].placeId;t&&A(t,0)}async function k(e){let{Place:t}=await google.maps.importLibrary(`places`);l.textContent=``;let n={textQuery:e,fields:[`id`]},{places:r}=await t.searchByText(n);r.length>0&&await A(r[0].id,0)}async function A(e,t){let n,{Place:o}=await google.maps.importLibrary(`places`);_=e,l.textContent=``;let s=new o({id:e});await s.fetchFields({fields:[`displayName`,`formattedAddress`,`viewport`,`types`,`addressComponents`]});let c=s.addressComponents?.find(e=>e.types.includes(`country`));c&&(i.value=c.shortText,T(i.value),n=E(i.value).get(a.value));let u=s.viewport;r.fitBounds(u,155),l.appendChild(document.createElement(`hr`));let d=s.types,f=document.createElement(`div`);if(f.id=`place-info`,t===0){let t=document.createElement(`b`);t.textContent=s.formattedAddress;let n=document.createElement(`code`);n.textContent=e;let r=document.createElement(`code`);r.textContent=d[0],f.append(t),f.append(document.createElement(`br`),`Place ID: `,n),f.append(document.createElement(`br`),`Feature type: `,r)}else n?f.textContent=`Click a boundary to see its place ID and feature type.`:f.textContent=`Feature type (${a.value}) is not supported for this country.`;l.appendChild(f),S(e)}v(); \ No newline at end of file diff --git a/dist/samples/dds-region-viewer/dist/index.html b/dist/samples/dds-region-viewer/dist/index.html index 93479d098..0dcf4364c 100644 --- a/dist/samples/dds-region-viewer/dist/index.html +++ b/dist/samples/dds-region-viewer/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/dds-region-viewer/docs/index.js b/dist/samples/dds-region-viewer/docs/index.js index a5573b847..1ed4835d4 100644 --- a/dist/samples/dds-region-viewer/docs/index.js +++ b/dist/samples/dds-region-viewer/docs/index.js @@ -220,7 +220,8 @@ function applyStyle(placeid) { revertStyles(); const featureStyle = (params) => { - if (params.feature.placeId == placeid) { + const placeFeature = params.feature; + if (placeFeature.placeId === placeid) { return styleStrokeFill; } else { return styleStrokeOnly; @@ -265,7 +266,7 @@ function buildMenu() { countryOption.textContent = item.name; countryOption.value = item.code; // Set U.S. as the default. - if (item.code == 'US') { + if (item.code === 'US') { countryOption.selected = true; } countryMenu.appendChild(countryOption); @@ -298,11 +299,10 @@ function updateFeatureMenuAvailability(countryCode) { } // Return a map of feature availability for a country. -function getFeatureAvailability(countryName) { +function getFeatureAvailability(countryCode) { // Return the data for the selected country. - const selectedCountry = countries.default.find((country) => { - return country.code === countryName; + return country.code === countryCode; }); // Create a map for our values. @@ -333,7 +333,8 @@ function revertStyles() { // Apply styling to the clicked place. function handlePlaceClick(event) { - const clickedPlaceId = event.features[0].placeId; + const placeFeature = event.features[0]; + const clickedPlaceId = placeFeature.placeId; if (!clickedPlaceId) return; void showSelectedPolygon(clickedPlaceId, 0); } @@ -404,7 +405,7 @@ async function showSelectedPolygon(placeid, mode) { placeInfo.id = 'place-info'; // Show information if boundary was clicked (mode 0). - if (mode == 0) { + if (mode === 0) { const boldAddress = document.createElement('b'); boldAddress.textContent = place.formattedAddress; const placeIdCode = document.createElement('code'); diff --git a/dist/samples/dds-region-viewer/docs/index.ts b/dist/samples/dds-region-viewer/docs/index.ts index 121bbd333..58f061e1f 100644 --- a/dist/samples/dds-region-viewer/docs/index.ts +++ b/dist/samples/dds-region-viewer/docs/index.ts @@ -4,6 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ + /** * Data-driven styling region coverage viewer! * - View feature boundary availability around the world. @@ -12,7 +16,7 @@ // [START maps_dds_region_viewer] const mapElement = document.querySelector('gmp-map')!; -let placeAutocomplete; +let placeAutocomplete: google.maps.places.PlaceAutocompleteElement; let innerMap: google.maps.Map; let countryMenu: HTMLSelectElement; let featureMenu: HTMLSelectElement; @@ -21,13 +25,13 @@ let fillColorPicker: HTMLInputElement; let strokeColorPicker: HTMLInputElement; let contentDiv: HTMLElement; -let allLayers; -let countryLayer; -let admin1Layer; -let admin2Layer; -let localityLayer; -let postalCodeLayer; -let schoolDistrictLayer; +let allLayers: google.maps.FeatureLayer[]; +let countryLayer: google.maps.FeatureLayer; +let admin1Layer: google.maps.FeatureLayer; +let admin2Layer: google.maps.FeatureLayer; +let localityLayer: google.maps.FeatureLayer; +let postalCodeLayer: google.maps.FeatureLayer; +let schoolDistrictLayer: google.maps.FeatureLayer; let selectedPlaceId: string; @@ -50,7 +54,7 @@ async function init() { placeAutocomplete = document.querySelector('gmp-place-autocomplete')!; placeAutocomplete.includedPrimaryTypes = ['(regions)']; - contentDiv = document.getElementById('pac-content') as HTMLElement; + contentDiv = document.getElementById('pac-content')!; searchInputOption = document.getElementById( 'pac-filter-option' ) as HTMLInputElement; @@ -87,7 +91,7 @@ async function init() { // Handle autocomplete widget selection. placeAutocomplete.addEventListener('gmp-select', ({ placePrediction }) => { - const types = placePrediction.types as string[]; + const types = placePrediction.types; // Find the first type that matches a feature menu option. const validFeatureTypes = [ @@ -209,7 +213,7 @@ function styleChanged() { } // Apply styling to a polygon. -function applyStyle(placeid?) { +function applyStyle(placeid?: string) { // Define styles. const styleStrokeOnly = { strokeColor: strokeColorPicker.value, @@ -229,8 +233,9 @@ function applyStyle(placeid?) { revertStyles(); - const featureStyle = (params) => { - if (params.feature.placeId == placeid) { + const featureStyle = (params: google.maps.FeatureStyleFunctionOptions) => { + const placeFeature = params.feature as google.maps.PlaceFeature; + if (placeFeature.placeId === placeid) { return styleStrokeFill; } else { return styleStrokeOnly; @@ -270,13 +275,12 @@ function applyStyle(placeid?) { // Populate the countries menu. function buildMenu() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any for (const item of (countries as any).default) { const countryOption = document.createElement('option'); countryOption.textContent = item.name; countryOption.value = item.code; // Set U.S. as the default. - if (item.code == 'US') { + if (item.code === 'US') { countryOption.selected = true; } countryMenu.appendChild(countryOption); @@ -303,17 +307,16 @@ function updateFeatureMenuAvailability(countryCode: string) { // Do a comparison on the map, and disable any false items. for (const [feature, isAvailable] of featureAvailabilityMap) { - const menuItem = featureMenu.namedItem(feature) as HTMLOptionElement; + const menuItem = featureMenu.namedItem(feature)!; if (menuItem) menuItem.disabled = !isAvailable; } } // Return a map of feature availability for a country. -function getFeatureAvailability(countryName) { +function getFeatureAvailability(countryCode: string) { // Return the data for the selected country. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const selectedCountry = (countries as any).default.find((country) => { - return country.code === countryName; + const selectedCountry = (countries as any).default.find((country: any) => { + return country.code === countryCode; }); // Create a map for our values. @@ -343,14 +346,15 @@ function revertStyles() { } // Apply styling to the clicked place. -function handlePlaceClick(event) { - const clickedPlaceId = event.features[0].placeId; +function handlePlaceClick(event: google.maps.FeatureMouseEvent) { + const placeFeature = event.features[0] as google.maps.PlaceFeature; + const clickedPlaceId = placeFeature.placeId; if (!clickedPlaceId) return; void showSelectedPolygon(clickedPlaceId, 0); } // Get the place ID for the selected country, then call showSelectedPolygon(). -async function showSelectedCountry(countryName) { +async function showSelectedCountry(countryName: string) { const { Place } = await google.maps.importLibrary('places'); contentDiv.textContent = ''; @@ -369,7 +373,7 @@ async function showSelectedCountry(countryName) { // Event handler for when a polygon is selected. // mode 0 = click, mode 1 = autocomplete. -async function showSelectedPolygon(placeid, mode) { +async function showSelectedPolygon(placeid: string, mode: number) { let isFeatureSupported; const { Place } = await google.maps.importLibrary('places'); selectedPlaceId = placeid; @@ -408,14 +412,14 @@ async function showSelectedPolygon(placeid, mode) { // Build the HTML. contentDiv.appendChild(document.createElement('hr')); - const types = place.types as string[]; + const types = place.types!; // Create HTML for place information. const placeInfo = document.createElement('div'); placeInfo.id = 'place-info'; // Show information if boundary was clicked (mode 0). - if (mode == 0) { + if (mode === 0) { const boldAddress = document.createElement('b'); boldAddress.textContent = place.formattedAddress!; const placeIdCode = document.createElement('code'); diff --git a/dist/samples/dds-region-viewer/jsfiddle/demo.js b/dist/samples/dds-region-viewer/jsfiddle/demo.js index 28a789474..962390c68 100644 --- a/dist/samples/dds-region-viewer/jsfiddle/demo.js +++ b/dist/samples/dds-region-viewer/jsfiddle/demo.js @@ -219,7 +219,8 @@ function applyStyle(placeid) { revertStyles(); const featureStyle = (params) => { - if (params.feature.placeId == placeid) { + const placeFeature = params.feature; + if (placeFeature.placeId === placeid) { return styleStrokeFill; } else { return styleStrokeOnly; @@ -264,7 +265,7 @@ function buildMenu() { countryOption.textContent = item.name; countryOption.value = item.code; // Set U.S. as the default. - if (item.code == 'US') { + if (item.code === 'US') { countryOption.selected = true; } countryMenu.appendChild(countryOption); @@ -297,11 +298,10 @@ function updateFeatureMenuAvailability(countryCode) { } // Return a map of feature availability for a country. -function getFeatureAvailability(countryName) { +function getFeatureAvailability(countryCode) { // Return the data for the selected country. - const selectedCountry = countries.default.find((country) => { - return country.code === countryName; + return country.code === countryCode; }); // Create a map for our values. @@ -332,7 +332,8 @@ function revertStyles() { // Apply styling to the clicked place. function handlePlaceClick(event) { - const clickedPlaceId = event.features[0].placeId; + const placeFeature = event.features[0]; + const clickedPlaceId = placeFeature.placeId; if (!clickedPlaceId) return; void showSelectedPolygon(clickedPlaceId, 0); } @@ -403,7 +404,7 @@ async function showSelectedPolygon(placeid, mode) { placeInfo.id = 'place-info'; // Show information if boundary was clicked (mode 0). - if (mode == 0) { + if (mode === 0) { const boldAddress = document.createElement('b'); boldAddress.textContent = place.formattedAddress; const placeIdCode = document.createElement('code'); diff --git a/dist/samples/deckgl-arclayer/app/index.ts b/dist/samples/deckgl-arclayer/app/index.ts index 38b24307e..640a898ec 100644 --- a/dist/samples/deckgl-arclayer/app/index.ts +++ b/dist/samples/deckgl-arclayer/app/index.ts @@ -4,12 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ + // [START maps_deckgl_arclayer] import { GoogleMapsOverlay } from '@deck.gl/google-maps'; import { ArcLayer } from '@deck.gl/layers'; import type * as GeoJSON from 'geojson'; -type Properties = { scalerank: number }; +interface Properties { + scalerank: number; +} type Feature = GeoJSON.Feature; async function init() { @@ -33,9 +39,8 @@ async function init() { const flightsLayer = new ArcLayer({ id: 'flights', data: dataUrl, - // eslint-disable-next-line @typescript-eslint/no-explicit-any + dataTransform: (data: any) => - // eslint-disable-next-line @typescript-eslint/no-explicit-any data.features.filter((f: any) => f.properties.scalerank < 4), getSourcePosition: () => [14.42076, 50.08804], // Prague getTargetPosition: (f: Feature) => diff --git a/dist/samples/deckgl-arclayer/docs/index.ts b/dist/samples/deckgl-arclayer/docs/index.ts index 38b24307e..640a898ec 100644 --- a/dist/samples/deckgl-arclayer/docs/index.ts +++ b/dist/samples/deckgl-arclayer/docs/index.ts @@ -4,12 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ + // [START maps_deckgl_arclayer] import { GoogleMapsOverlay } from '@deck.gl/google-maps'; import { ArcLayer } from '@deck.gl/layers'; import type * as GeoJSON from 'geojson'; -type Properties = { scalerank: number }; +interface Properties { + scalerank: number; +} type Feature = GeoJSON.Feature; async function init() { @@ -33,9 +39,8 @@ async function init() { const flightsLayer = new ArcLayer({ id: 'flights', data: dataUrl, - // eslint-disable-next-line @typescript-eslint/no-explicit-any + dataTransform: (data: any) => - // eslint-disable-next-line @typescript-eslint/no-explicit-any data.features.filter((f: any) => f.properties.scalerank < 4), getSourcePosition: () => [14.42076, 50.08804], // Prague getTargetPosition: (f: Feature) => diff --git a/dist/samples/deckgl-heatmap/app/index.ts b/dist/samples/deckgl-heatmap/app/index.ts index 31d967175..9519f7774 100644 --- a/dist/samples/deckgl-heatmap/app/index.ts +++ b/dist/samples/deckgl-heatmap/app/index.ts @@ -5,6 +5,8 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* [START maps_deckgl_heatmap] */ // Initialize and add the map @@ -15,6 +17,19 @@ let googleMapsOverlay: deck.GoogleMapsOverlay; let marker: google.maps.marker.AdvancedMarkerElement | undefined; let infoWindow: google.maps.InfoWindow; +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Declare global namespace for Deck.gl to satisfy TypeScript compiler declare namespace deck { class HeatmapLayer { @@ -33,18 +48,17 @@ declare namespace deck { async function init(): Promise { // Progress bar logic moved from index.html - let progress; - const progressDiv = document.querySelector('.mdc-linear-progress')!; + let progress: mdc.linearProgress.MDCLinearProgress | undefined; + const progressDiv = document.querySelector('.mdc-linear-progress'); if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { - progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progress!.close(); + progressDiv.remove(); }; } @@ -131,7 +145,7 @@ async function init(): Promise { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } @@ -146,7 +160,7 @@ async function init(): Promise { if (!marker) { // Create the marker on the first click marker = new AdvancedMarkerElement({ - map: map, + map, position: latLng, gmpClickable: true, }); diff --git a/dist/samples/deckgl-heatmap/dist/assets/index-VKnhh8tX.js b/dist/samples/deckgl-heatmap/dist/assets/index-BT-qe2Sl.js similarity index 57% rename from dist/samples/deckgl-heatmap/dist/assets/index-VKnhh8tX.js rename to dist/samples/deckgl-heatmap/dist/assets/index-BT-qe2Sl.js index 38a677fe1..77fb31b36 100644 --- a/dist/samples/deckgl-heatmap/dist/assets/index-VKnhh8tX.js +++ b/dist/samples/deckgl-heatmap/dist/assets/index-BT-qe2Sl.js @@ -1,4 +1,4 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r,i;async function a(){let a,o=document.querySelector(`.mdc-linear-progress`);o&&(a=new mdc.linearProgress.MDCLinearProgress(o),a.open(),a.determinate=!1,a.done=function(){a.close(),o?.remove()});let s={lat:37.77325660358167,lng:-122.41712341793448},[{Map:c,InfoWindow:l},{AdvancedMarkerElement:u}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`)]),d=document.getElementById(`map`);if(!d){console.error(`Map element not found!`);return}e=new c(d,{zoom:13,center:s,tilt:90,heading:-25,mapId:`6b73a9fe7e831a00`,fullscreenControl:!1,clickableIcons:!1}),t=new deck.HeatmapLayer({id:`HeatmapLayer`,data:`https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-bike-parking.json`,getPosition:e=>e.COORDINATES,getWeight:e=>e.SPACES,radiusPixels:25,visible:!0,pickable:!0,onHover:e=>{let t=document.getElementById(`tooltip`);if(t){if(console.log(`Hovered object:`,e.object),e.object){let n=`

Bike Parking Info:

`;e.object.ADDRESS!==void 0&&(n+=`Address: ${e.object.ADDRESS}
`),e.object.RACKS!==void 0&&(n+=`Racks: ${e.object.RACKS}
`),e.object.SPACES!==void 0&&(n+=`Spaces: ${e.object.SPACES}
`),t.innerHTML=n,t.style.left=e.x+`px`,t.style.top=e.y+`px`,t.style.display=`block`}else t.style.display=`none`;console.log(`Tooltip content set to:`,t.innerHTML)}}}),t.pickable=!0,n=new deck.GoogleMapsOverlay({layers:[t],controller:!0}),n.setMap(e),a&&setTimeout(()=>{a.done()},100),i=new l,e.addListener(`click`,t=>{let n=t.latLng;if(n)if(r){r.position=n;let t=` +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r,i;async function a(){let a,o=document.querySelector(`.mdc-linear-progress`);o&&(a=new mdc.linearProgress.MDCLinearProgress(o),a.open(),a.determinate=!1,a.done=function(){a.close(),o.remove()});let s={lat:37.77325660358167,lng:-122.41712341793448},[{Map:c,InfoWindow:l},{AdvancedMarkerElement:u}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`)]),d=document.getElementById(`map`);if(!d){console.error(`Map element not found!`);return}e=new c(d,{zoom:13,center:s,tilt:90,heading:-25,mapId:`6b73a9fe7e831a00`,fullscreenControl:!1,clickableIcons:!1}),t=new deck.HeatmapLayer({id:`HeatmapLayer`,data:`https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-bike-parking.json`,getPosition:e=>e.COORDINATES,getWeight:e=>e.SPACES,radiusPixels:25,visible:!0,pickable:!0,onHover:e=>{let t=document.getElementById(`tooltip`);if(t){if(console.log(`Hovered object:`,e.object),e.object){let n=`

Bike Parking Info:

`;e.object.ADDRESS!==void 0&&(n+=`Address: ${e.object.ADDRESS}
`),e.object.RACKS!==void 0&&(n+=`Racks: ${e.object.RACKS}
`),e.object.SPACES!==void 0&&(n+=`Spaces: ${e.object.SPACES}
`),t.innerHTML=n,t.style.left=e.x+`px`,t.style.top=e.y+`px`,t.style.display=`block`}else t.style.display=`none`;console.log(`Tooltip content set to:`,t.innerHTML)}}}),t.pickable=!0,n=new deck.GoogleMapsOverlay({layers:[t],controller:!0}),n.setMap(e),a&&setTimeout(()=>{a.done?.()},100),i=new l,e.addListener(`click`,t=>{let n=t.latLng;if(n)if(r){r.position=n;let t=`
Location: ${n.lat().toFixed(3)}, ${n.lng().toFixed(3)}
`;i.setContent(t),i.open(e,r)}else{r=new u({map:e,position:n,gmpClickable:!0}),r.addEventListener(`gmp-click`,()=>{i.close();let t=` diff --git a/dist/samples/deckgl-heatmap/dist/index.html b/dist/samples/deckgl-heatmap/dist/index.html index 87898358c..c753da60e 100644 --- a/dist/samples/deckgl-heatmap/dist/index.html +++ b/dist/samples/deckgl-heatmap/dist/index.html @@ -25,7 +25,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/deckgl-heatmap/docs/index.js b/dist/samples/deckgl-heatmap/docs/index.js index 2ec595454..3009358e4 100644 --- a/dist/samples/deckgl-heatmap/docs/index.js +++ b/dist/samples/deckgl-heatmap/docs/index.js @@ -21,13 +21,12 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progressDiv.remove(); }; } @@ -114,7 +113,7 @@ async function init() { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } @@ -129,7 +128,7 @@ async function init() { if (!marker) { // Create the marker on the first click marker = new AdvancedMarkerElement({ - map: map, + map, position: latLng, gmpClickable: true, }); diff --git a/dist/samples/deckgl-heatmap/docs/index.ts b/dist/samples/deckgl-heatmap/docs/index.ts index 31d967175..9519f7774 100644 --- a/dist/samples/deckgl-heatmap/docs/index.ts +++ b/dist/samples/deckgl-heatmap/docs/index.ts @@ -5,6 +5,8 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* [START maps_deckgl_heatmap] */ // Initialize and add the map @@ -15,6 +17,19 @@ let googleMapsOverlay: deck.GoogleMapsOverlay; let marker: google.maps.marker.AdvancedMarkerElement | undefined; let infoWindow: google.maps.InfoWindow; +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Declare global namespace for Deck.gl to satisfy TypeScript compiler declare namespace deck { class HeatmapLayer { @@ -33,18 +48,17 @@ declare namespace deck { async function init(): Promise { // Progress bar logic moved from index.html - let progress; - const progressDiv = document.querySelector('.mdc-linear-progress')!; + let progress: mdc.linearProgress.MDCLinearProgress | undefined; + const progressDiv = document.querySelector('.mdc-linear-progress'); if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { - progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progress!.close(); + progressDiv.remove(); }; } @@ -131,7 +145,7 @@ async function init(): Promise { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } @@ -146,7 +160,7 @@ async function init(): Promise { if (!marker) { // Create the marker on the first click marker = new AdvancedMarkerElement({ - map: map, + map, position: latLng, gmpClickable: true, }); diff --git a/dist/samples/deckgl-heatmap/jsfiddle/demo.js b/dist/samples/deckgl-heatmap/jsfiddle/demo.js index fc1a2f09c..1bce0cfe7 100644 --- a/dist/samples/deckgl-heatmap/jsfiddle/demo.js +++ b/dist/samples/deckgl-heatmap/jsfiddle/demo.js @@ -20,13 +20,12 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progressDiv.remove(); }; } @@ -113,7 +112,7 @@ async function init() { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } @@ -128,7 +127,7 @@ async function init() { if (!marker) { // Create the marker on the first click marker = new AdvancedMarkerElement({ - map: map, + map, position: latLng, gmpClickable: true, }); diff --git a/dist/samples/deckgl-kml-updated/app/index.ts b/dist/samples/deckgl-kml-updated/app/index.ts index cfe49f60a..dd0c211db 100644 --- a/dist/samples/deckgl-kml-updated/app/index.ts +++ b/dist/samples/deckgl-kml-updated/app/index.ts @@ -5,6 +5,9 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* [START maps_deckgl_kml_updated] */ // Import necessary loader @@ -44,6 +47,19 @@ declare namespace deck { // Add other Deck.gl types used globally if needed } +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Initialize and add the map let map: google.maps.Map; let geojsonLayer: deck.GeoJsonLayer; @@ -51,18 +67,17 @@ let googleMapsOverlay: deck.GoogleMapsOverlay; async function init(): Promise { // Progress bar logic moved from index.html - let progress; + let progress: mdc.linearProgress.MDCLinearProgress; const progressDiv = document.querySelector('.mdc-linear-progress')!; if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { - progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progress!.close(); + progressDiv.remove(); // Use optional chaining in case progressDiv is null }; } @@ -106,12 +121,12 @@ async function init(): Promise { pointRadiusMinPixels: 2, pointRadiusMaxPixels: 200, getRadius: () => 8000, - getFillColor: (f) => { + getFillColor: (f: any) => { // Extract magnitude from the description string const description = f.properties.description; const magnitudeMatch = description.match(/M (\d+\.?\d*)/); let parsedMagnitude: number | null = null; - if (magnitudeMatch && magnitudeMatch[1]) { + if (magnitudeMatch?.[1]) { parsedMagnitude = parseFloat(magnitudeMatch[1]); } else { console.log('Magnitude not found'); @@ -176,7 +191,7 @@ async function init(): Promise { }, onDataLoad: () => { console.log('KML data loaded'); - if (progress && progress.done) { + if (progress?.done) { progress.done(); } }, diff --git a/dist/samples/deckgl-kml-updated/dist/assets/index-CaCNysHK.js b/dist/samples/deckgl-kml-updated/dist/assets/index-C_FxTM2c.js similarity index 96% rename from dist/samples/deckgl-kml-updated/dist/assets/index-CaCNysHK.js rename to dist/samples/deckgl-kml-updated/dist/assets/index-C_FxTM2c.js index d289c47c9..18f8e9cf3 100644 --- a/dist/samples/deckgl-kml-updated/dist/assets/index-CaCNysHK.js +++ b/dist/samples/deckgl-kml-updated/dist/assets/index-C_FxTM2c.js @@ -1,4 +1,4 @@ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function t(e){return e&&e.normalize&&e.normalize(),e&&e.textContent||``}function n(e,t){let n=e.getElementsByTagName(t);return n.length?n[0]:null}var r=/\s*/g,i=/^\s*|\s*$/g,a=/\s+/;function o(e){if(!e||!e.length)return 0;let t=0;for(let n=0;n{function t(e,t,n){if(n===void 0&&(n=Array.prototype),e&&typeof n.find==`function`)return n.find.call(e,t);for(var r=0;r{var t=v(),n=t.find,r=t.NAMESPACE;function i(e){return e!==``}function a(e){return e?e.split(/[\t\n\f\r ]+/).filter(i):[]}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function s(e){if(!e)return[];var t=a(e);return Object.keys(t.reduce(o,{}))}function c(e){return function(t){return e&&e.indexOf(t)!==-1}}function l(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function u(e,t){var n=e.prototype;if(!(n instanceof t)){function r(){}r.prototype=t.prototype,r=new r,l(n,r),e.prototype=n=r}n.constructor!=e&&(typeof e!=`function`&&console.error(`unknown Class:`+e),n.constructor=e)}var d={},f=d.ELEMENT_NODE=1,p=d.ATTRIBUTE_NODE=2,m=d.TEXT_NODE=3,h=d.CDATA_SECTION_NODE=4,g=d.ENTITY_REFERENCE_NODE=5,_=d.ENTITY_NODE=6,y=d.PROCESSING_INSTRUCTION_NODE=7,b=d.COMMENT_NODE=8,x=d.DOCUMENT_NODE=9,S=d.DOCUMENT_TYPE_NODE=10,C=d.DOCUMENT_FRAGMENT_NODE=11,w=d.NOTATION_NODE=12,T={},E={};T.INDEX_SIZE_ERR=(E[1]=`Index size error`,1),T.DOMSTRING_SIZE_ERR=(E[2]=`DOMString size error`,2);var D=T.HIERARCHY_REQUEST_ERR=(E[3]=`Hierarchy request error`,3);T.WRONG_DOCUMENT_ERR=(E[4]=`Wrong document`,4),T.INVALID_CHARACTER_ERR=(E[5]=`Invalid character`,5),T.NO_DATA_ALLOWED_ERR=(E[6]=`No data allowed`,6),T.NO_MODIFICATION_ALLOWED_ERR=(E[7]=`No modification allowed`,7);var O=T.NOT_FOUND_ERR=(E[8]=`Not found`,8);T.NOT_SUPPORTED_ERR=(E[9]=`Not supported`,9);var k=T.INUSE_ATTRIBUTE_ERR=(E[10]=`Attribute in use`,10);T.INVALID_STATE_ERR=(E[11]=`Invalid state`,11),T.SYNTAX_ERR=(E[12]=`Syntax error`,12),T.INVALID_MODIFICATION_ERR=(E[13]=`Invalid modification`,13),T.NAMESPACE_ERR=(E[14]=`Invalid namespace`,14),T.INVALID_ACCESS_ERR=(E[15]=`Invalid access`,15);function A(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,E[e]),this.message=E[e],Error.captureStackTrace&&Error.captureStackTrace(this,A);return n.code=e,t&&(this.message=this.message+`: `+t),n}A.prototype=Error.prototype,l(T,A);function j(){}j.prototype={length:0,item:function(e){return e>=0&&e=0){for(var i=t.length-1;r0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===e)return r}t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n&&Object.prototype.hasOwnProperty.call(n,e))return n[e];t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return this.lookupPrefix(e)==null}};function B(e){return e==`<`&&`<`||e==`>`&&`>`||e==`&`&&`&`||e==`"`&&`"`||`&#`+e.charCodeAt()+`;`}l(d,z),l(d,z.prototype);function V(e,t){if(t(e))return!0;if(e=e.firstChild)do if(V(e,t))return!0;while(e=e.nextSibling)}function H(){this.ownerDocument=this}function ee(e,t,n){e&&e._inc++,n.namespaceURI===r.XMLNS&&(t._nsMap[n.prefix?n.localName:``]=n.value)}function te(e,t,n,i){e&&e._inc++,n.namespaceURI===r.XMLNS&&delete t._nsMap[n.prefix?n.localName:``]}function ne(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var i=t.firstChild,a=0;i;)r[a++]=i,i=i.nextSibling;r.length=a,delete r[r.length]}}}function re(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,ne(e.ownerDocument,e),t}function ie(e){return e&&(e.nodeType===z.DOCUMENT_NODE||e.nodeType===z.DOCUMENT_FRAGMENT_NODE||e.nodeType===z.ELEMENT_NODE)}function ae(e){return e&&(W(e)||oe(e)||U(e)||e.nodeType===z.DOCUMENT_FRAGMENT_NODE||e.nodeType===z.COMMENT_NODE||e.nodeType===z.PROCESSING_INSTRUCTION_NODE)}function U(e){return e&&e.nodeType===z.DOCUMENT_TYPE_NODE}function W(e){return e&&e.nodeType===z.ELEMENT_NODE}function oe(e){return e&&e.nodeType===z.TEXT_NODE}function se(e,t){var r=e.childNodes||[];if(n(r,W)||U(t))return!1;var i=n(r,U);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function ce(e,t){var r=e.childNodes||[];function i(e){return W(e)&&e!==t}if(n(r,i))return!1;var a=n(r,U);return!(t&&a&&r.indexOf(a)>r.indexOf(t))}function le(e,t,n){if(!ie(e))throw new A(D,`Unexpected parent node type `+e.nodeType);if(n&&n.parentNode!==e)throw new A(O,`child not in parent`);if(!ae(t)||U(t)&&e.nodeType!==z.DOCUMENT_NODE)throw new A(D,`Unexpected node type `+t.nodeType+` for parent node type `+e.nodeType)}function ue(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===z.DOCUMENT_FRAGMENT_NODE){var o=a.filter(W);if(o.length>1||n(a,oe))throw new A(D,`More than one element or text in fragment`);if(o.length===1&&!se(e,r))throw new A(D,`Element in fragment can not be inserted before doctype`)}if(W(t)&&!se(e,r))throw new A(D,`Only one element can be added and only after doctype`);if(U(t)){if(n(i,U))throw new A(D,`Only one doctype is allowed`);var s=n(i,W);if(r&&i.indexOf(s)1||n(a,oe))throw new A(D,`More than one element or text in fragment`);if(o.length===1&&!ce(e,r))throw new A(D,`Element in fragment can not be inserted before doctype`)}if(W(t)&&!ce(e,r))throw new A(D,`Only one element can be added and only after doctype`);if(U(t)){function e(e){return U(e)&&e!==r}if(n(i,e))throw new A(D,`Only one doctype is allowed`);var s=n(i,W);if(r&&i.indexOf(s)0&&V(n.documentElement,function(i){if(i!==n&&i.nodeType===f){var a=i.getAttribute(`class`);if(a){var o=e===a;if(!o){var l=s(a);o=t.every(c(l))}o&&r.push(i)}}}),r})},createElement:function(e){var t=new K;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new j;var n=t.attributes=new P;return n._ownerElement=t,t},createDocumentFragment:function(){var e=new Q;return e.ownerDocument=this,e.childNodes=new j,e},createTextNode:function(e){var t=new Y;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new pe;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new _e;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new q;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ge;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new K,r=t.split(`:`),i=n.attributes=new P;return n.childNodes=new j,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new q,r=t.split(`:`);return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},u(H,z);function K(){this._nsMap={}}K.prototype={nodeType:f,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||``},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=``+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===C?this.insertBefore(e,null):fe(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||``},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=``+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new M(this,function(t){var n=[];return V(t,function(r){r!==t&&r.nodeType==f&&(e===`*`||r.tagName==e)&&n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new M(this,function(n){var r=[];return V(n,function(i){i!==n&&i.nodeType===f&&(e===`*`||i.namespaceURI===e)&&(t===`*`||i.localName==t)&&r.push(i)}),r})}},H.prototype.getElementsByTagName=K.prototype.getElementsByTagName,H.prototype.getElementsByTagNameNS=K.prototype.getElementsByTagNameNS,u(K,z);function q(){}q.prototype.nodeType=p,u(q,z);function J(){}J.prototype={data:``,substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw Error(E[D])},deleteData:function(e,t){this.replaceData(e,t,``)},replaceData:function(e,t,n){var r=this.data.substring(0,e),i=this.data.substring(e+t);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}},u(J,z);function Y(){}Y.prototype={nodeName:`#text`,nodeType:m,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},u(Y,J);function X(){}X.prototype={nodeName:`#comment`,nodeType:b},u(X,J);function pe(){}pe.prototype={nodeName:`#cdata-section`,nodeType:h},u(pe,J);function Z(){}Z.prototype.nodeType=S,u(Z,z);function me(){}me.prototype.nodeType=w,u(me,z);function he(){}he.prototype.nodeType=_,u(he,z);function ge(){}ge.prototype.nodeType=g,u(ge,z);function Q(){}Q.prototype.nodeName=`#document-fragment`,Q.prototype.nodeType=C,u(Q,z);function _e(){}_e.prototype.nodeType=y,u(_e,z);function ve(){}ve.prototype.serializeToString=function(e,t,n){return ye.call(e,t,n)},z.prototype.toString=ye;function ye(e,t){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,a=r.namespaceURI;if(a&&i==null){var i=r.lookupPrefix(a);if(i==null)var o=[{namespace:a,prefix:null}]}return $(this,n,e,t,o),n.join(``)}function be(e,t,n){var i=e.prefix||``,a=e.namespaceURI;if(!a||i===`xml`&&a===r.XML||a===r.XMLNS)return!1;for(var o=n.length;o--;){var s=n[o];if(s.prefix===i)return s.namespace!==a}return!0}function xe(e,t,n){e.push(` `,t,`="`,n.replace(/[<&"]/g,B),`"`)}function $(e,t,n,i,a){if(a||=[],i)if(e=i(e),e){if(typeof e==`string`){t.push(e);return}}else return;switch(e.nodeType){case f:var o=e.attributes,s=o.length,c=e.firstChild,l=e.tagName;n=r.isHTML(e.namespaceURI)||n;var u=l;if(!n&&!e.prefix&&e.namespaceURI){for(var d,_=0;_=0;v--){var w=a[v];if(w.prefix===``&&w.namespace===e.namespaceURI){d=w.namespace;break}}if(d!==e.namespaceURI)for(var v=a.length-1;v>=0;v--){var w=a[v];if(w.namespace===e.namespaceURI){w.prefix&&(u=w.prefix+`:`+l);break}}}t.push(`<`,u);for(var T=0;T`),n&&/^script$/i.test(l))for(;c;)c.data?t.push(c.data):$(c,t,n,i,a.slice()),c=c.nextSibling;else for(;c;)$(c,t,n,i,a.slice()),c=c.nextSibling;t.push(``)}else t.push(`/>`);return;case x:case C:for(var c=e.firstChild;c;)$(c,t,n,i,a.slice()),c=c.nextSibling;return;case p:return xe(t,e.name,e.value);case m:return t.push(e.data.replace(/[<&]/g,B).replace(/]]>/g,`]]>`));case h:return t.push(``);case b:return t.push(``);case S:var k=e.publicId,A=e.systemId;if(t.push(``);else if(A&&A!=`.`)t.push(` SYSTEM `,A,`>`);else{var j=e.internalSubset;j&&t.push(` [`,j,`]`),t.push(`>`)}return;case y:return t.push(``);case g:return t.push(`&`,e.nodeName,`;`);default:t.push(`??`,e.nodeName)}}function Se(e,t,n){var r;switch(t.nodeType){case f:r=t.cloneNode(!1),r.ownerDocument=e;case C:break;case p:n=!0;break}if(r||=t.cloneNode(!1),r.ownerDocument=e,r.parentNode=null,n)for(var i=t.firstChild;i;)r.appendChild(Se(e,i,n)),i=i.nextSibling;return r}function Ce(e,t,n){var r=new t.constructor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=t[i];typeof a!=`object`&&a!=r[i]&&(r[i]=a)}switch(t.childNodes&&(r.childNodes=new j),r.ownerDocument=e,r.nodeType){case f:var o=t.attributes,s=r.attributes=new P,c=o.length;s._ownerElement=r;for(var l=0;l{var t=v().freeze;e.XML_ENTITIES=t({amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`}),e.HTML_ENTITIES=t({Aacute:`Á`,aacute:`á`,Abreve:`Ă`,abreve:`ă`,ac:`∾`,acd:`∿`,acE:`∾̳`,Acirc:`Â`,acirc:`â`,acute:`´`,Acy:`А`,acy:`а`,AElig:`Æ`,aelig:`æ`,af:`⁡`,Afr:`𝔄`,afr:`𝔞`,Agrave:`À`,agrave:`à`,alefsym:`ℵ`,aleph:`ℵ`,Alpha:`Α`,alpha:`α`,Amacr:`Ā`,amacr:`ā`,amalg:`⨿`,AMP:`&`,amp:`&`,And:`⩓`,and:`∧`,andand:`⩕`,andd:`⩜`,andslope:`⩘`,andv:`⩚`,ang:`∠`,ange:`⦤`,angle:`∠`,angmsd:`∡`,angmsdaa:`⦨`,angmsdab:`⦩`,angmsdac:`⦪`,angmsdad:`⦫`,angmsdae:`⦬`,angmsdaf:`⦭`,angmsdag:`⦮`,angmsdah:`⦯`,angrt:`∟`,angrtvb:`⊾`,angrtvbd:`⦝`,angsph:`∢`,angst:`Å`,angzarr:`⍼`,Aogon:`Ą`,aogon:`ą`,Aopf:`𝔸`,aopf:`𝕒`,ap:`≈`,apacir:`⩯`,apE:`⩰`,ape:`≊`,apid:`≋`,apos:`'`,ApplyFunction:`⁡`,approx:`≈`,approxeq:`≊`,Aring:`Å`,aring:`å`,Ascr:`𝒜`,ascr:`𝒶`,Assign:`≔`,ast:`*`,asymp:`≈`,asympeq:`≍`,Atilde:`Ã`,atilde:`ã`,Auml:`Ä`,auml:`ä`,awconint:`∳`,awint:`⨑`,backcong:`≌`,backepsilon:`϶`,backprime:`‵`,backsim:`∽`,backsimeq:`⋍`,Backslash:`∖`,Barv:`⫧`,barvee:`⊽`,Barwed:`⌆`,barwed:`⌅`,barwedge:`⌅`,bbrk:`⎵`,bbrktbrk:`⎶`,bcong:`≌`,Bcy:`Б`,bcy:`б`,bdquo:`„`,becaus:`∵`,Because:`∵`,because:`∵`,bemptyv:`⦰`,bepsi:`϶`,bernou:`ℬ`,Bernoullis:`ℬ`,Beta:`Β`,beta:`β`,beth:`ℶ`,between:`≬`,Bfr:`𝔅`,bfr:`𝔟`,bigcap:`⋂`,bigcirc:`◯`,bigcup:`⋃`,bigodot:`⨀`,bigoplus:`⨁`,bigotimes:`⨂`,bigsqcup:`⨆`,bigstar:`★`,bigtriangledown:`▽`,bigtriangleup:`△`,biguplus:`⨄`,bigvee:`⋁`,bigwedge:`⋀`,bkarow:`⤍`,blacklozenge:`⧫`,blacksquare:`▪`,blacktriangle:`▴`,blacktriangledown:`▾`,blacktriangleleft:`◂`,blacktriangleright:`▸`,blank:`␣`,blk12:`▒`,blk14:`░`,blk34:`▓`,block:`█`,bne:`=⃥`,bnequiv:`≡⃥`,bNot:`⫭`,bnot:`⌐`,Bopf:`𝔹`,bopf:`𝕓`,bot:`⊥`,bottom:`⊥`,bowtie:`⋈`,boxbox:`⧉`,boxDL:`╗`,boxDl:`╖`,boxdL:`╕`,boxdl:`┐`,boxDR:`╔`,boxDr:`╓`,boxdR:`╒`,boxdr:`┌`,boxH:`═`,boxh:`─`,boxHD:`╦`,boxHd:`╤`,boxhD:`╥`,boxhd:`┬`,boxHU:`╩`,boxHu:`╧`,boxhU:`╨`,boxhu:`┴`,boxminus:`⊟`,boxplus:`⊞`,boxtimes:`⊠`,boxUL:`╝`,boxUl:`╜`,boxuL:`╛`,boxul:`┘`,boxUR:`╚`,boxUr:`╙`,boxuR:`╘`,boxur:`└`,boxV:`║`,boxv:`│`,boxVH:`╬`,boxVh:`╫`,boxvH:`╪`,boxvh:`┼`,boxVL:`╣`,boxVl:`╢`,boxvL:`╡`,boxvl:`┤`,boxVR:`╠`,boxVr:`╟`,boxvR:`╞`,boxvr:`├`,bprime:`‵`,Breve:`˘`,breve:`˘`,brvbar:`¦`,Bscr:`ℬ`,bscr:`𝒷`,bsemi:`⁏`,bsim:`∽`,bsime:`⋍`,bsol:`\\`,bsolb:`⧅`,bsolhsub:`⟈`,bull:`•`,bullet:`•`,bump:`≎`,bumpE:`⪮`,bumpe:`≏`,Bumpeq:`≎`,bumpeq:`≏`,Cacute:`Ć`,cacute:`ć`,Cap:`⋒`,cap:`∩`,capand:`⩄`,capbrcup:`⩉`,capcap:`⩋`,capcup:`⩇`,capdot:`⩀`,CapitalDifferentialD:`ⅅ`,caps:`∩︀`,caret:`⁁`,caron:`ˇ`,Cayleys:`ℭ`,ccaps:`⩍`,Ccaron:`Č`,ccaron:`č`,Ccedil:`Ç`,ccedil:`ç`,Ccirc:`Ĉ`,ccirc:`ĉ`,Cconint:`∰`,ccups:`⩌`,ccupssm:`⩐`,Cdot:`Ċ`,cdot:`ċ`,cedil:`¸`,Cedilla:`¸`,cemptyv:`⦲`,cent:`¢`,CenterDot:`·`,centerdot:`·`,Cfr:`ℭ`,cfr:`𝔠`,CHcy:`Ч`,chcy:`ч`,check:`✓`,checkmark:`✓`,Chi:`Χ`,chi:`χ`,cir:`○`,circ:`ˆ`,circeq:`≗`,circlearrowleft:`↺`,circlearrowright:`↻`,circledast:`⊛`,circledcirc:`⊚`,circleddash:`⊝`,CircleDot:`⊙`,circledR:`®`,circledS:`Ⓢ`,CircleMinus:`⊖`,CirclePlus:`⊕`,CircleTimes:`⊗`,cirE:`⧃`,cire:`≗`,cirfnint:`⨐`,cirmid:`⫯`,cirscir:`⧂`,ClockwiseContourIntegral:`∲`,CloseCurlyDoubleQuote:`”`,CloseCurlyQuote:`’`,clubs:`♣`,clubsuit:`♣`,Colon:`∷`,colon:`:`,Colone:`⩴`,colone:`≔`,coloneq:`≔`,comma:`,`,commat:`@`,comp:`∁`,compfn:`∘`,complement:`∁`,complexes:`ℂ`,cong:`≅`,congdot:`⩭`,Congruent:`≡`,Conint:`∯`,conint:`∮`,ContourIntegral:`∮`,Copf:`ℂ`,copf:`𝕔`,coprod:`∐`,Coproduct:`∐`,COPY:`©`,copy:`©`,copysr:`℗`,CounterClockwiseContourIntegral:`∳`,crarr:`↵`,Cross:`⨯`,cross:`✗`,Cscr:`𝒞`,cscr:`𝒸`,csub:`⫏`,csube:`⫑`,csup:`⫐`,csupe:`⫒`,ctdot:`⋯`,cudarrl:`⤸`,cudarrr:`⤵`,cuepr:`⋞`,cuesc:`⋟`,cularr:`↶`,cularrp:`⤽`,Cup:`⋓`,cup:`∪`,cupbrcap:`⩈`,CupCap:`≍`,cupcap:`⩆`,cupcup:`⩊`,cupdot:`⊍`,cupor:`⩅`,cups:`∪︀`,curarr:`↷`,curarrm:`⤼`,curlyeqprec:`⋞`,curlyeqsucc:`⋟`,curlyvee:`⋎`,curlywedge:`⋏`,curren:`¤`,curvearrowleft:`↶`,curvearrowright:`↷`,cuvee:`⋎`,cuwed:`⋏`,cwconint:`∲`,cwint:`∱`,cylcty:`⌭`,Dagger:`‡`,dagger:`†`,daleth:`ℸ`,Darr:`↡`,dArr:`⇓`,darr:`↓`,dash:`‐`,Dashv:`⫤`,dashv:`⊣`,dbkarow:`⤏`,dblac:`˝`,Dcaron:`Ď`,dcaron:`ď`,Dcy:`Д`,dcy:`д`,DD:`ⅅ`,dd:`ⅆ`,ddagger:`‡`,ddarr:`⇊`,DDotrahd:`⤑`,ddotseq:`⩷`,deg:`°`,Del:`∇`,Delta:`Δ`,delta:`δ`,demptyv:`⦱`,dfisht:`⥿`,Dfr:`𝔇`,dfr:`𝔡`,dHar:`⥥`,dharl:`⇃`,dharr:`⇂`,DiacriticalAcute:`´`,DiacriticalDot:`˙`,DiacriticalDoubleAcute:`˝`,DiacriticalGrave:"`",DiacriticalTilde:`˜`,diam:`⋄`,Diamond:`⋄`,diamond:`⋄`,diamondsuit:`♦`,diams:`♦`,die:`¨`,DifferentialD:`ⅆ`,digamma:`ϝ`,disin:`⋲`,div:`÷`,divide:`÷`,divideontimes:`⋇`,divonx:`⋇`,DJcy:`Ђ`,djcy:`ђ`,dlcorn:`⌞`,dlcrop:`⌍`,dollar:`$`,Dopf:`𝔻`,dopf:`𝕕`,Dot:`¨`,dot:`˙`,DotDot:`⃜`,doteq:`≐`,doteqdot:`≑`,DotEqual:`≐`,dotminus:`∸`,dotplus:`∔`,dotsquare:`⊡`,doublebarwedge:`⌆`,DoubleContourIntegral:`∯`,DoubleDot:`¨`,DoubleDownArrow:`⇓`,DoubleLeftArrow:`⇐`,DoubleLeftRightArrow:`⇔`,DoubleLeftTee:`⫤`,DoubleLongLeftArrow:`⟸`,DoubleLongLeftRightArrow:`⟺`,DoubleLongRightArrow:`⟹`,DoubleRightArrow:`⇒`,DoubleRightTee:`⊨`,DoubleUpArrow:`⇑`,DoubleUpDownArrow:`⇕`,DoubleVerticalBar:`∥`,DownArrow:`↓`,Downarrow:`⇓`,downarrow:`↓`,DownArrowBar:`⤓`,DownArrowUpArrow:`⇵`,DownBreve:`̑`,downdownarrows:`⇊`,downharpoonleft:`⇃`,downharpoonright:`⇂`,DownLeftRightVector:`⥐`,DownLeftTeeVector:`⥞`,DownLeftVector:`↽`,DownLeftVectorBar:`⥖`,DownRightTeeVector:`⥟`,DownRightVector:`⇁`,DownRightVectorBar:`⥗`,DownTee:`⊤`,DownTeeArrow:`↧`,drbkarow:`⤐`,drcorn:`⌟`,drcrop:`⌌`,Dscr:`𝒟`,dscr:`𝒹`,DScy:`Ѕ`,dscy:`ѕ`,dsol:`⧶`,Dstrok:`Đ`,dstrok:`đ`,dtdot:`⋱`,dtri:`▿`,dtrif:`▾`,duarr:`⇵`,duhar:`⥯`,dwangle:`⦦`,DZcy:`Џ`,dzcy:`џ`,dzigrarr:`⟿`,Eacute:`É`,eacute:`é`,easter:`⩮`,Ecaron:`Ě`,ecaron:`ě`,ecir:`≖`,Ecirc:`Ê`,ecirc:`ê`,ecolon:`≕`,Ecy:`Э`,ecy:`э`,eDDot:`⩷`,Edot:`Ė`,eDot:`≑`,edot:`ė`,ee:`ⅇ`,efDot:`≒`,Efr:`𝔈`,efr:`𝔢`,eg:`⪚`,Egrave:`È`,egrave:`è`,egs:`⪖`,egsdot:`⪘`,el:`⪙`,Element:`∈`,elinters:`⏧`,ell:`ℓ`,els:`⪕`,elsdot:`⪗`,Emacr:`Ē`,emacr:`ē`,empty:`∅`,emptyset:`∅`,EmptySmallSquare:`◻`,emptyv:`∅`,EmptyVerySmallSquare:`▫`,emsp:` `,emsp13:` `,emsp14:` `,ENG:`Ŋ`,eng:`ŋ`,ensp:` `,Eogon:`Ę`,eogon:`ę`,Eopf:`𝔼`,eopf:`𝕖`,epar:`⋕`,eparsl:`⧣`,eplus:`⩱`,epsi:`ε`,Epsilon:`Ε`,epsilon:`ε`,epsiv:`ϵ`,eqcirc:`≖`,eqcolon:`≕`,eqsim:`≂`,eqslantgtr:`⪖`,eqslantless:`⪕`,Equal:`⩵`,equals:`=`,EqualTilde:`≂`,equest:`≟`,Equilibrium:`⇌`,equiv:`≡`,equivDD:`⩸`,eqvparsl:`⧥`,erarr:`⥱`,erDot:`≓`,Escr:`ℰ`,escr:`ℯ`,esdot:`≐`,Esim:`⩳`,esim:`≂`,Eta:`Η`,eta:`η`,ETH:`Ð`,eth:`ð`,Euml:`Ë`,euml:`ë`,euro:`€`,excl:`!`,exist:`∃`,Exists:`∃`,expectation:`ℰ`,ExponentialE:`ⅇ`,exponentiale:`ⅇ`,fallingdotseq:`≒`,Fcy:`Ф`,fcy:`ф`,female:`♀`,ffilig:`ffi`,fflig:`ff`,ffllig:`ffl`,Ffr:`𝔉`,ffr:`𝔣`,filig:`fi`,FilledSmallSquare:`◼`,FilledVerySmallSquare:`▪`,fjlig:`fj`,flat:`♭`,fllig:`fl`,fltns:`▱`,fnof:`ƒ`,Fopf:`𝔽`,fopf:`𝕗`,ForAll:`∀`,forall:`∀`,fork:`⋔`,forkv:`⫙`,Fouriertrf:`ℱ`,fpartint:`⨍`,frac12:`½`,frac13:`⅓`,frac14:`¼`,frac15:`⅕`,frac16:`⅙`,frac18:`⅛`,frac23:`⅔`,frac25:`⅖`,frac34:`¾`,frac35:`⅗`,frac38:`⅜`,frac45:`⅘`,frac56:`⅚`,frac58:`⅝`,frac78:`⅞`,frasl:`⁄`,frown:`⌢`,Fscr:`ℱ`,fscr:`𝒻`,gacute:`ǵ`,Gamma:`Γ`,gamma:`γ`,Gammad:`Ϝ`,gammad:`ϝ`,gap:`⪆`,Gbreve:`Ğ`,gbreve:`ğ`,Gcedil:`Ģ`,Gcirc:`Ĝ`,gcirc:`ĝ`,Gcy:`Г`,gcy:`г`,Gdot:`Ġ`,gdot:`ġ`,gE:`≧`,ge:`≥`,gEl:`⪌`,gel:`⋛`,geq:`≥`,geqq:`≧`,geqslant:`⩾`,ges:`⩾`,gescc:`⪩`,gesdot:`⪀`,gesdoto:`⪂`,gesdotol:`⪄`,gesl:`⋛︀`,gesles:`⪔`,Gfr:`𝔊`,gfr:`𝔤`,Gg:`⋙`,gg:`≫`,ggg:`⋙`,gimel:`ℷ`,GJcy:`Ѓ`,gjcy:`ѓ`,gl:`≷`,gla:`⪥`,glE:`⪒`,glj:`⪤`,gnap:`⪊`,gnapprox:`⪊`,gnE:`≩`,gne:`⪈`,gneq:`⪈`,gneqq:`≩`,gnsim:`⋧`,Gopf:`𝔾`,gopf:`𝕘`,grave:"`",GreaterEqual:`≥`,GreaterEqualLess:`⋛`,GreaterFullEqual:`≧`,GreaterGreater:`⪢`,GreaterLess:`≷`,GreaterSlantEqual:`⩾`,GreaterTilde:`≳`,Gscr:`𝒢`,gscr:`ℊ`,gsim:`≳`,gsime:`⪎`,gsiml:`⪐`,Gt:`≫`,GT:`>`,gt:`>`,gtcc:`⪧`,gtcir:`⩺`,gtdot:`⋗`,gtlPar:`⦕`,gtquest:`⩼`,gtrapprox:`⪆`,gtrarr:`⥸`,gtrdot:`⋗`,gtreqless:`⋛`,gtreqqless:`⪌`,gtrless:`≷`,gtrsim:`≳`,gvertneqq:`≩︀`,gvnE:`≩︀`,Hacek:`ˇ`,hairsp:` `,half:`½`,hamilt:`ℋ`,HARDcy:`Ъ`,hardcy:`ъ`,hArr:`⇔`,harr:`↔`,harrcir:`⥈`,harrw:`↭`,Hat:`^`,hbar:`ℏ`,Hcirc:`Ĥ`,hcirc:`ĥ`,hearts:`♥`,heartsuit:`♥`,hellip:`…`,hercon:`⊹`,Hfr:`ℌ`,hfr:`𝔥`,HilbertSpace:`ℋ`,hksearow:`⤥`,hkswarow:`⤦`,hoarr:`⇿`,homtht:`∻`,hookleftarrow:`↩`,hookrightarrow:`↪`,Hopf:`ℍ`,hopf:`𝕙`,horbar:`―`,HorizontalLine:`─`,Hscr:`ℋ`,hscr:`𝒽`,hslash:`ℏ`,Hstrok:`Ħ`,hstrok:`ħ`,HumpDownHump:`≎`,HumpEqual:`≏`,hybull:`⁃`,hyphen:`‐`,Iacute:`Í`,iacute:`í`,ic:`⁣`,Icirc:`Î`,icirc:`î`,Icy:`И`,icy:`и`,Idot:`İ`,IEcy:`Е`,iecy:`е`,iexcl:`¡`,iff:`⇔`,Ifr:`ℑ`,ifr:`𝔦`,Igrave:`Ì`,igrave:`ì`,ii:`ⅈ`,iiiint:`⨌`,iiint:`∭`,iinfin:`⧜`,iiota:`℩`,IJlig:`IJ`,ijlig:`ij`,Im:`ℑ`,Imacr:`Ī`,imacr:`ī`,image:`ℑ`,ImaginaryI:`ⅈ`,imagline:`ℐ`,imagpart:`ℑ`,imath:`ı`,imof:`⊷`,imped:`Ƶ`,Implies:`⇒`,in:`∈`,incare:`℅`,infin:`∞`,infintie:`⧝`,inodot:`ı`,Int:`∬`,int:`∫`,intcal:`⊺`,integers:`ℤ`,Integral:`∫`,intercal:`⊺`,Intersection:`⋂`,intlarhk:`⨗`,intprod:`⨼`,InvisibleComma:`⁣`,InvisibleTimes:`⁢`,IOcy:`Ё`,iocy:`ё`,Iogon:`Į`,iogon:`į`,Iopf:`𝕀`,iopf:`𝕚`,Iota:`Ι`,iota:`ι`,iprod:`⨼`,iquest:`¿`,Iscr:`ℐ`,iscr:`𝒾`,isin:`∈`,isindot:`⋵`,isinE:`⋹`,isins:`⋴`,isinsv:`⋳`,isinv:`∈`,it:`⁢`,Itilde:`Ĩ`,itilde:`ĩ`,Iukcy:`І`,iukcy:`і`,Iuml:`Ï`,iuml:`ï`,Jcirc:`Ĵ`,jcirc:`ĵ`,Jcy:`Й`,jcy:`й`,Jfr:`𝔍`,jfr:`𝔧`,jmath:`ȷ`,Jopf:`𝕁`,jopf:`𝕛`,Jscr:`𝒥`,jscr:`𝒿`,Jsercy:`Ј`,jsercy:`ј`,Jukcy:`Є`,jukcy:`є`,Kappa:`Κ`,kappa:`κ`,kappav:`ϰ`,Kcedil:`Ķ`,kcedil:`ķ`,Kcy:`К`,kcy:`к`,Kfr:`𝔎`,kfr:`𝔨`,kgreen:`ĸ`,KHcy:`Х`,khcy:`х`,KJcy:`Ќ`,kjcy:`ќ`,Kopf:`𝕂`,kopf:`𝕜`,Kscr:`𝒦`,kscr:`𝓀`,lAarr:`⇚`,Lacute:`Ĺ`,lacute:`ĺ`,laemptyv:`⦴`,lagran:`ℒ`,Lambda:`Λ`,lambda:`λ`,Lang:`⟪`,lang:`⟨`,langd:`⦑`,langle:`⟨`,lap:`⪅`,Laplacetrf:`ℒ`,laquo:`«`,Larr:`↞`,lArr:`⇐`,larr:`←`,larrb:`⇤`,larrbfs:`⤟`,larrfs:`⤝`,larrhk:`↩`,larrlp:`↫`,larrpl:`⤹`,larrsim:`⥳`,larrtl:`↢`,lat:`⪫`,lAtail:`⤛`,latail:`⤙`,late:`⪭`,lates:`⪭︀`,lBarr:`⤎`,lbarr:`⤌`,lbbrk:`❲`,lbrace:`{`,lbrack:`[`,lbrke:`⦋`,lbrksld:`⦏`,lbrkslu:`⦍`,Lcaron:`Ľ`,lcaron:`ľ`,Lcedil:`Ļ`,lcedil:`ļ`,lceil:`⌈`,lcub:`{`,Lcy:`Л`,lcy:`л`,ldca:`⤶`,ldquo:`“`,ldquor:`„`,ldrdhar:`⥧`,ldrushar:`⥋`,ldsh:`↲`,lE:`≦`,le:`≤`,LeftAngleBracket:`⟨`,LeftArrow:`←`,Leftarrow:`⇐`,leftarrow:`←`,LeftArrowBar:`⇤`,LeftArrowRightArrow:`⇆`,leftarrowtail:`↢`,LeftCeiling:`⌈`,LeftDoubleBracket:`⟦`,LeftDownTeeVector:`⥡`,LeftDownVector:`⇃`,LeftDownVectorBar:`⥙`,LeftFloor:`⌊`,leftharpoondown:`↽`,leftharpoonup:`↼`,leftleftarrows:`⇇`,LeftRightArrow:`↔`,Leftrightarrow:`⇔`,leftrightarrow:`↔`,leftrightarrows:`⇆`,leftrightharpoons:`⇋`,leftrightsquigarrow:`↭`,LeftRightVector:`⥎`,LeftTee:`⊣`,LeftTeeArrow:`↤`,LeftTeeVector:`⥚`,leftthreetimes:`⋋`,LeftTriangle:`⊲`,LeftTriangleBar:`⧏`,LeftTriangleEqual:`⊴`,LeftUpDownVector:`⥑`,LeftUpTeeVector:`⥠`,LeftUpVector:`↿`,LeftUpVectorBar:`⥘`,LeftVector:`↼`,LeftVectorBar:`⥒`,lEg:`⪋`,leg:`⋚`,leq:`≤`,leqq:`≦`,leqslant:`⩽`,les:`⩽`,lescc:`⪨`,lesdot:`⩿`,lesdoto:`⪁`,lesdotor:`⪃`,lesg:`⋚︀`,lesges:`⪓`,lessapprox:`⪅`,lessdot:`⋖`,lesseqgtr:`⋚`,lesseqqgtr:`⪋`,LessEqualGreater:`⋚`,LessFullEqual:`≦`,LessGreater:`≶`,lessgtr:`≶`,LessLess:`⪡`,lesssim:`≲`,LessSlantEqual:`⩽`,LessTilde:`≲`,lfisht:`⥼`,lfloor:`⌊`,Lfr:`𝔏`,lfr:`𝔩`,lg:`≶`,lgE:`⪑`,lHar:`⥢`,lhard:`↽`,lharu:`↼`,lharul:`⥪`,lhblk:`▄`,LJcy:`Љ`,ljcy:`љ`,Ll:`⋘`,ll:`≪`,llarr:`⇇`,llcorner:`⌞`,Lleftarrow:`⇚`,llhard:`⥫`,lltri:`◺`,Lmidot:`Ŀ`,lmidot:`ŀ`,lmoust:`⎰`,lmoustache:`⎰`,lnap:`⪉`,lnapprox:`⪉`,lnE:`≨`,lne:`⪇`,lneq:`⪇`,lneqq:`≨`,lnsim:`⋦`,loang:`⟬`,loarr:`⇽`,lobrk:`⟦`,LongLeftArrow:`⟵`,Longleftarrow:`⟸`,longleftarrow:`⟵`,LongLeftRightArrow:`⟷`,Longleftrightarrow:`⟺`,longleftrightarrow:`⟷`,longmapsto:`⟼`,LongRightArrow:`⟶`,Longrightarrow:`⟹`,longrightarrow:`⟶`,looparrowleft:`↫`,looparrowright:`↬`,lopar:`⦅`,Lopf:`𝕃`,lopf:`𝕝`,loplus:`⨭`,lotimes:`⨴`,lowast:`∗`,lowbar:`_`,LowerLeftArrow:`↙`,LowerRightArrow:`↘`,loz:`◊`,lozenge:`◊`,lozf:`⧫`,lpar:`(`,lparlt:`⦓`,lrarr:`⇆`,lrcorner:`⌟`,lrhar:`⇋`,lrhard:`⥭`,lrm:`‎`,lrtri:`⊿`,lsaquo:`‹`,Lscr:`ℒ`,lscr:`𝓁`,Lsh:`↰`,lsh:`↰`,lsim:`≲`,lsime:`⪍`,lsimg:`⪏`,lsqb:`[`,lsquo:`‘`,lsquor:`‚`,Lstrok:`Ł`,lstrok:`ł`,Lt:`≪`,LT:`<`,lt:`<`,ltcc:`⪦`,ltcir:`⩹`,ltdot:`⋖`,lthree:`⋋`,ltimes:`⋉`,ltlarr:`⥶`,ltquest:`⩻`,ltri:`◃`,ltrie:`⊴`,ltrif:`◂`,ltrPar:`⦖`,lurdshar:`⥊`,luruhar:`⥦`,lvertneqq:`≨︀`,lvnE:`≨︀`,macr:`¯`,male:`♂`,malt:`✠`,maltese:`✠`,Map:`⤅`,map:`↦`,mapsto:`↦`,mapstodown:`↧`,mapstoleft:`↤`,mapstoup:`↥`,marker:`▮`,mcomma:`⨩`,Mcy:`М`,mcy:`м`,mdash:`—`,mDDot:`∺`,measuredangle:`∡`,MediumSpace:` `,Mellintrf:`ℳ`,Mfr:`𝔐`,mfr:`𝔪`,mho:`℧`,micro:`µ`,mid:`∣`,midast:`*`,midcir:`⫰`,middot:`·`,minus:`−`,minusb:`⊟`,minusd:`∸`,minusdu:`⨪`,MinusPlus:`∓`,mlcp:`⫛`,mldr:`…`,mnplus:`∓`,models:`⊧`,Mopf:`𝕄`,mopf:`𝕞`,mp:`∓`,Mscr:`ℳ`,mscr:`𝓂`,mstpos:`∾`,Mu:`Μ`,mu:`μ`,multimap:`⊸`,mumap:`⊸`,nabla:`∇`,Nacute:`Ń`,nacute:`ń`,nang:`∠⃒`,nap:`≉`,napE:`⩰̸`,napid:`≋̸`,napos:`ʼn`,napprox:`≉`,natur:`♮`,natural:`♮`,naturals:`ℕ`,nbsp:`\xA0`,nbump:`≎̸`,nbumpe:`≏̸`,ncap:`⩃`,Ncaron:`Ň`,ncaron:`ň`,Ncedil:`Ņ`,ncedil:`ņ`,ncong:`≇`,ncongdot:`⩭̸`,ncup:`⩂`,Ncy:`Н`,ncy:`н`,ndash:`–`,ne:`≠`,nearhk:`⤤`,neArr:`⇗`,nearr:`↗`,nearrow:`↗`,nedot:`≐̸`,NegativeMediumSpace:`​`,NegativeThickSpace:`​`,NegativeThinSpace:`​`,NegativeVeryThinSpace:`​`,nequiv:`≢`,nesear:`⤨`,nesim:`≂̸`,NestedGreaterGreater:`≫`,NestedLessLess:`≪`,NewLine:` `,nexist:`∄`,nexists:`∄`,Nfr:`𝔑`,nfr:`𝔫`,ngE:`≧̸`,nge:`≱`,ngeq:`≱`,ngeqq:`≧̸`,ngeqslant:`⩾̸`,nges:`⩾̸`,nGg:`⋙̸`,ngsim:`≵`,nGt:`≫⃒`,ngt:`≯`,ngtr:`≯`,nGtv:`≫̸`,nhArr:`⇎`,nharr:`↮`,nhpar:`⫲`,ni:`∋`,nis:`⋼`,nisd:`⋺`,niv:`∋`,NJcy:`Њ`,njcy:`њ`,nlArr:`⇍`,nlarr:`↚`,nldr:`‥`,nlE:`≦̸`,nle:`≰`,nLeftarrow:`⇍`,nleftarrow:`↚`,nLeftrightarrow:`⇎`,nleftrightarrow:`↮`,nleq:`≰`,nleqq:`≦̸`,nleqslant:`⩽̸`,nles:`⩽̸`,nless:`≮`,nLl:`⋘̸`,nlsim:`≴`,nLt:`≪⃒`,nlt:`≮`,nltri:`⋪`,nltrie:`⋬`,nLtv:`≪̸`,nmid:`∤`,NoBreak:`⁠`,NonBreakingSpace:`\xA0`,Nopf:`ℕ`,nopf:`𝕟`,Not:`⫬`,not:`¬`,NotCongruent:`≢`,NotCupCap:`≭`,NotDoubleVerticalBar:`∦`,NotElement:`∉`,NotEqual:`≠`,NotEqualTilde:`≂̸`,NotExists:`∄`,NotGreater:`≯`,NotGreaterEqual:`≱`,NotGreaterFullEqual:`≧̸`,NotGreaterGreater:`≫̸`,NotGreaterLess:`≹`,NotGreaterSlantEqual:`⩾̸`,NotGreaterTilde:`≵`,NotHumpDownHump:`≎̸`,NotHumpEqual:`≏̸`,notin:`∉`,notindot:`⋵̸`,notinE:`⋹̸`,notinva:`∉`,notinvb:`⋷`,notinvc:`⋶`,NotLeftTriangle:`⋪`,NotLeftTriangleBar:`⧏̸`,NotLeftTriangleEqual:`⋬`,NotLess:`≮`,NotLessEqual:`≰`,NotLessGreater:`≸`,NotLessLess:`≪̸`,NotLessSlantEqual:`⩽̸`,NotLessTilde:`≴`,NotNestedGreaterGreater:`⪢̸`,NotNestedLessLess:`⪡̸`,notni:`∌`,notniva:`∌`,notnivb:`⋾`,notnivc:`⋽`,NotPrecedes:`⊀`,NotPrecedesEqual:`⪯̸`,NotPrecedesSlantEqual:`⋠`,NotReverseElement:`∌`,NotRightTriangle:`⋫`,NotRightTriangleBar:`⧐̸`,NotRightTriangleEqual:`⋭`,NotSquareSubset:`⊏̸`,NotSquareSubsetEqual:`⋢`,NotSquareSuperset:`⊐̸`,NotSquareSupersetEqual:`⋣`,NotSubset:`⊂⃒`,NotSubsetEqual:`⊈`,NotSucceeds:`⊁`,NotSucceedsEqual:`⪰̸`,NotSucceedsSlantEqual:`⋡`,NotSucceedsTilde:`≿̸`,NotSuperset:`⊃⃒`,NotSupersetEqual:`⊉`,NotTilde:`≁`,NotTildeEqual:`≄`,NotTildeFullEqual:`≇`,NotTildeTilde:`≉`,NotVerticalBar:`∤`,npar:`∦`,nparallel:`∦`,nparsl:`⫽⃥`,npart:`∂̸`,npolint:`⨔`,npr:`⊀`,nprcue:`⋠`,npre:`⪯̸`,nprec:`⊀`,npreceq:`⪯̸`,nrArr:`⇏`,nrarr:`↛`,nrarrc:`⤳̸`,nrarrw:`↝̸`,nRightarrow:`⇏`,nrightarrow:`↛`,nrtri:`⋫`,nrtrie:`⋭`,nsc:`⊁`,nsccue:`⋡`,nsce:`⪰̸`,Nscr:`𝒩`,nscr:`𝓃`,nshortmid:`∤`,nshortparallel:`∦`,nsim:`≁`,nsime:`≄`,nsimeq:`≄`,nsmid:`∤`,nspar:`∦`,nsqsube:`⋢`,nsqsupe:`⋣`,nsub:`⊄`,nsubE:`⫅̸`,nsube:`⊈`,nsubset:`⊂⃒`,nsubseteq:`⊈`,nsubseteqq:`⫅̸`,nsucc:`⊁`,nsucceq:`⪰̸`,nsup:`⊅`,nsupE:`⫆̸`,nsupe:`⊉`,nsupset:`⊃⃒`,nsupseteq:`⊉`,nsupseteqq:`⫆̸`,ntgl:`≹`,Ntilde:`Ñ`,ntilde:`ñ`,ntlg:`≸`,ntriangleleft:`⋪`,ntrianglelefteq:`⋬`,ntriangleright:`⋫`,ntrianglerighteq:`⋭`,Nu:`Ν`,nu:`ν`,num:`#`,numero:`№`,numsp:` `,nvap:`≍⃒`,nVDash:`⊯`,nVdash:`⊮`,nvDash:`⊭`,nvdash:`⊬`,nvge:`≥⃒`,nvgt:`>⃒`,nvHarr:`⤄`,nvinfin:`⧞`,nvlArr:`⤂`,nvle:`≤⃒`,nvlt:`<⃒`,nvltrie:`⊴⃒`,nvrArr:`⤃`,nvrtrie:`⊵⃒`,nvsim:`∼⃒`,nwarhk:`⤣`,nwArr:`⇖`,nwarr:`↖`,nwarrow:`↖`,nwnear:`⤧`,Oacute:`Ó`,oacute:`ó`,oast:`⊛`,ocir:`⊚`,Ocirc:`Ô`,ocirc:`ô`,Ocy:`О`,ocy:`о`,odash:`⊝`,Odblac:`Ő`,odblac:`ő`,odiv:`⨸`,odot:`⊙`,odsold:`⦼`,OElig:`Œ`,oelig:`œ`,ofcir:`⦿`,Ofr:`𝔒`,ofr:`𝔬`,ogon:`˛`,Ograve:`Ò`,ograve:`ò`,ogt:`⧁`,ohbar:`⦵`,ohm:`Ω`,oint:`∮`,olarr:`↺`,olcir:`⦾`,olcross:`⦻`,oline:`‾`,olt:`⧀`,Omacr:`Ō`,omacr:`ō`,Omega:`Ω`,omega:`ω`,Omicron:`Ο`,omicron:`ο`,omid:`⦶`,ominus:`⊖`,Oopf:`𝕆`,oopf:`𝕠`,opar:`⦷`,OpenCurlyDoubleQuote:`“`,OpenCurlyQuote:`‘`,operp:`⦹`,oplus:`⊕`,Or:`⩔`,or:`∨`,orarr:`↻`,ord:`⩝`,order:`ℴ`,orderof:`ℴ`,ordf:`ª`,ordm:`º`,origof:`⊶`,oror:`⩖`,orslope:`⩗`,orv:`⩛`,oS:`Ⓢ`,Oscr:`𝒪`,oscr:`ℴ`,Oslash:`Ø`,oslash:`ø`,osol:`⊘`,Otilde:`Õ`,otilde:`õ`,Otimes:`⨷`,otimes:`⊗`,otimesas:`⨶`,Ouml:`Ö`,ouml:`ö`,ovbar:`⌽`,OverBar:`‾`,OverBrace:`⏞`,OverBracket:`⎴`,OverParenthesis:`⏜`,par:`∥`,para:`¶`,parallel:`∥`,parsim:`⫳`,parsl:`⫽`,part:`∂`,PartialD:`∂`,Pcy:`П`,pcy:`п`,percnt:`%`,period:`.`,permil:`‰`,perp:`⊥`,pertenk:`‱`,Pfr:`𝔓`,pfr:`𝔭`,Phi:`Φ`,phi:`φ`,phiv:`ϕ`,phmmat:`ℳ`,phone:`☎`,Pi:`Π`,pi:`π`,pitchfork:`⋔`,piv:`ϖ`,planck:`ℏ`,planckh:`ℎ`,plankv:`ℏ`,plus:`+`,plusacir:`⨣`,plusb:`⊞`,pluscir:`⨢`,plusdo:`∔`,plusdu:`⨥`,pluse:`⩲`,PlusMinus:`±`,plusmn:`±`,plussim:`⨦`,plustwo:`⨧`,pm:`±`,Poincareplane:`ℌ`,pointint:`⨕`,Popf:`ℙ`,popf:`𝕡`,pound:`£`,Pr:`⪻`,pr:`≺`,prap:`⪷`,prcue:`≼`,prE:`⪳`,pre:`⪯`,prec:`≺`,precapprox:`⪷`,preccurlyeq:`≼`,Precedes:`≺`,PrecedesEqual:`⪯`,PrecedesSlantEqual:`≼`,PrecedesTilde:`≾`,preceq:`⪯`,precnapprox:`⪹`,precneqq:`⪵`,precnsim:`⋨`,precsim:`≾`,Prime:`″`,prime:`′`,primes:`ℙ`,prnap:`⪹`,prnE:`⪵`,prnsim:`⋨`,prod:`∏`,Product:`∏`,profalar:`⌮`,profline:`⌒`,profsurf:`⌓`,prop:`∝`,Proportion:`∷`,Proportional:`∝`,propto:`∝`,prsim:`≾`,prurel:`⊰`,Pscr:`𝒫`,pscr:`𝓅`,Psi:`Ψ`,psi:`ψ`,puncsp:` `,Qfr:`𝔔`,qfr:`𝔮`,qint:`⨌`,Qopf:`ℚ`,qopf:`𝕢`,qprime:`⁗`,Qscr:`𝒬`,qscr:`𝓆`,quaternions:`ℍ`,quatint:`⨖`,quest:`?`,questeq:`≟`,QUOT:`"`,quot:`"`,rAarr:`⇛`,race:`∽̱`,Racute:`Ŕ`,racute:`ŕ`,radic:`√`,raemptyv:`⦳`,Rang:`⟫`,rang:`⟩`,rangd:`⦒`,range:`⦥`,rangle:`⟩`,raquo:`»`,Rarr:`↠`,rArr:`⇒`,rarr:`→`,rarrap:`⥵`,rarrb:`⇥`,rarrbfs:`⤠`,rarrc:`⤳`,rarrfs:`⤞`,rarrhk:`↪`,rarrlp:`↬`,rarrpl:`⥅`,rarrsim:`⥴`,Rarrtl:`⤖`,rarrtl:`↣`,rarrw:`↝`,rAtail:`⤜`,ratail:`⤚`,ratio:`∶`,rationals:`ℚ`,RBarr:`⤐`,rBarr:`⤏`,rbarr:`⤍`,rbbrk:`❳`,rbrace:`}`,rbrack:`]`,rbrke:`⦌`,rbrksld:`⦎`,rbrkslu:`⦐`,Rcaron:`Ř`,rcaron:`ř`,Rcedil:`Ŗ`,rcedil:`ŗ`,rceil:`⌉`,rcub:`}`,Rcy:`Р`,rcy:`р`,rdca:`⤷`,rdldhar:`⥩`,rdquo:`”`,rdquor:`”`,rdsh:`↳`,Re:`ℜ`,real:`ℜ`,realine:`ℛ`,realpart:`ℜ`,reals:`ℝ`,rect:`▭`,REG:`®`,reg:`®`,ReverseElement:`∋`,ReverseEquilibrium:`⇋`,ReverseUpEquilibrium:`⥯`,rfisht:`⥽`,rfloor:`⌋`,Rfr:`ℜ`,rfr:`𝔯`,rHar:`⥤`,rhard:`⇁`,rharu:`⇀`,rharul:`⥬`,Rho:`Ρ`,rho:`ρ`,rhov:`ϱ`,RightAngleBracket:`⟩`,RightArrow:`→`,Rightarrow:`⇒`,rightarrow:`→`,RightArrowBar:`⇥`,RightArrowLeftArrow:`⇄`,rightarrowtail:`↣`,RightCeiling:`⌉`,RightDoubleBracket:`⟧`,RightDownTeeVector:`⥝`,RightDownVector:`⇂`,RightDownVectorBar:`⥕`,RightFloor:`⌋`,rightharpoondown:`⇁`,rightharpoonup:`⇀`,rightleftarrows:`⇄`,rightleftharpoons:`⇌`,rightrightarrows:`⇉`,rightsquigarrow:`↝`,RightTee:`⊢`,RightTeeArrow:`↦`,RightTeeVector:`⥛`,rightthreetimes:`⋌`,RightTriangle:`⊳`,RightTriangleBar:`⧐`,RightTriangleEqual:`⊵`,RightUpDownVector:`⥏`,RightUpTeeVector:`⥜`,RightUpVector:`↾`,RightUpVectorBar:`⥔`,RightVector:`⇀`,RightVectorBar:`⥓`,ring:`˚`,risingdotseq:`≓`,rlarr:`⇄`,rlhar:`⇌`,rlm:`‏`,rmoust:`⎱`,rmoustache:`⎱`,rnmid:`⫮`,roang:`⟭`,roarr:`⇾`,robrk:`⟧`,ropar:`⦆`,Ropf:`ℝ`,ropf:`𝕣`,roplus:`⨮`,rotimes:`⨵`,RoundImplies:`⥰`,rpar:`)`,rpargt:`⦔`,rppolint:`⨒`,rrarr:`⇉`,Rrightarrow:`⇛`,rsaquo:`›`,Rscr:`ℛ`,rscr:`𝓇`,Rsh:`↱`,rsh:`↱`,rsqb:`]`,rsquo:`’`,rsquor:`’`,rthree:`⋌`,rtimes:`⋊`,rtri:`▹`,rtrie:`⊵`,rtrif:`▸`,rtriltri:`⧎`,RuleDelayed:`⧴`,ruluhar:`⥨`,rx:`℞`,Sacute:`Ś`,sacute:`ś`,sbquo:`‚`,Sc:`⪼`,sc:`≻`,scap:`⪸`,Scaron:`Š`,scaron:`š`,sccue:`≽`,scE:`⪴`,sce:`⪰`,Scedil:`Ş`,scedil:`ş`,Scirc:`Ŝ`,scirc:`ŝ`,scnap:`⪺`,scnE:`⪶`,scnsim:`⋩`,scpolint:`⨓`,scsim:`≿`,Scy:`С`,scy:`с`,sdot:`⋅`,sdotb:`⊡`,sdote:`⩦`,searhk:`⤥`,seArr:`⇘`,searr:`↘`,searrow:`↘`,sect:`§`,semi:`;`,seswar:`⤩`,setminus:`∖`,setmn:`∖`,sext:`✶`,Sfr:`𝔖`,sfr:`𝔰`,sfrown:`⌢`,sharp:`♯`,SHCHcy:`Щ`,shchcy:`щ`,SHcy:`Ш`,shcy:`ш`,ShortDownArrow:`↓`,ShortLeftArrow:`←`,shortmid:`∣`,shortparallel:`∥`,ShortRightArrow:`→`,ShortUpArrow:`↑`,shy:`­`,Sigma:`Σ`,sigma:`σ`,sigmaf:`ς`,sigmav:`ς`,sim:`∼`,simdot:`⩪`,sime:`≃`,simeq:`≃`,simg:`⪞`,simgE:`⪠`,siml:`⪝`,simlE:`⪟`,simne:`≆`,simplus:`⨤`,simrarr:`⥲`,slarr:`←`,SmallCircle:`∘`,smallsetminus:`∖`,smashp:`⨳`,smeparsl:`⧤`,smid:`∣`,smile:`⌣`,smt:`⪪`,smte:`⪬`,smtes:`⪬︀`,SOFTcy:`Ь`,softcy:`ь`,sol:`/`,solb:`⧄`,solbar:`⌿`,Sopf:`𝕊`,sopf:`𝕤`,spades:`♠`,spadesuit:`♠`,spar:`∥`,sqcap:`⊓`,sqcaps:`⊓︀`,sqcup:`⊔`,sqcups:`⊔︀`,Sqrt:`√`,sqsub:`⊏`,sqsube:`⊑`,sqsubset:`⊏`,sqsubseteq:`⊑`,sqsup:`⊐`,sqsupe:`⊒`,sqsupset:`⊐`,sqsupseteq:`⊒`,squ:`□`,Square:`□`,square:`□`,SquareIntersection:`⊓`,SquareSubset:`⊏`,SquareSubsetEqual:`⊑`,SquareSuperset:`⊐`,SquareSupersetEqual:`⊒`,SquareUnion:`⊔`,squarf:`▪`,squf:`▪`,srarr:`→`,Sscr:`𝒮`,sscr:`𝓈`,ssetmn:`∖`,ssmile:`⌣`,sstarf:`⋆`,Star:`⋆`,star:`☆`,starf:`★`,straightepsilon:`ϵ`,straightphi:`ϕ`,strns:`¯`,Sub:`⋐`,sub:`⊂`,subdot:`⪽`,subE:`⫅`,sube:`⊆`,subedot:`⫃`,submult:`⫁`,subnE:`⫋`,subne:`⊊`,subplus:`⪿`,subrarr:`⥹`,Subset:`⋐`,subset:`⊂`,subseteq:`⊆`,subseteqq:`⫅`,SubsetEqual:`⊆`,subsetneq:`⊊`,subsetneqq:`⫋`,subsim:`⫇`,subsub:`⫕`,subsup:`⫓`,succ:`≻`,succapprox:`⪸`,succcurlyeq:`≽`,Succeeds:`≻`,SucceedsEqual:`⪰`,SucceedsSlantEqual:`≽`,SucceedsTilde:`≿`,succeq:`⪰`,succnapprox:`⪺`,succneqq:`⪶`,succnsim:`⋩`,succsim:`≿`,SuchThat:`∋`,Sum:`∑`,sum:`∑`,sung:`♪`,Sup:`⋑`,sup:`⊃`,sup1:`¹`,sup2:`²`,sup3:`³`,supdot:`⪾`,supdsub:`⫘`,supE:`⫆`,supe:`⊇`,supedot:`⫄`,Superset:`⊃`,SupersetEqual:`⊇`,suphsol:`⟉`,suphsub:`⫗`,suplarr:`⥻`,supmult:`⫂`,supnE:`⫌`,supne:`⊋`,supplus:`⫀`,Supset:`⋑`,supset:`⊃`,supseteq:`⊇`,supseteqq:`⫆`,supsetneq:`⊋`,supsetneqq:`⫌`,supsim:`⫈`,supsub:`⫔`,supsup:`⫖`,swarhk:`⤦`,swArr:`⇙`,swarr:`↙`,swarrow:`↙`,swnwar:`⤪`,szlig:`ß`,Tab:` `,target:`⌖`,Tau:`Τ`,tau:`τ`,tbrk:`⎴`,Tcaron:`Ť`,tcaron:`ť`,Tcedil:`Ţ`,tcedil:`ţ`,Tcy:`Т`,tcy:`т`,tdot:`⃛`,telrec:`⌕`,Tfr:`𝔗`,tfr:`𝔱`,there4:`∴`,Therefore:`∴`,therefore:`∴`,Theta:`Θ`,theta:`θ`,thetasym:`ϑ`,thetav:`ϑ`,thickapprox:`≈`,thicksim:`∼`,ThickSpace:`  `,thinsp:` `,ThinSpace:` `,thkap:`≈`,thksim:`∼`,THORN:`Þ`,thorn:`þ`,Tilde:`∼`,tilde:`˜`,TildeEqual:`≃`,TildeFullEqual:`≅`,TildeTilde:`≈`,times:`×`,timesb:`⊠`,timesbar:`⨱`,timesd:`⨰`,tint:`∭`,toea:`⤨`,top:`⊤`,topbot:`⌶`,topcir:`⫱`,Topf:`𝕋`,topf:`𝕥`,topfork:`⫚`,tosa:`⤩`,tprime:`‴`,TRADE:`™`,trade:`™`,triangle:`▵`,triangledown:`▿`,triangleleft:`◃`,trianglelefteq:`⊴`,triangleq:`≜`,triangleright:`▹`,trianglerighteq:`⊵`,tridot:`◬`,trie:`≜`,triminus:`⨺`,TripleDot:`⃛`,triplus:`⨹`,trisb:`⧍`,tritime:`⨻`,trpezium:`⏢`,Tscr:`𝒯`,tscr:`𝓉`,TScy:`Ц`,tscy:`ц`,TSHcy:`Ћ`,tshcy:`ћ`,Tstrok:`Ŧ`,tstrok:`ŧ`,twixt:`≬`,twoheadleftarrow:`↞`,twoheadrightarrow:`↠`,Uacute:`Ú`,uacute:`ú`,Uarr:`↟`,uArr:`⇑`,uarr:`↑`,Uarrocir:`⥉`,Ubrcy:`Ў`,ubrcy:`ў`,Ubreve:`Ŭ`,ubreve:`ŭ`,Ucirc:`Û`,ucirc:`û`,Ucy:`У`,ucy:`у`,udarr:`⇅`,Udblac:`Ű`,udblac:`ű`,udhar:`⥮`,ufisht:`⥾`,Ufr:`𝔘`,ufr:`𝔲`,Ugrave:`Ù`,ugrave:`ù`,uHar:`⥣`,uharl:`↿`,uharr:`↾`,uhblk:`▀`,ulcorn:`⌜`,ulcorner:`⌜`,ulcrop:`⌏`,ultri:`◸`,Umacr:`Ū`,umacr:`ū`,uml:`¨`,UnderBar:`_`,UnderBrace:`⏟`,UnderBracket:`⎵`,UnderParenthesis:`⏝`,Union:`⋃`,UnionPlus:`⊎`,Uogon:`Ų`,uogon:`ų`,Uopf:`𝕌`,uopf:`𝕦`,UpArrow:`↑`,Uparrow:`⇑`,uparrow:`↑`,UpArrowBar:`⤒`,UpArrowDownArrow:`⇅`,UpDownArrow:`↕`,Updownarrow:`⇕`,updownarrow:`↕`,UpEquilibrium:`⥮`,upharpoonleft:`↿`,upharpoonright:`↾`,uplus:`⊎`,UpperLeftArrow:`↖`,UpperRightArrow:`↗`,Upsi:`ϒ`,upsi:`υ`,upsih:`ϒ`,Upsilon:`Υ`,upsilon:`υ`,UpTee:`⊥`,UpTeeArrow:`↥`,upuparrows:`⇈`,urcorn:`⌝`,urcorner:`⌝`,urcrop:`⌎`,Uring:`Ů`,uring:`ů`,urtri:`◹`,Uscr:`𝒰`,uscr:`𝓊`,utdot:`⋰`,Utilde:`Ũ`,utilde:`ũ`,utri:`▵`,utrif:`▴`,uuarr:`⇈`,Uuml:`Ü`,uuml:`ü`,uwangle:`⦧`,vangrt:`⦜`,varepsilon:`ϵ`,varkappa:`ϰ`,varnothing:`∅`,varphi:`ϕ`,varpi:`ϖ`,varpropto:`∝`,vArr:`⇕`,varr:`↕`,varrho:`ϱ`,varsigma:`ς`,varsubsetneq:`⊊︀`,varsubsetneqq:`⫋︀`,varsupsetneq:`⊋︀`,varsupsetneqq:`⫌︀`,vartheta:`ϑ`,vartriangleleft:`⊲`,vartriangleright:`⊳`,Vbar:`⫫`,vBar:`⫨`,vBarv:`⫩`,Vcy:`В`,vcy:`в`,VDash:`⊫`,Vdash:`⊩`,vDash:`⊨`,vdash:`⊢`,Vdashl:`⫦`,Vee:`⋁`,vee:`∨`,veebar:`⊻`,veeeq:`≚`,vellip:`⋮`,Verbar:`‖`,verbar:`|`,Vert:`‖`,vert:`|`,VerticalBar:`∣`,VerticalLine:`|`,VerticalSeparator:`❘`,VerticalTilde:`≀`,VeryThinSpace:` `,Vfr:`𝔙`,vfr:`𝔳`,vltri:`⊲`,vnsub:`⊂⃒`,vnsup:`⊃⃒`,Vopf:`𝕍`,vopf:`𝕧`,vprop:`∝`,vrtri:`⊳`,Vscr:`𝒱`,vscr:`𝓋`,vsubnE:`⫋︀`,vsubne:`⊊︀`,vsupnE:`⫌︀`,vsupne:`⊋︀`,Vvdash:`⊪`,vzigzag:`⦚`,Wcirc:`Ŵ`,wcirc:`ŵ`,wedbar:`⩟`,Wedge:`⋀`,wedge:`∧`,wedgeq:`≙`,weierp:`℘`,Wfr:`𝔚`,wfr:`𝔴`,Wopf:`𝕎`,wopf:`𝕨`,wp:`℘`,wr:`≀`,wreath:`≀`,Wscr:`𝒲`,wscr:`𝓌`,xcap:`⋂`,xcirc:`◯`,xcup:`⋃`,xdtri:`▽`,Xfr:`𝔛`,xfr:`𝔵`,xhArr:`⟺`,xharr:`⟷`,Xi:`Ξ`,xi:`ξ`,xlArr:`⟸`,xlarr:`⟵`,xmap:`⟼`,xnis:`⋻`,xodot:`⨀`,Xopf:`𝕏`,xopf:`𝕩`,xoplus:`⨁`,xotime:`⨂`,xrArr:`⟹`,xrarr:`⟶`,Xscr:`𝒳`,xscr:`𝓍`,xsqcup:`⨆`,xuplus:`⨄`,xutri:`△`,xvee:`⋁`,xwedge:`⋀`,Yacute:`Ý`,yacute:`ý`,YAcy:`Я`,yacy:`я`,Ycirc:`Ŷ`,ycirc:`ŷ`,Ycy:`Ы`,ycy:`ы`,yen:`¥`,Yfr:`𝔜`,yfr:`𝔶`,YIcy:`Ї`,yicy:`ї`,Yopf:`𝕐`,yopf:`𝕪`,Yscr:`𝒴`,yscr:`𝓎`,YUcy:`Ю`,yucy:`ю`,Yuml:`Ÿ`,yuml:`ÿ`,Zacute:`Ź`,zacute:`ź`,Zcaron:`Ž`,zcaron:`ž`,Zcy:`З`,zcy:`з`,Zdot:`Ż`,zdot:`ż`,zeetrf:`ℨ`,ZeroWidthSpace:`​`,Zeta:`Ζ`,zeta:`ζ`,Zfr:`ℨ`,zfr:`𝔷`,ZHcy:`Ж`,zhcy:`ж`,zigrarr:`⇝`,Zopf:`ℤ`,zopf:`𝕫`,Zscr:`𝒵`,zscr:`𝓏`,zwj:`‍`,zwnj:`‌`}),e.entityMap=e.HTML_ENTITIES})),x=e((e=>{var t=v().NAMESPACE,n=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=RegExp(`[\\-\\.0-9`+n.source.slice(1,-1)+`\\u00B7\\u0300-\\u036F\\u203F-\\u2040]`),i=RegExp(`^`+n.source+r.source+`*(?::`+n.source+r.source+`*)?$`),a=0,o=1,s=2,c=3,l=4,u=5,d=6,f=7;function p(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,p)}p.prototype=Error(),p.prototype.name=p.name;function m(){}m.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),S(t,t={}),h(e,t,n,r,this.errorHandler),r.endDocument()}};function h(e,n,r,i,a){function o(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}else return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return t in r?r[t]:t.charAt(0)===`#`?o(parseInt(t.substr(1).replace(`x`,`0x`))):(a.error(`entity not found:`+e),e)}function c(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,s);m&&l(S),i.characters(n,0,t-S),S=t}}function l(t,n){for(;t>=d&&(n=f.exec(e));)u=n.index,d=u+n[0].length,m.lineNumber++;m.columnNumber=t-u+1}for(var u=0,d=0,f=/.*(?:\r\n?|\n)|.*$/g,m=i.locator,h=[{currentNSMap:n}],v={},S=0;;){try{var E=e.indexOf(`<`,S);if(E<0){if(!e.substr(S).match(/^\s*$/)){var D=i.doc,O=D.createTextNode(e.substr(S));D.appendChild(O),i.currentElement=O}return}switch(E>S&&c(E),e.charAt(E+1)){case`/`:var k=e.indexOf(`>`,E+3),A=e.substring(E+2,k).replace(/[ \t\n\r]+$/g,``),j=h.pop();k<0?(A=e.substring(E+2).replace(/[\s<].*/,``),a.error(`end tag name: `+A+` is not complete:`+j.tagName),k=E+1+A.length):A.match(/\sS?S=k:c(Math.max(E,S)+1)}}function g(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function _(e,n,r,i,p,m){function h(e,t,n){r.attributeNames.hasOwnProperty(e)&&m.fatalError(`Attribute `+e+` redefined`),r.addValue(e,t,n)}for(var g,_,v=++n,y=a;;){var b=e.charAt(v);switch(b){case`=`:if(y===o)g=e.slice(n,v),y=c;else if(y===s)y=c;else throw Error(`attribute equal must after attrName`);break;case`'`:case`"`:if(y===c||y===o)if(y===o&&(m.warning(`attribute value must after "="`),g=e.slice(n,v)),n=v+1,v=e.indexOf(b,n),v>0)_=e.slice(n,v).replace(/&#?\w+;/g,p),h(g,_,n-1),y=u;else throw Error(`attribute value no end '`+b+`' match`);else if(y==l)_=e.slice(n,v).replace(/&#?\w+;/g,p),h(g,_,n),m.warning(`attribute "`+g+`" missed start quot(`+b+`)!!`),n=v+1,y=u;else throw Error(`attribute value must after "="`);break;case`/`:switch(y){case a:r.setTagName(e.slice(n,v));case u:case d:case f:y=f,r.closed=!0;case l:case o:break;case s:r.closed=!0;break;default:throw Error(`attribute invalid close char('/')`)}break;case``:return m.error(`unexpected end of input`),y==a&&r.setTagName(e.slice(n,v)),v;case`>`:switch(y){case a:r.setTagName(e.slice(n,v));case u:case d:case f:break;case l:case o:_=e.slice(n,v),_.slice(-1)===`/`&&(r.closed=!0,_=_.slice(0,-1));case s:y===s&&(_=g),y==l?(m.warning(`attribute "`+_+`" missed quot(")!`),h(g,_.replace(/&#?\w+;/g,p),n)):((!t.isHTML(i[``])||!_.match(/^(?:disabled|checked|selected)$/i))&&m.warning(`attribute "`+_+`" missed value!! "`+_+`" instead!!`),h(_,_,n));break;case c:throw Error(`attribute value missed!!`)}return v;case`€`:b=` `;default:if(b<=` `)switch(y){case a:r.setTagName(e.slice(n,v)),y=d;break;case o:g=e.slice(n,v),y=s;break;case l:var _=e.slice(n,v).replace(/&#?\w+;/g,p);m.warning(`attribute "`+_+`" missed quot(")!!`),h(g,_,n);case u:y=d;break}else switch(y){case s:r.tagName,(!t.isHTML(i[``])||!g.match(/^(?:disabled|checked|selected)$/i))&&m.warning(`attribute "`+g+`" missed value!! "`+g+`" instead2!!`),h(g,g,n),n=v,y=o;break;case u:m.warning(`attribute space is required"`+g+`"!!`);case d:y=o,n=v;break;case c:y=l,n=v;break;case f:throw Error(`elements closed character '/' and '>' must be connected to`)}}v++}}function y(e,n,r){for(var i=e.tagName,a=null,o=e.length;o--;){var s=e[o],c=s.qName,l=s.value,u=c.indexOf(`:`);if(u>0)var d=s.prefix=c.slice(0,u),f=c.slice(u+1),p=d===`xmlns`&&f;else f=c,d=null,p=c===`xmlns`&&``;s.localName=f,p!==!1&&(a??(a={},S(r,r={})),r[p]=a[p]=l,s.uri=t.XMLNS,n.startPrefixMapping(p,l))}for(var o=e.length;o--;){s=e[o];var d=s.prefix;d&&(d===`xml`&&(s.uri=t.XML),d!==`xmlns`&&(s.uri=r[d||``]))}var u=i.indexOf(`:`);u>0?(d=e.prefix=i.slice(0,u),f=e.localName=i.slice(u+1)):(d=null,f=e.localName=i);var m=e.uri=r[d||``];if(n.startElement(m,f,i,e),e.closed){if(n.endElement(m,f,i),a)for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&n.endPrefixMapping(d)}else return e.currentNSMap=r,e.localNSMap=a,!0}function b(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf(``,t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(n)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,r),i.characters(o,0,o.length),a)}return t+1}function x(e,t,n,r){var i=r[n];return i??(i=e.lastIndexOf(``),i`,t+4);return i>t?(n.comment(e,t+4,i-t-4),i+3):(r.error(`Unclosed comment`),-1)}else return-1;default:if(e.substr(t+3,6)==`CDATA[`){var i=e.indexOf(`]]>`,t+9);return n.startCDATA(),n.characters(e,t+9,i-t-9),n.endCDATA(),i+3}var a=E(e,t),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var s=a[1][0],c=!1,l=!1;o>3&&(/^public$/i.test(a[2][0])?(c=a[3][0],l=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var u=a[o-1];return n.startDTD(s,c,l),n.endDTD(),u.index+u[0].length}}return-1}function w(e,t,n){var r=e.indexOf(`?>`,t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function T(){this.attributeNames={}}T.prototype={setTagName:function(e){if(!i.test(e))throw Error(`invalid tagName:`+e);this.tagName=e},addValue:function(e,t,n){if(!i.test(e))throw Error(`invalid attribute:`+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function E(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);n=i.exec(e);)if(r.push(n),n[1])return r}e.XMLReader=m,e.ParseError=p})),S=e((e=>{var t=v(),n=y(),r=b(),i=x(),a=n.DOMImplementation,o=t.NAMESPACE,s=i.ParseError,c=i.XMLReader;function l(e){this.options=e||{locator:{}}}l.prototype.parseFromString=function(e,t){var n=this.options,i=new c,a=n.domBuilder||new d,s=n.errorHandler,l=n.locator,f=n.xmlns||{},p=/\/x?html?$/.test(t),m=p?r.HTML_ENTITIES:r.XML_ENTITIES;return l&&a.setDocumentLocator(l),i.errorHandler=u(s,a,l),i.domBuilder=n.domBuilder||a,p&&(f[``]=o.HTML),f.xml=f.xml||o.XML,e&&typeof e==`string`?i.parse(e,f,m):i.errorHandler.error(`invalid doc source`),a.doc};function u(e,t,n){if(!e){if(t instanceof d)return t;e=t}var r={},i=e instanceof Function;n||={};function a(t){var a=e[t];!a&&i&&(a=e.length==2?function(n){e(t,n)}:e),r[t]=a&&function(e){a(`[xmldom `+t+`] `+e+p(n))}||function(){}}return a(`warning`),a(`error`),a(`fatalError`),r}function d(){this.cdata=!1}function f(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}d.prototype={startDocument:function(){this.doc=new a().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,a=i.createElementNS(e,n||t),o=r.length;h(this,a),this.currentElement=a,this.locator&&f(this.locator,a);for(var s=0;s=t+n||t?new java.lang.String(e,t,n)+``:e}`endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl`.replace(/\w+/g,function(e){d.prototype[e]=function(){return null}});function h(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}e.__DOMHandler=d,e.DOMParser=l,e.DOMImplementation=n.DOMImplementation,e.XMLSerializer=n.XMLSerializer})),C=e((e=>{var t=y();e.DOMImplementation=t.DOMImplementation,e.XMLSerializer=t.XMLSerializer,e.DOMParser=S().DOMParser}))(),w={dataType:null,batchType:null,name:`KML (Keyhole Markup Language)`,id:`kml`,module:`kml`,version:`4.4.1`,extensions:[`kml`],mimeTypes:[`application/vnd.google-earth.kml+xml`],text:!0,tests:[` -`],parse:async(e,t)=>T(new TextDecoder().decode(e),t),parseTextSync:T,options:{kml:{shape:`geojson-table`},gis:{}}};function T(e,t){let n=_(new C.DOMParser().parseFromString(e,`text/xml`)),r={...w.options.kml,...t?.kml};switch(r.shape){case`geojson-table`:return{shape:`geojson-table`,type:`FeatureCollection`,features:n.features};case`object-row-table`:return{shape:`object-row-table`,data:n.features};default:throw Error(r.shape)}}var E,D,O;async function k(){let e,t=document.querySelector(`.mdc-linear-progress`);t&&(e=new mdc.linearProgress.MDCLinearProgress(t),e.open(),e.determinate=!1,e.done=function(){e.close(),t?.remove()});let n={lat:19.223718899391237,lng:-148.62590882823457},{Map:r}=await google.maps.importLibrary(`maps`),i=document.getElementById(`map`);if(!i){console.error(`Map element not found!`);return}E=new r(i,{zoom:3,center:n,mapId:`6a17c323f461e521`,mapTypeId:`satellite`,zoomControl:!0,clickableIcons:!1}),D=new deck.GeoJsonLayer({id:`geojson-layer`,data:`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_week_age.kml?t=${Date.now()}`,loaders:[w],pickable:!0,stroked:!0,getLineColor:[0,0,0,255],getLineWidth:2,filled:!0,pointType:`circle`,pointRadiusMinPixels:2,pointRadiusMaxPixels:200,getRadius:()=>8e3,getFillColor:e=>{let t=e.properties.description.match(/M (\d+\.?\d*)/),n=null;t&&t[1]?n=parseFloat(t[1]):console.log(`Magnitude not found`);let r=[255,255,0],i=[255,0,0],a=Math.max(0,Math.min(1,((n===null?1:n)-1)/6)),o=r[0]+a*(i[0]-r[0]),s=r[1]+a*(i[1]-r[1]),c=r[2]+a*(i[2]-r[2]);return[Math.round(o),Math.round(s),Math.round(c),200]},autoHighlight:!0,transitions:{getRadius:{type:`spring`,stiffness:.1,damping:.15,enter:()=>[0],duration:1e4}},onHover:({object:e,x:t,y:n})=>{let r=document.getElementById(`tooltip`);if(r&&e){let i=`Earthquakes 1.0_week_age`;i+=`

${e.properties.description}

`,r.innerHTML=i,r.style.left=t+`px`,r.style.top=n+`px`,r.style.display=`block`}else r&&(r.style.display=`none`)},onDataLoad:()=>{console.log(`KML data loaded`),e&&e.done&&e.done()}}),O=new deck.GoogleMapsOverlay({layers:[D],parameters:{depthTest:!1}}),O.setMap(E);let a=document.getElementById(`legend`);if(a){let e=[1,2,3,4,5,6,7],t=[255,255,0],n=[255,0,0];e.forEach(e=>{let r=Math.max(0,Math.min(1,(e-1)/6)),i=t[0]+r*(n[0]-t[0]),o=t[1]+r*(n[1]-t[1]),s=t[2]+r*(n[2]-t[2]),c=`rgb(${Math.round(i)}, ${Math.round(o)}, ${Math.round(s)})`,l=document.createElement(`div`);l.classList.add(`legend-item`);let u=document.createElement(`div`);u.classList.add(`legend-color`),u.style.backgroundColor=c;let d=document.createElement(`span`);d.textContent=`${e}`,l.appendChild(u),l.appendChild(d),a.appendChild(l)})}}k(); \ No newline at end of file +`],parse:async(e,t)=>T(new TextDecoder().decode(e),t),parseTextSync:T,options:{kml:{shape:`geojson-table`},gis:{}}};function T(e,t){let n=_(new C.DOMParser().parseFromString(e,`text/xml`)),r={...w.options.kml,...t?.kml};switch(r.shape){case`geojson-table`:return{shape:`geojson-table`,type:`FeatureCollection`,features:n.features};case`object-row-table`:return{shape:`object-row-table`,data:n.features};default:throw Error(r.shape)}}var E,D,O;async function k(){let e,t=document.querySelector(`.mdc-linear-progress`);t&&(e=new mdc.linearProgress.MDCLinearProgress(t),e.open(),e.determinate=!1,e.done=function(){e.close(),t.remove()});let n={lat:19.223718899391237,lng:-148.62590882823457},{Map:r}=await google.maps.importLibrary(`maps`),i=document.getElementById(`map`);if(!i){console.error(`Map element not found!`);return}E=new r(i,{zoom:3,center:n,mapId:`6a17c323f461e521`,mapTypeId:`satellite`,zoomControl:!0,clickableIcons:!1}),D=new deck.GeoJsonLayer({id:`geojson-layer`,data:`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_week_age.kml?t=${Date.now()}`,loaders:[w],pickable:!0,stroked:!0,getLineColor:[0,0,0,255],getLineWidth:2,filled:!0,pointType:`circle`,pointRadiusMinPixels:2,pointRadiusMaxPixels:200,getRadius:()=>8e3,getFillColor:e=>{let t=e.properties.description.match(/M (\d+\.?\d*)/),n=null;t?.[1]?n=parseFloat(t[1]):console.log(`Magnitude not found`);let r=[255,255,0],i=[255,0,0],a=Math.max(0,Math.min(1,((n===null?1:n)-1)/6)),o=r[0]+a*(i[0]-r[0]),s=r[1]+a*(i[1]-r[1]),c=r[2]+a*(i[2]-r[2]);return[Math.round(o),Math.round(s),Math.round(c),200]},autoHighlight:!0,transitions:{getRadius:{type:`spring`,stiffness:.1,damping:.15,enter:()=>[0],duration:1e4}},onHover:({object:e,x:t,y:n})=>{let r=document.getElementById(`tooltip`);if(r&&e){let i=`Earthquakes 1.0_week_age`;i+=`

${e.properties.description}

`,r.innerHTML=i,r.style.left=t+`px`,r.style.top=n+`px`,r.style.display=`block`}else r&&(r.style.display=`none`)},onDataLoad:()=>{console.log(`KML data loaded`),e?.done&&e.done()}}),O=new deck.GoogleMapsOverlay({layers:[D],parameters:{depthTest:!1}}),O.setMap(E);let a=document.getElementById(`legend`);if(a){let e=[1,2,3,4,5,6,7],t=[255,255,0],n=[255,0,0];e.forEach(e=>{let r=Math.max(0,Math.min(1,(e-1)/6)),i=t[0]+r*(n[0]-t[0]),o=t[1]+r*(n[1]-t[1]),s=t[2]+r*(n[2]-t[2]),c=`rgb(${Math.round(i)}, ${Math.round(o)}, ${Math.round(s)})`,l=document.createElement(`div`);l.classList.add(`legend-item`);let u=document.createElement(`div`);u.classList.add(`legend-color`),u.style.backgroundColor=c;let d=document.createElement(`span`);d.textContent=`${e}`,l.appendChild(u),l.appendChild(d),a.appendChild(l)})}}k(); \ No newline at end of file diff --git a/dist/samples/deckgl-kml-updated/dist/index.html b/dist/samples/deckgl-kml-updated/dist/index.html index 3331e8257..0b9c7d2a0 100644 --- a/dist/samples/deckgl-kml-updated/dist/index.html +++ b/dist/samples/deckgl-kml-updated/dist/index.html @@ -25,7 +25,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/deckgl-kml-updated/docs/index.js b/dist/samples/deckgl-kml-updated/docs/index.js index b3b5c2403..b9ede8b05 100644 --- a/dist/samples/deckgl-kml-updated/docs/index.js +++ b/dist/samples/deckgl-kml-updated/docs/index.js @@ -20,13 +20,12 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progressDiv.remove(); // Use optional chaining in case progressDiv is null }; } @@ -75,7 +74,7 @@ async function init() { const description = f.properties.description; const magnitudeMatch = description.match(/M (\d+\.?\d*)/); let parsedMagnitude = null; - if (magnitudeMatch && magnitudeMatch[1]) { + if (magnitudeMatch?.[1]) { parsedMagnitude = parseFloat(magnitudeMatch[1]); } else { console.log('Magnitude not found'); @@ -140,7 +139,7 @@ async function init() { }, onDataLoad: () => { console.log('KML data loaded'); - if (progress && progress.done) { + if (progress?.done) { progress.done(); } }, diff --git a/dist/samples/deckgl-kml-updated/docs/index.ts b/dist/samples/deckgl-kml-updated/docs/index.ts index cfe49f60a..dd0c211db 100644 --- a/dist/samples/deckgl-kml-updated/docs/index.ts +++ b/dist/samples/deckgl-kml-updated/docs/index.ts @@ -5,6 +5,9 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* [START maps_deckgl_kml_updated] */ // Import necessary loader @@ -44,6 +47,19 @@ declare namespace deck { // Add other Deck.gl types used globally if needed } +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Initialize and add the map let map: google.maps.Map; let geojsonLayer: deck.GeoJsonLayer; @@ -51,18 +67,17 @@ let googleMapsOverlay: deck.GoogleMapsOverlay; async function init(): Promise { // Progress bar logic moved from index.html - let progress; + let progress: mdc.linearProgress.MDCLinearProgress; const progressDiv = document.querySelector('.mdc-linear-progress')!; if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { - progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progress!.close(); + progressDiv.remove(); // Use optional chaining in case progressDiv is null }; } @@ -106,12 +121,12 @@ async function init(): Promise { pointRadiusMinPixels: 2, pointRadiusMaxPixels: 200, getRadius: () => 8000, - getFillColor: (f) => { + getFillColor: (f: any) => { // Extract magnitude from the description string const description = f.properties.description; const magnitudeMatch = description.match(/M (\d+\.?\d*)/); let parsedMagnitude: number | null = null; - if (magnitudeMatch && magnitudeMatch[1]) { + if (magnitudeMatch?.[1]) { parsedMagnitude = parseFloat(magnitudeMatch[1]); } else { console.log('Magnitude not found'); @@ -176,7 +191,7 @@ async function init(): Promise { }, onDataLoad: () => { console.log('KML data loaded'); - if (progress && progress.done) { + if (progress?.done) { progress.done(); } }, diff --git a/dist/samples/deckgl-kml-updated/jsfiddle/demo.js b/dist/samples/deckgl-kml-updated/jsfiddle/demo.js index 881bd95b0..f4789e688 100644 --- a/dist/samples/deckgl-kml-updated/jsfiddle/demo.js +++ b/dist/samples/deckgl-kml-updated/jsfiddle/demo.js @@ -19,13 +19,12 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progressDiv.remove(); // Use optional chaining in case progressDiv is null }; } @@ -74,7 +73,7 @@ async function init() { const description = f.properties.description; const magnitudeMatch = description.match(/M (\d+\.?\d*)/); let parsedMagnitude = null; - if (magnitudeMatch && magnitudeMatch[1]) { + if (magnitudeMatch?.[1]) { parsedMagnitude = parseFloat(magnitudeMatch[1]); } else { console.log('Magnitude not found'); @@ -139,7 +138,7 @@ async function init() { }, onDataLoad: () => { console.log('KML data loaded'); - if (progress && progress.done) { + if (progress?.done) { progress.done(); } }, diff --git a/dist/samples/deckgl-kml/app/index.ts b/dist/samples/deckgl-kml/app/index.ts index f0c1a7ba2..1a40ddeca 100644 --- a/dist/samples/deckgl-kml/app/index.ts +++ b/dist/samples/deckgl-kml/app/index.ts @@ -5,6 +5,10 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* [START maps_deckgl_kml] */ // Import necessary loader @@ -43,6 +47,19 @@ declare namespace deck { // Add other Deck.gl types used globally if needed } +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Initialize and add the map let map: google.maps.Map; let geojsonLayer: deck.GeoJsonLayer; @@ -50,12 +67,11 @@ let googleMapsOverlay: deck.GoogleMapsOverlay; async function init(): Promise { // Progress bar logic moved from index.html - let progress; + let progress: mdc.linearProgress.MDCLinearProgress; const progressDiv = document.querySelector('.mdc-linear-progress')!; if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; @@ -116,7 +132,7 @@ async function init(): Promise { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } }, @@ -161,8 +177,7 @@ async function init(): Promise { if (d.properties.centroid) { position = d.properties.centroid; } else if ( - d.geometry && - d.geometry.coordinates && + d.geometry?.coordinates && d.geometry.coordinates.length > 0 ) { // Assuming Polygon or MultiPolygon diff --git a/dist/samples/deckgl-kml/dist/assets/index-B8eC_RCi.js b/dist/samples/deckgl-kml/dist/assets/index-B02K2uug.js similarity index 97% rename from dist/samples/deckgl-kml/dist/assets/index-B8eC_RCi.js rename to dist/samples/deckgl-kml/dist/assets/index-B02K2uug.js index f9ce7bd4e..1d77a59be 100644 --- a/dist/samples/deckgl-kml/dist/assets/index-B8eC_RCi.js +++ b/dist/samples/deckgl-kml/dist/assets/index-B02K2uug.js @@ -1,4 +1,4 @@ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function t(e){return e&&e.normalize&&e.normalize(),e&&e.textContent||``}function n(e,t){let n=e.getElementsByTagName(t);return n.length?n[0]:null}var r=/\s*/g,i=/^\s*|\s*$/g,a=/\s+/;function o(e){if(!e||!e.length)return 0;let t=0;for(let n=0;n{function t(e,t,n){if(n===void 0&&(n=Array.prototype),e&&typeof n.find==`function`)return n.find.call(e,t);for(var r=0;r{var t=v(),n=t.find,r=t.NAMESPACE;function i(e){return e!==``}function a(e){return e?e.split(/[\t\n\f\r ]+/).filter(i):[]}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function s(e){if(!e)return[];var t=a(e);return Object.keys(t.reduce(o,{}))}function c(e){return function(t){return e&&e.indexOf(t)!==-1}}function l(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function u(e,t){var n=e.prototype;if(!(n instanceof t)){function r(){}r.prototype=t.prototype,r=new r,l(n,r),e.prototype=n=r}n.constructor!=e&&(typeof e!=`function`&&console.error(`unknown Class:`+e),n.constructor=e)}var d={},f=d.ELEMENT_NODE=1,p=d.ATTRIBUTE_NODE=2,m=d.TEXT_NODE=3,h=d.CDATA_SECTION_NODE=4,g=d.ENTITY_REFERENCE_NODE=5,_=d.ENTITY_NODE=6,y=d.PROCESSING_INSTRUCTION_NODE=7,b=d.COMMENT_NODE=8,x=d.DOCUMENT_NODE=9,S=d.DOCUMENT_TYPE_NODE=10,C=d.DOCUMENT_FRAGMENT_NODE=11,w=d.NOTATION_NODE=12,T={},E={};T.INDEX_SIZE_ERR=(E[1]=`Index size error`,1),T.DOMSTRING_SIZE_ERR=(E[2]=`DOMString size error`,2);var D=T.HIERARCHY_REQUEST_ERR=(E[3]=`Hierarchy request error`,3);T.WRONG_DOCUMENT_ERR=(E[4]=`Wrong document`,4),T.INVALID_CHARACTER_ERR=(E[5]=`Invalid character`,5),T.NO_DATA_ALLOWED_ERR=(E[6]=`No data allowed`,6),T.NO_MODIFICATION_ALLOWED_ERR=(E[7]=`No modification allowed`,7);var O=T.NOT_FOUND_ERR=(E[8]=`Not found`,8);T.NOT_SUPPORTED_ERR=(E[9]=`Not supported`,9);var k=T.INUSE_ATTRIBUTE_ERR=(E[10]=`Attribute in use`,10);T.INVALID_STATE_ERR=(E[11]=`Invalid state`,11),T.SYNTAX_ERR=(E[12]=`Syntax error`,12),T.INVALID_MODIFICATION_ERR=(E[13]=`Invalid modification`,13),T.NAMESPACE_ERR=(E[14]=`Invalid namespace`,14),T.INVALID_ACCESS_ERR=(E[15]=`Invalid access`,15);function A(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,E[e]),this.message=E[e],Error.captureStackTrace&&Error.captureStackTrace(this,A);return n.code=e,t&&(this.message=this.message+`: `+t),n}A.prototype=Error.prototype,l(T,A);function j(){}j.prototype={length:0,item:function(e){return e>=0&&e=0){for(var i=t.length-1;r0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===e)return r}t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n&&Object.prototype.hasOwnProperty.call(n,e))return n[e];t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return this.lookupPrefix(e)==null}};function B(e){return e==`<`&&`<`||e==`>`&&`>`||e==`&`&&`&`||e==`"`&&`"`||`&#`+e.charCodeAt()+`;`}l(d,z),l(d,z.prototype);function V(e,t){if(t(e))return!0;if(e=e.firstChild)do if(V(e,t))return!0;while(e=e.nextSibling)}function H(){this.ownerDocument=this}function ee(e,t,n){e&&e._inc++,n.namespaceURI===r.XMLNS&&(t._nsMap[n.prefix?n.localName:``]=n.value)}function te(e,t,n,i){e&&e._inc++,n.namespaceURI===r.XMLNS&&delete t._nsMap[n.prefix?n.localName:``]}function ne(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var i=t.firstChild,a=0;i;)r[a++]=i,i=i.nextSibling;r.length=a,delete r[r.length]}}}function re(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,ne(e.ownerDocument,e),t}function ie(e){return e&&(e.nodeType===z.DOCUMENT_NODE||e.nodeType===z.DOCUMENT_FRAGMENT_NODE||e.nodeType===z.ELEMENT_NODE)}function ae(e){return e&&(W(e)||oe(e)||U(e)||e.nodeType===z.DOCUMENT_FRAGMENT_NODE||e.nodeType===z.COMMENT_NODE||e.nodeType===z.PROCESSING_INSTRUCTION_NODE)}function U(e){return e&&e.nodeType===z.DOCUMENT_TYPE_NODE}function W(e){return e&&e.nodeType===z.ELEMENT_NODE}function oe(e){return e&&e.nodeType===z.TEXT_NODE}function se(e,t){var r=e.childNodes||[];if(n(r,W)||U(t))return!1;var i=n(r,U);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function ce(e,t){var r=e.childNodes||[];function i(e){return W(e)&&e!==t}if(n(r,i))return!1;var a=n(r,U);return!(t&&a&&r.indexOf(a)>r.indexOf(t))}function le(e,t,n){if(!ie(e))throw new A(D,`Unexpected parent node type `+e.nodeType);if(n&&n.parentNode!==e)throw new A(O,`child not in parent`);if(!ae(t)||U(t)&&e.nodeType!==z.DOCUMENT_NODE)throw new A(D,`Unexpected node type `+t.nodeType+` for parent node type `+e.nodeType)}function ue(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===z.DOCUMENT_FRAGMENT_NODE){var o=a.filter(W);if(o.length>1||n(a,oe))throw new A(D,`More than one element or text in fragment`);if(o.length===1&&!se(e,r))throw new A(D,`Element in fragment can not be inserted before doctype`)}if(W(t)&&!se(e,r))throw new A(D,`Only one element can be added and only after doctype`);if(U(t)){if(n(i,U))throw new A(D,`Only one doctype is allowed`);var s=n(i,W);if(r&&i.indexOf(s)1||n(a,oe))throw new A(D,`More than one element or text in fragment`);if(o.length===1&&!ce(e,r))throw new A(D,`Element in fragment can not be inserted before doctype`)}if(W(t)&&!ce(e,r))throw new A(D,`Only one element can be added and only after doctype`);if(U(t)){function e(e){return U(e)&&e!==r}if(n(i,e))throw new A(D,`Only one doctype is allowed`);var s=n(i,W);if(r&&i.indexOf(s)0&&V(n.documentElement,function(i){if(i!==n&&i.nodeType===f){var a=i.getAttribute(`class`);if(a){var o=e===a;if(!o){var l=s(a);o=t.every(c(l))}o&&r.push(i)}}}),r})},createElement:function(e){var t=new K;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new j;var n=t.attributes=new P;return n._ownerElement=t,t},createDocumentFragment:function(){var e=new Q;return e.ownerDocument=this,e.childNodes=new j,e},createTextNode:function(e){var t=new Y;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new pe;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new _e;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new q;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ge;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new K,r=t.split(`:`),i=n.attributes=new P;return n.childNodes=new j,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new q,r=t.split(`:`);return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},u(H,z);function K(){this._nsMap={}}K.prototype={nodeType:f,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||``},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=``+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===C?this.insertBefore(e,null):fe(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||``},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=``+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new M(this,function(t){var n=[];return V(t,function(r){r!==t&&r.nodeType==f&&(e===`*`||r.tagName==e)&&n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new M(this,function(n){var r=[];return V(n,function(i){i!==n&&i.nodeType===f&&(e===`*`||i.namespaceURI===e)&&(t===`*`||i.localName==t)&&r.push(i)}),r})}},H.prototype.getElementsByTagName=K.prototype.getElementsByTagName,H.prototype.getElementsByTagNameNS=K.prototype.getElementsByTagNameNS,u(K,z);function q(){}q.prototype.nodeType=p,u(q,z);function J(){}J.prototype={data:``,substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw Error(E[D])},deleteData:function(e,t){this.replaceData(e,t,``)},replaceData:function(e,t,n){var r=this.data.substring(0,e),i=this.data.substring(e+t);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}},u(J,z);function Y(){}Y.prototype={nodeName:`#text`,nodeType:m,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},u(Y,J);function X(){}X.prototype={nodeName:`#comment`,nodeType:b},u(X,J);function pe(){}pe.prototype={nodeName:`#cdata-section`,nodeType:h},u(pe,J);function Z(){}Z.prototype.nodeType=S,u(Z,z);function me(){}me.prototype.nodeType=w,u(me,z);function he(){}he.prototype.nodeType=_,u(he,z);function ge(){}ge.prototype.nodeType=g,u(ge,z);function Q(){}Q.prototype.nodeName=`#document-fragment`,Q.prototype.nodeType=C,u(Q,z);function _e(){}_e.prototype.nodeType=y,u(_e,z);function ve(){}ve.prototype.serializeToString=function(e,t,n){return ye.call(e,t,n)},z.prototype.toString=ye;function ye(e,t){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,a=r.namespaceURI;if(a&&i==null){var i=r.lookupPrefix(a);if(i==null)var o=[{namespace:a,prefix:null}]}return $(this,n,e,t,o),n.join(``)}function be(e,t,n){var i=e.prefix||``,a=e.namespaceURI;if(!a||i===`xml`&&a===r.XML||a===r.XMLNS)return!1;for(var o=n.length;o--;){var s=n[o];if(s.prefix===i)return s.namespace!==a}return!0}function xe(e,t,n){e.push(` `,t,`="`,n.replace(/[<&"]/g,B),`"`)}function $(e,t,n,i,a){if(a||=[],i)if(e=i(e),e){if(typeof e==`string`){t.push(e);return}}else return;switch(e.nodeType){case f:var o=e.attributes,s=o.length,c=e.firstChild,l=e.tagName;n=r.isHTML(e.namespaceURI)||n;var u=l;if(!n&&!e.prefix&&e.namespaceURI){for(var d,_=0;_=0;v--){var w=a[v];if(w.prefix===``&&w.namespace===e.namespaceURI){d=w.namespace;break}}if(d!==e.namespaceURI)for(var v=a.length-1;v>=0;v--){var w=a[v];if(w.namespace===e.namespaceURI){w.prefix&&(u=w.prefix+`:`+l);break}}}t.push(`<`,u);for(var T=0;T`),n&&/^script$/i.test(l))for(;c;)c.data?t.push(c.data):$(c,t,n,i,a.slice()),c=c.nextSibling;else for(;c;)$(c,t,n,i,a.slice()),c=c.nextSibling;t.push(``)}else t.push(`/>`);return;case x:case C:for(var c=e.firstChild;c;)$(c,t,n,i,a.slice()),c=c.nextSibling;return;case p:return xe(t,e.name,e.value);case m:return t.push(e.data.replace(/[<&]/g,B).replace(/]]>/g,`]]>`));case h:return t.push(``);case b:return t.push(``);case S:var k=e.publicId,A=e.systemId;if(t.push(``);else if(A&&A!=`.`)t.push(` SYSTEM `,A,`>`);else{var j=e.internalSubset;j&&t.push(` [`,j,`]`),t.push(`>`)}return;case y:return t.push(``);case g:return t.push(`&`,e.nodeName,`;`);default:t.push(`??`,e.nodeName)}}function Se(e,t,n){var r;switch(t.nodeType){case f:r=t.cloneNode(!1),r.ownerDocument=e;case C:break;case p:n=!0;break}if(r||=t.cloneNode(!1),r.ownerDocument=e,r.parentNode=null,n)for(var i=t.firstChild;i;)r.appendChild(Se(e,i,n)),i=i.nextSibling;return r}function Ce(e,t,n){var r=new t.constructor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=t[i];typeof a!=`object`&&a!=r[i]&&(r[i]=a)}switch(t.childNodes&&(r.childNodes=new j),r.ownerDocument=e,r.nodeType){case f:var o=t.attributes,s=r.attributes=new P,c=o.length;s._ownerElement=r;for(var l=0;l{var t=v().freeze;e.XML_ENTITIES=t({amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`}),e.HTML_ENTITIES=t({Aacute:`Á`,aacute:`á`,Abreve:`Ă`,abreve:`ă`,ac:`∾`,acd:`∿`,acE:`∾̳`,Acirc:`Â`,acirc:`â`,acute:`´`,Acy:`А`,acy:`а`,AElig:`Æ`,aelig:`æ`,af:`⁡`,Afr:`𝔄`,afr:`𝔞`,Agrave:`À`,agrave:`à`,alefsym:`ℵ`,aleph:`ℵ`,Alpha:`Α`,alpha:`α`,Amacr:`Ā`,amacr:`ā`,amalg:`⨿`,AMP:`&`,amp:`&`,And:`⩓`,and:`∧`,andand:`⩕`,andd:`⩜`,andslope:`⩘`,andv:`⩚`,ang:`∠`,ange:`⦤`,angle:`∠`,angmsd:`∡`,angmsdaa:`⦨`,angmsdab:`⦩`,angmsdac:`⦪`,angmsdad:`⦫`,angmsdae:`⦬`,angmsdaf:`⦭`,angmsdag:`⦮`,angmsdah:`⦯`,angrt:`∟`,angrtvb:`⊾`,angrtvbd:`⦝`,angsph:`∢`,angst:`Å`,angzarr:`⍼`,Aogon:`Ą`,aogon:`ą`,Aopf:`𝔸`,aopf:`𝕒`,ap:`≈`,apacir:`⩯`,apE:`⩰`,ape:`≊`,apid:`≋`,apos:`'`,ApplyFunction:`⁡`,approx:`≈`,approxeq:`≊`,Aring:`Å`,aring:`å`,Ascr:`𝒜`,ascr:`𝒶`,Assign:`≔`,ast:`*`,asymp:`≈`,asympeq:`≍`,Atilde:`Ã`,atilde:`ã`,Auml:`Ä`,auml:`ä`,awconint:`∳`,awint:`⨑`,backcong:`≌`,backepsilon:`϶`,backprime:`‵`,backsim:`∽`,backsimeq:`⋍`,Backslash:`∖`,Barv:`⫧`,barvee:`⊽`,Barwed:`⌆`,barwed:`⌅`,barwedge:`⌅`,bbrk:`⎵`,bbrktbrk:`⎶`,bcong:`≌`,Bcy:`Б`,bcy:`б`,bdquo:`„`,becaus:`∵`,Because:`∵`,because:`∵`,bemptyv:`⦰`,bepsi:`϶`,bernou:`ℬ`,Bernoullis:`ℬ`,Beta:`Β`,beta:`β`,beth:`ℶ`,between:`≬`,Bfr:`𝔅`,bfr:`𝔟`,bigcap:`⋂`,bigcirc:`◯`,bigcup:`⋃`,bigodot:`⨀`,bigoplus:`⨁`,bigotimes:`⨂`,bigsqcup:`⨆`,bigstar:`★`,bigtriangledown:`▽`,bigtriangleup:`△`,biguplus:`⨄`,bigvee:`⋁`,bigwedge:`⋀`,bkarow:`⤍`,blacklozenge:`⧫`,blacksquare:`▪`,blacktriangle:`▴`,blacktriangledown:`▾`,blacktriangleleft:`◂`,blacktriangleright:`▸`,blank:`␣`,blk12:`▒`,blk14:`░`,blk34:`▓`,block:`█`,bne:`=⃥`,bnequiv:`≡⃥`,bNot:`⫭`,bnot:`⌐`,Bopf:`𝔹`,bopf:`𝕓`,bot:`⊥`,bottom:`⊥`,bowtie:`⋈`,boxbox:`⧉`,boxDL:`╗`,boxDl:`╖`,boxdL:`╕`,boxdl:`┐`,boxDR:`╔`,boxDr:`╓`,boxdR:`╒`,boxdr:`┌`,boxH:`═`,boxh:`─`,boxHD:`╦`,boxHd:`╤`,boxhD:`╥`,boxhd:`┬`,boxHU:`╩`,boxHu:`╧`,boxhU:`╨`,boxhu:`┴`,boxminus:`⊟`,boxplus:`⊞`,boxtimes:`⊠`,boxUL:`╝`,boxUl:`╜`,boxuL:`╛`,boxul:`┘`,boxUR:`╚`,boxUr:`╙`,boxuR:`╘`,boxur:`└`,boxV:`║`,boxv:`│`,boxVH:`╬`,boxVh:`╫`,boxvH:`╪`,boxvh:`┼`,boxVL:`╣`,boxVl:`╢`,boxvL:`╡`,boxvl:`┤`,boxVR:`╠`,boxVr:`╟`,boxvR:`╞`,boxvr:`├`,bprime:`‵`,Breve:`˘`,breve:`˘`,brvbar:`¦`,Bscr:`ℬ`,bscr:`𝒷`,bsemi:`⁏`,bsim:`∽`,bsime:`⋍`,bsol:`\\`,bsolb:`⧅`,bsolhsub:`⟈`,bull:`•`,bullet:`•`,bump:`≎`,bumpE:`⪮`,bumpe:`≏`,Bumpeq:`≎`,bumpeq:`≏`,Cacute:`Ć`,cacute:`ć`,Cap:`⋒`,cap:`∩`,capand:`⩄`,capbrcup:`⩉`,capcap:`⩋`,capcup:`⩇`,capdot:`⩀`,CapitalDifferentialD:`ⅅ`,caps:`∩︀`,caret:`⁁`,caron:`ˇ`,Cayleys:`ℭ`,ccaps:`⩍`,Ccaron:`Č`,ccaron:`č`,Ccedil:`Ç`,ccedil:`ç`,Ccirc:`Ĉ`,ccirc:`ĉ`,Cconint:`∰`,ccups:`⩌`,ccupssm:`⩐`,Cdot:`Ċ`,cdot:`ċ`,cedil:`¸`,Cedilla:`¸`,cemptyv:`⦲`,cent:`¢`,CenterDot:`·`,centerdot:`·`,Cfr:`ℭ`,cfr:`𝔠`,CHcy:`Ч`,chcy:`ч`,check:`✓`,checkmark:`✓`,Chi:`Χ`,chi:`χ`,cir:`○`,circ:`ˆ`,circeq:`≗`,circlearrowleft:`↺`,circlearrowright:`↻`,circledast:`⊛`,circledcirc:`⊚`,circleddash:`⊝`,CircleDot:`⊙`,circledR:`®`,circledS:`Ⓢ`,CircleMinus:`⊖`,CirclePlus:`⊕`,CircleTimes:`⊗`,cirE:`⧃`,cire:`≗`,cirfnint:`⨐`,cirmid:`⫯`,cirscir:`⧂`,ClockwiseContourIntegral:`∲`,CloseCurlyDoubleQuote:`”`,CloseCurlyQuote:`’`,clubs:`♣`,clubsuit:`♣`,Colon:`∷`,colon:`:`,Colone:`⩴`,colone:`≔`,coloneq:`≔`,comma:`,`,commat:`@`,comp:`∁`,compfn:`∘`,complement:`∁`,complexes:`ℂ`,cong:`≅`,congdot:`⩭`,Congruent:`≡`,Conint:`∯`,conint:`∮`,ContourIntegral:`∮`,Copf:`ℂ`,copf:`𝕔`,coprod:`∐`,Coproduct:`∐`,COPY:`©`,copy:`©`,copysr:`℗`,CounterClockwiseContourIntegral:`∳`,crarr:`↵`,Cross:`⨯`,cross:`✗`,Cscr:`𝒞`,cscr:`𝒸`,csub:`⫏`,csube:`⫑`,csup:`⫐`,csupe:`⫒`,ctdot:`⋯`,cudarrl:`⤸`,cudarrr:`⤵`,cuepr:`⋞`,cuesc:`⋟`,cularr:`↶`,cularrp:`⤽`,Cup:`⋓`,cup:`∪`,cupbrcap:`⩈`,CupCap:`≍`,cupcap:`⩆`,cupcup:`⩊`,cupdot:`⊍`,cupor:`⩅`,cups:`∪︀`,curarr:`↷`,curarrm:`⤼`,curlyeqprec:`⋞`,curlyeqsucc:`⋟`,curlyvee:`⋎`,curlywedge:`⋏`,curren:`¤`,curvearrowleft:`↶`,curvearrowright:`↷`,cuvee:`⋎`,cuwed:`⋏`,cwconint:`∲`,cwint:`∱`,cylcty:`⌭`,Dagger:`‡`,dagger:`†`,daleth:`ℸ`,Darr:`↡`,dArr:`⇓`,darr:`↓`,dash:`‐`,Dashv:`⫤`,dashv:`⊣`,dbkarow:`⤏`,dblac:`˝`,Dcaron:`Ď`,dcaron:`ď`,Dcy:`Д`,dcy:`д`,DD:`ⅅ`,dd:`ⅆ`,ddagger:`‡`,ddarr:`⇊`,DDotrahd:`⤑`,ddotseq:`⩷`,deg:`°`,Del:`∇`,Delta:`Δ`,delta:`δ`,demptyv:`⦱`,dfisht:`⥿`,Dfr:`𝔇`,dfr:`𝔡`,dHar:`⥥`,dharl:`⇃`,dharr:`⇂`,DiacriticalAcute:`´`,DiacriticalDot:`˙`,DiacriticalDoubleAcute:`˝`,DiacriticalGrave:"`",DiacriticalTilde:`˜`,diam:`⋄`,Diamond:`⋄`,diamond:`⋄`,diamondsuit:`♦`,diams:`♦`,die:`¨`,DifferentialD:`ⅆ`,digamma:`ϝ`,disin:`⋲`,div:`÷`,divide:`÷`,divideontimes:`⋇`,divonx:`⋇`,DJcy:`Ђ`,djcy:`ђ`,dlcorn:`⌞`,dlcrop:`⌍`,dollar:`$`,Dopf:`𝔻`,dopf:`𝕕`,Dot:`¨`,dot:`˙`,DotDot:`⃜`,doteq:`≐`,doteqdot:`≑`,DotEqual:`≐`,dotminus:`∸`,dotplus:`∔`,dotsquare:`⊡`,doublebarwedge:`⌆`,DoubleContourIntegral:`∯`,DoubleDot:`¨`,DoubleDownArrow:`⇓`,DoubleLeftArrow:`⇐`,DoubleLeftRightArrow:`⇔`,DoubleLeftTee:`⫤`,DoubleLongLeftArrow:`⟸`,DoubleLongLeftRightArrow:`⟺`,DoubleLongRightArrow:`⟹`,DoubleRightArrow:`⇒`,DoubleRightTee:`⊨`,DoubleUpArrow:`⇑`,DoubleUpDownArrow:`⇕`,DoubleVerticalBar:`∥`,DownArrow:`↓`,Downarrow:`⇓`,downarrow:`↓`,DownArrowBar:`⤓`,DownArrowUpArrow:`⇵`,DownBreve:`̑`,downdownarrows:`⇊`,downharpoonleft:`⇃`,downharpoonright:`⇂`,DownLeftRightVector:`⥐`,DownLeftTeeVector:`⥞`,DownLeftVector:`↽`,DownLeftVectorBar:`⥖`,DownRightTeeVector:`⥟`,DownRightVector:`⇁`,DownRightVectorBar:`⥗`,DownTee:`⊤`,DownTeeArrow:`↧`,drbkarow:`⤐`,drcorn:`⌟`,drcrop:`⌌`,Dscr:`𝒟`,dscr:`𝒹`,DScy:`Ѕ`,dscy:`ѕ`,dsol:`⧶`,Dstrok:`Đ`,dstrok:`đ`,dtdot:`⋱`,dtri:`▿`,dtrif:`▾`,duarr:`⇵`,duhar:`⥯`,dwangle:`⦦`,DZcy:`Џ`,dzcy:`џ`,dzigrarr:`⟿`,Eacute:`É`,eacute:`é`,easter:`⩮`,Ecaron:`Ě`,ecaron:`ě`,ecir:`≖`,Ecirc:`Ê`,ecirc:`ê`,ecolon:`≕`,Ecy:`Э`,ecy:`э`,eDDot:`⩷`,Edot:`Ė`,eDot:`≑`,edot:`ė`,ee:`ⅇ`,efDot:`≒`,Efr:`𝔈`,efr:`𝔢`,eg:`⪚`,Egrave:`È`,egrave:`è`,egs:`⪖`,egsdot:`⪘`,el:`⪙`,Element:`∈`,elinters:`⏧`,ell:`ℓ`,els:`⪕`,elsdot:`⪗`,Emacr:`Ē`,emacr:`ē`,empty:`∅`,emptyset:`∅`,EmptySmallSquare:`◻`,emptyv:`∅`,EmptyVerySmallSquare:`▫`,emsp:` `,emsp13:` `,emsp14:` `,ENG:`Ŋ`,eng:`ŋ`,ensp:` `,Eogon:`Ę`,eogon:`ę`,Eopf:`𝔼`,eopf:`𝕖`,epar:`⋕`,eparsl:`⧣`,eplus:`⩱`,epsi:`ε`,Epsilon:`Ε`,epsilon:`ε`,epsiv:`ϵ`,eqcirc:`≖`,eqcolon:`≕`,eqsim:`≂`,eqslantgtr:`⪖`,eqslantless:`⪕`,Equal:`⩵`,equals:`=`,EqualTilde:`≂`,equest:`≟`,Equilibrium:`⇌`,equiv:`≡`,equivDD:`⩸`,eqvparsl:`⧥`,erarr:`⥱`,erDot:`≓`,Escr:`ℰ`,escr:`ℯ`,esdot:`≐`,Esim:`⩳`,esim:`≂`,Eta:`Η`,eta:`η`,ETH:`Ð`,eth:`ð`,Euml:`Ë`,euml:`ë`,euro:`€`,excl:`!`,exist:`∃`,Exists:`∃`,expectation:`ℰ`,ExponentialE:`ⅇ`,exponentiale:`ⅇ`,fallingdotseq:`≒`,Fcy:`Ф`,fcy:`ф`,female:`♀`,ffilig:`ffi`,fflig:`ff`,ffllig:`ffl`,Ffr:`𝔉`,ffr:`𝔣`,filig:`fi`,FilledSmallSquare:`◼`,FilledVerySmallSquare:`▪`,fjlig:`fj`,flat:`♭`,fllig:`fl`,fltns:`▱`,fnof:`ƒ`,Fopf:`𝔽`,fopf:`𝕗`,ForAll:`∀`,forall:`∀`,fork:`⋔`,forkv:`⫙`,Fouriertrf:`ℱ`,fpartint:`⨍`,frac12:`½`,frac13:`⅓`,frac14:`¼`,frac15:`⅕`,frac16:`⅙`,frac18:`⅛`,frac23:`⅔`,frac25:`⅖`,frac34:`¾`,frac35:`⅗`,frac38:`⅜`,frac45:`⅘`,frac56:`⅚`,frac58:`⅝`,frac78:`⅞`,frasl:`⁄`,frown:`⌢`,Fscr:`ℱ`,fscr:`𝒻`,gacute:`ǵ`,Gamma:`Γ`,gamma:`γ`,Gammad:`Ϝ`,gammad:`ϝ`,gap:`⪆`,Gbreve:`Ğ`,gbreve:`ğ`,Gcedil:`Ģ`,Gcirc:`Ĝ`,gcirc:`ĝ`,Gcy:`Г`,gcy:`г`,Gdot:`Ġ`,gdot:`ġ`,gE:`≧`,ge:`≥`,gEl:`⪌`,gel:`⋛`,geq:`≥`,geqq:`≧`,geqslant:`⩾`,ges:`⩾`,gescc:`⪩`,gesdot:`⪀`,gesdoto:`⪂`,gesdotol:`⪄`,gesl:`⋛︀`,gesles:`⪔`,Gfr:`𝔊`,gfr:`𝔤`,Gg:`⋙`,gg:`≫`,ggg:`⋙`,gimel:`ℷ`,GJcy:`Ѓ`,gjcy:`ѓ`,gl:`≷`,gla:`⪥`,glE:`⪒`,glj:`⪤`,gnap:`⪊`,gnapprox:`⪊`,gnE:`≩`,gne:`⪈`,gneq:`⪈`,gneqq:`≩`,gnsim:`⋧`,Gopf:`𝔾`,gopf:`𝕘`,grave:"`",GreaterEqual:`≥`,GreaterEqualLess:`⋛`,GreaterFullEqual:`≧`,GreaterGreater:`⪢`,GreaterLess:`≷`,GreaterSlantEqual:`⩾`,GreaterTilde:`≳`,Gscr:`𝒢`,gscr:`ℊ`,gsim:`≳`,gsime:`⪎`,gsiml:`⪐`,Gt:`≫`,GT:`>`,gt:`>`,gtcc:`⪧`,gtcir:`⩺`,gtdot:`⋗`,gtlPar:`⦕`,gtquest:`⩼`,gtrapprox:`⪆`,gtrarr:`⥸`,gtrdot:`⋗`,gtreqless:`⋛`,gtreqqless:`⪌`,gtrless:`≷`,gtrsim:`≳`,gvertneqq:`≩︀`,gvnE:`≩︀`,Hacek:`ˇ`,hairsp:` `,half:`½`,hamilt:`ℋ`,HARDcy:`Ъ`,hardcy:`ъ`,hArr:`⇔`,harr:`↔`,harrcir:`⥈`,harrw:`↭`,Hat:`^`,hbar:`ℏ`,Hcirc:`Ĥ`,hcirc:`ĥ`,hearts:`♥`,heartsuit:`♥`,hellip:`…`,hercon:`⊹`,Hfr:`ℌ`,hfr:`𝔥`,HilbertSpace:`ℋ`,hksearow:`⤥`,hkswarow:`⤦`,hoarr:`⇿`,homtht:`∻`,hookleftarrow:`↩`,hookrightarrow:`↪`,Hopf:`ℍ`,hopf:`𝕙`,horbar:`―`,HorizontalLine:`─`,Hscr:`ℋ`,hscr:`𝒽`,hslash:`ℏ`,Hstrok:`Ħ`,hstrok:`ħ`,HumpDownHump:`≎`,HumpEqual:`≏`,hybull:`⁃`,hyphen:`‐`,Iacute:`Í`,iacute:`í`,ic:`⁣`,Icirc:`Î`,icirc:`î`,Icy:`И`,icy:`и`,Idot:`İ`,IEcy:`Е`,iecy:`е`,iexcl:`¡`,iff:`⇔`,Ifr:`ℑ`,ifr:`𝔦`,Igrave:`Ì`,igrave:`ì`,ii:`ⅈ`,iiiint:`⨌`,iiint:`∭`,iinfin:`⧜`,iiota:`℩`,IJlig:`IJ`,ijlig:`ij`,Im:`ℑ`,Imacr:`Ī`,imacr:`ī`,image:`ℑ`,ImaginaryI:`ⅈ`,imagline:`ℐ`,imagpart:`ℑ`,imath:`ı`,imof:`⊷`,imped:`Ƶ`,Implies:`⇒`,in:`∈`,incare:`℅`,infin:`∞`,infintie:`⧝`,inodot:`ı`,Int:`∬`,int:`∫`,intcal:`⊺`,integers:`ℤ`,Integral:`∫`,intercal:`⊺`,Intersection:`⋂`,intlarhk:`⨗`,intprod:`⨼`,InvisibleComma:`⁣`,InvisibleTimes:`⁢`,IOcy:`Ё`,iocy:`ё`,Iogon:`Į`,iogon:`į`,Iopf:`𝕀`,iopf:`𝕚`,Iota:`Ι`,iota:`ι`,iprod:`⨼`,iquest:`¿`,Iscr:`ℐ`,iscr:`𝒾`,isin:`∈`,isindot:`⋵`,isinE:`⋹`,isins:`⋴`,isinsv:`⋳`,isinv:`∈`,it:`⁢`,Itilde:`Ĩ`,itilde:`ĩ`,Iukcy:`І`,iukcy:`і`,Iuml:`Ï`,iuml:`ï`,Jcirc:`Ĵ`,jcirc:`ĵ`,Jcy:`Й`,jcy:`й`,Jfr:`𝔍`,jfr:`𝔧`,jmath:`ȷ`,Jopf:`𝕁`,jopf:`𝕛`,Jscr:`𝒥`,jscr:`𝒿`,Jsercy:`Ј`,jsercy:`ј`,Jukcy:`Є`,jukcy:`є`,Kappa:`Κ`,kappa:`κ`,kappav:`ϰ`,Kcedil:`Ķ`,kcedil:`ķ`,Kcy:`К`,kcy:`к`,Kfr:`𝔎`,kfr:`𝔨`,kgreen:`ĸ`,KHcy:`Х`,khcy:`х`,KJcy:`Ќ`,kjcy:`ќ`,Kopf:`𝕂`,kopf:`𝕜`,Kscr:`𝒦`,kscr:`𝓀`,lAarr:`⇚`,Lacute:`Ĺ`,lacute:`ĺ`,laemptyv:`⦴`,lagran:`ℒ`,Lambda:`Λ`,lambda:`λ`,Lang:`⟪`,lang:`⟨`,langd:`⦑`,langle:`⟨`,lap:`⪅`,Laplacetrf:`ℒ`,laquo:`«`,Larr:`↞`,lArr:`⇐`,larr:`←`,larrb:`⇤`,larrbfs:`⤟`,larrfs:`⤝`,larrhk:`↩`,larrlp:`↫`,larrpl:`⤹`,larrsim:`⥳`,larrtl:`↢`,lat:`⪫`,lAtail:`⤛`,latail:`⤙`,late:`⪭`,lates:`⪭︀`,lBarr:`⤎`,lbarr:`⤌`,lbbrk:`❲`,lbrace:`{`,lbrack:`[`,lbrke:`⦋`,lbrksld:`⦏`,lbrkslu:`⦍`,Lcaron:`Ľ`,lcaron:`ľ`,Lcedil:`Ļ`,lcedil:`ļ`,lceil:`⌈`,lcub:`{`,Lcy:`Л`,lcy:`л`,ldca:`⤶`,ldquo:`“`,ldquor:`„`,ldrdhar:`⥧`,ldrushar:`⥋`,ldsh:`↲`,lE:`≦`,le:`≤`,LeftAngleBracket:`⟨`,LeftArrow:`←`,Leftarrow:`⇐`,leftarrow:`←`,LeftArrowBar:`⇤`,LeftArrowRightArrow:`⇆`,leftarrowtail:`↢`,LeftCeiling:`⌈`,LeftDoubleBracket:`⟦`,LeftDownTeeVector:`⥡`,LeftDownVector:`⇃`,LeftDownVectorBar:`⥙`,LeftFloor:`⌊`,leftharpoondown:`↽`,leftharpoonup:`↼`,leftleftarrows:`⇇`,LeftRightArrow:`↔`,Leftrightarrow:`⇔`,leftrightarrow:`↔`,leftrightarrows:`⇆`,leftrightharpoons:`⇋`,leftrightsquigarrow:`↭`,LeftRightVector:`⥎`,LeftTee:`⊣`,LeftTeeArrow:`↤`,LeftTeeVector:`⥚`,leftthreetimes:`⋋`,LeftTriangle:`⊲`,LeftTriangleBar:`⧏`,LeftTriangleEqual:`⊴`,LeftUpDownVector:`⥑`,LeftUpTeeVector:`⥠`,LeftUpVector:`↿`,LeftUpVectorBar:`⥘`,LeftVector:`↼`,LeftVectorBar:`⥒`,lEg:`⪋`,leg:`⋚`,leq:`≤`,leqq:`≦`,leqslant:`⩽`,les:`⩽`,lescc:`⪨`,lesdot:`⩿`,lesdoto:`⪁`,lesdotor:`⪃`,lesg:`⋚︀`,lesges:`⪓`,lessapprox:`⪅`,lessdot:`⋖`,lesseqgtr:`⋚`,lesseqqgtr:`⪋`,LessEqualGreater:`⋚`,LessFullEqual:`≦`,LessGreater:`≶`,lessgtr:`≶`,LessLess:`⪡`,lesssim:`≲`,LessSlantEqual:`⩽`,LessTilde:`≲`,lfisht:`⥼`,lfloor:`⌊`,Lfr:`𝔏`,lfr:`𝔩`,lg:`≶`,lgE:`⪑`,lHar:`⥢`,lhard:`↽`,lharu:`↼`,lharul:`⥪`,lhblk:`▄`,LJcy:`Љ`,ljcy:`љ`,Ll:`⋘`,ll:`≪`,llarr:`⇇`,llcorner:`⌞`,Lleftarrow:`⇚`,llhard:`⥫`,lltri:`◺`,Lmidot:`Ŀ`,lmidot:`ŀ`,lmoust:`⎰`,lmoustache:`⎰`,lnap:`⪉`,lnapprox:`⪉`,lnE:`≨`,lne:`⪇`,lneq:`⪇`,lneqq:`≨`,lnsim:`⋦`,loang:`⟬`,loarr:`⇽`,lobrk:`⟦`,LongLeftArrow:`⟵`,Longleftarrow:`⟸`,longleftarrow:`⟵`,LongLeftRightArrow:`⟷`,Longleftrightarrow:`⟺`,longleftrightarrow:`⟷`,longmapsto:`⟼`,LongRightArrow:`⟶`,Longrightarrow:`⟹`,longrightarrow:`⟶`,looparrowleft:`↫`,looparrowright:`↬`,lopar:`⦅`,Lopf:`𝕃`,lopf:`𝕝`,loplus:`⨭`,lotimes:`⨴`,lowast:`∗`,lowbar:`_`,LowerLeftArrow:`↙`,LowerRightArrow:`↘`,loz:`◊`,lozenge:`◊`,lozf:`⧫`,lpar:`(`,lparlt:`⦓`,lrarr:`⇆`,lrcorner:`⌟`,lrhar:`⇋`,lrhard:`⥭`,lrm:`‎`,lrtri:`⊿`,lsaquo:`‹`,Lscr:`ℒ`,lscr:`𝓁`,Lsh:`↰`,lsh:`↰`,lsim:`≲`,lsime:`⪍`,lsimg:`⪏`,lsqb:`[`,lsquo:`‘`,lsquor:`‚`,Lstrok:`Ł`,lstrok:`ł`,Lt:`≪`,LT:`<`,lt:`<`,ltcc:`⪦`,ltcir:`⩹`,ltdot:`⋖`,lthree:`⋋`,ltimes:`⋉`,ltlarr:`⥶`,ltquest:`⩻`,ltri:`◃`,ltrie:`⊴`,ltrif:`◂`,ltrPar:`⦖`,lurdshar:`⥊`,luruhar:`⥦`,lvertneqq:`≨︀`,lvnE:`≨︀`,macr:`¯`,male:`♂`,malt:`✠`,maltese:`✠`,Map:`⤅`,map:`↦`,mapsto:`↦`,mapstodown:`↧`,mapstoleft:`↤`,mapstoup:`↥`,marker:`▮`,mcomma:`⨩`,Mcy:`М`,mcy:`м`,mdash:`—`,mDDot:`∺`,measuredangle:`∡`,MediumSpace:` `,Mellintrf:`ℳ`,Mfr:`𝔐`,mfr:`𝔪`,mho:`℧`,micro:`µ`,mid:`∣`,midast:`*`,midcir:`⫰`,middot:`·`,minus:`−`,minusb:`⊟`,minusd:`∸`,minusdu:`⨪`,MinusPlus:`∓`,mlcp:`⫛`,mldr:`…`,mnplus:`∓`,models:`⊧`,Mopf:`𝕄`,mopf:`𝕞`,mp:`∓`,Mscr:`ℳ`,mscr:`𝓂`,mstpos:`∾`,Mu:`Μ`,mu:`μ`,multimap:`⊸`,mumap:`⊸`,nabla:`∇`,Nacute:`Ń`,nacute:`ń`,nang:`∠⃒`,nap:`≉`,napE:`⩰̸`,napid:`≋̸`,napos:`ʼn`,napprox:`≉`,natur:`♮`,natural:`♮`,naturals:`ℕ`,nbsp:`\xA0`,nbump:`≎̸`,nbumpe:`≏̸`,ncap:`⩃`,Ncaron:`Ň`,ncaron:`ň`,Ncedil:`Ņ`,ncedil:`ņ`,ncong:`≇`,ncongdot:`⩭̸`,ncup:`⩂`,Ncy:`Н`,ncy:`н`,ndash:`–`,ne:`≠`,nearhk:`⤤`,neArr:`⇗`,nearr:`↗`,nearrow:`↗`,nedot:`≐̸`,NegativeMediumSpace:`​`,NegativeThickSpace:`​`,NegativeThinSpace:`​`,NegativeVeryThinSpace:`​`,nequiv:`≢`,nesear:`⤨`,nesim:`≂̸`,NestedGreaterGreater:`≫`,NestedLessLess:`≪`,NewLine:` `,nexist:`∄`,nexists:`∄`,Nfr:`𝔑`,nfr:`𝔫`,ngE:`≧̸`,nge:`≱`,ngeq:`≱`,ngeqq:`≧̸`,ngeqslant:`⩾̸`,nges:`⩾̸`,nGg:`⋙̸`,ngsim:`≵`,nGt:`≫⃒`,ngt:`≯`,ngtr:`≯`,nGtv:`≫̸`,nhArr:`⇎`,nharr:`↮`,nhpar:`⫲`,ni:`∋`,nis:`⋼`,nisd:`⋺`,niv:`∋`,NJcy:`Њ`,njcy:`њ`,nlArr:`⇍`,nlarr:`↚`,nldr:`‥`,nlE:`≦̸`,nle:`≰`,nLeftarrow:`⇍`,nleftarrow:`↚`,nLeftrightarrow:`⇎`,nleftrightarrow:`↮`,nleq:`≰`,nleqq:`≦̸`,nleqslant:`⩽̸`,nles:`⩽̸`,nless:`≮`,nLl:`⋘̸`,nlsim:`≴`,nLt:`≪⃒`,nlt:`≮`,nltri:`⋪`,nltrie:`⋬`,nLtv:`≪̸`,nmid:`∤`,NoBreak:`⁠`,NonBreakingSpace:`\xA0`,Nopf:`ℕ`,nopf:`𝕟`,Not:`⫬`,not:`¬`,NotCongruent:`≢`,NotCupCap:`≭`,NotDoubleVerticalBar:`∦`,NotElement:`∉`,NotEqual:`≠`,NotEqualTilde:`≂̸`,NotExists:`∄`,NotGreater:`≯`,NotGreaterEqual:`≱`,NotGreaterFullEqual:`≧̸`,NotGreaterGreater:`≫̸`,NotGreaterLess:`≹`,NotGreaterSlantEqual:`⩾̸`,NotGreaterTilde:`≵`,NotHumpDownHump:`≎̸`,NotHumpEqual:`≏̸`,notin:`∉`,notindot:`⋵̸`,notinE:`⋹̸`,notinva:`∉`,notinvb:`⋷`,notinvc:`⋶`,NotLeftTriangle:`⋪`,NotLeftTriangleBar:`⧏̸`,NotLeftTriangleEqual:`⋬`,NotLess:`≮`,NotLessEqual:`≰`,NotLessGreater:`≸`,NotLessLess:`≪̸`,NotLessSlantEqual:`⩽̸`,NotLessTilde:`≴`,NotNestedGreaterGreater:`⪢̸`,NotNestedLessLess:`⪡̸`,notni:`∌`,notniva:`∌`,notnivb:`⋾`,notnivc:`⋽`,NotPrecedes:`⊀`,NotPrecedesEqual:`⪯̸`,NotPrecedesSlantEqual:`⋠`,NotReverseElement:`∌`,NotRightTriangle:`⋫`,NotRightTriangleBar:`⧐̸`,NotRightTriangleEqual:`⋭`,NotSquareSubset:`⊏̸`,NotSquareSubsetEqual:`⋢`,NotSquareSuperset:`⊐̸`,NotSquareSupersetEqual:`⋣`,NotSubset:`⊂⃒`,NotSubsetEqual:`⊈`,NotSucceeds:`⊁`,NotSucceedsEqual:`⪰̸`,NotSucceedsSlantEqual:`⋡`,NotSucceedsTilde:`≿̸`,NotSuperset:`⊃⃒`,NotSupersetEqual:`⊉`,NotTilde:`≁`,NotTildeEqual:`≄`,NotTildeFullEqual:`≇`,NotTildeTilde:`≉`,NotVerticalBar:`∤`,npar:`∦`,nparallel:`∦`,nparsl:`⫽⃥`,npart:`∂̸`,npolint:`⨔`,npr:`⊀`,nprcue:`⋠`,npre:`⪯̸`,nprec:`⊀`,npreceq:`⪯̸`,nrArr:`⇏`,nrarr:`↛`,nrarrc:`⤳̸`,nrarrw:`↝̸`,nRightarrow:`⇏`,nrightarrow:`↛`,nrtri:`⋫`,nrtrie:`⋭`,nsc:`⊁`,nsccue:`⋡`,nsce:`⪰̸`,Nscr:`𝒩`,nscr:`𝓃`,nshortmid:`∤`,nshortparallel:`∦`,nsim:`≁`,nsime:`≄`,nsimeq:`≄`,nsmid:`∤`,nspar:`∦`,nsqsube:`⋢`,nsqsupe:`⋣`,nsub:`⊄`,nsubE:`⫅̸`,nsube:`⊈`,nsubset:`⊂⃒`,nsubseteq:`⊈`,nsubseteqq:`⫅̸`,nsucc:`⊁`,nsucceq:`⪰̸`,nsup:`⊅`,nsupE:`⫆̸`,nsupe:`⊉`,nsupset:`⊃⃒`,nsupseteq:`⊉`,nsupseteqq:`⫆̸`,ntgl:`≹`,Ntilde:`Ñ`,ntilde:`ñ`,ntlg:`≸`,ntriangleleft:`⋪`,ntrianglelefteq:`⋬`,ntriangleright:`⋫`,ntrianglerighteq:`⋭`,Nu:`Ν`,nu:`ν`,num:`#`,numero:`№`,numsp:` `,nvap:`≍⃒`,nVDash:`⊯`,nVdash:`⊮`,nvDash:`⊭`,nvdash:`⊬`,nvge:`≥⃒`,nvgt:`>⃒`,nvHarr:`⤄`,nvinfin:`⧞`,nvlArr:`⤂`,nvle:`≤⃒`,nvlt:`<⃒`,nvltrie:`⊴⃒`,nvrArr:`⤃`,nvrtrie:`⊵⃒`,nvsim:`∼⃒`,nwarhk:`⤣`,nwArr:`⇖`,nwarr:`↖`,nwarrow:`↖`,nwnear:`⤧`,Oacute:`Ó`,oacute:`ó`,oast:`⊛`,ocir:`⊚`,Ocirc:`Ô`,ocirc:`ô`,Ocy:`О`,ocy:`о`,odash:`⊝`,Odblac:`Ő`,odblac:`ő`,odiv:`⨸`,odot:`⊙`,odsold:`⦼`,OElig:`Œ`,oelig:`œ`,ofcir:`⦿`,Ofr:`𝔒`,ofr:`𝔬`,ogon:`˛`,Ograve:`Ò`,ograve:`ò`,ogt:`⧁`,ohbar:`⦵`,ohm:`Ω`,oint:`∮`,olarr:`↺`,olcir:`⦾`,olcross:`⦻`,oline:`‾`,olt:`⧀`,Omacr:`Ō`,omacr:`ō`,Omega:`Ω`,omega:`ω`,Omicron:`Ο`,omicron:`ο`,omid:`⦶`,ominus:`⊖`,Oopf:`𝕆`,oopf:`𝕠`,opar:`⦷`,OpenCurlyDoubleQuote:`“`,OpenCurlyQuote:`‘`,operp:`⦹`,oplus:`⊕`,Or:`⩔`,or:`∨`,orarr:`↻`,ord:`⩝`,order:`ℴ`,orderof:`ℴ`,ordf:`ª`,ordm:`º`,origof:`⊶`,oror:`⩖`,orslope:`⩗`,orv:`⩛`,oS:`Ⓢ`,Oscr:`𝒪`,oscr:`ℴ`,Oslash:`Ø`,oslash:`ø`,osol:`⊘`,Otilde:`Õ`,otilde:`õ`,Otimes:`⨷`,otimes:`⊗`,otimesas:`⨶`,Ouml:`Ö`,ouml:`ö`,ovbar:`⌽`,OverBar:`‾`,OverBrace:`⏞`,OverBracket:`⎴`,OverParenthesis:`⏜`,par:`∥`,para:`¶`,parallel:`∥`,parsim:`⫳`,parsl:`⫽`,part:`∂`,PartialD:`∂`,Pcy:`П`,pcy:`п`,percnt:`%`,period:`.`,permil:`‰`,perp:`⊥`,pertenk:`‱`,Pfr:`𝔓`,pfr:`𝔭`,Phi:`Φ`,phi:`φ`,phiv:`ϕ`,phmmat:`ℳ`,phone:`☎`,Pi:`Π`,pi:`π`,pitchfork:`⋔`,piv:`ϖ`,planck:`ℏ`,planckh:`ℎ`,plankv:`ℏ`,plus:`+`,plusacir:`⨣`,plusb:`⊞`,pluscir:`⨢`,plusdo:`∔`,plusdu:`⨥`,pluse:`⩲`,PlusMinus:`±`,plusmn:`±`,plussim:`⨦`,plustwo:`⨧`,pm:`±`,Poincareplane:`ℌ`,pointint:`⨕`,Popf:`ℙ`,popf:`𝕡`,pound:`£`,Pr:`⪻`,pr:`≺`,prap:`⪷`,prcue:`≼`,prE:`⪳`,pre:`⪯`,prec:`≺`,precapprox:`⪷`,preccurlyeq:`≼`,Precedes:`≺`,PrecedesEqual:`⪯`,PrecedesSlantEqual:`≼`,PrecedesTilde:`≾`,preceq:`⪯`,precnapprox:`⪹`,precneqq:`⪵`,precnsim:`⋨`,precsim:`≾`,Prime:`″`,prime:`′`,primes:`ℙ`,prnap:`⪹`,prnE:`⪵`,prnsim:`⋨`,prod:`∏`,Product:`∏`,profalar:`⌮`,profline:`⌒`,profsurf:`⌓`,prop:`∝`,Proportion:`∷`,Proportional:`∝`,propto:`∝`,prsim:`≾`,prurel:`⊰`,Pscr:`𝒫`,pscr:`𝓅`,Psi:`Ψ`,psi:`ψ`,puncsp:` `,Qfr:`𝔔`,qfr:`𝔮`,qint:`⨌`,Qopf:`ℚ`,qopf:`𝕢`,qprime:`⁗`,Qscr:`𝒬`,qscr:`𝓆`,quaternions:`ℍ`,quatint:`⨖`,quest:`?`,questeq:`≟`,QUOT:`"`,quot:`"`,rAarr:`⇛`,race:`∽̱`,Racute:`Ŕ`,racute:`ŕ`,radic:`√`,raemptyv:`⦳`,Rang:`⟫`,rang:`⟩`,rangd:`⦒`,range:`⦥`,rangle:`⟩`,raquo:`»`,Rarr:`↠`,rArr:`⇒`,rarr:`→`,rarrap:`⥵`,rarrb:`⇥`,rarrbfs:`⤠`,rarrc:`⤳`,rarrfs:`⤞`,rarrhk:`↪`,rarrlp:`↬`,rarrpl:`⥅`,rarrsim:`⥴`,Rarrtl:`⤖`,rarrtl:`↣`,rarrw:`↝`,rAtail:`⤜`,ratail:`⤚`,ratio:`∶`,rationals:`ℚ`,RBarr:`⤐`,rBarr:`⤏`,rbarr:`⤍`,rbbrk:`❳`,rbrace:`}`,rbrack:`]`,rbrke:`⦌`,rbrksld:`⦎`,rbrkslu:`⦐`,Rcaron:`Ř`,rcaron:`ř`,Rcedil:`Ŗ`,rcedil:`ŗ`,rceil:`⌉`,rcub:`}`,Rcy:`Р`,rcy:`р`,rdca:`⤷`,rdldhar:`⥩`,rdquo:`”`,rdquor:`”`,rdsh:`↳`,Re:`ℜ`,real:`ℜ`,realine:`ℛ`,realpart:`ℜ`,reals:`ℝ`,rect:`▭`,REG:`®`,reg:`®`,ReverseElement:`∋`,ReverseEquilibrium:`⇋`,ReverseUpEquilibrium:`⥯`,rfisht:`⥽`,rfloor:`⌋`,Rfr:`ℜ`,rfr:`𝔯`,rHar:`⥤`,rhard:`⇁`,rharu:`⇀`,rharul:`⥬`,Rho:`Ρ`,rho:`ρ`,rhov:`ϱ`,RightAngleBracket:`⟩`,RightArrow:`→`,Rightarrow:`⇒`,rightarrow:`→`,RightArrowBar:`⇥`,RightArrowLeftArrow:`⇄`,rightarrowtail:`↣`,RightCeiling:`⌉`,RightDoubleBracket:`⟧`,RightDownTeeVector:`⥝`,RightDownVector:`⇂`,RightDownVectorBar:`⥕`,RightFloor:`⌋`,rightharpoondown:`⇁`,rightharpoonup:`⇀`,rightleftarrows:`⇄`,rightleftharpoons:`⇌`,rightrightarrows:`⇉`,rightsquigarrow:`↝`,RightTee:`⊢`,RightTeeArrow:`↦`,RightTeeVector:`⥛`,rightthreetimes:`⋌`,RightTriangle:`⊳`,RightTriangleBar:`⧐`,RightTriangleEqual:`⊵`,RightUpDownVector:`⥏`,RightUpTeeVector:`⥜`,RightUpVector:`↾`,RightUpVectorBar:`⥔`,RightVector:`⇀`,RightVectorBar:`⥓`,ring:`˚`,risingdotseq:`≓`,rlarr:`⇄`,rlhar:`⇌`,rlm:`‏`,rmoust:`⎱`,rmoustache:`⎱`,rnmid:`⫮`,roang:`⟭`,roarr:`⇾`,robrk:`⟧`,ropar:`⦆`,Ropf:`ℝ`,ropf:`𝕣`,roplus:`⨮`,rotimes:`⨵`,RoundImplies:`⥰`,rpar:`)`,rpargt:`⦔`,rppolint:`⨒`,rrarr:`⇉`,Rrightarrow:`⇛`,rsaquo:`›`,Rscr:`ℛ`,rscr:`𝓇`,Rsh:`↱`,rsh:`↱`,rsqb:`]`,rsquo:`’`,rsquor:`’`,rthree:`⋌`,rtimes:`⋊`,rtri:`▹`,rtrie:`⊵`,rtrif:`▸`,rtriltri:`⧎`,RuleDelayed:`⧴`,ruluhar:`⥨`,rx:`℞`,Sacute:`Ś`,sacute:`ś`,sbquo:`‚`,Sc:`⪼`,sc:`≻`,scap:`⪸`,Scaron:`Š`,scaron:`š`,sccue:`≽`,scE:`⪴`,sce:`⪰`,Scedil:`Ş`,scedil:`ş`,Scirc:`Ŝ`,scirc:`ŝ`,scnap:`⪺`,scnE:`⪶`,scnsim:`⋩`,scpolint:`⨓`,scsim:`≿`,Scy:`С`,scy:`с`,sdot:`⋅`,sdotb:`⊡`,sdote:`⩦`,searhk:`⤥`,seArr:`⇘`,searr:`↘`,searrow:`↘`,sect:`§`,semi:`;`,seswar:`⤩`,setminus:`∖`,setmn:`∖`,sext:`✶`,Sfr:`𝔖`,sfr:`𝔰`,sfrown:`⌢`,sharp:`♯`,SHCHcy:`Щ`,shchcy:`щ`,SHcy:`Ш`,shcy:`ш`,ShortDownArrow:`↓`,ShortLeftArrow:`←`,shortmid:`∣`,shortparallel:`∥`,ShortRightArrow:`→`,ShortUpArrow:`↑`,shy:`­`,Sigma:`Σ`,sigma:`σ`,sigmaf:`ς`,sigmav:`ς`,sim:`∼`,simdot:`⩪`,sime:`≃`,simeq:`≃`,simg:`⪞`,simgE:`⪠`,siml:`⪝`,simlE:`⪟`,simne:`≆`,simplus:`⨤`,simrarr:`⥲`,slarr:`←`,SmallCircle:`∘`,smallsetminus:`∖`,smashp:`⨳`,smeparsl:`⧤`,smid:`∣`,smile:`⌣`,smt:`⪪`,smte:`⪬`,smtes:`⪬︀`,SOFTcy:`Ь`,softcy:`ь`,sol:`/`,solb:`⧄`,solbar:`⌿`,Sopf:`𝕊`,sopf:`𝕤`,spades:`♠`,spadesuit:`♠`,spar:`∥`,sqcap:`⊓`,sqcaps:`⊓︀`,sqcup:`⊔`,sqcups:`⊔︀`,Sqrt:`√`,sqsub:`⊏`,sqsube:`⊑`,sqsubset:`⊏`,sqsubseteq:`⊑`,sqsup:`⊐`,sqsupe:`⊒`,sqsupset:`⊐`,sqsupseteq:`⊒`,squ:`□`,Square:`□`,square:`□`,SquareIntersection:`⊓`,SquareSubset:`⊏`,SquareSubsetEqual:`⊑`,SquareSuperset:`⊐`,SquareSupersetEqual:`⊒`,SquareUnion:`⊔`,squarf:`▪`,squf:`▪`,srarr:`→`,Sscr:`𝒮`,sscr:`𝓈`,ssetmn:`∖`,ssmile:`⌣`,sstarf:`⋆`,Star:`⋆`,star:`☆`,starf:`★`,straightepsilon:`ϵ`,straightphi:`ϕ`,strns:`¯`,Sub:`⋐`,sub:`⊂`,subdot:`⪽`,subE:`⫅`,sube:`⊆`,subedot:`⫃`,submult:`⫁`,subnE:`⫋`,subne:`⊊`,subplus:`⪿`,subrarr:`⥹`,Subset:`⋐`,subset:`⊂`,subseteq:`⊆`,subseteqq:`⫅`,SubsetEqual:`⊆`,subsetneq:`⊊`,subsetneqq:`⫋`,subsim:`⫇`,subsub:`⫕`,subsup:`⫓`,succ:`≻`,succapprox:`⪸`,succcurlyeq:`≽`,Succeeds:`≻`,SucceedsEqual:`⪰`,SucceedsSlantEqual:`≽`,SucceedsTilde:`≿`,succeq:`⪰`,succnapprox:`⪺`,succneqq:`⪶`,succnsim:`⋩`,succsim:`≿`,SuchThat:`∋`,Sum:`∑`,sum:`∑`,sung:`♪`,Sup:`⋑`,sup:`⊃`,sup1:`¹`,sup2:`²`,sup3:`³`,supdot:`⪾`,supdsub:`⫘`,supE:`⫆`,supe:`⊇`,supedot:`⫄`,Superset:`⊃`,SupersetEqual:`⊇`,suphsol:`⟉`,suphsub:`⫗`,suplarr:`⥻`,supmult:`⫂`,supnE:`⫌`,supne:`⊋`,supplus:`⫀`,Supset:`⋑`,supset:`⊃`,supseteq:`⊇`,supseteqq:`⫆`,supsetneq:`⊋`,supsetneqq:`⫌`,supsim:`⫈`,supsub:`⫔`,supsup:`⫖`,swarhk:`⤦`,swArr:`⇙`,swarr:`↙`,swarrow:`↙`,swnwar:`⤪`,szlig:`ß`,Tab:` `,target:`⌖`,Tau:`Τ`,tau:`τ`,tbrk:`⎴`,Tcaron:`Ť`,tcaron:`ť`,Tcedil:`Ţ`,tcedil:`ţ`,Tcy:`Т`,tcy:`т`,tdot:`⃛`,telrec:`⌕`,Tfr:`𝔗`,tfr:`𝔱`,there4:`∴`,Therefore:`∴`,therefore:`∴`,Theta:`Θ`,theta:`θ`,thetasym:`ϑ`,thetav:`ϑ`,thickapprox:`≈`,thicksim:`∼`,ThickSpace:`  `,thinsp:` `,ThinSpace:` `,thkap:`≈`,thksim:`∼`,THORN:`Þ`,thorn:`þ`,Tilde:`∼`,tilde:`˜`,TildeEqual:`≃`,TildeFullEqual:`≅`,TildeTilde:`≈`,times:`×`,timesb:`⊠`,timesbar:`⨱`,timesd:`⨰`,tint:`∭`,toea:`⤨`,top:`⊤`,topbot:`⌶`,topcir:`⫱`,Topf:`𝕋`,topf:`𝕥`,topfork:`⫚`,tosa:`⤩`,tprime:`‴`,TRADE:`™`,trade:`™`,triangle:`▵`,triangledown:`▿`,triangleleft:`◃`,trianglelefteq:`⊴`,triangleq:`≜`,triangleright:`▹`,trianglerighteq:`⊵`,tridot:`◬`,trie:`≜`,triminus:`⨺`,TripleDot:`⃛`,triplus:`⨹`,trisb:`⧍`,tritime:`⨻`,trpezium:`⏢`,Tscr:`𝒯`,tscr:`𝓉`,TScy:`Ц`,tscy:`ц`,TSHcy:`Ћ`,tshcy:`ћ`,Tstrok:`Ŧ`,tstrok:`ŧ`,twixt:`≬`,twoheadleftarrow:`↞`,twoheadrightarrow:`↠`,Uacute:`Ú`,uacute:`ú`,Uarr:`↟`,uArr:`⇑`,uarr:`↑`,Uarrocir:`⥉`,Ubrcy:`Ў`,ubrcy:`ў`,Ubreve:`Ŭ`,ubreve:`ŭ`,Ucirc:`Û`,ucirc:`û`,Ucy:`У`,ucy:`у`,udarr:`⇅`,Udblac:`Ű`,udblac:`ű`,udhar:`⥮`,ufisht:`⥾`,Ufr:`𝔘`,ufr:`𝔲`,Ugrave:`Ù`,ugrave:`ù`,uHar:`⥣`,uharl:`↿`,uharr:`↾`,uhblk:`▀`,ulcorn:`⌜`,ulcorner:`⌜`,ulcrop:`⌏`,ultri:`◸`,Umacr:`Ū`,umacr:`ū`,uml:`¨`,UnderBar:`_`,UnderBrace:`⏟`,UnderBracket:`⎵`,UnderParenthesis:`⏝`,Union:`⋃`,UnionPlus:`⊎`,Uogon:`Ų`,uogon:`ų`,Uopf:`𝕌`,uopf:`𝕦`,UpArrow:`↑`,Uparrow:`⇑`,uparrow:`↑`,UpArrowBar:`⤒`,UpArrowDownArrow:`⇅`,UpDownArrow:`↕`,Updownarrow:`⇕`,updownarrow:`↕`,UpEquilibrium:`⥮`,upharpoonleft:`↿`,upharpoonright:`↾`,uplus:`⊎`,UpperLeftArrow:`↖`,UpperRightArrow:`↗`,Upsi:`ϒ`,upsi:`υ`,upsih:`ϒ`,Upsilon:`Υ`,upsilon:`υ`,UpTee:`⊥`,UpTeeArrow:`↥`,upuparrows:`⇈`,urcorn:`⌝`,urcorner:`⌝`,urcrop:`⌎`,Uring:`Ů`,uring:`ů`,urtri:`◹`,Uscr:`𝒰`,uscr:`𝓊`,utdot:`⋰`,Utilde:`Ũ`,utilde:`ũ`,utri:`▵`,utrif:`▴`,uuarr:`⇈`,Uuml:`Ü`,uuml:`ü`,uwangle:`⦧`,vangrt:`⦜`,varepsilon:`ϵ`,varkappa:`ϰ`,varnothing:`∅`,varphi:`ϕ`,varpi:`ϖ`,varpropto:`∝`,vArr:`⇕`,varr:`↕`,varrho:`ϱ`,varsigma:`ς`,varsubsetneq:`⊊︀`,varsubsetneqq:`⫋︀`,varsupsetneq:`⊋︀`,varsupsetneqq:`⫌︀`,vartheta:`ϑ`,vartriangleleft:`⊲`,vartriangleright:`⊳`,Vbar:`⫫`,vBar:`⫨`,vBarv:`⫩`,Vcy:`В`,vcy:`в`,VDash:`⊫`,Vdash:`⊩`,vDash:`⊨`,vdash:`⊢`,Vdashl:`⫦`,Vee:`⋁`,vee:`∨`,veebar:`⊻`,veeeq:`≚`,vellip:`⋮`,Verbar:`‖`,verbar:`|`,Vert:`‖`,vert:`|`,VerticalBar:`∣`,VerticalLine:`|`,VerticalSeparator:`❘`,VerticalTilde:`≀`,VeryThinSpace:` `,Vfr:`𝔙`,vfr:`𝔳`,vltri:`⊲`,vnsub:`⊂⃒`,vnsup:`⊃⃒`,Vopf:`𝕍`,vopf:`𝕧`,vprop:`∝`,vrtri:`⊳`,Vscr:`𝒱`,vscr:`𝓋`,vsubnE:`⫋︀`,vsubne:`⊊︀`,vsupnE:`⫌︀`,vsupne:`⊋︀`,Vvdash:`⊪`,vzigzag:`⦚`,Wcirc:`Ŵ`,wcirc:`ŵ`,wedbar:`⩟`,Wedge:`⋀`,wedge:`∧`,wedgeq:`≙`,weierp:`℘`,Wfr:`𝔚`,wfr:`𝔴`,Wopf:`𝕎`,wopf:`𝕨`,wp:`℘`,wr:`≀`,wreath:`≀`,Wscr:`𝒲`,wscr:`𝓌`,xcap:`⋂`,xcirc:`◯`,xcup:`⋃`,xdtri:`▽`,Xfr:`𝔛`,xfr:`𝔵`,xhArr:`⟺`,xharr:`⟷`,Xi:`Ξ`,xi:`ξ`,xlArr:`⟸`,xlarr:`⟵`,xmap:`⟼`,xnis:`⋻`,xodot:`⨀`,Xopf:`𝕏`,xopf:`𝕩`,xoplus:`⨁`,xotime:`⨂`,xrArr:`⟹`,xrarr:`⟶`,Xscr:`𝒳`,xscr:`𝓍`,xsqcup:`⨆`,xuplus:`⨄`,xutri:`△`,xvee:`⋁`,xwedge:`⋀`,Yacute:`Ý`,yacute:`ý`,YAcy:`Я`,yacy:`я`,Ycirc:`Ŷ`,ycirc:`ŷ`,Ycy:`Ы`,ycy:`ы`,yen:`¥`,Yfr:`𝔜`,yfr:`𝔶`,YIcy:`Ї`,yicy:`ї`,Yopf:`𝕐`,yopf:`𝕪`,Yscr:`𝒴`,yscr:`𝓎`,YUcy:`Ю`,yucy:`ю`,Yuml:`Ÿ`,yuml:`ÿ`,Zacute:`Ź`,zacute:`ź`,Zcaron:`Ž`,zcaron:`ž`,Zcy:`З`,zcy:`з`,Zdot:`Ż`,zdot:`ż`,zeetrf:`ℨ`,ZeroWidthSpace:`​`,Zeta:`Ζ`,zeta:`ζ`,Zfr:`ℨ`,zfr:`𝔷`,ZHcy:`Ж`,zhcy:`ж`,zigrarr:`⇝`,Zopf:`ℤ`,zopf:`𝕫`,Zscr:`𝒵`,zscr:`𝓏`,zwj:`‍`,zwnj:`‌`}),e.entityMap=e.HTML_ENTITIES})),x=e((e=>{var t=v().NAMESPACE,n=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=RegExp(`[\\-\\.0-9`+n.source.slice(1,-1)+`\\u00B7\\u0300-\\u036F\\u203F-\\u2040]`),i=RegExp(`^`+n.source+r.source+`*(?::`+n.source+r.source+`*)?$`),a=0,o=1,s=2,c=3,l=4,u=5,d=6,f=7;function p(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,p)}p.prototype=Error(),p.prototype.name=p.name;function m(){}m.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),S(t,t={}),h(e,t,n,r,this.errorHandler),r.endDocument()}};function h(e,n,r,i,a){function o(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}else return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return t in r?r[t]:t.charAt(0)===`#`?o(parseInt(t.substr(1).replace(`x`,`0x`))):(a.error(`entity not found:`+e),e)}function c(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,s);m&&l(S),i.characters(n,0,t-S),S=t}}function l(t,n){for(;t>=d&&(n=f.exec(e));)u=n.index,d=u+n[0].length,m.lineNumber++;m.columnNumber=t-u+1}for(var u=0,d=0,f=/.*(?:\r\n?|\n)|.*$/g,m=i.locator,h=[{currentNSMap:n}],v={},S=0;;){try{var E=e.indexOf(`<`,S);if(E<0){if(!e.substr(S).match(/^\s*$/)){var D=i.doc,O=D.createTextNode(e.substr(S));D.appendChild(O),i.currentElement=O}return}switch(E>S&&c(E),e.charAt(E+1)){case`/`:var k=e.indexOf(`>`,E+3),A=e.substring(E+2,k).replace(/[ \t\n\r]+$/g,``),j=h.pop();k<0?(A=e.substring(E+2).replace(/[\s<].*/,``),a.error(`end tag name: `+A+` is not complete:`+j.tagName),k=E+1+A.length):A.match(/\sS?S=k:c(Math.max(E,S)+1)}}function g(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function _(e,n,r,i,p,m){function h(e,t,n){r.attributeNames.hasOwnProperty(e)&&m.fatalError(`Attribute `+e+` redefined`),r.addValue(e,t,n)}for(var g,_,v=++n,y=a;;){var b=e.charAt(v);switch(b){case`=`:if(y===o)g=e.slice(n,v),y=c;else if(y===s)y=c;else throw Error(`attribute equal must after attrName`);break;case`'`:case`"`:if(y===c||y===o)if(y===o&&(m.warning(`attribute value must after "="`),g=e.slice(n,v)),n=v+1,v=e.indexOf(b,n),v>0)_=e.slice(n,v).replace(/&#?\w+;/g,p),h(g,_,n-1),y=u;else throw Error(`attribute value no end '`+b+`' match`);else if(y==l)_=e.slice(n,v).replace(/&#?\w+;/g,p),h(g,_,n),m.warning(`attribute "`+g+`" missed start quot(`+b+`)!!`),n=v+1,y=u;else throw Error(`attribute value must after "="`);break;case`/`:switch(y){case a:r.setTagName(e.slice(n,v));case u:case d:case f:y=f,r.closed=!0;case l:case o:break;case s:r.closed=!0;break;default:throw Error(`attribute invalid close char('/')`)}break;case``:return m.error(`unexpected end of input`),y==a&&r.setTagName(e.slice(n,v)),v;case`>`:switch(y){case a:r.setTagName(e.slice(n,v));case u:case d:case f:break;case l:case o:_=e.slice(n,v),_.slice(-1)===`/`&&(r.closed=!0,_=_.slice(0,-1));case s:y===s&&(_=g),y==l?(m.warning(`attribute "`+_+`" missed quot(")!`),h(g,_.replace(/&#?\w+;/g,p),n)):((!t.isHTML(i[``])||!_.match(/^(?:disabled|checked|selected)$/i))&&m.warning(`attribute "`+_+`" missed value!! "`+_+`" instead!!`),h(_,_,n));break;case c:throw Error(`attribute value missed!!`)}return v;case`€`:b=` `;default:if(b<=` `)switch(y){case a:r.setTagName(e.slice(n,v)),y=d;break;case o:g=e.slice(n,v),y=s;break;case l:var _=e.slice(n,v).replace(/&#?\w+;/g,p);m.warning(`attribute "`+_+`" missed quot(")!!`),h(g,_,n);case u:y=d;break}else switch(y){case s:r.tagName,(!t.isHTML(i[``])||!g.match(/^(?:disabled|checked|selected)$/i))&&m.warning(`attribute "`+g+`" missed value!! "`+g+`" instead2!!`),h(g,g,n),n=v,y=o;break;case u:m.warning(`attribute space is required"`+g+`"!!`);case d:y=o,n=v;break;case c:y=l,n=v;break;case f:throw Error(`elements closed character '/' and '>' must be connected to`)}}v++}}function y(e,n,r){for(var i=e.tagName,a=null,o=e.length;o--;){var s=e[o],c=s.qName,l=s.value,u=c.indexOf(`:`);if(u>0)var d=s.prefix=c.slice(0,u),f=c.slice(u+1),p=d===`xmlns`&&f;else f=c,d=null,p=c===`xmlns`&&``;s.localName=f,p!==!1&&(a??(a={},S(r,r={})),r[p]=a[p]=l,s.uri=t.XMLNS,n.startPrefixMapping(p,l))}for(var o=e.length;o--;){s=e[o];var d=s.prefix;d&&(d===`xml`&&(s.uri=t.XML),d!==`xmlns`&&(s.uri=r[d||``]))}var u=i.indexOf(`:`);u>0?(d=e.prefix=i.slice(0,u),f=e.localName=i.slice(u+1)):(d=null,f=e.localName=i);var m=e.uri=r[d||``];if(n.startElement(m,f,i,e),e.closed){if(n.endElement(m,f,i),a)for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&n.endPrefixMapping(d)}else return e.currentNSMap=r,e.localNSMap=a,!0}function b(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf(``,t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(n)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,r),i.characters(o,0,o.length),a)}return t+1}function x(e,t,n,r){var i=r[n];return i??(i=e.lastIndexOf(``),i`,t+4);return i>t?(n.comment(e,t+4,i-t-4),i+3):(r.error(`Unclosed comment`),-1)}else return-1;default:if(e.substr(t+3,6)==`CDATA[`){var i=e.indexOf(`]]>`,t+9);return n.startCDATA(),n.characters(e,t+9,i-t-9),n.endCDATA(),i+3}var a=E(e,t),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var s=a[1][0],c=!1,l=!1;o>3&&(/^public$/i.test(a[2][0])?(c=a[3][0],l=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var u=a[o-1];return n.startDTD(s,c,l),n.endDTD(),u.index+u[0].length}}return-1}function w(e,t,n){var r=e.indexOf(`?>`,t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function T(){this.attributeNames={}}T.prototype={setTagName:function(e){if(!i.test(e))throw Error(`invalid tagName:`+e);this.tagName=e},addValue:function(e,t,n){if(!i.test(e))throw Error(`invalid attribute:`+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function E(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);n=i.exec(e);)if(r.push(n),n[1])return r}e.XMLReader=m,e.ParseError=p})),S=e((e=>{var t=v(),n=y(),r=b(),i=x(),a=n.DOMImplementation,o=t.NAMESPACE,s=i.ParseError,c=i.XMLReader;function l(e){this.options=e||{locator:{}}}l.prototype.parseFromString=function(e,t){var n=this.options,i=new c,a=n.domBuilder||new d,s=n.errorHandler,l=n.locator,f=n.xmlns||{},p=/\/x?html?$/.test(t),m=p?r.HTML_ENTITIES:r.XML_ENTITIES;return l&&a.setDocumentLocator(l),i.errorHandler=u(s,a,l),i.domBuilder=n.domBuilder||a,p&&(f[``]=o.HTML),f.xml=f.xml||o.XML,e&&typeof e==`string`?i.parse(e,f,m):i.errorHandler.error(`invalid doc source`),a.doc};function u(e,t,n){if(!e){if(t instanceof d)return t;e=t}var r={},i=e instanceof Function;n||={};function a(t){var a=e[t];!a&&i&&(a=e.length==2?function(n){e(t,n)}:e),r[t]=a&&function(e){a(`[xmldom `+t+`] `+e+p(n))}||function(){}}return a(`warning`),a(`error`),a(`fatalError`),r}function d(){this.cdata=!1}function f(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}d.prototype={startDocument:function(){this.doc=new a().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,a=i.createElementNS(e,n||t),o=r.length;h(this,a),this.currentElement=a,this.locator&&f(this.locator,a);for(var s=0;s=t+n||t?new java.lang.String(e,t,n)+``:e}`endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl`.replace(/\w+/g,function(e){d.prototype[e]=function(){return null}});function h(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}e.__DOMHandler=d,e.DOMParser=l,e.DOMImplementation=n.DOMImplementation,e.XMLSerializer=n.XMLSerializer})),C=e((e=>{var t=y();e.DOMImplementation=t.DOMImplementation,e.XMLSerializer=t.XMLSerializer,e.DOMParser=S().DOMParser}))(),w={dataType:null,batchType:null,name:`KML (Keyhole Markup Language)`,id:`kml`,module:`kml`,version:`4.4.1`,extensions:[`kml`],mimeTypes:[`application/vnd.google-earth.kml+xml`],text:!0,tests:[` -`],parse:async(e,t)=>T(new TextDecoder().decode(e),t),parseTextSync:T,options:{kml:{shape:`geojson-table`},gis:{}}};function T(e,t){let n=_(new C.DOMParser().parseFromString(e,`text/xml`)),r={...w.options.kml,...t?.kml};switch(r.shape){case`geojson-table`:return{shape:`geojson-table`,type:`FeatureCollection`,features:n.features};case`object-row-table`:return{shape:`object-row-table`,data:n.features};default:throw Error(r.shape)}}var E,D,O;async function k(){let e,t=document.querySelector(`.mdc-linear-progress`);t&&(e=new mdc.linearProgress.MDCLinearProgress(t),e.open(),e.determinate=!1,e.done=function(){e.close(),t?.remove()});let n={lat:41.8692576,lng:-87.689769},{Map:r}=await google.maps.importLibrary(`maps`),i=document.getElementById(`map`);if(!i){console.error(`Map element not found!`);return}E=new r(i,{zoom:11,center:n,mapId:`6a17c323f461e521`,zoomControl:!0,clickableIcons:!1}),D=new deck.GeoJsonLayer({id:`geojson-layer`,data:`https://googlearchive.github.io/js-v2-samples/ggeoxml/cta.kml`,loaders:[w],pickable:!0,stroked:!0,filled:!1,extruded:!1,lineWidthScale:14,lineWidthMinPixels:4,getLineColor:e=>{let t=e.properties.color||e.properties.stroke;if(t){let e=A(t);if(e)return e}return[120,120,120,255]},getLineWidth:2,onDataLoad:()=>{e&&setTimeout(()=>{e.done()},100)},onHover:({object:e,x:t,y:n})=>{let r=document.getElementById(`tooltip`);if(r&&e){let i=`

${e.properties.name||`GeoJSON Feature`}

`;for(let t of[`description`,`styleUrl`,`color`,`stroke`,`stroke-width`,`fill`])e.properties.hasOwnProperty(t)&&e.properties[t]!==void 0&&(i+=`

${t}: ${e.properties[t]}

`);r.innerHTML=i,r.style.left=t+`px`,r.style.top=n+`px`,r.style.display=`block`}else r&&(r.style.display=`none`)}});let a=new deck.TextLayer({id:`text-layer`,data:D.props.data,getPosition:e=>{let t=[0,0];if(e.properties.centroid)t=e.properties.centroid;else if(e.geometry&&e.geometry.coordinates&&e.geometry.coordinates.length>0){let n=e.geometry.coordinates[0][0];n&&n.length>=2&&(t=[n[0],n[1]])}return t},getText:e=>e.properties.name||``,getColor:[0,0,0,255],getSize:16,getAngle:0,getTextAnchor:`middle`,getAlignmentBaseline:`middle`,parameters:{depthTest:!1}});O=new deck.GoogleMapsOverlay({layers:[D,a],parameters:{depthTest:!1}}),O.setMap(E)}function A(e){if(e.startsWith(`#`)&&(e=e.slice(1)),e.length===6)return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16),255];if(e.length===8){let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16);return[parseInt(e.substring(6,8),16),r,n,t]}return null}k(); \ No newline at end of file +`],parse:async(e,t)=>T(new TextDecoder().decode(e),t),parseTextSync:T,options:{kml:{shape:`geojson-table`},gis:{}}};function T(e,t){let n=_(new C.DOMParser().parseFromString(e,`text/xml`)),r={...w.options.kml,...t?.kml};switch(r.shape){case`geojson-table`:return{shape:`geojson-table`,type:`FeatureCollection`,features:n.features};case`object-row-table`:return{shape:`object-row-table`,data:n.features};default:throw Error(r.shape)}}var E,D,O;async function k(){let e,t=document.querySelector(`.mdc-linear-progress`);t&&(e=new mdc.linearProgress.MDCLinearProgress(t),e.open(),e.determinate=!1,e.done=function(){e.close(),t?.remove()});let n={lat:41.8692576,lng:-87.689769},{Map:r}=await google.maps.importLibrary(`maps`),i=document.getElementById(`map`);if(!i){console.error(`Map element not found!`);return}E=new r(i,{zoom:11,center:n,mapId:`6a17c323f461e521`,zoomControl:!0,clickableIcons:!1}),D=new deck.GeoJsonLayer({id:`geojson-layer`,data:`https://googlearchive.github.io/js-v2-samples/ggeoxml/cta.kml`,loaders:[w],pickable:!0,stroked:!0,filled:!1,extruded:!1,lineWidthScale:14,lineWidthMinPixels:4,getLineColor:e=>{let t=e.properties.color||e.properties.stroke;if(t){let e=A(t);if(e)return e}return[120,120,120,255]},getLineWidth:2,onDataLoad:()=>{e&&setTimeout(()=>{e.done?.()},100)},onHover:({object:e,x:t,y:n})=>{let r=document.getElementById(`tooltip`);if(r&&e){let i=`

${e.properties.name||`GeoJSON Feature`}

`;for(let t of[`description`,`styleUrl`,`color`,`stroke`,`stroke-width`,`fill`])e.properties.hasOwnProperty(t)&&e.properties[t]!==void 0&&(i+=`

${t}: ${e.properties[t]}

`);r.innerHTML=i,r.style.left=t+`px`,r.style.top=n+`px`,r.style.display=`block`}else r&&(r.style.display=`none`)}});let a=new deck.TextLayer({id:`text-layer`,data:D.props.data,getPosition:e=>{let t=[0,0];if(e.properties.centroid)t=e.properties.centroid;else if(e.geometry?.coordinates&&e.geometry.coordinates.length>0){let n=e.geometry.coordinates[0][0];n&&n.length>=2&&(t=[n[0],n[1]])}return t},getText:e=>e.properties.name||``,getColor:[0,0,0,255],getSize:16,getAngle:0,getTextAnchor:`middle`,getAlignmentBaseline:`middle`,parameters:{depthTest:!1}});O=new deck.GoogleMapsOverlay({layers:[D,a],parameters:{depthTest:!1}}),O.setMap(E)}function A(e){if(e.startsWith(`#`)&&(e=e.slice(1)),e.length===6)return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16),255];if(e.length===8){let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16);return[parseInt(e.substring(6,8),16),r,n,t]}return null}k(); \ No newline at end of file diff --git a/dist/samples/deckgl-kml/dist/index.html b/dist/samples/deckgl-kml/dist/index.html index 96b2afe31..6908f4488 100644 --- a/dist/samples/deckgl-kml/dist/index.html +++ b/dist/samples/deckgl-kml/dist/index.html @@ -25,7 +25,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/deckgl-kml/docs/index.js b/dist/samples/deckgl-kml/docs/index.js index f3151e327..af8f17017 100644 --- a/dist/samples/deckgl-kml/docs/index.js +++ b/dist/samples/deckgl-kml/docs/index.js @@ -20,7 +20,6 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; @@ -81,7 +80,7 @@ async function init() { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } }, @@ -126,8 +125,7 @@ async function init() { if (d.properties.centroid) { position = d.properties.centroid; } else if ( - d.geometry && - d.geometry.coordinates && + d.geometry?.coordinates && d.geometry.coordinates.length > 0 ) { // Assuming Polygon or MultiPolygon diff --git a/dist/samples/deckgl-kml/docs/index.ts b/dist/samples/deckgl-kml/docs/index.ts index f0c1a7ba2..1a40ddeca 100644 --- a/dist/samples/deckgl-kml/docs/index.ts +++ b/dist/samples/deckgl-kml/docs/index.ts @@ -5,6 +5,10 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* [START maps_deckgl_kml] */ // Import necessary loader @@ -43,6 +47,19 @@ declare namespace deck { // Add other Deck.gl types used globally if needed } +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Initialize and add the map let map: google.maps.Map; let geojsonLayer: deck.GeoJsonLayer; @@ -50,12 +67,11 @@ let googleMapsOverlay: deck.GoogleMapsOverlay; async function init(): Promise { // Progress bar logic moved from index.html - let progress; + let progress: mdc.linearProgress.MDCLinearProgress; const progressDiv = document.querySelector('.mdc-linear-progress')!; if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; @@ -116,7 +132,7 @@ async function init(): Promise { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } }, @@ -161,8 +177,7 @@ async function init(): Promise { if (d.properties.centroid) { position = d.properties.centroid; } else if ( - d.geometry && - d.geometry.coordinates && + d.geometry?.coordinates && d.geometry.coordinates.length > 0 ) { // Assuming Polygon or MultiPolygon diff --git a/dist/samples/deckgl-kml/jsfiddle/demo.js b/dist/samples/deckgl-kml/jsfiddle/demo.js index 32ed8a0ac..2630483d5 100644 --- a/dist/samples/deckgl-kml/jsfiddle/demo.js +++ b/dist/samples/deckgl-kml/jsfiddle/demo.js @@ -19,7 +19,6 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; @@ -80,7 +79,7 @@ async function init() { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress.done?.(); // hides progress bar }, 100); // 100ms delay } }, @@ -125,8 +124,7 @@ async function init() { if (d.properties.centroid) { position = d.properties.centroid; } else if ( - d.geometry && - d.geometry.coordinates && + d.geometry?.coordinates && d.geometry.coordinates.length > 0 ) { // Assuming Polygon or MultiPolygon diff --git a/dist/samples/deckgl-polygon/app/index.ts b/dist/samples/deckgl-polygon/app/index.ts index f345fd6b5..a83ddc536 100644 --- a/dist/samples/deckgl-polygon/app/index.ts +++ b/dist/samples/deckgl-polygon/app/index.ts @@ -3,8 +3,9 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ - /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* [START maps_deckgl_polygon] */ // Initialize and add the map @@ -12,6 +13,19 @@ let map: google.maps.Map; let polygonLayer: deck.PolygonLayer; // Declare polygonLayer outside for button access let googleMapsOverlay: deck.GoogleMapsOverlay; // Declare googleMapsOverlay outside for button access +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Declare global namespace for Deck.gl to satisfy TypeScript compiler declare namespace deck { class PolygonLayer { @@ -30,18 +44,17 @@ declare namespace deck { async function init(): Promise { // Progress bar logic moved from index.html - let progress; - const progressDiv = document.querySelector('.mdc-linear-progress')!; + let progress: mdc.linearProgress.MDCLinearProgress | undefined; + const progressDiv = document.querySelector('.mdc-linear-progress'); if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { - progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progress!.close(); + progressDiv.remove(); }; } @@ -88,7 +101,7 @@ async function init(): Promise { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress?.done?.(); // hides progress bar }, 100); // 100ms delay } }, diff --git a/dist/samples/deckgl-polygon/dist/assets/index-C2MR-4vh.js b/dist/samples/deckgl-polygon/dist/assets/index-C2MR-4vh.js new file mode 100644 index 000000000..349b9e790 --- /dev/null +++ b/dist/samples/deckgl-polygon/dist/assets/index-C2MR-4vh.js @@ -0,0 +1 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n;async function r(){let r,i=document.querySelector(`.mdc-linear-progress`);i&&(r=new mdc.linearProgress.MDCLinearProgress(i),r.open(),r.determinate=!1,r.done=function(){r.close(),i.remove()});let a={lat:37.752954624496304,lng:-122.44754059928648},{Map:o}=await google.maps.importLibrary(`maps`),s=document.getElementById(`map`);if(!s){console.error(`Map element not found!`);return}e=new o(s,{zoom:12,center:a,tilt:90,heading:-25,mapId:`c306b3c6dd3ed8d9`,streetViewControl:!1}),t=new deck.PolygonLayer({id:`PolygonLayer`,data:`https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-zipcodes.json`,getPolygon:e=>e.contour,getElevation:e=>e.population/e.area/10,getFillColor:e=>[e.population/e.area/60,140,0],getLineColor:[255,255,255],getLineWidth:20,lineWidthMinPixels:1,visible:!0,opacity:.7,pickable:!0,onDataLoad:()=>{r&&setTimeout(()=>{r?.done?.()},100)},onHover:({object:e,x:t,y:n})=>{let r=document.getElementById(`tooltip`);if(r)if(e){let i=``,a=e;a&&(a.zipcode!==void 0&&(i+=`Zipcode: ${a.zipcode}
`),a.population!==void 0&&(i+=`Population: ${a.population}
`),a.area!==void 0&&(i+=`Area: ${a.area}
`)),r.innerHTML=i,r.style.left=t+`px`,r.style.top=n+`px`,r.style.display=`block`}else r.style.display=`none`}}),n=new deck.GoogleMapsOverlay({layers:[t]}),n.setMap(e);let c=document.getElementById(`toggleButton`);c&&c.addEventListener(`click`,()=>{let e=t.props.visible,r=t.clone({visible:!e});n.setProps({layers:[r]}),t=r,c.textContent=e?`Show Polygon Layer`:`Hide Polygon Layer`})}r(); \ No newline at end of file diff --git a/dist/samples/deckgl-polygon/dist/assets/index-CanQ9InY.js b/dist/samples/deckgl-polygon/dist/assets/index-CanQ9InY.js deleted file mode 100644 index aa0f5186a..000000000 --- a/dist/samples/deckgl-polygon/dist/assets/index-CanQ9InY.js +++ /dev/null @@ -1 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n;async function r(){let r,i=document.querySelector(`.mdc-linear-progress`);i&&(r=new mdc.linearProgress.MDCLinearProgress(i),r.open(),r.determinate=!1,r.done=function(){r.close(),i?.remove()});let a={lat:37.752954624496304,lng:-122.44754059928648},{Map:o}=await google.maps.importLibrary(`maps`),s=document.getElementById(`map`);if(!s){console.error(`Map element not found!`);return}e=new o(s,{zoom:12,center:a,tilt:90,heading:-25,mapId:`c306b3c6dd3ed8d9`,streetViewControl:!1}),t=new deck.PolygonLayer({id:`PolygonLayer`,data:`https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-zipcodes.json`,getPolygon:e=>e.contour,getElevation:e=>e.population/e.area/10,getFillColor:e=>[e.population/e.area/60,140,0],getLineColor:[255,255,255],getLineWidth:20,lineWidthMinPixels:1,visible:!0,opacity:.7,pickable:!0,onDataLoad:()=>{r&&setTimeout(()=>{r.done()},100)},onHover:({object:e,x:t,y:n})=>{let r=document.getElementById(`tooltip`);if(r)if(e){let i=``,a=e;a&&(a.zipcode!==void 0&&(i+=`Zipcode: ${a.zipcode}
`),a.population!==void 0&&(i+=`Population: ${a.population}
`),a.area!==void 0&&(i+=`Area: ${a.area}
`)),r.innerHTML=i,r.style.left=t+`px`,r.style.top=n+`px`,r.style.display=`block`}else r.style.display=`none`}}),n=new deck.GoogleMapsOverlay({layers:[t]}),n.setMap(e);let c=document.getElementById(`toggleButton`);c&&c.addEventListener(`click`,()=>{let e=t.props.visible,r=t.clone({visible:!e});n.setProps({layers:[r]}),t=r,c.textContent=e?`Show Polygon Layer`:`Hide Polygon Layer`})}r(); \ No newline at end of file diff --git a/dist/samples/deckgl-polygon/dist/index.html b/dist/samples/deckgl-polygon/dist/index.html index 64f0363aa..c29b6117f 100644 --- a/dist/samples/deckgl-polygon/dist/index.html +++ b/dist/samples/deckgl-polygon/dist/index.html @@ -24,7 +24,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/deckgl-polygon/docs/index.js b/dist/samples/deckgl-polygon/docs/index.js index 75be61fc2..ae2b76e7e 100644 --- a/dist/samples/deckgl-polygon/docs/index.js +++ b/dist/samples/deckgl-polygon/docs/index.js @@ -18,13 +18,12 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progressDiv.remove(); }; } @@ -71,7 +70,7 @@ async function init() { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress?.done?.(); // hides progress bar }, 100); // 100ms delay } }, diff --git a/dist/samples/deckgl-polygon/docs/index.ts b/dist/samples/deckgl-polygon/docs/index.ts index f345fd6b5..a83ddc536 100644 --- a/dist/samples/deckgl-polygon/docs/index.ts +++ b/dist/samples/deckgl-polygon/docs/index.ts @@ -3,8 +3,9 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ - /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* [START maps_deckgl_polygon] */ // Initialize and add the map @@ -12,6 +13,19 @@ let map: google.maps.Map; let polygonLayer: deck.PolygonLayer; // Declare polygonLayer outside for button access let googleMapsOverlay: deck.GoogleMapsOverlay; // Declare googleMapsOverlay outside for button access +// Declare global namespace for MDC to satisfy TypeScript compiler +declare namespace mdc { + namespace linearProgress { + class MDCLinearProgress { + constructor(el: Element); + open(): void; + close(): void; + determinate: boolean; + done?: () => void; + } + } +} + // Declare global namespace for Deck.gl to satisfy TypeScript compiler declare namespace deck { class PolygonLayer { @@ -30,18 +44,17 @@ declare namespace deck { async function init(): Promise { // Progress bar logic moved from index.html - let progress; - const progressDiv = document.querySelector('.mdc-linear-progress')!; + let progress: mdc.linearProgress.MDCLinearProgress | undefined; + const progressDiv = document.querySelector('.mdc-linear-progress'); if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - // @ts-expect-error: mdc not typed progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { - progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progress!.close(); + progressDiv.remove(); }; } @@ -88,7 +101,7 @@ async function init(): Promise { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress?.done?.(); // hides progress bar }, 100); // 100ms delay } }, diff --git a/dist/samples/deckgl-polygon/jsfiddle/demo.js b/dist/samples/deckgl-polygon/jsfiddle/demo.js index 43833352c..089c35d1c 100644 --- a/dist/samples/deckgl-polygon/jsfiddle/demo.js +++ b/dist/samples/deckgl-polygon/jsfiddle/demo.js @@ -17,13 +17,12 @@ async function init() { if (progressDiv) { // Assuming 'mdc' is globally available, potentially loaded via a script tag // If not, you might need to import it or add type definitions. - progress = new mdc.linearProgress.MDCLinearProgress(progressDiv); progress.open(); progress.determinate = false; progress.done = function () { progress.close(); - progressDiv?.remove(); // Use optional chaining in case progressDiv is null + progressDiv.remove(); }; } @@ -70,7 +69,7 @@ async function init() { // Check if progress is defined // Add a small delay to ensure the progress bar is removed setTimeout(() => { - progress.done(); // hides progress bar + progress?.done?.(); // hides progress bar }, 100); // 100ms delay } }, diff --git a/dist/samples/deckgl-tripslayer/app/index.ts b/dist/samples/deckgl-tripslayer/app/index.ts index eeef08617..839d4ba03 100644 --- a/dist/samples/deckgl-tripslayer/app/index.ts +++ b/dist/samples/deckgl-tripslayer/app/index.ts @@ -49,7 +49,8 @@ async function init() { shadowEnabled: false, }; - const overlay = new GoogleMapsOverlay({}); + const googleMapsOverlayProps = {}; + const overlay = new GoogleMapsOverlay(googleMapsOverlayProps); const animate = () => { currentTime = (currentTime + 1) % LOOP_LENGTH; diff --git a/dist/samples/deckgl-tripslayer/docs/index.js b/dist/samples/deckgl-tripslayer/docs/index.js index 6586507cc..e01d89526 100644 --- a/dist/samples/deckgl-tripslayer/docs/index.js +++ b/dist/samples/deckgl-tripslayer/docs/index.js @@ -42,7 +42,8 @@ async function init() { shadowEnabled: false, }; - const overlay = new GoogleMapsOverlay({}); + const googleMapsOverlayProps = {}; + const overlay = new GoogleMapsOverlay(googleMapsOverlayProps); const animate = () => { currentTime = (currentTime + 1) % LOOP_LENGTH; diff --git a/dist/samples/deckgl-tripslayer/docs/index.ts b/dist/samples/deckgl-tripslayer/docs/index.ts index eeef08617..839d4ba03 100644 --- a/dist/samples/deckgl-tripslayer/docs/index.ts +++ b/dist/samples/deckgl-tripslayer/docs/index.ts @@ -49,7 +49,8 @@ async function init() { shadowEnabled: false, }; - const overlay = new GoogleMapsOverlay({}); + const googleMapsOverlayProps = {}; + const overlay = new GoogleMapsOverlay(googleMapsOverlayProps); const animate = () => { currentTime = (currentTime + 1) % LOOP_LENGTH; diff --git a/dist/samples/deckgl-tripslayer/jsfiddle/demo.js b/dist/samples/deckgl-tripslayer/jsfiddle/demo.js index c155a54b1..8d2693bc4 100644 --- a/dist/samples/deckgl-tripslayer/jsfiddle/demo.js +++ b/dist/samples/deckgl-tripslayer/jsfiddle/demo.js @@ -42,7 +42,8 @@ async function init() { shadowEnabled: false, }; - const overlay = new GoogleMapsOverlay({}); + const googleMapsOverlayProps = {}; + const overlay = new GoogleMapsOverlay(googleMapsOverlayProps); const animate = () => { currentTime = (currentTime + 1) % LOOP_LENGTH; diff --git a/dist/samples/event-arguments/app/index.ts b/dist/samples/event-arguments/app/index.ts index f81dd1d6b..9ba42f92b 100644 --- a/dist/samples/event-arguments/app/index.ts +++ b/dist/samples/event-arguments/app/index.ts @@ -15,12 +15,13 @@ async function init() { const mapElement = document.querySelector('gmp-map')!; const innerMap = mapElement.innerMap; - innerMap.addListener('click', (e) => { + innerMap.addListener('click', (event: google.maps.MapMouseEvent) => { + if (!event.latLng) return; new AdvancedMarkerElement({ - position: e.latLng, + position: event.latLng, map: innerMap, }); - innerMap.panTo(e.latLng); + innerMap.panTo(event.latLng); }); } diff --git a/dist/samples/event-arguments/dist/assets/index-l7pdboKs.js b/dist/samples/event-arguments/dist/assets/index-Cmf1OREf.js similarity index 91% rename from dist/samples/event-arguments/dist/assets/index-l7pdboKs.js rename to dist/samples/event-arguments/dist/assets/index-Cmf1OREf.js index 5a6deba4f..9b0ceb73d 100644 --- a/dist/samples/event-arguments/dist/assets/index-l7pdboKs.js +++ b/dist/samples/event-arguments/dist/assets/index-Cmf1OREf.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{AdvancedMarkerElement:e}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),t=document.querySelector(`gmp-map`).innerMap;t.addListener(`click`,n=>{new e({position:n.latLng,map:t}),t.panTo(n.latLng)})}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{AdvancedMarkerElement:e}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),t=document.querySelector(`gmp-map`).innerMap;t.addListener(`click`,n=>{n.latLng&&(new e({position:n.latLng,map:t}),t.panTo(n.latLng))})}e(); \ No newline at end of file diff --git a/dist/samples/event-arguments/dist/index.html b/dist/samples/event-arguments/dist/index.html index 9e56f9100..d373a25c7 100644 --- a/dist/samples/event-arguments/dist/index.html +++ b/dist/samples/event-arguments/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/event-arguments/docs/index.js b/dist/samples/event-arguments/docs/index.js index c1c542160..0a1af7755 100644 --- a/dist/samples/event-arguments/docs/index.js +++ b/dist/samples/event-arguments/docs/index.js @@ -16,12 +16,13 @@ async function init() { const mapElement = document.querySelector('gmp-map'); const innerMap = mapElement.innerMap; - innerMap.addListener('click', (e) => { + innerMap.addListener('click', (event) => { + if (!event.latLng) return; new AdvancedMarkerElement({ - position: e.latLng, + position: event.latLng, map: innerMap, }); - innerMap.panTo(e.latLng); + innerMap.panTo(event.latLng); }); } diff --git a/dist/samples/event-arguments/docs/index.ts b/dist/samples/event-arguments/docs/index.ts index f81dd1d6b..9ba42f92b 100644 --- a/dist/samples/event-arguments/docs/index.ts +++ b/dist/samples/event-arguments/docs/index.ts @@ -15,12 +15,13 @@ async function init() { const mapElement = document.querySelector('gmp-map')!; const innerMap = mapElement.innerMap; - innerMap.addListener('click', (e) => { + innerMap.addListener('click', (event: google.maps.MapMouseEvent) => { + if (!event.latLng) return; new AdvancedMarkerElement({ - position: e.latLng, + position: event.latLng, map: innerMap, }); - innerMap.panTo(e.latLng); + innerMap.panTo(event.latLng); }); } diff --git a/dist/samples/event-arguments/jsfiddle/demo.js b/dist/samples/event-arguments/jsfiddle/demo.js index 0f74b5bf7..22e68bf2e 100644 --- a/dist/samples/event-arguments/jsfiddle/demo.js +++ b/dist/samples/event-arguments/jsfiddle/demo.js @@ -15,12 +15,13 @@ async function init() { const mapElement = document.querySelector('gmp-map'); const innerMap = mapElement.innerMap; - innerMap.addListener('click', (e) => { + innerMap.addListener('click', (event) => { + if (!event.latLng) return; new AdvancedMarkerElement({ - position: e.latLng, + position: event.latLng, map: innerMap, }); - innerMap.panTo(e.latLng); + innerMap.panTo(event.latLng); }); } diff --git a/dist/samples/event-click-latlng/app/index.ts b/dist/samples/event-click-latlng/app/index.ts index 13a3c14f0..b9b5a70d6 100644 --- a/dist/samples/event-click-latlng/app/index.ts +++ b/dist/samples/event-click-latlng/app/index.ts @@ -26,19 +26,22 @@ async function init() { // [START maps_event_click_latlng_listener] // Configure the click listener. - innerMap.addListener('click', (mapsMouseEvent) => { - // Close the current InfoWindow. - infoWindow.close(); - - // Create a new InfoWindow. - infoWindow = new InfoWindow({ - position: mapsMouseEvent.latLng, - }); - infoWindow.setContent( - JSON.stringify(mapsMouseEvent.latLng.toJSON(), null, 2) - ); - infoWindow.open(innerMap); - }); + innerMap.addListener( + 'click', + (mapsMouseEvent: google.maps.MapMouseEvent) => { + // Close the current InfoWindow. + infoWindow.close(); + + // Create a new InfoWindow. + infoWindow = new InfoWindow({ + position: mapsMouseEvent.latLng, + }); + infoWindow.setContent( + JSON.stringify(mapsMouseEvent.latLng!.toJSON(), null, 2) + ); + infoWindow.open(innerMap); + } + ); // [END maps_event_click_latlng_listener] } diff --git a/dist/samples/event-click-latlng/docs/index.ts b/dist/samples/event-click-latlng/docs/index.ts index 13a3c14f0..b9b5a70d6 100644 --- a/dist/samples/event-click-latlng/docs/index.ts +++ b/dist/samples/event-click-latlng/docs/index.ts @@ -26,19 +26,22 @@ async function init() { // [START maps_event_click_latlng_listener] // Configure the click listener. - innerMap.addListener('click', (mapsMouseEvent) => { - // Close the current InfoWindow. - infoWindow.close(); - - // Create a new InfoWindow. - infoWindow = new InfoWindow({ - position: mapsMouseEvent.latLng, - }); - infoWindow.setContent( - JSON.stringify(mapsMouseEvent.latLng.toJSON(), null, 2) - ); - infoWindow.open(innerMap); - }); + innerMap.addListener( + 'click', + (mapsMouseEvent: google.maps.MapMouseEvent) => { + // Close the current InfoWindow. + infoWindow.close(); + + // Create a new InfoWindow. + infoWindow = new InfoWindow({ + position: mapsMouseEvent.latLng, + }); + infoWindow.setContent( + JSON.stringify(mapsMouseEvent.latLng!.toJSON(), null, 2) + ); + infoWindow.open(innerMap); + } + ); // [END maps_event_click_latlng_listener] } diff --git a/dist/samples/event-closure/app/index.ts b/dist/samples/event-closure/app/index.ts index ac473084e..cdfc63c40 100644 --- a/dist/samples/event-closure/app/index.ts +++ b/dist/samples/event-closure/app/index.ts @@ -33,7 +33,7 @@ async function init() { const lngSpan = bounds.east - bounds.west; const latSpan = bounds.north - bounds.south; - for (let i = 0; i < secretMessages.length; ++i) { + for (const secretMessage of secretMessages) { const marker = new AdvancedMarkerElement({ position: { lat: bounds.south + latSpan * Math.random(), @@ -42,7 +42,7 @@ async function init() { map: innerMap, }); - void attachSecretMessage(marker, secretMessages[i]); + void attachSecretMessage(marker, secretMessage); } } diff --git a/dist/samples/event-closure/dist/assets/index-CguLmy-g.js b/dist/samples/event-closure/dist/assets/index-BWtYwPd-.js similarity index 77% rename from dist/samples/event-closure/dist/assets/index-CguLmy-g.js rename to dist/samples/event-closure/dist/assets/index-BWtYwPd-.js index e166b4214..90bf18a68 100644 --- a/dist/samples/event-closure/dist/assets/index-CguLmy-g.js +++ b/dist/samples/event-closure/dist/assets/index-BWtYwPd-.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{AdvancedMarkerElement:e}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),n=document.querySelector(`gmp-map`).innerMap,r={north:-25.363882,south:-31.203405,east:131.044922,west:125.244141};n.fitBounds(r);let i=[`This`,`is`,`the`,`secret`,`message`],a=r.east-r.west,o=r.north-r.south;for(let s=0;s{r.open(e.map,e)})}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{AdvancedMarkerElement:e}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),n=document.querySelector(`gmp-map`).innerMap,r={north:-25.363882,south:-31.203405,east:131.044922,west:125.244141};n.fitBounds(r);let i=[`This`,`is`,`the`,`secret`,`message`],a=r.east-r.west,o=r.north-r.south;for(let s of i)t(new e({position:{lat:r.south+o*Math.random(),lng:r.west+a*Math.random()},map:n}),s)}async function t(e,t){let{InfoWindow:n}=await google.maps.importLibrary(`maps`),r=new n({content:t});e.addListener(`gmp-click`,()=>{r.open(e.map,e)})}e(); \ No newline at end of file diff --git a/dist/samples/event-closure/dist/index.html b/dist/samples/event-closure/dist/index.html index 80dc4336b..1aff6b9b3 100644 --- a/dist/samples/event-closure/dist/index.html +++ b/dist/samples/event-closure/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/event-closure/docs/index.js b/dist/samples/event-closure/docs/index.js index 492879058..fc0ec12e4 100644 --- a/dist/samples/event-closure/docs/index.js +++ b/dist/samples/event-closure/docs/index.js @@ -34,7 +34,7 @@ async function init() { const lngSpan = bounds.east - bounds.west; const latSpan = bounds.north - bounds.south; - for (let i = 0; i < secretMessages.length; ++i) { + for (const secretMessage of secretMessages) { const marker = new AdvancedMarkerElement({ position: { lat: bounds.south + latSpan * Math.random(), @@ -43,7 +43,7 @@ async function init() { map: innerMap, }); - void attachSecretMessage(marker, secretMessages[i]); + void attachSecretMessage(marker, secretMessage); } } diff --git a/dist/samples/event-closure/docs/index.ts b/dist/samples/event-closure/docs/index.ts index ac473084e..cdfc63c40 100644 --- a/dist/samples/event-closure/docs/index.ts +++ b/dist/samples/event-closure/docs/index.ts @@ -33,7 +33,7 @@ async function init() { const lngSpan = bounds.east - bounds.west; const latSpan = bounds.north - bounds.south; - for (let i = 0; i < secretMessages.length; ++i) { + for (const secretMessage of secretMessages) { const marker = new AdvancedMarkerElement({ position: { lat: bounds.south + latSpan * Math.random(), @@ -42,7 +42,7 @@ async function init() { map: innerMap, }); - void attachSecretMessage(marker, secretMessages[i]); + void attachSecretMessage(marker, secretMessage); } } diff --git a/dist/samples/event-closure/jsfiddle/demo.js b/dist/samples/event-closure/jsfiddle/demo.js index cd5c929d6..666a6a674 100644 --- a/dist/samples/event-closure/jsfiddle/demo.js +++ b/dist/samples/event-closure/jsfiddle/demo.js @@ -33,7 +33,7 @@ async function init() { const lngSpan = bounds.east - bounds.west; const latSpan = bounds.north - bounds.south; - for (let i = 0; i < secretMessages.length; ++i) { + for (const secretMessage of secretMessages) { const marker = new AdvancedMarkerElement({ position: { lat: bounds.south + latSpan * Math.random(), @@ -42,7 +42,7 @@ async function init() { map: innerMap, }); - void attachSecretMessage(marker, secretMessages[i]); + void attachSecretMessage(marker, secretMessage); } } diff --git a/dist/samples/event-poi/app/index.ts b/dist/samples/event-poi/app/index.ts index 81883fd38..0dabe0828 100644 --- a/dist/samples/event-poi/app/index.ts +++ b/dist/samples/event-poi/app/index.ts @@ -19,21 +19,24 @@ async function init() { innerMap = mapElement.innerMap; // Create the initial info window. - const infoWindow = new InfoWindow({}); + const infoWindow = new InfoWindow(); // Add a listener for click events on the map. - innerMap.addListener('click', (event) => { - // Prevent the default POI info window from showing. - event.stop(); - - // If the event has a placeId, show the info window. - if (isIconMouseEvent(event) && event.placeId) { - void showInfoWindow(event, infoWindow); - } else { - // Close the info window if there is no placeId. - infoWindow.close(); + innerMap.addListener( + 'click', + (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => { + // Prevent the default POI info window from showing. + event.stop(); + + // If the event has a placeId, show the info window. + if (isIconMouseEvent(event) && event.placeId) { + void showInfoWindow(event, infoWindow); + } else { + // Close the info window if there is no placeId. + infoWindow.close(); + } } - }); + ); } // Helper function to show the info window. @@ -41,6 +44,8 @@ async function showInfoWindow( event: google.maps.IconMouseEvent, infoWindow: google.maps.InfoWindow ) { + if (!event.placeId) return; + const { Size } = await google.maps.importLibrary('core'); // Retrieve the place details for the selected POI. @@ -65,7 +70,7 @@ async function showInfoWindow( position: event.latLng, pixelOffset: new Size(0, -30), headerContent: name, - content: content, + content, }); innerMap.panTo(event.latLng!); @@ -73,7 +78,7 @@ async function showInfoWindow( } // Helper function to get place details. -async function getPlaceDetails(placeId) { +async function getPlaceDetails(placeId: string) { // Import the Places library. const { Place } = await google.maps.importLibrary('places'); diff --git a/dist/samples/event-poi/dist/assets/index-DLcvfDXA.js b/dist/samples/event-poi/dist/assets/index-D32PtEyh.js similarity index 50% rename from dist/samples/event-poi/dist/assets/index-DLcvfDXA.js rename to dist/samples/event-poi/dist/assets/index-D32PtEyh.js index 4b3a3a677..770dbc4c0 100644 --- a/dist/samples/event-poi/dist/assets/index-DLcvfDXA.js +++ b/dist/samples/event-poi/dist/assets/index-D32PtEyh.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){google.maps.importLibrary(`core`);let{InfoWindow:t}=await google.maps.importLibrary(`maps`);e=document.querySelector(`gmp-map`).innerMap;let r=new t({});e.addListener(`click`,e=>{e.stop(),i(e)&&e.placeId?n(e,r):r.close()})}async function n(t,n){let{Size:i}=await google.maps.importLibrary(`core`),a=await r(t.placeId),o=document.createElement(`div`),s=document.createElement(`div`),c=document.createElement(`div`);s.textContent=a.formattedAddress||``,c.textContent=a.id||``,o.append(s,c);let l=document.createElement(`div`);l.style.fontWeight=`bold`,l.style.fontSize=`medium`,l.textContent=a.displayName||``,n.setOptions({position:t.latLng,pixelOffset:new i(0,-30),headerContent:l,content:o}),e.panTo(t.latLng),n.open(e)}async function r(e){let{Place:t}=await google.maps.importLibrary(`places`),n=new t({id:e});return await n.fetchFields({fields:[`displayName`,`formattedAddress`]}),n}function i(e){return`placeId`in e}t(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){google.maps.importLibrary(`core`);let{InfoWindow:t}=await google.maps.importLibrary(`maps`);e=document.querySelector(`gmp-map`).innerMap;let r=new t;e.addListener(`click`,e=>{e.stop(),i(e)&&e.placeId?n(e,r):r.close()})}async function n(t,n){if(!t.placeId)return;let{Size:i}=await google.maps.importLibrary(`core`),a=await r(t.placeId),o=document.createElement(`div`),s=document.createElement(`div`),c=document.createElement(`div`);s.textContent=a.formattedAddress||``,c.textContent=a.id||``,o.append(s,c);let l=document.createElement(`div`);l.style.fontWeight=`bold`,l.style.fontSize=`medium`,l.textContent=a.displayName||``,n.setOptions({position:t.latLng,pixelOffset:new i(0,-30),headerContent:l,content:o}),e.panTo(t.latLng),n.open(e)}async function r(e){let{Place:t}=await google.maps.importLibrary(`places`),n=new t({id:e});return await n.fetchFields({fields:[`displayName`,`formattedAddress`]}),n}function i(e){return`placeId`in e}t(); \ No newline at end of file diff --git a/dist/samples/event-poi/dist/index.html b/dist/samples/event-poi/dist/index.html index 8ae745865..991845c9a 100644 --- a/dist/samples/event-poi/dist/index.html +++ b/dist/samples/event-poi/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/event-poi/docs/index.js b/dist/samples/event-poi/docs/index.js index 7403d338b..3030de28a 100644 --- a/dist/samples/event-poi/docs/index.js +++ b/dist/samples/event-poi/docs/index.js @@ -20,7 +20,7 @@ async function init() { innerMap = mapElement.innerMap; // Create the initial info window. - const infoWindow = new InfoWindow({}); + const infoWindow = new InfoWindow(); // Add a listener for click events on the map. innerMap.addListener('click', (event) => { @@ -39,6 +39,8 @@ async function init() { // Helper function to show the info window. async function showInfoWindow(event, infoWindow) { + if (!event.placeId) return; + const { Size } = await google.maps.importLibrary('core'); // Retrieve the place details for the selected POI. @@ -63,7 +65,7 @@ async function showInfoWindow(event, infoWindow) { position: event.latLng, pixelOffset: new Size(0, -30), headerContent: name, - content: content, + content, }); innerMap.panTo(event.latLng); diff --git a/dist/samples/event-poi/docs/index.ts b/dist/samples/event-poi/docs/index.ts index 81883fd38..0dabe0828 100644 --- a/dist/samples/event-poi/docs/index.ts +++ b/dist/samples/event-poi/docs/index.ts @@ -19,21 +19,24 @@ async function init() { innerMap = mapElement.innerMap; // Create the initial info window. - const infoWindow = new InfoWindow({}); + const infoWindow = new InfoWindow(); // Add a listener for click events on the map. - innerMap.addListener('click', (event) => { - // Prevent the default POI info window from showing. - event.stop(); - - // If the event has a placeId, show the info window. - if (isIconMouseEvent(event) && event.placeId) { - void showInfoWindow(event, infoWindow); - } else { - // Close the info window if there is no placeId. - infoWindow.close(); + innerMap.addListener( + 'click', + (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => { + // Prevent the default POI info window from showing. + event.stop(); + + // If the event has a placeId, show the info window. + if (isIconMouseEvent(event) && event.placeId) { + void showInfoWindow(event, infoWindow); + } else { + // Close the info window if there is no placeId. + infoWindow.close(); + } } - }); + ); } // Helper function to show the info window. @@ -41,6 +44,8 @@ async function showInfoWindow( event: google.maps.IconMouseEvent, infoWindow: google.maps.InfoWindow ) { + if (!event.placeId) return; + const { Size } = await google.maps.importLibrary('core'); // Retrieve the place details for the selected POI. @@ -65,7 +70,7 @@ async function showInfoWindow( position: event.latLng, pixelOffset: new Size(0, -30), headerContent: name, - content: content, + content, }); innerMap.panTo(event.latLng!); @@ -73,7 +78,7 @@ async function showInfoWindow( } // Helper function to get place details. -async function getPlaceDetails(placeId) { +async function getPlaceDetails(placeId: string) { // Import the Places library. const { Place } = await google.maps.importLibrary('places'); diff --git a/dist/samples/event-poi/jsfiddle/demo.js b/dist/samples/event-poi/jsfiddle/demo.js index 3f6b1ba24..ba12acf07 100644 --- a/dist/samples/event-poi/jsfiddle/demo.js +++ b/dist/samples/event-poi/jsfiddle/demo.js @@ -19,7 +19,7 @@ async function init() { innerMap = mapElement.innerMap; // Create the initial info window. - const infoWindow = new InfoWindow({}); + const infoWindow = new InfoWindow(); // Add a listener for click events on the map. innerMap.addListener('click', (event) => { @@ -38,6 +38,8 @@ async function init() { // Helper function to show the info window. async function showInfoWindow(event, infoWindow) { + if (!event.placeId) return; + const { Size } = await google.maps.importLibrary('core'); // Retrieve the place details for the selected POI. @@ -62,7 +64,7 @@ async function showInfoWindow(event, infoWindow) { position: event.latLng, pixelOffset: new Size(0, -30), headerContent: name, - content: content, + content, }); innerMap.panTo(event.latLng); diff --git a/dist/samples/geocoding-place-id/app/index.ts b/dist/samples/geocoding-place-id/app/index.ts index 86aad9fd5..44db8bcff 100644 --- a/dist/samples/geocoding-place-id/app/index.ts +++ b/dist/samples/geocoding-place-id/app/index.ts @@ -33,7 +33,7 @@ async function geocodePlaceId( const { AdvancedMarkerElement } = await google.maps.importLibrary('marker'); - const { results } = await geocoder.geocode({ placeId: placeId }); + const { results } = await geocoder.geocode({ placeId }); if (results[0]) { map.setZoom(11); map.setCenter(results[0].geometry.location); diff --git a/dist/samples/geocoding-place-id/docs/index.js b/dist/samples/geocoding-place-id/docs/index.js index 7497cd946..d8dbba71f 100644 --- a/dist/samples/geocoding-place-id/docs/index.js +++ b/dist/samples/geocoding-place-id/docs/index.js @@ -29,7 +29,7 @@ async function geocodePlaceId(geocoder, map, infoWindow) { const { AdvancedMarkerElement } = await google.maps.importLibrary('marker'); - const { results } = await geocoder.geocode({ placeId: placeId }); + const { results } = await geocoder.geocode({ placeId }); if (results[0]) { map.setZoom(11); map.setCenter(results[0].geometry.location); diff --git a/dist/samples/geocoding-place-id/docs/index.ts b/dist/samples/geocoding-place-id/docs/index.ts index 86aad9fd5..44db8bcff 100644 --- a/dist/samples/geocoding-place-id/docs/index.ts +++ b/dist/samples/geocoding-place-id/docs/index.ts @@ -33,7 +33,7 @@ async function geocodePlaceId( const { AdvancedMarkerElement } = await google.maps.importLibrary('marker'); - const { results } = await geocoder.geocode({ placeId: placeId }); + const { results } = await geocoder.geocode({ placeId }); if (results[0]) { map.setZoom(11); map.setCenter(results[0].geometry.location); diff --git a/dist/samples/geocoding-place-id/jsfiddle/demo.js b/dist/samples/geocoding-place-id/jsfiddle/demo.js index 9c4e5e33f..197fb95c3 100644 --- a/dist/samples/geocoding-place-id/jsfiddle/demo.js +++ b/dist/samples/geocoding-place-id/jsfiddle/demo.js @@ -29,7 +29,7 @@ async function geocodePlaceId(geocoder, map, infoWindow) { const { AdvancedMarkerElement } = await google.maps.importLibrary('marker'); - const { results } = await geocoder.geocode({ placeId: placeId }); + const { results } = await geocoder.geocode({ placeId }); if (results[0]) { map.setZoom(11); map.setCenter(results[0].geometry.location); diff --git a/dist/samples/geocoding-region-es/app/index.ts b/dist/samples/geocoding-region-es/app/index.ts index efba60e92..5490b2e17 100644 --- a/dist/samples/geocoding-region-es/app/index.ts +++ b/dist/samples/geocoding-region-es/app/index.ts @@ -27,11 +27,11 @@ async function init(): Promise { position, }); }) - .catch((e) => + .catch((e: unknown) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-es/dist/assets/index-CE7U96Bk.js b/dist/samples/geocoding-region-es/dist/assets/index-Dri2CeEr.js similarity index 89% rename from dist/samples/geocoding-region-es/dist/assets/index-CE7U96Bk.js rename to dist/samples/geocoding-region-es/dist/assets/index-Dri2CeEr.js index 31cc2c716..f6524ae41 100644 --- a/dist/samples/geocoding-region-es/dist/assets/index-CE7U96Bk.js +++ b/dist/samples/geocoding-region-es/dist/assets/index-Dri2CeEr.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{Geocoder:e},{AdvancedMarkerElement:t}]=await Promise.all([google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),n=document.querySelector(`gmp-map`).innerMap;new e().geocode({address:`Toledo`}).then(e=>{let r=e.results[0].geometry.location;n.setCenter(r),new t({map:n,position:r})}).catch(e=>window.alert(`Geocode was not successful for the following reason: `+e))}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{Geocoder:e},{AdvancedMarkerElement:t}]=await Promise.all([google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),n=document.querySelector(`gmp-map`).innerMap;new e().geocode({address:`Toledo`}).then(e=>{let r=e.results[0].geometry.location;n.setCenter(r),new t({map:n,position:r})}).catch(e=>{window.alert(`Geocode was not successful for the following reason: `+e)})}e(); \ No newline at end of file diff --git a/dist/samples/geocoding-region-es/dist/index.html b/dist/samples/geocoding-region-es/dist/index.html index 19190560a..e38bc755f 100644 --- a/dist/samples/geocoding-region-es/dist/index.html +++ b/dist/samples/geocoding-region-es/dist/index.html @@ -16,7 +16,7 @@ region: "ES" }); - + diff --git a/dist/samples/geocoding-region-es/docs/index.js b/dist/samples/geocoding-region-es/docs/index.js index 0cf113609..dc6792a0e 100644 --- a/dist/samples/geocoding-region-es/docs/index.js +++ b/dist/samples/geocoding-region-es/docs/index.js @@ -28,11 +28,11 @@ async function init() { position, }); }) - .catch((e) => + .catch((e) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-es/docs/index.ts b/dist/samples/geocoding-region-es/docs/index.ts index efba60e92..5490b2e17 100644 --- a/dist/samples/geocoding-region-es/docs/index.ts +++ b/dist/samples/geocoding-region-es/docs/index.ts @@ -27,11 +27,11 @@ async function init(): Promise { position, }); }) - .catch((e) => + .catch((e: unknown) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-es/jsfiddle/demo.js b/dist/samples/geocoding-region-es/jsfiddle/demo.js index 75027070d..373d3d31b 100644 --- a/dist/samples/geocoding-region-es/jsfiddle/demo.js +++ b/dist/samples/geocoding-region-es/jsfiddle/demo.js @@ -27,11 +27,11 @@ async function init() { position, }); }) - .catch((e) => + .catch((e) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-us/app/index.ts b/dist/samples/geocoding-region-us/app/index.ts index ae853934e..497b12158 100644 --- a/dist/samples/geocoding-region-us/app/index.ts +++ b/dist/samples/geocoding-region-us/app/index.ts @@ -27,11 +27,11 @@ async function init(): Promise { position, }); }) - .catch((e) => + .catch((e: unknown) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-us/dist/assets/index-CE7U96Bk.js b/dist/samples/geocoding-region-us/dist/assets/index-Dri2CeEr.js similarity index 89% rename from dist/samples/geocoding-region-us/dist/assets/index-CE7U96Bk.js rename to dist/samples/geocoding-region-us/dist/assets/index-Dri2CeEr.js index 31cc2c716..f6524ae41 100644 --- a/dist/samples/geocoding-region-us/dist/assets/index-CE7U96Bk.js +++ b/dist/samples/geocoding-region-us/dist/assets/index-Dri2CeEr.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{Geocoder:e},{AdvancedMarkerElement:t}]=await Promise.all([google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),n=document.querySelector(`gmp-map`).innerMap;new e().geocode({address:`Toledo`}).then(e=>{let r=e.results[0].geometry.location;n.setCenter(r),new t({map:n,position:r})}).catch(e=>window.alert(`Geocode was not successful for the following reason: `+e))}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let[{Geocoder:e},{AdvancedMarkerElement:t}]=await Promise.all([google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),n=document.querySelector(`gmp-map`).innerMap;new e().geocode({address:`Toledo`}).then(e=>{let r=e.results[0].geometry.location;n.setCenter(r),new t({map:n,position:r})}).catch(e=>{window.alert(`Geocode was not successful for the following reason: `+e)})}e(); \ No newline at end of file diff --git a/dist/samples/geocoding-region-us/dist/index.html b/dist/samples/geocoding-region-us/dist/index.html index 240d24fac..5ba9b592c 100644 --- a/dist/samples/geocoding-region-us/dist/index.html +++ b/dist/samples/geocoding-region-us/dist/index.html @@ -16,7 +16,7 @@ region: "US" }); - + diff --git a/dist/samples/geocoding-region-us/docs/index.js b/dist/samples/geocoding-region-us/docs/index.js index 7f5745296..bd40710ac 100644 --- a/dist/samples/geocoding-region-us/docs/index.js +++ b/dist/samples/geocoding-region-us/docs/index.js @@ -28,11 +28,11 @@ async function init() { position, }); }) - .catch((e) => + .catch((e) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-us/docs/index.ts b/dist/samples/geocoding-region-us/docs/index.ts index ae853934e..497b12158 100644 --- a/dist/samples/geocoding-region-us/docs/index.ts +++ b/dist/samples/geocoding-region-us/docs/index.ts @@ -27,11 +27,11 @@ async function init(): Promise { position, }); }) - .catch((e) => + .catch((e: unknown) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-region-us/jsfiddle/demo.js b/dist/samples/geocoding-region-us/jsfiddle/demo.js index 75027070d..373d3d31b 100644 --- a/dist/samples/geocoding-region-us/jsfiddle/demo.js +++ b/dist/samples/geocoding-region-us/jsfiddle/demo.js @@ -27,11 +27,11 @@ async function init() { position, }); }) - .catch((e) => + .catch((e) => { window.alert( 'Geocode was not successful for the following reason: ' + e - ) - ); + ); + }); } void init(); diff --git a/dist/samples/geocoding-reverse/app/index.ts b/dist/samples/geocoding-reverse/app/index.ts index ec13dce92..7875559e8 100644 --- a/dist/samples/geocoding-reverse/app/index.ts +++ b/dist/samples/geocoding-reverse/app/index.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ // [START maps_geocoding_reverse] -let marker; +let marker: google.maps.marker.AdvancedMarkerElement; async function init() { // Request the needed libraries. @@ -25,7 +25,7 @@ async function init() { const latLngQuery = document.getElementById('latlng') as HTMLInputElement; // Get the submit button. - const submitButton = document.getElementById('submit') as HTMLElement; + const submitButton = document.getElementById('submit')!; // Set the cursor to crosshair. innerMap.setOptions({ @@ -50,9 +50,11 @@ async function init() { }); // Add a click event listener to the map. - innerMap.addListener('click', (event) => { - latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; - void geocodeLatLng(geocoder, innerMap, infoWindow); + innerMap.addListener('click', (event: google.maps.MapMouseEvent) => { + if (event.latLng) { + latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; + void geocodeLatLng(geocoder, innerMap, infoWindow); + } }); // Make an initial request upon loading. diff --git a/dist/samples/geocoding-reverse/dist/assets/index-4iGbQb0Y.js b/dist/samples/geocoding-reverse/dist/assets/index-k1_z5ekC.js similarity index 73% rename from dist/samples/geocoding-reverse/dist/assets/index-4iGbQb0Y.js rename to dist/samples/geocoding-reverse/dist/assets/index-k1_z5ekC.js index c49b16f6e..c7be472db 100644 --- a/dist/samples/geocoding-reverse/dist/assets/index-4iGbQb0Y.js +++ b/dist/samples/geocoding-reverse/dist/assets/index-k1_z5ekC.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){let[{InfoWindow:t},{Geocoder:r},{AdvancedMarkerElement:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`)]),a=document.querySelector(`gmp-map`).innerMap,o=document.getElementById(`latlng`),s=document.getElementById(`submit`);a.setOptions({draggableCursor:`crosshair`,zoom:13,mapTypeControl:!1}),e=new i({map:a}),e.anchorTop=`40px`;let c=new r,l=new t;s.addEventListener(`click`,()=>{n(c,a,l)}),a.addListener(`click`,e=>{o.value=`${e.latLng.lat()}, ${e.latLng.lng()}`,n(c,a,l)}),n(c,a,l)}async function n(t,n,r){let i=document.getElementById(`latlng`).value.split(`,`,2),a={lat:parseFloat(i[0]),lng:parseFloat(i[1])};try{let{results:i}=await t.geocode({location:a});i[0]?(e.position=a,n.setCenter(a),r.setContent(i[0].formatted_address),r.open(n,e)):window.alert(`No results found`)}catch(e){window.alert(`Geocoder failed due to: `+String(e))}}t(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e;async function t(){let[{InfoWindow:t},{Geocoder:r},{AdvancedMarkerElement:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`)]),a=document.querySelector(`gmp-map`).innerMap,o=document.getElementById(`latlng`),s=document.getElementById(`submit`);a.setOptions({draggableCursor:`crosshair`,zoom:13,mapTypeControl:!1}),e=new i({map:a}),e.anchorTop=`40px`;let c=new r,l=new t;s.addEventListener(`click`,()=>{n(c,a,l)}),a.addListener(`click`,e=>{e.latLng&&(o.value=`${e.latLng.lat()}, ${e.latLng.lng()}`,n(c,a,l))}),n(c,a,l)}async function n(t,n,r){let i=document.getElementById(`latlng`).value.split(`,`,2),a={lat:parseFloat(i[0]),lng:parseFloat(i[1])};try{let{results:i}=await t.geocode({location:a});i[0]?(e.position=a,n.setCenter(a),r.setContent(i[0].formatted_address),r.open(n,e)):window.alert(`No results found`)}catch(e){window.alert(`Geocoder failed due to: `+String(e))}}t(); \ No newline at end of file diff --git a/dist/samples/geocoding-reverse/dist/index.html b/dist/samples/geocoding-reverse/dist/index.html index 53770c1a7..2184a1370 100644 --- a/dist/samples/geocoding-reverse/dist/index.html +++ b/dist/samples/geocoding-reverse/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/geocoding-reverse/docs/index.js b/dist/samples/geocoding-reverse/docs/index.js index 54fe0d20c..015df8e54 100644 --- a/dist/samples/geocoding-reverse/docs/index.js +++ b/dist/samples/geocoding-reverse/docs/index.js @@ -52,8 +52,10 @@ async function init() { // Add a click event listener to the map. innerMap.addListener('click', (event) => { - latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; - void geocodeLatLng(geocoder, innerMap, infoWindow); + if (event.latLng) { + latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; + void geocodeLatLng(geocoder, innerMap, infoWindow); + } }); // Make an initial request upon loading. diff --git a/dist/samples/geocoding-reverse/docs/index.ts b/dist/samples/geocoding-reverse/docs/index.ts index ec13dce92..7875559e8 100644 --- a/dist/samples/geocoding-reverse/docs/index.ts +++ b/dist/samples/geocoding-reverse/docs/index.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ // [START maps_geocoding_reverse] -let marker; +let marker: google.maps.marker.AdvancedMarkerElement; async function init() { // Request the needed libraries. @@ -25,7 +25,7 @@ async function init() { const latLngQuery = document.getElementById('latlng') as HTMLInputElement; // Get the submit button. - const submitButton = document.getElementById('submit') as HTMLElement; + const submitButton = document.getElementById('submit')!; // Set the cursor to crosshair. innerMap.setOptions({ @@ -50,9 +50,11 @@ async function init() { }); // Add a click event listener to the map. - innerMap.addListener('click', (event) => { - latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; - void geocodeLatLng(geocoder, innerMap, infoWindow); + innerMap.addListener('click', (event: google.maps.MapMouseEvent) => { + if (event.latLng) { + latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; + void geocodeLatLng(geocoder, innerMap, infoWindow); + } }); // Make an initial request upon loading. diff --git a/dist/samples/geocoding-reverse/jsfiddle/demo.js b/dist/samples/geocoding-reverse/jsfiddle/demo.js index f8d4bb23a..eb2da6157 100644 --- a/dist/samples/geocoding-reverse/jsfiddle/demo.js +++ b/dist/samples/geocoding-reverse/jsfiddle/demo.js @@ -52,8 +52,10 @@ async function init() { // Add a click event listener to the map. innerMap.addListener('click', (event) => { - latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; - void geocodeLatLng(geocoder, innerMap, infoWindow); + if (event.latLng) { + latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; + void geocodeLatLng(geocoder, innerMap, infoWindow); + } }); // Make an initial request upon loading. diff --git a/dist/samples/geocoding-simple/app/index.ts b/dist/samples/geocoding-simple/app/index.ts index 79d5bcee4..170212261 100644 --- a/dist/samples/geocoding-simple/app/index.ts +++ b/dist/samples/geocoding-simple/app/index.ts @@ -6,11 +6,11 @@ // [START maps_geocoding_simple] let geocoder: google.maps.Geocoder; -let mapElement; +let mapElement: google.maps.MapElement; let innerMap: google.maps.Map; -let marker; -let responseDiv; -let responsePre; +let marker: google.maps.marker.AdvancedMarkerElement; +let responseDiv: HTMLElement; +let responsePre: HTMLPreElement; async function init() { // Request the needed libraries. @@ -43,12 +43,10 @@ async function init() { const inputText = document.getElementById('address') as HTMLInputElement; const submitButton = document.getElementById('submit') as HTMLInputElement; const clearButton = document.getElementById('clear') as HTMLInputElement; - responseDiv = document.getElementById( - 'response-container' - ) as HTMLDivElement; + responseDiv = document.getElementById('response-container')!; responsePre = document.getElementById('response') as HTMLPreElement; - marker = new AdvancedMarkerElement({}); + marker = new AdvancedMarkerElement(); innerMap.addListener('click', (e: google.maps.MapMouseEvent) => { void geocode({ location: e.latLng }); @@ -66,7 +64,7 @@ async function init() { } function clear() { - marker.setMap(null); + marker.map = null; responseDiv.style.display = 'none'; } diff --git a/dist/samples/geocoding-simple/dist/assets/index-TFN50Rj5.js b/dist/samples/geocoding-simple/dist/assets/index-Dz4uBDLz.js similarity index 69% rename from dist/samples/geocoding-simple/dist/assets/index-TFN50Rj5.js rename to dist/samples/geocoding-simple/dist/assets/index-Dz4uBDLz.js index 93d2660a2..c5a43d88f 100644 --- a/dist/samples/geocoding-simple/dist/assets/index-TFN50Rj5.js +++ b/dist/samples/geocoding-simple/dist/assets/index-Dz4uBDLz.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r,i,a;async function o(){let[{Geocoder:o},{AdvancedMarkerElement:l},{ControlPosition:u}]=await Promise.all([google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);t=document.querySelector(`gmp-map`),n=t.innerMap,n.setOptions({mapTypeControl:!1,fullscreenControl:!1,cameraControlOptions:{position:u.INLINE_START_BLOCK_END},draggableCursor:`crosshair`}),e=new o;let d=document.getElementById(`address`),f=document.getElementById(`submit`),p=document.getElementById(`clear`);i=document.getElementById(`response-container`),a=document.getElementById(`response`),r=new l({}),n.addListener(`click`,e=>{c({location:e.latLng})}),f.addEventListener(`click`,()=>{c({address:d.value})}),p.addEventListener(`click`,()=>{s()}),s()}function s(){r.setMap(null),i.style.display=`none`}async function c(o){s();let{LatLng:c}=await google.maps.importLibrary(`core`);try{let s=await e.geocode(o),{results:l}=s;return n.setCenter(l[0].geometry.location),r.position=new c(l[0].geometry.location),t.append(r),i.style.display=`block`,a.innerText=JSON.stringify(s,null,2),l}catch(e){alert(`Geocode was not successful for the following reason: `+String(e))}}o(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r,i,a;async function o(){let[{Geocoder:o},{AdvancedMarkerElement:l},{ControlPosition:u}]=await Promise.all([google.maps.importLibrary(`geocoding`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);t=document.querySelector(`gmp-map`),n=t.innerMap,n.setOptions({mapTypeControl:!1,fullscreenControl:!1,cameraControlOptions:{position:u.INLINE_START_BLOCK_END},draggableCursor:`crosshair`}),e=new o;let d=document.getElementById(`address`),f=document.getElementById(`submit`),p=document.getElementById(`clear`);i=document.getElementById(`response-container`),a=document.getElementById(`response`),r=new l,n.addListener(`click`,e=>{c({location:e.latLng})}),f.addEventListener(`click`,()=>{c({address:d.value})}),p.addEventListener(`click`,()=>{s()}),s()}function s(){r.map=null,i.style.display=`none`}async function c(o){s();let{LatLng:c}=await google.maps.importLibrary(`core`);try{let s=await e.geocode(o),{results:l}=s;return n.setCenter(l[0].geometry.location),r.position=new c(l[0].geometry.location),t.append(r),i.style.display=`block`,a.innerText=JSON.stringify(s,null,2),l}catch(e){alert(`Geocode was not successful for the following reason: `+String(e))}}o(); \ No newline at end of file diff --git a/dist/samples/geocoding-simple/dist/index.html b/dist/samples/geocoding-simple/dist/index.html index 3c51f54fc..ce3b21c7e 100644 --- a/dist/samples/geocoding-simple/dist/index.html +++ b/dist/samples/geocoding-simple/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/geocoding-simple/docs/index.js b/dist/samples/geocoding-simple/docs/index.js index e462c184a..2999578ca 100644 --- a/dist/samples/geocoding-simple/docs/index.js +++ b/dist/samples/geocoding-simple/docs/index.js @@ -47,7 +47,7 @@ async function init() { responseDiv = document.getElementById('response-container'); responsePre = document.getElementById('response'); - marker = new AdvancedMarkerElement({}); + marker = new AdvancedMarkerElement(); innerMap.addListener('click', (e) => { void geocode({ location: e.latLng }); @@ -65,7 +65,7 @@ async function init() { } function clear() { - marker.setMap(null); + marker.map = null; responseDiv.style.display = 'none'; } diff --git a/dist/samples/geocoding-simple/docs/index.ts b/dist/samples/geocoding-simple/docs/index.ts index 79d5bcee4..170212261 100644 --- a/dist/samples/geocoding-simple/docs/index.ts +++ b/dist/samples/geocoding-simple/docs/index.ts @@ -6,11 +6,11 @@ // [START maps_geocoding_simple] let geocoder: google.maps.Geocoder; -let mapElement; +let mapElement: google.maps.MapElement; let innerMap: google.maps.Map; -let marker; -let responseDiv; -let responsePre; +let marker: google.maps.marker.AdvancedMarkerElement; +let responseDiv: HTMLElement; +let responsePre: HTMLPreElement; async function init() { // Request the needed libraries. @@ -43,12 +43,10 @@ async function init() { const inputText = document.getElementById('address') as HTMLInputElement; const submitButton = document.getElementById('submit') as HTMLInputElement; const clearButton = document.getElementById('clear') as HTMLInputElement; - responseDiv = document.getElementById( - 'response-container' - ) as HTMLDivElement; + responseDiv = document.getElementById('response-container')!; responsePre = document.getElementById('response') as HTMLPreElement; - marker = new AdvancedMarkerElement({}); + marker = new AdvancedMarkerElement(); innerMap.addListener('click', (e: google.maps.MapMouseEvent) => { void geocode({ location: e.latLng }); @@ -66,7 +64,7 @@ async function init() { } function clear() { - marker.setMap(null); + marker.map = null; responseDiv.style.display = 'none'; } diff --git a/dist/samples/geocoding-simple/jsfiddle/demo.js b/dist/samples/geocoding-simple/jsfiddle/demo.js index 91c675c18..e266df3cd 100644 --- a/dist/samples/geocoding-simple/jsfiddle/demo.js +++ b/dist/samples/geocoding-simple/jsfiddle/demo.js @@ -46,7 +46,7 @@ async function init() { responseDiv = document.getElementById('response-container'); responsePre = document.getElementById('response'); - marker = new AdvancedMarkerElement({}); + marker = new AdvancedMarkerElement(); innerMap.addListener('click', (e) => { void geocode({ location: e.latLng }); @@ -64,7 +64,7 @@ async function init() { } function clear() { - marker.setMap(null); + marker.map = null; responseDiv.style.display = 'none'; } diff --git a/dist/samples/hiding-features/app/index.ts b/dist/samples/hiding-features/app/index.ts index 1a4b7bd33..920c39778 100644 --- a/dist/samples/hiding-features/app/index.ts +++ b/dist/samples/hiding-features/app/index.ts @@ -22,18 +22,12 @@ async function init() { }); // Apply new JSON when the user chooses to hide/show features. - (document.getElementById('hide-poi') as HTMLElement).addEventListener( - 'click', - () => { - innerMap.setOptions({ styles: styles['hide'] }); - } - ); - (document.getElementById('show-poi') as HTMLElement).addEventListener( - 'click', - () => { - innerMap.setOptions({ styles: styles['default'] }); - } - ); + document.getElementById('hide-poi')!.addEventListener('click', () => { + innerMap.setOptions({ styles: styles.hide }); + }); + document.getElementById('show-poi')!.addEventListener('click', () => { + innerMap.setOptions({ styles: styles.default }); + }); } const styles: Record = { diff --git a/dist/samples/hiding-features/docs/index.js b/dist/samples/hiding-features/docs/index.js index 01e64d56a..bcce193b1 100644 --- a/dist/samples/hiding-features/docs/index.js +++ b/dist/samples/hiding-features/docs/index.js @@ -24,10 +24,10 @@ async function init() { // Apply new JSON when the user chooses to hide/show features. document.getElementById('hide-poi').addEventListener('click', () => { - innerMap.setOptions({ styles: styles['hide'] }); + innerMap.setOptions({ styles: styles.hide }); }); document.getElementById('show-poi').addEventListener('click', () => { - innerMap.setOptions({ styles: styles['default'] }); + innerMap.setOptions({ styles: styles.default }); }); } diff --git a/dist/samples/hiding-features/docs/index.ts b/dist/samples/hiding-features/docs/index.ts index 1a4b7bd33..920c39778 100644 --- a/dist/samples/hiding-features/docs/index.ts +++ b/dist/samples/hiding-features/docs/index.ts @@ -22,18 +22,12 @@ async function init() { }); // Apply new JSON when the user chooses to hide/show features. - (document.getElementById('hide-poi') as HTMLElement).addEventListener( - 'click', - () => { - innerMap.setOptions({ styles: styles['hide'] }); - } - ); - (document.getElementById('show-poi') as HTMLElement).addEventListener( - 'click', - () => { - innerMap.setOptions({ styles: styles['default'] }); - } - ); + document.getElementById('hide-poi')!.addEventListener('click', () => { + innerMap.setOptions({ styles: styles.hide }); + }); + document.getElementById('show-poi')!.addEventListener('click', () => { + innerMap.setOptions({ styles: styles.default }); + }); } const styles: Record = { diff --git a/dist/samples/hiding-features/jsfiddle/demo.js b/dist/samples/hiding-features/jsfiddle/demo.js index 52e640ec4..97d895f4b 100644 --- a/dist/samples/hiding-features/jsfiddle/demo.js +++ b/dist/samples/hiding-features/jsfiddle/demo.js @@ -23,10 +23,10 @@ async function init() { // Apply new JSON when the user chooses to hide/show features. document.getElementById('hide-poi').addEventListener('click', () => { - innerMap.setOptions({ styles: styles['hide'] }); + innerMap.setOptions({ styles: styles.hide }); }); document.getElementById('show-poi').addEventListener('click', () => { - innerMap.setOptions({ styles: styles['default'] }); + innerMap.setOptions({ styles: styles.default }); }); } diff --git a/dist/samples/infowindow-simple/app/index.ts b/dist/samples/infowindow-simple/app/index.ts index 09a665f7c..4eeb46a50 100644 --- a/dist/samples/infowindow-simple/app/index.ts +++ b/dist/samples/infowindow-simple/app/index.ts @@ -49,7 +49,7 @@ async function init(): Promise { // Create the info window. const infoWindow = new InfoWindow({ headerContent: heading, - content: content, + content, ariaLabel: 'Uluru', maxWidth: 500, // Set max width (optional). }); diff --git a/dist/samples/infowindow-simple/docs/index.js b/dist/samples/infowindow-simple/docs/index.js index 7461aae05..a43f32d15 100644 --- a/dist/samples/infowindow-simple/docs/index.js +++ b/dist/samples/infowindow-simple/docs/index.js @@ -50,7 +50,7 @@ async function init() { // Create the info window. const infoWindow = new InfoWindow({ headerContent: heading, - content: content, + content, ariaLabel: 'Uluru', maxWidth: 500, // Set max width (optional). }); diff --git a/dist/samples/infowindow-simple/docs/index.ts b/dist/samples/infowindow-simple/docs/index.ts index 09a665f7c..4eeb46a50 100644 --- a/dist/samples/infowindow-simple/docs/index.ts +++ b/dist/samples/infowindow-simple/docs/index.ts @@ -49,7 +49,7 @@ async function init(): Promise { // Create the info window. const infoWindow = new InfoWindow({ headerContent: heading, - content: content, + content, ariaLabel: 'Uluru', maxWidth: 500, // Set max width (optional). }); diff --git a/dist/samples/infowindow-simple/jsfiddle/demo.js b/dist/samples/infowindow-simple/jsfiddle/demo.js index c34ee640f..d2639a919 100644 --- a/dist/samples/infowindow-simple/jsfiddle/demo.js +++ b/dist/samples/infowindow-simple/jsfiddle/demo.js @@ -49,7 +49,7 @@ async function init() { // Create the info window. const infoWindow = new InfoWindow({ headerContent: heading, - content: content, + content, ariaLabel: 'Uluru', maxWidth: 500, // Set max width (optional). }); diff --git a/dist/samples/js-api-loader-map/app/index.ts b/dist/samples/js-api-loader-map/app/index.ts index db4c2a16a..7d303b86a 100644 --- a/dist/samples/js-api-loader-map/app/index.ts +++ b/dist/samples/js-api-loader-map/app/index.ts @@ -30,7 +30,7 @@ async function init(): Promise { }; // Declare the map. - new Map(document.getElementById('map') as HTMLElement, mapOptions); + new Map(document.getElementById('map')!, mapOptions); } void init(); diff --git a/dist/samples/js-api-loader-map/docs/index.ts b/dist/samples/js-api-loader-map/docs/index.ts index db4c2a16a..7d303b86a 100644 --- a/dist/samples/js-api-loader-map/docs/index.ts +++ b/dist/samples/js-api-loader-map/docs/index.ts @@ -30,7 +30,7 @@ async function init(): Promise { }; // Declare the map. - new Map(document.getElementById('map') as HTMLElement, mapOptions); + new Map(document.getElementById('map')!, mapOptions); } void init(); diff --git a/dist/samples/layer-data-event/app/index.ts b/dist/samples/layer-data-event/app/index.ts index d729ef22a..6c8d86a3e 100644 --- a/dist/samples/layer-data-event/app/index.ts +++ b/dist/samples/layer-data-event/app/index.ts @@ -25,10 +25,13 @@ async function init() { // [START maps_layer_data_event_snippet] // Set mouseover event for each feature. - innerMap.data.addListener('mouseover', (event) => { - (document.getElementById('info-box') as HTMLElement).textContent = - event.feature.getProperty('letter'); - }); + innerMap.data.addListener( + 'mouseover', + (event: google.maps.Data.MouseEvent) => { + document.getElementById('info-box')!.textContent = + event.feature.getProperty('letter') as string; + } + ); // [END maps_layer_data_event_snippet] } diff --git a/dist/samples/layer-data-event/docs/index.ts b/dist/samples/layer-data-event/docs/index.ts index d729ef22a..6c8d86a3e 100644 --- a/dist/samples/layer-data-event/docs/index.ts +++ b/dist/samples/layer-data-event/docs/index.ts @@ -25,10 +25,13 @@ async function init() { // [START maps_layer_data_event_snippet] // Set mouseover event for each feature. - innerMap.data.addListener('mouseover', (event) => { - (document.getElementById('info-box') as HTMLElement).textContent = - event.feature.getProperty('letter'); - }); + innerMap.data.addListener( + 'mouseover', + (event: google.maps.Data.MouseEvent) => { + document.getElementById('info-box')!.textContent = + event.feature.getProperty('letter') as string; + } + ); // [END maps_layer_data_event_snippet] } diff --git a/dist/samples/layer-data-quakes-red/app/index.ts b/dist/samples/layer-data-quakes-red/app/index.ts index eb45736f3..d9ac4d3c3 100644 --- a/dist/samples/layer-data-quakes-red/app/index.ts +++ b/dist/samples/layer-data-quakes-red/app/index.ts @@ -45,6 +45,7 @@ async function init() { // Defines the callback function referenced in the jsonp file. // eslint-disable-next-line @typescript-eslint/no-explicit-any function earthquakeDataLoad(data: any) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument innerMap.data.addGeoJson(data); } diff --git a/dist/samples/layer-data-quakes-red/docs/index.ts b/dist/samples/layer-data-quakes-red/docs/index.ts index eb45736f3..d9ac4d3c3 100644 --- a/dist/samples/layer-data-quakes-red/docs/index.ts +++ b/dist/samples/layer-data-quakes-red/docs/index.ts @@ -45,6 +45,7 @@ async function init() { // Defines the callback function referenced in the jsonp file. // eslint-disable-next-line @typescript-eslint/no-explicit-any function earthquakeDataLoad(data: any) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument innerMap.data.addGeoJson(data); } diff --git a/dist/samples/layer-data-quakes-simple/app/index.ts b/dist/samples/layer-data-quakes-simple/app/index.ts index 4577de347..a643badf0 100644 --- a/dist/samples/layer-data-quakes-simple/app/index.ts +++ b/dist/samples/layer-data-quakes-simple/app/index.ts @@ -27,6 +27,7 @@ async function init() { // Defines the callback function referenced in the jsonp file. // eslint-disable-next-line @typescript-eslint/no-explicit-any function earthquakeDataLoad(data: any) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument innerMap.data.addGeoJson(data); } diff --git a/dist/samples/layer-data-quakes-simple/docs/index.ts b/dist/samples/layer-data-quakes-simple/docs/index.ts index 4577de347..a643badf0 100644 --- a/dist/samples/layer-data-quakes-simple/docs/index.ts +++ b/dist/samples/layer-data-quakes-simple/docs/index.ts @@ -27,6 +27,7 @@ async function init() { // Defines the callback function referenced in the jsonp file. // eslint-disable-next-line @typescript-eslint/no-explicit-any function earthquakeDataLoad(data: any) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument innerMap.data.addGeoJson(data); } diff --git a/dist/samples/map-drawing-terradraw/app/.eslintsrc.json b/dist/samples/map-drawing-terradraw/app/.eslintsrc.json deleted file mode 100644 index 4c44dab04..000000000 --- a/dist/samples/map-drawing-terradraw/app/.eslintsrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "parser": "@typescript-eslint/parser", - "rules": { - "@typescript-eslint/ban-ts-comment": 0, - "@typescript-eslint/no-this-alias": 1, - "@typescript-eslint/no-empty-function": 1, - "@typescript-eslint/explicit-module-boundary-types": 1, - "@typescript-eslint/no-unused-vars": 1 - } -} diff --git a/dist/samples/map-drawing-terradraw/app/README.md b/dist/samples/map-drawing-terradraw/app/README.md deleted file mode 100644 index 8626a48b6..000000000 --- a/dist/samples/map-drawing-terradraw/app/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Basic Terra Draw with Google Maps API Sample - -This sample demonstrates a basic implementation of Terra Draw with the Google Maps JavaScript API. It includes various drawing modes such as Point, LineString, Polygon, Rectangle, Circle, and Freehand. - -![Roadmap View](./screenshots/draw-roadmap.png) -![Satellite View](./screenshots/draw-satellite.png) - -# Google Maps JavaScript Sample - -This sample is generated from @googlemaps/js-samples located at -https://github.com/googlemaps-samples/js-api-samples. - -## Setup - -### Before starting run: - -`$npm i` - -### Run an example on a local web server - -First `cd` to the folder for the sample to run, then: - -`$npm start` - -### Build an individual example - -From `samples/`: - -`$npm run build --workspace=sample-name/` - -### Build all of the examples. - -From `samples/`: -`$npm run build-all` - -## Feedback - -For feedback related to this sample, please open a new issue on -[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues). - diff --git a/dist/samples/map-drawing-terradraw/app/index.html b/dist/samples/map-drawing-terradraw/app/index.html deleted file mode 100644 index 48c180390..000000000 --- a/dist/samples/map-drawing-terradraw/app/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - Terra Draw with Google Maps API Sample - - - - - -
- - -
- - - - - - - - - - - - - - - -
- - - - - - diff --git a/dist/samples/map-drawing-terradraw/app/index.ts b/dist/samples/map-drawing-terradraw/app/index.ts deleted file mode 100644 index 51c00895f..000000000 --- a/dist/samples/map-drawing-terradraw/app/index.ts +++ /dev/null @@ -1,509 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_map_drawing_terradraw] -// [START maps_map_drawing_terradraw_libraries] -import { Loader } from '@googlemaps/js-api-loader'; - -import { - TerraDraw, - TerraDrawSelectMode, - TerraDrawPointMode, - TerraDrawLineStringMode, - TerraDrawPolygonMode, - TerraDrawRectangleMode, - TerraDrawCircleMode, - TerraDrawFreehandMode -} from 'terra-draw'; -import { TerraDrawGoogleMapsAdapter } from 'terra-draw-google-maps-adapter'; - -// [END maps_map_drawing_terradraw_libraries] - -const colorPalette = [ - "#E74C3C", - "#FF0066", - "#9B59B6", - "#673AB7", - "#3F51B5", - "#3498DB", - "#03A9F4", - "#00BCD4", - "#009688", - "#27AE60", - "#8BC34A", - "#CDDC39", - "#F1C40F", - "#FFC107", - "#F39C12", - "#FF5722", - "#795548" -]; - -const getRandomColor = () => colorPalette[Math.floor(Math.random() * colorPalette.length)] as `#${string}`; - -function processSnapshotForUndo(snapshot: any[]): any[] { - // console.log("Processing snapshot for undo:", snapshot); - return snapshot.map(feature => { - const newFeature = JSON.parse(JSON.stringify(feature)); - - if (newFeature.properties.mode === 'rectangle') { - // console.log("Processing rectangle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - newFeature.properties.mode = 'polygon'; - } else if (newFeature.properties.mode === 'circle') { - // console.log("Processing circle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - // The radius is already in properties, so we just need to ensure the mode is correct for re-creation - newFeature.properties.mode = 'circle'; - } - return newFeature; - }); -} - -function setupModeButtons(): void { - const modeUI = document.getElementById('mode-ui'); - if (!modeUI) { - return; - } - - const modeButtons: { [key: string]: string } = { - 'select-mode': 'select', - 'point-mode': 'point', - 'linestring-mode': 'linestring', - 'polygon-mode': 'polygon', - 'rectangle-mode': 'rectangle', - 'circle-mode': 'circle', - 'freehand-mode': 'freehand', - 'clear-mode': 'static' - }; - - for (const buttonId in modeButtons) { - const button = document.getElementById(buttonId); - if (button) { - button.onclick = () => { - setActiveButton(buttonId); - const modeName = modeButtons[buttonId]; - - if (!draw) { - return; - } - if (modeName === 'static') { - draw.clear(); - draw.setMode('static'); - } else if (modeName) { - draw.setMode(modeName); - } - }; - } - } -} - -function setActiveButton(buttonId: string): void { - const buttons = document.querySelectorAll('.mode-button'); - const resizeButton = document.getElementById('resize-button'); - const isResizeActive = resizeButton?.classList.contains('active'); - - buttons.forEach(button => { - if (button.id !== 'resize-button') { - button.classList.remove('active'); - } - }); - - const activeButton = document.getElementById(buttonId); - if (activeButton) { - activeButton.classList.add('active'); - } - - if (isResizeActive) { - resizeButton?.classList.add('active'); - } -} - -function initUI(): void { - setActiveButton('point-mode'); -} - -let map: google.maps.Map; -let draw: TerraDraw; -let currentMode: string = 'static'; -let history: any[] = []; -let redoHistory: any[] = []; -let selectedFeatureId: string | null = null; -let isRestoring = false; -let resizingEnabled = false; -let debounceTimeout: number | undefined; - -const loader = new Loader({ - apiKey: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", - version: "weekly", - libraries: ["maps", "drawing", "marker"] -}); - -loader.load().then(async () => { - try { - const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; - const { LatLngBounds } = await google.maps.importLibrary("core") as google.maps.CoreLibrary; - const { Data } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; - - const mapOptions: google.maps.MapOptions = { - center: { lat: 48.862, lng: 2.342 }, - zoom: 12, - mapId:'c306b3c6dd3ed8d9', // raster '6a17c323f461e521', - mapTypeId: 'roadmap', - zoomControl:false, - tilt: 45, - mapTypeControl: true, - clickableIcons:false, - streetViewControl:false, - fullscreenControl:false, - }; - - const mapDiv = document.getElementById("map") as HTMLElement; - map = new Map(mapDiv, mapOptions); - - map.addListener("click", () => { - if (draw) { - console.log("Current draw mode on map click:", draw.getMode()); - } - }); - - map.addListener("projection_changed", () => { - - // [START maps_drawing_terradraw_modes] - - draw = new TerraDraw({ - adapter: new TerraDrawGoogleMapsAdapter({ map, lib: google.maps, coordinatePrecision: 9 }), - modes: [ - new TerraDrawSelectMode({ - flags: { - polygon: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - linestring: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - point: { - feature: { - draggable: true, - rotateable: true, - }, - }, - rectangle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - circle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - freehand: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - }, - }), - - new TerraDrawPointMode({ - editable: true, - styles: { pointColor: getRandomColor() }, - }), - new TerraDrawLineStringMode({ - editable: true, - styles: { lineStringColor: getRandomColor() }, - }), - new TerraDrawPolygonMode({ - editable: true, - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawRectangleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawCircleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawFreehandMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - ], - }); - - draw.start(); - - - draw.on('ready', () => { - console.log("TerraDraw is ready!"); - initUI(); - setupModeButtons(); - draw.setMode('point'); - currentMode = 'point'; - setActiveButton('point-mode'); - - draw.on("select", (id) => { - // console.log(`Feature selected: ${id}`); - if (selectedFeatureId && selectedFeatureId !== id) { - draw.deselectFeature(selectedFeatureId); - } - selectedFeatureId = id as string; - }); - - draw.on("deselect", () => { - // console.log("Feature deselected"); - selectedFeatureId = null; - }); - - history.push(processSnapshotForUndo(draw.getSnapshot())); // Push initial empty state - - draw.on("change", (ids, type) => { - if (isRestoring) { - return; - } - - if (debounceTimeout) { - clearTimeout(debounceTimeout); - } - - debounceTimeout = window.setTimeout(() => { - const snapshot = draw.getSnapshot(); - const processedSnapshot = processSnapshotForUndo(snapshot); - const filteredSnapshot = processedSnapshot.filter( - (f) => !f.properties.midPoint && !f.properties.selectionPoint - ); - history.push(filteredSnapshot); - redoHistory = []; - }, 200); - }); - - // [END maps_drawing_terradraw_modes] - - const exportButton = document.getElementById('export-button'); - if (exportButton) { - exportButton.onclick = () => { - const features = draw.getSnapshot(); - const geojson = { - type: "FeatureCollection", - features: features, - }; - const data = JSON.stringify(geojson, null, 2); - const blob = new Blob([data], { type: "text/plain" }); - const url = URL.createObjectURL(blob); - const link = document.createElement("a"); - link.href = url; - link.download = "drawing.geojson"; - link.click(); - URL.revokeObjectURL(url); - }; - } - - const uploadButton = document.getElementById('upload-button'); - const uploadInput = document.getElementById('upload-input') as HTMLInputElement; - - if (uploadButton && uploadInput) { - uploadButton.onclick = () => { - uploadInput.click(); - }; - - uploadInput.onchange = (event) => { - const file = (event.target as HTMLInputElement).files?.[0]; - if (file) { - const reader = new FileReader(); - reader.onload = (e) => { - try { - const geojson = JSON.parse(e.target?.result as string); - if (geojson.type === "FeatureCollection") { - draw.addFeatures(geojson.features); - } else { - alert("Invalid GeoJSON file: must be a FeatureCollection."); - } - } catch (error) { - alert("Error parsing GeoJSON file."); - } - }; - reader.readAsText(file); - } - }; - } - - const resizeButton = document.getElementById('resize-button'); - if (resizeButton) { - resizeButton.onclick = () => { - resizingEnabled = !resizingEnabled; - resizeButton.classList.toggle('active', resizingEnabled); - - const flags = { - polygon: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - linestring: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - rectangle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - circle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - freehand: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - }; - - console.log("Updating flags:", flags); - draw.updateModeOptions('select', { flags }); - }; - } - - const deleteSelectedButton = document.getElementById('delete-selected-button'); - if (deleteSelectedButton) { - deleteSelectedButton.onclick = () => { - if (selectedFeatureId) { - draw.removeFeatures([selectedFeatureId]); - } else { - const features = draw.getSnapshot(); - if (features.length > 0) { - const lastFeature = features[features.length - 1]; - if (lastFeature.id) { - draw.removeFeatures([lastFeature.id]); - } - } - } - }; - } - - const undoButton = document.getElementById('undo-button'); - if (undoButton) { - undoButton.onclick = () => { - if (history.length > 1) { - redoHistory.push(history.pop()); - const snapshotToRestore = history[history.length - 1]; - console.log("Restoring snapshot (undo):", snapshotToRestore); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshotToRestore); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - - const redoButton = document.getElementById('redo-button'); - if (redoButton) { - redoButton.onclick = () => { - if (redoHistory.length > 0) { - const snapshot = redoHistory.pop(); - console.log("Restoring snapshot (redo):", snapshot); - history.push(snapshot); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshot); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - }); - - function rotateFeature(feature, angle) { - const newFeature = JSON.parse(JSON.stringify(feature)); - const coordinates = newFeature.geometry.coordinates; - const center = getCenter(coordinates); - - const rotatedCoordinates = coordinates.map(ring => { - return ring.map(point => { - const x = point[0] - center[0]; - const y = point[1] - center[1]; - const newX = x * Math.cos(angle * Math.PI / 180) - y * Math.sin(angle * Math.PI / 180); - const newY = x * Math.sin(angle * Math.PI / 180) + y * Math.cos(angle * Math.PI / 180); - return [newX + center[0], newY + center[1]]; - }); - }); - - newFeature.geometry.coordinates = rotatedCoordinates; - return newFeature; - } - - function getCenter(coordinates) { - let x = 0; - let y = 0; - let count = 0; - coordinates.forEach(ring => { - ring.forEach(point => { - x += point[0]; - y += point[1]; - count++; - }); - }); - return [x / count, y / count]; - } - - document.addEventListener('keydown', (event) => { - if (event.key === 'r' && selectedFeatureId) { - const features = draw.getSnapshot(); - const selectedFeature = features.find(f => f.id === selectedFeatureId); - - if (selectedFeature) { - const newFeature = rotateFeature(selectedFeature, 15); - draw.addFeatures([newFeature]); - } - } - }); - }); - - } catch (e) { - console.error("Error loading Google Maps API:", e); - } -}).catch(e => { - console.error("Error loading Google Maps API:", e); -}); -// [END maps_map_drawing_terradraw] diff --git a/dist/samples/map-drawing-terradraw/app/package.json b/dist/samples/map-drawing-terradraw/app/package.json deleted file mode 100644 index c45a36a9e..000000000 --- a/dist/samples/map-drawing-terradraw/app/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@js-api-samples/map-drawing-terradraw", - "version": "1.0.0", - "description": "Basic sample for Terra Draw with Google Maps API.", - "scripts": { - "build": "tsc && bash ../jsfiddle.sh map-drawing-terradraw && bash ../app.sh map-drawing-terradraw && bash ../docs.sh map-drawing-terradraw && npm run build:vite --workspace=. && bash ../dist.sh map-drawing-terradraw", - "test": "tsc && npm run build:vite --workspace=.", - "start": "tsc && vite build --base './' && vite", - "build:vite": "vite build --base './'", - "preview": "vite preview" - }, - "dependencies": { - "@googlemaps/js-api-loader": "^1.16.8", - "terra-draw": "latest", - "terra-draw-google-maps-adapter": "latest" - }, - "devDependencies": { - "@types/google.maps": "latest", - "typescript": "^5.0.0", - "vite": "^5.0.0" - } -} diff --git a/dist/samples/map-drawing-terradraw/app/style.css b/dist/samples/map-drawing-terradraw/app/style.css deleted file mode 100644 index 2584b672b..000000000 --- a/dist/samples/map-drawing-terradraw/app/style.css +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ -/* [START maps_map_drawing_terradraw] */ -html, -body { - height: 100%; - margin: 0; - padding: 0; - font-family: Arial, sans-serif; -} -#map { - height: 100%; - width: 100%; -} -#mode-ui { - position: absolute; - top: 10px; - right: 10px; - background: white; - padding: 10px; - border-radius: 5px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); - z-index: 1000; - display: flex; - flex-direction: column; -} -#mode-ui button { - margin: 5px 0; - cursor: pointer; -} - -.mode-button { - width: 30px; - height: 30px; - border: 1px solid #ccc; - background-color: white; - padding: 2px; - box-sizing: border-box; -} - -.mode-button img { - width: 100%; - height: 100%; - display: block; - user-select: none; -} - -/* Active state for shape modes */ -.mode-button.active { - background-color: #e0e0e0; /* light grey */ -} - -/* Special buttons default state */ -#select-mode, -#clear-mode, -#delete-selected-button, -#undo-button, -#redo-button, -#export-button, -#upload-button, -#resize-button { - background-color: #000000; -} - -/* Special buttons icon default state */ -#select-mode img, -#clear-mode img, -#delete-selected-button img, -#undo-button img, -#redo-button img, -#export-button img, -#upload-button img, -#resize-button img { - filter: brightness(0) invert(1); -} - -/* Special buttons active/click states */ -#select-mode.active { - background-color: #A9A9A9; /* dark grey */ -} - -#clear-mode:active, -#delete-selected-button:active, -#undo-button:active, -#redo-button:active, -#export-button:active, -#upload-button:active, -#resize-button.active { - background-color: #A9A9A9; /* dark grey */ -} -/* [END maps_map_drawing_terradraw] */ diff --git a/dist/samples/map-drawing-terradraw/app/tsconfig.json b/dist/samples/map-drawing-terradraw/app/tsconfig.json deleted file mode 100644 index c543450ed..000000000 --- a/dist/samples/map-drawing-terradraw/app/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "module": "esnext", - "target": "esnext", - "strict": true, - "noImplicitAny": false, - "lib": [ - "es2015", - "esnext", - "es6", - "dom", - "dom.iterable" - ], - "moduleResolution": "Bundler", - "jsx": "preserve", - "types": ["@types/google.maps"] - } -} \ No newline at end of file diff --git a/dist/samples/map-drawing-terradraw/dist/assets/index-CIrp2hh-.js b/dist/samples/map-drawing-terradraw/dist/assets/index-CIrp2hh-.js deleted file mode 100644 index f61827e45..000000000 --- a/dist/samples/map-drawing-terradraw/dist/assets/index-CIrp2hh-.js +++ /dev/null @@ -1,5 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const n of s.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function e(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(o){if(o.ep)return;o.ep=!0;const s=e(o);fetch(o.href,s)}})();function Pe(r,t,e,i){function o(s){return s instanceof e?s:new e(function(n){n(s)})}return new(e||(e=Promise))(function(s,n){function a(h){try{l(i.next(h))}catch(c){n(c)}}function d(h){try{l(i.throw(h))}catch(c){n(c)}}function l(h){h.done?s(h.value):o(h.value).then(a,d)}l((i=i.apply(r,[])).next())})}function Ie(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var It,zt;function xe(){return zt||(zt=1,It=function r(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var i,o,s;if(Array.isArray(t)){if(i=t.length,i!=e.length)return!1;for(o=i;o--!==0;)if(!r(t[o],e[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(s=Object.keys(t),i=s.length,i!==Object.keys(e).length)return!1;for(o=i;o--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[o]))return!1;for(o=i;o--!==0;){var n=s[o];if(!r(t[n],e[n]))return!1}return!0}return t!==t&&e!==e}),It}var Ee=xe(),Me=Ie(Ee);const Kt="__googleMapsScriptId";var tt;(function(r){r[r.INITIALIZED=0]="INITIALIZED",r[r.LOADING=1]="LOADING",r[r.SUCCESS=2]="SUCCESS",r[r.FAILURE=3]="FAILURE"})(tt||(tt={}));class H{constructor({apiKey:t,authReferrerPolicy:e,channel:i,client:o,id:s=Kt,language:n,libraries:a=[],mapIds:d,nonce:l,region:h,retries:c=3,url:u="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=t,this.authReferrerPolicy=e,this.channel=i,this.client=o,this.id=s||Kt,this.language=n,this.libraries=a,this.mapIds=d,this.nonce=l,this.region=h,this.retries=c,this.url=u,this.version=p,H.instance){if(!Me(this.options,H.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(H.instance.options)}`);return H.instance}H.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?tt.FAILURE:this.done?tt.SUCCESS:this.loading?tt.LOADING:tt.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let t=this.url;return t+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(t+=`&key=${this.apiKey}`),this.channel&&(t+=`&channel=${this.channel}`),this.client&&(t+=`&client=${this.client}`),this.libraries.length>0&&(t+=`&libraries=${this.libraries.join(",")}`),this.language&&(t+=`&language=${this.language}`),this.region&&(t+=`®ion=${this.region}`),this.version&&(t+=`&v=${this.version}`),this.mapIds&&(t+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(t+=`&auth_referrer_policy=${this.authReferrerPolicy}`),t}deleteScript(){const t=document.getElementById(this.id);t&&t.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((t,e)=>{this.loadCallback(i=>{i?e(i.error):t(window.google)})})}importLibrary(t){return this.execute(),google.maps.importLibrary(t)}loadCallback(t){this.callbacks.push(t),this.execute()}setScript(){var t,e;if(document.getElementById(this.id)){this.callback();return}const i={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(i).forEach(s=>!i[s]&&delete i[s]),!((e=(t=window==null?void 0:window.google)===null||t===void 0?void 0:t.maps)===null||e===void 0)&&e.importLibrary||(s=>{let n,a,d,l="The Google Maps JavaScript API",h="google",c="importLibrary",u="__ib__",p=document,g=window;g=g[h]||(g[h]={});const y=g.maps||(g.maps={}),v=new Set,m=new URLSearchParams,C=()=>n||(n=new Promise((f,P)=>Pe(this,void 0,void 0,function*(){var x;yield a=p.createElement("script"),a.id=this.id,m.set("libraries",[...v]+"");for(d in s)m.set(d.replace(/[A-Z]/g,w=>"_"+w[0].toLowerCase()),s[d]);m.set("callback",h+".maps."+u),a.src=this.url+"?"+m,y[u]=f,a.onerror=()=>n=P(Error(l+" could not load.")),a.nonce=this.nonce||((x=p.querySelector("script[nonce]"))===null||x===void 0?void 0:x.nonce)||"",p.head.append(a)})));y[c]?console.warn(l+" only loads once. Ignoring:",s):y[c]=(f,...P)=>v.add(f)&&C().then(()=>y[c](f,...P))})(i);const o=this.libraries.map(s=>this.importLibrary(s));o.length||o.push(this.importLibrary("core")),Promise.all(o).then(()=>this.callback(),s=>{const n=new ErrorEvent("error",{error:s});this.loadErrorCallback(n)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(t){if(this.errors.push(t),this.errors.length<=this.retries){const e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=t,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(t=>{t(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}function M(){return M=Object.assign?Object.assign.bind():function(r){for(var t=1;tl*Math.PI/180,i=e(r[1]),o=e(r[0]),s=e(t[1]),n=s-i,a=e(t[0])-o,d=Math.sin(n/2)*Math.sin(n/2)+Math.cos(i)*Math.cos(s)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d))*6371e3/1e3}const ce=63710088e-1;function _(r){return r%360*Math.PI/180}function ue(r){return r/6371.0088}function V(r){return r%(2*Math.PI)*180/Math.PI}function b(r,t=9){const e=Math.pow(10,t);return Math.round(r*e)/e}const $t=57.29577951308232,Ht=.017453292519943295,vt=6378137,S=(r,t)=>({x:r===0?0:r*Ht*vt,y:t===0?0:Math.log(Math.tan(Math.PI/4+t*Ht/2))*vt}),ot=(r,t)=>({lng:r===0?0:$t*(r/vt),lat:t===0?0:(2*Math.atan(Math.exp(t/vt))-Math.PI/2)*$t});function _e(r,t,e){const i=_(r[0]),o=_(r[1]),s=_(e),n=ue(t),a=Math.asin(Math.sin(o)*Math.cos(n)+Math.cos(o)*Math.sin(n)*Math.cos(s));return[V(i+Math.atan2(Math.sin(s)*Math.sin(n)*Math.cos(o),Math.cos(n)-Math.sin(o)*Math.sin(a))),V(a)]}function qt(r){const{center:t,radiusKilometers:e,coordinatePrecision:i}=r,o=r.steps?r.steps:64,s=[];for(let n=0;n0;function i(s){return s<0||s>1}function o(s,n,a,d){const l=t[s][n],h=t[s][n+1],c=t[a][d],u=t[a][d+1],p=function(v,m,C,f){if(ct(v,C)||ct(v,f)||ct(m,C)||ct(f,C))return null;const P=v[0],x=v[1],w=m[0],F=m[1],O=C[0],B=C[1],D=f[0],W=f[1],K=(P-w)*(B-W)-(x-F)*(O-D);return K===0?null:[((P*F-x*w)*(O-D)-(P-w)*(O*W-B*D))/K,((P*F-x*w)*(B-W)-(x-F)*(O*W-B*D))/K]}(l,h,c,u);if(p===null)return;let g,y;g=h[0]!==l[0]?(p[0]-l[0])/(h[0]-l[0]):(p[1]-l[1])/(h[1]-l[1]),y=u[0]!==c[0]?(p[0]-c[0])/(u[0]-c[0]):(p[1]-c[1])/(u[1]-c[1]),i(g)||i(y)||(p.toString(),e.push(p))}}function ct(r,t){return r[0]===t[0]&&r[1]===t[1]}function Pt(r,t){return Jt(r[0])<=t&&Jt(r[1])<=t}function Bt(r){return r.length===2&&typeof r[0]=="number"&&typeof r[1]=="number"&&r[0]!==1/0&&r[1]!==1/0&&(e=r[0])>=-180&&e<=180&&(t=r[1])>=-90&&t<=90;var t,e}function Jt(r){let t=1,e=0;for(;Math.round(r*t)/t!==r;)t*=10,e++;return e}const De="Feature has holes",ke="Feature has less than 4 coordinates",Oe="Feature has invalid coordinates",Be="Feature coordinates are not closed";function jt(r,t){if(r.geometry.type!=="Polygon")return{valid:!1,reason:"Feature is not a Polygon"};if(r.geometry.coordinates.length!==1)return{valid:!1,reason:De};if(r.geometry.coordinates[0].length<4)return{valid:!1,reason:ke};for(let o=0;oge(e,this.coordinatePrecision))}updateCircle(t){if(this.clickCount===1&&this.center&&this.currentCircleId){const e=T(this.center,[t.lng,t.lat]);let i;if(this.projection==="web-mercator"){const o=function(s,n){const a=1e3*T(s,n);if(a===0)return 1;const{x:d,y:l}=S(s[0],s[1]),{x:h,y:c}=S(n[0],n[1]);return Math.sqrt(Math.pow(h-d,2)+Math.pow(c-l,2))/a}(this.center,[t.lng,t.lat]);i=function(s){const{center:n,radiusKilometers:a,coordinatePrecision:d}=s,l=s.steps?s.steps:64,h=1e3*a,[c,u]=n,{x:p,y:g}=S(c,u),y=[];for(let v=0;v{const{x:e,y:i}=r,{x:o,y:s}=t,n=o-e,a=s-i;return Math.sqrt(a*a+n*n)};function Lt(r){if(!function(e){const i=e.coordinates[0];let o=0;for(let s=0;s{this.preventNewFeature=!1},this.autoCloseTimeout),this.close()),this.setCursor(this.cursors.close),this.preventPointsNearClose)return}else this.hasLeftStartingPoint=!0,this.setCursor(this.cursors.start);if(djt(e,this.coordinatePrecision))}}class k{constructor({store:t,mode:e,project:i,unproject:o,pointerDistance:s,coordinatePrecision:n,projection:a}){this.store=void 0,this.mode=void 0,this.project=void 0,this.unproject=void 0,this.pointerDistance=void 0,this.coordinatePrecision=void 0,this.projection=void 0,this.store=t,this.mode=e,this.project=i,this.unproject=o,this.pointerDistance=s,this.coordinatePrecision=n,this.projection=a}}function ye({unproject:r,point:t,pointerDistance:e}){const i=e/2,{x:o,y:s}=t;return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[r(o-i,s-i),r(o+i,s-i),r(o+i,s+i),r(o-i,s+i),r(o-i,s-i)].map(n=>[n.lng,n.lat])]}}}class lt extends k{constructor(t){super(t)}create(t){const{containerX:e,containerY:i}=t;return ye({unproject:this.unproject,point:{x:e,y:i},pointerDistance:this.pointerDistance})}}class ht extends k{constructor(t){super(t)}measure(t,e){const{x:i,y:o}=this.project(e[0],e[1]);return G({x:i,y:o},{x:t.containerX,y:t.containerY})}}class Ct extends k{constructor(t,e,i){super(t),this.config=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.getSnappableCoordinateFirstClick=o=>this.getSnappable(o,s=>!!(s.properties&&s.properties.mode===this.mode)).coordinate,this.getSnappableCoordinate=(o,s)=>this.getSnappable(o,n=>!!(n.properties&&n.properties.mode===this.mode&&n.id!==s)).coordinate,this.config=t,this.pixelDistance=e,this.clickBoundingBox=i}getSnappable(t,e){const i=this.clickBoundingBox.create(t),o=this.store.search(i,e),s={featureId:void 0,featureCoordinateIndex:void 0,coordinate:void 0,minDist:1/0};return o.forEach(n=>{let a;if(n.geometry.type==="Polygon")a=n.geometry.coordinates[0];else{if(n.geometry.type!=="LineString")return;a=n.geometry.coordinates}a.forEach((d,l)=>{const h=this.pixelDistance.measure(t,d);h180?n-=360:n<-180&&(n+=360),n}function Re(r,t,e){const i=[],o=r.length;let s,n,a,d=0;for(let h=0;h=d&&h===r.length-1);h++){if(d>t&&i.length===0){if(s=t-d,!s)return i.push(r[h]),i;n=Qt(r[h],r[h-1])-180,a=Zt(r[h],s,n),i.push(a)}if(d>=e)return s=e-d,s?(n=Qt(r[h],r[h-1])-180,a=Zt(r[h],s,n),i.push(a),i):(i.push(r[h]),i);if(d>=t&&i.push(r[h]),h===r.length-1)return i;d+=T(r[h],r[h+1])}if(d[b(e[0],this.config.coordinatePrecision),b(e[1],this.config.coordinatePrecision)])}}function mt(r,t){return r[0]===t[0]&&r[1]===t[1]}function Ve(r,t){if(r.geometry.type!=="LineString")return{valid:!1,reason:"Feature is not a LineString"};if(r.geometry.coordinates.length<2)return{valid:!1,reason:"Feature has less than 2 coordinates"};for(let e=0;ex||X(o,D)>x?T(Y(D),Y(i))<=T(Y(D),Y(o))?[Y(i),!0,!1]:[Y(o),!1,!0]:[Y(D),!1,!1]}function Ke(r,t,e){const i=t.x-r.x,o=t.y-r.y,s=Math.max(0,Math.min(1,((e.x-r.x)*i+(e.y-r.y)*o)/(i*i+o*o)));return{x:r.x+s*i,y:r.y+s*o}}class Wt extends k{constructor(t,e,i){super(t),this.config=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.getSnappableCoordinateFirstClick=o=>{const s=this.getSnappable(o,n=>!!(n.properties&&n.properties.mode===this.mode));return s.coordinate?[b(s.coordinate[0],this.config.coordinatePrecision),b(s.coordinate[1],this.config.coordinatePrecision)]:void 0},this.getSnappableCoordinate=(o,s)=>{const n=this.getSnappable(o,a=>!!(a.properties&&a.properties.mode===this.mode&&a.id!==s));return n.coordinate?[b(n.coordinate[0],this.config.coordinatePrecision),b(n.coordinate[1],this.config.coordinatePrecision)]:void 0},this.config=t,this.pixelDistance=e,this.clickBoundingBox=i}getSnappable(t,e){const i=this.clickBoundingBox.create(t),o=this.store.search(i,e),s={featureId:void 0,featureCoordinateIndex:void 0,coordinate:void 0,minDistance:1/0};return o.forEach(n=>{let a;if(n.geometry.type==="Polygon")a=n.geometry.coordinates[0];else{if(n.geometry.type!=="LineString")return;a=n.geometry.coordinates}const d=[];for(let u=0;uthis.lineStringFilter(n));if(!e||i===void 0)return;const o=this.store.getGeometryCopy(e);let s;if(o.type==="LineString"&&(s=o.coordinates,!(s.length<=2))){if(s.splice(i,1),this.validate&&!this.validate({id:e,type:"Feature",geometry:o,properties:{}},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:I.Commit}).valid)return;this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0),this.store.updateGeometry([{id:e,geometry:o}]),this.onFinish(e,{mode:this.mode,action:"edit"})}}onLeftClick(t){this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0);const e=this.snapCoordinate(t)||[t.lng,t.lat];this.currentCoordinate===0?this.createLine(e):this.currentCoordinate===1&&this.currentId?this.firstUpdateToLine(e):this.currentId&&this.updateToLine(e,{x:t.containerX,y:t.containerY})}onClick(t){(t.button==="right"&&this.allowPointerEvent(this.pointerEvents.rightClick,t)||t.button==="left"&&this.allowPointerEvent(this.pointerEvents.leftClick,t)||t.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,t))&&(this.currentCoordinate>0&&!this.mouseMove&&this.onMouseMove(t),this.mouseMove=!1,t.button==="right"?this.onRightClick(t):t.button==="left"&&this.onLeftClick(t))}onKeyDown(){}onKeyUp(t){t.key===this.keyEvents.cancel&&this.cleanUp(),t.key===this.keyEvents.finish&&this.close()}onDragStart(t,e){if(!this.allowPointerEvent(this.pointerEvents.onDragStart,t)||!this.editable)return;let i;if(this.state==="started"){const o=this.lineSnapping.getSnappable(t,n=>this.lineStringFilter(n));o.coordinate&&(this.editedSnapType="line",this.editedFeatureCoordinateIndex=o.featureCoordinateIndex,this.editedFeatureId=o.featureId,i=o.coordinate);const s=this.coordinateSnapping.getSnappable(t,n=>this.lineStringFilter(n));s.coordinate&&(this.editedSnapType="coordinate",this.editedFeatureCoordinateIndex=s.featureCoordinateIndex,this.editedFeatureId=s.featureId,i=s.coordinate)}if(this.editedFeatureId&&i){if(!this.editedPointId){const[o]=this.store.create([{geometry:{type:"Point",coordinates:i},properties:{mode:this.mode,[R]:!0}}]);this.editedPointId=o}this.setCursor(this.cursors.dragStart),e(!1)}}onDrag(t,e){if(!this.allowPointerEvent(this.pointerEvents.onDrag,t)||this.editedFeatureId===void 0||this.editedFeatureCoordinateIndex===void 0)return;const i=this.store.getGeometryCopy(this.editedFeatureId);this.editedSnapType==="coordinate"||this.editedSnapType==="line"&&this.editedInsertIndex!==void 0?i.coordinates[this.editedFeatureCoordinateIndex]=[t.lng,t.lat]:this.editedSnapType==="line"&&this.editedInsertIndex===void 0&&(this.editedInsertIndex=this.editedFeatureCoordinateIndex+1,i.coordinates.splice(this.editedInsertIndex,0,[t.lng,t.lat]),this.editedFeatureCoordinateIndex++);const o={type:"LineString",coordinates:i.coordinates};this.validate&&!this.validate({type:"Feature",geometry:o,properties:this.store.getPropertiesCopy(this.editedFeatureId)},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:I.Provisional}).valid||(this.snapping&&this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0),this.store.updateGeometry([{id:this.editedFeatureId,geometry:o}]),this.editedPointId&&this.store.updateGeometry([{id:this.editedPointId,geometry:{type:"Point",coordinates:[t.lng,t.lat]}}]),this.store.updateProperty([{id:this.editedFeatureId,property:R,value:!0}]))}onDragEnd(t,e){this.allowPointerEvent(this.pointerEvents.onDragEnd,t)&&this.editedFeatureId!==void 0&&(this.setCursor(this.cursors.dragEnd),this.editedPointId&&(this.store.delete([this.editedPointId]),this.editedPointId=void 0),this.store.updateProperty([{id:this.editedFeatureId,property:R,value:!1}]),this.onFinish(this.editedFeatureId,{mode:this.mode,action:"edit"}),this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedInsertIndex=void 0,this.editedSnapType=void 0,e(!0))}cleanUp(){const t=this.currentId,e=this.closingPointId,i=this.snappedPointId;this.closingPointId=void 0,this.snappedPointId=void 0,this.currentId=void 0,this.currentCoordinate=0,this.state==="drawing"&&this.setStarted();try{t!==void 0&&this.store.delete([t]),i!==void 0&&this.store.delete([i]),e!==void 0&&this.store.delete([e])}catch{}}styleFeature(t){const e=M({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});if(t.type==="Feature"&&t.geometry.type==="LineString"&&t.properties.mode===this.mode)return e.lineStringColor=this.getHexColorStylingValue(this.styles.lineStringColor,e.lineStringColor,t),e.lineStringWidth=this.getNumericStylingValue(this.styles.lineStringWidth,e.lineStringWidth,t),e.zIndex=U,e;if(t.type==="Feature"&&t.geometry.type==="Point"&&t.properties.mode===this.mode){const i=t.properties[et];return e.pointColor=this.getHexColorStylingValue(i?this.styles.closingPointColor:this.styles.snappingPointColor,e.pointColor,t),e.pointWidth=this.getNumericStylingValue(i?this.styles.closingPointWidth:this.styles.snappingPointWidth,e.pointWidth,t),e.pointOutlineColor=this.getHexColorStylingValue(i?this.styles.closingPointOutlineColor:this.styles.snappingPointOutlineColor,"#ffffff",t),e.pointOutlineWidth=this.getNumericStylingValue(i?this.styles.closingPointOutlineWidth:this.styles.snappingPointOutlineWidth,2,t),e.zIndex=50,e}return e}validateFeature(t){return this.validateModeFeature(t,e=>Ve(e,this.coordinatePrecision))}lineStringFilter(t){return!!(t.geometry.type==="LineString"&&t.properties&&t.properties.mode===this.mode)}snapCoordinate(t){var e,i,o;let s;if((e=this.snapping)!=null&&e.toLine){let n;n=this.currentId?this.lineSnapping.getSnappableCoordinate(t,this.currentId):this.lineSnapping.getSnappableCoordinateFirstClick(t),n&&(s=n)}return(i=this.snapping)!=null&&i.toCoordinate&&(s=this.currentId?this.coordinateSnapping.getSnappableCoordinate(t,this.currentId):this.coordinateSnapping.getSnappableCoordinateFirstClick(t)),(o=this.snapping)!=null&&o.toCustom&&(s=this.snapping.toCustom(t,{currentCoordinate:this.currentCoordinate,currentId:this.currentId,getCurrentGeometrySnapshot:this.currentId?()=>this.store.getGeometryCopy(this.currentId):()=>null,project:this.project,unproject:this.unproject})),s}}const He="Feature is not a Point",qe="Feature has invalid coordinates",Je="Feature has coordinates with excessive precision";function Ze(r,t){return r.geometry.type!=="Point"?{valid:!1,reason:He}:Bt(r.geometry.coordinates)?Pt(r.geometry.coordinates,t)?{valid:!0}:{valid:!1,reason:Je}:{valid:!1,reason:qe}}const Qe={create:"crosshair",dragStart:"grabbing",dragEnd:"crosshair"};class ti extends z{constructor(t){super(t,!0),this.mode="point",this.cursors=Qe,this.editable=!1,this.editedFeatureId=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.updateOptions(t)}updateOptions(t){super.updateOptions(t),t!=null&&t.cursors&&(this.cursors=M({},this.cursors,t.cursors)),t!=null&&t.editable&&(this.editable=t.editable)}start(){this.setStarted(),this.setCursor(this.cursors.create)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onClick(t){t.button==="right"&&this.allowPointerEvent(this.pointerEvents.rightClick,t)||t.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,t)?this.onRightClick(t):t.button==="left"&&this.allowPointerEvent(this.pointerEvents.leftClick,t)&&this.onLeftClick(t)}onMouseMove(){}onKeyDown(){}onKeyUp(){}cleanUp(){this.editedFeatureId=void 0}onDragStart(t,e){if(this.allowPointerEvent(this.pointerEvents.onDragStart,t)){if(this.editable){const i=this.getNearestPointFeature(t);this.editedFeatureId=i==null?void 0:i.id}this.editedFeatureId&&(this.setCursor(this.cursors.dragStart),e(!1))}}onDrag(t,e){this.allowPointerEvent(this.pointerEvents.onDrag,t)&&this.editedFeatureId!==void 0&&(this.validate&&!this.validate({type:"Feature",geometry:{type:"Point",coordinates:[t.lng,t.lat]},properties:this.store.getPropertiesCopy(this.editedFeatureId)},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:I.Finish}).valid||(this.store.updateGeometry([{id:this.editedFeatureId,geometry:{type:"Point",coordinates:[t.lng,t.lat]}}]),this.store.updateProperty([{id:this.editedFeatureId,property:R,value:!0}])))}onDragEnd(t,e){this.allowPointerEvent(this.pointerEvents.onDragEnd,t)&&this.editedFeatureId!==void 0&&(this.onFinish(this.editedFeatureId,{mode:this.mode,action:"edit"}),this.setCursor(this.cursors.dragEnd),this.store.updateProperty([{id:this.editedFeatureId,property:R,value:!1}]),this.editedFeatureId=void 0,e(!0))}registerBehaviors(t){this.pixelDistance=new ht(t),this.clickBoundingBox=new lt(t)}styleFeature(t){const e=M({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});if(t.type==="Feature"&&t.geometry.type==="Point"&&t.properties.mode===this.mode){const i=!!(t.id&&this.editedFeatureId===t.id);e.pointWidth=this.getNumericStylingValue(i?this.styles.editedPointWidth:this.styles.pointWidth,e.pointWidth,t),e.pointColor=this.getHexColorStylingValue(i?this.styles.editedPointColor:this.styles.pointColor,e.pointColor,t),e.pointOutlineColor=this.getHexColorStylingValue(i?this.styles.editedPointOutlineColor:this.styles.pointOutlineColor,e.pointOutlineColor,t),e.pointOutlineWidth=this.getNumericStylingValue(i?this.styles.editedPointOutlineWidth:this.styles.pointOutlineWidth,2,t),e.zIndex=30}return e}validateFeature(t){return this.validateModeFeature(t,e=>Ze(e,this.coordinatePrecision))}onLeftClick(t){const e={type:"Point",coordinates:[t.lng,t.lat]},i={mode:this.mode};if(this.validate&&!this.validate({type:"Feature",geometry:e,properties:i},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:I.Finish}).valid)return;const[o]=this.store.create([{geometry:e,properties:i}]);this.onFinish(o,{mode:this.mode,action:"draw"})}onRightClick(t){if(!this.editable)return;const e=this.getNearestPointFeature(t);e&&this.store.delete([e.id])}getNearestPointFeature(t){const e=this.clickBoundingBox.create(t),i=this.store.search(e);let o,s=1/0;for(let n=0;ns||d>this.pointerDistance||(s=d,o=a)}return o}}class ei extends k{constructor(t,e){super(t),this.config=void 0,this.pixelDistance=void 0,this._startEndPoints=[],this.config=t,this.pixelDistance=e}get ids(){return this._startEndPoints.concat()}set ids(t){}create(t,e){if(this.ids.length)throw new Error("Opening and closing points already created");if(t.length<=3)throw new Error("Requires at least 4 coordinates");this._startEndPoints=this.store.create([{geometry:{type:"Point",coordinates:t[0]},properties:{mode:e,[et]:!0}},{geometry:{type:"Point",coordinates:t[t.length-2]},properties:{mode:e,[et]:!0}}])}delete(){this.ids.length&&(this.store.delete(this.ids),this._startEndPoints=[])}update(t){if(this.ids.length!==2)throw new Error("No closing points to update");this.store.updateGeometry([{id:this.ids[0],geometry:{type:"Point",coordinates:t[0]}},{id:this.ids[1],geometry:{type:"Point",coordinates:t[t.length-3]}}])}isClosingPoint(t){const e=this.store.getGeometryCopy(this.ids[0]),i=this.store.getGeometryCopy(this.ids[1]),o=this.pixelDistance.measure(t,e.coordinates),s=this.pixelDistance.measure(t,i.coordinates);return{isClosing:othis.store.has(a))){const a=s.coordinatePointIds,d=a.map(l=>this.store.getGeometryCopy(l).coordinates);if(a.length!==o.length){this.deleteCoordinatePoints(a);const l=this.createPoints(o,i.mode,t);this.setFeatureCoordinatePoints(t,l)}else o.forEach((l,h)=>{l[0]===d[h][0]&&l[1]===d[h][1]||this.store.updateGeometry([{id:a[h],geometry:{type:"Point",coordinates:l}}])})}else{const a=n.filter(l=>this.store.has(l));a.length&&this.deleteCoordinatePoints(a);const d=this.createPoints(o,i.mode,t);this.setFeatureCoordinatePoints(t,d)}else{const a=this.createPoints(o,i.mode,t);this.setFeatureCoordinatePoints(t,a)}}deletePointsByFeatureIds(t){for(const e of t)this.deleteIfPresent(e)}getUpdated(t,e){const i=this.store.getPropertiesCopy(t);if(i.coordinatePointIds)return i.coordinatePointIds.map((o,s)=>({id:o,geometry:M({},this.store.getGeometryCopy(o),{coordinates:e[s]})}))}createPoints(t,e,i){return this.store.create(t.map((o,s)=>({geometry:{type:"Point",coordinates:o},properties:{mode:e,[Ot]:!0,[Se]:i,index:s}})))}setFeatureCoordinatePoints(t,e){this.store.updateProperty([{id:t,property:dt,value:e}])}deleteCoordinatePoints(t){const e=t.filter(i=>this.store.has(i));this.store.delete(e)}deleteIfPresent(t){const e=this.store.getPropertiesCopy(t).coordinatePointIds;e&&(this.deleteCoordinatePoints(e),this.setFeatureCoordinatePoints(t,null))}}const ii={cancel:"Escape",finish:"Enter"},oi={start:"crosshair",close:"pointer",dragStart:"grabbing",dragEnd:"crosshair"};class si extends z{constructor(t){super(t,!0),this.mode="polygon",this.currentCoordinate=0,this.currentId=void 0,this.keyEvents=ii,this.cursors=oi,this.mouseMove=!1,this.showCoordinatePoints=!1,this.snapping=void 0,this.snappedPointId=void 0,this.editable=!1,this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedSnapType=void 0,this.editedInsertIndex=void 0,this.editedPointId=void 0,this.coordinatePoints=void 0,this.lineSnapping=void 0,this.coordinateSnapping=void 0,this.pixelDistance=void 0,this.closingPoints=void 0,this.clickBoundingBox=void 0,this.updateOptions(t)}updateOptions(t){if(super.updateOptions(t),t!=null&&t.cursors&&(this.cursors=M({},this.cursors,t.cursors)),(t==null?void 0:t.keyEvents)===null?this.keyEvents={cancel:null,finish:null}:t!=null&&t.keyEvents&&(this.keyEvents=M({},this.keyEvents,t.keyEvents)),t!=null&&t.snapping&&(this.snapping=t.snapping),(t==null?void 0:t.editable)!==void 0&&(this.editable=t.editable),(t==null?void 0:t.pointerEvents)!==void 0&&(this.pointerEvents=t.pointerEvents),(t==null?void 0:t.showCoordinatePoints)!==void 0){if(this.showCoordinatePoints=t.showCoordinatePoints,this.coordinatePoints&&t.showCoordinatePoints===!0)this.store.copyAllWhere(e=>e.mode===this.mode).map(e=>e.id).forEach(e=>{this.coordinatePoints.createOrUpdate(e)});else if(this.coordinatePoints&&this.showCoordinatePoints===!1){const e=this.store.copyAllWhere(i=>i.mode===this.mode&&!!i[dt]);this.coordinatePoints.deletePointsByFeatureIds(e.map(i=>i.id))}}}close(){if(this.currentId===void 0)return;const t=this.store.getGeometryCopy(this.currentId).coordinates[0];if(t.length<5||!this.updatePolygonGeometry([...t.slice(0,-2),t[0]],I.Finish))return;const e=this.currentId;if(this.currentId){const i=Lt(this.store.getGeometryCopy(this.currentId));i&&this.store.updateGeometry([{id:this.currentId,geometry:i}]),this.store.updateProperty([{id:this.currentId,property:N,value:void 0}])}this.snappedPointId&&this.store.delete([this.snappedPointId]),this.currentCoordinate=0,this.currentId=void 0,this.snappedPointId=void 0,this.closingPoints.delete(),this.state==="drawing"&&this.setStarted(),this.onFinish(e,{mode:this.mode,action:"draw"})}registerBehaviors(t){this.clickBoundingBox=new lt(t),this.pixelDistance=new ht(t),this.lineSnapping=new Wt(t,this.pixelDistance,this.clickBoundingBox),this.coordinateSnapping=new Ct(t,this.pixelDistance,this.clickBoundingBox),this.closingPoints=new ei(t,this.pixelDistance),this.coordinatePoints=new fe(t)}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onMouseMove(t){this.mouseMove=!0,this.setCursor(this.cursors.start);const e=this.snapCoordinate(t);if(e){if(this.snappedPointId)this.store.updateGeometry([{id:this.snappedPointId,geometry:{type:"Point",coordinates:e}}]);else{const[s]=this.store.create([{geometry:{type:"Point",coordinates:e},properties:{mode:this.mode,[Ft]:!0}}]);this.snappedPointId=s}t.lng=e[0],t.lat=e[1]}else this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0);if(this.currentId===void 0||this.currentCoordinate===0)return;const i=this.store.getGeometryCopy(this.currentId).coordinates[0];let o;if(this.currentCoordinate===1){const s=1/Math.pow(10,this.coordinatePrecision-1),n=Math.max(1e-6,s);o=[i[0],[t.lng,t.lat],[t.lng,t.lat-n],i[0]]}else if(this.currentCoordinate===2)o=[i[0],i[1],[t.lng,t.lat],i[0]];else{const{isClosing:s,isPreviousClosing:n}=this.closingPoints.isClosingPoint(t);n||s?(this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0),this.setCursor(this.cursors.close),o=[...i.slice(0,-2),i[0],i[0]]):o=[...i.slice(0,-2),[t.lng,t.lat],i[0]]}this.updatePolygonGeometry(o,I.Provisional)}updatePolygonGeometry(t,e){if(!this.currentId)return!1;const i={type:"Polygon",coordinates:[t]};return!(this.validate&&!this.validate({type:"Feature",geometry:i},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:e}).valid||(this.store.updateGeometry([{id:this.currentId,geometry:i}]),this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate(this.currentId),0))}snapCoordinate(t){var e,i,o;let s;if((e=this.snapping)!=null&&e.toLine){let n;n=this.currentId?this.lineSnapping.getSnappableCoordinate(t,this.currentId):this.lineSnapping.getSnappableCoordinateFirstClick(t),n&&(s=n)}if((i=this.snapping)!=null&&i.toCoordinate){let n;n=this.currentId?this.coordinateSnapping.getSnappableCoordinate(t,this.currentId):this.coordinateSnapping.getSnappableCoordinateFirstClick(t),n&&(s=n)}return(o=this.snapping)!=null&&o.toCustom&&(s=this.snapping.toCustom(t,{currentCoordinate:this.currentCoordinate,currentId:this.currentId,getCurrentGeometrySnapshot:this.currentId?()=>this.store.getGeometryCopy(this.currentId):()=>null,project:this.project,unproject:this.unproject})),s}polygonFilter(t){return!!(t.geometry.type==="Polygon"&&t.properties&&t.properties.mode===this.mode)}onRightClick(t){if(!this.editable||this.state!=="started")return;const{featureId:e,featureCoordinateIndex:i}=this.coordinateSnapping.getSnappable(t,n=>this.polygonFilter(n));if(!e||i===void 0)return;const o=this.store.getGeometryCopy(e);let s;o.type==="Polygon"&&(s=o.coordinates[0],s.length<=4||(o.type!=="Polygon"||i!==0&&i!==s.length-1?s.splice(i,1):(s.shift(),s.pop(),s.push([s[0][0],s[0][1]])),(!this.validate||this.validate({id:e,type:"Feature",geometry:o,properties:{}},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:I.Commit}).valid)&&(this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0),this.store.updateGeometry([{id:e,geometry:o}]),this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate(e),this.onFinish(e,{mode:this.mode,action:"edit"}))))}onLeftClick(t){if(this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0),this.currentCoordinate===0){const e=this.snapCoordinate(t);e&&(t.lng=e[0],t.lat=e[1]);const[i]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[t.lng,t.lat],[t.lng,t.lat],[t.lng,t.lat],[t.lng,t.lat]]]},properties:{mode:this.mode,[N]:!0}}]);this.currentId=i,this.currentCoordinate++,this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate(i),this.setDrawing()}else if(this.currentCoordinate===1&&this.currentId){const e=this.snapCoordinate(t);e&&(t.lng=e[0],t.lat=e[1]);const i=this.store.getGeometryCopy(this.currentId);if(mt([t.lng,t.lat],i.coordinates[0][0])||!this.updatePolygonGeometry([i.coordinates[0][0],[t.lng,t.lat],[t.lng,t.lat],i.coordinates[0][0]],I.Commit))return;this.currentCoordinate++}else if(this.currentCoordinate===2&&this.currentId){const e=this.snapCoordinate(t);e&&(t.lng=e[0],t.lat=e[1]);const i=this.store.getGeometryCopy(this.currentId).coordinates[0];if(mt([t.lng,t.lat],i[1])||!this.updatePolygonGeometry([i[0],i[1],[t.lng,t.lat],[t.lng,t.lat],i[0]],I.Commit))return;this.currentCoordinate===2&&this.closingPoints.create(i,"polygon"),this.currentCoordinate++}else if(this.currentId){const e=this.store.getGeometryCopy(this.currentId).coordinates[0],{isClosing:i,isPreviousClosing:o}=this.closingPoints.isClosingPoint(t);if(o||i)this.close();else{const s=this.snapCoordinate(t);if(s&&(t.lng=s[0],t.lat=s[1]),mt([t.lng,t.lat],e[this.currentCoordinate-1]))return;const n=function(a=[[[0,0],[0,1],[1,1],[1,0],[0,0]]]){return{type:"Feature",geometry:{type:"Polygon",coordinates:a},properties:{}}}([[...e.slice(0,-1),[t.lng,t.lat],e[0]]]);if(!this.updatePolygonGeometry(n.geometry.coordinates[0],I.Commit))return;this.currentCoordinate++,this.closingPoints.ids.length&&this.closingPoints.update(n.geometry.coordinates[0])}}}onClick(t){this.currentCoordinate>0&&!this.mouseMove&&this.onMouseMove(t),this.mouseMove=!1,t.button==="right"&&this.allowPointerEvent(this.pointerEvents.rightClick,t)||t.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,t)?this.onRightClick(t):t.button==="left"&&this.allowPointerEvent(this.pointerEvents.leftClick,t)&&this.onLeftClick(t)}onKeyUp(t){t.key===this.keyEvents.cancel?this.cleanUp():t.key===this.keyEvents.finish&&this.close()}onKeyDown(){}onDragStart(t,e){if(!this.allowPointerEvent(this.pointerEvents.onDragStart,t)||!this.editable)return;let i;if(this.state==="started"){const o=this.lineSnapping.getSnappable(t,n=>this.polygonFilter(n));o.coordinate&&(this.editedSnapType="line",this.editedFeatureCoordinateIndex=o.featureCoordinateIndex,this.editedFeatureId=o.featureId,i=o.coordinate);const s=this.coordinateSnapping.getSnappable(t,n=>this.polygonFilter(n));s.coordinate&&(this.editedSnapType="coordinate",this.editedFeatureCoordinateIndex=s.featureCoordinateIndex,this.editedFeatureId=s.featureId,i=s.coordinate)}if(this.editedFeatureId&&i){if(!this.editedPointId){const[o]=this.store.create([{geometry:{type:"Point",coordinates:i},properties:{mode:this.mode,[R]:!0}}]);this.editedPointId=o}this.setCursor(this.cursors.dragStart),e(!1)}}onDrag(t,e){if(!this.allowPointerEvent(this.pointerEvents.onDrag,t)||this.editedFeatureId===void 0||this.editedFeatureCoordinateIndex===void 0)return;const i=this.store.getGeometryCopy(this.editedFeatureId),o=i.coordinates[0];this.editedSnapType==="coordinate"||this.editedSnapType==="line"&&this.editedInsertIndex!==void 0?this.editedFeatureCoordinateIndex===0||this.editedFeatureCoordinateIndex===i.coordinates[0].length-1?(o[0]=[t.lng,t.lat],o[o.length-1]=[t.lng,t.lat]):o[this.editedFeatureCoordinateIndex]=[t.lng,t.lat]:this.editedSnapType==="line"&&this.editedInsertIndex===void 0&&(this.editedInsertIndex=this.editedFeatureCoordinateIndex+1,i.coordinates[0].splice(this.editedInsertIndex,0,[t.lng,t.lat]),this.editedFeatureCoordinateIndex++);const s={type:"Polygon",coordinates:i.coordinates};this.validate&&!this.validate({type:"Feature",geometry:s,properties:this.store.getPropertiesCopy(this.editedFeatureId)},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:I.Provisional}).valid||(this.snapping&&this.snappedPointId&&(this.store.delete([this.snappedPointId]),this.snappedPointId=void 0),this.store.updateGeometry([{id:this.editedFeatureId,geometry:s}]),this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate(this.editedFeatureId),this.editedPointId&&this.store.updateGeometry([{id:this.editedPointId,geometry:{type:"Point",coordinates:[t.lng,t.lat]}}]),this.store.updateProperty([{id:this.editedFeatureId,property:R,value:!0}]))}onDragEnd(t,e){this.allowPointerEvent(this.pointerEvents.onDragEnd,t)&&this.editedFeatureId!==void 0&&(this.setCursor(this.cursors.dragEnd),this.editedPointId&&(this.store.delete([this.editedPointId]),this.editedPointId=void 0),this.store.updateProperty([{id:this.editedFeatureId,property:R,value:!1}]),this.onFinish(this.editedFeatureId,{mode:this.mode,action:"edit"}),this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedInsertIndex=void 0,this.editedSnapType=void 0,e(!0))}cleanUp(){const t=this.currentId,e=this.snappedPointId,i=this.editedPointId;this.currentId=void 0,this.snappedPointId=void 0,this.editedPointId=void 0,this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedInsertIndex=void 0,this.editedSnapType=void 0,this.currentCoordinate=0,this.state==="drawing"&&this.setStarted();try{t&&this.coordinatePoints.deletePointsByFeatureIds([t]),t!==void 0&&this.store.delete([t]),i!==void 0&&this.store.delete([i]),e!==void 0&&this.store.delete([e]),this.closingPoints.ids.length&&this.closingPoints.delete()}catch{}}styleFeature(t){const e=M({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});if(t.properties.mode===this.mode){if(t.geometry.type==="Polygon")return e.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,e.polygonFillColor,t),e.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,e.polygonOutlineColor,t),e.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,e.polygonOutlineWidth,t),e.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,e.polygonFillOpacity,t),e.zIndex=U,e;if(t.geometry.type==="Point"){const i=t.properties[R],o=t.properties[Ot],s=i?"editedPoint":t.properties[et]?"closingPoint":t.properties[Ft]?"snappingPoint":o?"coordinatePoint":void 0;if(!s)return e;const n={editedPoint:{width:this.styles.editedPointOutlineWidth,color:this.styles.editedPointColor,outlineColor:this.styles.editedPointOutlineColor,outlineWidth:this.styles.editedPointOutlineWidth},closingPoint:{width:this.styles.closingPointWidth,color:this.styles.closingPointColor,outlineColor:this.styles.closingPointOutlineColor,outlineWidth:this.styles.closingPointOutlineWidth},snappingPoint:{width:this.styles.snappingPointWidth,color:this.styles.snappingPointColor,outlineColor:this.styles.snappingPointOutlineColor,outlineWidth:this.styles.snappingPointOutlineWidth},coordinatePoint:{width:this.styles.coordinatePointWidth,color:this.styles.coordinatePointColor,outlineColor:this.styles.coordinatePointOutlineColor,outlineWidth:this.styles.coordinatePointOutlineWidth}};return e.pointWidth=this.getNumericStylingValue(n[s].width,e.pointWidth,t),e.pointColor=this.getHexColorStylingValue(n[s].color,e.pointColor,t),e.pointOutlineColor=this.getHexColorStylingValue(n[s].outlineColor,e.pointOutlineColor,t),e.pointOutlineWidth=this.getNumericStylingValue(n[s].outlineWidth,2,t),e.zIndex=i?40:o?20:30,e}}return e}afterFeatureAdded(t){this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate(t.id)}validateFeature(t){return this.validateModeFeature(t,e=>jt(e,this.coordinatePrecision))}}const ni={cancel:"Escape",finish:"Enter"},ri={start:"crosshair"};class ai extends z{constructor(t){super(t,!0),this.mode="rectangle",this.center=void 0,this.clickCount=0,this.currentRectangleId=void 0,this.keyEvents=ni,this.cursors=ri,this.updateOptions(t)}updateOptions(t){super.updateOptions(t),t!=null&&t.cursors&&(this.cursors=M({},this.cursors,t.cursors)),(t==null?void 0:t.keyEvents)===null?this.keyEvents={cancel:null,finish:null}:t!=null&&t.keyEvents&&(this.keyEvents=M({},this.keyEvents,t.keyEvents))}updateRectangle(t,e){if(this.clickCount===1&&this.center&&this.currentRectangleId){const i=this.store.getGeometryCopy(this.currentRectangleId).coordinates[0][0],o={type:"Polygon",coordinates:[[i,[t.lng,i[1]],[t.lng,t.lat],[i[0],t.lat],i]]};if(this.validate&&!this.validate({id:this.currentRectangleId,geometry:o},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:e}).valid)return;this.store.updateGeometry([{id:this.currentRectangleId,geometry:o}])}}close(){const t=this.currentRectangleId;if(t){const e=Lt(this.store.getGeometryCopy(t));e&&this.store.updateGeometry([{id:t,geometry:e}]),this.store.updateProperty([{id:t,property:N,value:void 0}])}this.center=void 0,this.currentRectangleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),t!==void 0&&this.onFinish(t,{mode:this.mode,action:"draw"})}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onClick(t){if(t.button==="right"&&this.allowPointerEvent(this.pointerEvents.rightClick,t)||t.button==="left"&&this.allowPointerEvent(this.pointerEvents.leftClick,t)||t.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,t))if(this.clickCount===0){this.center=[t.lng,t.lat];const[e]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[t.lng,t.lat],[t.lng,t.lat],[t.lng,t.lat],[t.lng,t.lat]]]},properties:{mode:this.mode,[N]:!0}}]);this.currentRectangleId=e,this.clickCount++,this.setDrawing()}else this.updateRectangle(t,I.Finish),this.close()}onMouseMove(t){this.updateRectangle(t,I.Provisional)}onKeyDown(){}onKeyUp(t){t.key===this.keyEvents.cancel?this.cleanUp():t.key===this.keyEvents.finish&&this.close()}onDragStart(){}onDrag(){}onDragEnd(){}cleanUp(){const t=this.currentRectangleId;this.center=void 0,this.currentRectangleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),t!==void 0&&this.store.delete([t])}styleFeature(t){const e=M({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});return t.type==="Feature"&&t.geometry.type==="Polygon"&&t.properties.mode===this.mode&&(e.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,e.polygonFillColor,t),e.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,e.polygonOutlineColor,t),e.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,e.polygonOutlineWidth,t),e.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,e.polygonFillOpacity,t),e.zIndex=U),e}validateFeature(t){return this.validateModeFeature(t,e=>ge(e,this.coordinatePrecision))}}function _t(r,t){const e=r,i=t,o=_(e[1]),s=_(i[1]);let n=_(i[0]-e[0]);n>Math.PI&&(n-=2*Math.PI),n<-Math.PI&&(n+=2*Math.PI);const a=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),d=(V(Math.atan2(n,a))+360)%360;return d>180?-(360-d):d}function me(r,t,e){let i=t;t<0&&(i=-Math.abs(i));const o=i/ce,s=r[0]*Math.PI/180,n=_(r[1]),a=_(e),d=o*Math.cos(a);let l=n+d;Math.abs(l)>Math.PI/2&&(l=l>0?Math.PI-l:-Math.PI-l);const h=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),c=Math.abs(h)>1e-11?d/h:Math.cos(n),u=[(180*(s+o*Math.sin(a)/c)/Math.PI+540)%360-180,180*l/Math.PI];return u[0]+=u[0]-r[0]>180?-360:r[0]-u[0]>180?360:0,u}function di(r,t,e,i,o){const s=i(r[0],r[1]),n=i(t[0],t[1]),{lng:a,lat:d}=o((s.x+n.x)/2,(s.y+n.y)/2);return[b(a,e),b(d,e)]}function li(r,t,e){const i=me(r,1e3*T(r,t)/2,_t(r,t));return[b(i[0],e),b(i[1],e)]}function ie({featureCoords:r,precision:t,unproject:e,project:i,projection:o}){const s=[];for(let n=0;n({geometry:{type:"Point",coordinates:h},properties:s(c)}))}(t,o=>({mode:this.mode,[L.MID_POINT]:!0,midPointSegment:o,midPointFeatureId:e}),i,this.config.project,this.config.unproject,this.projection))}delete(){this._midPoints.length&&(this.store.delete(this._midPoints),this._midPoints=[])}getUpdated(t){if(this._midPoints.length!==0)return ie({featureCoords:t,precision:this.coordinatePrecision,project:this.config.project,unproject:this.config.unproject,projection:this.config.projection}).map((e,i)=>({id:this._midPoints[i],geometry:{type:"Point",coordinates:e}}))}}class ci extends k{constructor(t){super(t),this._selectionPoints=[]}get ids(){return this._selectionPoints.concat()}set ids(t){}create(t,e,i){this._selectionPoints=this.store.create(function(o,s,n){const a=[],d=s==="Polygon"?o.length-1:o.length;for(let l=0;l({mode:this.mode,index:o,[L.SELECTION_POINT]:!0,[L.SELECTION_POINT_FEATURE_ID]:i})))}delete(){this.ids.length&&(this.store.delete(this.ids),this._selectionPoints=[])}getUpdated(t){if(this._selectionPoints.length!==0)return this._selectionPoints.map((e,i)=>({id:e,geometry:{type:"Point",coordinates:t[i]}}))}getOneUpdated(t,e){if(this._selectionPoints[t]!==void 0)return{id:this._selectionPoints[t],geometry:{type:"Point",coordinates:e}}}}function ve(r,t){let e=!1;for(let n=0,a=t.length;n(i=r)[1]!=(s=d[c])[1]>i[1]&&i[0]<(s[0]-o[0])*(i[1]-o[1])/(s[1]-o[1])+o[0]&&(e=!e)}var i,o,s;return e}const Dt=(r,t,e)=>{const i=s=>s*s,o=(s,n)=>i(s.x-n.x)+i(s.y-n.y);return Math.sqrt(((s,n,a)=>{const d=o(n,a);if(d===0)return o(s,n);let l=((s.x-n.x)*(a.x-n.x)+(s.y-n.y)*(a.y-n.y))/d;return l=Math.max(0,Math.min(1,l)),o(s,{x:n.x+l*(a.x-n.x),y:n.y+l*(a.y-n.y)})})(r,t,e))};class ui extends k{constructor(t,e,i){super(t),this.config=void 0,this.createClickBoundingBox=void 0,this.pixelDistance=void 0,this.config=t,this.createClickBoundingBox=e,this.pixelDistance=i}find(t,e){let i,o,s,n,a=1/0,d=1/0,l=1/0;const h=this.createClickBoundingBox.create(t),c=this.store.search(h);for(let u=0;u180||u<-180||p>90||p<-90)return!1;s[h]=[u,p]}i.type==="Polygon"&&(s[s.length-1]=[s[0][0],s[0][1]]);const a=this.selectionPoints.getUpdated(s)||[],d=this.midPoints.getUpdated(s)||[],l=this.coordinatePoints.getUpdated(this.draggedFeatureId,s)||[];if(e&&!e({type:"Feature",id:this.draggedFeatureId,geometry:i,properties:{}},{project:this.config.project,unproject:this.config.unproject,coordinatePrecision:this.config.coordinatePrecision,updateType:I.Provisional}).valid)return!1;this.store.updateGeometry([{id:this.draggedFeatureId,geometry:i},...a,...d,...l]),this.dragPosition=[t.lng,t.lat]}else i.type==="Point"&&(this.store.updateGeometry([{id:this.draggedFeatureId,geometry:{type:"Point",coordinates:o}}]),this.dragPosition=[t.lng,t.lat])}}class gi extends k{constructor(t,e,i,o,s,n,a){super(t),this.config=void 0,this.pixelDistance=void 0,this.selectionPoints=void 0,this.midPoints=void 0,this.coordinatePoints=void 0,this.coordinateSnapping=void 0,this.lineSnapping=void 0,this.draggedCoordinate={id:null,index:-1},this.config=t,this.pixelDistance=e,this.selectionPoints=i,this.midPoints=o,this.coordinatePoints=s,this.coordinateSnapping=n,this.lineSnapping=a}getClosestCoordinate(t,e){const i={dist:1/0,index:-1,isFirstOrLastPolygonCoord:!1};let o;if(e.type==="LineString")o=e.coordinates;else{if(e.type!=="Polygon")return i;o=e.coordinates[0]}for(let s=0;s!!(n.properties&&n.properties.mode===i.properties.mode&&n.id!==this.draggedCoordinate.id);if(e!=null&&e.toLine){let n;n=this.lineSnapping.getSnappable(t,s).coordinate,n&&(o=n)}if(e.toCoordinate){let n;n=this.coordinateSnapping.getSnappable(t,s).coordinate,n&&(o=n)}if(e!=null&&e.toCustom){let n;n=e.toCustom(t,{currentCoordinate:this.draggedCoordinate.index,currentId:i.id,getCurrentGeometrySnapshot:i.id?()=>this.store.getGeometryCopy(i.id):()=>null,project:this.project,unproject:this.unproject}),n&&(o=n)}return o}drag(t,e,i,o){const s=this.draggedCoordinate.id;if(s===null)return!1;const n=this.draggedCoordinate.index,a=this.store.getGeometryCopy(s),d=this.store.getPropertiesCopy(s),l=a.type==="LineString"?a.coordinates:a.coordinates[0],h=a.type==="Polygon"&&(n===l.length-1||n===0),c={type:"Feature",id:s,geometry:a,properties:d},u=this.snapCoordinate(t,o,c);if(t.lng>180||t.lng<-180||t.lat>90||t.lat<-90)return!1;if(h){const m=l.length-1;l[0]=u,l[m]=u}else l[n]=u;const p=this.selectionPoints.getOneUpdated(n,u),g=p?[p]:[],y=this.midPoints.getUpdated(l)||[],v=this.coordinatePoints.getUpdated(s,l)||[];return!(a.type!=="Point"&&!e&&pe({geometry:a})||i&&!i(c,{project:this.config.project,unproject:this.config.unproject,coordinatePrecision:this.config.coordinatePrecision,updateType:I.Provisional}).valid||(this.store.updateGeometry([{id:s,geometry:a},...g,...y,...v]),0))}isDragging(){return this.draggedCoordinate.id!==null}startDragging(t,e){this.draggedCoordinate={id:t,index:e}}stopDragging(){this.draggedCoordinate={id:null,index:-1}}}function oe(r){let t=0,e=0,i=0;return(r.geometry.type==="Polygon"?r.geometry.coordinates[0].slice(0,-1):r.geometry.coordinates).forEach(o=>{t+=o[0],e+=o[1],i++},!0),[t/i,e/i]}function kt(r){const t=(r.geometry.type==="Polygon"?r.geometry.coordinates[0]:r.geometry.coordinates).map(e=>{const{x:i,y:o}=S(e[0],e[1]);return[i,o]});return r.geometry.type==="Polygon"?function(e){let i=0,o=0,s=0;const n=e.length;for(let a=0;a{if(g===0||g===360||g===-360)return p;const y=.017453292519943295*g,v=(p.geometry.type==="Polygon"?p.geometry.coordinates[0]:p.geometry.coordinates).map(([f,P])=>S(f,P)),m=v.reduce((f,P)=>({x:f.x+P.x,y:f.y+P.y}),{x:0,y:0});m.x/=v.length,m.y/=v.length;const C=v.map(f=>({x:m.x+(f.x-m.x)*Math.cos(y)-(f.y-m.y)*Math.sin(y),y:m.y+(f.x-m.x)*Math.sin(y)+(f.y-m.y)*Math.cos(y)})).map(({x:f,y:P})=>[ot(f,P).lng,ot(f,P).lat]);p.geometry.type==="Polygon"?p.geometry.coordinates[0]=C:p.geometry.coordinates=C})(a,-(this.lastBearing-n))}else{if(this.config.projection!=="globe")throw new Error("Unsupported projection");if(this.selectedGeometryCentroid||(this.selectedGeometryCentroid=oe({geometry:o})),n=_t(this.selectedGeometryCentroid,s),!this.lastBearing)return void(this.lastBearing=n+180);(function(u,p){if(p===0||p===360||p===-360)return u;const g=oe(u);(u.geometry.type==="Polygon"?u.geometry.coordinates[0]:u.geometry.coordinates).forEach(y=>{const v=_t(g,y)+p,m=function(f,P){f[0]+=f[0]-P[0]>180?-360:P[0]-f[0]>180?360:0;const x=ce,w=P[1]*Math.PI/180,F=f[1]*Math.PI/180,O=F-w;let B=Math.abs(f[0]-P[0])*Math.PI/180;B>Math.PI&&(B-=2*Math.PI);const D=Math.log(Math.tan(F/2+Math.PI/4)/Math.tan(w/2+Math.PI/4)),W=Math.abs(D)>1e-11?O/D:Math.cos(w);return Math.sqrt(O*O+W*W*B*B)*x}(g,y),C=me(g,m,v);y[0]=C[0],y[1]=C[1]})})(a,-(this.lastBearing-(n+180)))}const d=o.type==="Polygon"?o.coordinates[0]:o.coordinates;d.forEach(u=>{u[0]=b(u[0],this.coordinatePrecision),u[1]=b(u[1],this.coordinatePrecision)});const l=this.midPoints.getUpdated(d)||[],h=this.selectionPoints.getUpdated(d)||[],c=this.coordinatePoints.getUpdated(e,d)||[];if(i&&!i({id:e,type:"Feature",geometry:o,properties:{}},{project:this.config.project,unproject:this.config.unproject,coordinatePrecision:this.config.coordinatePrecision,updateType:I.Provisional}))return!1;this.store.updateGeometry([{id:e,geometry:o},...h,...l,...c]),this.projection==="web-mercator"?this.lastBearing=n:this.projection==="globe"&&(this.lastBearing=n+180)}}class fi extends k{constructor(t,e){super(t),this.config=void 0,this.dragCoordinateResizeBehavior=void 0,this.config=t,this.dragCoordinateResizeBehavior=e}scale(t,e,i){if(!this.dragCoordinateResizeBehavior.isDragging()){const o=this.dragCoordinateResizeBehavior.getDraggableIndex(t,e);this.dragCoordinateResizeBehavior.startDragging(e,o)}this.dragCoordinateResizeBehavior.drag(t,"center-fixed",i)}reset(){this.dragCoordinateResizeBehavior.stopDragging()}}class mi extends k{constructor(t,e,i,o,s){super(t),this.config=void 0,this.pixelDistance=void 0,this.selectionPoints=void 0,this.midPoints=void 0,this.coordinatePoints=void 0,this.minimumScale=1e-4,this.draggedCoordinate={id:null,index:-1},this.boundingBoxMaps={opposite:{0:4,1:5,2:6,3:7,4:0,5:1,6:2,7:3}},this.config=t,this.pixelDistance=e,this.selectionPoints=i,this.midPoints=o,this.coordinatePoints=s}getClosestCoordinate(t,e){const i={dist:1/0,index:-1,isFirstOrLastPolygonCoord:!1};let o;if(e.type==="LineString")o=e.coordinates;else{if(e.type!=="Polygon")return i;o=e.coordinates[0]}for(let s=0;s=0)return!1;break;case 1:if(i>=0)return!1;break;case 2:if(e>=0||i>=0)return!1;break;case 3:if(e>=0)return!1;break;case 4:if(e>=0||i<=0)return!1;break;case 5:if(i<=0)return!1;break;case 6:if(e<=0||i<=0)return!1;break;case 7:if(e<=0)return!1}return!0}getSelectedFeatureDataWebMercator(){if(!this.draggedCoordinate.id||this.draggedCoordinate.index===-1)return null;const t=this.getFeature(this.draggedCoordinate.id);if(!t)return null;const e=this.getNormalisedCoordinates(t.geometry);return{boundingBox:this.getBBoxWebMercator(e),feature:t,updatedCoords:e,selectedCoordinate:e[this.draggedCoordinate.index]}}centerWebMercatorDrag(t){const e=this.getSelectedFeatureDataWebMercator();if(!e)return null;const{feature:i,boundingBox:o,updatedCoords:s,selectedCoordinate:n}=e,a=kt(i);if(!a)return null;const d=S(n[0],n[1]),{closestBBoxIndex:l}=this.getIndexesWebMercator(o,d),h=S(t.lng,t.lat);return this.scaleWebMercator({closestBBoxIndex:l,updatedCoords:s,webMercatorCursor:h,webMercatorSelected:d,webMercatorOrigin:a}),s}centerFixedWebMercatorDrag(t){const e=this.getSelectedFeatureDataWebMercator();if(!e)return null;const{feature:i,boundingBox:o,updatedCoords:s,selectedCoordinate:n}=e,a=kt(i);if(!a)return null;const d=S(n[0],n[1]),{closestBBoxIndex:l}=this.getIndexesWebMercator(o,d),h=S(t.lng,t.lat);return this.scaleFixedWebMercator({closestBBoxIndex:l,updatedCoords:s,webMercatorCursor:h,webMercatorSelected:d,webMercatorOrigin:a}),s}scaleFixedWebMercator({closestBBoxIndex:t,webMercatorOrigin:e,webMercatorSelected:i,webMercatorCursor:o,updatedCoords:s}){if(!this.isValidDragWebMercator(t,e.x-o.x,e.y-o.y))return null;let n=G(e,o)/G(e,i);return n<0&&(n=this.minimumScale),this.performWebMercatorScale(s,e.x,e.y,n,n),s}oppositeFixedWebMercatorDrag(t){const e=this.getSelectedFeatureDataWebMercator();if(!e)return null;const{boundingBox:i,updatedCoords:o,selectedCoordinate:s}=e,n=S(s[0],s[1]),{oppositeBboxIndex:a,closestBBoxIndex:d}=this.getIndexesWebMercator(i,n),l={x:i[a][0],y:i[a][1]},h=S(t.lng,t.lat);return this.scaleFixedWebMercator({closestBBoxIndex:d,updatedCoords:o,webMercatorCursor:h,webMercatorSelected:n,webMercatorOrigin:l}),o}oppositeWebMercatorDrag(t){const e=this.getSelectedFeatureDataWebMercator();if(!e)return null;const{boundingBox:i,updatedCoords:o,selectedCoordinate:s}=e,n=S(s[0],s[1]),{oppositeBboxIndex:a,closestBBoxIndex:d}=this.getIndexesWebMercator(i,n),l={x:i[a][0],y:i[a][1]},h=S(t.lng,t.lat);return this.scaleWebMercator({closestBBoxIndex:d,updatedCoords:o,webMercatorCursor:h,webMercatorSelected:n,webMercatorOrigin:l}),o}scaleWebMercator({closestBBoxIndex:t,webMercatorOrigin:e,webMercatorSelected:i,webMercatorCursor:o,updatedCoords:s}){const n=e.x-o.x,a=e.y-o.y;if(!this.isValidDragWebMercator(t,n,a))return null;let d=1;n!==0&&t!==1&&t!==5&&(d=1-(e.x-i.x-n)/n);let l=1;return a!==0&&t!==3&&t!==7&&(l=1-(e.y-i.y-a)/a),this.validateScale(d,l)?(d<0&&(d=this.minimumScale),l<0&&(l=this.minimumScale),this.performWebMercatorScale(s,e.x,e.y,d,l),s):null}getFeature(t){if(this.draggedCoordinate.id===null)return null;const e=this.store.getGeometryCopy(t);return e.type!=="Polygon"&&e.type!=="LineString"?null:{id:t,type:"Feature",geometry:e,properties:{}}}getNormalisedCoordinates(t){return t.type==="Polygon"?t.coordinates[0]:t.coordinates}validateScale(t,e){const i=!isNaN(t)&&e{const{x:a,y:d}=S(n[0],n[1]),l=e+(a-e)*o,h=i+(d-i)*s,{lng:c,lat:u}=ot(l,h);n[0]=c,n[1]=u})}getBBoxWebMercator(t){const e=[1/0,1/0,-1/0,-1/0];(t=t.map(a=>{const{x:d,y:l}=S(a[0],a[1]);return[d,l]})).forEach(([a,d])=>{ae[2]&&(e[2]=a),d>e[3]&&(e[3]=d)});const[i,o,s,n]=e;return[[i,n],[(i+s)/2,n],[s,n],[s,n+(o-n)/2],[s,o],[(i+s)/2,o],[i,o],[i,n+(o-n)/2]]}getIndexesWebMercator(t,e){let i,o=1/0;for(let s=0;sthis.store.has(e)).map(e=>({id:e,property:L.SELECTED,value:!1}));this.store.updateProperty(t),this.onDeselect(this.selected[0]),this.selected=[],this.selectionPoints.delete(),this.midPoints.delete()}deleteSelected(){this.store.delete(this.selected),this.selected=[]}onRightClick(t){if(!this.selectionPoints.ids.length)return;let e,i=1/0;if(this.selectionPoints.ids.forEach(u=>{const p=this.store.getGeometryCopy(u),g=this.pixelDistance.measure(t,p.coordinates);g0);if(this.selected.length&&i)this.midPoints.insert(this.selected[0],i.id,this.coordinatePrecision);else if(e&&e.id)this.select(e.id,!0);else if(this.selected.length&&this.allowManualDeselection)return void this.deselect()}start(){this.setStarted(),this.setSelecting()}stop(){this.cleanUp(),this.setStarted(),this.setStopped()}onClick(t){t.button==="right"&&this.allowPointerEvent(this.pointerEvents.rightClick,t)||t.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,t)?this.onRightClick(t):t.button==="left"&&this.allowPointerEvent(this.pointerEvents.leftClick,t)&&this.onLeftClick(t)}canScale(t){return this.keyEvents.scale&&this.keyEvents.scale.every(e=>t.heldKeys.includes(e))}canRotate(t){return this.keyEvents.rotate&&this.keyEvents.rotate.every(e=>t.heldKeys.includes(e))}preventDefaultKeyEvent(t){const e=this.canRotate(t),i=this.canScale(t);(e||i)&&t.preventDefault()}onKeyDown(t){this.preventDefaultKeyEvent(t)}onKeyUp(t){if(this.preventDefaultKeyEvent(t),this.keyEvents.delete&&t.key===this.keyEvents.delete){if(!this.selected.length)return;const e=this.selected[0];this.onDeselect(this.selected[0]),this.coordinatePoints.deletePointsByFeatureIds([e]),this.deleteSelected(),this.selectionPoints.delete(),this.midPoints.delete()}else this.keyEvents.deselect&&t.key===this.keyEvents.deselect&&this.cleanUp()}cleanUp(){this.selected.length&&this.deselect()}onDragStart(t,e){if(!this.allowPointerEvent(this.pointerEvents.onDragStart,t)||!this.selected.length)return;const i=this.store.getPropertiesCopy(this.selected[0]),o=this.flags[i.mode];if(!(o&&o.feature&&(o.feature.draggable||o.feature.coordinates&&o.feature.coordinates.draggable||o.feature.coordinates&&o.feature.coordinates.resizable||o.feature.coordinates&&typeof o.feature.coordinates.midpoints=="object"&&o.feature.coordinates.midpoints.draggable)))return;this.dragEventCount=0;const s=this.selected[0],n=this.dragCoordinate.getDraggableIndex(t,s);if(o&&o.feature&&o.feature.coordinates&&(o.feature.coordinates.draggable||o.feature.coordinates.resizable)&&n!==-1)return this.setCursor(this.cursors.dragStart),o.feature.coordinates.resizable?this.dragCoordinateResizeFeature.startDragging(s,n):this.dragCoordinate.startDragging(s,n),void e(!1);if(o&&o.feature&&o.feature.coordinates&&typeof o.feature.coordinates.midpoints=="object"&&o.feature.coordinates.midpoints.draggable){const{clickedMidPoint:a}=this.featuresAtMouseEvent.find(t,this.selected.length>0);if(this.selected.length&&a){this.midPoints.insert(s,a.id,this.coordinatePrecision);const d=this.dragCoordinate.getDraggableIndex(t,s);return this.dragCoordinate.startDragging(s,d),void e(!1)}}return o&&o.feature&&o.feature.draggable&&this.dragFeature.canDrag(t,s)?(this.setCursor(this.cursors.dragStart),this.dragFeature.startDragging(t,s),void e(!1)):void 0}onDrag(t,e){if(!this.allowPointerEvent(this.pointerEvents.onDrag,t))return;const i=this.selected[0];if(!i)return;const o=this.store.getPropertiesCopy(i),s=this.flags[o.mode],n=(s&&s.feature&&s.feature.selfIntersectable)===!0;if(this.dragEventCount++,this.dragEventCount%this.dragEventThrottle==0)return;const a=this.validations[o.mode];if(s&&s.feature&&s.feature.rotateable&&this.canRotate(t))return e(!1),void this.rotateFeature.rotate(t,i,a);if(s&&s.feature&&s.feature.scaleable&&this.canScale(t))return e(!1),void this.scaleFeature.scale(t,i,a);if(this.dragCoordinateResizeFeature.isDragging()&&s.feature&&s.feature.coordinates&&s.feature.coordinates.resizable){if(this.projection==="globe")throw new Error("Globe is currently unsupported projection for resizable");return e(!1),void this.dragCoordinateResizeFeature.drag(t,s.feature.coordinates.resizable,a)}if(this.dragCoordinate.isDragging()){var d;const l=(d=s.feature)==null||(d=d.coordinates)==null?void 0:d.snappable;let h={toCoordinate:!1};return l===!0?h={toCoordinate:!0}:typeof l=="object"&&(h=l),void this.dragCoordinate.drag(t,n,a,h)}this.dragFeature.isDragging()?this.dragFeature.drag(t,a):e(!0)}onDragEnd(t,e){this.allowPointerEvent(this.pointerEvents.onDragEnd,t)&&(this.setCursor(this.cursors.dragEnd),this.dragCoordinate.isDragging()?this.onFinish(this.selected[0],{mode:this.mode,action:"dragCoordinate"}):this.dragFeature.isDragging()?this.onFinish(this.selected[0],{mode:this.mode,action:"dragFeature"}):this.dragCoordinateResizeFeature.isDragging()&&this.onFinish(this.selected[0],{mode:this.mode,action:"dragCoordinateResize"}),this.dragCoordinate.stopDragging(),this.dragFeature.stopDragging(),this.dragCoordinateResizeFeature.stopDragging(),this.rotateFeature.reset(),this.scaleFeature.reset(),e(!0))}onMouseMove(t){if(!this.selected.length)return void this.setCursor("unset");if(this.dragFeature.isDragging())return;let e=!1;this.midPoints.ids.forEach(s=>{if(e)return;const n=this.store.getGeometryCopy(s);this.pixelDistance.measure(t,n.coordinates){const n=this.store.getGeometryCopy(s);this.pixelDistance.measure(t,n.coordinates)0&&(o&&o.id===this.selected[0]||i)?this.cursors.pointerOver:"unset")}styleFeature(t){const e=M({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});if(t.properties.mode===this.mode&&t.geometry.type==="Point"){if(t.properties.selectionPoint)return e.pointColor=this.getHexColorStylingValue(this.styles.selectionPointColor,e.pointColor,t),e.pointOutlineColor=this.getHexColorStylingValue(this.styles.selectionPointOutlineColor,e.pointOutlineColor,t),e.pointWidth=this.getNumericStylingValue(this.styles.selectionPointWidth,e.pointWidth,t),e.pointOutlineWidth=this.getNumericStylingValue(this.styles.selectionPointOutlineWidth,2,t),e.zIndex=30,e;if(t.properties.midPoint)return e.pointColor=this.getHexColorStylingValue(this.styles.midPointColor,e.pointColor,t),e.pointOutlineColor=this.getHexColorStylingValue(this.styles.midPointOutlineColor,e.pointOutlineColor,t),e.pointWidth=this.getNumericStylingValue(this.styles.midPointWidth,4,t),e.pointOutlineWidth=this.getNumericStylingValue(this.styles.midPointOutlineWidth,2,t),e.zIndex=50,e}else if(t.properties[L.SELECTED]){if(t.geometry.type==="Polygon")return e.polygonFillColor=this.getHexColorStylingValue(this.styles.selectedPolygonColor,e.polygonFillColor,t),e.polygonOutlineWidth=this.getNumericStylingValue(this.styles.selectedPolygonOutlineWidth,e.polygonOutlineWidth,t),e.polygonOutlineColor=this.getHexColorStylingValue(this.styles.selectedPolygonOutlineColor,e.polygonOutlineColor,t),e.polygonFillOpacity=this.getNumericStylingValue(this.styles.selectedPolygonFillOpacity,e.polygonFillOpacity,t),e.zIndex=U,e;if(t.geometry.type==="LineString")return e.lineStringColor=this.getHexColorStylingValue(this.styles.selectedLineStringColor,e.lineStringColor,t),e.lineStringWidth=this.getNumericStylingValue(this.styles.selectedLineStringWidth,e.lineStringWidth,t),e.zIndex=U,e;if(t.geometry.type==="Point")return e.pointWidth=this.getNumericStylingValue(this.styles.selectedPointWidth,e.pointWidth,t),e.pointColor=this.getHexColorStylingValue(this.styles.selectedPointColor,e.pointColor,t),e.pointOutlineColor=this.getHexColorStylingValue(this.styles.selectedPointOutlineColor,e.pointOutlineColor,t),e.pointOutlineWidth=this.getNumericStylingValue(this.styles.selectedPointOutlineWidth,e.pointOutlineWidth,t),e.zIndex=U,e}return e}}class Pi extends z{constructor(...t){super(...t),this.type=it.Static,this.mode="static"}start(){}stop(){}onKeyUp(){}onKeyDown(){}onClick(){}onDragStart(){}onDrag(){}onDragEnd(){}onMouseMove(){}cleanUp(){}styleFeature(){return M({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0})}}function Ce(r,t,e,i,o){for(;i>e;){if(i-e>600){const d=i-e+1,l=t-e+1,h=Math.log(d),c=.5*Math.exp(2*h/3),u=.5*Math.sqrt(h*c*(d-c)/d)*(l-d/2<0?-1:1);Ce(r,t,Math.max(e,Math.floor(t-l*c/d+u)),Math.min(i,Math.floor(t+(d-l)*c/d+u)),o)}const s=r[t];let n=e,a=i;for(st(r,e,t),o(r[i],s)>0&&st(r,e,i);n0;)a--}o(r[e],s)===0?st(r,e,a):(a++,st(r,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function st(r,t,e){const i=r[t];r[t]=r[e],r[e]=i}function q(r,t){rt(r,0,r.children.length,t,r)}function rt(r,t,e,i,o){o||(o=Q([])),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let s=t;s=r.minX&&t.maxY>=r.minY}function Q(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ne(r,t,e,i,o){const s=[t,e];for(;s.length;){if((e=s.pop())-(t=s.pop())<=i)continue;const n=t+Math.ceil((e-t)/i/2)*i;Ce(r,n,t,e,o),s.push(t,n,n,e)}}class Mi{constructor(t){this._maxEntries=void 0,this._minEntries=void 0,this.data=void 0,this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}search(t){let e=this.data;const i=[];if(!gt(t,e))return i;const o=this.toBBox,s=[];for(;e;){for(let n=0;n=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(o,s,e)}_split(t,e){const i=t[e],o=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,o);const n=this._chooseSplitIndex(i,s,o),a=Q(i.children.splice(n,i.children.length-n));a.height=i.height,a.leaf=i.leaf,q(i,this.toBBox),q(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Q([t,e]),this.data.height=t.height+1,this.data.leaf=!1,q(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let o,s=1/0,n=1/0;for(let a=e;a<=i-e;a++){const d=rt(t,0,a,this.toBBox),l=rt(t,a,i,this.toBBox),h=Ei(d,l),c=Mt(d)+Mt(l);h=e;l--){const h=t.children[l];at(a,t.leaf?s(h):h),d+=pt(a)}return d}_adjustParentBBoxes(t,e,i){for(let o=i;o>=0;o--)at(e[o],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)t[i].children.length===0?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():q(t[i],this.toBBox)}}class Si{constructor(t){this.tree=void 0,this.idToNode=void 0,this.nodeToId=void 0,this.tree=new Mi(t&&t.maxEntries?t.maxEntries:9),this.idToNode=new Map,this.nodeToId=new Map}setMaps(t,e){this.idToNode.set(t.id,e),this.nodeToId.set(e,t.id)}toBBox(t){const e=[],i=[];let o;if(t.geometry.type==="Polygon")o=t.geometry.coordinates[0];else if(t.geometry.type==="LineString")o=t.geometry.coordinates;else{if(t.geometry.type!=="Point")throw new Error("Not a valid feature to turn into a bounding box");o=[t.geometry.coordinates]}for(let a=0;a{const s=this.toBBox(o);if(this.setMaps(o,s),i.has(String(o.id)))throw new Error(`Duplicate feature ID found ${o.id}`);i.add(String(o.id)),e.push(s)}),this.tree.load(e)}update(t){this.remove(t.id);const e=this.toBBox(t);this.setMaps(t,e),this.tree.insert(e)}remove(t){const e=this.idToNode.get(t);if(!e)throw new Error(`${t} not inserted into the spatial index`);this.tree.remove(e)}clear(){this.tree.clear()}search(t){return this.tree.search(this.toBBox(t)).map(e=>this.nodeToId.get(e))}collides(t){return this.tree.collides(this.toBBox(t))}}const bi={getId:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const t=16*Math.random()|0;return(r=="x"?t:3&t|8).toString(16)}),isValidId:r=>typeof r=="string"&&r.length===36};class wi{constructor(t){this.idStrategy=void 0,this.tracked=void 0,this.spatialIndex=void 0,this.store=void 0,this._onChange=()=>{},this.store={},this.spatialIndex=new Si,this.tracked=!t||t.tracked!==!1,this.idStrategy=t&&t.idStrategy?t.idStrategy:bi}clone(t){return JSON.parse(JSON.stringify(t))}getId(){return this.idStrategy.getId()}has(t){return!!this.store[t]}load(t,e,i,o){if(t.length===0)return[];let s=this.clone(t);const n=[],a=[];return s=s.filter(d=>{d.id==null&&(d.id=this.idStrategy.getId());const l=d.id;if(e){const h=e(d);if(!h.valid)return a.push({id:l,valid:!1,reason:h.reason}),!1}if(this.tracked){if(d.properties.createdAt){if(!Yt(d.properties.createdAt))return a.push({id:d.id,valid:!1,reason:"createdAt is not a valid numeric timestamp"}),!1}else d.properties.createdAt=+new Date;if(d.properties.updatedAt){if(!Yt(d.properties.updatedAt))return a.push({id:d.id,valid:!1,reason:"updatedAt is not a valid numeric timestamp"}),!1}else d.properties.updatedAt=+new Date}return this.has(l)?(a.push({id:l,valid:!1,reason:`Feature already exists with this id: ${l}`}),!1):(this.store[l]=d,n.push(l),i&&i(d),a.push({id:l,valid:!0}),!0)}),this.spatialIndex.load(s),n.length>0&&this._onChange(n,"create",o),a}search(t,e){const i=this.spatialIndex.search(t).map(o=>this.store[o]);return this.clone(e?i.filter(e):i)}registerOnChange(t){this._onChange=(e,i,o)=>{t(e,i,o)}}getGeometryCopy(t){const e=this.store[t];if(!e)throw new Error(`No feature with this id (${t}), can not get geometry copy`);return this.clone(e.geometry)}getPropertiesCopy(t){const e=this.store[t];if(!e)throw new Error(`No feature with this id (${t}), can not get properties copy`);return this.clone(e.properties)}updateProperty(t,e){const i=[];t.forEach(({id:o,property:s,value:n})=>{const a=this.store[o];if(!a)throw new Error(`No feature with this (${o}), can not update geometry`);i.push(o),n===void 0?delete a.properties[s]:a.properties[s]=n,this.tracked&&(a.properties.updatedAt=+new Date)}),this._onChange&&this._onChange(i,"update",e)}updateGeometry(t,e){const i=[];t.forEach(({id:o,geometry:s})=>{i.push(o);const n=this.store[o];if(!n)throw new Error(`No feature with this (${o}), can not update geometry`);n.geometry=this.clone(s),this.spatialIndex.update(n),this.tracked&&(n.properties.updatedAt=+new Date)}),this._onChange&&this._onChange(i,"update",e)}create(t,e){const i=[];return t.forEach(({geometry:o,properties:s})=>{let n,a=M({},s);this.tracked&&(n=+new Date,s?(a.createdAt=typeof s.createdAt=="number"?s.createdAt:n,a.updatedAt=typeof s.updatedAt=="number"?s.updatedAt:n):a={createdAt:n,updatedAt:n});const d=this.getId(),l={id:d,type:"Feature",geometry:o,properties:a};this.store[d]=l,this.spatialIndex.insert(l),i.push(d)}),this._onChange&&this._onChange([...i],"create",e),i}delete(t,e){t.forEach(i=>{if(!this.store[i])throw new Error(`No feature with id ${i}, can not delete`);delete this.store[i],this.spatialIndex.remove(i)}),this._onChange&&this._onChange([...t],"delete",e)}copy(t){return this.clone(this.store[t])}copyAll(){return this.clone(Object.keys(this.store).map(t=>this.store[t]))}copyAllWhere(t){return this.clone(Object.keys(this.store).map(e=>this.store[e]).filter(e=>e.properties&&t(e.properties)))}clear(){this.store={},this.spatialIndex.clear()}size(){return Object.keys(this.store).length}}class Fi{constructor(t){this._modes=void 0,this._mode=void 0,this._adapter=void 0,this._enabled=!1,this._store=void 0,this._eventListeners=void 0,this._instanceSelectMode=void 0,this._adapter=t.adapter,this._mode=new Pi;const e=new Set,i=t.modes.reduce((h,c)=>{if(e.has(c.mode))throw new Error(`There is already a ${c.mode} mode provided`);return e.add(c.mode),h[c.mode]=c,h},{}),o=Object.keys(i);if(o.length===0)throw new Error("No modes provided");o.forEach(h=>{if(i[h].type===it.Select){if(this._instanceSelectMode)throw new Error("only one type of select mode can be provided");this._instanceSelectMode=h}}),this._modes=M({},i,{static:this._mode}),this._eventListeners={change:[],select:[],deselect:[],finish:[],ready:[]},this._store=new wi({tracked:!!t.tracked,idStrategy:t.idStrategy?t.idStrategy:void 0});const s=h=>{const c=[],u=this._store.copyAll().filter(p=>!h.includes(p.id)||(c.push(p),!1));return{changed:c,unchanged:u}},n=(h,c)=>{this._enabled&&this._eventListeners.finish.forEach(u=>{u(h,c)})},a=(h,c,u)=>{if(!this._enabled)return;this._eventListeners.change.forEach(y=>{y(h,c,u)});const{changed:p,unchanged:g}=s(h);c==="create"?this._adapter.render({created:p,deletedIds:[],unchanged:g,updated:[]},this.getModeStyles()):c==="update"?this._adapter.render({created:[],deletedIds:[],unchanged:g,updated:p},this.getModeStyles()):c==="delete"?this._adapter.render({created:[],deletedIds:h,unchanged:g,updated:[]},this.getModeStyles()):c==="styling"&&this._adapter.render({created:[],deletedIds:[],unchanged:g,updated:[]},this.getModeStyles())},d=h=>{if(!this._enabled)return;this._eventListeners.select.forEach(p=>{p(h)});const{changed:c,unchanged:u}=s([h]);this._adapter.render({created:[],deletedIds:[],unchanged:u,updated:c},this.getModeStyles())},l=h=>{if(!this._enabled)return;this._eventListeners.deselect.forEach(p=>{p()});const{changed:c,unchanged:u}=s([h]);c&&this._adapter.render({created:[],deletedIds:[],unchanged:u,updated:c},this.getModeStyles())};Object.keys(this._modes).forEach(h=>{this._modes[h].register({mode:h,store:this._store,setCursor:this._adapter.setCursor.bind(this._adapter),project:this._adapter.project.bind(this._adapter),unproject:this._adapter.unproject.bind(this._adapter),setDoubleClickToZoom:this._adapter.setDoubleClickToZoom.bind(this._adapter),onChange:a,onSelect:d,onDeselect:l,onFinish:n,coordinatePrecision:this._adapter.getCoordinatePrecision()})})}checkEnabled(){if(!this._enabled)throw new Error("Terra Draw is not enabled")}getModeStyles(){const t={};return Object.keys(this._modes).forEach(e=>{t[e]=i=>this._instanceSelectMode&&i.properties[L.SELECTED]?this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(i):this._modes[e].styleFeature.bind(this._modes[e])(i)}),t}featuresAtLocation({lng:t,lat:e},i){const o=i&&i.pointerDistance!==void 0?i.pointerDistance:30,s=!i||i.ignoreSelectFeatures===void 0||i.ignoreSelectFeatures,n=!(!i||i.ignoreCoordinatePoints===void 0)&&i.ignoreCoordinatePoints,a=!(!i||i.ignoreCurrentlyDrawing===void 0)&&i.ignoreCurrentlyDrawing,d=!(!i||i.ignoreClosingPoints===void 0)&&i.ignoreClosingPoints,l=this._adapter.unproject.bind(this._adapter),h=this._adapter.project.bind(this._adapter),c=h(t,e),u=ye({unproject:l,point:c,pointerDistance:o});return this._store.search(u).filter(p=>{if(s&&(p.properties[L.MID_POINT]||p.properties[L.SELECTION_POINT])||n&&p.properties[Ot]||d&&p.properties[et]||a&&p.properties[N])return!1;if(p.geometry.type==="Point"){const g=p.geometry.coordinates,y=h(g[0],g[1]);return G(c,y){if(!this._store.has(i))throw new Error(`No feature with id ${i}, can not delete`);const o=this._store.copy(i);o.properties[L.SELECTED]&&this.deselectFeature(i),o.properties[dt]&&e.push(...o.properties[dt])}),this._store.delete([...t,...e],{origin:"api"})}selectFeature(t){this.getSelectMode().selectFeature(t)}deselectFeature(t){this.getSelectMode().deselectFeature(t)}getFeatureId(){return this._store.getId()}hasFeature(t){return this._store.has(t)}addFeatures(t){return this.checkEnabled(),t.length===0?[]:this._store.load(t,e=>{if(Xt(e)){const i=e.properties.mode,o=this._modes[i];if(!o)return{id:e.id,valid:!1,reason:`${i} mode is not in the list of instantiated modes`};const s=o.validateFeature.bind(o)(e);return{id:e.id,valid:s.valid,reason:s.reason?s.reason:s.valid?void 0:"Feature is invalid"}}return{id:e.id,valid:!1,reason:"Mode property does not exist"}},e=>{if(Xt(e)){const i=this._modes[e.properties.mode];i&&i.afterFeatureAdded&&i.afterFeatureAdded(e)}},{origin:"api"})}start(){this._enabled||(this._enabled=!0,this._adapter.register({onReady:()=>{this._eventListeners.ready.forEach(t=>{t()})},getState:()=>this._mode.state,onClick:t=>{this._mode.onClick(t)},onMouseMove:t=>{this._mode.onMouseMove(t)},onKeyDown:t=>{this._mode.onKeyDown(t)},onKeyUp:t=>{this._mode.onKeyUp(t)},onDragStart:(t,e)=>{this._mode.onDragStart(t,e)},onDrag:(t,e)=>{this._mode.onDrag(t,e)},onDragEnd:(t,e)=>{this._mode.onDragEnd(t,e)},onClear:()=>{this._mode.cleanUp(),this._store.clear()}}))}getFeaturesAtLngLat(t,e){const{lng:i,lat:o}=t;return this.featuresAtLocation({lng:i,lat:o},e)}getFeaturesAtPointerEvent(t,e){const i=this._adapter.getLngLatFromEvent.bind(this._adapter)(t);return i===null?[]:this.featuresAtLocation(i,e)}stop(){this._enabled&&(this._enabled=!1,this._adapter.unregister())}on(t,e){const i=this._eventListeners[t];i.includes(e)||i.push(e)}off(t,e){const i=this._eventListeners[t];i.includes(e)&&i.splice(i.indexOf(e),1)}}var re,bt,ae;function de(r,t=9){const e=Math.pow(10,t);return Math.round(r*e)/e}(bt=re||(re={})).Commit="commit",bt.Provisional="provisional",bt.Finish="finish",function(r){r.Drawing="drawing",r.Select="select",r.Static="static",r.Render="render"}(ae||(ae={}));class J{constructor({name:t,callback:e,unregister:i,register:o}){this.name=void 0,this.callback=void 0,this.registered=!1,this.register=void 0,this.unregister=void 0,this.name=t,this.register=()=>{this.registered||(this.registered=!0,o(e))},this.unregister=()=>{this.register&&(this.registered=!1,i(e))},this.callback=e}}var _i=class{constructor(r){this._minPixelDragDistance=void 0,this._minPixelDragDistanceDrawing=void 0,this._minPixelDragDistanceSelecting=void 0,this._lastDrawEvent=void 0,this._coordinatePrecision=void 0,this._heldKeys=new Set,this._listeners=[],this._dragState="not-dragging",this._currentModeCallbacks=void 0,this._minPixelDragDistance=typeof r.minPixelDragDistance=="number"?r.minPixelDragDistance:1,this._minPixelDragDistanceSelecting=typeof r.minPixelDragDistanceSelecting=="number"?r.minPixelDragDistanceSelecting:1,this._minPixelDragDistanceDrawing=typeof r.minPixelDragDistanceDrawing=="number"?r.minPixelDragDistanceDrawing:8,this._coordinatePrecision=typeof r.coordinatePrecision=="number"?r.coordinatePrecision:9}getButton(r){return r.button===-1?"neither":r.button===0?"left":r.button===1?"middle":r.button===2?"right":"neither"}getMapElementXYPosition(r){const t=this.getMapEventElement(),{left:e,top:i}=t.getBoundingClientRect();return{containerX:r.clientX-e,containerY:r.clientY-i}}getDrawEventFromEvent(r){const t=this.getLngLatFromEvent(r);if(!t)return null;const{lng:e,lat:i}=t,{containerX:o,containerY:s}=this.getMapElementXYPosition(r),n=this.getButton(r),a=Array.from(this._heldKeys);return{lng:de(e,this._coordinatePrecision),lat:de(i,this._coordinatePrecision),containerX:o,containerY:s,button:n,heldKeys:a}}register(r){this._currentModeCallbacks=r,this._listeners=this.getAdapterListeners(),this._listeners.forEach(t=>{t.register()})}getCoordinatePrecision(){return this._coordinatePrecision}getAdapterListeners(){return[new J({name:"pointerdown",callback:r=>{if(!this._currentModeCallbacks||!r.isPrimary)return;const t=this.getDrawEventFromEvent(r);t&&(this._dragState="pre-dragging",this._lastDrawEvent=t)},register:r=>{this.getMapEventElement().addEventListener("pointerdown",r)},unregister:r=>{this.getMapEventElement().removeEventListener("pointerdown",r)}}),new J({name:"pointermove",callback:r=>{if(!this._currentModeCallbacks||!r.isPrimary)return;r.preventDefault();const t=this.getDrawEventFromEvent(r);if(t)if(this._dragState==="not-dragging")this._currentModeCallbacks.onMouseMove(t),this._lastDrawEvent=t;else if(this._dragState==="pre-dragging"){if(!this._lastDrawEvent)return;const e={x:this._lastDrawEvent.containerX,y:this._lastDrawEvent.containerY},i={x:t.containerX,y:t.containerY},o=this._currentModeCallbacks.getState(),s=((a,d)=>{const{x:l,y:h}=a,{x:c,y:u}=d,p=c-l,g=u-h;return Math.sqrt(g*g+p*p)})(e,i);let n=!1;if(n=o==="drawing"?s{this.setDraggability.bind(this)(a)})}else this._dragState==="dragging"&&this._currentModeCallbacks.onDrag(t,e=>{this.setDraggability.bind(this)(e)})},register:r=>{this.getMapEventElement().addEventListener("pointermove",r)},unregister:r=>{this.getMapEventElement().removeEventListener("pointermove",r)}}),new J({name:"contextmenu",callback:r=>{this._currentModeCallbacks&&r.preventDefault()},register:r=>{this.getMapEventElement().addEventListener("contextmenu",r)},unregister:r=>{this.getMapEventElement().removeEventListener("contextmenu",r)}}),new J({name:"pointerup",callback:r=>{if(!this._currentModeCallbacks||r.target!==this.getMapEventElement()||!r.isPrimary)return;const t=this.getDrawEventFromEvent(r);t&&(this._dragState==="dragging"?this._currentModeCallbacks.onDragEnd(t,e=>{this.setDraggability.bind(this)(e)}):this._dragState!=="not-dragging"&&this._dragState!=="pre-dragging"||this._currentModeCallbacks.onClick(t),this._dragState="not-dragging",this.setDraggability(!0))},register:r=>{this.getMapEventElement().addEventListener("pointerup",r)},unregister:r=>{this.getMapEventElement().removeEventListener("pointerup",r)}}),new J({name:"keyup",callback:r=>{this._currentModeCallbacks&&(this._heldKeys.delete(r.key),this._currentModeCallbacks.onKeyUp({key:r.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>r.preventDefault()}))},register:r=>{this.getMapEventElement().addEventListener("keyup",r)},unregister:r=>{this.getMapEventElement().removeEventListener("keyup",r)}}),new J({name:"keydown",callback:r=>{this._currentModeCallbacks&&(this._heldKeys.add(r.key),this._currentModeCallbacks.onKeyDown({key:r.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>r.preventDefault()}))},register:r=>{this.getMapEventElement().addEventListener("keydown",r)},unregister:r=>{this.getMapEventElement().removeEventListener("keydown",r)}})]}unregister(){this._listeners.forEach(r=>{r.unregister()}),this.clear()}};class Di extends _i{constructor(t){if(super(t),this._cursor=void 0,this._cursorStyleSheet=void 0,this._lib=void 0,this._map=void 0,this._overlay=void 0,this._clickEventListener=void 0,this._mouseMoveEventListener=void 0,this.renderedFeatureIds=new Set,this._lib=t.lib,this._map=t.map,!this._map.getDiv().id)throw new Error("Google Map container div requires and id to be set");this._coordinatePrecision=typeof t.coordinatePrecision=="number"?t.coordinatePrecision:9}get _layers(){var t;return((t=this.renderedFeatureIds)==null?void 0:t.size)>0}circlePath(t,e,i){const o=2*i;return`M ${t} ${e} m -${i}, 0 a ${i},${i} 0 1,0 ${o},0 a ${i},${i} 0 1,0 -${o},0`}register(t){super.register(t),this._overlay=new this._lib.OverlayView,this._overlay.draw=function(){},this._overlay.onAdd=()=>{var e;(e=this._currentModeCallbacks)!=null&&e.onReady&&this._currentModeCallbacks.onReady()},this._overlay.setMap(this._map),this._clickEventListener=this._map.data.addListener("click",e=>{const i=this._listeners.find(({name:o})=>o==="click");i&&i.callback(e)}),this._mouseMoveEventListener=this._map.data.addListener("mousemove",e=>{const i=this._listeners.find(({name:o})=>o==="mousemove");i&&i.callback(e)})}unregister(){var t,e,i;super.unregister(),(t=this._clickEventListener)==null||t.remove(),(e=this._mouseMoveEventListener)==null||e.remove(),(i=this._overlay)==null||i.setMap(null),this._overlay=void 0}getLngLatFromEvent(t){if(!this._overlay)throw new Error("cannot get overlay");const e=this._map.getBounds();if(!e)return null;const i=e.getNorthEast(),o=e.getSouthWest(),s=new this._lib.LatLngBounds(o,i),n=this._map.getDiv(),a=t.clientX-n.getBoundingClientRect().left,d=t.clientY-n.getBoundingClientRect().top,l=new this._lib.Point(a,d),h=this._overlay.getProjection();if(!h)return null;const c=h.fromContainerPixelToLatLng(l);return c&&s.contains(c)?{lng:c.lng(),lat:c.lat()}:null}getMapEventElement(){return this._map.getDiv().querySelector('div[style*="z-index: 3;"]')}project(t,e){if(!this._overlay)throw new Error("cannot get overlay");if(this._map.getBounds()===void 0)throw new Error("cannot get bounds");const i=this._overlay.getProjection();if(i===void 0)throw new Error("cannot get projection");const o=i.fromLatLngToContainerPixel(new this._lib.LatLng(e,t));if(o===null)throw new Error("cannot project coordinates");return{x:o.x,y:o.y}}unproject(t,e){if(!this._overlay)throw new Error("cannot get overlay");const i=this._overlay.getProjection();if(i===void 0)throw new Error("cannot get projection");const o=i.fromContainerPixelToLatLng(new this._lib.Point(t,e));if(o===null)throw new Error("cannot unproject coordinates");return{lng:o.lng(),lat:o.lat()}}setCursor(t){if(t!==this._cursor){if(this._cursorStyleSheet&&(this._cursorStyleSheet.remove(),this._cursorStyleSheet=void 0),t!=="unset"){const e=this._map.getDiv(),i=document.querySelector(`#${e.id} .gm-style > div`);if(i){i.classList.add("terra-draw-google-maps");const o=document.createElement("style");o.innerHTML=`.terra-draw-google-maps { cursor: ${t} !important; }`,document.getElementsByTagName("head")[0].appendChild(o),this._cursorStyleSheet=o}}this._cursor=t}}setDoubleClickToZoom(t){this._map.setOptions(t?{disableDoubleClickZoom:!1}:{disableDoubleClickZoom:!0})}setDraggability(t){this._map.setOptions({draggable:t})}render(t,e){this._layers&&(t.deletedIds.forEach(o=>{const s=this._map.data.getFeatureById(o);s&&(this._map.data.remove(s),this.renderedFeatureIds.delete(o))}),t.updated.forEach(o=>{if(!o||!o.id)throw new Error("Feature is not valid");const s=this._map.data.getFeatureById(o.id);if(!s)throw new Error("Feature could not be found by Google Maps API");switch(s.forEachProperty((n,a)=>{s.setProperty(a,void 0)}),Object.keys(o.properties).forEach(n=>{s.setProperty(n,o.properties[n])}),o.geometry.type){case"Point":{const n=o.geometry.coordinates;s.setGeometry(new this._lib.Data.Point(new this._lib.LatLng(n[1],n[0])))}break;case"LineString":{const n=o.geometry.coordinates,a=[];for(let d=0;d{this.renderedFeatureIds.add(o.id),this._map.data.addGeoJson(o)})),t.created.forEach(o=>{this.renderedFeatureIds.add(o.id)});const i={type:"FeatureCollection",features:[...t.created]};this._map.data.addGeoJson(i),this._map.data.setStyle(o=>{const s=o.getProperty("mode"),n=o.getGeometry();if(!n)throw new Error("Google Maps geometry not found");const a=n.getType(),d={};o.forEachProperty((h,c)=>{d[c]=h});const l=e[s]({type:"Feature",geometry:{type:a,coordinates:[]},properties:d});switch(a){case"Point":return{clickable:!1,icon:{path:this.circlePath(0,0,l.pointWidth),fillColor:l.pointColor,fillOpacity:1,strokeColor:l.pointOutlineColor,strokeWeight:l.pointOutlineWidth,rotation:0,scale:1}};case"LineString":return{strokeColor:l.lineStringColor,strokeWeight:l.lineStringWidth};case"Polygon":return{strokeColor:l.polygonOutlineColor,strokeWeight:l.polygonOutlineWidth,fillOpacity:l.polygonFillOpacity,fillColor:l.polygonFillColor}}throw Error("Unknown feature type")})}clearLayers(){this._layers&&(this._map.data.forEach(t=>{const e=t.getId();this.renderedFeatureIds.has(e)&&this._map.data.remove(t)}),this.renderedFeatureIds=new Set)}clear(){this._currentModeCallbacks&&(this._currentModeCallbacks.onClear(),this.clearLayers())}getCoordinatePrecision(){return super.getCoordinatePrecision()}}/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */const le=["#E74C3C","#FF0066","#9B59B6","#673AB7","#3F51B5","#3498DB","#03A9F4","#00BCD4","#009688","#27AE60","#8BC34A","#CDDC39","#F1C40F","#FFC107","#F39C12","#FF5722","#795548"],Z=()=>le[Math.floor(Math.random()*le.length)];function he(r){return r.map(t=>{const e=JSON.parse(JSON.stringify(t));return e.properties.mode==="rectangle"?(e.geometry.type="Polygon",e.properties.mode="polygon"):e.properties.mode==="circle"&&(e.geometry.type="Polygon",e.properties.mode="circle"),e})}function ki(){if(!document.getElementById("mode-ui"))return;const t={"select-mode":"select","point-mode":"point","linestring-mode":"linestring","polygon-mode":"polygon","rectangle-mode":"rectangle","circle-mode":"circle","freehand-mode":"freehand","clear-mode":"static"};for(const e in t){const i=document.getElementById(e);i&&(i.onclick=()=>{Nt(e);const o=t[e];E&&(o==="static"?(E.clear(),E.setMode("static")):o&&E.setMode(o))})}}function Nt(r){const t=document.querySelectorAll(".mode-button"),e=document.getElementById("resize-button"),i=e==null?void 0:e.classList.contains("active");t.forEach(s=>{s.id!=="resize-button"&&s.classList.remove("active")});const o=document.getElementById(r);o&&o.classList.add("active"),i&&(e==null||e.classList.add("active"))}function Oi(){Nt("point-mode")}let yt,E,Bi="static",$=[],ft=[],A=null,nt=!1,j=!1,wt;const ji=new H({apiKey:"AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8",version:"weekly",libraries:["maps","drawing","marker"]});ji.load().then(async()=>{try{const{Map:r}=await google.maps.importLibrary("maps"),{LatLngBounds:t}=await google.maps.importLibrary("core"),{Data:e}=await google.maps.importLibrary("maps"),i={center:{lat:48.862,lng:2.342},zoom:12,mapId:"c306b3c6dd3ed8d9",mapTypeId:"roadmap",zoomControl:!1,tilt:45,mapTypeControl:!0,clickableIcons:!1,streetViewControl:!1,fullscreenControl:!1},o=document.getElementById("map");yt=new r(o,i),yt.addListener("click",()=>{E&&console.log("Current draw mode on map click:",E.getMode())}),yt.addListener("projection_changed",()=>{E=new Fi({adapter:new Di({map:yt,lib:google.maps,coordinatePrecision:9}),modes:[new Ci({flags:{polygon:{feature:{draggable:!0,rotateable:!0,coordinates:{midpoints:!0,draggable:!0,deletable:!0}}},linestring:{feature:{draggable:!0,rotateable:!0,coordinates:{midpoints:!0,draggable:!0,deletable:!0}}},point:{feature:{draggable:!0,rotateable:!0}},rectangle:{feature:{draggable:!0,rotateable:!0,coordinates:{midpoints:!0,draggable:!0,deletable:!0}}},circle:{feature:{draggable:!0,rotateable:!0,coordinates:{midpoints:!0,draggable:!0,deletable:!0}}},freehand:{feature:{draggable:!0,rotateable:!0,coordinates:{midpoints:!0,draggable:!0,deletable:!0}}}}}),new ti({editable:!0,styles:{pointColor:Z()}}),new $e({editable:!0,styles:{lineStringColor:Z()}}),new si({editable:!0,styles:(()=>{const a=Z();return{fillColor:a,outlineColor:a}})()}),new ai({styles:(()=>{const a=Z();return{fillColor:a,outlineColor:a}})()}),new We({styles:(()=>{const a=Z();return{fillColor:a,outlineColor:a}})()}),new Te({styles:(()=>{const a=Z();return{fillColor:a,outlineColor:a}})()})]}),E.start(),E.on("ready",()=>{console.log("TerraDraw is ready!"),Oi(),ki(),E.setMode("point"),Bi="point",Nt("point-mode"),E.on("select",g=>{A&&A!==g&&E.deselectFeature(A),A=g}),E.on("deselect",()=>{A=null}),$.push(he(E.getSnapshot())),E.on("change",(g,y)=>{nt||(wt&&clearTimeout(wt),wt=window.setTimeout(()=>{const v=E.getSnapshot(),C=he(v).filter(f=>!f.properties.midPoint&&!f.properties.selectionPoint);$.push(C),ft=[]},200))});const a=document.getElementById("export-button");a&&(a.onclick=()=>{const y={type:"FeatureCollection",features:E.getSnapshot()},v=JSON.stringify(y,null,2),m=new Blob([v],{type:"text/plain"}),C=URL.createObjectURL(m),f=document.createElement("a");f.href=C,f.download="drawing.geojson",f.click(),URL.revokeObjectURL(C)});const d=document.getElementById("upload-button"),l=document.getElementById("upload-input");d&&l&&(d.onclick=()=>{l.click()},l.onchange=g=>{var v;const y=(v=g.target.files)==null?void 0:v[0];if(y){const m=new FileReader;m.onload=C=>{var f;try{const P=JSON.parse((f=C.target)==null?void 0:f.result);P.type==="FeatureCollection"?E.addFeatures(P.features):alert("Invalid GeoJSON file: must be a FeatureCollection.")}catch{alert("Error parsing GeoJSON file.")}},m.readAsText(y)}});const h=document.getElementById("resize-button");h&&(h.onclick=()=>{j=!j,h.classList.toggle("active",j);const g={polygon:{feature:{draggable:!0,coordinates:{resizable:j?"center":void 0,draggable:!j}}},linestring:{feature:{draggable:!0,coordinates:{resizable:j?"center":void 0,draggable:!j}}},rectangle:{feature:{draggable:!0,coordinates:{resizable:j?"center":void 0,draggable:!j}}},circle:{feature:{draggable:!0,coordinates:{resizable:j?"center":void 0,draggable:!j}}},freehand:{feature:{draggable:!0,coordinates:{resizable:j?"center":void 0,draggable:!j}}}};console.log("Updating flags:",g),E.updateModeOptions("select",{flags:g})});const c=document.getElementById("delete-selected-button");c&&(c.onclick=()=>{if(A)E.removeFeatures([A]);else{const g=E.getSnapshot();if(g.length>0){const y=g[g.length-1];y.id&&E.removeFeatures([y.id])}}});const u=document.getElementById("undo-button");u&&(u.onclick=()=>{if($.length>1){ft.push($.pop());const g=$[$.length-1];console.log("Restoring snapshot (undo):",g),nt=!0,E.clear(),E.addFeatures(g),setTimeout(()=>{nt=!1},0)}});const p=document.getElementById("redo-button");p&&(p.onclick=()=>{if(ft.length>0){const g=ft.pop();console.log("Restoring snapshot (redo):",g),$.push(g),nt=!0,E.clear(),E.addFeatures(g),setTimeout(()=>{nt=!1},0)}})});function s(a,d){const l=JSON.parse(JSON.stringify(a)),h=l.geometry.coordinates,c=n(h),u=h.map(p=>p.map(g=>{const y=g[0]-c[0],v=g[1]-c[1],m=y*Math.cos(d*Math.PI/180)-v*Math.sin(d*Math.PI/180),C=y*Math.sin(d*Math.PI/180)+v*Math.cos(d*Math.PI/180);return[m+c[0],C+c[1]]}));return l.geometry.coordinates=u,l}function n(a){let d=0,l=0,h=0;return a.forEach(c=>{c.forEach(u=>{d+=u[0],l+=u[1],h++})}),[d/h,l/h]}document.addEventListener("keydown",a=>{if(a.key==="r"&&A){const l=E.getSnapshot().find(h=>h.id===A);if(l){const h=s(l,15);E.addFeatures([h])}}})})}catch(r){console.error("Error loading Google Maps API:",r)}}).catch(r=>{console.error("Error loading Google Maps API:",r)}); diff --git a/dist/samples/map-drawing-terradraw/dist/assets/index-P6yNqPBM.css b/dist/samples/map-drawing-terradraw/dist/assets/index-P6yNqPBM.css deleted file mode 100644 index ebd0c783b..000000000 --- a/dist/samples/map-drawing-terradraw/dist/assets/index-P6yNqPBM.css +++ /dev/null @@ -1,5 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */html,body{height:100%;margin:0;padding:0;font-family:Arial,sans-serif}#map{height:100%;width:100%}#mode-ui{position:absolute;top:10px;right:10px;background:#fff;padding:10px;border-radius:5px;box-shadow:0 0 10px #0003;z-index:1000;display:flex;flex-direction:column}#mode-ui button{margin:5px 0;cursor:pointer}.mode-button{width:30px;height:30px;border:1px solid #ccc;background-color:#fff;padding:2px;box-sizing:border-box}.mode-button img{width:100%;height:100%;display:block;-webkit-user-select:none;user-select:none}.mode-button.active{background-color:#e0e0e0}#select-mode,#clear-mode,#delete-selected-button,#undo-button,#redo-button,#export-button,#upload-button,#resize-button{background-color:#000}#select-mode img,#clear-mode img,#delete-selected-button img,#undo-button img,#redo-button img,#export-button img,#upload-button img,#resize-button img{filter:brightness(0) invert(1)}#select-mode.active,#clear-mode:active,#delete-selected-button:active,#undo-button:active,#redo-button:active,#export-button:active,#upload-button:active,#resize-button.active{background-color:#a9a9a9} diff --git a/dist/samples/map-drawing-terradraw/dist/index.html b/dist/samples/map-drawing-terradraw/dist/index.html deleted file mode 100644 index c0cb0acfe..000000000 --- a/dist/samples/map-drawing-terradraw/dist/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - Terra Draw with Google Maps API Sample - - - - - - -
- - -
- - - - - - - - - - - - - - - -
- - - - - diff --git a/dist/samples/map-drawing-terradraw/docs/index.html b/dist/samples/map-drawing-terradraw/docs/index.html deleted file mode 100644 index 48c180390..000000000 --- a/dist/samples/map-drawing-terradraw/docs/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - Terra Draw with Google Maps API Sample - - - - - -
- - -
- - - - - - - - - - - - - - - -
- - - - - - diff --git a/dist/samples/map-drawing-terradraw/docs/index.js b/dist/samples/map-drawing-terradraw/docs/index.js deleted file mode 100644 index 6cd1cf339..000000000 --- a/dist/samples/map-drawing-terradraw/docs/index.js +++ /dev/null @@ -1,451 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ -// [START maps_map_drawing_terradraw] -// [START maps_map_drawing_terradraw_libraries] -import { Loader } from '@googlemaps/js-api-loader'; -import { TerraDraw, TerraDrawSelectMode, TerraDrawPointMode, TerraDrawLineStringMode, TerraDrawPolygonMode, TerraDrawRectangleMode, TerraDrawCircleMode, TerraDrawFreehandMode } from 'terra-draw'; -import { TerraDrawGoogleMapsAdapter } from 'terra-draw-google-maps-adapter'; -// [END maps_map_drawing_terradraw_libraries] -const colorPalette = [ - "#E74C3C", - "#FF0066", - "#9B59B6", - "#673AB7", - "#3F51B5", - "#3498DB", - "#03A9F4", - "#00BCD4", - "#009688", - "#27AE60", - "#8BC34A", - "#CDDC39", - "#F1C40F", - "#FFC107", - "#F39C12", - "#FF5722", - "#795548" -]; -const getRandomColor = () => colorPalette[Math.floor(Math.random() * colorPalette.length)]; -function processSnapshotForUndo(snapshot) { - // console.log("Processing snapshot for undo:", snapshot); - return snapshot.map(feature => { - const newFeature = JSON.parse(JSON.stringify(feature)); - if (newFeature.properties.mode === 'rectangle') { - // console.log("Processing rectangle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - newFeature.properties.mode = 'polygon'; - } - else if (newFeature.properties.mode === 'circle') { - // console.log("Processing circle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - // The radius is already in properties, so we just need to ensure the mode is correct for re-creation - newFeature.properties.mode = 'circle'; - } - return newFeature; - }); -} -function setupModeButtons() { - const modeUI = document.getElementById('mode-ui'); - if (!modeUI) { - return; - } - const modeButtons = { - 'select-mode': 'select', - 'point-mode': 'point', - 'linestring-mode': 'linestring', - 'polygon-mode': 'polygon', - 'rectangle-mode': 'rectangle', - 'circle-mode': 'circle', - 'freehand-mode': 'freehand', - 'clear-mode': 'static' - }; - for (const buttonId in modeButtons) { - const button = document.getElementById(buttonId); - if (button) { - button.onclick = () => { - setActiveButton(buttonId); - const modeName = modeButtons[buttonId]; - if (!draw) { - return; - } - if (modeName === 'static') { - draw.clear(); - draw.setMode('static'); - } - else if (modeName) { - draw.setMode(modeName); - } - }; - } - } -} -function setActiveButton(buttonId) { - const buttons = document.querySelectorAll('.mode-button'); - const resizeButton = document.getElementById('resize-button'); - const isResizeActive = resizeButton?.classList.contains('active'); - buttons.forEach(button => { - if (button.id !== 'resize-button') { - button.classList.remove('active'); - } - }); - const activeButton = document.getElementById(buttonId); - if (activeButton) { - activeButton.classList.add('active'); - } - if (isResizeActive) { - resizeButton?.classList.add('active'); - } -} -function initUI() { - setActiveButton('point-mode'); -} -let map; -let draw; -let currentMode = 'static'; -let history = []; -let redoHistory = []; -let selectedFeatureId = null; -let isRestoring = false; -let resizingEnabled = false; -let debounceTimeout; -const loader = new Loader({ - apiKey: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", - version: "weekly", - libraries: ["maps", "drawing", "marker"] -}); -loader.load().then(async () => { - try { - const { Map } = await google.maps.importLibrary("maps"); - const { LatLngBounds } = await google.maps.importLibrary("core"); - const { Data } = await google.maps.importLibrary("maps"); - const mapOptions = { - center: { lat: 48.862, lng: 2.342 }, - zoom: 12, - mapId: 'c306b3c6dd3ed8d9', // raster '6a17c323f461e521', - mapTypeId: 'roadmap', - zoomControl: false, - tilt: 45, - mapTypeControl: true, - clickableIcons: false, - streetViewControl: false, - fullscreenControl: false, - }; - const mapDiv = document.getElementById("map"); - map = new Map(mapDiv, mapOptions); - map.addListener("click", () => { - if (draw) { - console.log("Current draw mode on map click:", draw.getMode()); - } - }); - map.addListener("projection_changed", () => { - // [START maps_drawing_terradraw_modes] - draw = new TerraDraw({ - adapter: new TerraDrawGoogleMapsAdapter({ map, lib: google.maps, coordinatePrecision: 9 }), - modes: [ - new TerraDrawSelectMode({ - flags: { - polygon: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - linestring: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - point: { - feature: { - draggable: true, - rotateable: true, - }, - }, - rectangle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - circle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - freehand: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - }, - }), - new TerraDrawPointMode({ - editable: true, - styles: { pointColor: getRandomColor() }, - }), - new TerraDrawLineStringMode({ - editable: true, - styles: { lineStringColor: getRandomColor() }, - }), - new TerraDrawPolygonMode({ - editable: true, - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawRectangleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawCircleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawFreehandMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - ], - }); - draw.start(); - draw.on('ready', () => { - console.log("TerraDraw is ready!"); - initUI(); - setupModeButtons(); - draw.setMode('point'); - currentMode = 'point'; - setActiveButton('point-mode'); - draw.on("select", (id) => { - // console.log(`Feature selected: ${id}`); - if (selectedFeatureId && selectedFeatureId !== id) { - draw.deselectFeature(selectedFeatureId); - } - selectedFeatureId = id; - }); - draw.on("deselect", () => { - // console.log("Feature deselected"); - selectedFeatureId = null; - }); - history.push(processSnapshotForUndo(draw.getSnapshot())); // Push initial empty state - draw.on("change", (ids, type) => { - if (isRestoring) { - return; - } - if (debounceTimeout) { - clearTimeout(debounceTimeout); - } - debounceTimeout = window.setTimeout(() => { - const snapshot = draw.getSnapshot(); - const processedSnapshot = processSnapshotForUndo(snapshot); - const filteredSnapshot = processedSnapshot.filter((f) => !f.properties.midPoint && !f.properties.selectionPoint); - history.push(filteredSnapshot); - redoHistory = []; - }, 200); - }); - // [END maps_drawing_terradraw_modes] - const exportButton = document.getElementById('export-button'); - if (exportButton) { - exportButton.onclick = () => { - const features = draw.getSnapshot(); - const geojson = { - type: "FeatureCollection", - features: features, - }; - const data = JSON.stringify(geojson, null, 2); - const blob = new Blob([data], { type: "text/plain" }); - const url = URL.createObjectURL(blob); - const link = document.createElement("a"); - link.href = url; - link.download = "drawing.geojson"; - link.click(); - URL.revokeObjectURL(url); - }; - } - const uploadButton = document.getElementById('upload-button'); - const uploadInput = document.getElementById('upload-input'); - if (uploadButton && uploadInput) { - uploadButton.onclick = () => { - uploadInput.click(); - }; - uploadInput.onchange = (event) => { - const file = event.target.files?.[0]; - if (file) { - const reader = new FileReader(); - reader.onload = (e) => { - try { - const geojson = JSON.parse(e.target?.result); - if (geojson.type === "FeatureCollection") { - draw.addFeatures(geojson.features); - } - else { - alert("Invalid GeoJSON file: must be a FeatureCollection."); - } - } - catch (error) { - alert("Error parsing GeoJSON file."); - } - }; - reader.readAsText(file); - } - }; - } - const resizeButton = document.getElementById('resize-button'); - if (resizeButton) { - resizeButton.onclick = () => { - resizingEnabled = !resizingEnabled; - resizeButton.classList.toggle('active', resizingEnabled); - const flags = { - polygon: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - linestring: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - rectangle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - circle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - freehand: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - }; - console.log("Updating flags:", flags); - draw.updateModeOptions('select', { flags }); - }; - } - const deleteSelectedButton = document.getElementById('delete-selected-button'); - if (deleteSelectedButton) { - deleteSelectedButton.onclick = () => { - if (selectedFeatureId) { - draw.removeFeatures([selectedFeatureId]); - } - else { - const features = draw.getSnapshot(); - if (features.length > 0) { - const lastFeature = features[features.length - 1]; - if (lastFeature.id) { - draw.removeFeatures([lastFeature.id]); - } - } - } - }; - } - const undoButton = document.getElementById('undo-button'); - if (undoButton) { - undoButton.onclick = () => { - if (history.length > 1) { - redoHistory.push(history.pop()); - const snapshotToRestore = history[history.length - 1]; - console.log("Restoring snapshot (undo):", snapshotToRestore); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshotToRestore); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - const redoButton = document.getElementById('redo-button'); - if (redoButton) { - redoButton.onclick = () => { - if (redoHistory.length > 0) { - const snapshot = redoHistory.pop(); - console.log("Restoring snapshot (redo):", snapshot); - history.push(snapshot); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshot); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - }); - function rotateFeature(feature, angle) { - const newFeature = JSON.parse(JSON.stringify(feature)); - const coordinates = newFeature.geometry.coordinates; - const center = getCenter(coordinates); - const rotatedCoordinates = coordinates.map(ring => { - return ring.map(point => { - const x = point[0] - center[0]; - const y = point[1] - center[1]; - const newX = x * Math.cos(angle * Math.PI / 180) - y * Math.sin(angle * Math.PI / 180); - const newY = x * Math.sin(angle * Math.PI / 180) + y * Math.cos(angle * Math.PI / 180); - return [newX + center[0], newY + center[1]]; - }); - }); - newFeature.geometry.coordinates = rotatedCoordinates; - return newFeature; - } - function getCenter(coordinates) { - let x = 0; - let y = 0; - let count = 0; - coordinates.forEach(ring => { - ring.forEach(point => { - x += point[0]; - y += point[1]; - count++; - }); - }); - return [x / count, y / count]; - } - document.addEventListener('keydown', (event) => { - if (event.key === 'r' && selectedFeatureId) { - const features = draw.getSnapshot(); - const selectedFeature = features.find(f => f.id === selectedFeatureId); - if (selectedFeature) { - const newFeature = rotateFeature(selectedFeature, 15); - draw.addFeatures([newFeature]); - } - } - }); - }); - } - catch (e) { - console.error("Error loading Google Maps API:", e); - } -}).catch(e => { - console.error("Error loading Google Maps API:", e); -}); -// [END maps_map_drawing_terradraw] diff --git a/dist/samples/map-drawing-terradraw/docs/index.ts b/dist/samples/map-drawing-terradraw/docs/index.ts deleted file mode 100644 index 51c00895f..000000000 --- a/dist/samples/map-drawing-terradraw/docs/index.ts +++ /dev/null @@ -1,509 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -// [START maps_map_drawing_terradraw] -// [START maps_map_drawing_terradraw_libraries] -import { Loader } from '@googlemaps/js-api-loader'; - -import { - TerraDraw, - TerraDrawSelectMode, - TerraDrawPointMode, - TerraDrawLineStringMode, - TerraDrawPolygonMode, - TerraDrawRectangleMode, - TerraDrawCircleMode, - TerraDrawFreehandMode -} from 'terra-draw'; -import { TerraDrawGoogleMapsAdapter } from 'terra-draw-google-maps-adapter'; - -// [END maps_map_drawing_terradraw_libraries] - -const colorPalette = [ - "#E74C3C", - "#FF0066", - "#9B59B6", - "#673AB7", - "#3F51B5", - "#3498DB", - "#03A9F4", - "#00BCD4", - "#009688", - "#27AE60", - "#8BC34A", - "#CDDC39", - "#F1C40F", - "#FFC107", - "#F39C12", - "#FF5722", - "#795548" -]; - -const getRandomColor = () => colorPalette[Math.floor(Math.random() * colorPalette.length)] as `#${string}`; - -function processSnapshotForUndo(snapshot: any[]): any[] { - // console.log("Processing snapshot for undo:", snapshot); - return snapshot.map(feature => { - const newFeature = JSON.parse(JSON.stringify(feature)); - - if (newFeature.properties.mode === 'rectangle') { - // console.log("Processing rectangle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - newFeature.properties.mode = 'polygon'; - } else if (newFeature.properties.mode === 'circle') { - // console.log("Processing circle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - // The radius is already in properties, so we just need to ensure the mode is correct for re-creation - newFeature.properties.mode = 'circle'; - } - return newFeature; - }); -} - -function setupModeButtons(): void { - const modeUI = document.getElementById('mode-ui'); - if (!modeUI) { - return; - } - - const modeButtons: { [key: string]: string } = { - 'select-mode': 'select', - 'point-mode': 'point', - 'linestring-mode': 'linestring', - 'polygon-mode': 'polygon', - 'rectangle-mode': 'rectangle', - 'circle-mode': 'circle', - 'freehand-mode': 'freehand', - 'clear-mode': 'static' - }; - - for (const buttonId in modeButtons) { - const button = document.getElementById(buttonId); - if (button) { - button.onclick = () => { - setActiveButton(buttonId); - const modeName = modeButtons[buttonId]; - - if (!draw) { - return; - } - if (modeName === 'static') { - draw.clear(); - draw.setMode('static'); - } else if (modeName) { - draw.setMode(modeName); - } - }; - } - } -} - -function setActiveButton(buttonId: string): void { - const buttons = document.querySelectorAll('.mode-button'); - const resizeButton = document.getElementById('resize-button'); - const isResizeActive = resizeButton?.classList.contains('active'); - - buttons.forEach(button => { - if (button.id !== 'resize-button') { - button.classList.remove('active'); - } - }); - - const activeButton = document.getElementById(buttonId); - if (activeButton) { - activeButton.classList.add('active'); - } - - if (isResizeActive) { - resizeButton?.classList.add('active'); - } -} - -function initUI(): void { - setActiveButton('point-mode'); -} - -let map: google.maps.Map; -let draw: TerraDraw; -let currentMode: string = 'static'; -let history: any[] = []; -let redoHistory: any[] = []; -let selectedFeatureId: string | null = null; -let isRestoring = false; -let resizingEnabled = false; -let debounceTimeout: number | undefined; - -const loader = new Loader({ - apiKey: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", - version: "weekly", - libraries: ["maps", "drawing", "marker"] -}); - -loader.load().then(async () => { - try { - const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; - const { LatLngBounds } = await google.maps.importLibrary("core") as google.maps.CoreLibrary; - const { Data } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; - - const mapOptions: google.maps.MapOptions = { - center: { lat: 48.862, lng: 2.342 }, - zoom: 12, - mapId:'c306b3c6dd3ed8d9', // raster '6a17c323f461e521', - mapTypeId: 'roadmap', - zoomControl:false, - tilt: 45, - mapTypeControl: true, - clickableIcons:false, - streetViewControl:false, - fullscreenControl:false, - }; - - const mapDiv = document.getElementById("map") as HTMLElement; - map = new Map(mapDiv, mapOptions); - - map.addListener("click", () => { - if (draw) { - console.log("Current draw mode on map click:", draw.getMode()); - } - }); - - map.addListener("projection_changed", () => { - - // [START maps_drawing_terradraw_modes] - - draw = new TerraDraw({ - adapter: new TerraDrawGoogleMapsAdapter({ map, lib: google.maps, coordinatePrecision: 9 }), - modes: [ - new TerraDrawSelectMode({ - flags: { - polygon: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - linestring: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - point: { - feature: { - draggable: true, - rotateable: true, - }, - }, - rectangle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - circle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - freehand: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - }, - }), - - new TerraDrawPointMode({ - editable: true, - styles: { pointColor: getRandomColor() }, - }), - new TerraDrawLineStringMode({ - editable: true, - styles: { lineStringColor: getRandomColor() }, - }), - new TerraDrawPolygonMode({ - editable: true, - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawRectangleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawCircleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawFreehandMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - ], - }); - - draw.start(); - - - draw.on('ready', () => { - console.log("TerraDraw is ready!"); - initUI(); - setupModeButtons(); - draw.setMode('point'); - currentMode = 'point'; - setActiveButton('point-mode'); - - draw.on("select", (id) => { - // console.log(`Feature selected: ${id}`); - if (selectedFeatureId && selectedFeatureId !== id) { - draw.deselectFeature(selectedFeatureId); - } - selectedFeatureId = id as string; - }); - - draw.on("deselect", () => { - // console.log("Feature deselected"); - selectedFeatureId = null; - }); - - history.push(processSnapshotForUndo(draw.getSnapshot())); // Push initial empty state - - draw.on("change", (ids, type) => { - if (isRestoring) { - return; - } - - if (debounceTimeout) { - clearTimeout(debounceTimeout); - } - - debounceTimeout = window.setTimeout(() => { - const snapshot = draw.getSnapshot(); - const processedSnapshot = processSnapshotForUndo(snapshot); - const filteredSnapshot = processedSnapshot.filter( - (f) => !f.properties.midPoint && !f.properties.selectionPoint - ); - history.push(filteredSnapshot); - redoHistory = []; - }, 200); - }); - - // [END maps_drawing_terradraw_modes] - - const exportButton = document.getElementById('export-button'); - if (exportButton) { - exportButton.onclick = () => { - const features = draw.getSnapshot(); - const geojson = { - type: "FeatureCollection", - features: features, - }; - const data = JSON.stringify(geojson, null, 2); - const blob = new Blob([data], { type: "text/plain" }); - const url = URL.createObjectURL(blob); - const link = document.createElement("a"); - link.href = url; - link.download = "drawing.geojson"; - link.click(); - URL.revokeObjectURL(url); - }; - } - - const uploadButton = document.getElementById('upload-button'); - const uploadInput = document.getElementById('upload-input') as HTMLInputElement; - - if (uploadButton && uploadInput) { - uploadButton.onclick = () => { - uploadInput.click(); - }; - - uploadInput.onchange = (event) => { - const file = (event.target as HTMLInputElement).files?.[0]; - if (file) { - const reader = new FileReader(); - reader.onload = (e) => { - try { - const geojson = JSON.parse(e.target?.result as string); - if (geojson.type === "FeatureCollection") { - draw.addFeatures(geojson.features); - } else { - alert("Invalid GeoJSON file: must be a FeatureCollection."); - } - } catch (error) { - alert("Error parsing GeoJSON file."); - } - }; - reader.readAsText(file); - } - }; - } - - const resizeButton = document.getElementById('resize-button'); - if (resizeButton) { - resizeButton.onclick = () => { - resizingEnabled = !resizingEnabled; - resizeButton.classList.toggle('active', resizingEnabled); - - const flags = { - polygon: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - linestring: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - rectangle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - circle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - freehand: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - }; - - console.log("Updating flags:", flags); - draw.updateModeOptions('select', { flags }); - }; - } - - const deleteSelectedButton = document.getElementById('delete-selected-button'); - if (deleteSelectedButton) { - deleteSelectedButton.onclick = () => { - if (selectedFeatureId) { - draw.removeFeatures([selectedFeatureId]); - } else { - const features = draw.getSnapshot(); - if (features.length > 0) { - const lastFeature = features[features.length - 1]; - if (lastFeature.id) { - draw.removeFeatures([lastFeature.id]); - } - } - } - }; - } - - const undoButton = document.getElementById('undo-button'); - if (undoButton) { - undoButton.onclick = () => { - if (history.length > 1) { - redoHistory.push(history.pop()); - const snapshotToRestore = history[history.length - 1]; - console.log("Restoring snapshot (undo):", snapshotToRestore); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshotToRestore); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - - const redoButton = document.getElementById('redo-button'); - if (redoButton) { - redoButton.onclick = () => { - if (redoHistory.length > 0) { - const snapshot = redoHistory.pop(); - console.log("Restoring snapshot (redo):", snapshot); - history.push(snapshot); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshot); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - }); - - function rotateFeature(feature, angle) { - const newFeature = JSON.parse(JSON.stringify(feature)); - const coordinates = newFeature.geometry.coordinates; - const center = getCenter(coordinates); - - const rotatedCoordinates = coordinates.map(ring => { - return ring.map(point => { - const x = point[0] - center[0]; - const y = point[1] - center[1]; - const newX = x * Math.cos(angle * Math.PI / 180) - y * Math.sin(angle * Math.PI / 180); - const newY = x * Math.sin(angle * Math.PI / 180) + y * Math.cos(angle * Math.PI / 180); - return [newX + center[0], newY + center[1]]; - }); - }); - - newFeature.geometry.coordinates = rotatedCoordinates; - return newFeature; - } - - function getCenter(coordinates) { - let x = 0; - let y = 0; - let count = 0; - coordinates.forEach(ring => { - ring.forEach(point => { - x += point[0]; - y += point[1]; - count++; - }); - }); - return [x / count, y / count]; - } - - document.addEventListener('keydown', (event) => { - if (event.key === 'r' && selectedFeatureId) { - const features = draw.getSnapshot(); - const selectedFeature = features.find(f => f.id === selectedFeatureId); - - if (selectedFeature) { - const newFeature = rotateFeature(selectedFeature, 15); - draw.addFeatures([newFeature]); - } - } - }); - }); - - } catch (e) { - console.error("Error loading Google Maps API:", e); - } -}).catch(e => { - console.error("Error loading Google Maps API:", e); -}); -// [END maps_map_drawing_terradraw] diff --git a/dist/samples/map-drawing-terradraw/docs/style.css b/dist/samples/map-drawing-terradraw/docs/style.css deleted file mode 100644 index 2584b672b..000000000 --- a/dist/samples/map-drawing-terradraw/docs/style.css +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ -/* [START maps_map_drawing_terradraw] */ -html, -body { - height: 100%; - margin: 0; - padding: 0; - font-family: Arial, sans-serif; -} -#map { - height: 100%; - width: 100%; -} -#mode-ui { - position: absolute; - top: 10px; - right: 10px; - background: white; - padding: 10px; - border-radius: 5px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); - z-index: 1000; - display: flex; - flex-direction: column; -} -#mode-ui button { - margin: 5px 0; - cursor: pointer; -} - -.mode-button { - width: 30px; - height: 30px; - border: 1px solid #ccc; - background-color: white; - padding: 2px; - box-sizing: border-box; -} - -.mode-button img { - width: 100%; - height: 100%; - display: block; - user-select: none; -} - -/* Active state for shape modes */ -.mode-button.active { - background-color: #e0e0e0; /* light grey */ -} - -/* Special buttons default state */ -#select-mode, -#clear-mode, -#delete-selected-button, -#undo-button, -#redo-button, -#export-button, -#upload-button, -#resize-button { - background-color: #000000; -} - -/* Special buttons icon default state */ -#select-mode img, -#clear-mode img, -#delete-selected-button img, -#undo-button img, -#redo-button img, -#export-button img, -#upload-button img, -#resize-button img { - filter: brightness(0) invert(1); -} - -/* Special buttons active/click states */ -#select-mode.active { - background-color: #A9A9A9; /* dark grey */ -} - -#clear-mode:active, -#delete-selected-button:active, -#undo-button:active, -#redo-button:active, -#export-button:active, -#upload-button:active, -#resize-button.active { - background-color: #A9A9A9; /* dark grey */ -} -/* [END maps_map_drawing_terradraw] */ diff --git a/dist/samples/map-drawing-terradraw/jsfiddle/demo.css b/dist/samples/map-drawing-terradraw/jsfiddle/demo.css deleted file mode 100644 index 8542350b1..000000000 --- a/dist/samples/map-drawing-terradraw/jsfiddle/demo.css +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -html, -body { - height: 100%; - margin: 0; - padding: 0; - font-family: Arial, sans-serif; -} -#map { - height: 100%; - width: 100%; -} -#mode-ui { - position: absolute; - top: 10px; - right: 10px; - background: white; - padding: 10px; - border-radius: 5px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); - z-index: 1000; - display: flex; - flex-direction: column; -} -#mode-ui button { - margin: 5px 0; - cursor: pointer; -} - -.mode-button { - width: 30px; - height: 30px; - border: 1px solid #ccc; - background-color: white; - padding: 2px; - box-sizing: border-box; -} - -.mode-button img { - width: 100%; - height: 100%; - display: block; - user-select: none; -} - -/* Active state for shape modes */ -.mode-button.active { - background-color: #e0e0e0; /* light grey */ -} - -/* Special buttons default state */ -#select-mode, -#clear-mode, -#delete-selected-button, -#undo-button, -#redo-button, -#export-button, -#upload-button, -#resize-button { - background-color: #000000; -} - -/* Special buttons icon default state */ -#select-mode img, -#clear-mode img, -#delete-selected-button img, -#undo-button img, -#redo-button img, -#export-button img, -#upload-button img, -#resize-button img { - filter: brightness(0) invert(1); -} - -/* Special buttons active/click states */ -#select-mode.active { - background-color: #A9A9A9; /* dark grey */ -} - -#clear-mode:active, -#delete-selected-button:active, -#undo-button:active, -#redo-button:active, -#export-button:active, -#upload-button:active, -#resize-button.active { - background-color: #A9A9A9; /* dark grey */ -} - diff --git a/dist/samples/map-drawing-terradraw/jsfiddle/demo.details b/dist/samples/map-drawing-terradraw/jsfiddle/demo.details deleted file mode 100644 index 6cbc1dcaa..000000000 --- a/dist/samples/map-drawing-terradraw/jsfiddle/demo.details +++ /dev/null @@ -1,7 +0,0 @@ -name: map-drawing-terradraw -authors: - - Geo Developer IX Documentation Team -tags: - - google maps -load_type: h -description: Sample code supporting Google Maps Platform JavaScript API documentation. diff --git a/dist/samples/map-drawing-terradraw/jsfiddle/demo.html b/dist/samples/map-drawing-terradraw/jsfiddle/demo.html deleted file mode 100644 index 181332dc7..000000000 --- a/dist/samples/map-drawing-terradraw/jsfiddle/demo.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - Terra Draw with Google Maps API Sample - - - - - -
- - -
- - - - - - - - - - - - - - - -
- - - - - - diff --git a/dist/samples/map-drawing-terradraw/jsfiddle/demo.js b/dist/samples/map-drawing-terradraw/jsfiddle/demo.js deleted file mode 100644 index 38988c3b1..000000000 --- a/dist/samples/map-drawing-terradraw/jsfiddle/demo.js +++ /dev/null @@ -1,451 +0,0 @@ -/* - * @license - * Copyright 2025 Google LLC. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - - -import { Loader } from '@googlemaps/js-api-loader'; -import { TerraDraw, TerraDrawSelectMode, TerraDrawPointMode, TerraDrawLineStringMode, TerraDrawPolygonMode, TerraDrawRectangleMode, TerraDrawCircleMode, TerraDrawFreehandMode } from 'terra-draw'; -import { TerraDrawGoogleMapsAdapter } from 'terra-draw-google-maps-adapter'; - -const colorPalette = [ - "#E74C3C", - "#FF0066", - "#9B59B6", - "#673AB7", - "#3F51B5", - "#3498DB", - "#03A9F4", - "#00BCD4", - "#009688", - "#27AE60", - "#8BC34A", - "#CDDC39", - "#F1C40F", - "#FFC107", - "#F39C12", - "#FF5722", - "#795548" -]; -const getRandomColor = () => colorPalette[Math.floor(Math.random() * colorPalette.length)]; -function processSnapshotForUndo(snapshot) { - // console.log("Processing snapshot for undo:", snapshot); - return snapshot.map(feature => { - const newFeature = JSON.parse(JSON.stringify(feature)); - if (newFeature.properties.mode === 'rectangle') { - // console.log("Processing rectangle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - newFeature.properties.mode = 'polygon'; - } - else if (newFeature.properties.mode === 'circle') { - // console.log("Processing circle for undo:", newFeature); - newFeature.geometry.type = 'Polygon'; - // The radius is already in properties, so we just need to ensure the mode is correct for re-creation - newFeature.properties.mode = 'circle'; - } - return newFeature; - }); -} -function setupModeButtons() { - const modeUI = document.getElementById('mode-ui'); - if (!modeUI) { - return; - } - const modeButtons = { - 'select-mode': 'select', - 'point-mode': 'point', - 'linestring-mode': 'linestring', - 'polygon-mode': 'polygon', - 'rectangle-mode': 'rectangle', - 'circle-mode': 'circle', - 'freehand-mode': 'freehand', - 'clear-mode': 'static' - }; - for (const buttonId in modeButtons) { - const button = document.getElementById(buttonId); - if (button) { - button.onclick = () => { - setActiveButton(buttonId); - const modeName = modeButtons[buttonId]; - if (!draw) { - return; - } - if (modeName === 'static') { - draw.clear(); - draw.setMode('static'); - } - else if (modeName) { - draw.setMode(modeName); - } - }; - } - } -} -function setActiveButton(buttonId) { - const buttons = document.querySelectorAll('.mode-button'); - const resizeButton = document.getElementById('resize-button'); - const isResizeActive = resizeButton?.classList.contains('active'); - buttons.forEach(button => { - if (button.id !== 'resize-button') { - button.classList.remove('active'); - } - }); - const activeButton = document.getElementById(buttonId); - if (activeButton) { - activeButton.classList.add('active'); - } - if (isResizeActive) { - resizeButton?.classList.add('active'); - } -} -function initUI() { - setActiveButton('point-mode'); -} -let map; -let draw; -let currentMode = 'static'; -let history = []; -let redoHistory = []; -let selectedFeatureId = null; -let isRestoring = false; -let resizingEnabled = false; -let debounceTimeout; -const loader = new Loader({ - apiKey: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", - version: "weekly", - libraries: ["maps", "drawing", "marker"] -}); -loader.load().then(async () => { - try { - const { Map } = await google.maps.importLibrary("maps"); - const { LatLngBounds } = await google.maps.importLibrary("core"); - const { Data } = await google.maps.importLibrary("maps"); - const mapOptions = { - center: { lat: 48.862, lng: 2.342 }, - zoom: 12, - mapId: 'c306b3c6dd3ed8d9', // raster '6a17c323f461e521', - mapTypeId: 'roadmap', - zoomControl: false, - tilt: 45, - mapTypeControl: true, - clickableIcons: false, - streetViewControl: false, - fullscreenControl: false, - }; - const mapDiv = document.getElementById("map"); - map = new Map(mapDiv, mapOptions); - map.addListener("click", () => { - if (draw) { - console.log("Current draw mode on map click:", draw.getMode()); - } - }); - map.addListener("projection_changed", () => { - - draw = new TerraDraw({ - adapter: new TerraDrawGoogleMapsAdapter({ map, lib: google.maps, coordinatePrecision: 9 }), - modes: [ - new TerraDrawSelectMode({ - flags: { - polygon: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - linestring: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - point: { - feature: { - draggable: true, - rotateable: true, - }, - }, - rectangle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - circle: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - freehand: { - feature: { - draggable: true, - rotateable: true, - coordinates: { - midpoints: true, - draggable: true, - deletable: true, - }, - }, - }, - }, - }), - new TerraDrawPointMode({ - editable: true, - styles: { pointColor: getRandomColor() }, - }), - new TerraDrawLineStringMode({ - editable: true, - styles: { lineStringColor: getRandomColor() }, - }), - new TerraDrawPolygonMode({ - editable: true, - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawRectangleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawCircleMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - new TerraDrawFreehandMode({ - styles: (() => { - const color = getRandomColor(); - return { - fillColor: color, - outlineColor: color, - }; - })(), - }), - ], - }); - draw.start(); - draw.on('ready', () => { - console.log("TerraDraw is ready!"); - initUI(); - setupModeButtons(); - draw.setMode('point'); - currentMode = 'point'; - setActiveButton('point-mode'); - draw.on("select", (id) => { - // console.log(`Feature selected: ${id}`); - if (selectedFeatureId && selectedFeatureId !== id) { - draw.deselectFeature(selectedFeatureId); - } - selectedFeatureId = id; - }); - draw.on("deselect", () => { - // console.log("Feature deselected"); - selectedFeatureId = null; - }); - history.push(processSnapshotForUndo(draw.getSnapshot())); // Push initial empty state - draw.on("change", (ids, type) => { - if (isRestoring) { - return; - } - if (debounceTimeout) { - clearTimeout(debounceTimeout); - } - debounceTimeout = window.setTimeout(() => { - const snapshot = draw.getSnapshot(); - const processedSnapshot = processSnapshotForUndo(snapshot); - const filteredSnapshot = processedSnapshot.filter((f) => !f.properties.midPoint && !f.properties.selectionPoint); - history.push(filteredSnapshot); - redoHistory = []; - }, 200); - }); - - const exportButton = document.getElementById('export-button'); - if (exportButton) { - exportButton.onclick = () => { - const features = draw.getSnapshot(); - const geojson = { - type: "FeatureCollection", - features: features, - }; - const data = JSON.stringify(geojson, null, 2); - const blob = new Blob([data], { type: "text/plain" }); - const url = URL.createObjectURL(blob); - const link = document.createElement("a"); - link.href = url; - link.download = "drawing.geojson"; - link.click(); - URL.revokeObjectURL(url); - }; - } - const uploadButton = document.getElementById('upload-button'); - const uploadInput = document.getElementById('upload-input'); - if (uploadButton && uploadInput) { - uploadButton.onclick = () => { - uploadInput.click(); - }; - uploadInput.onchange = (event) => { - const file = event.target.files?.[0]; - if (file) { - const reader = new FileReader(); - reader.onload = (e) => { - try { - const geojson = JSON.parse(e.target?.result); - if (geojson.type === "FeatureCollection") { - draw.addFeatures(geojson.features); - } - else { - alert("Invalid GeoJSON file: must be a FeatureCollection."); - } - } - catch (error) { - alert("Error parsing GeoJSON file."); - } - }; - reader.readAsText(file); - } - }; - } - const resizeButton = document.getElementById('resize-button'); - if (resizeButton) { - resizeButton.onclick = () => { - resizingEnabled = !resizingEnabled; - resizeButton.classList.toggle('active', resizingEnabled); - const flags = { - polygon: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - linestring: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - rectangle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - circle: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - freehand: { feature: { draggable: true, coordinates: { resizable: resizingEnabled ? 'center' : undefined, draggable: !resizingEnabled } } }, - }; - console.log("Updating flags:", flags); - draw.updateModeOptions('select', { flags }); - }; - } - const deleteSelectedButton = document.getElementById('delete-selected-button'); - if (deleteSelectedButton) { - deleteSelectedButton.onclick = () => { - if (selectedFeatureId) { - draw.removeFeatures([selectedFeatureId]); - } - else { - const features = draw.getSnapshot(); - if (features.length > 0) { - const lastFeature = features[features.length - 1]; - if (lastFeature.id) { - draw.removeFeatures([lastFeature.id]); - } - } - } - }; - } - const undoButton = document.getElementById('undo-button'); - if (undoButton) { - undoButton.onclick = () => { - if (history.length > 1) { - redoHistory.push(history.pop()); - const snapshotToRestore = history[history.length - 1]; - console.log("Restoring snapshot (undo):", snapshotToRestore); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshotToRestore); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - const redoButton = document.getElementById('redo-button'); - if (redoButton) { - redoButton.onclick = () => { - if (redoHistory.length > 0) { - const snapshot = redoHistory.pop(); - console.log("Restoring snapshot (redo):", snapshot); - history.push(snapshot); - isRestoring = true; - draw.clear(); - draw.addFeatures(snapshot); - setTimeout(() => { isRestoring = false; }, 0); - } - }; - } - }); - function rotateFeature(feature, angle) { - const newFeature = JSON.parse(JSON.stringify(feature)); - const coordinates = newFeature.geometry.coordinates; - const center = getCenter(coordinates); - const rotatedCoordinates = coordinates.map(ring => { - return ring.map(point => { - const x = point[0] - center[0]; - const y = point[1] - center[1]; - const newX = x * Math.cos(angle * Math.PI / 180) - y * Math.sin(angle * Math.PI / 180); - const newY = x * Math.sin(angle * Math.PI / 180) + y * Math.cos(angle * Math.PI / 180); - return [newX + center[0], newY + center[1]]; - }); - }); - newFeature.geometry.coordinates = rotatedCoordinates; - return newFeature; - } - function getCenter(coordinates) { - let x = 0; - let y = 0; - let count = 0; - coordinates.forEach(ring => { - ring.forEach(point => { - x += point[0]; - y += point[1]; - count++; - }); - }); - return [x / count, y / count]; - } - document.addEventListener('keydown', (event) => { - if (event.key === 'r' && selectedFeatureId) { - const features = draw.getSnapshot(); - const selectedFeature = features.find(f => f.id === selectedFeatureId); - if (selectedFeature) { - const newFeature = rotateFeature(selectedFeature, 15); - draw.addFeatures([newFeature]); - } - } - }); - }); - } - catch (e) { - console.error("Error loading Google Maps API:", e); - } -}).catch(e => { - console.error("Error loading Google Maps API:", e); -}); - diff --git a/dist/samples/map-events/app/index.ts b/dist/samples/map-events/app/index.ts index 3cdbe1b0e..4f452c004 100644 --- a/dist/samples/map-events/app/index.ts +++ b/dist/samples/map-events/app/index.ts @@ -29,7 +29,7 @@ const events = [ ]; function setupListener(map: google.maps.Map, name: string) { - const eventRow = document.getElementById(name) as HTMLElement; + const eventRow = document.getElementById(name)!; map.addListener(name, () => { eventRow.className = 'event active'; setTimeout(() => { @@ -52,20 +52,20 @@ async function init() { mapTypeControl: false, }); - for (let i = 0; i < events.length; i++) { - setupListener(innerMap, events[i]); + for (const event of events) { + setupListener(innerMap, event); } } // Dynamically create the table of events from the defined hashmap function populateTable() { - const eventsTable = document.getElementById('sidebar') as HTMLElement; + const eventsTable = document.getElementById('sidebar')!; - for (let i = 0; i < events.length; i++) { + for (const event of events) { const eventDiv = document.createElement('div'); eventDiv.className = 'event'; - eventDiv.id = events[i]; - eventDiv.innerText = events[i]; + eventDiv.id = event; + eventDiv.innerText = event; eventsTable.appendChild(eventDiv); } } diff --git a/dist/samples/map-events/dist/assets/index-EClbXEF-.js b/dist/samples/map-events/dist/assets/index-BIvXp_gI.js similarity index 85% rename from dist/samples/map-events/dist/assets/index-EClbXEF-.js rename to dist/samples/map-events/dist/assets/index-BIvXp_gI.js index d25325e43..1cec9c227 100644 --- a/dist/samples/map-events/dist/assets/index-EClbXEF-.js +++ b/dist/samples/map-events/dist/assets/index-BIvXp_gI.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[`bounds_changed`,`center_changed`,`click`,`contextmenu`,`dblclick`,`drag`,`dragend`,`dragstart`,`heading_changed`,`idle`,`maptypeid_changed`,`mousemove`,`mouseout`,`mouseover`,`projection_changed`,`resize`,`rightclick`,`tilesloaded`,`tilt_changed`,`zoom_changed`];function t(e,t){let n=document.getElementById(t);e.addListener(t,()=>{n.className=`event active`,setTimeout(()=>{n.className=`event inactive`},1e3)})}async function n(){await google.maps.importLibrary(`maps`);let n=document.querySelector(`gmp-map`);r();let i=n.innerMap;i.setOptions({mapTypeControl:!1});for(let n=0;n{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[`bounds_changed`,`center_changed`,`click`,`contextmenu`,`dblclick`,`drag`,`dragend`,`dragstart`,`heading_changed`,`idle`,`maptypeid_changed`,`mousemove`,`mouseout`,`mouseover`,`projection_changed`,`resize`,`rightclick`,`tilesloaded`,`tilt_changed`,`zoom_changed`];function t(e,t){let n=document.getElementById(t);e.addListener(t,()=>{n.className=`event active`,setTimeout(()=>{n.className=`event inactive`},1e3)})}async function n(){await google.maps.importLibrary(`maps`);let n=document.querySelector(`gmp-map`);r();let i=n.innerMap;i.setOptions({mapTypeControl:!1});for(let n of e)t(i,n)}function r(){let t=document.getElementById(`sidebar`);for(let n of e){let e=document.createElement(`div`);e.className=`event`,e.id=n,e.innerText=n,t.appendChild(e)}}n(); \ No newline at end of file diff --git a/dist/samples/map-events/dist/index.html b/dist/samples/map-events/dist/index.html index da8531d38..dc310e276 100644 --- a/dist/samples/map-events/dist/index.html +++ b/dist/samples/map-events/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/map-events/docs/index.js b/dist/samples/map-events/docs/index.js index 982ed9dc1..8ff63f64c 100644 --- a/dist/samples/map-events/docs/index.js +++ b/dist/samples/map-events/docs/index.js @@ -53,8 +53,8 @@ async function init() { mapTypeControl: false, }); - for (let i = 0; i < events.length; i++) { - setupListener(innerMap, events[i]); + for (const event of events) { + setupListener(innerMap, event); } } @@ -62,11 +62,11 @@ async function init() { function populateTable() { const eventsTable = document.getElementById('sidebar'); - for (let i = 0; i < events.length; i++) { + for (const event of events) { const eventDiv = document.createElement('div'); eventDiv.className = 'event'; - eventDiv.id = events[i]; - eventDiv.innerText = events[i]; + eventDiv.id = event; + eventDiv.innerText = event; eventsTable.appendChild(eventDiv); } } diff --git a/dist/samples/map-events/docs/index.ts b/dist/samples/map-events/docs/index.ts index 3cdbe1b0e..4f452c004 100644 --- a/dist/samples/map-events/docs/index.ts +++ b/dist/samples/map-events/docs/index.ts @@ -29,7 +29,7 @@ const events = [ ]; function setupListener(map: google.maps.Map, name: string) { - const eventRow = document.getElementById(name) as HTMLElement; + const eventRow = document.getElementById(name)!; map.addListener(name, () => { eventRow.className = 'event active'; setTimeout(() => { @@ -52,20 +52,20 @@ async function init() { mapTypeControl: false, }); - for (let i = 0; i < events.length; i++) { - setupListener(innerMap, events[i]); + for (const event of events) { + setupListener(innerMap, event); } } // Dynamically create the table of events from the defined hashmap function populateTable() { - const eventsTable = document.getElementById('sidebar') as HTMLElement; + const eventsTable = document.getElementById('sidebar')!; - for (let i = 0; i < events.length; i++) { + for (const event of events) { const eventDiv = document.createElement('div'); eventDiv.className = 'event'; - eventDiv.id = events[i]; - eventDiv.innerText = events[i]; + eventDiv.id = event; + eventDiv.innerText = event; eventsTable.appendChild(eventDiv); } } diff --git a/dist/samples/map-events/jsfiddle/demo.js b/dist/samples/map-events/jsfiddle/demo.js index 4af0c1dc2..d6f676461 100644 --- a/dist/samples/map-events/jsfiddle/demo.js +++ b/dist/samples/map-events/jsfiddle/demo.js @@ -52,8 +52,8 @@ async function init() { mapTypeControl: false, }); - for (let i = 0; i < events.length; i++) { - setupListener(innerMap, events[i]); + for (const event of events) { + setupListener(innerMap, event); } } @@ -61,11 +61,11 @@ async function init() { function populateTable() { const eventsTable = document.getElementById('sidebar'); - for (let i = 0; i < events.length; i++) { + for (const event of events) { const eventDiv = document.createElement('div'); eventDiv.className = 'event'; - eventDiv.id = events[i]; - eventDiv.innerText = events[i]; + eventDiv.id = event; + eventDiv.innerText = event; eventsTable.appendChild(eventDiv); } } diff --git a/dist/samples/map-projection-simple/app/index.ts b/dist/samples/map-projection-simple/app/index.ts index 64fe60505..493f644f9 100644 --- a/dist/samples/map-projection-simple/app/index.ts +++ b/dist/samples/map-projection-simple/app/index.ts @@ -27,7 +27,7 @@ async function init() { innerMap.setMapTypeId('gallPeters'); // Show the lat and lng under the mouse cursor. - const coordsDiv = document.getElementById('coords') as HTMLElement; + const coordsDiv = document.getElementById('coords')!; innerMap.addListener('mousemove', (event: google.maps.MapMouseEvent) => { coordsDiv.textContent = @@ -48,7 +48,7 @@ async function init() { innerMap.data.addGeoJson(cities); } -let gallPetersMapType; +let gallPetersMapType: google.maps.ImageMapType; async function initGallPeters() { const [{ ImageMapType }, { Size, Point, LatLng }] = await Promise.all([ @@ -61,7 +61,7 @@ async function initGallPeters() { // Fetch Gall-Peters tiles stored locally on our server. gallPetersMapType = new ImageMapType({ - getTileUrl: function (coord, zoom) { + getTileUrl(coord, zoom) { const scale = 1 << zoom; // Wrap tiles horizontally. @@ -82,14 +82,14 @@ async function initGallPeters() { // Describe the Gall-Peters projection used by these tiles. gallPetersMapType.projection = { - fromLatLngToPoint: function (latLng) { + fromLatLngToPoint(latLng: google.maps.LatLng) { const latRadians = (latLng.lat() * Math.PI) / 180; return new Point( GALL_PETERS_RANGE_X * (0.5 + latLng.lng() / 360), GALL_PETERS_RANGE_Y * (0.5 - 0.5 * Math.sin(latRadians)) ); }, - fromPointToLatLng: function (point, noWrap) { + fromPointToLatLng(point: google.maps.Point, noWrap?: boolean) { const x = point.x / GALL_PETERS_RANGE_X; const y = Math.max(0, Math.min(1, point.y / GALL_PETERS_RANGE_Y)); diff --git a/dist/samples/map-projection-simple/dist/assets/index-BnMy29Mt.js b/dist/samples/map-projection-simple/dist/assets/index-BnMy29Mt.js deleted file mode 100644 index c0553e10d..000000000 --- a/dist/samples/map-projection-simple/dist/assets/index-BnMy29Mt.js +++ /dev/null @@ -1 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;async function n(){await google.maps.importLibrary(`maps`),t=e.innerMap,t.setOptions({mapTypeControl:!1}),i(),t.mapTypes.set(`gallPeters`,r),t.setMapTypeId(`gallPeters`);let n=document.getElementById(`coords`);t.addListener(`mousemove`,e=>{n.textContent=`lat: `+Math.round(e.latLng.lat())+`, lng: `+Math.round(e.latLng.lng())}),t.data.setStyle(e=>({title:e.getProperty(`name`),optimized:!1})),t.data.addGeoJson(a)}var r;async function i(){let[{ImageMapType:e},{Size:t,Point:n,LatLng:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`core`)]);r=new e({getTileUrl:function(e,t){let n=1<=n?``:`gall-peters_`+t+`_`+r+`_`+i+`.png`},tileSize:new t(800,512),minZoom:0,maxZoom:1,name:`Gall-Peters`}),r.projection={fromLatLngToPoint:function(e){let t=e.lat()*Math.PI/180;return new n(800*(.5+e.lng()/360),512*(.5-.5*Math.sin(t)))},fromPointToLatLng:function(e,t){let n=e.x/800,r=Math.max(0,Math.min(1,e.y/512));return new i(Math.asin(1-2*r)*180/Math.PI,-180+360*n,t)}}}var a={type:`FeatureCollection`,features:[{type:`Feature`,geometry:{type:`Point`,coordinates:[-87.65,41.85]},properties:{name:`Chicago`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[-149.9,61.218]},properties:{name:`Anchorage`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[-99.127,19.427]},properties:{name:`Mexico City`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[-.126,51.5]},properties:{name:`London`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[28.045,-26.201]},properties:{name:`Johannesburg`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[15.322,-4.325]},properties:{name:`Kinshasa`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[151.207,-33.867]},properties:{name:`Sydney`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[0,0]},properties:{name:`0°N 0°E`}}]};n(); \ No newline at end of file diff --git a/dist/samples/map-projection-simple/dist/assets/index-adoPgcgI.js b/dist/samples/map-projection-simple/dist/assets/index-adoPgcgI.js new file mode 100644 index 000000000..62c10d1a3 --- /dev/null +++ b/dist/samples/map-projection-simple/dist/assets/index-adoPgcgI.js @@ -0,0 +1 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t;async function n(){await google.maps.importLibrary(`maps`),t=e.innerMap,t.setOptions({mapTypeControl:!1}),i(),t.mapTypes.set(`gallPeters`,r),t.setMapTypeId(`gallPeters`);let n=document.getElementById(`coords`);t.addListener(`mousemove`,e=>{n.textContent=`lat: `+Math.round(e.latLng.lat())+`, lng: `+Math.round(e.latLng.lng())}),t.data.setStyle(e=>({title:e.getProperty(`name`),optimized:!1})),t.data.addGeoJson(a)}var r;async function i(){let[{ImageMapType:e},{Size:t,Point:n,LatLng:i}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`core`)]);r=new e({getTileUrl(e,t){let n=1<=n?``:`gall-peters_`+t+`_`+r+`_`+i+`.png`},tileSize:new t(800,512),minZoom:0,maxZoom:1,name:`Gall-Peters`}),r.projection={fromLatLngToPoint(e){let t=e.lat()*Math.PI/180;return new n(800*(.5+e.lng()/360),512*(.5-.5*Math.sin(t)))},fromPointToLatLng(e,t){let n=e.x/800,r=Math.max(0,Math.min(1,e.y/512));return new i(Math.asin(1-2*r)*180/Math.PI,-180+360*n,t)}}}var a={type:`FeatureCollection`,features:[{type:`Feature`,geometry:{type:`Point`,coordinates:[-87.65,41.85]},properties:{name:`Chicago`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[-149.9,61.218]},properties:{name:`Anchorage`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[-99.127,19.427]},properties:{name:`Mexico City`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[-.126,51.5]},properties:{name:`London`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[28.045,-26.201]},properties:{name:`Johannesburg`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[15.322,-4.325]},properties:{name:`Kinshasa`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[151.207,-33.867]},properties:{name:`Sydney`}},{type:`Feature`,geometry:{type:`Point`,coordinates:[0,0]},properties:{name:`0°N 0°E`}}]};n(); \ No newline at end of file diff --git a/dist/samples/map-projection-simple/dist/index.html b/dist/samples/map-projection-simple/dist/index.html index bebb1eda9..a1055c474 100644 --- a/dist/samples/map-projection-simple/dist/index.html +++ b/dist/samples/map-projection-simple/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/map-projection-simple/docs/index.js b/dist/samples/map-projection-simple/docs/index.js index d3e017024..f8750fb09 100644 --- a/dist/samples/map-projection-simple/docs/index.js +++ b/dist/samples/map-projection-simple/docs/index.js @@ -62,7 +62,7 @@ async function initGallPeters() { // Fetch Gall-Peters tiles stored locally on our server. gallPetersMapType = new ImageMapType({ - getTileUrl: function (coord, zoom) { + getTileUrl(coord, zoom) { const scale = 1 << zoom; // Wrap tiles horizontally. @@ -83,14 +83,14 @@ async function initGallPeters() { // Describe the Gall-Peters projection used by these tiles. gallPetersMapType.projection = { - fromLatLngToPoint: function (latLng) { + fromLatLngToPoint(latLng) { const latRadians = (latLng.lat() * Math.PI) / 180; return new Point( GALL_PETERS_RANGE_X * (0.5 + latLng.lng() / 360), GALL_PETERS_RANGE_Y * (0.5 - 0.5 * Math.sin(latRadians)) ); }, - fromPointToLatLng: function (point, noWrap) { + fromPointToLatLng(point, noWrap) { const x = point.x / GALL_PETERS_RANGE_X; const y = Math.max(0, Math.min(1, point.y / GALL_PETERS_RANGE_Y)); diff --git a/dist/samples/map-projection-simple/docs/index.ts b/dist/samples/map-projection-simple/docs/index.ts index 64fe60505..493f644f9 100644 --- a/dist/samples/map-projection-simple/docs/index.ts +++ b/dist/samples/map-projection-simple/docs/index.ts @@ -27,7 +27,7 @@ async function init() { innerMap.setMapTypeId('gallPeters'); // Show the lat and lng under the mouse cursor. - const coordsDiv = document.getElementById('coords') as HTMLElement; + const coordsDiv = document.getElementById('coords')!; innerMap.addListener('mousemove', (event: google.maps.MapMouseEvent) => { coordsDiv.textContent = @@ -48,7 +48,7 @@ async function init() { innerMap.data.addGeoJson(cities); } -let gallPetersMapType; +let gallPetersMapType: google.maps.ImageMapType; async function initGallPeters() { const [{ ImageMapType }, { Size, Point, LatLng }] = await Promise.all([ @@ -61,7 +61,7 @@ async function initGallPeters() { // Fetch Gall-Peters tiles stored locally on our server. gallPetersMapType = new ImageMapType({ - getTileUrl: function (coord, zoom) { + getTileUrl(coord, zoom) { const scale = 1 << zoom; // Wrap tiles horizontally. @@ -82,14 +82,14 @@ async function initGallPeters() { // Describe the Gall-Peters projection used by these tiles. gallPetersMapType.projection = { - fromLatLngToPoint: function (latLng) { + fromLatLngToPoint(latLng: google.maps.LatLng) { const latRadians = (latLng.lat() * Math.PI) / 180; return new Point( GALL_PETERS_RANGE_X * (0.5 + latLng.lng() / 360), GALL_PETERS_RANGE_Y * (0.5 - 0.5 * Math.sin(latRadians)) ); }, - fromPointToLatLng: function (point, noWrap) { + fromPointToLatLng(point: google.maps.Point, noWrap?: boolean) { const x = point.x / GALL_PETERS_RANGE_X; const y = Math.max(0, Math.min(1, point.y / GALL_PETERS_RANGE_Y)); diff --git a/dist/samples/map-projection-simple/jsfiddle/demo.js b/dist/samples/map-projection-simple/jsfiddle/demo.js index eebc54ce8..3ed7b4dbf 100644 --- a/dist/samples/map-projection-simple/jsfiddle/demo.js +++ b/dist/samples/map-projection-simple/jsfiddle/demo.js @@ -61,7 +61,7 @@ async function initGallPeters() { // Fetch Gall-Peters tiles stored locally on our server. gallPetersMapType = new ImageMapType({ - getTileUrl: function (coord, zoom) { + getTileUrl(coord, zoom) { const scale = 1 << zoom; // Wrap tiles horizontally. @@ -82,14 +82,14 @@ async function initGallPeters() { // Describe the Gall-Peters projection used by these tiles. gallPetersMapType.projection = { - fromLatLngToPoint: function (latLng) { + fromLatLngToPoint(latLng) { const latRadians = (latLng.lat() * Math.PI) / 180; return new Point( GALL_PETERS_RANGE_X * (0.5 + latLng.lng() / 360), GALL_PETERS_RANGE_Y * (0.5 - 0.5 * Math.sin(latRadians)) ); }, - fromPointToLatLng: function (point, noWrap) { + fromPointToLatLng(point, noWrap) { const x = point.x / GALL_PETERS_RANGE_X; const y = Math.max(0, Math.min(1, point.y / GALL_PETERS_RANGE_Y)); diff --git a/dist/samples/map-simple-js/app/index.ts b/dist/samples/map-simple-js/app/index.ts index 3d95621c1..0afb5b576 100644 --- a/dist/samples/map-simple-js/app/index.ts +++ b/dist/samples/map-simple-js/app/index.ts @@ -17,7 +17,7 @@ async function init(): Promise { const { Map } = await google.maps.importLibrary('maps'); // Create a new map from the div with id="map". - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { center: { lat: -34.397, lng: 150.644 }, zoom: 8, renderingType: 'VECTOR', diff --git a/dist/samples/map-simple-js/docs/index.ts b/dist/samples/map-simple-js/docs/index.ts index 3d95621c1..0afb5b576 100644 --- a/dist/samples/map-simple-js/docs/index.ts +++ b/dist/samples/map-simple-js/docs/index.ts @@ -17,7 +17,7 @@ async function init(): Promise { const { Map } = await google.maps.importLibrary('maps'); // Create a new map from the div with id="map". - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { center: { lat: -34.397, lng: 150.644 }, zoom: 8, renderingType: 'VECTOR', diff --git a/dist/samples/place-autocomplete-basic-map/app/index.ts b/dist/samples/place-autocomplete-basic-map/app/index.ts index 8fcea027c..9f67a7812 100644 --- a/dist/samples/place-autocomplete-basic-map/app/index.ts +++ b/dist/samples/place-autocomplete-basic-map/app/index.ts @@ -11,7 +11,7 @@ const placeAutocompleteElement = document.querySelector( const placeDetailsElement = document.querySelector( 'gmp-place-details-compact' )!; -const placeDetailsParent = placeDetailsElement.parentElement as HTMLElement; +const placeDetailsParent = placeDetailsElement.parentElement!; const gmpMapElement = document.querySelector('gmp-map')!; async function init(): Promise { @@ -41,7 +41,7 @@ async function init(): Promise { // Create an advanced marker to show the location of a selected place. const advancedMarkerElement: google.maps.marker.AdvancedMarkerElement = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', }); diff --git a/dist/samples/place-autocomplete-basic-map/docs/index.js b/dist/samples/place-autocomplete-basic-map/docs/index.js index ce0fd055e..36ea1f7a0 100644 --- a/dist/samples/place-autocomplete-basic-map/docs/index.js +++ b/dist/samples/place-autocomplete-basic-map/docs/index.js @@ -39,7 +39,7 @@ async function init() { // Create an advanced marker to show the location of a selected place. const advancedMarkerElement = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', }); diff --git a/dist/samples/place-autocomplete-basic-map/docs/index.ts b/dist/samples/place-autocomplete-basic-map/docs/index.ts index 8fcea027c..9f67a7812 100644 --- a/dist/samples/place-autocomplete-basic-map/docs/index.ts +++ b/dist/samples/place-autocomplete-basic-map/docs/index.ts @@ -11,7 +11,7 @@ const placeAutocompleteElement = document.querySelector( const placeDetailsElement = document.querySelector( 'gmp-place-details-compact' )!; -const placeDetailsParent = placeDetailsElement.parentElement as HTMLElement; +const placeDetailsParent = placeDetailsElement.parentElement!; const gmpMapElement = document.querySelector('gmp-map')!; async function init(): Promise { @@ -41,7 +41,7 @@ async function init(): Promise { // Create an advanced marker to show the location of a selected place. const advancedMarkerElement: google.maps.marker.AdvancedMarkerElement = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', }); diff --git a/dist/samples/place-autocomplete-basic-map/jsfiddle/demo.js b/dist/samples/place-autocomplete-basic-map/jsfiddle/demo.js index c31879278..a5941ff1b 100644 --- a/dist/samples/place-autocomplete-basic-map/jsfiddle/demo.js +++ b/dist/samples/place-autocomplete-basic-map/jsfiddle/demo.js @@ -38,7 +38,7 @@ async function init() { // Create an advanced marker to show the location of a selected place. const advancedMarkerElement = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', }); diff --git a/dist/samples/place-autocomplete-data-session/app/index.ts b/dist/samples/place-autocomplete-data-session/app/index.ts index 0e3f8b654..78dfb3a2c 100644 --- a/dist/samples/place-autocomplete-data-session/app/index.ts +++ b/dist/samples/place-autocomplete-data-session/app/index.ts @@ -43,14 +43,14 @@ async function init() { inputElement.addEventListener('input', makeAutocompleteRequest); } -async function makeAutocompleteRequest(inputEvent) { +async function makeAutocompleteRequest(inputEvent: Event) { // To avoid race conditions, store the request ID and compare after the request. const requestId = ++newestRequestId; const { AutocompleteSuggestion } = await google.maps.importLibrary('places'); - if (!inputEvent.target?.value) { + if (!(inputEvent.target as HTMLInputElement)?.value) { titleElement.textContent = ''; resultsContainerElement.replaceChildren(); return; diff --git a/dist/samples/place-autocomplete-data-session/docs/index.js b/dist/samples/place-autocomplete-data-session/docs/index.js index 52a94a9ab..332e23079 100644 --- a/dist/samples/place-autocomplete-data-session/docs/index.js +++ b/dist/samples/place-autocomplete-data-session/docs/index.js @@ -85,7 +85,7 @@ async function makeAutocompleteRequest(inputEvent) { placeButton.addEventListener('click', () => { void onPlaceSelected(placePrediction.toPlace()); }); - // eslint-disable-next-line @typescript-eslint/no-base-to-string + placeButton.textContent = placePrediction.text.toString(); placeButton.classList.add('place-button'); diff --git a/dist/samples/place-autocomplete-data-session/docs/index.ts b/dist/samples/place-autocomplete-data-session/docs/index.ts index 0e3f8b654..78dfb3a2c 100644 --- a/dist/samples/place-autocomplete-data-session/docs/index.ts +++ b/dist/samples/place-autocomplete-data-session/docs/index.ts @@ -43,14 +43,14 @@ async function init() { inputElement.addEventListener('input', makeAutocompleteRequest); } -async function makeAutocompleteRequest(inputEvent) { +async function makeAutocompleteRequest(inputEvent: Event) { // To avoid race conditions, store the request ID and compare after the request. const requestId = ++newestRequestId; const { AutocompleteSuggestion } = await google.maps.importLibrary('places'); - if (!inputEvent.target?.value) { + if (!(inputEvent.target as HTMLInputElement)?.value) { titleElement.textContent = ''; resultsContainerElement.replaceChildren(); return; diff --git a/dist/samples/place-autocomplete-data-session/jsfiddle/demo.js b/dist/samples/place-autocomplete-data-session/jsfiddle/demo.js index b1522768e..815169062 100644 --- a/dist/samples/place-autocomplete-data-session/jsfiddle/demo.js +++ b/dist/samples/place-autocomplete-data-session/jsfiddle/demo.js @@ -84,7 +84,7 @@ async function makeAutocompleteRequest(inputEvent) { placeButton.addEventListener('click', () => { void onPlaceSelected(placePrediction.toPlace()); }); - // eslint-disable-next-line @typescript-eslint/no-base-to-string + placeButton.textContent = placePrediction.text.toString(); placeButton.classList.add('place-button'); diff --git a/dist/samples/place-autocomplete-data-simple/app/index.ts b/dist/samples/place-autocomplete-data-simple/app/index.ts index 0fb30a747..c24ecba8d 100644 --- a/dist/samples/place-autocomplete-data-simple/app/index.ts +++ b/dist/samples/place-autocomplete-data-simple/app/index.ts @@ -39,14 +39,14 @@ async function init() { const { suggestions } = await AutocompleteSuggestion.fetchAutocompleteSuggestions(request); - const title = document.getElementById('title') as HTMLElement; + const title = document.getElementById('title')!; title.appendChild( document.createTextNode( 'Query predictions for "' + request.input + '":' ) ); - const resultsElement = document.getElementById('results') as HTMLElement; + const resultsElement = document.getElementById('results')!; for (const suggestion of suggestions) { const placePrediction = suggestion.placePrediction; @@ -70,7 +70,7 @@ async function init() { }); // [END maps_place_autocomplete_data_simple_fetch] - const placeInfo = document.getElementById('prediction') as HTMLElement; + const placeInfo = document.getElementById('prediction')!; placeInfo.textContent = `First predicted place: ${place.displayName}: ${place.formattedAddress}`; // [END maps_place_autocomplete_data_simple_prediction] } diff --git a/dist/samples/place-autocomplete-data-simple/docs/index.js b/dist/samples/place-autocomplete-data-simple/docs/index.js index 4ec313647..c6d529b73 100644 --- a/dist/samples/place-autocomplete-data-simple/docs/index.js +++ b/dist/samples/place-autocomplete-data-simple/docs/index.js @@ -56,7 +56,6 @@ async function init() { const listItem = document.createElement('li'); listItem.appendChild( - // eslint-disable-next-line @typescript-eslint/no-base-to-string document.createTextNode(placePrediction.text.toString()) ); resultsElement.appendChild(listItem); diff --git a/dist/samples/place-autocomplete-data-simple/docs/index.ts b/dist/samples/place-autocomplete-data-simple/docs/index.ts index 0fb30a747..c24ecba8d 100644 --- a/dist/samples/place-autocomplete-data-simple/docs/index.ts +++ b/dist/samples/place-autocomplete-data-simple/docs/index.ts @@ -39,14 +39,14 @@ async function init() { const { suggestions } = await AutocompleteSuggestion.fetchAutocompleteSuggestions(request); - const title = document.getElementById('title') as HTMLElement; + const title = document.getElementById('title')!; title.appendChild( document.createTextNode( 'Query predictions for "' + request.input + '":' ) ); - const resultsElement = document.getElementById('results') as HTMLElement; + const resultsElement = document.getElementById('results')!; for (const suggestion of suggestions) { const placePrediction = suggestion.placePrediction; @@ -70,7 +70,7 @@ async function init() { }); // [END maps_place_autocomplete_data_simple_fetch] - const placeInfo = document.getElementById('prediction') as HTMLElement; + const placeInfo = document.getElementById('prediction')!; placeInfo.textContent = `First predicted place: ${place.displayName}: ${place.formattedAddress}`; // [END maps_place_autocomplete_data_simple_prediction] } diff --git a/dist/samples/place-autocomplete-data-simple/jsfiddle/demo.js b/dist/samples/place-autocomplete-data-simple/jsfiddle/demo.js index 2f6eaa86d..3289875cc 100644 --- a/dist/samples/place-autocomplete-data-simple/jsfiddle/demo.js +++ b/dist/samples/place-autocomplete-data-simple/jsfiddle/demo.js @@ -50,7 +50,6 @@ async function init() { const listItem = document.createElement('li'); listItem.appendChild( - // eslint-disable-next-line @typescript-eslint/no-base-to-string document.createTextNode(placePrediction.text.toString()) ); resultsElement.appendChild(listItem); diff --git a/dist/samples/place-autocomplete-element/app/index.ts b/dist/samples/place-autocomplete-element/app/index.ts index 24db2c6dc..521db7441 100644 --- a/dist/samples/place-autocomplete-element/app/index.ts +++ b/dist/samples/place-autocomplete-element/app/index.ts @@ -4,15 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +// Remove these disables once the PlacesLibrary typing is fixed: + +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ + // [START maps_place_autocomplete_element] async function init(): Promise { // [START maps_place_autocomplete_element_add] // Request needed libraries. - // @ts-expect-error - currently missing. bug fix pending + // @ts-expect-error - when this gets addressed also remove the global eslint-disables above const { PlaceAutocompleteElement } = await google.maps.importLibrary('places'); // Create the input HTML element, and append it. - const placeAutocomplete = new PlaceAutocompleteElement({}); + const placeAutocomplete = new PlaceAutocompleteElement(); document.body.appendChild(placeAutocomplete); // [END maps_place_autocomplete_element_add] @@ -26,10 +32,12 @@ async function init(): Promise { document.body.appendChild(selectedPlaceInfo); // [START maps_place_autocomplete_element_listener] - // Add the gmp-placeselect listener, and display the results. + // Add the gmp-select listener, and display the results. placeAutocomplete.addEventListener( 'gmp-select', - async ({ placePrediction }) => { + async ({ + placePrediction, + }: google.maps.places.PlacePredictionSelectEvent) => { const place = placePrediction.toPlace(); await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'], diff --git a/dist/samples/place-autocomplete-element/dist/assets/index-hJHXRRjA.js b/dist/samples/place-autocomplete-element/dist/assets/index-V7Q8GNS5.js similarity index 62% rename from dist/samples/place-autocomplete-element/dist/assets/index-hJHXRRjA.js rename to dist/samples/place-autocomplete-element/dist/assets/index-V7Q8GNS5.js index a9f605336..c624b86b1 100644 --- a/dist/samples/place-autocomplete-element/dist/assets/index-hJHXRRjA.js +++ b/dist/samples/place-autocomplete-element/dist/assets/index-V7Q8GNS5.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let{PlaceAutocompleteElement:e}=await google.maps.importLibrary(`places`),t=new e({});document.body.appendChild(t);let n=document.createElement(`p`);n.textContent=``,document.body.appendChild(n);let r=document.createElement(`pre`);r.textContent=``,document.body.appendChild(r),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();await t.fetchFields({fields:[`displayName`,`formattedAddress`,`location`]}),n.textContent=`Selected Place:`,r.textContent=JSON.stringify(t.toJSON(),null,2)})}e(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();async function e(){let{PlaceAutocompleteElement:e}=await google.maps.importLibrary(`places`),t=new e;document.body.appendChild(t);let n=document.createElement(`p`);n.textContent=``,document.body.appendChild(n);let r=document.createElement(`pre`);r.textContent=``,document.body.appendChild(r),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();await t.fetchFields({fields:[`displayName`,`formattedAddress`,`location`]}),n.textContent=`Selected Place:`,r.textContent=JSON.stringify(t.toJSON(),null,2)})}e(); \ No newline at end of file diff --git a/dist/samples/place-autocomplete-element/dist/index.html b/dist/samples/place-autocomplete-element/dist/index.html index 157dd2c9f..1c40afa4c 100644 --- a/dist/samples/place-autocomplete-element/dist/index.html +++ b/dist/samples/place-autocomplete-element/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/place-autocomplete-element/docs/index.js b/dist/samples/place-autocomplete-element/docs/index.js index ccd457e7c..f0ce39401 100644 --- a/dist/samples/place-autocomplete-element/docs/index.js +++ b/dist/samples/place-autocomplete-element/docs/index.js @@ -5,6 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +// Remove these disables once the PlacesLibrary typing is fixed: + // [START maps_place_autocomplete_element] async function init() { // [START maps_place_autocomplete_element_add] @@ -13,7 +15,7 @@ async function init() { const { PlaceAutocompleteElement } = await google.maps.importLibrary('places'); // Create the input HTML element, and append it. - const placeAutocomplete = new PlaceAutocompleteElement({}); + const placeAutocomplete = new PlaceAutocompleteElement(); document.body.appendChild(placeAutocomplete); // [END maps_place_autocomplete_element_add] @@ -27,7 +29,7 @@ async function init() { document.body.appendChild(selectedPlaceInfo); // [START maps_place_autocomplete_element_listener] - // Add the gmp-placeselect listener, and display the results. + // Add the gmp-select listener, and display the results. placeAutocomplete.addEventListener( 'gmp-select', async ({ placePrediction }) => { diff --git a/dist/samples/place-autocomplete-element/docs/index.ts b/dist/samples/place-autocomplete-element/docs/index.ts index 24db2c6dc..521db7441 100644 --- a/dist/samples/place-autocomplete-element/docs/index.ts +++ b/dist/samples/place-autocomplete-element/docs/index.ts @@ -4,15 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +// Remove these disables once the PlacesLibrary typing is fixed: + +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ + // [START maps_place_autocomplete_element] async function init(): Promise { // [START maps_place_autocomplete_element_add] // Request needed libraries. - // @ts-expect-error - currently missing. bug fix pending + // @ts-expect-error - when this gets addressed also remove the global eslint-disables above const { PlaceAutocompleteElement } = await google.maps.importLibrary('places'); // Create the input HTML element, and append it. - const placeAutocomplete = new PlaceAutocompleteElement({}); + const placeAutocomplete = new PlaceAutocompleteElement(); document.body.appendChild(placeAutocomplete); // [END maps_place_autocomplete_element_add] @@ -26,10 +32,12 @@ async function init(): Promise { document.body.appendChild(selectedPlaceInfo); // [START maps_place_autocomplete_element_listener] - // Add the gmp-placeselect listener, and display the results. + // Add the gmp-select listener, and display the results. placeAutocomplete.addEventListener( 'gmp-select', - async ({ placePrediction }) => { + async ({ + placePrediction, + }: google.maps.places.PlacePredictionSelectEvent) => { const place = placePrediction.toPlace(); await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'], diff --git a/dist/samples/place-autocomplete-element/jsfiddle/demo.js b/dist/samples/place-autocomplete-element/jsfiddle/demo.js index 05a323a11..23103894b 100644 --- a/dist/samples/place-autocomplete-element/jsfiddle/demo.js +++ b/dist/samples/place-autocomplete-element/jsfiddle/demo.js @@ -5,13 +5,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +// Remove these disables once the PlacesLibrary typing is fixed: + async function init() { // Request needed libraries. const { PlaceAutocompleteElement } = await google.maps.importLibrary('places'); // Create the input HTML element, and append it. - const placeAutocomplete = new PlaceAutocompleteElement({}); + const placeAutocomplete = new PlaceAutocompleteElement(); document.body.appendChild(placeAutocomplete); // Inject HTML UI. @@ -23,7 +25,7 @@ async function init() { selectedPlaceInfo.textContent = ''; document.body.appendChild(selectedPlaceInfo); - // Add the gmp-placeselect listener, and display the results. + // Add the gmp-select listener, and display the results. placeAutocomplete.addEventListener( 'gmp-select', async ({ placePrediction }) => { diff --git a/dist/samples/place-autocomplete-map/app/index.ts b/dist/samples/place-autocomplete-map/app/index.ts index 23778a69c..00bfb17a8 100644 --- a/dist/samples/place-autocomplete-map/app/index.ts +++ b/dist/samples/place-autocomplete-map/app/index.ts @@ -34,10 +34,10 @@ async function init(): Promise { map: innerMap, }); - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // [START maps_place_autocomplete_map_listener] - // Add the gmp-placeselect listener, and display the results on the map. + // Add the gmp-select listener, and display the results on the map. placeAutocomplete.addEventListener( 'gmp-select', async ({ placePrediction }) => { @@ -71,7 +71,10 @@ async function init(): Promise { } // Helper function to create an info window. -function updateInfoWindow(content, center) { +function updateInfoWindow( + content: string | Element | Text | null | undefined, + center: google.maps.LatLng | google.maps.LatLngLiteral | null | undefined +) { infoWindow.setContent(content); infoWindow.setPosition(center); infoWindow.open({ diff --git a/dist/samples/place-autocomplete-map/dist/assets/index-BtjvinI4.js b/dist/samples/place-autocomplete-map/dist/assets/index-kMde0BlN.js similarity index 61% rename from dist/samples/place-autocomplete-map/dist/assets/index-BtjvinI4.js rename to dist/samples/place-autocomplete-map/dist/assets/index-kMde0BlN.js index 55cedb7f7..72ef30883 100644 --- a/dist/samples/place-autocomplete-map/dist/assets/index-BtjvinI4.js +++ b/dist/samples/place-autocomplete-map/dist/assets/index-kMde0BlN.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-autocomplete`),n,r,i;async function a(){let[{AdvancedMarkerElement:a},{InfoWindow:s}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`)]);n=e.innerMap,n.setOptions({mapTypeControl:!1}),n.addListener(`bounds_changed`,()=>{t.locationRestriction=n.getBounds()}),r=new a({map:n}),i=new s({}),t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();await t.fetchFields({fields:[`displayName`,`formattedAddress`,`location`]}),t.viewport?n.fitBounds(t.viewport):(n.setCenter(t.location),n.setZoom(17));let i=document.createElement(`div`),a=document.createElement(`span`);a.textContent=t.displayName??`No name`,i.appendChild(a),i.appendChild(document.createElement(`br`));let s=document.createElement(`span`);s.textContent=t.formattedAddress??`No address`,i.appendChild(s),o(i,t.location),r.position=t.location})}function o(e,t){i.setContent(e),i.setPosition(t),i.open({map:n,anchor:r,shouldFocus:!1})}a(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-autocomplete`),n,r,i;async function a(){let[{AdvancedMarkerElement:a},{InfoWindow:s}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`)]);n=e.innerMap,n.setOptions({mapTypeControl:!1}),n.addListener(`bounds_changed`,()=>{t.locationRestriction=n.getBounds()}),r=new a({map:n}),i=new s,t.addEventListener(`gmp-select`,async({placePrediction:e})=>{let t=e.toPlace();await t.fetchFields({fields:[`displayName`,`formattedAddress`,`location`]}),t.viewport?n.fitBounds(t.viewport):(n.setCenter(t.location),n.setZoom(17));let i=document.createElement(`div`),a=document.createElement(`span`);a.textContent=t.displayName??`No name`,i.appendChild(a),i.appendChild(document.createElement(`br`));let s=document.createElement(`span`);s.textContent=t.formattedAddress??`No address`,i.appendChild(s),o(i,t.location),r.position=t.location})}function o(e,t){i.setContent(e),i.setPosition(t),i.open({map:n,anchor:r,shouldFocus:!1})}a(); \ No newline at end of file diff --git a/dist/samples/place-autocomplete-map/dist/index.html b/dist/samples/place-autocomplete-map/dist/index.html index 1f847fb93..1461f563d 100644 --- a/dist/samples/place-autocomplete-map/dist/index.html +++ b/dist/samples/place-autocomplete-map/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/place-autocomplete-map/docs/index.js b/dist/samples/place-autocomplete-map/docs/index.js index ab9ff78ce..ed46f31b8 100644 --- a/dist/samples/place-autocomplete-map/docs/index.js +++ b/dist/samples/place-autocomplete-map/docs/index.js @@ -35,10 +35,10 @@ async function init() { map: innerMap, }); - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // [START maps_place_autocomplete_map_listener] - // Add the gmp-placeselect listener, and display the results on the map. + // Add the gmp-select listener, and display the results on the map. placeAutocomplete.addEventListener( 'gmp-select', async ({ placePrediction }) => { diff --git a/dist/samples/place-autocomplete-map/docs/index.ts b/dist/samples/place-autocomplete-map/docs/index.ts index 23778a69c..00bfb17a8 100644 --- a/dist/samples/place-autocomplete-map/docs/index.ts +++ b/dist/samples/place-autocomplete-map/docs/index.ts @@ -34,10 +34,10 @@ async function init(): Promise { map: innerMap, }); - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); // [START maps_place_autocomplete_map_listener] - // Add the gmp-placeselect listener, and display the results on the map. + // Add the gmp-select listener, and display the results on the map. placeAutocomplete.addEventListener( 'gmp-select', async ({ placePrediction }) => { @@ -71,7 +71,10 @@ async function init(): Promise { } // Helper function to create an info window. -function updateInfoWindow(content, center) { +function updateInfoWindow( + content: string | Element | Text | null | undefined, + center: google.maps.LatLng | google.maps.LatLngLiteral | null | undefined +) { infoWindow.setContent(content); infoWindow.setPosition(center); infoWindow.open({ diff --git a/dist/samples/place-autocomplete-map/jsfiddle/demo.js b/dist/samples/place-autocomplete-map/jsfiddle/demo.js index f73290315..d06bd82af 100644 --- a/dist/samples/place-autocomplete-map/jsfiddle/demo.js +++ b/dist/samples/place-autocomplete-map/jsfiddle/demo.js @@ -34,9 +34,9 @@ async function init() { map: innerMap, }); - infoWindow = new InfoWindow({}); + infoWindow = new InfoWindow(); - // Add the gmp-placeselect listener, and display the results on the map. + // Add the gmp-select listener, and display the results on the map. placeAutocomplete.addEventListener( 'gmp-select', async ({ placePrediction }) => { diff --git a/dist/samples/place-class/app/index.ts b/dist/samples/place-class/app/index.ts index 130a3398c..12063162c 100644 --- a/dist/samples/place-class/app/index.ts +++ b/dist/samples/place-class/app/index.ts @@ -7,7 +7,7 @@ // [START maps_place_class] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let infoWindow; +let infoWindow: google.maps.InfoWindow; async function init() { const { InfoWindow } = await google.maps.importLibrary('maps'); diff --git a/dist/samples/place-class/docs/index.ts b/dist/samples/place-class/docs/index.ts index 130a3398c..12063162c 100644 --- a/dist/samples/place-class/docs/index.ts +++ b/dist/samples/place-class/docs/index.ts @@ -7,7 +7,7 @@ // [START maps_place_class] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let infoWindow; +let infoWindow: google.maps.InfoWindow; async function init() { const { InfoWindow } = await google.maps.importLibrary('maps'); diff --git a/dist/samples/place-nearby-search/app/index.ts b/dist/samples/place-nearby-search/app/index.ts index 39b25ce16..1c1283e8c 100644 --- a/dist/samples/place-nearby-search/app/index.ts +++ b/dist/samples/place-nearby-search/app/index.ts @@ -7,9 +7,9 @@ // [START maps_place_nearby_search] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let center; -let typeSelect; -let infoWindow; +let center: google.maps.LatLngLiteral | google.maps.LatLng; +let typeSelect: HTMLSelectElement; +let infoWindow: google.maps.InfoWindow; async function init() { const [{ InfoWindow }, { event }] = await Promise.all([ @@ -48,7 +48,7 @@ async function nearbySearch() { ]); // [START maps_place_nearby_search_request] // Get bounds and radius to constrain search. - center = mapElement.center; + center = mapElement.center!; const ne = innerMap.getBounds()!.getNorthEast(); const sw = innerMap.getBounds()!.getSouthWest(); const diameter = spherical.computeDistanceBetween(ne, sw); @@ -112,7 +112,7 @@ async function nearbySearch() { marker.addListener('gmp-click', () => { innerMap.panTo(place.location!); - updateInfoWindow(place.displayName, content, marker); + updateInfoWindow(place.displayName!, content, marker); }); }); @@ -122,7 +122,11 @@ async function nearbySearch() { } } -function updateInfoWindow(title, content, anchor) { +function updateInfoWindow( + title: string | Element | null, + content: string | Element | null, + anchor: google.maps.marker.AdvancedMarkerElement +) { infoWindow.setContent(content); infoWindow.setHeaderContent(title); infoWindow.open({ diff --git a/dist/samples/place-nearby-search/docs/index.ts b/dist/samples/place-nearby-search/docs/index.ts index 39b25ce16..1c1283e8c 100644 --- a/dist/samples/place-nearby-search/docs/index.ts +++ b/dist/samples/place-nearby-search/docs/index.ts @@ -7,9 +7,9 @@ // [START maps_place_nearby_search] const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let center; -let typeSelect; -let infoWindow; +let center: google.maps.LatLngLiteral | google.maps.LatLng; +let typeSelect: HTMLSelectElement; +let infoWindow: google.maps.InfoWindow; async function init() { const [{ InfoWindow }, { event }] = await Promise.all([ @@ -48,7 +48,7 @@ async function nearbySearch() { ]); // [START maps_place_nearby_search_request] // Get bounds and radius to constrain search. - center = mapElement.center; + center = mapElement.center!; const ne = innerMap.getBounds()!.getNorthEast(); const sw = innerMap.getBounds()!.getSouthWest(); const diameter = spherical.computeDistanceBetween(ne, sw); @@ -112,7 +112,7 @@ async function nearbySearch() { marker.addListener('gmp-click', () => { innerMap.panTo(place.location!); - updateInfoWindow(place.displayName, content, marker); + updateInfoWindow(place.displayName!, content, marker); }); }); @@ -122,7 +122,11 @@ async function nearbySearch() { } } -function updateInfoWindow(title, content, anchor) { +function updateInfoWindow( + title: string | Element | null, + content: string | Element | null, + anchor: google.maps.marker.AdvancedMarkerElement +) { infoWindow.setContent(content); infoWindow.setHeaderContent(title); infoWindow.open({ diff --git a/dist/samples/place-photos/app/index.ts b/dist/samples/place-photos/app/index.ts index 0ec527b64..eb293bdf4 100644 --- a/dist/samples/place-photos/app/index.ts +++ b/dist/samples/place-photos/app/index.ts @@ -19,16 +19,14 @@ async function init() { }); // Get the various HTML elements. - const heading = document.getElementById('heading') as HTMLElement; - const summary = document.getElementById('summary') as HTMLElement; - const gallery = document.getElementById('gallery') as HTMLElement; - const expandedImageDiv = document.getElementById( - 'expanded-image' - ) as HTMLElement; + const heading = document.getElementById('heading')!; + const summary = document.getElementById('summary')!; + const gallery = document.getElementById('gallery')!; + const expandedImageDiv = document.getElementById('expanded-image')!; // Show the display name and summary for the place. - heading.textContent = place.displayName as string; - summary.textContent = place.editorialSummary as string; + heading.textContent = place.displayName!; + summary.textContent = place.editorialSummary!; // Add photos to the gallery. place.photos?.forEach((photo) => { diff --git a/dist/samples/place-photos/docs/index.ts b/dist/samples/place-photos/docs/index.ts index 0ec527b64..eb293bdf4 100644 --- a/dist/samples/place-photos/docs/index.ts +++ b/dist/samples/place-photos/docs/index.ts @@ -19,16 +19,14 @@ async function init() { }); // Get the various HTML elements. - const heading = document.getElementById('heading') as HTMLElement; - const summary = document.getElementById('summary') as HTMLElement; - const gallery = document.getElementById('gallery') as HTMLElement; - const expandedImageDiv = document.getElementById( - 'expanded-image' - ) as HTMLElement; + const heading = document.getElementById('heading')!; + const summary = document.getElementById('summary')!; + const gallery = document.getElementById('gallery')!; + const expandedImageDiv = document.getElementById('expanded-image')!; // Show the display name and summary for the place. - heading.textContent = place.displayName as string; - summary.textContent = place.editorialSummary as string; + heading.textContent = place.displayName!; + summary.textContent = place.editorialSummary!; // Add photos to the gallery. place.photos?.forEach((photo) => { diff --git a/dist/samples/place-reviews/app/index.ts b/dist/samples/place-reviews/app/index.ts index 2ec24d416..8e48cd105 100644 --- a/dist/samples/place-reviews/app/index.ts +++ b/dist/samples/place-reviews/app/index.ts @@ -6,7 +6,7 @@ // [START maps_place_reviews] let innerMap: google.maps.Map; -let infoWindow; +let infoWindow: google.maps.InfoWindow; const mapElement = document.querySelector('gmp-map')!; async function init() { diff --git a/dist/samples/place-reviews/docs/index.ts b/dist/samples/place-reviews/docs/index.ts index 2ec24d416..8e48cd105 100644 --- a/dist/samples/place-reviews/docs/index.ts +++ b/dist/samples/place-reviews/docs/index.ts @@ -6,7 +6,7 @@ // [START maps_place_reviews] let innerMap: google.maps.Map; -let infoWindow; +let infoWindow: google.maps.InfoWindow; const mapElement = document.querySelector('gmp-map')!; async function init() { diff --git a/dist/samples/place-text-search/app/index.ts b/dist/samples/place-text-search/app/index.ts index b5a1aefa7..416ca1188 100644 --- a/dist/samples/place-text-search/app/index.ts +++ b/dist/samples/place-text-search/app/index.ts @@ -5,9 +5,9 @@ */ // [START maps_place_text_search] -let map; -let markers = {}; -let infoWindow; +let map: google.maps.Map; +let markers: Record = {}; +let infoWindow: google.maps.InfoWindow; async function init() { const [{ Map, InfoWindow }, { ControlPosition }] = await Promise.all([ @@ -16,8 +16,8 @@ async function init() { ]); const center = { lat: 37.4161493, lng: -122.0812166 }; - map = new Map(document.getElementById('map') as HTMLElement, { - center: center, + map = new Map(document.getElementById('map')!, { + center, zoom: 11, mapTypeControl: false, mapId: 'DEMO_MAP_ID', @@ -27,7 +27,7 @@ async function init() { const textInputButton = document.getElementById( 'text-input-button' ) as HTMLButtonElement; - const card = document.getElementById('text-input-card') as HTMLElement; + const card = document.getElementById('text-input-card')!; map.controls[ControlPosition.TOP_LEFT].push(card); textInputButton.addEventListener('click', () => { @@ -43,18 +43,19 @@ async function init() { infoWindow = new InfoWindow(); } -async function findPlaces(query) { +async function findPlaces(query: string) { const [{ Place }, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('places'), google.maps.importLibrary('marker'), ]); + // [START maps_place_text_search_request] const request = { textQuery: query, fields: ['displayName', 'location', 'businessStatus'], includedType: '', // Restrict query to a specific type (leave blank for any). useStrictTypeFiltering: true, - locationBias: map.center, + locationBias: map.getCenter(), isOpenNow: true, language: 'en-US', maxResultCount: 8, @@ -76,7 +77,7 @@ async function findPlaces(query) { markers = {}; // Loop through and get all the results. - places.forEach((place) => { + places.forEach((place: google.maps.places.Place) => { const marker = new AdvancedMarkerElement({ map, position: place.location, @@ -85,8 +86,8 @@ async function findPlaces(query) { markers[place.id] = marker; marker.addListener('gmp-click', () => { - map.panTo(place.location); - void updateInfoWindow(place.displayName, place.id, marker); + map.panTo(place.location!); + updateInfoWindow(place.displayName!, place.id, marker); }); if (place.location != null) { @@ -101,7 +102,11 @@ async function findPlaces(query) { } // Helper function to create an info window. -function updateInfoWindow(title, content, anchor) { +function updateInfoWindow( + title: string | Element | null, + content: string | Element | null, + anchor: google.maps.marker.AdvancedMarkerElement +) { infoWindow.setContent(content); infoWindow.setHeaderContent(title); infoWindow.open({ diff --git a/dist/samples/place-text-search/dist/assets/index-BI4v2OHO.js b/dist/samples/place-text-search/dist/assets/index-D2trdyiY.js similarity index 71% rename from dist/samples/place-text-search/dist/assets/index-BI4v2OHO.js rename to dist/samples/place-text-search/dist/assets/index-D2trdyiY.js index 9b36b2b39..db59e3a50 100644 --- a/dist/samples/place-text-search/dist/assets/index-BI4v2OHO.js +++ b/dist/samples/place-text-search/dist/assets/index-D2trdyiY.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t={},n;async function r(){let[{Map:t,InfoWindow:r},{ControlPosition:a}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`core`)]);e=new t(document.getElementById(`map`),{center:{lat:37.4161493,lng:-122.0812166},zoom:11,mapTypeControl:!1,mapId:`DEMO_MAP_ID`});let o=document.getElementById(`text-input`),s=document.getElementById(`text-input-button`),c=document.getElementById(`text-input-card`);e.controls[a.TOP_LEFT].push(c),s.addEventListener(`click`,()=>{i(o.value)}),o.addEventListener(`keydown`,e=>{e.key===`Enter`&&i(o.value)}),n=new r}async function i(n){let[{Place:r},{AdvancedMarkerElement:i}]=await Promise.all([google.maps.importLibrary(`places`),google.maps.importLibrary(`marker`)]),o={textQuery:n,fields:[`displayName`,`location`,`businessStatus`],includedType:``,useStrictTypeFiltering:!0,locationBias:e.center,isOpenNow:!0,language:`en-US`,maxResultCount:8,minRating:1,region:`us`},{places:s}=await r.searchByText(o);if(s.length){let{LatLngBounds:n}=await google.maps.importLibrary(`core`),r=new n;for(let e in t)t[e].map=null;t={},s.forEach(n=>{let o=new i({map:e,position:n.location,title:n.displayName});t[n.id]=o,o.addListener(`gmp-click`,()=>{e.panTo(n.location),a(n.displayName,n.id,o)}),n.location!=null&&r.extend(n.location)}),e.fitBounds(r)}else console.log(`No results`)}function a(t,r,i){n.setContent(r),n.setHeaderContent(t),n.open({map:e,anchor:i,shouldFocus:!1})}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t={},n;async function r(){let[{Map:t,InfoWindow:r},{ControlPosition:a}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`core`)]);e=new t(document.getElementById(`map`),{center:{lat:37.4161493,lng:-122.0812166},zoom:11,mapTypeControl:!1,mapId:`DEMO_MAP_ID`});let o=document.getElementById(`text-input`),s=document.getElementById(`text-input-button`),c=document.getElementById(`text-input-card`);e.controls[a.TOP_LEFT].push(c),s.addEventListener(`click`,()=>{i(o.value)}),o.addEventListener(`keydown`,e=>{e.key===`Enter`&&i(o.value)}),n=new r}async function i(n){let[{Place:r},{AdvancedMarkerElement:i}]=await Promise.all([google.maps.importLibrary(`places`),google.maps.importLibrary(`marker`)]),o={textQuery:n,fields:[`displayName`,`location`,`businessStatus`],includedType:``,useStrictTypeFiltering:!0,locationBias:e.getCenter(),isOpenNow:!0,language:`en-US`,maxResultCount:8,minRating:1,region:`us`},{places:s}=await r.searchByText(o);if(s.length){let{LatLngBounds:n}=await google.maps.importLibrary(`core`),r=new n;for(let e in t)t[e].map=null;t={},s.forEach(n=>{let o=new i({map:e,position:n.location,title:n.displayName});t[n.id]=o,o.addListener(`gmp-click`,()=>{e.panTo(n.location),a(n.displayName,n.id,o)}),n.location!=null&&r.extend(n.location)}),e.fitBounds(r)}else console.log(`No results`)}function a(t,r,i){n.setContent(r),n.setHeaderContent(t),n.open({map:e,anchor:i,shouldFocus:!1})}r(); \ No newline at end of file diff --git a/dist/samples/place-text-search/dist/index.html b/dist/samples/place-text-search/dist/index.html index 2b56d6ca3..0bee78c54 100644 --- a/dist/samples/place-text-search/dist/index.html +++ b/dist/samples/place-text-search/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/place-text-search/docs/index.js b/dist/samples/place-text-search/docs/index.js index f26ba4d99..9ac7dcfc0 100644 --- a/dist/samples/place-text-search/docs/index.js +++ b/dist/samples/place-text-search/docs/index.js @@ -18,7 +18,7 @@ async function init() { const center = { lat: 37.4161493, lng: -122.0812166 }; map = new Map(document.getElementById('map'), { - center: center, + center, zoom: 11, mapTypeControl: false, mapId: 'DEMO_MAP_ID', @@ -47,13 +47,14 @@ async function findPlaces(query) { google.maps.importLibrary('places'), google.maps.importLibrary('marker'), ]); + // [START maps_place_text_search_request] const request = { textQuery: query, fields: ['displayName', 'location', 'businessStatus'], includedType: '', // Restrict query to a specific type (leave blank for any). useStrictTypeFiltering: true, - locationBias: map.center, + locationBias: map.getCenter(), isOpenNow: true, language: 'en-US', maxResultCount: 8, @@ -85,7 +86,7 @@ async function findPlaces(query) { marker.addListener('gmp-click', () => { map.panTo(place.location); - void updateInfoWindow(place.displayName, place.id, marker); + updateInfoWindow(place.displayName, place.id, marker); }); if (place.location != null) { diff --git a/dist/samples/place-text-search/docs/index.ts b/dist/samples/place-text-search/docs/index.ts index b5a1aefa7..416ca1188 100644 --- a/dist/samples/place-text-search/docs/index.ts +++ b/dist/samples/place-text-search/docs/index.ts @@ -5,9 +5,9 @@ */ // [START maps_place_text_search] -let map; -let markers = {}; -let infoWindow; +let map: google.maps.Map; +let markers: Record = {}; +let infoWindow: google.maps.InfoWindow; async function init() { const [{ Map, InfoWindow }, { ControlPosition }] = await Promise.all([ @@ -16,8 +16,8 @@ async function init() { ]); const center = { lat: 37.4161493, lng: -122.0812166 }; - map = new Map(document.getElementById('map') as HTMLElement, { - center: center, + map = new Map(document.getElementById('map')!, { + center, zoom: 11, mapTypeControl: false, mapId: 'DEMO_MAP_ID', @@ -27,7 +27,7 @@ async function init() { const textInputButton = document.getElementById( 'text-input-button' ) as HTMLButtonElement; - const card = document.getElementById('text-input-card') as HTMLElement; + const card = document.getElementById('text-input-card')!; map.controls[ControlPosition.TOP_LEFT].push(card); textInputButton.addEventListener('click', () => { @@ -43,18 +43,19 @@ async function init() { infoWindow = new InfoWindow(); } -async function findPlaces(query) { +async function findPlaces(query: string) { const [{ Place }, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('places'), google.maps.importLibrary('marker'), ]); + // [START maps_place_text_search_request] const request = { textQuery: query, fields: ['displayName', 'location', 'businessStatus'], includedType: '', // Restrict query to a specific type (leave blank for any). useStrictTypeFiltering: true, - locationBias: map.center, + locationBias: map.getCenter(), isOpenNow: true, language: 'en-US', maxResultCount: 8, @@ -76,7 +77,7 @@ async function findPlaces(query) { markers = {}; // Loop through and get all the results. - places.forEach((place) => { + places.forEach((place: google.maps.places.Place) => { const marker = new AdvancedMarkerElement({ map, position: place.location, @@ -85,8 +86,8 @@ async function findPlaces(query) { markers[place.id] = marker; marker.addListener('gmp-click', () => { - map.panTo(place.location); - void updateInfoWindow(place.displayName, place.id, marker); + map.panTo(place.location!); + updateInfoWindow(place.displayName!, place.id, marker); }); if (place.location != null) { @@ -101,7 +102,11 @@ async function findPlaces(query) { } // Helper function to create an info window. -function updateInfoWindow(title, content, anchor) { +function updateInfoWindow( + title: string | Element | null, + content: string | Element | null, + anchor: google.maps.marker.AdvancedMarkerElement +) { infoWindow.setContent(content); infoWindow.setHeaderContent(title); infoWindow.open({ diff --git a/dist/samples/place-text-search/jsfiddle/demo.js b/dist/samples/place-text-search/jsfiddle/demo.js index ce8d1ffee..c1315537e 100644 --- a/dist/samples/place-text-search/jsfiddle/demo.js +++ b/dist/samples/place-text-search/jsfiddle/demo.js @@ -17,7 +17,7 @@ async function init() { const center = { lat: 37.4161493, lng: -122.0812166 }; map = new Map(document.getElementById('map'), { - center: center, + center, zoom: 11, mapTypeControl: false, mapId: 'DEMO_MAP_ID', @@ -52,7 +52,7 @@ async function findPlaces(query) { fields: ['displayName', 'location', 'businessStatus'], includedType: '', // Restrict query to a specific type (leave blank for any). useStrictTypeFiltering: true, - locationBias: map.center, + locationBias: map.getCenter(), isOpenNow: true, language: 'en-US', maxResultCount: 8, @@ -83,7 +83,7 @@ async function findPlaces(query) { marker.addListener('gmp-click', () => { map.panTo(place.location); - void updateInfoWindow(place.displayName, place.id, marker); + updateInfoWindow(place.displayName, place.id, marker); }); if (place.location != null) { diff --git a/dist/samples/places-autocomplete-addressform/app/index.ts b/dist/samples/places-autocomplete-addressform/app/index.ts index 7737bacec..9ea715084 100644 --- a/dist/samples/places-autocomplete-addressform/app/index.ts +++ b/dist/samples/places-autocomplete-addressform/app/index.ts @@ -11,7 +11,7 @@ // 3. Populate the form fields with those address components. // This sample requires the Places library, Maps JavaScript API. -let placeAutocomplete; +let placeAutocomplete: google.maps.places.PlaceAutocompleteElement; let address1Field: HTMLInputElement; let address2Field: HTMLInputElement; let postalField: HTMLInputElement; @@ -39,7 +39,9 @@ async function init() { } // [START maps_places_autocomplete_addressform_fillform] -async function fillInAddress(placePrediction) { +async function fillInAddress( + placePrediction: google.maps.places.PlacePrediction +) { // The placePrediction object does not have all the details needed // for the form, so we'll call fetchFields to get the place details. const place = placePrediction.toPlace(); diff --git a/dist/samples/places-autocomplete-addressform/docs/index.ts b/dist/samples/places-autocomplete-addressform/docs/index.ts index 7737bacec..9ea715084 100644 --- a/dist/samples/places-autocomplete-addressform/docs/index.ts +++ b/dist/samples/places-autocomplete-addressform/docs/index.ts @@ -11,7 +11,7 @@ // 3. Populate the form fields with those address components. // This sample requires the Places library, Maps JavaScript API. -let placeAutocomplete; +let placeAutocomplete: google.maps.places.PlaceAutocompleteElement; let address1Field: HTMLInputElement; let address2Field: HTMLInputElement; let postalField: HTMLInputElement; @@ -39,7 +39,9 @@ async function init() { } // [START maps_places_autocomplete_addressform_fillform] -async function fillInAddress(placePrediction) { +async function fillInAddress( + placePrediction: google.maps.places.PlacePrediction +) { // The placePrediction object does not have all the details needed // for the form, so we'll call fetchFields to get the place details. const place = placePrediction.toPlace(); diff --git a/dist/samples/places-placeid-finder/app/index.ts b/dist/samples/places-placeid-finder/app/index.ts index 60c87b795..adbf29f1a 100644 --- a/dist/samples/places-placeid-finder/app/index.ts +++ b/dist/samples/places-placeid-finder/app/index.ts @@ -39,14 +39,12 @@ async function init(): Promise { }); const infoWindow = new InfoWindow(); - const infoWindowContent = document.getElementById( - 'infowindow-content' - ) as HTMLElement; + const infoWindowContent = document.getElementById('infowindow-content')!; infoWindow.setContent(infoWindowContent); const marker = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', gmpClickable: true, }); @@ -81,19 +79,12 @@ async function init(): Promise { marker.position = place.location; // marker.setVisible(true); // AdvancedMarkerElement is visible by default when map and position are set. - ( - infoWindowContent.children.namedItem( - 'place-name' - ) as HTMLElement - ).textContent = place.displayName!; - ( - infoWindowContent.children.namedItem('place-id') as HTMLElement - ).textContent = place.id; - ( - infoWindowContent.children.namedItem( - 'place-address' - ) as HTMLElement - ).textContent = place.formattedAddress!; + infoWindowContent.children.namedItem('place-name')!.textContent = + place.displayName!; + infoWindowContent.children.namedItem('place-id')!.textContent = + place.id; + infoWindowContent.children.namedItem('place-address')!.textContent = + place.formattedAddress!; infoWindow.open(map, marker); } ); diff --git a/dist/samples/places-placeid-finder/docs/index.js b/dist/samples/places-placeid-finder/docs/index.js index e46e9c1f9..abe0649c7 100644 --- a/dist/samples/places-placeid-finder/docs/index.js +++ b/dist/samples/places-placeid-finder/docs/index.js @@ -45,7 +45,7 @@ async function init() { infoWindow.setContent(infoWindowContent); const marker = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', gmpClickable: true, }); diff --git a/dist/samples/places-placeid-finder/docs/index.ts b/dist/samples/places-placeid-finder/docs/index.ts index 60c87b795..adbf29f1a 100644 --- a/dist/samples/places-placeid-finder/docs/index.ts +++ b/dist/samples/places-placeid-finder/docs/index.ts @@ -39,14 +39,12 @@ async function init(): Promise { }); const infoWindow = new InfoWindow(); - const infoWindowContent = document.getElementById( - 'infowindow-content' - ) as HTMLElement; + const infoWindowContent = document.getElementById('infowindow-content')!; infoWindow.setContent(infoWindowContent); const marker = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', gmpClickable: true, }); @@ -81,19 +79,12 @@ async function init(): Promise { marker.position = place.location; // marker.setVisible(true); // AdvancedMarkerElement is visible by default when map and position are set. - ( - infoWindowContent.children.namedItem( - 'place-name' - ) as HTMLElement - ).textContent = place.displayName!; - ( - infoWindowContent.children.namedItem('place-id') as HTMLElement - ).textContent = place.id; - ( - infoWindowContent.children.namedItem( - 'place-address' - ) as HTMLElement - ).textContent = place.formattedAddress!; + infoWindowContent.children.namedItem('place-name')!.textContent = + place.displayName!; + infoWindowContent.children.namedItem('place-id')!.textContent = + place.id; + infoWindowContent.children.namedItem('place-address')!.textContent = + place.formattedAddress!; infoWindow.open(map, marker); } ); diff --git a/dist/samples/places-placeid-finder/jsfiddle/demo.js b/dist/samples/places-placeid-finder/jsfiddle/demo.js index f872eaddd..5e16a8a50 100644 --- a/dist/samples/places-placeid-finder/jsfiddle/demo.js +++ b/dist/samples/places-placeid-finder/jsfiddle/demo.js @@ -44,7 +44,7 @@ async function init() { infoWindow.setContent(infoWindowContent); const marker = new AdvancedMarkerElement({ - map: map, + map, collisionBehavior: 'REQUIRED_AND_HIDES_OPTIONAL', gmpClickable: true, }); diff --git a/dist/samples/react-ui-kit-place-details-compact/docs/app.tsx b/dist/samples/react-ui-kit-place-details-compact/docs/app.tsx index d5dfe4856..e9fcc91c1 100644 --- a/dist/samples/react-ui-kit-place-details-compact/docs/app.tsx +++ b/dist/samples/react-ui-kit-place-details-compact/docs/app.tsx @@ -14,9 +14,9 @@ import './styles.css'; const API_KEY = 'AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8'; -type PlaceDetailsProps = { +interface PlaceDetailsProps { placeId: string; -}; +} // Renders place details using a place ID. const PlaceDetails = ({ placeId }: PlaceDetailsProps) => { diff --git a/dist/samples/react-ui-kit-place-details-latlng-compact/docs/app.tsx b/dist/samples/react-ui-kit-place-details-latlng-compact/docs/app.tsx index 0037b5a77..833aed205 100644 --- a/dist/samples/react-ui-kit-place-details-latlng-compact/docs/app.tsx +++ b/dist/samples/react-ui-kit-place-details-latlng-compact/docs/app.tsx @@ -14,10 +14,10 @@ import './styles.css'; const API_KEY = 'AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8'; -type PlaceDetailsProps = { +interface PlaceDetailsProps { lat: number; lng: number; -}; +} // Renders place details using a latitude and longitude. const PlaceDetails = ({ lat, lng }: PlaceDetailsProps) => { diff --git a/dist/samples/react-ui-kit-place-details-latlng/docs/app.tsx b/dist/samples/react-ui-kit-place-details-latlng/docs/app.tsx index 1dfd07ecc..f3e0ae2ed 100644 --- a/dist/samples/react-ui-kit-place-details-latlng/docs/app.tsx +++ b/dist/samples/react-ui-kit-place-details-latlng/docs/app.tsx @@ -14,10 +14,10 @@ import './styles.css'; const API_KEY = 'AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8'; -type PlaceDetailsProps = { +interface PlaceDetailsProps { lat: number; lng: number; -}; +} // Renders place details using a latitude and longitude. const PlaceDetails = ({ lat, lng }: PlaceDetailsProps) => { diff --git a/dist/samples/react-ui-kit-place-details/docs/app.tsx b/dist/samples/react-ui-kit-place-details/docs/app.tsx index 447f1dceb..db19de52c 100644 --- a/dist/samples/react-ui-kit-place-details/docs/app.tsx +++ b/dist/samples/react-ui-kit-place-details/docs/app.tsx @@ -14,9 +14,9 @@ import './styles.css'; const API_KEY = 'AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8'; -type PlaceDetailsProps = { +interface PlaceDetailsProps { placeId: string; -}; +} // Renders place details using a place ID. const PlaceDetails = ({ placeId }: PlaceDetailsProps) => { diff --git a/dist/samples/react-ui-kit-search-nearby/dist/assets/index-CnfpCz-k.js b/dist/samples/react-ui-kit-search-nearby/dist/assets/index-BQoeVwpy.js similarity index 98% rename from dist/samples/react-ui-kit-search-nearby/dist/assets/index-CnfpCz-k.js rename to dist/samples/react-ui-kit-search-nearby/dist/assets/index-BQoeVwpy.js index e036c8b9a..5884c4be1 100644 --- a/dist/samples/react-ui-kit-search-nearby/dist/assets/index-CnfpCz-k.js +++ b/dist/samples/react-ui-kit-search-nearby/dist/assets/index-BQoeVwpy.js @@ -10,4 +10,4 @@ Error generating stack: `+e.message+` gmp-advanced-marker[data-origin='rgm'] { pointer-events: none !important; } - `,this.renderedStyles.add(`marker-pointer-events`)}cleanup(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null,this.renderedStyles.clear())}};function dt(e,t){if(!(google==null?void 0:google.maps)?.version)return;let n=google.maps.version.split(`.`),r=parseInt(n[0],10),i=parseInt(n[1],10);return r>e||r===e&&i>=t}var ft=S.createContext(null),pt={TOP_LEFT:[`0%`,`0%`],TOP_CENTER:[`50%`,`0%`],TOP:[`50%`,`0%`],TOP_RIGHT:[`100%`,`0%`],LEFT_CENTER:[`0%`,`50%`],LEFT_TOP:[`0%`,`0%`],LEFT:[`0%`,`50%`],LEFT_BOTTOM:[`0%`,`100%`],RIGHT_TOP:[`100%`,`0%`],RIGHT:[`100%`,`50%`],RIGHT_CENTER:[`100%`,`50%`],RIGHT_BOTTOM:[`100%`,`100%`],BOTTOM_LEFT:[`0%`,`100%`],BOTTOM_CENTER:[`50%`,`100%`],BOTTOM:[`50%`,`100%`],BOTTOM_RIGHT:[`100%`,`100%`],CENTER:[`50%`,`50%`]},j=(0,S.forwardRef)((e,t)=>{let{children:n,style:r,className:i,anchorPoint:a}=e,[o,s]=gt(e),c=(0,S.useMemo)(()=>o?{marker:o}:null,[o]);return(0,S.useImperativeHandle)(t,()=>o,[o]),s?S.createElement(ft.Provider,{value:c},(0,C.createPortal)(S.createElement(ht,{anchorPoint:a,styles:r,className:i},n),s)):null});j.displayName=`AdvancedMarker`;function mt(e){return e.nodeType===Node.ELEMENT_NODE}var ht=({children:e,styles:t,className:n})=>S.createElement(`div`,{className:n,style:t},e);function gt(e){let[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(null),a=$e(),o=et(`marker`),{children:s,onClick:c,className:l,onMouseEnter:u,onMouseLeave:d,onDrag:f,onDragStart:p,onDragEnd:m,collisionBehavior:h,clickable:g,draggable:_,position:v,title:y,zIndex:b,anchorPoint:x,anchorLeft:C,anchorTop:w}=e,ee=S.Children.count(s);return(0,S.useEffect)(()=>{if(!a||!o)return;let e=new o.AdvancedMarkerElement;e.map=a,n(e);let t=null;return ee>0&&(t=document.createElement(`div`),e.content=t,i(t)),()=>{e.map=null,t?.remove(),n(null),i(null)}},[a,o,ee]),(0,S.useEffect)(()=>{!t?.content||!mt(t.content)||ee>0||(t.content.className=l??``)},[t,l,ee]),_t(t,x,C,w,ee>0),A(t,`position`,v),A(t,`title`,y??``),A(t,`zIndex`,b),A(t,`collisionBehavior`,h),(0,S.useEffect)(()=>{t&&(_===void 0?f||p||m?t.gmpDraggable=!0:t.gmpDraggable=!1:t.gmpDraggable=_)},[t,_,f,m,p]),(0,S.useEffect)(()=>{if(!t)return;let e=g===void 0?!!c||!!u||!!d:g;t.gmpClickable=e,e&&t?.content&&mt(t.content)&&(t.content.style.pointerEvents=`all`,c&&(t.content.style.cursor=`pointer`))},[t,g,c,u,d]),k(t,`click`,c),k(t,`drag`,f),k(t,`dragstart`,p),k(t,`dragend`,m),lt(t?.element,`mouseenter`,u),lt(t?.element,`mouseleave`,d),[t,r]}function _t(e,t,n,r,i){(0,S.useEffect)(()=>{if(!e||!i)return;let a=dt(3,62),o=e.content;if(!(!o||!mt(o))){if(n!==void 0||r!==void 0){a||console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`),e.anchorLeft=n,e.anchorTop=r,t!==void 0&&console.warn(`AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.`);return}if(t!==void 0){let[n,r]=t??pt.BOTTOM,i=`calc(-1 * ${n})`,s=`calc(-1 * ${r})`;a?(e.anchorLeft=i,e.anchorTop=s,o.style.transform=``):(o.style.transform=`translate(50%, 100%) translate(${i}, ${s})`,e.dataset.origin=`rgm`,ut.addAdvancedMarkerPointerEventsOverwrite())}}},[e,t,n,r,i])}function vt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onRadiusChanged:s,onCenterChanged:c,center:l,defaultCenter:u,radius:d,defaultRadius:f}=e,p=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onRadiusChanged`,`onCenterChanged`,`center`,`defaultCenter`,`radius`,`defaultRadius`]),[m,h]=(0,S.useState)(null),g=$e(),_=Ee(Object.assign(Object.assign({},p),{clickable:p.clickable??!!t,draggable:p.draggable??!!(n||r||i||c),editable:p.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!g){g===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Circle(Object.assign(Object.assign({},_),{center:l??u,radius:d??f}));return e.setMap(g),h(e),()=>{e.setMap(null),h(null)}},[g]),k(m,`click`,t),k(m,`drag`,n),k(m,`dragstart`,r),k(m,`dragend`,i),k(m,`mouseover`,a),k(m,`mouseout`,o),k(m,`radius_changed`,s?()=>{let e=m?.getRadius();e!==void 0&&s(e)}:null),k(m,`center_changed`,c?()=>{c(m?.getCenter())}:null),(0,S.useEffect)(()=>{m&&m.setOptions(_)},[m,_]),(0,S.useEffect)(()=>{!m||!l||Pe(l,m.getCenter())||m.setCenter(l)},[m,l]),(0,S.useEffect)(()=>{!m||d===void 0||d!==m.getRadius()&&m.setRadius(d)},[m,d]),m}var yt=(0,S.forwardRef)((e,t)=>{let n=vt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});yt.displayName=`Circle`;function bt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");let r=e.style;if(n==null){if(t==null)return;for(let e in t)t.hasOwnProperty(e)&&xt(r,e,t[e]);return}for(let e in n)n.hasOwnProperty(e)&&(t==null||!t.hasOwnProperty(e))&&(e.indexOf(`--`)===0?r.setProperty(e,``):e===`float`?r.cssFloat=``:r[e]=``);if(t!=null)for(let e in t){let i=t[e];t.hasOwnProperty(e)&&n[e]!==i&&xt(r,e,i)}}function xt(e,t,n){let r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n==`number`&&n!==0&&!Ct(t)?e[t]=n+`px`:t===`float`?e.cssFloat=n:e[t]=(``+n).trim()}var St=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.scale.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth`.split(`.`));function Ct(e){return St.has(e)}function wt(e){let t=e.getPaths(),n=[];for(let e=0;e{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPaths(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.paths=t),e=new google.maps.Polygon(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(wt(p))}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=[],t=p.getPaths();if(typeof t.getLength!=`function`||typeof t.getAt!=`function`)return;let n=()=>{_.current||s(wt(p))},r=t=>{e.push(google.maps.event.addListener(t,`insert_at`,n)),e.push(google.maps.event.addListener(t,`remove_at`,n)),e.push(google.maps.event.addListener(t,`set_at`,n))};for(let e=0;e{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`set_at`,e=>{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`remove_at`,n)),()=>{e.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{if(!p||!u||!Array.isArray(u))return;let e=u[0];ze(Array.isArray(e)?u:[u],p.getPaths())||(_.current=!0,p.setPaths(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=l.map(e=>g.encoding.decodePath(e));p.setPaths(e),_.current=!1},[p,l,g]),p}var Et=(0,S.forwardRef)((e,t)=>{let n=Tt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Et.displayName=`Polygon`;function Dt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onPathChanged:s,polyline:c,encodedPath:l,path:u,defaultPath:d}=e,f=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onPathChanged`,`polyline`,`encodedPath`,`path`,`defaultPath`]),[p,m]=(0,S.useState)(null),h=$e(),g=et(`geometry`),_=(0,S.useRef)(!1),v=Ee(Object.assign(Object.assign({},f),{clickable:f.clickable??!!t,draggable:f.draggable??!!(n||r||i||s),editable:f.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPath(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.path=t),e=new google.maps.Polyline(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(p.getPath().getArray())}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=p.getPath();if(!e)return;let t=()=>{_.current||s(e.getArray())},n=[google.maps.event.addListener(e,`insert_at`,t),google.maps.event.addListener(e,`remove_at`,t),google.maps.event.addListener(e,`set_at`,t)];return()=>{n.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{!p||!u||Re(u,p.getPath())||(_.current=!0,p.setPath(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=g.encoding.decodePath(l);p.setPath(e),_.current=!1},[p,l,g]),p}var Ot=(0,S.forwardRef)((e,t)=>{let n=Dt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Ot.displayName=`Polyline`;var kt={center:{lat:0,lng:0,altitude:0},range:0,heading:0,tilt:0,roll:0},At=[`center`,`range`,`heading`,`tilt`,`roll`];function jt(e,t,n){let r=e[n];if(r!=null)if(n===`center`){let e=r;t.current.center=e.toJSON?e.toJSON():e}else t.current[n]=r}function Mt(e){let t=We(),n=(0,S.useRef)(Object.assign({},kt));return(0,S.useEffect)(()=>{if(!e)return;let r=[];for(let i of At){let a=`gmp-${i}change`,o=()=>{jt(e,n,i),t()};e.addEventListener(a,o),r.push(()=>e.removeEventListener(a,o))}return()=>{for(let e of r)e()}},[e,t]),n}function Nt(e){let t=et(`maps3d`),[n,r]=(0,S.useState)(!1),[,i]=He(),[a,o]=He(),s=Mt(a);return(0,S.useEffect)(()=>{customElements.whenDefined(`gmp-map-3d`).then(()=>{r(!0)})},[]),(0,S.useEffect)(()=>{if(!a)return;let{center:t,heading:n,tilt:r,range:i,roll:o,defaultCenter:s,defaultHeading:c,defaultTilt:l,defaultRange:u,defaultRoll:d,id:f,style:p,className:m,children:h,onCenterChanged:g,onHeadingChanged:_,onTiltChanged:v,onRangeChanged:y,onRollChanged:b,onCameraChanged:x,onClick:S,onSteadyChange:C,onAnimationEnd:w,onError:ee,mode:ne,gestureHandling:re}=e,ie=te(e,`center.heading.tilt.range.roll.defaultCenter.defaultHeading.defaultTilt.defaultRange.defaultRoll.id.style.className.children.onCenterChanged.onHeadingChanged.onTiltChanged.onRangeChanged.onRollChanged.onCameraChanged.onClick.onSteadyChange.onAnimationEnd.onError.mode.gestureHandling`.split(`.`)),ae=t??s,oe=n??c,se=r??l,ce=i??u,le=o??d,ue=Object.assign({},ie);ae&&(ue.center=ae),oe!==void 0&&(ue.heading=oe),se!==void 0&&(ue.tilt=se),ce!==void 0&&(ue.range=ce),le!==void 0&&(ue.roll=le),Object.assign(a,ue)},[a]),[a,i,o,s,!!t&&n]}function Pt(e){return e?`toJSON`in e&&typeof e.toJSON==`function`?e.toJSON():e:null}function Ft(e,t,n){let r=Pt(n.center),i=r?.lat??null,a=r?.lng??null,o=r?.altitude??null,s=n.range??null,c=n.heading??null,l=n.tilt??null,u=n.roll??null;(0,S.useLayoutEffect)(()=>{if(!e)return;let n=t.current;i!==null&&a!==null&&(n.center.lat!==i||n.center.lng!==a||o!==null&&n.center.altitude!==o)&&(e.center={lat:i,lng:a,altitude:o??n.center.altitude??0}),s!==null&&n.range!==s&&(e.range=s),c!==null&&n.heading!==c&&(e.heading=c),l!==null&&n.tilt!==l&&(e.tilt=l),u!==null&&n.roll!==u&&(e.roll=u)})}var It=[`gmp-centerchange`,`gmp-headingchange`,`gmp-tiltchange`,`gmp-rangechange`,`gmp-rollchange`];function Lt(e,t){let n=e.center,r;return r=n&&`toJSON`in n&&typeof n.toJSON==`function`?n.toJSON():n||{lat:0,lng:0,altitude:0},{type:t,map3d:e,detail:{center:r,range:e.range||0,heading:e.heading||0,tilt:e.tilt||0,roll:e.roll||0}}}function Rt(e,t){let n=t;return{type:`gmp-click`,map3d:e,detail:{position:t.position||null,placeId:n.placeId}}}function zt(e,t){return{type:`gmp-steadychange`,map3d:e,detail:{isSteady:t.isSteady}}}function Bt(e,t){let{onCenterChanged:n,onHeadingChanged:r,onTiltChanged:i,onRangeChanged:a,onRollChanged:o,onCameraChanged:s,onClick:c,onSteadyChange:l,onAnimationEnd:u,onError:d}=t;Vt(e,`gmp-centerchange`,n,Lt),Vt(e,`gmp-headingchange`,r,Lt),Vt(e,`gmp-tiltchange`,i,Lt),Vt(e,`gmp-rangechange`,a,Lt),Vt(e,`gmp-rollchange`,o,Lt),(0,S.useEffect)(()=>{if(!e||!s)return;let t=()=>{s(Lt(e,`camerachange`))};for(let n of It)e.addEventListener(n,t);return()=>{for(let n of It)e.removeEventListener(n,t)}},[e,s]),(0,S.useEffect)(()=>{if(!e||!c)return;let t=t=>{c(Rt(e,t))};return e.addEventListener(`gmp-click`,t),()=>e.removeEventListener(`gmp-click`,t)},[e,c]),(0,S.useEffect)(()=>{if(!e||!l)return;let t=t=>{l(zt(e,t))};return e.addEventListener(`gmp-steadychange`,t),()=>e.removeEventListener(`gmp-steadychange`,t)},[e,l]),Vt(e,`gmp-animationend`,u,(e,t)=>({type:t,map3d:e})),Vt(e,`gmp-error`,d,(e,t)=>({type:t,map3d:e}))}function Vt(e,t,n,r){(0,S.useEffect)(()=>{if(!e||!n)return;let i=()=>{n(r(e,t))};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)},[e,t,n,r])}var Ht=new Set([`bounds`,`defaultUIHidden`,`gestureHandling`,`internalUsageAttributionIds`,`maxAltitude`,`maxHeading`,`maxTilt`,`minAltitude`,`minHeading`,`minTilt`,`mode`]);function Ut(e,t){let n=(0,S.useMemo)(()=>{let e={},n=Object.keys(t);for(let r of n){if(!Ht.has(r))continue;let n=t[r];n!==void 0&&(e[r]=n)}return e},[t]);Oe(()=>{e&&Object.assign(e,n)},[e,n])}var Wt=S.createContext(null),Gt={width:`100%`,height:`100%`,position:`relative`},Kt=(0,S.forwardRef)((e,t)=>{let{children:n,id:r,className:i,style:a}=e,o=(0,S.useContext)(fe);if(!o)throw Error(` can only be used inside an component.`);let{addMap3DInstance:s,removeMap3DInstance:c}=o,[l,u,d,f,p]=Nt(e);Ft(l,f,e),Bt(l,e),Ut(l,e),(0,S.useEffect)(()=>{if(!l)return;let e=r??`default`;return s(l,e),()=>{c(e)}},[l,r]),(0,S.useImperativeHandle)(t,()=>({map3d:l,flyCameraAround:e=>{l?.flyCameraAround(e)},flyCameraTo:e=>{l?.flyCameraTo(e)},stopCameraAnimation:()=>{l?.stopCameraAnimation()}}),[l]);let m=(0,S.useMemo)(()=>Object.assign(Object.assign({},Gt),a),[a]),h=(0,S.useMemo)(()=>({map3d:l}),[l]);return p?S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}),S.createElement(`gmp-map-3d`,{ref:d,style:{width:`100%`,height:`100%`}},l&&S.createElement(Wt.Provider,{value:h},n))):S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}))});Kt.displayName=`Map3D`;var qt=(0,S.createContext)(null),Jt=(0,S.forwardRef)(function(e,t){let{children:n,onClick:r,position:i,altitudeMode:a,collisionBehavior:o,drawsWhenOccluded:s,extruded:c,label:l,sizePreserved:u,zIndex:d,title:f}=e,p=!!r,[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)(!1),v=(0,S.useMemo)(()=>{let e=document.createElement(`div`);return e.style.display=`none`,document.body.appendChild(e),e},[]);(0,S.useEffect)(()=>()=>v.remove(),[v]);let y=(0,S.useCallback)(e=>{h(e),typeof t==`function`?t(e):t&&(t.current=e)},[t]);lt(m,`gmp-click`,r),(0,S.useLayoutEffect)(()=>{if(g||!m||!v)return;for(;m.firstChild;)m.removeChild(m.firstChild);let e=Array.from(v.childNodes);for(let t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=t,n=e.tagName.toLowerCase();if(n===`img`||n===`svg`){let t=document.createElement(`template`);t.content.appendChild(e.cloneNode(!0)),m.appendChild(t)}else m.appendChild(e.cloneNode(!0))}},[m,v,n,g]);let b=(0,S.useMemo)(()=>({marker:m,setContentHandledExternally:_}),[m]);return A(m,`position`,i),A(m,`altitudeMode`,a),A(m,`collisionBehavior`,o),A(m,`drawsWhenOccluded`,s),A(m,`extruded`,c),A(m,`label`,l),A(m,`sizePreserved`,u),A(m,`zIndex`,d),A(m,`title`,f??``),S.createElement(qt.Provider,{value:b},p?S.createElement(`gmp-marker-3d-interactive`,{ref:y}):S.createElement(`gmp-marker-3d`,{ref:y}),(0,C.createPortal)(n,v))});Jt.displayName=`Marker3D`;var Yt=(0,S.forwardRef)(function(e,t){let{children:n,headerContent:r,style:i,className:a,open:o=!0,position:s,anchor:c,anchorId:l,altitudeMode:u,lightDismissDisabled:d,autoPanDisabled:f,onClose:p}=e,[m,h]=(0,S.useState)(null),g=(0,S.useRef)(null);return(0,S.useImperativeHandle)(t,()=>m,[m]),Xt(m,o,p),A(m,`open`,o??!1),A(m,`altitudeMode`,u),A(m,`lightDismissDisabled`,d),A(m,`autoPanDisabled`,f),A(m,`positionAnchor`,c??l??s),(0,S.useLayoutEffect)(()=>{m&&(bt(m,i||null,g.current),g.current=i||null)},[m,i]),S.createElement(`gmp-popover`,{ref:h,className:a},r&&S.createElement(`div`,{slot:`header`},r),n)});Yt.displayName=`Popover`;function Xt(e,t,n){let r=(0,S.useRef)(void 0),i=(0,S.useRef)(t);(0,S.useEffect)(()=>{i.current=t},[t]),(0,S.useEffect)(()=>{if(!e||!n)return;let t=new MutationObserver(t=>{for(let a of t)if(a.type===`attributes`&&a.attributeName===`open`){let t=e.hasAttribute(`open`);r.current===!0&&!t&&i.current!==!1&&n(),r.current=t}});return t.observe(e,{attributes:!0,attributeFilter:[`open`]}),r.current=e.hasAttribute(`open`),()=>{t.disconnect()}},[e,n])}function Zt(e){let[t,n]=(0,S.useState)(null),r=$e(),{onClick:i,onDrag:a,onDragStart:o,onDragEnd:s,onMouseOver:c,onMouseOut:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`]),{position:d,draggable:f}=u;return(0,S.useEffect)(()=>{if(!r){r===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Marker(u);return e.setMap(r),n(e),()=>{e.setMap(null),n(null)}},[r]),(0,S.useEffect)(()=>{if(!t)return;let e=t,n=google.maps.event;return i&&n.addListener(e,`click`,i),a&&n.addListener(e,`drag`,a),o&&n.addListener(e,`dragstart`,o),s&&n.addListener(e,`dragend`,s),c&&n.addListener(e,`mouseover`,c),l&&n.addListener(e,`mouseout`,l),t.setDraggable(!!f),()=>{n.clearInstanceListeners(e)}},[t,f,i,a,o,s,c,l]),(0,S.useEffect)(()=>{t&&u&&t.setOptions(u)},[t,u]),(0,S.useEffect)(()=>{f||!d||!t||t.setPosition(d)},[f,d,t]),t}var Qt=(0,S.forwardRef)((e,t)=>{let n=Zt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Qt.displayName=`Marker`;function $t(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onBoundsChanged:s,bounds:c,defaultBounds:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onBoundsChanged`,`bounds`,`defaultBounds`]),[d,f]=(0,S.useState)(null),p=$e(),m=Ee(Object.assign(Object.assign({},u),{clickable:u.clickable??!!t,draggable:u.draggable??!!(n||r||i||s),editable:u.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!p){p===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Rectangle(Object.assign(Object.assign({},m),{bounds:c??l}));return e.setMap(p),f(e),()=>{e.setMap(null),f(null)}},[p]),k(d,`click`,t),k(d,`drag`,n),k(d,`dragstart`,r),k(d,`dragend`,i),k(d,`mouseover`,a),k(d,`mouseout`,o),k(d,`bounds_changed`,s?()=>{s(d?.getBounds())}:null),(0,S.useEffect)(()=>{d&&d.setOptions(m)},[d,m]),(0,S.useEffect)(()=>{!d||!c||Le(c,d.getBounds())||d.setBounds(c)},[d,c]),d}var en=(0,S.forwardRef)((e,t)=>{let n=$t(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});en.displayName=`Rectangle`;var tn=`AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8`,nn=()=>(0,b.jsx)(ye,{apiKey:tn,libraries:[`maps`,`places`,`marker`,`geometry`,`core`],children:(0,b.jsx)(rn,{})}),rn=()=>{let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(null),o=(0,S.useRef)(null);return(0,b.jsxs)(`div`,{className:`places-ui-kit`,children:[(0,b.jsx)(`div`,{className:`place-list-wrapper`,ref:o}),(0,b.jsx)(`div`,{className:`map-container`,children:(0,b.jsxs)(Xe,{defaultCenter:{lat:48.8566,lng:2.3522},defaultZoom:16,mapId:`DEMO_MAP_ID`,clickableIcons:!1,onClick:()=>a(null),children:[(0,b.jsx)(an,{placeSearchRef:o,selectedType:e,setPlaces:r,setSelectedPlace:a,selectedPlace:i}),n.map(e=>e.location&&(0,b.jsx)(j,{position:e.location,onClick:()=>{console.log(`Marker clicked:`,e),a(e)}},e.id))]})}),(0,b.jsx)(`div`,{className:`controls`,children:(0,b.jsxs)(`select`,{name:`types`,className:`type-select`,value:e,onChange:e=>t(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`Select a place type`}),(0,b.jsx)(`option`,{value:`cafe`,children:`Cafe`}),(0,b.jsx)(`option`,{value:`restaurant`,children:`Restaurant`}),(0,b.jsx)(`option`,{value:`electric_vehicle_charging_station`,children:`EV charging station`})]})})]})},an=({placeSearchRef:e,selectedType:t,setPlaces:n,setSelectedPlace:r,selectedPlace:i})=>{let a=$e(),o=et(`core`),s=et(`marker`),c=et(`geometry`),l=(0,S.useRef)(null),u=(0,S.useRef)(null),d=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(!s||!a)return;let e=document.createElement(`gmp-place-details-compact`);e.setAttribute(`orientation`,`horizontal`),d.current=e;let t=document.createElement(`gmp-place-details-place-request`);l.current=t;let n=document.createElement(`gmp-place-all-content`);e.appendChild(t),e.appendChild(n),u.current=new s.AdvancedMarkerElement({map:null,content:e,zIndex:100})},[s,a]),(0,S.useEffect)(()=>{if(!a||!o||!c||!e.current)return;if(!t){n([]),e.current.innerHTML=``;return}let i=document.createElement(`gmp-place-search`);i.setAttribute(`selectable`,``);let s=document.createElement(`gmp-place-all-content`),l=document.createElement(`gmp-place-nearby-search-request`);i.appendChild(s),i.appendChild(l),e.current.innerHTML=``,e.current.appendChild(i);let u=a.getBounds(),d=a.getCenter();if(!u||!d)return;let f=u.getNorthEast(),p=u.getSouthWest(),m=c.spherical.computeDistanceBetween(f,p),h=Math.min(m/2,5e4);l.maxResultCount=10,l.locationRestriction={center:d,radius:h},l.includedTypes=[t];let g=()=>{let e=i.places||[];if(n(e),e.length>0){let t=new o.LatLngBounds;e.forEach(e=>e.location&&t.extend(e.location)),t.isEmpty()||a.fitBounds(t)}},_=e=>r(e.place);return i.addEventListener(`gmp-load`,g),i.addEventListener(`gmp-select`,_),()=>{i.removeEventListener(`gmp-load`,g),i.removeEventListener(`gmp-select`,_)}},[a,o,c,t,e,n,r]),(0,S.useEffect)(()=>{!a||!u.current||!l.current||!d.current||(i&&i.location?(l.current.place=i,d.current&&(d.current.style.display=`block`),u.current.position=i.location,u.current.map=a,i.viewport&&(a.fitBounds(i.viewport,{top:0,left:400}),d.current.addEventListener(`gmp-load`,()=>{i.viewport&&a.fitBounds(i.viewport,{top:0,right:450})},{once:!0}))):(u.current.map=null,d.current&&(d.current.style.display=`none`)))},[i,a]),null};(0,x.createRoot)(document.getElementById(`app`)).render((0,b.jsx)(S.StrictMode,{children:(0,b.jsx)(nn,{})})); \ No newline at end of file + `,this.renderedStyles.add(`marker-pointer-events`)}cleanup(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null,this.renderedStyles.clear())}};function dt(e,t){if(!(google==null?void 0:google.maps)?.version)return;let n=google.maps.version.split(`.`),r=parseInt(n[0],10),i=parseInt(n[1],10);return r>e||r===e&&i>=t}var ft=S.createContext(null),pt={TOP_LEFT:[`0%`,`0%`],TOP_CENTER:[`50%`,`0%`],TOP:[`50%`,`0%`],TOP_RIGHT:[`100%`,`0%`],LEFT_CENTER:[`0%`,`50%`],LEFT_TOP:[`0%`,`0%`],LEFT:[`0%`,`50%`],LEFT_BOTTOM:[`0%`,`100%`],RIGHT_TOP:[`100%`,`0%`],RIGHT:[`100%`,`50%`],RIGHT_CENTER:[`100%`,`50%`],RIGHT_BOTTOM:[`100%`,`100%`],BOTTOM_LEFT:[`0%`,`100%`],BOTTOM_CENTER:[`50%`,`100%`],BOTTOM:[`50%`,`100%`],BOTTOM_RIGHT:[`100%`,`100%`],CENTER:[`50%`,`50%`]},j=(0,S.forwardRef)((e,t)=>{let{children:n,style:r,className:i,anchorPoint:a}=e,[o,s]=gt(e),c=(0,S.useMemo)(()=>o?{marker:o}:null,[o]);return(0,S.useImperativeHandle)(t,()=>o,[o]),s?S.createElement(ft.Provider,{value:c},(0,C.createPortal)(S.createElement(ht,{anchorPoint:a,styles:r,className:i},n),s)):null});j.displayName=`AdvancedMarker`;function mt(e){return e.nodeType===Node.ELEMENT_NODE}var ht=({children:e,styles:t,className:n})=>S.createElement(`div`,{className:n,style:t},e);function gt(e){let[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(null),a=$e(),o=et(`marker`),{children:s,onClick:c,className:l,onMouseEnter:u,onMouseLeave:d,onDrag:f,onDragStart:p,onDragEnd:m,collisionBehavior:h,clickable:g,draggable:_,position:v,title:y,zIndex:b,anchorPoint:x,anchorLeft:C,anchorTop:w}=e,ee=S.Children.count(s);return(0,S.useEffect)(()=>{if(!a||!o)return;let e=new o.AdvancedMarkerElement;e.map=a,n(e);let t=null;return ee>0&&(t=document.createElement(`div`),e.content=t,i(t)),()=>{e.map=null,t?.remove(),n(null),i(null)}},[a,o,ee]),(0,S.useEffect)(()=>{!t?.content||!mt(t.content)||ee>0||(t.content.className=l??``)},[t,l,ee]),_t(t,x,C,w,ee>0),A(t,`position`,v),A(t,`title`,y??``),A(t,`zIndex`,b),A(t,`collisionBehavior`,h),(0,S.useEffect)(()=>{t&&(_===void 0?f||p||m?t.gmpDraggable=!0:t.gmpDraggable=!1:t.gmpDraggable=_)},[t,_,f,m,p]),(0,S.useEffect)(()=>{if(!t)return;let e=g===void 0?!!c||!!u||!!d:g;t.gmpClickable=e,e&&t?.content&&mt(t.content)&&(t.content.style.pointerEvents=`all`,c&&(t.content.style.cursor=`pointer`))},[t,g,c,u,d]),k(t,`click`,c),k(t,`drag`,f),k(t,`dragstart`,p),k(t,`dragend`,m),lt(t?.element,`mouseenter`,u),lt(t?.element,`mouseleave`,d),[t,r]}function _t(e,t,n,r,i){(0,S.useEffect)(()=>{if(!e||!i)return;let a=dt(3,62),o=e.content;if(!(!o||!mt(o))){if(n!==void 0||r!==void 0){a||console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`),e.anchorLeft=n,e.anchorTop=r,t!==void 0&&console.warn(`AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.`);return}if(t!==void 0){let[n,r]=t??pt.BOTTOM,i=`calc(-1 * ${n})`,s=`calc(-1 * ${r})`;a?(e.anchorLeft=i,e.anchorTop=s,o.style.transform=``):(o.style.transform=`translate(50%, 100%) translate(${i}, ${s})`,e.dataset.origin=`rgm`,ut.addAdvancedMarkerPointerEventsOverwrite())}}},[e,t,n,r,i])}function vt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onRadiusChanged:s,onCenterChanged:c,center:l,defaultCenter:u,radius:d,defaultRadius:f}=e,p=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onRadiusChanged`,`onCenterChanged`,`center`,`defaultCenter`,`radius`,`defaultRadius`]),[m,h]=(0,S.useState)(null),g=$e(),_=Ee(Object.assign(Object.assign({},p),{clickable:p.clickable??!!t,draggable:p.draggable??!!(n||r||i||c),editable:p.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!g){g===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Circle(Object.assign(Object.assign({},_),{center:l??u,radius:d??f}));return e.setMap(g),h(e),()=>{e.setMap(null),h(null)}},[g]),k(m,`click`,t),k(m,`drag`,n),k(m,`dragstart`,r),k(m,`dragend`,i),k(m,`mouseover`,a),k(m,`mouseout`,o),k(m,`radius_changed`,s?()=>{let e=m?.getRadius();e!==void 0&&s(e)}:null),k(m,`center_changed`,c?()=>{c(m?.getCenter())}:null),(0,S.useEffect)(()=>{m&&m.setOptions(_)},[m,_]),(0,S.useEffect)(()=>{!m||!l||Pe(l,m.getCenter())||m.setCenter(l)},[m,l]),(0,S.useEffect)(()=>{!m||d===void 0||d!==m.getRadius()&&m.setRadius(d)},[m,d]),m}var yt=(0,S.forwardRef)((e,t)=>{let n=vt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});yt.displayName=`Circle`;function bt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");let r=e.style;if(n==null){if(t==null)return;for(let e in t)t.hasOwnProperty(e)&&xt(r,e,t[e]);return}for(let e in n)n.hasOwnProperty(e)&&(t==null||!t.hasOwnProperty(e))&&(e.indexOf(`--`)===0?r.setProperty(e,``):e===`float`?r.cssFloat=``:r[e]=``);if(t!=null)for(let e in t){let i=t[e];t.hasOwnProperty(e)&&n[e]!==i&&xt(r,e,i)}}function xt(e,t,n){let r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n==`number`&&n!==0&&!Ct(t)?e[t]=n+`px`:t===`float`?e.cssFloat=n:e[t]=(``+n).trim()}var St=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.scale.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth`.split(`.`));function Ct(e){return St.has(e)}function wt(e){let t=e.getPaths(),n=[];for(let e=0;e{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPaths(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.paths=t),e=new google.maps.Polygon(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(wt(p))}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=[],t=p.getPaths();if(typeof t.getLength!=`function`||typeof t.getAt!=`function`)return;let n=()=>{_.current||s(wt(p))},r=t=>{e.push(google.maps.event.addListener(t,`insert_at`,n)),e.push(google.maps.event.addListener(t,`remove_at`,n)),e.push(google.maps.event.addListener(t,`set_at`,n))};for(let e=0;e{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`set_at`,e=>{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`remove_at`,n)),()=>{e.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{if(!p||!u||!Array.isArray(u))return;let e=u[0];ze(Array.isArray(e)?u:[u],p.getPaths())||(_.current=!0,p.setPaths(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=l.map(e=>g.encoding.decodePath(e));p.setPaths(e),_.current=!1},[p,l,g]),p}var Et=(0,S.forwardRef)((e,t)=>{let n=Tt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Et.displayName=`Polygon`;function Dt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onPathChanged:s,polyline:c,encodedPath:l,path:u,defaultPath:d}=e,f=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onPathChanged`,`polyline`,`encodedPath`,`path`,`defaultPath`]),[p,m]=(0,S.useState)(null),h=$e(),g=et(`geometry`),_=(0,S.useRef)(!1),v=Ee(Object.assign(Object.assign({},f),{clickable:f.clickable??!!t,draggable:f.draggable??!!(n||r||i||s),editable:f.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPath(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.path=t),e=new google.maps.Polyline(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(p.getPath().getArray())}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=p.getPath();if(!e)return;let t=()=>{_.current||s(e.getArray())},n=[google.maps.event.addListener(e,`insert_at`,t),google.maps.event.addListener(e,`remove_at`,t),google.maps.event.addListener(e,`set_at`,t)];return()=>{n.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{!p||!u||Re(u,p.getPath())||(_.current=!0,p.setPath(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=g.encoding.decodePath(l);p.setPath(e),_.current=!1},[p,l,g]),p}var Ot=(0,S.forwardRef)((e,t)=>{let n=Dt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Ot.displayName=`Polyline`;var kt={center:{lat:0,lng:0,altitude:0},range:0,heading:0,tilt:0,roll:0},At=[`center`,`range`,`heading`,`tilt`,`roll`];function jt(e,t,n){let r=e[n];if(r!=null)if(n===`center`){let e=r;t.current.center=e.toJSON?e.toJSON():e}else t.current[n]=r}function Mt(e){let t=We(),n=(0,S.useRef)(Object.assign({},kt));return(0,S.useEffect)(()=>{if(!e)return;let r=[];for(let i of At){let a=`gmp-${i}change`,o=()=>{jt(e,n,i),t()};e.addEventListener(a,o),r.push(()=>e.removeEventListener(a,o))}return()=>{for(let e of r)e()}},[e,t]),n}function Nt(e){let t=et(`maps3d`),[n,r]=(0,S.useState)(!1),[,i]=He(),[a,o]=He(),s=Mt(a);return(0,S.useEffect)(()=>{customElements.whenDefined(`gmp-map-3d`).then(()=>{r(!0)})},[]),(0,S.useEffect)(()=>{if(!a)return;let{center:t,heading:n,tilt:r,range:i,roll:o,defaultCenter:s,defaultHeading:c,defaultTilt:l,defaultRange:u,defaultRoll:d,id:f,style:p,className:m,children:h,onCenterChanged:g,onHeadingChanged:_,onTiltChanged:v,onRangeChanged:y,onRollChanged:b,onCameraChanged:x,onClick:S,onSteadyChange:C,onAnimationEnd:w,onError:ee,mode:ne,gestureHandling:re}=e,ie=te(e,`center.heading.tilt.range.roll.defaultCenter.defaultHeading.defaultTilt.defaultRange.defaultRoll.id.style.className.children.onCenterChanged.onHeadingChanged.onTiltChanged.onRangeChanged.onRollChanged.onCameraChanged.onClick.onSteadyChange.onAnimationEnd.onError.mode.gestureHandling`.split(`.`)),ae=t??s,oe=n??c,se=r??l,ce=i??u,le=o??d,ue=Object.assign({},ie);ae&&(ue.center=ae),oe!==void 0&&(ue.heading=oe),se!==void 0&&(ue.tilt=se),ce!==void 0&&(ue.range=ce),le!==void 0&&(ue.roll=le),Object.assign(a,ue)},[a]),[a,i,o,s,!!t&&n]}function Pt(e){return e?`toJSON`in e&&typeof e.toJSON==`function`?e.toJSON():e:null}function Ft(e,t,n){let r=Pt(n.center),i=r?.lat??null,a=r?.lng??null,o=r?.altitude??null,s=n.range??null,c=n.heading??null,l=n.tilt??null,u=n.roll??null;(0,S.useLayoutEffect)(()=>{if(!e)return;let n=t.current;i!==null&&a!==null&&(n.center.lat!==i||n.center.lng!==a||o!==null&&n.center.altitude!==o)&&(e.center={lat:i,lng:a,altitude:o??n.center.altitude??0}),s!==null&&n.range!==s&&(e.range=s),c!==null&&n.heading!==c&&(e.heading=c),l!==null&&n.tilt!==l&&(e.tilt=l),u!==null&&n.roll!==u&&(e.roll=u)})}var It=[`gmp-centerchange`,`gmp-headingchange`,`gmp-tiltchange`,`gmp-rangechange`,`gmp-rollchange`];function Lt(e,t){let n=e.center,r;return r=n&&`toJSON`in n&&typeof n.toJSON==`function`?n.toJSON():n||{lat:0,lng:0,altitude:0},{type:t,map3d:e,detail:{center:r,range:e.range||0,heading:e.heading||0,tilt:e.tilt||0,roll:e.roll||0}}}function Rt(e,t){let n=t;return{type:`gmp-click`,map3d:e,detail:{position:t.position||null,placeId:n.placeId}}}function zt(e,t){return{type:`gmp-steadychange`,map3d:e,detail:{isSteady:t.isSteady}}}function Bt(e,t){let{onCenterChanged:n,onHeadingChanged:r,onTiltChanged:i,onRangeChanged:a,onRollChanged:o,onCameraChanged:s,onClick:c,onSteadyChange:l,onAnimationEnd:u,onError:d}=t;Vt(e,`gmp-centerchange`,n,Lt),Vt(e,`gmp-headingchange`,r,Lt),Vt(e,`gmp-tiltchange`,i,Lt),Vt(e,`gmp-rangechange`,a,Lt),Vt(e,`gmp-rollchange`,o,Lt),(0,S.useEffect)(()=>{if(!e||!s)return;let t=()=>{s(Lt(e,`camerachange`))};for(let n of It)e.addEventListener(n,t);return()=>{for(let n of It)e.removeEventListener(n,t)}},[e,s]),(0,S.useEffect)(()=>{if(!e||!c)return;let t=t=>{c(Rt(e,t))};return e.addEventListener(`gmp-click`,t),()=>e.removeEventListener(`gmp-click`,t)},[e,c]),(0,S.useEffect)(()=>{if(!e||!l)return;let t=t=>{l(zt(e,t))};return e.addEventListener(`gmp-steadychange`,t),()=>e.removeEventListener(`gmp-steadychange`,t)},[e,l]),Vt(e,`gmp-animationend`,u,(e,t)=>({type:t,map3d:e})),Vt(e,`gmp-error`,d,(e,t)=>({type:t,map3d:e}))}function Vt(e,t,n,r){(0,S.useEffect)(()=>{if(!e||!n)return;let i=()=>{n(r(e,t))};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)},[e,t,n,r])}var Ht=new Set([`bounds`,`defaultUIHidden`,`gestureHandling`,`internalUsageAttributionIds`,`maxAltitude`,`maxHeading`,`maxTilt`,`minAltitude`,`minHeading`,`minTilt`,`mode`]);function Ut(e,t){let n=(0,S.useMemo)(()=>{let e={},n=Object.keys(t);for(let r of n){if(!Ht.has(r))continue;let n=t[r];n!==void 0&&(e[r]=n)}return e},[t]);Oe(()=>{e&&Object.assign(e,n)},[e,n])}var Wt=S.createContext(null),Gt={width:`100%`,height:`100%`,position:`relative`},Kt=(0,S.forwardRef)((e,t)=>{let{children:n,id:r,className:i,style:a}=e,o=(0,S.useContext)(fe);if(!o)throw Error(` can only be used inside an component.`);let{addMap3DInstance:s,removeMap3DInstance:c}=o,[l,u,d,f,p]=Nt(e);Ft(l,f,e),Bt(l,e),Ut(l,e),(0,S.useEffect)(()=>{if(!l)return;let e=r??`default`;return s(l,e),()=>{c(e)}},[l,r]),(0,S.useImperativeHandle)(t,()=>({map3d:l,flyCameraAround:e=>{l?.flyCameraAround(e)},flyCameraTo:e=>{l?.flyCameraTo(e)},stopCameraAnimation:()=>{l?.stopCameraAnimation()}}),[l]);let m=(0,S.useMemo)(()=>Object.assign(Object.assign({},Gt),a),[a]),h=(0,S.useMemo)(()=>({map3d:l}),[l]);return p?S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}),S.createElement(`gmp-map-3d`,{ref:d,style:{width:`100%`,height:`100%`}},l&&S.createElement(Wt.Provider,{value:h},n))):S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}))});Kt.displayName=`Map3D`;var qt=(0,S.createContext)(null),Jt=(0,S.forwardRef)(function(e,t){let{children:n,onClick:r,position:i,altitudeMode:a,collisionBehavior:o,drawsWhenOccluded:s,extruded:c,label:l,sizePreserved:u,zIndex:d,title:f}=e,p=!!r,[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)(!1),v=(0,S.useMemo)(()=>{let e=document.createElement(`div`);return e.style.display=`none`,document.body.appendChild(e),e},[]);(0,S.useEffect)(()=>()=>v.remove(),[v]);let y=(0,S.useCallback)(e=>{h(e),typeof t==`function`?t(e):t&&(t.current=e)},[t]);lt(m,`gmp-click`,r),(0,S.useLayoutEffect)(()=>{if(g||!m||!v)return;for(;m.firstChild;)m.removeChild(m.firstChild);let e=Array.from(v.childNodes);for(let t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=t,n=e.tagName.toLowerCase();if(n===`img`||n===`svg`){let t=document.createElement(`template`);t.content.appendChild(e.cloneNode(!0)),m.appendChild(t)}else m.appendChild(e.cloneNode(!0))}},[m,v,n,g]);let b=(0,S.useMemo)(()=>({marker:m,setContentHandledExternally:_}),[m]);return A(m,`position`,i),A(m,`altitudeMode`,a),A(m,`collisionBehavior`,o),A(m,`drawsWhenOccluded`,s),A(m,`extruded`,c),A(m,`label`,l),A(m,`sizePreserved`,u),A(m,`zIndex`,d),A(m,`title`,f??``),S.createElement(qt.Provider,{value:b},p?S.createElement(`gmp-marker-3d-interactive`,{ref:y}):S.createElement(`gmp-marker-3d`,{ref:y}),(0,C.createPortal)(n,v))});Jt.displayName=`Marker3D`;var Yt=(0,S.forwardRef)(function(e,t){let{children:n,headerContent:r,style:i,className:a,open:o=!0,position:s,anchor:c,anchorId:l,altitudeMode:u,lightDismissDisabled:d,autoPanDisabled:f,onClose:p}=e,[m,h]=(0,S.useState)(null),g=(0,S.useRef)(null);return(0,S.useImperativeHandle)(t,()=>m,[m]),Xt(m,o,p),A(m,`open`,o??!1),A(m,`altitudeMode`,u),A(m,`lightDismissDisabled`,d),A(m,`autoPanDisabled`,f),A(m,`positionAnchor`,c??l??s),(0,S.useLayoutEffect)(()=>{m&&(bt(m,i||null,g.current),g.current=i||null)},[m,i]),S.createElement(`gmp-popover`,{ref:h,className:a},r&&S.createElement(`div`,{slot:`header`},r),n)});Yt.displayName=`Popover`;function Xt(e,t,n){let r=(0,S.useRef)(void 0),i=(0,S.useRef)(t);(0,S.useEffect)(()=>{i.current=t},[t]),(0,S.useEffect)(()=>{if(!e||!n)return;let t=new MutationObserver(t=>{for(let a of t)if(a.type===`attributes`&&a.attributeName===`open`){let t=e.hasAttribute(`open`);r.current===!0&&!t&&i.current!==!1&&n(),r.current=t}});return t.observe(e,{attributes:!0,attributeFilter:[`open`]}),r.current=e.hasAttribute(`open`),()=>{t.disconnect()}},[e,n])}function Zt(e){let[t,n]=(0,S.useState)(null),r=$e(),{onClick:i,onDrag:a,onDragStart:o,onDragEnd:s,onMouseOver:c,onMouseOut:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`]),{position:d,draggable:f}=u;return(0,S.useEffect)(()=>{if(!r){r===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Marker(u);return e.setMap(r),n(e),()=>{e.setMap(null),n(null)}},[r]),(0,S.useEffect)(()=>{if(!t)return;let e=t,n=google.maps.event;return i&&n.addListener(e,`click`,i),a&&n.addListener(e,`drag`,a),o&&n.addListener(e,`dragstart`,o),s&&n.addListener(e,`dragend`,s),c&&n.addListener(e,`mouseover`,c),l&&n.addListener(e,`mouseout`,l),t.setDraggable(!!f),()=>{n.clearInstanceListeners(e)}},[t,f,i,a,o,s,c,l]),(0,S.useEffect)(()=>{t&&u&&t.setOptions(u)},[t,u]),(0,S.useEffect)(()=>{f||!d||!t||t.setPosition(d)},[f,d,t]),t}var Qt=(0,S.forwardRef)((e,t)=>{let n=Zt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Qt.displayName=`Marker`;function $t(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onBoundsChanged:s,bounds:c,defaultBounds:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onBoundsChanged`,`bounds`,`defaultBounds`]),[d,f]=(0,S.useState)(null),p=$e(),m=Ee(Object.assign(Object.assign({},u),{clickable:u.clickable??!!t,draggable:u.draggable??!!(n||r||i||s),editable:u.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!p){p===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Rectangle(Object.assign(Object.assign({},m),{bounds:c??l}));return e.setMap(p),f(e),()=>{e.setMap(null),f(null)}},[p]),k(d,`click`,t),k(d,`drag`,n),k(d,`dragstart`,r),k(d,`dragend`,i),k(d,`mouseover`,a),k(d,`mouseout`,o),k(d,`bounds_changed`,s?()=>{s(d?.getBounds())}:null),(0,S.useEffect)(()=>{d&&d.setOptions(m)},[d,m]),(0,S.useEffect)(()=>{!d||!c||Le(c,d.getBounds())||d.setBounds(c)},[d,c]),d}var en=(0,S.forwardRef)((e,t)=>{let n=$t(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});en.displayName=`Rectangle`;var tn=`AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8`,nn=()=>(0,b.jsx)(ye,{apiKey:tn,libraries:[`maps`,`places`,`marker`,`geometry`,`core`],children:(0,b.jsx)(rn,{})}),rn=()=>{let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(null),o=(0,S.useRef)(null);return(0,b.jsxs)(`div`,{className:`places-ui-kit`,children:[(0,b.jsx)(`div`,{className:`place-list-wrapper`,ref:o}),(0,b.jsx)(`div`,{className:`map-container`,children:(0,b.jsxs)(Xe,{defaultCenter:{lat:48.8566,lng:2.3522},defaultZoom:16,mapId:`DEMO_MAP_ID`,clickableIcons:!1,onClick:()=>{a(null)},children:[(0,b.jsx)(an,{placeSearchRef:o,selectedType:e,setPlaces:r,setSelectedPlace:a,selectedPlace:i}),n.map(e=>e.location&&(0,b.jsx)(j,{position:e.location,onClick:()=>{console.log(`Marker clicked:`,e),a(e)}},e.id))]})}),(0,b.jsx)(`div`,{className:`controls`,children:(0,b.jsxs)(`select`,{name:`types`,className:`type-select`,value:e,onChange:e=>{t(e.target.value)},children:[(0,b.jsx)(`option`,{value:``,children:`Select a place type`}),(0,b.jsx)(`option`,{value:`cafe`,children:`Cafe`}),(0,b.jsx)(`option`,{value:`restaurant`,children:`Restaurant`}),(0,b.jsx)(`option`,{value:`electric_vehicle_charging_station`,children:`EV charging station`})]})})]})},an=({placeSearchRef:e,selectedType:t,setPlaces:n,setSelectedPlace:r,selectedPlace:i})=>{let a=$e(),o=et(`core`),s=et(`marker`),c=et(`geometry`),l=(0,S.useRef)(null),u=(0,S.useRef)(null),d=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(!s||!a)return;let e=document.createElement(`gmp-place-details-compact`);e.setAttribute(`orientation`,`horizontal`),d.current=e;let t=document.createElement(`gmp-place-details-place-request`);l.current=t;let n=document.createElement(`gmp-place-all-content`);e.appendChild(t),e.appendChild(n),u.current=new s.AdvancedMarkerElement({map:null,content:e,zIndex:100})},[s,a]),(0,S.useEffect)(()=>{if(!a||!o||!c||!e.current)return;if(!t){n([]),e.current.innerHTML=``;return}let i=document.createElement(`gmp-place-search`);i.setAttribute(`selectable`,``);let s=document.createElement(`gmp-place-all-content`),l=document.createElement(`gmp-place-nearby-search-request`);i.appendChild(s),i.appendChild(l),e.current.innerHTML=``,e.current.appendChild(i);let u=a.getBounds(),d=a.getCenter();if(!u||!d)return;let f=u.getNorthEast(),p=u.getSouthWest(),m=c.spherical.computeDistanceBetween(f,p),h=Math.min(m/2,5e4);l.maxResultCount=10,l.locationRestriction={center:d,radius:h},l.includedTypes=[t];let g=()=>{let e=i.places||[];if(n(e),e.length>0){let t=new o.LatLngBounds;e.forEach(e=>e.location&&t.extend(e.location)),t.isEmpty()||a.fitBounds(t)}},_=e=>{r(e.place)};return i.addEventListener(`gmp-load`,g),i.addEventListener(`gmp-select`,_),()=>{i.removeEventListener(`gmp-load`,g),i.removeEventListener(`gmp-select`,_)}},[a,o,c,t,e,n,r]),(0,S.useEffect)(()=>{!a||!u.current||!l.current||!d.current||(i?.location?(l.current.place=i,d.current&&(d.current.style.display=`block`),u.current.position=i.location,u.current.map=a,i.viewport&&(a.fitBounds(i.viewport,{top:0,left:400}),d.current.addEventListener(`gmp-load`,()=>{i.viewport&&a.fitBounds(i.viewport,{top:0,right:450})},{once:!0}))):(u.current.map=null,d.current&&(d.current.style.display=`none`)))},[i,a]),null};(0,x.createRoot)(document.getElementById(`app`)).render((0,b.jsx)(S.StrictMode,{children:(0,b.jsx)(nn,{})})); \ No newline at end of file diff --git a/dist/samples/react-ui-kit-search-nearby/dist/index.html b/dist/samples/react-ui-kit-search-nearby/dist/index.html index 42fc7b2b3..4e98dbd7a 100644 --- a/dist/samples/react-ui-kit-search-nearby/dist/index.html +++ b/dist/samples/react-ui-kit-search-nearby/dist/index.html @@ -7,7 +7,7 @@ content="width=device-width, initial-scale=1.0, user-scalable=no" /> React - Places UI Kit Search Nearby - + diff --git a/dist/samples/react-ui-kit-search-nearby/docs/app.tsx b/dist/samples/react-ui-kit-search-nearby/docs/app.tsx index aecdd60ff..1fadcbc91 100644 --- a/dist/samples/react-ui-kit-search-nearby/docs/app.tsx +++ b/dist/samples/react-ui-kit-search-nearby/docs/app.tsx @@ -3,6 +3,13 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ + { /* [START maps_react_places_ui_kit_search_nearby] */ } @@ -30,9 +37,7 @@ const App = () => ( const PlacesSearchLayout = () => { const [selectedType, setSelectedType] = useState(''); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const [places, setPlaces] = useState([]); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const [selectedPlace, setSelectedPlace] = useState(null); const placeSearchRef = useRef(null); @@ -46,7 +51,9 @@ const PlacesSearchLayout = () => { defaultZoom={16} mapId="DEMO_MAP_ID" clickableIcons={false} - onClick={() => setSelectedPlace(null)}> + onClick={() => { + setSelectedPlace(null); + }}> { name="types" className="type-select" value={selectedType} - onChange={(e) => setSelectedType(e.target.value)}> + onChange={(e) => { + setSelectedType(e.target.value); + }}> @@ -90,11 +99,8 @@ const PlacesSearchLayout = () => { interface PlaceSearchControllerProps { placeSearchRef: RefObject; selectedType: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any setPlaces: (places: any[]) => void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any setSelectedPlace: (place: any) => void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any selectedPlace: any; } @@ -110,7 +116,6 @@ const PlaceSearchController = ({ const markerLib = useMapsLibrary('marker'); const geometryLib = useMapsLibrary('geometry'); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const placeRequestRef = useRef(null); const popupMarkerRef = useRef(null); @@ -172,29 +177,25 @@ const PlaceSearchController = ({ const diameter = geometryLib.spherical.computeDistanceBetween(ne, sw); const radius = Math.min(diameter / 2, 50000); - // eslint-disable-next-line @typescript-eslint/no-explicit-any (nearbyRequest as any).maxResultCount = 10; - // eslint-disable-next-line @typescript-eslint/no-explicit-any (nearbyRequest as any).locationRestriction = { center, radius }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any (nearbyRequest as any).includedTypes = [selectedType]; const handleLoad = () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const newPlaces = (placeSearch as any).places || []; setPlaces(newPlaces); if (newPlaces.length > 0) { const newBounds = new coreLib.LatLngBounds(); newPlaces.forEach( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (p: any) => p.location && newBounds.extend(p.location) ); if (!newBounds.isEmpty()) map.fitBounds(newBounds); } }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const handleSelect = (event: any) => setSelectedPlace(event.place); + const handleSelect = (event: any) => { + setSelectedPlace(event.place); + }; placeSearch.addEventListener('gmp-load', handleLoad); placeSearch.addEventListener('gmp-select', handleSelect); @@ -223,7 +224,7 @@ const PlaceSearchController = ({ ) return; - if (selectedPlace && selectedPlace.location) { + if (selectedPlace?.location) { placeRequestRef.current.place = selectedPlace; if (placeDetailsRef.current) placeDetailsRef.current.style.display = 'block'; @@ -257,7 +258,7 @@ const PlaceSearchController = ({ return null; }; -const root = createRoot(document.getElementById('app') as HTMLElement); +const root = createRoot(document.getElementById('app')!); root.render( diff --git a/dist/samples/react-ui-kit-search-text/dist/assets/index-LKS0y80c.js b/dist/samples/react-ui-kit-search-text/dist/assets/index-CfrKTpmR.js similarity index 98% rename from dist/samples/react-ui-kit-search-text/dist/assets/index-LKS0y80c.js rename to dist/samples/react-ui-kit-search-text/dist/assets/index-CfrKTpmR.js index 7b7eaba57..c039d4083 100644 --- a/dist/samples/react-ui-kit-search-text/dist/assets/index-LKS0y80c.js +++ b/dist/samples/react-ui-kit-search-text/dist/assets/index-CfrKTpmR.js @@ -10,4 +10,4 @@ Error generating stack: `+e.message+` gmp-advanced-marker[data-origin='rgm'] { pointer-events: none !important; } - `,this.renderedStyles.add(`marker-pointer-events`)}cleanup(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null,this.renderedStyles.clear())}};function dt(e,t){if(!(google==null?void 0:google.maps)?.version)return;let n=google.maps.version.split(`.`),r=parseInt(n[0],10),i=parseInt(n[1],10);return r>e||r===e&&i>=t}var ft=S.createContext(null),pt={TOP_LEFT:[`0%`,`0%`],TOP_CENTER:[`50%`,`0%`],TOP:[`50%`,`0%`],TOP_RIGHT:[`100%`,`0%`],LEFT_CENTER:[`0%`,`50%`],LEFT_TOP:[`0%`,`0%`],LEFT:[`0%`,`50%`],LEFT_BOTTOM:[`0%`,`100%`],RIGHT_TOP:[`100%`,`0%`],RIGHT:[`100%`,`50%`],RIGHT_CENTER:[`100%`,`50%`],RIGHT_BOTTOM:[`100%`,`100%`],BOTTOM_LEFT:[`0%`,`100%`],BOTTOM_CENTER:[`50%`,`100%`],BOTTOM:[`50%`,`100%`],BOTTOM_RIGHT:[`100%`,`100%`],CENTER:[`50%`,`50%`]},j=(0,S.forwardRef)((e,t)=>{let{children:n,style:r,className:i,anchorPoint:a}=e,[o,s]=gt(e),c=(0,S.useMemo)(()=>o?{marker:o}:null,[o]);return(0,S.useImperativeHandle)(t,()=>o,[o]),s?S.createElement(ft.Provider,{value:c},(0,C.createPortal)(S.createElement(ht,{anchorPoint:a,styles:r,className:i},n),s)):null});j.displayName=`AdvancedMarker`;function mt(e){return e.nodeType===Node.ELEMENT_NODE}var ht=({children:e,styles:t,className:n})=>S.createElement(`div`,{className:n,style:t},e);function gt(e){let[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(null),a=$e(),o=et(`marker`),{children:s,onClick:c,className:l,onMouseEnter:u,onMouseLeave:d,onDrag:f,onDragStart:p,onDragEnd:m,collisionBehavior:h,clickable:g,draggable:_,position:v,title:y,zIndex:b,anchorPoint:x,anchorLeft:C,anchorTop:w}=e,ee=S.Children.count(s);return(0,S.useEffect)(()=>{if(!a||!o)return;let e=new o.AdvancedMarkerElement;e.map=a,n(e);let t=null;return ee>0&&(t=document.createElement(`div`),e.content=t,i(t)),()=>{e.map=null,t?.remove(),n(null),i(null)}},[a,o,ee]),(0,S.useEffect)(()=>{!t?.content||!mt(t.content)||ee>0||(t.content.className=l??``)},[t,l,ee]),_t(t,x,C,w,ee>0),A(t,`position`,v),A(t,`title`,y??``),A(t,`zIndex`,b),A(t,`collisionBehavior`,h),(0,S.useEffect)(()=>{t&&(_===void 0?f||p||m?t.gmpDraggable=!0:t.gmpDraggable=!1:t.gmpDraggable=_)},[t,_,f,m,p]),(0,S.useEffect)(()=>{if(!t)return;let e=g===void 0?!!c||!!u||!!d:g;t.gmpClickable=e,e&&t?.content&&mt(t.content)&&(t.content.style.pointerEvents=`all`,c&&(t.content.style.cursor=`pointer`))},[t,g,c,u,d]),k(t,`click`,c),k(t,`drag`,f),k(t,`dragstart`,p),k(t,`dragend`,m),lt(t?.element,`mouseenter`,u),lt(t?.element,`mouseleave`,d),[t,r]}function _t(e,t,n,r,i){(0,S.useEffect)(()=>{if(!e||!i)return;let a=dt(3,62),o=e.content;if(!(!o||!mt(o))){if(n!==void 0||r!==void 0){a||console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`),e.anchorLeft=n,e.anchorTop=r,t!==void 0&&console.warn(`AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.`);return}if(t!==void 0){let[n,r]=t??pt.BOTTOM,i=`calc(-1 * ${n})`,s=`calc(-1 * ${r})`;a?(e.anchorLeft=i,e.anchorTop=s,o.style.transform=``):(o.style.transform=`translate(50%, 100%) translate(${i}, ${s})`,e.dataset.origin=`rgm`,ut.addAdvancedMarkerPointerEventsOverwrite())}}},[e,t,n,r,i])}function vt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onRadiusChanged:s,onCenterChanged:c,center:l,defaultCenter:u,radius:d,defaultRadius:f}=e,p=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onRadiusChanged`,`onCenterChanged`,`center`,`defaultCenter`,`radius`,`defaultRadius`]),[m,h]=(0,S.useState)(null),g=$e(),_=Ee(Object.assign(Object.assign({},p),{clickable:p.clickable??!!t,draggable:p.draggable??!!(n||r||i||c),editable:p.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!g){g===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Circle(Object.assign(Object.assign({},_),{center:l??u,radius:d??f}));return e.setMap(g),h(e),()=>{e.setMap(null),h(null)}},[g]),k(m,`click`,t),k(m,`drag`,n),k(m,`dragstart`,r),k(m,`dragend`,i),k(m,`mouseover`,a),k(m,`mouseout`,o),k(m,`radius_changed`,s?()=>{let e=m?.getRadius();e!==void 0&&s(e)}:null),k(m,`center_changed`,c?()=>{c(m?.getCenter())}:null),(0,S.useEffect)(()=>{m&&m.setOptions(_)},[m,_]),(0,S.useEffect)(()=>{!m||!l||Pe(l,m.getCenter())||m.setCenter(l)},[m,l]),(0,S.useEffect)(()=>{!m||d===void 0||d!==m.getRadius()&&m.setRadius(d)},[m,d]),m}var yt=(0,S.forwardRef)((e,t)=>{let n=vt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});yt.displayName=`Circle`;function bt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");let r=e.style;if(n==null){if(t==null)return;for(let e in t)t.hasOwnProperty(e)&&xt(r,e,t[e]);return}for(let e in n)n.hasOwnProperty(e)&&(t==null||!t.hasOwnProperty(e))&&(e.indexOf(`--`)===0?r.setProperty(e,``):e===`float`?r.cssFloat=``:r[e]=``);if(t!=null)for(let e in t){let i=t[e];t.hasOwnProperty(e)&&n[e]!==i&&xt(r,e,i)}}function xt(e,t,n){let r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n==`number`&&n!==0&&!Ct(t)?e[t]=n+`px`:t===`float`?e.cssFloat=n:e[t]=(``+n).trim()}var St=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.scale.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth`.split(`.`));function Ct(e){return St.has(e)}function wt(e){let t=e.getPaths(),n=[];for(let e=0;e{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPaths(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.paths=t),e=new google.maps.Polygon(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(wt(p))}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=[],t=p.getPaths();if(typeof t.getLength!=`function`||typeof t.getAt!=`function`)return;let n=()=>{_.current||s(wt(p))},r=t=>{e.push(google.maps.event.addListener(t,`insert_at`,n)),e.push(google.maps.event.addListener(t,`remove_at`,n)),e.push(google.maps.event.addListener(t,`set_at`,n))};for(let e=0;e{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`set_at`,e=>{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`remove_at`,n)),()=>{e.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{if(!p||!u||!Array.isArray(u))return;let e=u[0];ze(Array.isArray(e)?u:[u],p.getPaths())||(_.current=!0,p.setPaths(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=l.map(e=>g.encoding.decodePath(e));p.setPaths(e),_.current=!1},[p,l,g]),p}var Et=(0,S.forwardRef)((e,t)=>{let n=Tt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Et.displayName=`Polygon`;function Dt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onPathChanged:s,polyline:c,encodedPath:l,path:u,defaultPath:d}=e,f=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onPathChanged`,`polyline`,`encodedPath`,`path`,`defaultPath`]),[p,m]=(0,S.useState)(null),h=$e(),g=et(`geometry`),_=(0,S.useRef)(!1),v=Ee(Object.assign(Object.assign({},f),{clickable:f.clickable??!!t,draggable:f.draggable??!!(n||r||i||s),editable:f.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPath(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.path=t),e=new google.maps.Polyline(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(p.getPath().getArray())}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=p.getPath();if(!e)return;let t=()=>{_.current||s(e.getArray())},n=[google.maps.event.addListener(e,`insert_at`,t),google.maps.event.addListener(e,`remove_at`,t),google.maps.event.addListener(e,`set_at`,t)];return()=>{n.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{!p||!u||Re(u,p.getPath())||(_.current=!0,p.setPath(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=g.encoding.decodePath(l);p.setPath(e),_.current=!1},[p,l,g]),p}var Ot=(0,S.forwardRef)((e,t)=>{let n=Dt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Ot.displayName=`Polyline`;var kt={center:{lat:0,lng:0,altitude:0},range:0,heading:0,tilt:0,roll:0},At=[`center`,`range`,`heading`,`tilt`,`roll`];function jt(e,t,n){let r=e[n];if(r!=null)if(n===`center`){let e=r;t.current.center=e.toJSON?e.toJSON():e}else t.current[n]=r}function Mt(e){let t=We(),n=(0,S.useRef)(Object.assign({},kt));return(0,S.useEffect)(()=>{if(!e)return;let r=[];for(let i of At){let a=`gmp-${i}change`,o=()=>{jt(e,n,i),t()};e.addEventListener(a,o),r.push(()=>e.removeEventListener(a,o))}return()=>{for(let e of r)e()}},[e,t]),n}function Nt(e){let t=et(`maps3d`),[n,r]=(0,S.useState)(!1),[,i]=He(),[a,o]=He(),s=Mt(a);return(0,S.useEffect)(()=>{customElements.whenDefined(`gmp-map-3d`).then(()=>{r(!0)})},[]),(0,S.useEffect)(()=>{if(!a)return;let{center:t,heading:n,tilt:r,range:i,roll:o,defaultCenter:s,defaultHeading:c,defaultTilt:l,defaultRange:u,defaultRoll:d,id:f,style:p,className:m,children:h,onCenterChanged:g,onHeadingChanged:_,onTiltChanged:v,onRangeChanged:y,onRollChanged:b,onCameraChanged:x,onClick:S,onSteadyChange:C,onAnimationEnd:w,onError:ee,mode:ne,gestureHandling:re}=e,ie=te(e,`center.heading.tilt.range.roll.defaultCenter.defaultHeading.defaultTilt.defaultRange.defaultRoll.id.style.className.children.onCenterChanged.onHeadingChanged.onTiltChanged.onRangeChanged.onRollChanged.onCameraChanged.onClick.onSteadyChange.onAnimationEnd.onError.mode.gestureHandling`.split(`.`)),ae=t??s,oe=n??c,se=r??l,ce=i??u,le=o??d,ue=Object.assign({},ie);ae&&(ue.center=ae),oe!==void 0&&(ue.heading=oe),se!==void 0&&(ue.tilt=se),ce!==void 0&&(ue.range=ce),le!==void 0&&(ue.roll=le),Object.assign(a,ue)},[a]),[a,i,o,s,!!t&&n]}function Pt(e){return e?`toJSON`in e&&typeof e.toJSON==`function`?e.toJSON():e:null}function Ft(e,t,n){let r=Pt(n.center),i=r?.lat??null,a=r?.lng??null,o=r?.altitude??null,s=n.range??null,c=n.heading??null,l=n.tilt??null,u=n.roll??null;(0,S.useLayoutEffect)(()=>{if(!e)return;let n=t.current;i!==null&&a!==null&&(n.center.lat!==i||n.center.lng!==a||o!==null&&n.center.altitude!==o)&&(e.center={lat:i,lng:a,altitude:o??n.center.altitude??0}),s!==null&&n.range!==s&&(e.range=s),c!==null&&n.heading!==c&&(e.heading=c),l!==null&&n.tilt!==l&&(e.tilt=l),u!==null&&n.roll!==u&&(e.roll=u)})}var It=[`gmp-centerchange`,`gmp-headingchange`,`gmp-tiltchange`,`gmp-rangechange`,`gmp-rollchange`];function Lt(e,t){let n=e.center,r;return r=n&&`toJSON`in n&&typeof n.toJSON==`function`?n.toJSON():n||{lat:0,lng:0,altitude:0},{type:t,map3d:e,detail:{center:r,range:e.range||0,heading:e.heading||0,tilt:e.tilt||0,roll:e.roll||0}}}function Rt(e,t){let n=t;return{type:`gmp-click`,map3d:e,detail:{position:t.position||null,placeId:n.placeId}}}function zt(e,t){return{type:`gmp-steadychange`,map3d:e,detail:{isSteady:t.isSteady}}}function Bt(e,t){let{onCenterChanged:n,onHeadingChanged:r,onTiltChanged:i,onRangeChanged:a,onRollChanged:o,onCameraChanged:s,onClick:c,onSteadyChange:l,onAnimationEnd:u,onError:d}=t;Vt(e,`gmp-centerchange`,n,Lt),Vt(e,`gmp-headingchange`,r,Lt),Vt(e,`gmp-tiltchange`,i,Lt),Vt(e,`gmp-rangechange`,a,Lt),Vt(e,`gmp-rollchange`,o,Lt),(0,S.useEffect)(()=>{if(!e||!s)return;let t=()=>{s(Lt(e,`camerachange`))};for(let n of It)e.addEventListener(n,t);return()=>{for(let n of It)e.removeEventListener(n,t)}},[e,s]),(0,S.useEffect)(()=>{if(!e||!c)return;let t=t=>{c(Rt(e,t))};return e.addEventListener(`gmp-click`,t),()=>e.removeEventListener(`gmp-click`,t)},[e,c]),(0,S.useEffect)(()=>{if(!e||!l)return;let t=t=>{l(zt(e,t))};return e.addEventListener(`gmp-steadychange`,t),()=>e.removeEventListener(`gmp-steadychange`,t)},[e,l]),Vt(e,`gmp-animationend`,u,(e,t)=>({type:t,map3d:e})),Vt(e,`gmp-error`,d,(e,t)=>({type:t,map3d:e}))}function Vt(e,t,n,r){(0,S.useEffect)(()=>{if(!e||!n)return;let i=()=>{n(r(e,t))};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)},[e,t,n,r])}var Ht=new Set([`bounds`,`defaultUIHidden`,`gestureHandling`,`internalUsageAttributionIds`,`maxAltitude`,`maxHeading`,`maxTilt`,`minAltitude`,`minHeading`,`minTilt`,`mode`]);function Ut(e,t){let n=(0,S.useMemo)(()=>{let e={},n=Object.keys(t);for(let r of n){if(!Ht.has(r))continue;let n=t[r];n!==void 0&&(e[r]=n)}return e},[t]);Oe(()=>{e&&Object.assign(e,n)},[e,n])}var Wt=S.createContext(null),Gt={width:`100%`,height:`100%`,position:`relative`},Kt=(0,S.forwardRef)((e,t)=>{let{children:n,id:r,className:i,style:a}=e,o=(0,S.useContext)(fe);if(!o)throw Error(` can only be used inside an component.`);let{addMap3DInstance:s,removeMap3DInstance:c}=o,[l,u,d,f,p]=Nt(e);Ft(l,f,e),Bt(l,e),Ut(l,e),(0,S.useEffect)(()=>{if(!l)return;let e=r??`default`;return s(l,e),()=>{c(e)}},[l,r]),(0,S.useImperativeHandle)(t,()=>({map3d:l,flyCameraAround:e=>{l?.flyCameraAround(e)},flyCameraTo:e=>{l?.flyCameraTo(e)},stopCameraAnimation:()=>{l?.stopCameraAnimation()}}),[l]);let m=(0,S.useMemo)(()=>Object.assign(Object.assign({},Gt),a),[a]),h=(0,S.useMemo)(()=>({map3d:l}),[l]);return p?S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}),S.createElement(`gmp-map-3d`,{ref:d,style:{width:`100%`,height:`100%`}},l&&S.createElement(Wt.Provider,{value:h},n))):S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}))});Kt.displayName=`Map3D`;var qt=(0,S.createContext)(null),Jt=(0,S.forwardRef)(function(e,t){let{children:n,onClick:r,position:i,altitudeMode:a,collisionBehavior:o,drawsWhenOccluded:s,extruded:c,label:l,sizePreserved:u,zIndex:d,title:f}=e,p=!!r,[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)(!1),v=(0,S.useMemo)(()=>{let e=document.createElement(`div`);return e.style.display=`none`,document.body.appendChild(e),e},[]);(0,S.useEffect)(()=>()=>v.remove(),[v]);let y=(0,S.useCallback)(e=>{h(e),typeof t==`function`?t(e):t&&(t.current=e)},[t]);lt(m,`gmp-click`,r),(0,S.useLayoutEffect)(()=>{if(g||!m||!v)return;for(;m.firstChild;)m.removeChild(m.firstChild);let e=Array.from(v.childNodes);for(let t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=t,n=e.tagName.toLowerCase();if(n===`img`||n===`svg`){let t=document.createElement(`template`);t.content.appendChild(e.cloneNode(!0)),m.appendChild(t)}else m.appendChild(e.cloneNode(!0))}},[m,v,n,g]);let b=(0,S.useMemo)(()=>({marker:m,setContentHandledExternally:_}),[m]);return A(m,`position`,i),A(m,`altitudeMode`,a),A(m,`collisionBehavior`,o),A(m,`drawsWhenOccluded`,s),A(m,`extruded`,c),A(m,`label`,l),A(m,`sizePreserved`,u),A(m,`zIndex`,d),A(m,`title`,f??``),S.createElement(qt.Provider,{value:b},p?S.createElement(`gmp-marker-3d-interactive`,{ref:y}):S.createElement(`gmp-marker-3d`,{ref:y}),(0,C.createPortal)(n,v))});Jt.displayName=`Marker3D`;var Yt=(0,S.forwardRef)(function(e,t){let{children:n,headerContent:r,style:i,className:a,open:o=!0,position:s,anchor:c,anchorId:l,altitudeMode:u,lightDismissDisabled:d,autoPanDisabled:f,onClose:p}=e,[m,h]=(0,S.useState)(null),g=(0,S.useRef)(null);return(0,S.useImperativeHandle)(t,()=>m,[m]),Xt(m,o,p),A(m,`open`,o??!1),A(m,`altitudeMode`,u),A(m,`lightDismissDisabled`,d),A(m,`autoPanDisabled`,f),A(m,`positionAnchor`,c??l??s),(0,S.useLayoutEffect)(()=>{m&&(bt(m,i||null,g.current),g.current=i||null)},[m,i]),S.createElement(`gmp-popover`,{ref:h,className:a},r&&S.createElement(`div`,{slot:`header`},r),n)});Yt.displayName=`Popover`;function Xt(e,t,n){let r=(0,S.useRef)(void 0),i=(0,S.useRef)(t);(0,S.useEffect)(()=>{i.current=t},[t]),(0,S.useEffect)(()=>{if(!e||!n)return;let t=new MutationObserver(t=>{for(let a of t)if(a.type===`attributes`&&a.attributeName===`open`){let t=e.hasAttribute(`open`);r.current===!0&&!t&&i.current!==!1&&n(),r.current=t}});return t.observe(e,{attributes:!0,attributeFilter:[`open`]}),r.current=e.hasAttribute(`open`),()=>{t.disconnect()}},[e,n])}function Zt(e){let[t,n]=(0,S.useState)(null),r=$e(),{onClick:i,onDrag:a,onDragStart:o,onDragEnd:s,onMouseOver:c,onMouseOut:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`]),{position:d,draggable:f}=u;return(0,S.useEffect)(()=>{if(!r){r===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Marker(u);return e.setMap(r),n(e),()=>{e.setMap(null),n(null)}},[r]),(0,S.useEffect)(()=>{if(!t)return;let e=t,n=google.maps.event;return i&&n.addListener(e,`click`,i),a&&n.addListener(e,`drag`,a),o&&n.addListener(e,`dragstart`,o),s&&n.addListener(e,`dragend`,s),c&&n.addListener(e,`mouseover`,c),l&&n.addListener(e,`mouseout`,l),t.setDraggable(!!f),()=>{n.clearInstanceListeners(e)}},[t,f,i,a,o,s,c,l]),(0,S.useEffect)(()=>{t&&u&&t.setOptions(u)},[t,u]),(0,S.useEffect)(()=>{f||!d||!t||t.setPosition(d)},[f,d,t]),t}var Qt=(0,S.forwardRef)((e,t)=>{let n=Zt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Qt.displayName=`Marker`;function $t(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onBoundsChanged:s,bounds:c,defaultBounds:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onBoundsChanged`,`bounds`,`defaultBounds`]),[d,f]=(0,S.useState)(null),p=$e(),m=Ee(Object.assign(Object.assign({},u),{clickable:u.clickable??!!t,draggable:u.draggable??!!(n||r||i||s),editable:u.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!p){p===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Rectangle(Object.assign(Object.assign({},m),{bounds:c??l}));return e.setMap(p),f(e),()=>{e.setMap(null),f(null)}},[p]),k(d,`click`,t),k(d,`drag`,n),k(d,`dragstart`,r),k(d,`dragend`,i),k(d,`mouseover`,a),k(d,`mouseout`,o),k(d,`bounds_changed`,s?()=>{s(d?.getBounds())}:null),(0,S.useEffect)(()=>{d&&d.setOptions(m)},[d,m]),(0,S.useEffect)(()=>{!d||!c||Le(c,d.getBounds())||d.setBounds(c)},[d,c]),d}var en=(0,S.forwardRef)((e,t)=>{let n=$t(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});en.displayName=`Rectangle`;var tn=`AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8`,nn=()=>(0,b.jsx)(ye,{apiKey:tn,libraries:[`maps`,`places`,`marker`,`geometry`,`core`],children:(0,b.jsx)(rn,{})}),rn=()=>{let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(null),o=(0,S.useRef)(null),s=(0,S.useRef)(null);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`map-container`,children:(0,b.jsxs)(Xe,{defaultCenter:{lat:48.8566,lng:2.3522},defaultZoom:14,mapId:`DEMO_MAP_ID`,clickableIcons:!1,onClick:()=>a(null),children:[(0,b.jsx)(an,{placeSearchRef:o,query:e,setPlaces:r,setSelectedPlace:a,selectedPlace:i}),n.map(e=>e.location&&(0,b.jsx)(j,{position:e.location,onClick:()=>{a(e)}},e.id))]})}),(0,b.jsx)(`div`,{className:`place-list-wrapper`,ref:o}),(0,b.jsxs)(`div`,{className:`controls`,children:[(0,b.jsx)(`input`,{type:`text`,ref:s,className:`query-input`}),(0,b.jsx)(`button`,{className:`search-button`,onClick:()=>{s.current&&t(s.current.value)},children:`Search`})]})]})},an=({placeSearchRef:e,query:t,setPlaces:n,setSelectedPlace:r,selectedPlace:i})=>{let a=$e(),o=et(`core`),s=et(`marker`),c=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(!s||!a)return;let e=document.createElement(`gmp-place-details-compact`);e.setAttribute(`orientation`,`horizontal`),u.current=e;let t=document.createElement(`gmp-place-details-place-request`);c.current=t;let n=document.createElement(`gmp-place-all-content`);e.appendChild(t),e.appendChild(n),l.current=new s.AdvancedMarkerElement({map:null,content:e,zIndex:100})},[s,a]),(0,S.useEffect)(()=>{if(!a||!o||!e.current)return;if(!t){e.current.innerHTML=``,n([]);return}let i=a.getBounds();if(!i)return;let s=document.createElement(`gmp-place-search`);s.setAttribute(`selectable`,``),s.setAttribute(`orientation`,`vertical`),s.setAttribute(`attribution-position`,`top`),s.style.display=`block`;let c=document.createElement(`gmp-place-text-search-request`);c.textQuery=t,c.locationBias=i,s.appendChild(c);let l=document.createElement(`gmp-place-all-content`);s.appendChild(l),e.current.innerHTML=``,e.current.appendChild(s);let u=()=>{let e=s.places||[];if(n(e),e.length>0){let t=new o.LatLngBounds;e.forEach(e=>e.location&&t.extend(e.location)),t.isEmpty()||a.fitBounds(t)}},d=e=>r(e.place);return s.addEventListener(`gmp-load`,u),s.addEventListener(`gmp-select`,d),()=>{s.removeEventListener(`gmp-load`,u),s.removeEventListener(`gmp-select`,d)}},[a,o,t,e,n,r]),(0,S.useEffect)(()=>{!a||!l.current||!c.current||!u.current||(i&&i.location?(c.current.place=i,u.current&&(u.current.style.display=`block`),l.current.position=i.location,l.current.map=a,i.viewport&&(a.fitBounds(i.viewport,{top:0,left:400}),u.current.addEventListener(`gmp-load`,()=>{i.viewport&&a.fitBounds(i.viewport,{top:0,right:450})},{once:!0}))):(l.current.map=null,u.current&&(u.current.style.display=`none`)))},[i,a]),null};(0,x.createRoot)(document.getElementById(`app`)).render((0,b.jsx)(S.StrictMode,{children:(0,b.jsx)(nn,{})})); \ No newline at end of file + `,this.renderedStyles.add(`marker-pointer-events`)}cleanup(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null,this.renderedStyles.clear())}};function dt(e,t){if(!(google==null?void 0:google.maps)?.version)return;let n=google.maps.version.split(`.`),r=parseInt(n[0],10),i=parseInt(n[1],10);return r>e||r===e&&i>=t}var ft=S.createContext(null),pt={TOP_LEFT:[`0%`,`0%`],TOP_CENTER:[`50%`,`0%`],TOP:[`50%`,`0%`],TOP_RIGHT:[`100%`,`0%`],LEFT_CENTER:[`0%`,`50%`],LEFT_TOP:[`0%`,`0%`],LEFT:[`0%`,`50%`],LEFT_BOTTOM:[`0%`,`100%`],RIGHT_TOP:[`100%`,`0%`],RIGHT:[`100%`,`50%`],RIGHT_CENTER:[`100%`,`50%`],RIGHT_BOTTOM:[`100%`,`100%`],BOTTOM_LEFT:[`0%`,`100%`],BOTTOM_CENTER:[`50%`,`100%`],BOTTOM:[`50%`,`100%`],BOTTOM_RIGHT:[`100%`,`100%`],CENTER:[`50%`,`50%`]},j=(0,S.forwardRef)((e,t)=>{let{children:n,style:r,className:i,anchorPoint:a}=e,[o,s]=gt(e),c=(0,S.useMemo)(()=>o?{marker:o}:null,[o]);return(0,S.useImperativeHandle)(t,()=>o,[o]),s?S.createElement(ft.Provider,{value:c},(0,C.createPortal)(S.createElement(ht,{anchorPoint:a,styles:r,className:i},n),s)):null});j.displayName=`AdvancedMarker`;function mt(e){return e.nodeType===Node.ELEMENT_NODE}var ht=({children:e,styles:t,className:n})=>S.createElement(`div`,{className:n,style:t},e);function gt(e){let[t,n]=(0,S.useState)(null),[r,i]=(0,S.useState)(null),a=$e(),o=et(`marker`),{children:s,onClick:c,className:l,onMouseEnter:u,onMouseLeave:d,onDrag:f,onDragStart:p,onDragEnd:m,collisionBehavior:h,clickable:g,draggable:_,position:v,title:y,zIndex:b,anchorPoint:x,anchorLeft:C,anchorTop:w}=e,ee=S.Children.count(s);return(0,S.useEffect)(()=>{if(!a||!o)return;let e=new o.AdvancedMarkerElement;e.map=a,n(e);let t=null;return ee>0&&(t=document.createElement(`div`),e.content=t,i(t)),()=>{e.map=null,t?.remove(),n(null),i(null)}},[a,o,ee]),(0,S.useEffect)(()=>{!t?.content||!mt(t.content)||ee>0||(t.content.className=l??``)},[t,l,ee]),_t(t,x,C,w,ee>0),A(t,`position`,v),A(t,`title`,y??``),A(t,`zIndex`,b),A(t,`collisionBehavior`,h),(0,S.useEffect)(()=>{t&&(_===void 0?f||p||m?t.gmpDraggable=!0:t.gmpDraggable=!1:t.gmpDraggable=_)},[t,_,f,m,p]),(0,S.useEffect)(()=>{if(!t)return;let e=g===void 0?!!c||!!u||!!d:g;t.gmpClickable=e,e&&t?.content&&mt(t.content)&&(t.content.style.pointerEvents=`all`,c&&(t.content.style.cursor=`pointer`))},[t,g,c,u,d]),k(t,`click`,c),k(t,`drag`,f),k(t,`dragstart`,p),k(t,`dragend`,m),lt(t?.element,`mouseenter`,u),lt(t?.element,`mouseleave`,d),[t,r]}function _t(e,t,n,r,i){(0,S.useEffect)(()=>{if(!e||!i)return;let a=dt(3,62),o=e.content;if(!(!o||!mt(o))){if(n!==void 0||r!==void 0){a||console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`),e.anchorLeft=n,e.anchorTop=r,t!==void 0&&console.warn(`AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.`);return}if(t!==void 0){let[n,r]=t??pt.BOTTOM,i=`calc(-1 * ${n})`,s=`calc(-1 * ${r})`;a?(e.anchorLeft=i,e.anchorTop=s,o.style.transform=``):(o.style.transform=`translate(50%, 100%) translate(${i}, ${s})`,e.dataset.origin=`rgm`,ut.addAdvancedMarkerPointerEventsOverwrite())}}},[e,t,n,r,i])}function vt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onRadiusChanged:s,onCenterChanged:c,center:l,defaultCenter:u,radius:d,defaultRadius:f}=e,p=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onRadiusChanged`,`onCenterChanged`,`center`,`defaultCenter`,`radius`,`defaultRadius`]),[m,h]=(0,S.useState)(null),g=$e(),_=Ee(Object.assign(Object.assign({},p),{clickable:p.clickable??!!t,draggable:p.draggable??!!(n||r||i||c),editable:p.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!g){g===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Circle(Object.assign(Object.assign({},_),{center:l??u,radius:d??f}));return e.setMap(g),h(e),()=>{e.setMap(null),h(null)}},[g]),k(m,`click`,t),k(m,`drag`,n),k(m,`dragstart`,r),k(m,`dragend`,i),k(m,`mouseover`,a),k(m,`mouseout`,o),k(m,`radius_changed`,s?()=>{let e=m?.getRadius();e!==void 0&&s(e)}:null),k(m,`center_changed`,c?()=>{c(m?.getCenter())}:null),(0,S.useEffect)(()=>{m&&m.setOptions(_)},[m,_]),(0,S.useEffect)(()=>{!m||!l||Pe(l,m.getCenter())||m.setCenter(l)},[m,l]),(0,S.useEffect)(()=>{!m||d===void 0||d!==m.getRadius()&&m.setRadius(d)},[m,d]),m}var yt=(0,S.forwardRef)((e,t)=>{let n=vt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});yt.displayName=`Circle`;function bt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");let r=e.style;if(n==null){if(t==null)return;for(let e in t)t.hasOwnProperty(e)&&xt(r,e,t[e]);return}for(let e in n)n.hasOwnProperty(e)&&(t==null||!t.hasOwnProperty(e))&&(e.indexOf(`--`)===0?r.setProperty(e,``):e===`float`?r.cssFloat=``:r[e]=``);if(t!=null)for(let e in t){let i=t[e];t.hasOwnProperty(e)&&n[e]!==i&&xt(r,e,i)}}function xt(e,t,n){let r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n==`number`&&n!==0&&!Ct(t)?e[t]=n+`px`:t===`float`?e.cssFloat=n:e[t]=(``+n).trim()}var St=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.scale.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth`.split(`.`));function Ct(e){return St.has(e)}function wt(e){let t=e.getPaths(),n=[];for(let e=0;e{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPaths(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.paths=t),e=new google.maps.Polygon(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(wt(p))}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=[],t=p.getPaths();if(typeof t.getLength!=`function`||typeof t.getAt!=`function`)return;let n=()=>{_.current||s(wt(p))},r=t=>{e.push(google.maps.event.addListener(t,`insert_at`,n)),e.push(google.maps.event.addListener(t,`remove_at`,n)),e.push(google.maps.event.addListener(t,`set_at`,n))};for(let e=0;e{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`set_at`,e=>{r(t.getAt(e)),n()})),e.push(google.maps.event.addListener(t,`remove_at`,n)),()=>{e.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{if(!p||!u||!Array.isArray(u))return;let e=u[0];ze(Array.isArray(e)?u:[u],p.getPaths())||(_.current=!0,p.setPaths(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=l.map(e=>g.encoding.decodePath(e));p.setPaths(e),_.current=!1},[p,l,g]),p}var Et=(0,S.forwardRef)((e,t)=>{let n=Tt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Et.displayName=`Polygon`;function Dt(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onPathChanged:s,polyline:c,encodedPath:l,path:u,defaultPath:d}=e,f=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onPathChanged`,`polyline`,`encodedPath`,`path`,`defaultPath`]),[p,m]=(0,S.useState)(null),h=$e(),g=et(`geometry`),_=(0,S.useRef)(!1),v=Ee(Object.assign(Object.assign({},f),{clickable:f.clickable??!!t,draggable:f.draggable??!!(n||r||i||s),editable:f.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!h){h===void 0&&console.error(` has to be inside a Map component.`);return}let e;if(c){e=c;let t=u??d;t&&Array.isArray(t)&&e.setPath(t),e.setOptions(v)}else{let t=u??d,n=Object.assign({},v);t&&Array.isArray(t)&&(n.path=t),e=new google.maps.Polyline(n)}return e.setMap(h),m(e),()=>{e.setMap(null),m(null)}},[h,c]),k(p,`click`,t),k(p,`drag`,n),k(p,`dragstart`,r),k(p,`mouseover`,a),k(p,`mouseout`,o),k(p,`dragend`,e=>{i?.(e),s&&p&&!_.current&&s(p.getPath().getArray())}),(0,S.useEffect)(()=>{if(!p||!s)return;let e=p.getPath();if(!e)return;let t=()=>{_.current||s(e.getArray())},n=[google.maps.event.addListener(e,`insert_at`,t),google.maps.event.addListener(e,`remove_at`,t),google.maps.event.addListener(e,`set_at`,t)];return()=>{n.forEach(e=>e.remove())}},[p,s,u,l,v.editable,v.draggable]),(0,S.useEffect)(()=>{p&&p.setOptions(v)},[p,v]),(0,S.useEffect)(()=>{!p||!u||Re(u,p.getPath())||(_.current=!0,p.setPath(u),_.current=!1)},[p,u]),(0,S.useEffect)(()=>{if(!p||!l||!g)return;_.current=!0;let e=g.encoding.decodePath(l);p.setPath(e),_.current=!1},[p,l,g]),p}var Ot=(0,S.forwardRef)((e,t)=>{let n=Dt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Ot.displayName=`Polyline`;var kt={center:{lat:0,lng:0,altitude:0},range:0,heading:0,tilt:0,roll:0},At=[`center`,`range`,`heading`,`tilt`,`roll`];function jt(e,t,n){let r=e[n];if(r!=null)if(n===`center`){let e=r;t.current.center=e.toJSON?e.toJSON():e}else t.current[n]=r}function Mt(e){let t=We(),n=(0,S.useRef)(Object.assign({},kt));return(0,S.useEffect)(()=>{if(!e)return;let r=[];for(let i of At){let a=`gmp-${i}change`,o=()=>{jt(e,n,i),t()};e.addEventListener(a,o),r.push(()=>e.removeEventListener(a,o))}return()=>{for(let e of r)e()}},[e,t]),n}function Nt(e){let t=et(`maps3d`),[n,r]=(0,S.useState)(!1),[,i]=He(),[a,o]=He(),s=Mt(a);return(0,S.useEffect)(()=>{customElements.whenDefined(`gmp-map-3d`).then(()=>{r(!0)})},[]),(0,S.useEffect)(()=>{if(!a)return;let{center:t,heading:n,tilt:r,range:i,roll:o,defaultCenter:s,defaultHeading:c,defaultTilt:l,defaultRange:u,defaultRoll:d,id:f,style:p,className:m,children:h,onCenterChanged:g,onHeadingChanged:_,onTiltChanged:v,onRangeChanged:y,onRollChanged:b,onCameraChanged:x,onClick:S,onSteadyChange:C,onAnimationEnd:w,onError:ee,mode:ne,gestureHandling:re}=e,ie=te(e,`center.heading.tilt.range.roll.defaultCenter.defaultHeading.defaultTilt.defaultRange.defaultRoll.id.style.className.children.onCenterChanged.onHeadingChanged.onTiltChanged.onRangeChanged.onRollChanged.onCameraChanged.onClick.onSteadyChange.onAnimationEnd.onError.mode.gestureHandling`.split(`.`)),ae=t??s,oe=n??c,se=r??l,ce=i??u,le=o??d,ue=Object.assign({},ie);ae&&(ue.center=ae),oe!==void 0&&(ue.heading=oe),se!==void 0&&(ue.tilt=se),ce!==void 0&&(ue.range=ce),le!==void 0&&(ue.roll=le),Object.assign(a,ue)},[a]),[a,i,o,s,!!t&&n]}function Pt(e){return e?`toJSON`in e&&typeof e.toJSON==`function`?e.toJSON():e:null}function Ft(e,t,n){let r=Pt(n.center),i=r?.lat??null,a=r?.lng??null,o=r?.altitude??null,s=n.range??null,c=n.heading??null,l=n.tilt??null,u=n.roll??null;(0,S.useLayoutEffect)(()=>{if(!e)return;let n=t.current;i!==null&&a!==null&&(n.center.lat!==i||n.center.lng!==a||o!==null&&n.center.altitude!==o)&&(e.center={lat:i,lng:a,altitude:o??n.center.altitude??0}),s!==null&&n.range!==s&&(e.range=s),c!==null&&n.heading!==c&&(e.heading=c),l!==null&&n.tilt!==l&&(e.tilt=l),u!==null&&n.roll!==u&&(e.roll=u)})}var It=[`gmp-centerchange`,`gmp-headingchange`,`gmp-tiltchange`,`gmp-rangechange`,`gmp-rollchange`];function Lt(e,t){let n=e.center,r;return r=n&&`toJSON`in n&&typeof n.toJSON==`function`?n.toJSON():n||{lat:0,lng:0,altitude:0},{type:t,map3d:e,detail:{center:r,range:e.range||0,heading:e.heading||0,tilt:e.tilt||0,roll:e.roll||0}}}function Rt(e,t){let n=t;return{type:`gmp-click`,map3d:e,detail:{position:t.position||null,placeId:n.placeId}}}function zt(e,t){return{type:`gmp-steadychange`,map3d:e,detail:{isSteady:t.isSteady}}}function Bt(e,t){let{onCenterChanged:n,onHeadingChanged:r,onTiltChanged:i,onRangeChanged:a,onRollChanged:o,onCameraChanged:s,onClick:c,onSteadyChange:l,onAnimationEnd:u,onError:d}=t;Vt(e,`gmp-centerchange`,n,Lt),Vt(e,`gmp-headingchange`,r,Lt),Vt(e,`gmp-tiltchange`,i,Lt),Vt(e,`gmp-rangechange`,a,Lt),Vt(e,`gmp-rollchange`,o,Lt),(0,S.useEffect)(()=>{if(!e||!s)return;let t=()=>{s(Lt(e,`camerachange`))};for(let n of It)e.addEventListener(n,t);return()=>{for(let n of It)e.removeEventListener(n,t)}},[e,s]),(0,S.useEffect)(()=>{if(!e||!c)return;let t=t=>{c(Rt(e,t))};return e.addEventListener(`gmp-click`,t),()=>e.removeEventListener(`gmp-click`,t)},[e,c]),(0,S.useEffect)(()=>{if(!e||!l)return;let t=t=>{l(zt(e,t))};return e.addEventListener(`gmp-steadychange`,t),()=>e.removeEventListener(`gmp-steadychange`,t)},[e,l]),Vt(e,`gmp-animationend`,u,(e,t)=>({type:t,map3d:e})),Vt(e,`gmp-error`,d,(e,t)=>({type:t,map3d:e}))}function Vt(e,t,n,r){(0,S.useEffect)(()=>{if(!e||!n)return;let i=()=>{n(r(e,t))};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)},[e,t,n,r])}var Ht=new Set([`bounds`,`defaultUIHidden`,`gestureHandling`,`internalUsageAttributionIds`,`maxAltitude`,`maxHeading`,`maxTilt`,`minAltitude`,`minHeading`,`minTilt`,`mode`]);function Ut(e,t){let n=(0,S.useMemo)(()=>{let e={},n=Object.keys(t);for(let r of n){if(!Ht.has(r))continue;let n=t[r];n!==void 0&&(e[r]=n)}return e},[t]);Oe(()=>{e&&Object.assign(e,n)},[e,n])}var Wt=S.createContext(null),Gt={width:`100%`,height:`100%`,position:`relative`},Kt=(0,S.forwardRef)((e,t)=>{let{children:n,id:r,className:i,style:a}=e,o=(0,S.useContext)(fe);if(!o)throw Error(` can only be used inside an component.`);let{addMap3DInstance:s,removeMap3DInstance:c}=o,[l,u,d,f,p]=Nt(e);Ft(l,f,e),Bt(l,e),Ut(l,e),(0,S.useEffect)(()=>{if(!l)return;let e=r??`default`;return s(l,e),()=>{c(e)}},[l,r]),(0,S.useImperativeHandle)(t,()=>({map3d:l,flyCameraAround:e=>{l?.flyCameraAround(e)},flyCameraTo:e=>{l?.flyCameraTo(e)},stopCameraAnimation:()=>{l?.stopCameraAnimation()}}),[l]);let m=(0,S.useMemo)(()=>Object.assign(Object.assign({},Gt),a),[a]),h=(0,S.useMemo)(()=>({map3d:l}),[l]);return p?S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}),S.createElement(`gmp-map-3d`,{ref:d,style:{width:`100%`,height:`100%`}},l&&S.createElement(Wt.Provider,{value:h},n))):S.createElement(`div`,Object.assign({ref:u,"data-testid":`map-3d`,style:i?void 0:m,className:i},r?{id:r}:{}))});Kt.displayName=`Map3D`;var qt=(0,S.createContext)(null),Jt=(0,S.forwardRef)(function(e,t){let{children:n,onClick:r,position:i,altitudeMode:a,collisionBehavior:o,drawsWhenOccluded:s,extruded:c,label:l,sizePreserved:u,zIndex:d,title:f}=e,p=!!r,[m,h]=(0,S.useState)(null),[g,_]=(0,S.useState)(!1),v=(0,S.useMemo)(()=>{let e=document.createElement(`div`);return e.style.display=`none`,document.body.appendChild(e),e},[]);(0,S.useEffect)(()=>()=>v.remove(),[v]);let y=(0,S.useCallback)(e=>{h(e),typeof t==`function`?t(e):t&&(t.current=e)},[t]);lt(m,`gmp-click`,r),(0,S.useLayoutEffect)(()=>{if(g||!m||!v)return;for(;m.firstChild;)m.removeChild(m.firstChild);let e=Array.from(v.childNodes);for(let t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=t,n=e.tagName.toLowerCase();if(n===`img`||n===`svg`){let t=document.createElement(`template`);t.content.appendChild(e.cloneNode(!0)),m.appendChild(t)}else m.appendChild(e.cloneNode(!0))}},[m,v,n,g]);let b=(0,S.useMemo)(()=>({marker:m,setContentHandledExternally:_}),[m]);return A(m,`position`,i),A(m,`altitudeMode`,a),A(m,`collisionBehavior`,o),A(m,`drawsWhenOccluded`,s),A(m,`extruded`,c),A(m,`label`,l),A(m,`sizePreserved`,u),A(m,`zIndex`,d),A(m,`title`,f??``),S.createElement(qt.Provider,{value:b},p?S.createElement(`gmp-marker-3d-interactive`,{ref:y}):S.createElement(`gmp-marker-3d`,{ref:y}),(0,C.createPortal)(n,v))});Jt.displayName=`Marker3D`;var Yt=(0,S.forwardRef)(function(e,t){let{children:n,headerContent:r,style:i,className:a,open:o=!0,position:s,anchor:c,anchorId:l,altitudeMode:u,lightDismissDisabled:d,autoPanDisabled:f,onClose:p}=e,[m,h]=(0,S.useState)(null),g=(0,S.useRef)(null);return(0,S.useImperativeHandle)(t,()=>m,[m]),Xt(m,o,p),A(m,`open`,o??!1),A(m,`altitudeMode`,u),A(m,`lightDismissDisabled`,d),A(m,`autoPanDisabled`,f),A(m,`positionAnchor`,c??l??s),(0,S.useLayoutEffect)(()=>{m&&(bt(m,i||null,g.current),g.current=i||null)},[m,i]),S.createElement(`gmp-popover`,{ref:h,className:a},r&&S.createElement(`div`,{slot:`header`},r),n)});Yt.displayName=`Popover`;function Xt(e,t,n){let r=(0,S.useRef)(void 0),i=(0,S.useRef)(t);(0,S.useEffect)(()=>{i.current=t},[t]),(0,S.useEffect)(()=>{if(!e||!n)return;let t=new MutationObserver(t=>{for(let a of t)if(a.type===`attributes`&&a.attributeName===`open`){let t=e.hasAttribute(`open`);r.current===!0&&!t&&i.current!==!1&&n(),r.current=t}});return t.observe(e,{attributes:!0,attributeFilter:[`open`]}),r.current=e.hasAttribute(`open`),()=>{t.disconnect()}},[e,n])}function Zt(e){let[t,n]=(0,S.useState)(null),r=$e(),{onClick:i,onDrag:a,onDragStart:o,onDragEnd:s,onMouseOver:c,onMouseOut:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`]),{position:d,draggable:f}=u;return(0,S.useEffect)(()=>{if(!r){r===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Marker(u);return e.setMap(r),n(e),()=>{e.setMap(null),n(null)}},[r]),(0,S.useEffect)(()=>{if(!t)return;let e=t,n=google.maps.event;return i&&n.addListener(e,`click`,i),a&&n.addListener(e,`drag`,a),o&&n.addListener(e,`dragstart`,o),s&&n.addListener(e,`dragend`,s),c&&n.addListener(e,`mouseover`,c),l&&n.addListener(e,`mouseout`,l),t.setDraggable(!!f),()=>{n.clearInstanceListeners(e)}},[t,f,i,a,o,s,c,l]),(0,S.useEffect)(()=>{t&&u&&t.setOptions(u)},[t,u]),(0,S.useEffect)(()=>{f||!d||!t||t.setPosition(d)},[f,d,t]),t}var Qt=(0,S.forwardRef)((e,t)=>{let n=Zt(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});Qt.displayName=`Marker`;function $t(e){let{onClick:t,onDrag:n,onDragStart:r,onDragEnd:i,onMouseOver:a,onMouseOut:o,onBoundsChanged:s,bounds:c,defaultBounds:l}=e,u=te(e,[`onClick`,`onDrag`,`onDragStart`,`onDragEnd`,`onMouseOver`,`onMouseOut`,`onBoundsChanged`,`bounds`,`defaultBounds`]),[d,f]=(0,S.useState)(null),p=$e(),m=Ee(Object.assign(Object.assign({},u),{clickable:u.clickable??!!t,draggable:u.draggable??!!(n||r||i||s),editable:u.editable??!!s}),w.default);return(0,S.useEffect)(()=>{if(!p){p===void 0&&console.error(` has to be inside a Map component.`);return}let e=new google.maps.Rectangle(Object.assign(Object.assign({},m),{bounds:c??l}));return e.setMap(p),f(e),()=>{e.setMap(null),f(null)}},[p]),k(d,`click`,t),k(d,`drag`,n),k(d,`dragstart`,r),k(d,`dragend`,i),k(d,`mouseover`,a),k(d,`mouseout`,o),k(d,`bounds_changed`,s?()=>{s(d?.getBounds())}:null),(0,S.useEffect)(()=>{d&&d.setOptions(m)},[d,m]),(0,S.useEffect)(()=>{!d||!c||Le(c,d.getBounds())||d.setBounds(c)},[d,c]),d}var en=(0,S.forwardRef)((e,t)=>{let n=$t(e);return(0,S.useImperativeHandle)(t,()=>n,[n]),S.createElement(S.Fragment,null)});en.displayName=`Rectangle`;var tn=`AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8`,nn=()=>(0,b.jsx)(ye,{apiKey:tn,libraries:[`maps`,`places`,`marker`,`geometry`,`core`],children:(0,b.jsx)(rn,{})}),rn=()=>{let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(null),o=(0,S.useRef)(null),s=(0,S.useRef)(null);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`map-container`,children:(0,b.jsxs)(Xe,{defaultCenter:{lat:48.8566,lng:2.3522},defaultZoom:14,mapId:`DEMO_MAP_ID`,clickableIcons:!1,onClick:()=>{a(null)},children:[(0,b.jsx)(an,{placeSearchRef:o,query:e,setPlaces:r,setSelectedPlace:a,selectedPlace:i}),n.map(e=>e.location&&(0,b.jsx)(j,{position:e.location,onClick:()=>{a(e)}},e.id))]})}),(0,b.jsx)(`div`,{className:`place-list-wrapper`,ref:o}),(0,b.jsxs)(`div`,{className:`controls`,children:[(0,b.jsx)(`input`,{type:`text`,ref:s,className:`query-input`}),(0,b.jsx)(`button`,{className:`search-button`,onClick:()=>{s.current&&t(s.current.value)},children:`Search`})]})]})},an=({placeSearchRef:e,query:t,setPlaces:n,setSelectedPlace:r,selectedPlace:i})=>{let a=$e(),o=et(`core`),s=et(`marker`),c=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(!s||!a)return;let e=document.createElement(`gmp-place-details-compact`);e.setAttribute(`orientation`,`horizontal`),u.current=e;let t=document.createElement(`gmp-place-details-place-request`);c.current=t;let n=document.createElement(`gmp-place-all-content`);e.appendChild(t),e.appendChild(n),l.current=new s.AdvancedMarkerElement({map:null,content:e,zIndex:100})},[s,a]),(0,S.useEffect)(()=>{if(!a||!o||!e.current)return;if(!t){e.current.innerHTML=``,n([]);return}let i=a.getBounds();if(!i)return;let s=document.createElement(`gmp-place-search`);s.setAttribute(`selectable`,``),s.setAttribute(`orientation`,`vertical`),s.setAttribute(`attribution-position`,`top`),s.style.display=`block`;let c=document.createElement(`gmp-place-text-search-request`);c.textQuery=t,c.locationBias=i,s.appendChild(c);let l=document.createElement(`gmp-place-all-content`);s.appendChild(l),e.current.innerHTML=``,e.current.appendChild(s);let u=()=>{let e=s.places||[];if(n(e),e.length>0){let t=new o.LatLngBounds;e.forEach(e=>e.location&&t.extend(e.location)),t.isEmpty()||a.fitBounds(t)}},d=e=>{r(e.place)};return s.addEventListener(`gmp-load`,u),s.addEventListener(`gmp-select`,d),()=>{s.removeEventListener(`gmp-load`,u),s.removeEventListener(`gmp-select`,d)}},[a,o,t,e,n,r]),(0,S.useEffect)(()=>{!a||!l.current||!c.current||!u.current||(i?.location?(c.current.place=i,u.current&&(u.current.style.display=`block`),l.current.position=i.location,l.current.map=a,i.viewport&&(a.fitBounds(i.viewport,{top:0,left:400}),u.current.addEventListener(`gmp-load`,()=>{i.viewport&&a.fitBounds(i.viewport,{top:0,right:450})},{once:!0}))):(l.current.map=null,u.current&&(u.current.style.display=`none`)))},[i,a]),null};(0,x.createRoot)(document.getElementById(`app`)).render((0,b.jsx)(S.StrictMode,{children:(0,b.jsx)(nn,{})})); \ No newline at end of file diff --git a/dist/samples/react-ui-kit-search-text/dist/index.html b/dist/samples/react-ui-kit-search-text/dist/index.html index edeaa5a9f..a711744f0 100644 --- a/dist/samples/react-ui-kit-search-text/dist/index.html +++ b/dist/samples/react-ui-kit-search-text/dist/index.html @@ -12,7 +12,7 @@ content="width=device-width, initial-scale=1.0, user-scalable=no" /> React - Places UI Kit Search Text - + diff --git a/dist/samples/react-ui-kit-search-text/docs/app.tsx b/dist/samples/react-ui-kit-search-text/docs/app.tsx index 8f214312d..1aac09100 100644 --- a/dist/samples/react-ui-kit-search-text/docs/app.tsx +++ b/dist/samples/react-ui-kit-search-text/docs/app.tsx @@ -3,6 +3,13 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ + { /* [START maps_react_places_ui_kit_search_text] */ } @@ -34,9 +41,7 @@ const App = () => ( const PlacesSearchLayout = () => { const [query, setQuery] = useState(''); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const [places, setPlaces] = useState([]); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const [selectedPlace, setSelectedPlace] = useState(null); const placeSearchRef = useRef(null); @@ -56,7 +61,9 @@ const PlacesSearchLayout = () => { defaultZoom={14} mapId="DEMO_MAP_ID" clickableIcons={false} - onClick={() => setSelectedPlace(null)}> + onClick={() => { + setSelectedPlace(null); + }}> { interface PlaceSearchControllerProps { placeSearchRef: RefObject; query: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any setPlaces: (places: any[]) => void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any setSelectedPlace: (place: any) => void; - // eslint-disable-next-line @typescript-eslint/no-explicit-any selectedPlace: any; } @@ -115,7 +119,6 @@ const PlaceSearchController = ({ const coreLib = useMapsLibrary('core'); const markerLib = useMapsLibrary('marker'); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const placeRequestRef = useRef(null); const popupMarkerRef = useRef(null); @@ -169,9 +172,7 @@ const PlaceSearchController = ({ const textRequest = document.createElement( 'gmp-place-text-search-request' ); - // eslint-disable-next-line @typescript-eslint/no-explicit-any (textRequest as any).textQuery = query; - // eslint-disable-next-line @typescript-eslint/no-explicit-any (textRequest as any).locationBias = bounds; placeSearch.appendChild(textRequest); @@ -182,20 +183,19 @@ const PlaceSearchController = ({ placeSearchRef.current.appendChild(placeSearch); const handleLoad = () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const newPlaces = (placeSearch as any).places || []; setPlaces(newPlaces); if (newPlaces.length > 0) { const newBounds = new coreLib.LatLngBounds(); newPlaces.forEach( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (p: any) => p.location && newBounds.extend(p.location) ); if (!newBounds.isEmpty()) map.fitBounds(newBounds); } }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const handleSelect = (event: any) => setSelectedPlace(event.place); + const handleSelect = (event: any) => { + setSelectedPlace(event.place); + }; placeSearch.addEventListener('gmp-load', handleLoad); placeSearch.addEventListener('gmp-select', handleSelect); @@ -216,7 +216,7 @@ const PlaceSearchController = ({ ) return; - if (selectedPlace && selectedPlace.location) { + if (selectedPlace?.location) { placeRequestRef.current.place = selectedPlace; if (placeDetailsRef.current) placeDetailsRef.current.style.display = 'block'; @@ -250,7 +250,7 @@ const PlaceSearchController = ({ return null; }; -const root = createRoot(document.getElementById('app') as HTMLElement); +const root = createRoot(document.getElementById('app')!); root.render( diff --git a/dist/samples/rectangle-event/app/index.ts b/dist/samples/rectangle-event/app/index.ts index 7c6b42691..5736c8f84 100644 --- a/dist/samples/rectangle-event/app/index.ts +++ b/dist/samples/rectangle-event/app/index.ts @@ -29,7 +29,7 @@ async function init(): Promise { // Define the rectangle and set its editable property to true. rectangle = new Rectangle({ - bounds: bounds, + bounds, editable: true, draggable: true, }); diff --git a/dist/samples/rectangle-event/docs/index.js b/dist/samples/rectangle-event/docs/index.js index bf8f31687..c3bc41092 100644 --- a/dist/samples/rectangle-event/docs/index.js +++ b/dist/samples/rectangle-event/docs/index.js @@ -30,7 +30,7 @@ async function init() { // Define the rectangle and set its editable property to true. rectangle = new Rectangle({ - bounds: bounds, + bounds, editable: true, draggable: true, }); diff --git a/dist/samples/rectangle-event/docs/index.ts b/dist/samples/rectangle-event/docs/index.ts index 7c6b42691..5736c8f84 100644 --- a/dist/samples/rectangle-event/docs/index.ts +++ b/dist/samples/rectangle-event/docs/index.ts @@ -29,7 +29,7 @@ async function init(): Promise { // Define the rectangle and set its editable property to true. rectangle = new Rectangle({ - bounds: bounds, + bounds, editable: true, draggable: true, }); diff --git a/dist/samples/rectangle-event/jsfiddle/demo.js b/dist/samples/rectangle-event/jsfiddle/demo.js index 299d70b8c..ab7f635c8 100644 --- a/dist/samples/rectangle-event/jsfiddle/demo.js +++ b/dist/samples/rectangle-event/jsfiddle/demo.js @@ -29,7 +29,7 @@ async function init() { // Define the rectangle and set its editable property to true. rectangle = new Rectangle({ - bounds: bounds, + bounds, editable: true, draggable: true, }); diff --git a/dist/samples/routes-compute-routes/app/index.ts b/dist/samples/routes-compute-routes/app/index.ts index 6616169b3..52e17d0b0 100644 --- a/dist/samples/routes-compute-routes/app/index.ts +++ b/dist/samples/routes-compute-routes/app/index.ts @@ -3,6 +3,10 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ + +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ + // [START maps_routes_compute_routes] let markers: google.maps.marker.AdvancedMarkerElement[] = []; let polylines: google.maps.Polyline[] = []; @@ -91,9 +95,8 @@ async function init() { formData: FormData ): google.maps.routes.ComputeRoutesRequest { const travelMode = - (formData.get('travel_mode') as string) === '' - ? undefined - : formData.get('travel_mode'); + (formData.get('travel_mode') as google.maps.TravelModeString) || + undefined; const extraComputations: google.maps.routes.ComputeRoutesExtraComputation[] = []; const requestedReferenceRoutes: google.maps.routes.ReferenceRoute[] = @@ -127,19 +130,15 @@ async function init() { ), (input) => (input as HTMLInputElement).value ), - travelMode: travelMode as google.maps.TravelMode, + travelMode, routingPreference: - formData.get('routing_preference') === '' - ? undefined - : (formData.get( - 'routing_preference' - ) as google.maps.routes.RoutingPreference), + (formData.get( + 'routing_preference' + ) as google.maps.routes.RoutingPreferenceString) || undefined, polylineQuality: - formData.get('polyline_quality') === '' - ? undefined - : (formData.get( - 'polyline_quality' - ) as google.maps.routes.PolylineQuality), + (formData.get( + 'polyline_quality' + ) as google.maps.routes.PolylineQualityString) || undefined, computeAlternativeRoutes: formData.get('compute_alternative_routes') === 'on', routeModifiers: { @@ -188,12 +187,9 @@ async function init() { (input) => (input as HTMLInputElement).value as google.maps.TransitMode ); - transitPreference.routingPreference = - formData.get('transit_preference') === '' - ? undefined - : (formData.get( - 'transit_preference' - ) as google.maps.TransitRoutePreference); + transitPreference.routingPreference = formData.get( + 'transit_preference' + ) as google.maps.TransitRoutePreferenceString; } return request; @@ -203,7 +199,7 @@ async function init() { autocompleteSelection: PlaceAutocompleteSelection, locationInput?: FormDataEntryValue | null, headingInput?: FormDataEntryValue | null, - travelModeInput?: FormDataEntryValue | null + travelModeInput?: google.maps.TravelModeString | null ): string | google.maps.routes.DirectionalLocationLiteral { if (!locationInput) { throw new Error('Location is required.'); @@ -244,7 +240,7 @@ async function init() { } function setErrorMessage(error: string) { - const alertBox = document.getElementById('alert') as HTMLDivElement; + const alertBox = document.getElementById('alert')!; alertBox.querySelector('p')!.textContent = error; alertBox.style.display = 'flex'; } @@ -356,7 +352,7 @@ async function init() { } function attachMapClickListener() { - if (!map || !map.innerMap) { + if (!map?.innerMap) { return; } @@ -436,9 +432,8 @@ async function init() { toggleTrafficAwarePolyline(); // Toggle transit options for Transit mode - ( - document.getElementById('transit-options') as HTMLElement - ).style.display = travelMode.value === 'TRANSIT' ? 'flex' : 'none'; + document.getElementById('transit-options')!.style.display = + travelMode.value === 'TRANSIT' ? 'flex' : 'none'; }); routingPreference.addEventListener('change', () => { @@ -467,7 +462,7 @@ async function init() { } function attachAlertWindowListener() { - const alertBox = document.getElementById('alert') as HTMLDivElement; + const alertBox = document.getElementById('alert')!; const closeBtn = alertBox.querySelector('.close')!; closeBtn.addEventListener('click', () => { if (alertBox.style.display !== 'none') { diff --git a/dist/samples/routes-compute-routes/dist/assets/index-BNosmqPS.js b/dist/samples/routes-compute-routes/dist/assets/index-BNosmqPS.js new file mode 100644 index 000000000..049049046 --- /dev/null +++ b/dist/samples/routes-compute-routes/dist/assets/index-BNosmqPS.js @@ -0,0 +1 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[],t=[],n={predictionText:null,location:null},r={predictionText:null,location:null};async function i(){let[{InfoWindow:i},{AdvancedMarkerElement:a},{PlaceAutocompleteElement:o},{ComputeRoutesExtraComputation:s,ReferenceRoute:c,Route:l,RouteLabel:u}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`),google.maps.importLibrary(`routes`)]),d=document.getElementById(`map`);f(),C(),b(),x(),S(),w();function f(){let e=document.getElementById(`compute-routes-form`);e.addEventListener(`submit`,t=>{t.preventDefault(),p(new FormData(e))})}async function p(e){y();try{let{routes:t}=await l.computeRoutes(m(e));if(!t){console.log(`No routes returned.`);return}console.log(`Routes:`),t.forEach(e=>{console.log(e.toJSON())}),await Promise.all(t.map(e=>_(e,!!e.routeLabels?.includes(u.DEFAULT_ROUTE))))}catch(e){console.error(e),g(e.message||`Unknown error.`)}}function m(e){let t=e.get(`travel_mode`)||void 0,i=[],a=[],o={},l={origin:{location:h(n,e.get(`origin_location`),e.get(`heading_org`),t),vehicleStopover:e.get(`origin_stopover`)===`on`,sideOfRoad:e.get(`origin_side_of_road`)===`on`},destination:{location:h(r,e.get(`destination_location`),e.get(`heading_dest`),t),vehicleStopover:e.get(`destination_stopover`)===`on`,sideOfRoad:e.get(`destination_side_of_road`)===`on`},fields:Array.from(document.querySelectorAll(`ul#fields li input[type="checkbox"]:checked`),e=>e.value),travelMode:t,routingPreference:e.get(`routing_preference`)||void 0,polylineQuality:e.get(`polyline_quality`)||void 0,computeAlternativeRoutes:e.get(`compute_alternative_routes`)===`on`,routeModifiers:{avoidTolls:e.get(`avoid_tolls`)===`on`,avoidHighways:e.get(`avoid_highways`)===`on`,avoidFerries:e.get(`avoid_ferries`)===`on`,avoidIndoor:e.get(`avoid_indoor`)===`on`},departureTime:e.get(`departure_time`)===``?void 0:new Date(e.get(`departure_time`)),extraComputations:i,requestedReferenceRoutes:a,transitPreference:o};if(e.get(`traffic_aware_polyline`)===`on`&&i.push(s.TRAFFIC_ON_POLYLINE),e.get(`shorter_distance`)===`on`&&a.push(c.SHORTER_DISTANCE),e.get(`eco_routes`)===`on`&&(a.push(c.FUEL_EFFICIENT),i.push(s.FUEL_CONSUMPTION),l.routeModifiers.vehicleInfo={emissionType:e.get(`emission_type`)}),t===`TRANSIT`){let t=document.querySelectorAll(`ul#transitModes li input[type="checkbox"]:checked`);o.allowedTransitModes=Array.from(t,e=>e.value),o.routingPreference=e.get(`transit_preference`)}return l}function h(e,t,n,r){if(!t)throw Error(`Location is required.`);let i=/^-?\d+(\.\d+)?,\s*-?\d+(\.\d+)?$/,a=t,o=n&&r!==`TRANSIT`?Number(n):void 0;return e.predictionText===a&&e.location?{lat:e.location.lat(),lng:e.location.lng(),altitude:0,heading:o}:i.test(a)?{lat:Number(a.split(`,`)[0]),lng:Number(a.split(`,`)[1]),altitude:0,heading:o}:a}function g(e){let t=document.getElementById(`alert`);t.querySelector(`p`).textContent=e,t.style.display=`flex`}async function _(n,r){t=t.concat(n.createPolylines({polylineOptions:r?{map:d.innerMap,zIndex:1}:{map:d.innerMap,strokeColor:`#669DF6`,strokeOpacity:.5,strokeWeight:8},colorScheme:d.innerMap.get(`colorScheme`)})),r&&(e=e.concat(await n.createWaypointAdvancedMarkers({map:d.innerMap,zIndex:1})),n.viewport&&d.innerMap.fitBounds(n.viewport)),v(n,Math.floor(n.path.length/2))}function v(t,n){let r=document.createElement(`div`);if(r.className=`route-tag`,t.routeLabels&&t.routeLabels.length>0){let e=document.createElement(`p`);t.routeLabels.forEach((n,i)=>{n.includes(u.FUEL_EFFICIENT)&&r.classList.add(`eco`),n.includes(u.DEFAULT_ROUTE_ALTERNATE)&&r.classList.add(`alternate`),n.includes(u.SHORTER_DISTANCE)&&r.classList.add(`shorter-distance`),e.appendChild(document.createTextNode(n)),i{e.map=null}),e.length=0,t.forEach(e=>{e.setMap(null)}),t.length=0}function b(){if(!d?.innerMap)return;let e=document.getElementById(`infowindow-alert`);e||(e=document.createElement(`div`),e.id=e.className=`infowindow-alert`,e.textContent=`Lat/Lng are copied to clipboard`);let t=new i,n;d.innerMap.addListener(`click`,async r=>{r.latLng&&(t.close(),n&&clearTimeout(n),t.setContent(e),t.setPosition({lat:r.latLng.lat(),lng:r.latLng.lng()}),await navigator.clipboard.writeText(`${r.latLng.lat()},${r.latLng.lng()}`),t.open(d.innerMap),n=window.setTimeout(()=>{t.close()},2e3))})}function x(){let e=document.getElementById(`travel-mode`),t=document.getElementById(`routing-preference`),n=document.getElementById(`traffic-aware-polyline`),r=document.getElementById(`eco-routes`),i=document.getElementById(`emission-type`);e.addEventListener(`change`,()=>{e.value===`WALKING`||e.value===`BICYCLING`||e.value===`TRANSIT`?(t.disabled=!0,t.value=``):(t.disabled=!1,t.value=t.value||`TRAFFIC_UNAWARE`),a(),document.getElementById(`transit-options`).style.display=e.value===`TRANSIT`?`flex`:`none`}),t.addEventListener(`change`,()=>{a()}),r.addEventListener(`change`,()=>{r.checked?i.disabled=!1:i.disabled=!0});function a(){!t.value||t.value===`TRAFFIC_UNAWARE`?(n.checked=!1,n.disabled=!0):n.disabled=!1}}function S(){let e=document.getElementById(`alert`);e.querySelector(`.close`).addEventListener(`click`,()=>{e.style.display!==`none`&&(e.style.display=`none`)})}function C(){let e=new o({name:`origin_location`}),t=new o({name:`destination_location`});[[e,n],[t,r]].forEach(([e,t])=>{e.addEventListener(`gmp-select`,async e=>{t.predictionText=e.placePrediction.text.text;let n=e.placePrediction.toPlace();await n.fetchFields({fields:[`location`]}),t.location=n.location})}),document.getElementById(`origin-input`)?.appendChild(e),document.getElementById(`destination-input`)?.appendChild(t)}function w(){let e=document.getElementById(`departure-time`),t=document.getElementById(`utc-output`);e.addEventListener(`change`,()=>{t.textContent=`UTC time: ${new Date(e.value).toUTCString()}`})}}i(); \ No newline at end of file diff --git a/dist/samples/routes-compute-routes/dist/assets/index-CDtxAlDI.js b/dist/samples/routes-compute-routes/dist/assets/index-CDtxAlDI.js deleted file mode 100644 index e7d4fa614..000000000 --- a/dist/samples/routes-compute-routes/dist/assets/index-CDtxAlDI.js +++ /dev/null @@ -1 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[],t=[],n={predictionText:null,location:null},r={predictionText:null,location:null};async function i(){let[{InfoWindow:i},{AdvancedMarkerElement:a},{PlaceAutocompleteElement:o},{ComputeRoutesExtraComputation:s,ReferenceRoute:c,Route:l,RouteLabel:u}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`),google.maps.importLibrary(`routes`)]),d=document.getElementById(`map`);f(),C(),b(),x(),S(),w();function f(){let e=document.getElementById(`compute-routes-form`);e.addEventListener(`submit`,t=>{t.preventDefault(),p(new FormData(e))})}async function p(e){y();try{let{routes:t}=await l.computeRoutes(m(e));if(!t){console.log(`No routes returned.`);return}console.log(`Routes:`),t.forEach(e=>{console.log(e.toJSON())}),await Promise.all(t.map(e=>_(e,!!e.routeLabels?.includes(u.DEFAULT_ROUTE))))}catch(e){console.error(e),g(e.message||`Unknown error.`)}}function m(e){let t=e.get(`travel_mode`)===``?void 0:e.get(`travel_mode`),i=[],a=[],o={},l={origin:{location:h(n,e.get(`origin_location`),e.get(`heading_org`),t),vehicleStopover:e.get(`origin_stopover`)===`on`,sideOfRoad:e.get(`origin_side_of_road`)===`on`},destination:{location:h(r,e.get(`destination_location`),e.get(`heading_dest`),t),vehicleStopover:e.get(`destination_stopover`)===`on`,sideOfRoad:e.get(`destination_side_of_road`)===`on`},fields:Array.from(document.querySelectorAll(`ul#fields li input[type="checkbox"]:checked`),e=>e.value),travelMode:t,routingPreference:e.get(`routing_preference`)===``?void 0:e.get(`routing_preference`),polylineQuality:e.get(`polyline_quality`)===``?void 0:e.get(`polyline_quality`),computeAlternativeRoutes:e.get(`compute_alternative_routes`)===`on`,routeModifiers:{avoidTolls:e.get(`avoid_tolls`)===`on`,avoidHighways:e.get(`avoid_highways`)===`on`,avoidFerries:e.get(`avoid_ferries`)===`on`,avoidIndoor:e.get(`avoid_indoor`)===`on`},departureTime:e.get(`departure_time`)===``?void 0:new Date(e.get(`departure_time`)),extraComputations:i,requestedReferenceRoutes:a,transitPreference:o};if(e.get(`traffic_aware_polyline`)===`on`&&i.push(s.TRAFFIC_ON_POLYLINE),e.get(`shorter_distance`)===`on`&&a.push(c.SHORTER_DISTANCE),e.get(`eco_routes`)===`on`&&(a.push(c.FUEL_EFFICIENT),i.push(s.FUEL_CONSUMPTION),l.routeModifiers.vehicleInfo={emissionType:e.get(`emission_type`)}),t===`TRANSIT`){let t=document.querySelectorAll(`ul#transitModes li input[type="checkbox"]:checked`);o.allowedTransitModes=Array.from(t,e=>e.value),o.routingPreference=e.get(`transit_preference`)===``?void 0:e.get(`transit_preference`)}return l}function h(e,t,n,r){if(!t)throw Error(`Location is required.`);let i=/^-?\d+(\.\d+)?,\s*-?\d+(\.\d+)?$/,a=t,o=n&&r!==`TRANSIT`?Number(n):void 0;return e.predictionText===a&&e.location?{lat:e.location.lat(),lng:e.location.lng(),altitude:0,heading:o}:i.test(a)?{lat:Number(a.split(`,`)[0]),lng:Number(a.split(`,`)[1]),altitude:0,heading:o}:a}function g(e){let t=document.getElementById(`alert`);t.querySelector(`p`).textContent=e,t.style.display=`flex`}async function _(n,r){t=t.concat(n.createPolylines({polylineOptions:r?{map:d.innerMap,zIndex:1}:{map:d.innerMap,strokeColor:`#669DF6`,strokeOpacity:.5,strokeWeight:8},colorScheme:d.innerMap.get(`colorScheme`)})),r&&(e=e.concat(await n.createWaypointAdvancedMarkers({map:d.innerMap,zIndex:1})),n.viewport&&d.innerMap.fitBounds(n.viewport)),v(n,Math.floor(n.path.length/2))}function v(t,n){let r=document.createElement(`div`);if(r.className=`route-tag`,t.routeLabels&&t.routeLabels.length>0){let e=document.createElement(`p`);t.routeLabels.forEach((n,i)=>{n.includes(u.FUEL_EFFICIENT)&&r.classList.add(`eco`),n.includes(u.DEFAULT_ROUTE_ALTERNATE)&&r.classList.add(`alternate`),n.includes(u.SHORTER_DISTANCE)&&r.classList.add(`shorter-distance`),e.appendChild(document.createTextNode(n)),i{e.map=null}),e.length=0,t.forEach(e=>{e.setMap(null)}),t.length=0}function b(){if(!d||!d.innerMap)return;let e=document.getElementById(`infowindow-alert`);e||(e=document.createElement(`div`),e.id=e.className=`infowindow-alert`,e.textContent=`Lat/Lng are copied to clipboard`);let t=new i,n;d.innerMap.addListener(`click`,async r=>{r.latLng&&(t.close(),n&&clearTimeout(n),t.setContent(e),t.setPosition({lat:r.latLng.lat(),lng:r.latLng.lng()}),await navigator.clipboard.writeText(`${r.latLng.lat()},${r.latLng.lng()}`),t.open(d.innerMap),n=window.setTimeout(()=>{t.close()},2e3))})}function x(){let e=document.getElementById(`travel-mode`),t=document.getElementById(`routing-preference`),n=document.getElementById(`traffic-aware-polyline`),r=document.getElementById(`eco-routes`),i=document.getElementById(`emission-type`);e.addEventListener(`change`,()=>{e.value===`WALKING`||e.value===`BICYCLING`||e.value===`TRANSIT`?(t.disabled=!0,t.value=``):(t.disabled=!1,t.value=t.value||`TRAFFIC_UNAWARE`),a(),document.getElementById(`transit-options`).style.display=e.value===`TRANSIT`?`flex`:`none`}),t.addEventListener(`change`,()=>{a()}),r.addEventListener(`change`,()=>{r.checked?i.disabled=!1:i.disabled=!0});function a(){!t.value||t.value===`TRAFFIC_UNAWARE`?(n.checked=!1,n.disabled=!0):n.disabled=!1}}function S(){let e=document.getElementById(`alert`);e.querySelector(`.close`).addEventListener(`click`,()=>{e.style.display!==`none`&&(e.style.display=`none`)})}function C(){let e=new o({name:`origin_location`}),t=new o({name:`destination_location`});[[e,n],[t,r]].forEach(([e,t])=>{e.addEventListener(`gmp-select`,async e=>{t.predictionText=e.placePrediction.text.text;let n=e.placePrediction.toPlace();await n.fetchFields({fields:[`location`]}),t.location=n.location})}),document.getElementById(`origin-input`)?.appendChild(e),document.getElementById(`destination-input`)?.appendChild(t)}function w(){let e=document.getElementById(`departure-time`),t=document.getElementById(`utc-output`);e.addEventListener(`change`,()=>{t.textContent=`UTC time: ${new Date(e.value).toUTCString()}`})}}i(); \ No newline at end of file diff --git a/dist/samples/routes-compute-routes/dist/index.html b/dist/samples/routes-compute-routes/dist/index.html index 79ebf4432..223c3e9c8 100644 --- a/dist/samples/routes-compute-routes/dist/index.html +++ b/dist/samples/routes-compute-routes/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/routes-compute-routes/docs/index.js b/dist/samples/routes-compute-routes/docs/index.js index 9ad3c09b8..23747096a 100644 --- a/dist/samples/routes-compute-routes/docs/index.js +++ b/dist/samples/routes-compute-routes/docs/index.js @@ -4,6 +4,7 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ + // [START maps_routes_compute_routes] let markers = []; let polylines = []; @@ -21,7 +22,7 @@ async function init() { const [ { InfoWindow }, { AdvancedMarkerElement }, - // @ts-expect-error - currently missing. bug fix pending + { PlaceAutocompleteElement }, { ComputeRoutesExtraComputation, ReferenceRoute, Route, RouteLabel }, ] = await Promise.all([ @@ -84,10 +85,7 @@ async function init() { } function buildComputeRoutesJsRequest(formData) { - const travelMode = - formData.get('travel_mode') === '' - ? undefined - : formData.get('travel_mode'); + const travelMode = formData.get('travel_mode') || undefined; const extraComputations = []; const requestedReferenceRoutes = []; const transitPreference = {}; @@ -119,15 +117,9 @@ async function init() { ), (input) => input.value ), - travelMode: travelMode, - routingPreference: - formData.get('routing_preference') === '' - ? undefined - : formData.get('routing_preference'), - polylineQuality: - formData.get('polyline_quality') === '' - ? undefined - : formData.get('polyline_quality'), + travelMode, + routingPreference: formData.get('routing_preference') || undefined, + polylineQuality: formData.get('polyline_quality') || undefined, computeAlternativeRoutes: formData.get('compute_alternative_routes') === 'on', routeModifiers: { @@ -174,9 +166,7 @@ async function init() { (input) => input.value ); transitPreference.routingPreference = - formData.get('transit_preference') === '' - ? undefined - : formData.get('transit_preference'); + formData.get('transit_preference'); } return request; @@ -333,7 +323,7 @@ async function init() { } function attachMapClickListener() { - if (!map || !map.innerMap) { + if (!map?.innerMap) { return; } diff --git a/dist/samples/routes-compute-routes/docs/index.ts b/dist/samples/routes-compute-routes/docs/index.ts index 6616169b3..52e17d0b0 100644 --- a/dist/samples/routes-compute-routes/docs/index.ts +++ b/dist/samples/routes-compute-routes/docs/index.ts @@ -3,6 +3,10 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ + +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ + // [START maps_routes_compute_routes] let markers: google.maps.marker.AdvancedMarkerElement[] = []; let polylines: google.maps.Polyline[] = []; @@ -91,9 +95,8 @@ async function init() { formData: FormData ): google.maps.routes.ComputeRoutesRequest { const travelMode = - (formData.get('travel_mode') as string) === '' - ? undefined - : formData.get('travel_mode'); + (formData.get('travel_mode') as google.maps.TravelModeString) || + undefined; const extraComputations: google.maps.routes.ComputeRoutesExtraComputation[] = []; const requestedReferenceRoutes: google.maps.routes.ReferenceRoute[] = @@ -127,19 +130,15 @@ async function init() { ), (input) => (input as HTMLInputElement).value ), - travelMode: travelMode as google.maps.TravelMode, + travelMode, routingPreference: - formData.get('routing_preference') === '' - ? undefined - : (formData.get( - 'routing_preference' - ) as google.maps.routes.RoutingPreference), + (formData.get( + 'routing_preference' + ) as google.maps.routes.RoutingPreferenceString) || undefined, polylineQuality: - formData.get('polyline_quality') === '' - ? undefined - : (formData.get( - 'polyline_quality' - ) as google.maps.routes.PolylineQuality), + (formData.get( + 'polyline_quality' + ) as google.maps.routes.PolylineQualityString) || undefined, computeAlternativeRoutes: formData.get('compute_alternative_routes') === 'on', routeModifiers: { @@ -188,12 +187,9 @@ async function init() { (input) => (input as HTMLInputElement).value as google.maps.TransitMode ); - transitPreference.routingPreference = - formData.get('transit_preference') === '' - ? undefined - : (formData.get( - 'transit_preference' - ) as google.maps.TransitRoutePreference); + transitPreference.routingPreference = formData.get( + 'transit_preference' + ) as google.maps.TransitRoutePreferenceString; } return request; @@ -203,7 +199,7 @@ async function init() { autocompleteSelection: PlaceAutocompleteSelection, locationInput?: FormDataEntryValue | null, headingInput?: FormDataEntryValue | null, - travelModeInput?: FormDataEntryValue | null + travelModeInput?: google.maps.TravelModeString | null ): string | google.maps.routes.DirectionalLocationLiteral { if (!locationInput) { throw new Error('Location is required.'); @@ -244,7 +240,7 @@ async function init() { } function setErrorMessage(error: string) { - const alertBox = document.getElementById('alert') as HTMLDivElement; + const alertBox = document.getElementById('alert')!; alertBox.querySelector('p')!.textContent = error; alertBox.style.display = 'flex'; } @@ -356,7 +352,7 @@ async function init() { } function attachMapClickListener() { - if (!map || !map.innerMap) { + if (!map?.innerMap) { return; } @@ -436,9 +432,8 @@ async function init() { toggleTrafficAwarePolyline(); // Toggle transit options for Transit mode - ( - document.getElementById('transit-options') as HTMLElement - ).style.display = travelMode.value === 'TRANSIT' ? 'flex' : 'none'; + document.getElementById('transit-options')!.style.display = + travelMode.value === 'TRANSIT' ? 'flex' : 'none'; }); routingPreference.addEventListener('change', () => { @@ -467,7 +462,7 @@ async function init() { } function attachAlertWindowListener() { - const alertBox = document.getElementById('alert') as HTMLDivElement; + const alertBox = document.getElementById('alert')!; const closeBtn = alertBox.querySelector('.close')!; closeBtn.addEventListener('click', () => { if (alertBox.style.display !== 'none') { diff --git a/dist/samples/routes-compute-routes/jsfiddle/demo.js b/dist/samples/routes-compute-routes/jsfiddle/demo.js index 234b98927..0ce5cb74f 100644 --- a/dist/samples/routes-compute-routes/jsfiddle/demo.js +++ b/dist/samples/routes-compute-routes/jsfiddle/demo.js @@ -21,7 +21,7 @@ async function init() { const [ { InfoWindow }, { AdvancedMarkerElement }, - // @ts-expect-error - currently missing. bug fix pending + { PlaceAutocompleteElement }, { ComputeRoutesExtraComputation, ReferenceRoute, Route, RouteLabel }, ] = await Promise.all([ @@ -84,10 +84,7 @@ async function init() { } function buildComputeRoutesJsRequest(formData) { - const travelMode = - formData.get('travel_mode') === '' - ? undefined - : formData.get('travel_mode'); + const travelMode = formData.get('travel_mode') || undefined; const extraComputations = []; const requestedReferenceRoutes = []; const transitPreference = {}; @@ -119,15 +116,9 @@ async function init() { ), (input) => input.value ), - travelMode: travelMode, - routingPreference: - formData.get('routing_preference') === '' - ? undefined - : formData.get('routing_preference'), - polylineQuality: - formData.get('polyline_quality') === '' - ? undefined - : formData.get('polyline_quality'), + travelMode, + routingPreference: formData.get('routing_preference') || undefined, + polylineQuality: formData.get('polyline_quality') || undefined, computeAlternativeRoutes: formData.get('compute_alternative_routes') === 'on', routeModifiers: { @@ -174,9 +165,7 @@ async function init() { (input) => input.value ); transitPreference.routingPreference = - formData.get('transit_preference') === '' - ? undefined - : formData.get('transit_preference'); + formData.get('transit_preference'); } return request; @@ -333,7 +322,7 @@ async function init() { } function attachMapClickListener() { - if (!map || !map.innerMap) { + if (!map?.innerMap) { return; } diff --git a/dist/samples/routes-get-alternatives/app/index.ts b/dist/samples/routes-get-alternatives/app/index.ts index 88ea67482..07209ccde 100644 --- a/dist/samples/routes-get-alternatives/app/index.ts +++ b/dist/samples/routes-get-alternatives/app/index.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ // [START maps_routes_get_alternatives] -let mapPolylines: google.maps.Polyline[] = []; +const mapPolylines: google.maps.Polyline[] = []; const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; @@ -33,6 +33,7 @@ async function getDirections() { const [{ Route, RouteLabel }] = await Promise.all([ google.maps.importLibrary('routes'), ]); + // [START maps_routes_get_alternatives_request_full] // [START maps_routes_get_alternatives_request] // Build a request. @@ -53,7 +54,7 @@ async function getDirections() { return; } - let primaryRoute; + let primaryRoute: google.maps.routes.Route | undefined; for (const route of result.routes) { // Save the primary route for last so it's drawn on top. @@ -70,7 +71,7 @@ async function getDirections() { if (primaryRoute) { drawRoute(primaryRoute, true); await primaryRoute.createWaypointAdvancedMarkers({ map: innerMap }); - innerMap.fitBounds(primaryRoute.viewport, 50); + innerMap.fitBounds(primaryRoute.viewport!, 50); innerMap.setHeading(70); } // [END maps_routes_get_alternatives_compute] @@ -80,9 +81,9 @@ async function getDirections() { console.log(`Response:\n ${JSON.stringify(result, null, 2)}`); } -function drawRoute(route, isPrimaryRoute) { - mapPolylines = mapPolylines.concat( - route.createPolylines({ +function drawRoute(route: google.maps.routes.Route, isPrimaryRoute: boolean) { + mapPolylines.push( + ...route.createPolylines({ polylineOptions: isPrimaryRoute ? { map: innerMap, @@ -94,7 +95,9 @@ function drawRoute(route, isPrimaryRoute) { strokeOpacity: 0.5, strokeWeight: 5, }, - colorScheme: innerMap.get('colorScheme'), + colorScheme: innerMap!.get( + 'colorScheme' + ) as google.maps.ColorScheme, }) ); } diff --git a/dist/samples/routes-get-alternatives/dist/assets/index-CYpnwxIJ.js b/dist/samples/routes-get-alternatives/dist/assets/index-Bh-yK8tk.js similarity index 90% rename from dist/samples/routes-get-alternatives/dist/assets/index-CYpnwxIJ.js rename to dist/samples/routes-get-alternatives/dist/assets/index-Bh-yK8tk.js index dd8b203b1..bba8ab8c1 100644 --- a/dist/samples/routes-get-alternatives/dist/assets/index-CYpnwxIJ.js +++ b/dist/samples/routes-get-alternatives/dist/assets/index-Bh-yK8tk.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[],t=document.querySelector(`gmp-map`),n;async function r(){let[{event:e}]=await Promise.all([google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);n=t.innerMap,n.setOptions({mapTypeControl:!1,mapId:`DEMO_MAP_ID`}),e.addListenerOnce(n,`idle`,()=>{i()})}async function i(){let[{Route:e,RouteLabel:t}]=await Promise.all([google.maps.importLibrary(`routes`)]),r=await e.computeRoutes({origin:`San Francisco, CA`,destination:`Sunset Dr Pacific Grove, CA 93950`,travelMode:`DRIVING`,computeAlternativeRoutes:!0,fields:[`path`,`routeLabels`,`viewport`]});if(!r.routes||r.routes.length===0){console.warn(`No routes found`);return}let i;for(let e of r.routes)e.routeLabels?.includes(t.DEFAULT_ROUTE)?i=e:a(e,!1);i&&(a(i,!0),await i.createWaypointAdvancedMarkers({map:n}),n.fitBounds(i.viewport,50),n.setHeading(70)),console.log(`Response:\n ${JSON.stringify(r,null,2)}`)}function a(t,r){e=e.concat(t.createPolylines({polylineOptions:r?{map:n,strokeWeight:5}:{map:n,strokeColor:`#669DF6`,strokeOpacity:.5,strokeWeight:5},colorScheme:n.get(`colorScheme`)}))}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[],t=document.querySelector(`gmp-map`),n;async function r(){let[{event:e}]=await Promise.all([google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);n=t.innerMap,n.setOptions({mapTypeControl:!1,mapId:`DEMO_MAP_ID`}),e.addListenerOnce(n,`idle`,()=>{i()})}async function i(){let[{Route:e,RouteLabel:t}]=await Promise.all([google.maps.importLibrary(`routes`)]),r=await e.computeRoutes({origin:`San Francisco, CA`,destination:`Sunset Dr Pacific Grove, CA 93950`,travelMode:`DRIVING`,computeAlternativeRoutes:!0,fields:[`path`,`routeLabels`,`viewport`]});if(!r.routes||r.routes.length===0){console.warn(`No routes found`);return}let i;for(let e of r.routes)e.routeLabels?.includes(t.DEFAULT_ROUTE)?i=e:a(e,!1);i&&(a(i,!0),await i.createWaypointAdvancedMarkers({map:n}),n.fitBounds(i.viewport,50),n.setHeading(70)),console.log(`Response:\n ${JSON.stringify(r,null,2)}`)}function a(t,r){e.push(...t.createPolylines({polylineOptions:r?{map:n,strokeWeight:5}:{map:n,strokeColor:`#669DF6`,strokeOpacity:.5,strokeWeight:5},colorScheme:n.get(`colorScheme`)}))}r(); \ No newline at end of file diff --git a/dist/samples/routes-get-alternatives/dist/index.html b/dist/samples/routes-get-alternatives/dist/index.html index d362525f0..1ee03fd44 100644 --- a/dist/samples/routes-get-alternatives/dist/index.html +++ b/dist/samples/routes-get-alternatives/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/routes-get-alternatives/docs/index.js b/dist/samples/routes-get-alternatives/docs/index.js index 96434ccb2..c142067ac 100644 --- a/dist/samples/routes-get-alternatives/docs/index.js +++ b/dist/samples/routes-get-alternatives/docs/index.js @@ -5,7 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 */ // [START maps_routes_get_alternatives] -let mapPolylines = []; +const mapPolylines = []; const mapElement = document.querySelector('gmp-map'); let innerMap; @@ -34,6 +34,7 @@ async function getDirections() { const [{ Route, RouteLabel }] = await Promise.all([ google.maps.importLibrary('routes'), ]); + // [START maps_routes_get_alternatives_request_full] // [START maps_routes_get_alternatives_request] // Build a request. @@ -82,8 +83,8 @@ async function getDirections() { } function drawRoute(route, isPrimaryRoute) { - mapPolylines = mapPolylines.concat( - route.createPolylines({ + mapPolylines.push( + ...route.createPolylines({ polylineOptions: isPrimaryRoute ? { map: innerMap, diff --git a/dist/samples/routes-get-alternatives/docs/index.ts b/dist/samples/routes-get-alternatives/docs/index.ts index 88ea67482..07209ccde 100644 --- a/dist/samples/routes-get-alternatives/docs/index.ts +++ b/dist/samples/routes-get-alternatives/docs/index.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ // [START maps_routes_get_alternatives] -let mapPolylines: google.maps.Polyline[] = []; +const mapPolylines: google.maps.Polyline[] = []; const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; @@ -33,6 +33,7 @@ async function getDirections() { const [{ Route, RouteLabel }] = await Promise.all([ google.maps.importLibrary('routes'), ]); + // [START maps_routes_get_alternatives_request_full] // [START maps_routes_get_alternatives_request] // Build a request. @@ -53,7 +54,7 @@ async function getDirections() { return; } - let primaryRoute; + let primaryRoute: google.maps.routes.Route | undefined; for (const route of result.routes) { // Save the primary route for last so it's drawn on top. @@ -70,7 +71,7 @@ async function getDirections() { if (primaryRoute) { drawRoute(primaryRoute, true); await primaryRoute.createWaypointAdvancedMarkers({ map: innerMap }); - innerMap.fitBounds(primaryRoute.viewport, 50); + innerMap.fitBounds(primaryRoute.viewport!, 50); innerMap.setHeading(70); } // [END maps_routes_get_alternatives_compute] @@ -80,9 +81,9 @@ async function getDirections() { console.log(`Response:\n ${JSON.stringify(result, null, 2)}`); } -function drawRoute(route, isPrimaryRoute) { - mapPolylines = mapPolylines.concat( - route.createPolylines({ +function drawRoute(route: google.maps.routes.Route, isPrimaryRoute: boolean) { + mapPolylines.push( + ...route.createPolylines({ polylineOptions: isPrimaryRoute ? { map: innerMap, @@ -94,7 +95,9 @@ function drawRoute(route, isPrimaryRoute) { strokeOpacity: 0.5, strokeWeight: 5, }, - colorScheme: innerMap.get('colorScheme'), + colorScheme: innerMap!.get( + 'colorScheme' + ) as google.maps.ColorScheme, }) ); } diff --git a/dist/samples/routes-get-alternatives/jsfiddle/demo.js b/dist/samples/routes-get-alternatives/jsfiddle/demo.js index 7173a79b2..9475db9db 100644 --- a/dist/samples/routes-get-alternatives/jsfiddle/demo.js +++ b/dist/samples/routes-get-alternatives/jsfiddle/demo.js @@ -5,7 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -let mapPolylines = []; +const mapPolylines = []; const mapElement = document.querySelector('gmp-map'); let innerMap; @@ -77,8 +77,8 @@ async function getDirections() { } function drawRoute(route, isPrimaryRoute) { - mapPolylines = mapPolylines.concat( - route.createPolylines({ + mapPolylines.push( + ...route.createPolylines({ polylineOptions: isPrimaryRoute ? { map: innerMap, diff --git a/dist/samples/routes-get-directions-panel/app/index.ts b/dist/samples/routes-get-directions-panel/app/index.ts index 3667cf5bb..7c7499e2e 100644 --- a/dist/samples/routes-get-directions-panel/app/index.ts +++ b/dist/samples/routes-get-directions-panel/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_routes_get_directions_panel] // Initialize and add the map. -let map; +let map: google.maps.Map; let mapPolylines: google.maps.Polyline[] = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA @@ -17,7 +17,7 @@ async function init(): Promise { google.maps.importLibrary('routes'), ]); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { zoom: 12, center, mapTypeControl: false, @@ -49,7 +49,9 @@ async function init(): Promise { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); void fitMapToPath(routes[0].path!); @@ -134,7 +136,7 @@ async function init(): Promise { } // [END maps_routes_get_directions_panel_steps] // Helper function to fit the map to the path. -async function fitMapToPath(path) { +async function fitMapToPath(path: google.maps.LatLngLiteral[]) { const { LatLngBounds } = await google.maps.importLibrary('core'); const bounds = new LatLngBounds(); path.forEach((point) => { diff --git a/dist/samples/routes-get-directions-panel/dist/assets/index-CgXLkXJe.js b/dist/samples/routes-get-directions-panel/dist/assets/index-CgXLkXJe.js deleted file mode 100644 index 68a90c444..000000000 --- a/dist/samples/routes-get-directions-panel/dist/assets/index-CgXLkXJe.js +++ /dev/null @@ -1 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t=[],n={lat:37.447646,lng:-122.113878};async function r(){let[{Map:r},{Route:a}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`routes`)]);e=new r(document.getElementById(`map`),{zoom:12,center:n,mapTypeControl:!1,mapId:`DEMO_MAP_ID`});let{routes:o}=await a.computeRoutes({origin:`Mountain View, CA`,destination:`Sausalito, CA`,intermediates:[{location:`Half Moon Bay, CA`},{location:`Pacifica Esplanade Beach`}],travelMode:`DRIVING`,fields:[`legs`,`path`]});if(console.log(`Response:\n ${JSON.stringify(o,null,2)}`),!o){console.warn(`No routes found.`);return}t=o[0].createPolylines(),t.forEach(t=>t.setMap(e)),i(o[0].path),await o[0].createWaypointAdvancedMarkers({map:e});let s=document.getElementById(`directions`);if(!o||o.length===0){s&&(s.textContent=`No routes available.`);return}let c=o[0];if(!c.legs||c.legs.length===0){s&&(s.textContent=`The route has no legs.`);return}let l=document.createDocumentFragment();c.legs.forEach((e,t)=>{let n=document.createElement(`div`);n.className=`directions-leg`;let r=document.createElement(`h3`);if(r.textContent=`Leg ${t+1} of ${c.legs.length}`,n.appendChild(r),e.steps&&e.steps.length>0){let t=document.createElement(`ol`);t.className=`directions-steps`,e.steps.forEach(e=>{let n=document.createElement(`li`);n.className=`direction-step`;let r=document.createElement(`div`);if(r.className=`direction`,e.maneuver){let t=document.createElement(`p`);t.textContent=e.maneuver,t.className=`maneuver`,r.appendChild(t)}if(e.localizedValues){let t=document.createElement(`p`);t.textContent=`${e.localizedValues.distance} (${e.localizedValues.staticDuration})`,t.className=`distance`,r.appendChild(t)}if(e.instructions){let t=document.createElement(`p`);t.textContent=e.instructions,t.className=`instruction`,r.appendChild(t)}n.appendChild(r),t.appendChild(n)}),n.appendChild(t)}l.appendChild(n),s?.appendChild(l)})}async function i(t){let{LatLngBounds:n}=await google.maps.importLibrary(`core`),r=new n;t.forEach(e=>{r.extend(e)}),e.fitBounds(r)}r(); \ No newline at end of file diff --git a/dist/samples/routes-get-directions-panel/dist/assets/index-GOecTYUK.js b/dist/samples/routes-get-directions-panel/dist/assets/index-GOecTYUK.js new file mode 100644 index 000000000..00ac75e01 --- /dev/null +++ b/dist/samples/routes-get-directions-panel/dist/assets/index-GOecTYUK.js @@ -0,0 +1 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t=[],n={lat:37.447646,lng:-122.113878};async function r(){let[{Map:r},{Route:a}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`routes`)]);e=new r(document.getElementById(`map`),{zoom:12,center:n,mapTypeControl:!1,mapId:`DEMO_MAP_ID`});let{routes:o}=await a.computeRoutes({origin:`Mountain View, CA`,destination:`Sausalito, CA`,intermediates:[{location:`Half Moon Bay, CA`},{location:`Pacifica Esplanade Beach`}],travelMode:`DRIVING`,fields:[`legs`,`path`]});if(console.log(`Response:\n ${JSON.stringify(o,null,2)}`),!o){console.warn(`No routes found.`);return}t=o[0].createPolylines(),t.forEach(t=>{t.setMap(e)}),i(o[0].path),await o[0].createWaypointAdvancedMarkers({map:e});let s=document.getElementById(`directions`);if(!o||o.length===0){s&&(s.textContent=`No routes available.`);return}let c=o[0];if(!c.legs||c.legs.length===0){s&&(s.textContent=`The route has no legs.`);return}let l=document.createDocumentFragment();c.legs.forEach((e,t)=>{let n=document.createElement(`div`);n.className=`directions-leg`;let r=document.createElement(`h3`);if(r.textContent=`Leg ${t+1} of ${c.legs.length}`,n.appendChild(r),e.steps&&e.steps.length>0){let t=document.createElement(`ol`);t.className=`directions-steps`,e.steps.forEach(e=>{let n=document.createElement(`li`);n.className=`direction-step`;let r=document.createElement(`div`);if(r.className=`direction`,e.maneuver){let t=document.createElement(`p`);t.textContent=e.maneuver,t.className=`maneuver`,r.appendChild(t)}if(e.localizedValues){let t=document.createElement(`p`);t.textContent=`${e.localizedValues.distance} (${e.localizedValues.staticDuration})`,t.className=`distance`,r.appendChild(t)}if(e.instructions){let t=document.createElement(`p`);t.textContent=e.instructions,t.className=`instruction`,r.appendChild(t)}n.appendChild(r),t.appendChild(n)}),n.appendChild(t)}l.appendChild(n),s?.appendChild(l)})}async function i(t){let{LatLngBounds:n}=await google.maps.importLibrary(`core`),r=new n;t.forEach(e=>{r.extend(e)}),e.fitBounds(r)}r(); \ No newline at end of file diff --git a/dist/samples/routes-get-directions-panel/dist/index.html b/dist/samples/routes-get-directions-panel/dist/index.html index c0c87a734..de668bb80 100644 --- a/dist/samples/routes-get-directions-panel/dist/index.html +++ b/dist/samples/routes-get-directions-panel/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/routes-get-directions-panel/docs/index.js b/dist/samples/routes-get-directions-panel/docs/index.js index 034587a13..eabbe8ddc 100644 --- a/dist/samples/routes-get-directions-panel/docs/index.js +++ b/dist/samples/routes-get-directions-panel/docs/index.js @@ -50,7 +50,9 @@ async function init() { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); void fitMapToPath(routes[0].path); diff --git a/dist/samples/routes-get-directions-panel/docs/index.ts b/dist/samples/routes-get-directions-panel/docs/index.ts index 3667cf5bb..7c7499e2e 100644 --- a/dist/samples/routes-get-directions-panel/docs/index.ts +++ b/dist/samples/routes-get-directions-panel/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_routes_get_directions_panel] // Initialize and add the map. -let map; +let map: google.maps.Map; let mapPolylines: google.maps.Polyline[] = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA @@ -17,7 +17,7 @@ async function init(): Promise { google.maps.importLibrary('routes'), ]); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { zoom: 12, center, mapTypeControl: false, @@ -49,7 +49,9 @@ async function init(): Promise { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); void fitMapToPath(routes[0].path!); @@ -134,7 +136,7 @@ async function init(): Promise { } // [END maps_routes_get_directions_panel_steps] // Helper function to fit the map to the path. -async function fitMapToPath(path) { +async function fitMapToPath(path: google.maps.LatLngLiteral[]) { const { LatLngBounds } = await google.maps.importLibrary('core'); const bounds = new LatLngBounds(); path.forEach((point) => { diff --git a/dist/samples/routes-get-directions-panel/jsfiddle/demo.js b/dist/samples/routes-get-directions-panel/jsfiddle/demo.js index b0778f18a..0ce1967f6 100644 --- a/dist/samples/routes-get-directions-panel/jsfiddle/demo.js +++ b/dist/samples/routes-get-directions-panel/jsfiddle/demo.js @@ -50,7 +50,9 @@ async function init() { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); void fitMapToPath(routes[0].path); diff --git a/dist/samples/routes-get-directions/app/index.ts b/dist/samples/routes-get-directions/app/index.ts index 761cca0bf..8df3ddd6c 100644 --- a/dist/samples/routes-get-directions/app/index.ts +++ b/dist/samples/routes-get-directions/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_routes_get_directions] // Initialize and add the map. -let map; +let map: google.maps.Map; let mapPolylines: google.maps.Polyline[] = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA @@ -18,9 +18,9 @@ async function init(): Promise { google.maps.importLibrary('routes'), ]); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { zoom: 12, - center: center, + center, mapTypeControl: false, mapId: 'DEMO_MAP_ID', }); @@ -103,7 +103,9 @@ async function init(): Promise { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); // Create markers to start and end points. const markers = await routes[0].createWaypointAdvancedMarkers(); @@ -122,7 +124,7 @@ async function init(): Promise { } // Helper function to fit the map to the path. -async function fitMapToPath(path) { +async function fitMapToPath(path: google.maps.LatLngLiteral[]) { const { LatLngBounds } = await google.maps.importLibrary('core'); const bounds = new LatLngBounds(); path.forEach((point) => { diff --git a/dist/samples/routes-get-directions/dist/assets/index-nMU14zHh.js b/dist/samples/routes-get-directions/dist/assets/index-DR_bIDcN.js similarity index 85% rename from dist/samples/routes-get-directions/dist/assets/index-nMU14zHh.js rename to dist/samples/routes-get-directions/dist/assets/index-DR_bIDcN.js index 0e2d426d7..4b84ba045 100644 --- a/dist/samples/routes-get-directions/dist/assets/index-nMU14zHh.js +++ b/dist/samples/routes-get-directions/dist/assets/index-DR_bIDcN.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t=[],n={lat:37.447646,lng:-122.113878};async function r(){let[{Map:r},{Place:a},{Route:o}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`),google.maps.importLibrary(`routes`)]);e=new r(document.getElementById(`map`),{zoom:12,center:n,mapTypeControl:!1,mapId:`DEMO_MAP_ID`}),console.log({requestWithAddressStrings:{origin:`1600 Amphitheatre Parkway, Mountain View, CA`,destination:`345 Spear Street, San Francisco, CA`,fields:[`path`]}});let s={origin:new a({id:`ChIJiQHsW0m3j4ARm69rRkrUF3w`}),destination:new a({id:`ChIJIQBpAG2ahYAR_6128GcTUEo`}),fields:[`path`]};console.log({requestWithPlaceIds:s}),console.log({requestWithLatLngs:{origin:{lat:37.422,lng:-122.084058},destination:{lat:37.774929,lng:-122.419415},fields:[`path`]}}),console.log({requestWithPlusCodes:{origin:`849VCWC8+R9`,destination:`CRHJ+C3 Stanford, CA 94305, USA`,fields:[`path`]}});let{routes:c}=await o.computeRoutes({origin:`Mountain View, CA`,destination:`San Francisco, CA`,travelMode:`DRIVING`,fields:[`path`]});if(!c){console.warn(`No routes found.`);return}t=c[0].createPolylines(),t.forEach(t=>t.setMap(e)),(await c[0].createWaypointAdvancedMarkers()).forEach(t=>{t.map=e}),console.log(`Response:\n ${JSON.stringify(c,null,2)}`),i(c[0].path)}async function i(t){let{LatLngBounds:n}=await google.maps.importLibrary(`core`),r=new n;t.forEach(e=>{r.extend(e)}),e.fitBounds(r)}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t=[],n={lat:37.447646,lng:-122.113878};async function r(){let[{Map:r},{Place:a},{Route:o}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`),google.maps.importLibrary(`routes`)]);e=new r(document.getElementById(`map`),{zoom:12,center:n,mapTypeControl:!1,mapId:`DEMO_MAP_ID`}),console.log({requestWithAddressStrings:{origin:`1600 Amphitheatre Parkway, Mountain View, CA`,destination:`345 Spear Street, San Francisco, CA`,fields:[`path`]}});let s={origin:new a({id:`ChIJiQHsW0m3j4ARm69rRkrUF3w`}),destination:new a({id:`ChIJIQBpAG2ahYAR_6128GcTUEo`}),fields:[`path`]};console.log({requestWithPlaceIds:s}),console.log({requestWithLatLngs:{origin:{lat:37.422,lng:-122.084058},destination:{lat:37.774929,lng:-122.419415},fields:[`path`]}}),console.log({requestWithPlusCodes:{origin:`849VCWC8+R9`,destination:`CRHJ+C3 Stanford, CA 94305, USA`,fields:[`path`]}});let{routes:c}=await o.computeRoutes({origin:`Mountain View, CA`,destination:`San Francisco, CA`,travelMode:`DRIVING`,fields:[`path`]});if(!c){console.warn(`No routes found.`);return}t=c[0].createPolylines(),t.forEach(t=>{t.setMap(e)}),(await c[0].createWaypointAdvancedMarkers()).forEach(t=>{t.map=e}),console.log(`Response:\n ${JSON.stringify(c,null,2)}`),i(c[0].path)}async function i(t){let{LatLngBounds:n}=await google.maps.importLibrary(`core`),r=new n;t.forEach(e=>{r.extend(e)}),e.fitBounds(r)}r(); \ No newline at end of file diff --git a/dist/samples/routes-get-directions/dist/index.html b/dist/samples/routes-get-directions/dist/index.html index 6eb01c489..f8622f089 100644 --- a/dist/samples/routes-get-directions/dist/index.html +++ b/dist/samples/routes-get-directions/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/routes-get-directions/docs/index.js b/dist/samples/routes-get-directions/docs/index.js index 59afbd615..8d6cbcca1 100644 --- a/dist/samples/routes-get-directions/docs/index.js +++ b/dist/samples/routes-get-directions/docs/index.js @@ -21,7 +21,7 @@ async function init() { map = new Map(document.getElementById('map'), { zoom: 12, - center: center, + center, mapTypeControl: false, mapId: 'DEMO_MAP_ID', }); @@ -104,7 +104,9 @@ async function init() { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); // Create markers to start and end points. const markers = await routes[0].createWaypointAdvancedMarkers(); diff --git a/dist/samples/routes-get-directions/docs/index.ts b/dist/samples/routes-get-directions/docs/index.ts index 761cca0bf..8df3ddd6c 100644 --- a/dist/samples/routes-get-directions/docs/index.ts +++ b/dist/samples/routes-get-directions/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_routes_get_directions] // Initialize and add the map. -let map; +let map: google.maps.Map; let mapPolylines: google.maps.Polyline[] = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA @@ -18,9 +18,9 @@ async function init(): Promise { google.maps.importLibrary('routes'), ]); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { zoom: 12, - center: center, + center, mapTypeControl: false, mapId: 'DEMO_MAP_ID', }); @@ -103,7 +103,9 @@ async function init(): Promise { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); // Create markers to start and end points. const markers = await routes[0].createWaypointAdvancedMarkers(); @@ -122,7 +124,7 @@ async function init(): Promise { } // Helper function to fit the map to the path. -async function fitMapToPath(path) { +async function fitMapToPath(path: google.maps.LatLngLiteral[]) { const { LatLngBounds } = await google.maps.importLibrary('core'); const bounds = new LatLngBounds(); path.forEach((point) => { diff --git a/dist/samples/routes-get-directions/jsfiddle/demo.js b/dist/samples/routes-get-directions/jsfiddle/demo.js index 5de710efd..fb084196f 100644 --- a/dist/samples/routes-get-directions/jsfiddle/demo.js +++ b/dist/samples/routes-get-directions/jsfiddle/demo.js @@ -21,7 +21,7 @@ async function init() { map = new Map(document.getElementById('map'), { zoom: 12, - center: center, + center, mapTypeControl: false, mapId: 'DEMO_MAP_ID', }); @@ -95,7 +95,9 @@ async function init() { } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. - mapPolylines.forEach((polyline) => polyline.setMap(map)); + mapPolylines.forEach((polyline) => { + polyline.setMap(map); + }); // Create markers to start and end points. const markers = await routes[0].createWaypointAdvancedMarkers(); diff --git a/dist/samples/routes-markers/app/index.ts b/dist/samples/routes-markers/app/index.ts index 6a30f9253..04b28be92 100644 --- a/dist/samples/routes-markers/app/index.ts +++ b/dist/samples/routes-markers/app/index.ts @@ -117,7 +117,9 @@ async function getDirections() { // Create polylines and add them to the map. mapPolylines = result.routes[0].createPolylines(); - mapPolylines.forEach((polyline) => polyline.setMap(innerMap)); + mapPolylines.forEach((polyline) => { + polyline.setMap(innerMap); + }); } void init(); diff --git a/dist/samples/routes-markers/dist/assets/index-DeGHbAh6.js b/dist/samples/routes-markers/dist/assets/index-BtjB8wjs.js similarity index 96% rename from dist/samples/routes-markers/dist/assets/index-DeGHbAh6.js rename to dist/samples/routes-markers/dist/assets/index-BtjB8wjs.js index 11b7c7eda..8edd9b557 100644 --- a/dist/samples/routes-markers/dist/assets/index-DeGHbAh6.js +++ b/dist/samples/routes-markers/dist/assets/index-BtjB8wjs.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[],t=document.querySelector(`gmp-map`),n;async function r(){let[{event:e}]=await Promise.all([google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);n=t.innerMap,n.setOptions({mapTypeControl:!1,mapId:`DEMO_MAP_ID`}),e.addListenerOnce(n,`idle`,()=>{i()})}async function i(){let[{Route:t},{PinElement:r}]=await Promise.all([google.maps.importLibrary(`routes`),google.maps.importLibrary(`marker`)]),i=await t.computeRoutes({origin:`Parking lot, Christmas Tree Point Rd, San Francisco, CA 94131`,destination:`100 Spinnaker Dr, Sausalito, CA 94965`,intermediates:[{location:`300 Finley Rd San Francisco, CA 94129`}],travelMode:`DRIVING`,fields:[`path`,`legs`,`viewport`]});if(!i.routes||i.routes.length===0){console.warn(`No routes found`);return}function a(e,t){let{index:i,totalMarkers:a}=t;return i===0?{...e,map:n,content:new r({glyphText:(i+1).toString(),glyphColor:`white`,background:`green`,borderColor:`green`})}:i===0||i===a-1?i===a-1?{...e,map:n,content:new r({glyphText:(i+1).toString(),glyphColor:`white`,background:`red`,borderColor:`red`})}:{...e,map:n}:{...e,map:n,content:new r({glyphText:(i+1).toString(),glyphColor:`white`,background:`blue`,borderColor:`blue`})}}await i.routes[0].createWaypointAdvancedMarkers(a),n.fitBounds(i.routes[0].viewport),n.setHeading(270),e=i.routes[0].createPolylines(),e.forEach(e=>e.setMap(n))}r(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=[],t=document.querySelector(`gmp-map`),n;async function r(){let[{event:e}]=await Promise.all([google.maps.importLibrary(`core`),google.maps.importLibrary(`maps`)]);n=t.innerMap,n.setOptions({mapTypeControl:!1,mapId:`DEMO_MAP_ID`}),e.addListenerOnce(n,`idle`,()=>{i()})}async function i(){let[{Route:t},{PinElement:r}]=await Promise.all([google.maps.importLibrary(`routes`),google.maps.importLibrary(`marker`)]),i=await t.computeRoutes({origin:`Parking lot, Christmas Tree Point Rd, San Francisco, CA 94131`,destination:`100 Spinnaker Dr, Sausalito, CA 94965`,intermediates:[{location:`300 Finley Rd San Francisco, CA 94129`}],travelMode:`DRIVING`,fields:[`path`,`legs`,`viewport`]});if(!i.routes||i.routes.length===0){console.warn(`No routes found`);return}function a(e,t){let{index:i,totalMarkers:a}=t;return i===0?{...e,map:n,content:new r({glyphText:(i+1).toString(),glyphColor:`white`,background:`green`,borderColor:`green`})}:i===0||i===a-1?i===a-1?{...e,map:n,content:new r({glyphText:(i+1).toString(),glyphColor:`white`,background:`red`,borderColor:`red`})}:{...e,map:n}:{...e,map:n,content:new r({glyphText:(i+1).toString(),glyphColor:`white`,background:`blue`,borderColor:`blue`})}}await i.routes[0].createWaypointAdvancedMarkers(a),n.fitBounds(i.routes[0].viewport),n.setHeading(270),e=i.routes[0].createPolylines(),e.forEach(e=>{e.setMap(n)})}r(); \ No newline at end of file diff --git a/dist/samples/routes-markers/dist/index.html b/dist/samples/routes-markers/dist/index.html index 9390e4972..290264854 100644 --- a/dist/samples/routes-markers/dist/index.html +++ b/dist/samples/routes-markers/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/routes-markers/docs/index.js b/dist/samples/routes-markers/docs/index.js index 24bc4eb88..de3c18d13 100644 --- a/dist/samples/routes-markers/docs/index.js +++ b/dist/samples/routes-markers/docs/index.js @@ -115,7 +115,9 @@ async function getDirections() { // Create polylines and add them to the map. mapPolylines = result.routes[0].createPolylines(); - mapPolylines.forEach((polyline) => polyline.setMap(innerMap)); + mapPolylines.forEach((polyline) => { + polyline.setMap(innerMap); + }); } void init(); diff --git a/dist/samples/routes-markers/docs/index.ts b/dist/samples/routes-markers/docs/index.ts index 6a30f9253..04b28be92 100644 --- a/dist/samples/routes-markers/docs/index.ts +++ b/dist/samples/routes-markers/docs/index.ts @@ -117,7 +117,9 @@ async function getDirections() { // Create polylines and add them to the map. mapPolylines = result.routes[0].createPolylines(); - mapPolylines.forEach((polyline) => polyline.setMap(innerMap)); + mapPolylines.forEach((polyline) => { + polyline.setMap(innerMap); + }); } void init(); diff --git a/dist/samples/routes-markers/jsfiddle/demo.js b/dist/samples/routes-markers/jsfiddle/demo.js index c96f82d66..f17d28de3 100644 --- a/dist/samples/routes-markers/jsfiddle/demo.js +++ b/dist/samples/routes-markers/jsfiddle/demo.js @@ -109,7 +109,9 @@ async function getDirections() { // Create polylines and add them to the map. mapPolylines = result.routes[0].createPolylines(); - mapPolylines.forEach((polyline) => polyline.setMap(innerMap)); + mapPolylines.forEach((polyline) => { + polyline.setMap(innerMap); + }); } void init(); diff --git a/dist/samples/routes-route-matrix/app/index.ts b/dist/samples/routes-route-matrix/app/index.ts index 313af0a35..601e75dee 100644 --- a/dist/samples/routes-route-matrix/app/index.ts +++ b/dist/samples/routes-route-matrix/app/index.ts @@ -5,7 +5,7 @@ */ // [START maps_routes_route_matrix] // Initialize and add the map. -let map; +let map: google.maps.Map; const markers: google.maps.marker.AdvancedMarkerElement[] = []; const center = { lat: 51.55, lng: -1.8 }; @@ -27,9 +27,9 @@ async function init(): Promise { const bounds = new LatLngBounds(); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { zoom: 8, - center: center, + center, mapId: 'DEMO_MAP_ID', }); @@ -67,15 +67,21 @@ async function init(): Promise { // [END maps_routes_route_matrix_request] // Show the request. - (document.getElementById('request') as HTMLDivElement).innerText = - JSON.stringify(request, null, 2); + document.getElementById('request')!.innerText = JSON.stringify( + request, + null, + 2 + ); // Get the RouteMatrix response. const response = await RouteMatrix.computeRouteMatrix(request); // Show the response. - (document.getElementById('response') as HTMLDivElement).innerText = - JSON.stringify(response, null, 2); + document.getElementById('response')!.innerText = JSON.stringify( + response, + null, + 2 + ); // Add markers for the origins. for (const origin of origins) { @@ -98,8 +104,7 @@ async function init(): Promise { } // Add markers for the destinations. - for (let i = 0; i < destinations.length; i++) { - const destination = destinations[i]; + for (const destination of destinations) { if (destination.location) { const pin = new PinElement({ glyphText: 'D', @@ -112,7 +117,7 @@ async function init(): Promise { map, position: destination.location, content: pin, - title: `Destination: ${destination.displayName}`, + title: `Destination: ${destination.displayName ?? 'Unknown'}`, }); markers.push(marker); diff --git a/dist/samples/routes-route-matrix/dist/assets/index-BP2Te6Po.js b/dist/samples/routes-route-matrix/dist/assets/index-kv8LQK8_.js similarity index 86% rename from dist/samples/routes-route-matrix/dist/assets/index-BP2Te6Po.js rename to dist/samples/routes-route-matrix/dist/assets/index-kv8LQK8_.js index bd0ce6c39..dab9cbc17 100644 --- a/dist/samples/routes-route-matrix/dist/assets/index-BP2Te6Po.js +++ b/dist/samples/routes-route-matrix/dist/assets/index-kv8LQK8_.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t=[],n={lat:51.55,lng:-1.8};async function r(){let[{Map:r},{Place:i},{AdvancedMarkerElement:a,PinElement:o},{RouteMatrix:s},{LatLngBounds:c,UnitSystem:l}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`routes`),google.maps.importLibrary(`core`)]),u=new c;e=new r(document.getElementById(`map`),{zoom:8,center:n,mapId:`DEMO_MAP_ID`});let d=new i({id:`ChIJ83WZp86p2EcRbMrkYqGncBQ`}),f=new i({id:`ChIJCSkVvleJc0gR8HHaTGpajKc`}),p=new i({id:`ChIJYdizgWaDcUgRH9eaSy6y5I4`}),m=new i({id:`ChIJ9VPsNNQCbkgRDmeGZdsGNBQ`});await Promise.all([d.fetchFields({fields:[`location`,`displayName`]}),f.fetchFields({fields:[`location`,`displayName`]}),p.fetchFields({fields:[`location`,`displayName`]}),m.fetchFields({fields:[`location`,`displayName`]})]);let h=[p,m],g=[d,f],_={origins:g,destinations:h,travelMode:`DRIVING`,units:l.METRIC,fields:[`distanceMeters`,`durationMillis`,`condition`]};document.getElementById(`request`).innerText=JSON.stringify(_,null,2);let v=await s.computeRouteMatrix(_);document.getElementById(`response`).innerText=JSON.stringify(v,null,2);for(let n of g)if(n.location){let r=new o({glyphText:`O`,glyphColor:`white`,background:`#137333`,borderColor:`white`}),i=new a({map:e,position:n.location,title:`Origin: ${n.displayName}`});i.append(r),t.push(i),u.extend(n.location)}for(let n=0;n{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t=[],n={lat:51.55,lng:-1.8};async function r(){let[{Map:r},{Place:i},{AdvancedMarkerElement:a,PinElement:o},{RouteMatrix:s},{LatLngBounds:c,UnitSystem:l}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`routes`),google.maps.importLibrary(`core`)]),u=new c;e=new r(document.getElementById(`map`),{zoom:8,center:n,mapId:`DEMO_MAP_ID`});let d=new i({id:`ChIJ83WZp86p2EcRbMrkYqGncBQ`}),f=new i({id:`ChIJCSkVvleJc0gR8HHaTGpajKc`}),p=new i({id:`ChIJYdizgWaDcUgRH9eaSy6y5I4`}),m=new i({id:`ChIJ9VPsNNQCbkgRDmeGZdsGNBQ`});await Promise.all([d.fetchFields({fields:[`location`,`displayName`]}),f.fetchFields({fields:[`location`,`displayName`]}),p.fetchFields({fields:[`location`,`displayName`]}),m.fetchFields({fields:[`location`,`displayName`]})]);let h=[p,m],g=[d,f],_={origins:g,destinations:h,travelMode:`DRIVING`,units:l.METRIC,fields:[`distanceMeters`,`durationMillis`,`condition`]};document.getElementById(`request`).innerText=JSON.stringify(_,null,2);let v=await s.computeRouteMatrix(_);document.getElementById(`response`).innerText=JSON.stringify(v,null,2);for(let n of g)if(n.location){let r=new o({glyphText:`O`,glyphColor:`white`,background:`#137333`,borderColor:`white`}),i=new a({map:e,position:n.location,title:`Origin: ${n.displayName}`});i.append(r),t.push(i),u.extend(n.location)}for(let n of h)if(n.location){let r=new o({glyphText:`D`,glyphColor:`white`,background:`#C5221F`,borderColor:`white`}),i=new a({map:e,position:n.location,content:r,title:`Destination: ${n.displayName??`Unknown`}`});t.push(i),u.extend(n.location)}e.fitBounds(u)}r(); \ No newline at end of file diff --git a/dist/samples/routes-route-matrix/dist/index.html b/dist/samples/routes-route-matrix/dist/index.html index 8d6fca074..678938aae 100644 --- a/dist/samples/routes-route-matrix/dist/index.html +++ b/dist/samples/routes-route-matrix/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/routes-route-matrix/docs/index.js b/dist/samples/routes-route-matrix/docs/index.js index 467375c11..ad6cf0894 100644 --- a/dist/samples/routes-route-matrix/docs/index.js +++ b/dist/samples/routes-route-matrix/docs/index.js @@ -30,7 +30,7 @@ async function init() { map = new Map(document.getElementById('map'), { zoom: 8, - center: center, + center, mapId: 'DEMO_MAP_ID', }); @@ -105,8 +105,7 @@ async function init() { } // Add markers for the destinations. - for (let i = 0; i < destinations.length; i++) { - const destination = destinations[i]; + for (const destination of destinations) { if (destination.location) { const pin = new PinElement({ glyphText: 'D', @@ -119,7 +118,7 @@ async function init() { map, position: destination.location, content: pin, - title: `Destination: ${destination.displayName}`, + title: `Destination: ${destination.displayName ?? 'Unknown'}`, }); markers.push(marker); diff --git a/dist/samples/routes-route-matrix/docs/index.ts b/dist/samples/routes-route-matrix/docs/index.ts index 313af0a35..601e75dee 100644 --- a/dist/samples/routes-route-matrix/docs/index.ts +++ b/dist/samples/routes-route-matrix/docs/index.ts @@ -5,7 +5,7 @@ */ // [START maps_routes_route_matrix] // Initialize and add the map. -let map; +let map: google.maps.Map; const markers: google.maps.marker.AdvancedMarkerElement[] = []; const center = { lat: 51.55, lng: -1.8 }; @@ -27,9 +27,9 @@ async function init(): Promise { const bounds = new LatLngBounds(); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { zoom: 8, - center: center, + center, mapId: 'DEMO_MAP_ID', }); @@ -67,15 +67,21 @@ async function init(): Promise { // [END maps_routes_route_matrix_request] // Show the request. - (document.getElementById('request') as HTMLDivElement).innerText = - JSON.stringify(request, null, 2); + document.getElementById('request')!.innerText = JSON.stringify( + request, + null, + 2 + ); // Get the RouteMatrix response. const response = await RouteMatrix.computeRouteMatrix(request); // Show the response. - (document.getElementById('response') as HTMLDivElement).innerText = - JSON.stringify(response, null, 2); + document.getElementById('response')!.innerText = JSON.stringify( + response, + null, + 2 + ); // Add markers for the origins. for (const origin of origins) { @@ -98,8 +104,7 @@ async function init(): Promise { } // Add markers for the destinations. - for (let i = 0; i < destinations.length; i++) { - const destination = destinations[i]; + for (const destination of destinations) { if (destination.location) { const pin = new PinElement({ glyphText: 'D', @@ -112,7 +117,7 @@ async function init(): Promise { map, position: destination.location, content: pin, - title: `Destination: ${destination.displayName}`, + title: `Destination: ${destination.displayName ?? 'Unknown'}`, }); markers.push(marker); diff --git a/dist/samples/routes-route-matrix/jsfiddle/demo.js b/dist/samples/routes-route-matrix/jsfiddle/demo.js index 48ebbf498..23660e860 100644 --- a/dist/samples/routes-route-matrix/jsfiddle/demo.js +++ b/dist/samples/routes-route-matrix/jsfiddle/demo.js @@ -30,7 +30,7 @@ async function init() { map = new Map(document.getElementById('map'), { zoom: 8, - center: center, + center, mapId: 'DEMO_MAP_ID', }); @@ -103,8 +103,7 @@ async function init() { } // Add markers for the destinations. - for (let i = 0; i < destinations.length; i++) { - const destination = destinations[i]; + for (const destination of destinations) { if (destination.location) { const pin = new PinElement({ glyphText: 'D', @@ -117,7 +116,7 @@ async function init() { map, position: destination.location, content: pin, - title: `Destination: ${destination.displayName}`, + title: `Destination: ${destination.displayName ?? 'Unknown'}`, }); markers.push(marker); diff --git a/dist/samples/streetview-overlays/app/index.ts b/dist/samples/streetview-overlays/app/index.ts index 58e7069ad..e3d53d113 100644 --- a/dist/samples/streetview-overlays/app/index.ts +++ b/dist/samples/streetview-overlays/app/index.ts @@ -70,7 +70,7 @@ async function init() { function toggleStreetView(): void { const toggle = panorama.getVisible(); - if (toggle == false) { + if (!toggle) { panorama.setVisible(true); } else { panorama.setVisible(false); diff --git a/dist/samples/streetview-overlays/dist/assets/index-tP85ksEQ.js b/dist/samples/streetview-overlays/dist/assets/index-534vIoFg.js similarity index 95% rename from dist/samples/streetview-overlays/dist/assets/index-tP85ksEQ.js rename to dist/samples/streetview-overlays/dist/assets/index-534vIoFg.js index 5bbbd7c44..6ff0ec081 100644 --- a/dist/samples/streetview-overlays/dist/assets/index-tP85ksEQ.js +++ b/dist/samples/streetview-overlays/dist/assets/index-534vIoFg.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t;async function n(){let[{Marker:n}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),i={lat:40.729884,lng:-73.990988};t=document.querySelector(`gmp-map`).innerMap,document.getElementById(`streetview-toggle-button`).addEventListener(`click`,r);let a=document.createElement(`img`);a.src=new URL(``+new URL(`../cafe_icon.svg`,import.meta.url).href,``+import.meta.url).href;let o=document.createElement(`img`);o.src=new URL(``+new URL(`../bank_icon.svg`,import.meta.url).href,``+import.meta.url).href;let s=document.createElement(`img`);s.src=new URL(``+new URL(`../bus_icon.svg`,import.meta.url).href,``+import.meta.url).href,new n({position:{lat:40.730031,lng:-73.991428},map:t,title:`Cafe`,icon:a.src}),new n({position:{lat:40.729681,lng:-73.991138},map:t,title:`Bank`,icon:o.src}),new n({position:{lat:40.729559,lng:-73.990741},map:t,title:`Bus Stop`,icon:s.src}),e=t.getStreetView(),e.setPosition(i),e.setPov({heading:265,pitch:0})}function r(){e.getVisible()==0?e.setVisible(!0):e.setVisible(!1)}n(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t;async function n(){let[{Marker:n}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`maps`)]),i={lat:40.729884,lng:-73.990988};t=document.querySelector(`gmp-map`).innerMap,document.getElementById(`streetview-toggle-button`).addEventListener(`click`,r);let a=document.createElement(`img`);a.src=new URL(``+new URL(`../cafe_icon.svg`,import.meta.url).href,``+import.meta.url).href;let o=document.createElement(`img`);o.src=new URL(``+new URL(`../bank_icon.svg`,import.meta.url).href,``+import.meta.url).href;let s=document.createElement(`img`);s.src=new URL(``+new URL(`../bus_icon.svg`,import.meta.url).href,``+import.meta.url).href,new n({position:{lat:40.730031,lng:-73.991428},map:t,title:`Cafe`,icon:a.src}),new n({position:{lat:40.729681,lng:-73.991138},map:t,title:`Bank`,icon:o.src}),new n({position:{lat:40.729559,lng:-73.990741},map:t,title:`Bus Stop`,icon:s.src}),e=t.getStreetView(),e.setPosition(i),e.setPov({heading:265,pitch:0})}function r(){e.getVisible()?e.setVisible(!1):e.setVisible(!0)}n(); \ No newline at end of file diff --git a/dist/samples/streetview-overlays/dist/index.html b/dist/samples/streetview-overlays/dist/index.html index 596ea8360..4a639eacf 100644 --- a/dist/samples/streetview-overlays/dist/index.html +++ b/dist/samples/streetview-overlays/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/streetview-overlays/docs/index.js b/dist/samples/streetview-overlays/docs/index.js index e8b1fc80f..5de696372 100644 --- a/dist/samples/streetview-overlays/docs/index.js +++ b/dist/samples/streetview-overlays/docs/index.js @@ -70,7 +70,7 @@ async function init() { function toggleStreetView() { const toggle = panorama.getVisible(); - if (toggle == false) { + if (!toggle) { panorama.setVisible(true); } else { panorama.setVisible(false); diff --git a/dist/samples/streetview-overlays/docs/index.ts b/dist/samples/streetview-overlays/docs/index.ts index 58e7069ad..e3d53d113 100644 --- a/dist/samples/streetview-overlays/docs/index.ts +++ b/dist/samples/streetview-overlays/docs/index.ts @@ -70,7 +70,7 @@ async function init() { function toggleStreetView(): void { const toggle = panorama.getVisible(); - if (toggle == false) { + if (!toggle) { panorama.setVisible(true); } else { panorama.setVisible(false); diff --git a/dist/samples/streetview-overlays/jsfiddle/demo.js b/dist/samples/streetview-overlays/jsfiddle/demo.js index 7b1cd378b..5264dcb20 100644 --- a/dist/samples/streetview-overlays/jsfiddle/demo.js +++ b/dist/samples/streetview-overlays/jsfiddle/demo.js @@ -69,7 +69,7 @@ async function init() { function toggleStreetView() { const toggle = panorama.getVisible(); - if (toggle == false) { + if (!toggle) { panorama.setVisible(true); } else { panorama.setVisible(false); diff --git a/dist/samples/test-example/app/index.ts b/dist/samples/test-example/app/index.ts index 23ae3f00e..9bde40269 100644 --- a/dist/samples/test-example/app/index.ts +++ b/dist/samples/test-example/app/index.ts @@ -14,7 +14,7 @@ // Declare the gmp-map element. const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let center; +let center: google.maps.LatLng | null | undefined; async function init() { // [START maps_test_example_instantiate_map] diff --git a/dist/samples/test-example/docs/index.ts b/dist/samples/test-example/docs/index.ts index 23ae3f00e..9bde40269 100644 --- a/dist/samples/test-example/docs/index.ts +++ b/dist/samples/test-example/docs/index.ts @@ -14,7 +14,7 @@ // Declare the gmp-map element. const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; -let center; +let center: google.maps.LatLng | null | undefined; async function init() { // [START maps_test_example_instantiate_map] diff --git a/dist/samples/ui-kit-place-details-compact/app/index.ts b/dist/samples/ui-kit-place-details-compact/app/index.ts index 632bde1d4..1c6d4ac4c 100644 --- a/dist/samples/ui-kit-place-details-compact/app/index.ts +++ b/dist/samples/ui-kit-place-details-compact/app/index.ts @@ -53,21 +53,24 @@ async function init(): Promise { /* [START maps_ui_kit_place_details_compact_event] */ // Add an event listener to handle clicks. - map.innerMap.addListener('click', (event) => { - event.stop(); + map.innerMap.addListener( + 'click', + (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => { + event.stop(); - if (event.placeId) { - // When the user clicks a POI. - marker.position = event.latLng; - placeDetailsRequest.place = event.placeId; - showInfoWindow(); - } else { - // When the user clicks the map (not on a POI). - marker.position = null; - placeDetailsRequest.place = null; - console.log('No place was selected.'); + if ('placeId' in event) { + // When the user clicks a POI. + marker.position = event.latLng; + placeDetailsRequest.place = event.placeId; + showInfoWindow(); + } else { + // When the user clicks the map (not on a POI). + marker.position = null; + placeDetailsRequest.place = null; + console.log('No place was selected.'); + } } - }); + ); } /* [END maps_ui_kit_place_details_compact_event] */ void init(); diff --git a/dist/samples/ui-kit-place-details-compact/dist/assets/index-pAUwJln0.js b/dist/samples/ui-kit-place-details-compact/dist/assets/index-BOHPhnZQ.js similarity index 90% rename from dist/samples/ui-kit-place-details-compact/dist/assets/index-pAUwJln0.js rename to dist/samples/ui-kit-place-details-compact/dist/assets/index-BOHPhnZQ.js index 8b1c7cf34..3b2fb41ea 100644 --- a/dist/samples/ui-kit-place-details-compact/dist/assets/index-pAUwJln0.js +++ b/dist/samples/ui-kit-place-details-compact/dist/assets/index-BOHPhnZQ.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-details-compact`),n=document.querySelector(`gmp-place-details-place-request`),r=document.querySelector(`gmp-advanced-marker`);async function i(){Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`)]);let{InfoWindow:i}=await google.maps.importLibrary(`maps`);await window.customElements.whenDefined(`gmp-map`),e.innerMap.setOptions({mapTypeControl:!1,streetViewControl:!1}),await window.customElements.whenDefined(`gmp-advanced-marker`),r.collisionBehavior=`REQUIRED_AND_HIDES_OPTIONAL`;let a=new i;a.addListener(`close`,()=>{r.position=null});let o=()=>{a.isOpen||(a.setContent(t),a.open({anchor:r}))};t.addEventListener(`gmp-load`,()=>{!e.center&&t.place?.location&&(e.center=r.position=t.place.location,o())}),e.innerMap.addListener(`click`,e=>{e.stop(),e.placeId?(r.position=e.latLng,n.place=e.placeId,o()):(r.position=null,n.place=null,console.log(`No place was selected.`))})}i(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-details-compact`),n=document.querySelector(`gmp-place-details-place-request`),r=document.querySelector(`gmp-advanced-marker`);async function i(){Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`)]);let{InfoWindow:i}=await google.maps.importLibrary(`maps`);await window.customElements.whenDefined(`gmp-map`),e.innerMap.setOptions({mapTypeControl:!1,streetViewControl:!1}),await window.customElements.whenDefined(`gmp-advanced-marker`),r.collisionBehavior=`REQUIRED_AND_HIDES_OPTIONAL`;let a=new i;a.addListener(`close`,()=>{r.position=null});let o=()=>{a.isOpen||(a.setContent(t),a.open({anchor:r}))};t.addEventListener(`gmp-load`,()=>{!e.center&&t.place?.location&&(e.center=r.position=t.place.location,o())}),e.innerMap.addListener(`click`,e=>{e.stop(),`placeId`in e?(r.position=e.latLng,n.place=e.placeId,o()):(r.position=null,n.place=null,console.log(`No place was selected.`))})}i(); \ No newline at end of file diff --git a/dist/samples/ui-kit-place-details-compact/dist/index.html b/dist/samples/ui-kit-place-details-compact/dist/index.html index 352f5d94b..d4786d605 100644 --- a/dist/samples/ui-kit-place-details-compact/dist/index.html +++ b/dist/samples/ui-kit-place-details-compact/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/ui-kit-place-details-compact/docs/index.js b/dist/samples/ui-kit-place-details-compact/docs/index.js index 34c4300c3..a5cc04f50 100644 --- a/dist/samples/ui-kit-place-details-compact/docs/index.js +++ b/dist/samples/ui-kit-place-details-compact/docs/index.js @@ -57,7 +57,7 @@ async function init() { map.innerMap.addListener('click', (event) => { event.stop(); - if (event.placeId) { + if ('placeId' in event) { // When the user clicks a POI. marker.position = event.latLng; placeDetailsRequest.place = event.placeId; diff --git a/dist/samples/ui-kit-place-details-compact/docs/index.ts b/dist/samples/ui-kit-place-details-compact/docs/index.ts index 632bde1d4..1c6d4ac4c 100644 --- a/dist/samples/ui-kit-place-details-compact/docs/index.ts +++ b/dist/samples/ui-kit-place-details-compact/docs/index.ts @@ -53,21 +53,24 @@ async function init(): Promise { /* [START maps_ui_kit_place_details_compact_event] */ // Add an event listener to handle clicks. - map.innerMap.addListener('click', (event) => { - event.stop(); + map.innerMap.addListener( + 'click', + (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => { + event.stop(); - if (event.placeId) { - // When the user clicks a POI. - marker.position = event.latLng; - placeDetailsRequest.place = event.placeId; - showInfoWindow(); - } else { - // When the user clicks the map (not on a POI). - marker.position = null; - placeDetailsRequest.place = null; - console.log('No place was selected.'); + if ('placeId' in event) { + // When the user clicks a POI. + marker.position = event.latLng; + placeDetailsRequest.place = event.placeId; + showInfoWindow(); + } else { + // When the user clicks the map (not on a POI). + marker.position = null; + placeDetailsRequest.place = null; + console.log('No place was selected.'); + } } - }); + ); } /* [END maps_ui_kit_place_details_compact_event] */ void init(); diff --git a/dist/samples/ui-kit-place-details-compact/jsfiddle/demo.js b/dist/samples/ui-kit-place-details-compact/jsfiddle/demo.js index e32e36e32..5e199fe13 100644 --- a/dist/samples/ui-kit-place-details-compact/jsfiddle/demo.js +++ b/dist/samples/ui-kit-place-details-compact/jsfiddle/demo.js @@ -56,7 +56,7 @@ async function init() { map.innerMap.addListener('click', (event) => { event.stop(); - if (event.placeId) { + if ('placeId' in event) { // When the user clicks a POI. marker.position = event.latLng; placeDetailsRequest.place = event.placeId; diff --git a/dist/samples/ui-kit-place-details/app/index.ts b/dist/samples/ui-kit-place-details/app/index.ts index ad5a2ef0e..3bbdf81d6 100644 --- a/dist/samples/ui-kit-place-details/app/index.ts +++ b/dist/samples/ui-kit-place-details/app/index.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ /* [START maps_ui_kit_place_details] */ + // Use querySelector to select elements for interaction. /* [START maps_ui_kit_place_details_query_selector] */ const map = document.querySelector('gmp-map')!; @@ -27,7 +28,7 @@ async function init(): Promise { // Function to update map and marker based on place details const updateMapAndMarker = () => { - if (placeDetails.place && placeDetails.place.location) { + if (placeDetails.place?.location) { map.innerMap.panTo(placeDetails.place.location); map.innerMap.setZoom(16); // Set zoom after panning if needed marker.position = placeDetails.place.location; @@ -43,19 +44,22 @@ async function init(): Promise { /* [START maps_ui_kit_place_details_event] */ // Add an event listener to handle clicks. - map.innerMap.addListener('click', (event) => { - marker.position = null; - event.stop(); - if (event.placeId) { - // Fire when the user clicks a POI. - placeDetailsRequest.place = event.placeId; - updateMapAndMarker(); - } else { - // Fire when the user clicks the map (not on a POI). - console.log('No place was selected.'); - marker.style.display = 'none'; + map.innerMap.addListener( + 'click', + (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => { + marker.position = null; + event.stop(); + if ('placeId' in event && event.placeId) { + // Fire when the user clicks a POI. + placeDetailsRequest.place = event.placeId; + updateMapAndMarker(); + } else { + // Fire when the user clicks the map (not on a POI). + console.log('No place was selected.'); + marker.style.display = 'none'; + } } - }); + ); } /* [END maps_ui_kit_place_details_event] */ diff --git a/dist/samples/ui-kit-place-details/dist/assets/index-C1YCSiF8.js b/dist/samples/ui-kit-place-details/dist/assets/index-CiRCIMfZ.js similarity index 72% rename from dist/samples/ui-kit-place-details/dist/assets/index-C1YCSiF8.js rename to dist/samples/ui-kit-place-details/dist/assets/index-CiRCIMfZ.js index e1f3de08b..d7afa0a2c 100644 --- a/dist/samples/ui-kit-place-details/dist/assets/index-C1YCSiF8.js +++ b/dist/samples/ui-kit-place-details/dist/assets/index-CiRCIMfZ.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-details`),n=document.querySelector(`gmp-place-details-place-request`),r=document.querySelector(`gmp-advanced-marker`);async function i(){await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`)]),e.innerMap.setOptions({mapTypeControl:!1});let i=()=>{t.place&&t.place.location&&(e.innerMap.panTo(t.place.location),e.innerMap.setZoom(16),r.position=t.place.location,r.collisionBehavior=`REQUIRED_AND_HIDES_OPTIONAL`,r.style.display=`block`)};t.addEventListener(`gmp-load`,()=>{i()}),e.innerMap.addListener(`click`,e=>{r.position=null,e.stop(),e.placeId?(n.place=e.placeId,i()):(console.log(`No place was selected.`),r.style.display=`none`)})}i(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-details`),n=document.querySelector(`gmp-place-details-place-request`),r=document.querySelector(`gmp-advanced-marker`);async function i(){await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`marker`),google.maps.importLibrary(`places`)]),e.innerMap.setOptions({mapTypeControl:!1});let i=()=>{t.place?.location&&(e.innerMap.panTo(t.place.location),e.innerMap.setZoom(16),r.position=t.place.location,r.collisionBehavior=`REQUIRED_AND_HIDES_OPTIONAL`,r.style.display=`block`)};t.addEventListener(`gmp-load`,()=>{i()}),e.innerMap.addListener(`click`,e=>{r.position=null,e.stop(),`placeId`in e&&e.placeId?(n.place=e.placeId,i()):(console.log(`No place was selected.`),r.style.display=`none`)})}i(); \ No newline at end of file diff --git a/dist/samples/ui-kit-place-details/dist/index.html b/dist/samples/ui-kit-place-details/dist/index.html index 83dfd505e..92e960378 100644 --- a/dist/samples/ui-kit-place-details/dist/index.html +++ b/dist/samples/ui-kit-place-details/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/ui-kit-place-details/docs/index.js b/dist/samples/ui-kit-place-details/docs/index.js index 4d530d13c..a8ddee00e 100644 --- a/dist/samples/ui-kit-place-details/docs/index.js +++ b/dist/samples/ui-kit-place-details/docs/index.js @@ -5,6 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 */ /* [START maps_ui_kit_place_details] */ + // Use querySelector to select elements for interaction. /* [START maps_ui_kit_place_details_query_selector] */ const map = document.querySelector('gmp-map'); @@ -28,7 +29,7 @@ async function init() { // Function to update map and marker based on place details const updateMapAndMarker = () => { - if (placeDetails.place && placeDetails.place.location) { + if (placeDetails.place?.location) { map.innerMap.panTo(placeDetails.place.location); map.innerMap.setZoom(16); // Set zoom after panning if needed marker.position = placeDetails.place.location; @@ -47,7 +48,7 @@ async function init() { map.innerMap.addListener('click', (event) => { marker.position = null; event.stop(); - if (event.placeId) { + if ('placeId' in event && event.placeId) { // Fire when the user clicks a POI. placeDetailsRequest.place = event.placeId; updateMapAndMarker(); diff --git a/dist/samples/ui-kit-place-details/docs/index.ts b/dist/samples/ui-kit-place-details/docs/index.ts index ad5a2ef0e..3bbdf81d6 100644 --- a/dist/samples/ui-kit-place-details/docs/index.ts +++ b/dist/samples/ui-kit-place-details/docs/index.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ /* [START maps_ui_kit_place_details] */ + // Use querySelector to select elements for interaction. /* [START maps_ui_kit_place_details_query_selector] */ const map = document.querySelector('gmp-map')!; @@ -27,7 +28,7 @@ async function init(): Promise { // Function to update map and marker based on place details const updateMapAndMarker = () => { - if (placeDetails.place && placeDetails.place.location) { + if (placeDetails.place?.location) { map.innerMap.panTo(placeDetails.place.location); map.innerMap.setZoom(16); // Set zoom after panning if needed marker.position = placeDetails.place.location; @@ -43,19 +44,22 @@ async function init(): Promise { /* [START maps_ui_kit_place_details_event] */ // Add an event listener to handle clicks. - map.innerMap.addListener('click', (event) => { - marker.position = null; - event.stop(); - if (event.placeId) { - // Fire when the user clicks a POI. - placeDetailsRequest.place = event.placeId; - updateMapAndMarker(); - } else { - // Fire when the user clicks the map (not on a POI). - console.log('No place was selected.'); - marker.style.display = 'none'; + map.innerMap.addListener( + 'click', + (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => { + marker.position = null; + event.stop(); + if ('placeId' in event && event.placeId) { + // Fire when the user clicks a POI. + placeDetailsRequest.place = event.placeId; + updateMapAndMarker(); + } else { + // Fire when the user clicks the map (not on a POI). + console.log('No place was selected.'); + marker.style.display = 'none'; + } } - }); + ); } /* [END maps_ui_kit_place_details_event] */ diff --git a/dist/samples/ui-kit-place-details/jsfiddle/demo.js b/dist/samples/ui-kit-place-details/jsfiddle/demo.js index 7a379d5fd..649eedd99 100644 --- a/dist/samples/ui-kit-place-details/jsfiddle/demo.js +++ b/dist/samples/ui-kit-place-details/jsfiddle/demo.js @@ -27,7 +27,7 @@ async function init() { // Function to update map and marker based on place details const updateMapAndMarker = () => { - if (placeDetails.place && placeDetails.place.location) { + if (placeDetails.place?.location) { map.innerMap.panTo(placeDetails.place.location); map.innerMap.setZoom(16); // Set zoom after panning if needed marker.position = placeDetails.place.location; @@ -45,7 +45,7 @@ async function init() { map.innerMap.addListener('click', (event) => { marker.position = null; event.stop(); - if (event.placeId) { + if ('placeId' in event && event.placeId) { // Fire when the user clicks a POI. placeDetailsRequest.place = event.placeId; updateMapAndMarker(); diff --git a/dist/samples/ui-kit-place-search-nearby/app/index.ts b/dist/samples/ui-kit-place-search-nearby/app/index.ts index 510425248..61dc39066 100644 --- a/dist/samples/ui-kit-place-search-nearby/app/index.ts +++ b/dist/samples/ui-kit-place-search-nearby/app/index.ts @@ -18,8 +18,7 @@ const typeSelect = document.querySelector('.type-select') as HTMLSelectElement; /* [END maps_ui_kit_place_search_nearby_query_selectors] */ // Global variables for the map, markers, and info window. -const markers: Map = - new Map(); +const markers = new Map(); let infoWindow: google.maps.InfoWindow; // The init function is called when the page loads. @@ -46,7 +45,9 @@ async function init(): Promise { /* [START maps_ui_kit_place_search_nearby_event] */ // Add event listeners to the type select and place search elements. - typeSelect.addEventListener('change', () => searchPlaces()); + typeSelect.addEventListener('change', () => { + searchPlaces(); + }); placeSearch.addEventListener('gmp-select', (event) => { const { place } = event; @@ -56,7 +57,7 @@ async function init(): Promise { void addMarkers(); }); - void searchPlaces(); + searchPlaces(); } /* [END maps_ui_kit_place_search_nearby_event] */ /* [START maps_ui_kit_place_search_nearby_function] */ diff --git a/dist/samples/ui-kit-place-search-nearby/dist/assets/index-CtuxePuS.js b/dist/samples/ui-kit-place-search-nearby/dist/assets/index-Dn48O_Pk.js similarity index 62% rename from dist/samples/ui-kit-place-search-nearby/dist/assets/index-CtuxePuS.js rename to dist/samples/ui-kit-place-search-nearby/dist/assets/index-Dn48O_Pk.js index bade7cad2..180e3278e 100644 --- a/dist/samples/ui-kit-place-search-nearby/dist/assets/index-CtuxePuS.js +++ b/dist/samples/ui-kit-place-search-nearby/dist/assets/index-Dn48O_Pk.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-search`),n=document.querySelector(`gmp-place-nearby-search-request`),r=document.querySelector(`gmp-place-details-compact`),i=document.querySelector(`gmp-place-details-place-request`),a=document.querySelector(`.type-select`),o=new Map,s;async function c(){let[{InfoWindow:n}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`)]);r.remove(),s=new n({content:r,ariaLabel:`Place Details`}),e.innerMap.setOptions({clickableIcons:!1,mapTypeControl:!1,streetViewControl:!1}),a.addEventListener(`change`,()=>l()),t.addEventListener(`gmp-select`,e=>{let{place:t}=e;o.get(t.id)?.click()}),t.addEventListener(`gmp-load`,()=>{u()}),l()}function l(){s.close();for(let e of o.values())e.remove();o.clear(),a.value&&(n.locationRestriction={center:e.center,radius:5e4},n.includedTypes=[a.value])}async function u(){let[{AdvancedMarkerElement:n},{LatLngBounds:r}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),a=new r;if(t.places.length!==0){for(let r of t.places){if(!r.location)continue;let t=new n({map:e.innerMap,position:r.location,collisionBehavior:`REQUIRED_AND_HIDES_OPTIONAL`});o.set(r.id,t),a.extend(r.location),t.addListener(`click`,()=>{i.place=r,s.open(e.innerMap,t)})}e.innerMap.fitBounds(a)}}c(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-search`),n=document.querySelector(`gmp-place-nearby-search-request`),r=document.querySelector(`gmp-place-details-compact`),i=document.querySelector(`gmp-place-details-place-request`),a=document.querySelector(`.type-select`),o=new Map,s;async function c(){let[{InfoWindow:n}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`)]);r.remove(),s=new n({content:r,ariaLabel:`Place Details`}),e.innerMap.setOptions({clickableIcons:!1,mapTypeControl:!1,streetViewControl:!1}),a.addEventListener(`change`,()=>{l()}),t.addEventListener(`gmp-select`,e=>{let{place:t}=e;o.get(t.id)?.click()}),t.addEventListener(`gmp-load`,()=>{u()}),l()}function l(){s.close();for(let e of o.values())e.remove();o.clear(),a.value&&(n.locationRestriction={center:e.center,radius:5e4},n.includedTypes=[a.value])}async function u(){let[{AdvancedMarkerElement:n},{LatLngBounds:r}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),a=new r;if(t.places.length!==0){for(let r of t.places){if(!r.location)continue;let t=new n({map:e.innerMap,position:r.location,collisionBehavior:`REQUIRED_AND_HIDES_OPTIONAL`});o.set(r.id,t),a.extend(r.location),t.addListener(`click`,()=>{i.place=r,s.open(e.innerMap,t)})}e.innerMap.fitBounds(a)}}c(); \ No newline at end of file diff --git a/dist/samples/ui-kit-place-search-nearby/dist/index.html b/dist/samples/ui-kit-place-search-nearby/dist/index.html index 98ff65f97..fee2e7892 100644 --- a/dist/samples/ui-kit-place-search-nearby/dist/index.html +++ b/dist/samples/ui-kit-place-search-nearby/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/ui-kit-place-search-nearby/docs/index.js b/dist/samples/ui-kit-place-search-nearby/docs/index.js index c4db4148b..f80a92f40 100644 --- a/dist/samples/ui-kit-place-search-nearby/docs/index.js +++ b/dist/samples/ui-kit-place-search-nearby/docs/index.js @@ -46,7 +46,9 @@ async function init() { /* [START maps_ui_kit_place_search_nearby_event] */ // Add event listeners to the type select and place search elements. - typeSelect.addEventListener('change', () => searchPlaces()); + typeSelect.addEventListener('change', () => { + searchPlaces(); + }); placeSearch.addEventListener('gmp-select', (event) => { const { place } = event; @@ -56,7 +58,7 @@ async function init() { void addMarkers(); }); - void searchPlaces(); + searchPlaces(); } /* [END maps_ui_kit_place_search_nearby_event] */ /* [START maps_ui_kit_place_search_nearby_function] */ diff --git a/dist/samples/ui-kit-place-search-nearby/docs/index.ts b/dist/samples/ui-kit-place-search-nearby/docs/index.ts index 510425248..61dc39066 100644 --- a/dist/samples/ui-kit-place-search-nearby/docs/index.ts +++ b/dist/samples/ui-kit-place-search-nearby/docs/index.ts @@ -18,8 +18,7 @@ const typeSelect = document.querySelector('.type-select') as HTMLSelectElement; /* [END maps_ui_kit_place_search_nearby_query_selectors] */ // Global variables for the map, markers, and info window. -const markers: Map = - new Map(); +const markers = new Map(); let infoWindow: google.maps.InfoWindow; // The init function is called when the page loads. @@ -46,7 +45,9 @@ async function init(): Promise { /* [START maps_ui_kit_place_search_nearby_event] */ // Add event listeners to the type select and place search elements. - typeSelect.addEventListener('change', () => searchPlaces()); + typeSelect.addEventListener('change', () => { + searchPlaces(); + }); placeSearch.addEventListener('gmp-select', (event) => { const { place } = event; @@ -56,7 +57,7 @@ async function init(): Promise { void addMarkers(); }); - void searchPlaces(); + searchPlaces(); } /* [END maps_ui_kit_place_search_nearby_event] */ /* [START maps_ui_kit_place_search_nearby_function] */ diff --git a/dist/samples/ui-kit-place-search-nearby/jsfiddle/demo.js b/dist/samples/ui-kit-place-search-nearby/jsfiddle/demo.js index 832756f29..3690de20a 100644 --- a/dist/samples/ui-kit-place-search-nearby/jsfiddle/demo.js +++ b/dist/samples/ui-kit-place-search-nearby/jsfiddle/demo.js @@ -42,7 +42,9 @@ async function init() { }); // Add event listeners to the type select and place search elements. - typeSelect.addEventListener('change', () => searchPlaces()); + typeSelect.addEventListener('change', () => { + searchPlaces(); + }); placeSearch.addEventListener('gmp-select', (event) => { const { place } = event; @@ -52,7 +54,7 @@ async function init() { void addMarkers(); }); - void searchPlaces(); + searchPlaces(); } // The searchPlaces function is called when the user changes the type select or when the page loads. diff --git a/dist/samples/ui-kit-place-search-text/app/index.ts b/dist/samples/ui-kit-place-search-text/app/index.ts index 0ff4fd78c..28325a12f 100644 --- a/dist/samples/ui-kit-place-search-text/app/index.ts +++ b/dist/samples/ui-kit-place-search-text/app/index.ts @@ -19,8 +19,7 @@ const searchButton = document.querySelector('.search-button')!; /* [END maps_ui_kit_place_search_text_query_selectors] */ // Global variables for the map, markers, and info window. -const markers: Map = - new Map(); +const markers = new Map(); let infoWindow: google.maps.InfoWindow; // The init function is called when the page loads. @@ -47,7 +46,9 @@ async function init(): Promise { /* [START maps_ui_kit_place_search_text_event] */ // Add event listeners to the query input and place search elements. - searchButton.addEventListener('click', () => searchPlaces()); + searchButton.addEventListener('click', () => { + searchPlaces(); + }); queryInput.addEventListener('keydown', (event) => { if (event.key === 'Enter') { searchPlaces(); diff --git a/dist/samples/ui-kit-place-search-text/dist/assets/index-BUeNulZI.js b/dist/samples/ui-kit-place-search-text/dist/assets/index-CeoJvH4U.js similarity index 63% rename from dist/samples/ui-kit-place-search-text/dist/assets/index-BUeNulZI.js rename to dist/samples/ui-kit-place-search-text/dist/assets/index-CeoJvH4U.js index 2509868ea..b37610e5d 100644 --- a/dist/samples/ui-kit-place-search-text/dist/assets/index-BUeNulZI.js +++ b/dist/samples/ui-kit-place-search-text/dist/assets/index-CeoJvH4U.js @@ -1 +1 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-search`),n=document.querySelector(`gmp-place-text-search-request`),r=document.querySelector(`gmp-place-details-compact`),i=document.querySelector(`gmp-place-details-place-request`),a=document.querySelector(`.query-input`),o=document.querySelector(`.search-button`),s=new Map,c;async function l(){let[{InfoWindow:n}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`)]);r.remove(),c=new n({content:r,ariaLabel:`Place Details`}),e.innerMap.setOptions({clickableIcons:!1,mapTypeControl:!1,streetViewControl:!1}),o.addEventListener(`click`,()=>u()),a.addEventListener(`keydown`,e=>{e.key===`Enter`&&u()}),t.addEventListener(`gmp-select`,e=>{let{place:t}=e;s.get(t.id)?.click()}),t.addEventListener(`gmp-load`,()=>{d()}),u()}function u(){c.close();for(let e of s.values())e.remove();if(s.clear(),a.value){let t=e.center;t&&(n.locationBias=t),n.textQuery=a.value}}async function d(){let[{AdvancedMarkerElement:n},{LatLngBounds:r}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),a=new r;if(t.places.length!==0){for(let r of t.places){if(!r.location)continue;let t=new n({map:e.innerMap,position:r.location,collisionBehavior:`REQUIRED_AND_HIDES_OPTIONAL`});s.set(r.id,t),a.extend(r.location),t.addListener(`click`,()=>{i.place=r,c.open(e.innerMap,t)})}e.innerMap.fitBounds(a)}}l(); \ No newline at end of file +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=document.querySelector(`gmp-map`),t=document.querySelector(`gmp-place-search`),n=document.querySelector(`gmp-place-text-search-request`),r=document.querySelector(`gmp-place-details-compact`),i=document.querySelector(`gmp-place-details-place-request`),a=document.querySelector(`.query-input`),o=document.querySelector(`.search-button`),s=new Map,c;async function l(){let[{InfoWindow:n}]=await Promise.all([google.maps.importLibrary(`maps`),google.maps.importLibrary(`places`)]);r.remove(),c=new n({content:r,ariaLabel:`Place Details`}),e.innerMap.setOptions({clickableIcons:!1,mapTypeControl:!1,streetViewControl:!1}),o.addEventListener(`click`,()=>{u()}),a.addEventListener(`keydown`,e=>{e.key===`Enter`&&u()}),t.addEventListener(`gmp-select`,e=>{let{place:t}=e;s.get(t.id)?.click()}),t.addEventListener(`gmp-load`,()=>{d()}),u()}function u(){c.close();for(let e of s.values())e.remove();if(s.clear(),a.value){let t=e.center;t&&(n.locationBias=t),n.textQuery=a.value}}async function d(){let[{AdvancedMarkerElement:n},{LatLngBounds:r}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),a=new r;if(t.places.length!==0){for(let r of t.places){if(!r.location)continue;let t=new n({map:e.innerMap,position:r.location,collisionBehavior:`REQUIRED_AND_HIDES_OPTIONAL`});s.set(r.id,t),a.extend(r.location),t.addListener(`click`,()=>{i.place=r,c.open(e.innerMap,t)})}e.innerMap.fitBounds(a)}}l(); \ No newline at end of file diff --git a/dist/samples/ui-kit-place-search-text/dist/index.html b/dist/samples/ui-kit-place-search-text/dist/index.html index 214ca89e9..6155beb11 100644 --- a/dist/samples/ui-kit-place-search-text/dist/index.html +++ b/dist/samples/ui-kit-place-search-text/dist/index.html @@ -15,7 +15,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/ui-kit-place-search-text/docs/index.js b/dist/samples/ui-kit-place-search-text/docs/index.js index 702f691a4..831f31585 100644 --- a/dist/samples/ui-kit-place-search-text/docs/index.js +++ b/dist/samples/ui-kit-place-search-text/docs/index.js @@ -47,7 +47,9 @@ async function init() { /* [START maps_ui_kit_place_search_text_event] */ // Add event listeners to the query input and place search elements. - searchButton.addEventListener('click', () => searchPlaces()); + searchButton.addEventListener('click', () => { + searchPlaces(); + }); queryInput.addEventListener('keydown', (event) => { if (event.key === 'Enter') { searchPlaces(); diff --git a/dist/samples/ui-kit-place-search-text/docs/index.ts b/dist/samples/ui-kit-place-search-text/docs/index.ts index 0ff4fd78c..28325a12f 100644 --- a/dist/samples/ui-kit-place-search-text/docs/index.ts +++ b/dist/samples/ui-kit-place-search-text/docs/index.ts @@ -19,8 +19,7 @@ const searchButton = document.querySelector('.search-button')!; /* [END maps_ui_kit_place_search_text_query_selectors] */ // Global variables for the map, markers, and info window. -const markers: Map = - new Map(); +const markers = new Map(); let infoWindow: google.maps.InfoWindow; // The init function is called when the page loads. @@ -47,7 +46,9 @@ async function init(): Promise { /* [START maps_ui_kit_place_search_text_event] */ // Add event listeners to the query input and place search elements. - searchButton.addEventListener('click', () => searchPlaces()); + searchButton.addEventListener('click', () => { + searchPlaces(); + }); queryInput.addEventListener('keydown', (event) => { if (event.key === 'Enter') { searchPlaces(); diff --git a/dist/samples/ui-kit-place-search-text/jsfiddle/demo.js b/dist/samples/ui-kit-place-search-text/jsfiddle/demo.js index 962d0f8e4..64ce0890a 100644 --- a/dist/samples/ui-kit-place-search-text/jsfiddle/demo.js +++ b/dist/samples/ui-kit-place-search-text/jsfiddle/demo.js @@ -43,7 +43,9 @@ async function init() { }); // Add event listeners to the query input and place search elements. - searchButton.addEventListener('click', () => searchPlaces()); + searchButton.addEventListener('click', () => { + searchPlaces(); + }); queryInput.addEventListener('keydown', (event) => { if (event.key === 'Enter') { searchPlaces(); diff --git a/dist/samples/weather-api-current-compact/app/index.ts b/dist/samples/weather-api-current-compact/app/index.ts index 836daa2e8..acbe4793f 100644 --- a/dist/samples/weather-api-current-compact/app/index.ts +++ b/dist/samples/weather-api-current-compact/app/index.ts @@ -3,6 +3,8 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ // [START maps_weather_api_compact] import './simple-weather-widget'; // Import the custom element @@ -22,7 +24,7 @@ async function init(): Promise { void google.maps.importLibrary('marker'); // preload const { Map } = await google.maps.importLibrary('maps'); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { center: { lat: 48.8566, lng: 2.3522 }, // Set center to Paris initially, will change based on markers zoom: 6, minZoom: 5, // Set minimum zoom level to 5 @@ -48,7 +50,7 @@ async function init(): Promise { map.addListener('click', async (event: google.maps.MapMouseEvent) => { // Check if the click was on a marker. If so, the marker's own click listener will handle it. // If not, create a new dynamic marker or hide the active widget. - let target = event.domEvent.target as HTMLElement; + let target = event.domEvent.target as Element; let isClickOnMarker = false; while (target) { if ( @@ -59,7 +61,7 @@ async function init(): Promise { isClickOnMarker = true; break; } - target = target.parentElement as HTMLElement; + target = target.parentElement!; } if (!isClickOnMarker && event.latLng) { @@ -68,12 +70,12 @@ async function init(): Promise { const rainDetailsElement = activeWeatherWidget.shadowRoot!.getElementById( 'rain-details' - ) as HTMLDivElement; + )!; rainDetailsElement.style.display = 'none'; const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); // Find the marker associated with the active widget and reset its zIndex const activeMarker = allMarkers.find( @@ -87,7 +89,6 @@ async function init(): Promise { // Remove the previous dynamic marker if it exists const currentDynamicMarkerIndex = allMarkers.findIndex( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker) => (marker as any).markerType === 'dynamic' ); if (currentDynamicMarkerIndex !== -1) { @@ -126,13 +127,13 @@ async function createAndAddMarker( ) as SimpleWeatherWidget; // Apply dark mode if the map container is in dark mode - const mapContainer = document.getElementById('map') as HTMLElement; + const mapContainer = document.getElementById('map')!; if (mapContainer.classList.contains('dark-mode')) { weatherWidget.setMode('dark'); } const marker = new AdvancedMarkerElement({ - map: map, + map, position: { lat: location.lat, lng: location.lng }, title: location.name, // Add a title for accessibility gmpClickable: true, @@ -140,7 +141,6 @@ async function createAndAddMarker( marker.append(weatherWidget); // Store the marker type - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker as any).markerType = markerType; // Fetch and update weather data for this location @@ -152,16 +152,15 @@ async function createAndAddMarker( // Add click listener to the marker marker.addEventListener('gmp-click', () => { - const widgetContainer = weatherWidget.shadowRoot!.querySelector( - '.widget-container' - ) as HTMLDivElement; + const widgetContainer = + weatherWidget.shadowRoot!.querySelector('.widget-container')!; // If a widget is currently active and it's not the clicked one, remove its highlight class and reset zIndex if (activeWeatherWidget && activeWeatherWidget !== weatherWidget) { const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); // Find the marker associated with the active widget and reset its zIndex const activeMarker = allMarkers.find( @@ -196,7 +195,7 @@ async function createAndAddMarker( * Toggles the dark mode class on the body element. */ async function toggleDarkMode() { - const mapContainer = document.getElementById('map') as HTMLElement; + const mapContainer = document.getElementById('map')!; mapContainer.classList.toggle('dark-mode'); const modeToggleButton = document.getElementById('mode-toggle'); @@ -249,7 +248,7 @@ async function toggleDarkMode() { map.addListener('click', async (event: google.maps.MapMouseEvent) => { // Check if the click was on a marker. If so, the marker's own click listener will handle it. // If not, create a new dynamic marker or hide the active widget. - let target = event.domEvent.target as HTMLElement; + let target = event.domEvent.target as Element; let isClickOnMarker = false; while (target) { if ( @@ -260,7 +259,7 @@ async function toggleDarkMode() { isClickOnMarker = true; break; } - target = target.parentElement as HTMLElement; + target = target.parentElement!; } if (!isClickOnMarker && event.latLng) { @@ -268,12 +267,12 @@ async function toggleDarkMode() { const rainDetailsElement = activeWeatherWidget.shadowRoot!.getElementById( 'rain-details' - ) as HTMLDivElement; + )!; rainDetailsElement.style.display = 'none'; const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); // Find the marker associated with the active widget and reset its zIndex const activeMarker = allMarkers.find( @@ -287,7 +286,6 @@ async function toggleDarkMode() { // Remove the previous dynamic marker if it exists const currentDynamicMarkerIndex = allMarkers.findIndex( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker) => (marker as any).markerType === 'dynamic' ); if (currentDynamicMarkerIndex !== -1) { @@ -332,19 +330,16 @@ function removeButtonMarkers(): void { const buttonMarker = allMarkers.find( (marker) => marker.firstElementChild === activeWeatherWidget && - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker as any).markerType === 'button' ); if (buttonMarker) { const rainDetailsElement = - activeWeatherWidget.shadowRoot!.getElementById( - 'rain-details' - ) as HTMLDivElement; + activeWeatherWidget.shadowRoot!.getElementById('rain-details')!; rainDetailsElement.style.display = 'none'; const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); buttonMarker.zIndex = null; activeWeatherWidget = null; // Clear the active widget @@ -353,7 +348,6 @@ function removeButtonMarkers(): void { // Remove button markers from the map and the allMarkers array const markersToRemove = allMarkers.filter( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker) => (marker as any).markerType === 'button' ); markersToRemove.forEach((marker) => { diff --git a/dist/samples/weather-api-current-compact/dist/assets/index-1mvsB7xh.js b/dist/samples/weather-api-current-compact/dist/assets/index-Bbf-jOcW.js similarity index 58% rename from dist/samples/weather-api-current-compact/dist/assets/index-1mvsB7xh.js rename to dist/samples/weather-api-current-compact/dist/assets/index-Bbf-jOcW.js index 81431a801..69d9a8121 100644 --- a/dist/samples/weather-api-current-compact/dist/assets/index-1mvsB7xh.js +++ b/dist/samples/weather-api-current-compact/dist/assets/index-Bbf-jOcW.js @@ -143,4 +143,4 @@
- `}set data(e){let t=this.shadowRoot.getElementById(`condition-icon`),n=this.shadowRoot.getElementById(`temperature`),r=this.shadowRoot.getElementById(`rain-probability`),i=this.shadowRoot.getElementById(`rain-qpf`),a=this.shadowRoot.getElementById(`rain-details`);if(!e||e.error){t.style.display=`none`,a.style.display=`none`,e&&e.error?(n.textContent=e.error,n.classList.add(`error-message`)):(n.textContent=`N/A`,n.classList.remove(`error-message`));return}let o=e.daytimeForecast||e.nighttimeForecast,s,c,l,u;if(o){let t=e;s=t.maxTemperature?.degrees,c=t.daytimeForecast?.weatherCondition?.iconBaseUri||t.nighttimeForecast?.weatherCondition?.iconBaseUri,l=t.precipitation?.probability?.percent,u=t.precipitation?.qpf?.quantity}else{let t=e;s=t.temperature?.degrees,c=t.weatherCondition?.iconBaseUri,l=t.precipitation?.probability?.percent,u=t.currentConditionsHistory?.qpf?.quantity===void 0?t.precipitation?.qpf?.quantity:t.currentConditionsHistory.qpf.quantity}let d=``;d=c?`${c}.svg`:`/icons/cloud-cover-white.svg`,t.style.display=`none`,t.onload=()=>{t.style.display=`inline-block`},t.onerror=()=>{console.error(`Failed to load weather icon:`,d),t.style.display=`none`},t.src=d,n.textContent=`${s===void 0?`N/A`:s.toFixed(0)}°C`,n.classList.remove(`error-message`),l==null?r.textContent=`0%`:r.textContent=`${l}%`,u==null?i.textContent=`0.0mm`:i.textContent=`${u.toFixed(1)}mm`}setMode(e){e===`dark`?this.classList.add(`dark-mode`):this.classList.remove(`dark-mode`)}};customElements.define(`simple-weather-widget`,e);var t=`https://weather.googleapis.com/v1/currentConditions:lookup`,n=`AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8`,r=`c306b3c6dd3ed8d9`,i=`6b73a9fe7e831a00`,a,o=null,s=[],c=!1;async function l(){google.maps.importLibrary(`marker`);let{Map:e}=await google.maps.importLibrary(`maps`);a=new e(document.getElementById(`map`),{center:{lat:48.8566,lng:2.3522},zoom:6,minZoom:5,disableDefaultUI:!0,mapId:`c306b3c6dd3ed8d9`,clickableIcons:!1});let t=a.getCenter();t&&await u({name:`Initial Location`,lat:t.lat(),lng:t.lng()},`dynamic`),a.addListener(`click`,async e=>{let t=e.domEvent.target,n=!1;for(;t;){if(t.tagName===`SIMPLE-WEATHER-WIDGET`||t.classList.contains(`gm-control-active`)){n=!0;break}t=t.parentElement}if(!n&&e.latLng){if(o){let e=o.shadowRoot.getElementById(`rain-details`);e.style.display=`none`,o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`);let t=s.find(e=>e.firstElementChild===o);t&&(t.zIndex=null),o=null}let t=s.findIndex(e=>e.markerType===`dynamic`);t!==-1&&(s[t].map=null,s.splice(t,1)),await u({name:`Clicked Location`,lat:e.latLng.lat(),lng:e.latLng.lng()},`dynamic`)}})}async function u(e,t){let[{AdvancedMarkerElement:n},{LatLng:r}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),i=document.createElement(`simple-weather-widget`);document.getElementById(`map`).classList.contains(`dark-mode`)&&i.setMode(`dark`);let c=new n({map:a,position:{lat:e.lat,lng:e.lng},title:e.name,gmpClickable:!0});c.append(i),c.markerType=t,h(c,i,new r(e.lat,e.lng)),c.addEventListener(`gmp-click`,()=>{let e=i.shadowRoot.querySelector(`.widget-container`);if(o&&o!==i){o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`);let e=s.find(e=>e.firstElementChild===o);e&&(e.zIndex=null)}e.classList.toggle(`highlight`),e.classList.contains(`highlight`)?(o=i,c.zIndex=1):(o=null,c.zIndex=null)}),s.push(c)}async function d(){let e=document.getElementById(`map`);e.classList.toggle(`dark-mode`);let t=document.getElementById(`mode-toggle`);t&&(e.classList.contains(`dark-mode`)?t.textContent=`Light Mode`:t.textContent=`Dark Mode`),s.forEach(e=>{e.map=null});let{Map:n}=await google.maps.importLibrary(`maps`);a=new n(e,{center:a.getCenter(),zoom:a.getZoom(),minZoom:5,disableDefaultUI:!0,mapId:e.classList.contains(`dark-mode`)?i:r,clickableIcons:!1});let c=[...s];s=[];for(let t of c){t.map=a;let n=t.firstElementChild;e.classList.contains(`dark-mode`)?n.setMode(`dark`):n.setMode(`light`),s.push(t)}a.addListener(`click`,async e=>{let t=e.domEvent.target,n=!1;for(;t;){if(t.tagName===`SIMPLE-WEATHER-WIDGET`||t.classList.contains(`gm-control-active`)){n=!0;break}t=t.parentElement}if(!n&&e.latLng){if(o){let e=o.shadowRoot.getElementById(`rain-details`);e.style.display=`none`,o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`);let t=s.find(e=>e.firstElementChild===o);t&&(t.zIndex=null),o=null}let t=s.findIndex(e=>e.markerType===`dynamic`);t!==-1&&(s[t].map=null,s.splice(t,1)),await u({name:`Clicked Location`,lat:e.latLng.lat(),lng:e.latLng.lng()},`dynamic`)}})}var f=[{name:`London`,lat:51.5074,lng:-.1278},{name:`Brussels`,lat:50.8503,lng:4.3517},{name:`Luxembourg`,lat:49.8153,lng:6.1296},{name:`Amsterdam`,lat:52.3676,lng:4.9041},{name:`Berlin`,lat:52.52,lng:13.405},{name:`Rome`,lat:41.9028,lng:12.4964},{name:`Geneva`,lat:46.2044,lng:6.14324},{name:`Barcelona`,lat:41.3874,lng:-2.1686},{name:`Milan`,lat:45.4685,lng:9.1824}];async function p(){for(let e of f)await u(e,`button`)}function m(){if(o){let e=s.find(e=>e.firstElementChild===o&&e.markerType===`button`);if(e){let t=o.shadowRoot.getElementById(`rain-details`);t.style.display=`none`,o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`),e.zIndex=null,o=null}}s.filter(e=>e.markerType===`button`).forEach(e=>{e.map=null;let t=s.indexOf(e);t>-1&&s.splice(t,1)})}async function h(e,r,i){let a=`${t}?key=${n}&location.latitude=${i.lat()}&location.longitude=${i.lng()}`;try{let e=await fetch(a);if(e.ok){let t=await e.json();console.log(`Weather data fetched for marker:`,t),r.data=t}else{let t=await e.json();if(console.error(`API error response:`,t),e.status===404&&t?.error?.status===`NOT_FOUND`)r.data={error:`Location not supported`};else throw Error(`HTTP error! status: ${e.status}`)}}catch(e){console.error(`Error fetching weather data for marker:`,e),r.data={error:`Failed to fetch weather data`}}}l(),customElements.whenDefined(`simple-weather-widget`).then(()=>{let e=document.getElementById(`mode-toggle`);e&&e.addEventListener(`click`,()=>{d()});let t=document.getElementById(`load-markers-button`);t&&t.addEventListener(`click`,()=>{c?(m(),c=!1,t.textContent=`Load Markers`):(p(),c=!0,t.textContent=`Remove Markers`)})}); \ No newline at end of file + `}set data(e){let t=this.shadowRoot.getElementById(`condition-icon`),n=this.shadowRoot.getElementById(`temperature`),r=this.shadowRoot.getElementById(`rain-probability`),i=this.shadowRoot.getElementById(`rain-qpf`),a=this.shadowRoot.getElementById(`rain-details`);if(!e||e.error){t.style.display=`none`,a.style.display=`none`,e?.error?(n.textContent=e.error,n.classList.add(`error-message`)):(n.textContent=`N/A`,n.classList.remove(`error-message`));return}let o=e.daytimeForecast||e.nighttimeForecast,s,c,l,u;if(o){let t=e;s=t.maxTemperature?.degrees,c=t.daytimeForecast?.weatherCondition?.iconBaseUri||t.nighttimeForecast?.weatherCondition?.iconBaseUri,l=t.precipitation?.probability?.percent,u=t.precipitation?.qpf?.quantity}else{let t=e;s=t.temperature?.degrees,c=t.weatherCondition?.iconBaseUri,l=t.precipitation?.probability?.percent,u=t.currentConditionsHistory?.qpf?.quantity===void 0?t.precipitation?.qpf?.quantity:t.currentConditionsHistory.qpf.quantity}let d=``;d=c?`${c}.svg`:`/icons/cloud-cover-white.svg`,t.style.display=`none`,t.onload=()=>{t.style.display=`inline-block`},t.onerror=()=>{console.error(`Failed to load weather icon:`,d),t.style.display=`none`},t.src=d,n.textContent=`${s===void 0?`N/A`:s.toFixed(0)}°C`,n.classList.remove(`error-message`),l==null?r.textContent=`0%`:r.textContent=`${l}%`,u==null?i.textContent=`0.0mm`:i.textContent=`${u.toFixed(1)}mm`}setMode(e){e===`dark`?this.classList.add(`dark-mode`):this.classList.remove(`dark-mode`)}};customElements.define(`simple-weather-widget`,e);var t=`https://weather.googleapis.com/v1/currentConditions:lookup`,n=`AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8`,r=`c306b3c6dd3ed8d9`,i=`6b73a9fe7e831a00`,a,o=null,s=[],c=!1;async function l(){google.maps.importLibrary(`marker`);let{Map:e}=await google.maps.importLibrary(`maps`);a=new e(document.getElementById(`map`),{center:{lat:48.8566,lng:2.3522},zoom:6,minZoom:5,disableDefaultUI:!0,mapId:`c306b3c6dd3ed8d9`,clickableIcons:!1});let t=a.getCenter();t&&await u({name:`Initial Location`,lat:t.lat(),lng:t.lng()},`dynamic`),a.addListener(`click`,async e=>{let t=e.domEvent.target,n=!1;for(;t;){if(t.tagName===`SIMPLE-WEATHER-WIDGET`||t.classList.contains(`gm-control-active`)){n=!0;break}t=t.parentElement}if(!n&&e.latLng){if(o){let e=o.shadowRoot.getElementById(`rain-details`);e.style.display=`none`,o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`);let t=s.find(e=>e.firstElementChild===o);t&&(t.zIndex=null),o=null}let t=s.findIndex(e=>e.markerType===`dynamic`);t!==-1&&(s[t].map=null,s.splice(t,1)),await u({name:`Clicked Location`,lat:e.latLng.lat(),lng:e.latLng.lng()},`dynamic`)}})}async function u(e,t){let[{AdvancedMarkerElement:n},{LatLng:r}]=await Promise.all([google.maps.importLibrary(`marker`),google.maps.importLibrary(`core`)]),i=document.createElement(`simple-weather-widget`);document.getElementById(`map`).classList.contains(`dark-mode`)&&i.setMode(`dark`);let c=new n({map:a,position:{lat:e.lat,lng:e.lng},title:e.name,gmpClickable:!0});c.append(i),c.markerType=t,h(c,i,new r(e.lat,e.lng)),c.addEventListener(`gmp-click`,()=>{let e=i.shadowRoot.querySelector(`.widget-container`);if(o&&o!==i){o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`);let e=s.find(e=>e.firstElementChild===o);e&&(e.zIndex=null)}e.classList.toggle(`highlight`),e.classList.contains(`highlight`)?(o=i,c.zIndex=1):(o=null,c.zIndex=null)}),s.push(c)}async function d(){let e=document.getElementById(`map`);e.classList.toggle(`dark-mode`);let t=document.getElementById(`mode-toggle`);t&&(e.classList.contains(`dark-mode`)?t.textContent=`Light Mode`:t.textContent=`Dark Mode`),s.forEach(e=>{e.map=null});let{Map:n}=await google.maps.importLibrary(`maps`);a=new n(e,{center:a.getCenter(),zoom:a.getZoom(),minZoom:5,disableDefaultUI:!0,mapId:e.classList.contains(`dark-mode`)?i:r,clickableIcons:!1});let c=[...s];s=[];for(let t of c){t.map=a;let n=t.firstElementChild;e.classList.contains(`dark-mode`)?n.setMode(`dark`):n.setMode(`light`),s.push(t)}a.addListener(`click`,async e=>{let t=e.domEvent.target,n=!1;for(;t;){if(t.tagName===`SIMPLE-WEATHER-WIDGET`||t.classList.contains(`gm-control-active`)){n=!0;break}t=t.parentElement}if(!n&&e.latLng){if(o){let e=o.shadowRoot.getElementById(`rain-details`);e.style.display=`none`,o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`);let t=s.find(e=>e.firstElementChild===o);t&&(t.zIndex=null),o=null}let t=s.findIndex(e=>e.markerType===`dynamic`);t!==-1&&(s[t].map=null,s.splice(t,1)),await u({name:`Clicked Location`,lat:e.latLng.lat(),lng:e.latLng.lng()},`dynamic`)}})}var f=[{name:`London`,lat:51.5074,lng:-.1278},{name:`Brussels`,lat:50.8503,lng:4.3517},{name:`Luxembourg`,lat:49.8153,lng:6.1296},{name:`Amsterdam`,lat:52.3676,lng:4.9041},{name:`Berlin`,lat:52.52,lng:13.405},{name:`Rome`,lat:41.9028,lng:12.4964},{name:`Geneva`,lat:46.2044,lng:6.14324},{name:`Barcelona`,lat:41.3874,lng:-2.1686},{name:`Milan`,lat:45.4685,lng:9.1824}];async function p(){for(let e of f)await u(e,`button`)}function m(){if(o){let e=s.find(e=>e.firstElementChild===o&&e.markerType===`button`);if(e){let t=o.shadowRoot.getElementById(`rain-details`);t.style.display=`none`,o.shadowRoot.querySelector(`.widget-container`).classList.remove(`highlight`),e.zIndex=null,o=null}}s.filter(e=>e.markerType===`button`).forEach(e=>{e.map=null;let t=s.indexOf(e);t>-1&&s.splice(t,1)})}async function h(e,r,i){let a=`${t}?key=${n}&location.latitude=${i.lat()}&location.longitude=${i.lng()}`;try{let e=await fetch(a);if(e.ok){let t=await e.json();console.log(`Weather data fetched for marker:`,t),r.data=t}else{let t=await e.json();if(console.error(`API error response:`,t),e.status===404&&t?.error?.status===`NOT_FOUND`)r.data={error:`Location not supported`};else throw Error(`HTTP error! status: ${e.status}`)}}catch(e){console.error(`Error fetching weather data for marker:`,e),r.data={error:`Failed to fetch weather data`}}}l(),customElements.whenDefined(`simple-weather-widget`).then(()=>{let e=document.getElementById(`mode-toggle`);e&&e.addEventListener(`click`,()=>{d()});let t=document.getElementById(`load-markers-button`);t&&t.addEventListener(`click`,()=>{c?(m(),c=!1,t.textContent=`Load Markers`):(p(),c=!0,t.textContent=`Remove Markers`)})}); \ No newline at end of file diff --git a/dist/samples/weather-api-current-compact/dist/index.html b/dist/samples/weather-api-current-compact/dist/index.html index 5760e316f..1a73df6b5 100644 --- a/dist/samples/weather-api-current-compact/dist/index.html +++ b/dist/samples/weather-api-current-compact/dist/index.html @@ -16,7 +16,7 @@ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" }); - + diff --git a/dist/samples/weather-api-current-compact/docs/index.js b/dist/samples/weather-api-current-compact/docs/index.js index 98a3191b6..aff418417 100644 --- a/dist/samples/weather-api-current-compact/docs/index.js +++ b/dist/samples/weather-api-current-compact/docs/index.js @@ -126,7 +126,7 @@ async function createAndAddMarker(location, markerType) { } const marker = new AdvancedMarkerElement({ - map: map, + map, position: { lat: location.lat, lng: location.lng }, title: location.name, // Add a title for accessibility gmpClickable: true, @@ -134,7 +134,6 @@ async function createAndAddMarker(location, markerType) { marker.append(weatherWidget); // Store the marker type - marker.markerType = markerType; // Fetch and update weather data for this location diff --git a/dist/samples/weather-api-current-compact/docs/index.ts b/dist/samples/weather-api-current-compact/docs/index.ts index 836daa2e8..acbe4793f 100644 --- a/dist/samples/weather-api-current-compact/docs/index.ts +++ b/dist/samples/weather-api-current-compact/docs/index.ts @@ -3,6 +3,8 @@ * Copyright 2025 Google LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ // [START maps_weather_api_compact] import './simple-weather-widget'; // Import the custom element @@ -22,7 +24,7 @@ async function init(): Promise { void google.maps.importLibrary('marker'); // preload const { Map } = await google.maps.importLibrary('maps'); - map = new Map(document.getElementById('map') as HTMLElement, { + map = new Map(document.getElementById('map')!, { center: { lat: 48.8566, lng: 2.3522 }, // Set center to Paris initially, will change based on markers zoom: 6, minZoom: 5, // Set minimum zoom level to 5 @@ -48,7 +50,7 @@ async function init(): Promise { map.addListener('click', async (event: google.maps.MapMouseEvent) => { // Check if the click was on a marker. If so, the marker's own click listener will handle it. // If not, create a new dynamic marker or hide the active widget. - let target = event.domEvent.target as HTMLElement; + let target = event.domEvent.target as Element; let isClickOnMarker = false; while (target) { if ( @@ -59,7 +61,7 @@ async function init(): Promise { isClickOnMarker = true; break; } - target = target.parentElement as HTMLElement; + target = target.parentElement!; } if (!isClickOnMarker && event.latLng) { @@ -68,12 +70,12 @@ async function init(): Promise { const rainDetailsElement = activeWeatherWidget.shadowRoot!.getElementById( 'rain-details' - ) as HTMLDivElement; + )!; rainDetailsElement.style.display = 'none'; const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); // Find the marker associated with the active widget and reset its zIndex const activeMarker = allMarkers.find( @@ -87,7 +89,6 @@ async function init(): Promise { // Remove the previous dynamic marker if it exists const currentDynamicMarkerIndex = allMarkers.findIndex( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker) => (marker as any).markerType === 'dynamic' ); if (currentDynamicMarkerIndex !== -1) { @@ -126,13 +127,13 @@ async function createAndAddMarker( ) as SimpleWeatherWidget; // Apply dark mode if the map container is in dark mode - const mapContainer = document.getElementById('map') as HTMLElement; + const mapContainer = document.getElementById('map')!; if (mapContainer.classList.contains('dark-mode')) { weatherWidget.setMode('dark'); } const marker = new AdvancedMarkerElement({ - map: map, + map, position: { lat: location.lat, lng: location.lng }, title: location.name, // Add a title for accessibility gmpClickable: true, @@ -140,7 +141,6 @@ async function createAndAddMarker( marker.append(weatherWidget); // Store the marker type - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker as any).markerType = markerType; // Fetch and update weather data for this location @@ -152,16 +152,15 @@ async function createAndAddMarker( // Add click listener to the marker marker.addEventListener('gmp-click', () => { - const widgetContainer = weatherWidget.shadowRoot!.querySelector( - '.widget-container' - ) as HTMLDivElement; + const widgetContainer = + weatherWidget.shadowRoot!.querySelector('.widget-container')!; // If a widget is currently active and it's not the clicked one, remove its highlight class and reset zIndex if (activeWeatherWidget && activeWeatherWidget !== weatherWidget) { const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); // Find the marker associated with the active widget and reset its zIndex const activeMarker = allMarkers.find( @@ -196,7 +195,7 @@ async function createAndAddMarker( * Toggles the dark mode class on the body element. */ async function toggleDarkMode() { - const mapContainer = document.getElementById('map') as HTMLElement; + const mapContainer = document.getElementById('map')!; mapContainer.classList.toggle('dark-mode'); const modeToggleButton = document.getElementById('mode-toggle'); @@ -249,7 +248,7 @@ async function toggleDarkMode() { map.addListener('click', async (event: google.maps.MapMouseEvent) => { // Check if the click was on a marker. If so, the marker's own click listener will handle it. // If not, create a new dynamic marker or hide the active widget. - let target = event.domEvent.target as HTMLElement; + let target = event.domEvent.target as Element; let isClickOnMarker = false; while (target) { if ( @@ -260,7 +259,7 @@ async function toggleDarkMode() { isClickOnMarker = true; break; } - target = target.parentElement as HTMLElement; + target = target.parentElement!; } if (!isClickOnMarker && event.latLng) { @@ -268,12 +267,12 @@ async function toggleDarkMode() { const rainDetailsElement = activeWeatherWidget.shadowRoot!.getElementById( 'rain-details' - ) as HTMLDivElement; + )!; rainDetailsElement.style.display = 'none'; const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); // Find the marker associated with the active widget and reset its zIndex const activeMarker = allMarkers.find( @@ -287,7 +286,6 @@ async function toggleDarkMode() { // Remove the previous dynamic marker if it exists const currentDynamicMarkerIndex = allMarkers.findIndex( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker) => (marker as any).markerType === 'dynamic' ); if (currentDynamicMarkerIndex !== -1) { @@ -332,19 +330,16 @@ function removeButtonMarkers(): void { const buttonMarker = allMarkers.find( (marker) => marker.firstElementChild === activeWeatherWidget && - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker as any).markerType === 'button' ); if (buttonMarker) { const rainDetailsElement = - activeWeatherWidget.shadowRoot!.getElementById( - 'rain-details' - ) as HTMLDivElement; + activeWeatherWidget.shadowRoot!.getElementById('rain-details')!; rainDetailsElement.style.display = 'none'; const activeWidgetContainer = activeWeatherWidget.shadowRoot!.querySelector( '.widget-container' - ) as HTMLDivElement; + )!; activeWidgetContainer.classList.remove('highlight'); buttonMarker.zIndex = null; activeWeatherWidget = null; // Clear the active widget @@ -353,7 +348,6 @@ function removeButtonMarkers(): void { // Remove button markers from the map and the allMarkers array const markersToRemove = allMarkers.filter( - // eslint-disable-next-line @typescript-eslint/no-explicit-any (marker) => (marker as any).markerType === 'button' ); markersToRemove.forEach((marker) => { diff --git a/dist/samples/weather-api-current-compact/jsfiddle/demo.js b/dist/samples/weather-api-current-compact/jsfiddle/demo.js index 0632b549a..8b35e1c45 100644 --- a/dist/samples/weather-api-current-compact/jsfiddle/demo.js +++ b/dist/samples/weather-api-current-compact/jsfiddle/demo.js @@ -125,7 +125,7 @@ async function createAndAddMarker(location, markerType) { } const marker = new AdvancedMarkerElement({ - map: map, + map, position: { lat: location.lat, lng: location.lng }, title: location.name, // Add a title for accessibility gmpClickable: true, @@ -133,7 +133,6 @@ async function createAndAddMarker(location, markerType) { marker.append(weatherWidget); // Store the marker type - marker.markerType = markerType; // Fetch and update weather data for this location diff --git a/dist/samples/web-components-map/app/index.html b/dist/samples/web-components-map/app/index.html index 5d49e4086..57b013c82 100644 --- a/dist/samples/web-components-map/app/index.html +++ b/dist/samples/web-components-map/app/index.html @@ -13,7 +13,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> diff --git a/dist/samples/web-components-map/dist/index.html b/dist/samples/web-components-map/dist/index.html index 62d9e08d9..1a29dfc1e 100644 --- a/dist/samples/web-components-map/dist/index.html +++ b/dist/samples/web-components-map/dist/index.html @@ -11,7 +11,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> diff --git a/dist/samples/web-components-map/docs/index.html b/dist/samples/web-components-map/docs/index.html index 5d49e4086..57b013c82 100644 --- a/dist/samples/web-components-map/docs/index.html +++ b/dist/samples/web-components-map/docs/index.html @@ -13,7 +13,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> diff --git a/dist/samples/web-components-map/jsfiddle/demo.html b/dist/samples/web-components-map/jsfiddle/demo.html index a834dd748..8aaf4f96c 100644 --- a/dist/samples/web-components-map/jsfiddle/demo.html +++ b/dist/samples/web-components-map/jsfiddle/demo.html @@ -13,7 +13,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> diff --git a/dist/samples/web-components-markers/dist/index.html b/dist/samples/web-components-markers/dist/index.html index 067a745a4..4c325e1d0 100644 --- a/dist/samples/web-components-markers/dist/index.html +++ b/dist/samples/web-components-markers/dist/index.html @@ -21,7 +21,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> diff --git a/dist/samples/web-components-markers/docs/index.html b/dist/samples/web-components-markers/docs/index.html index 633fa77e2..addb240fb 100644 --- a/dist/samples/web-components-markers/docs/index.html +++ b/dist/samples/web-components-markers/docs/index.html @@ -22,7 +22,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker"> diff --git a/dist/samples/web-components-markers/jsfiddle/demo.html b/dist/samples/web-components-markers/jsfiddle/demo.html index 60aa2c306..cc7b04974 100644 --- a/dist/samples/web-components-markers/jsfiddle/demo.html +++ b/dist/samples/web-components-markers/jsfiddle/demo.html @@ -22,7 +22,7 @@ + src="https://maps.googleapis.com/maps/api/js?loading=async&key=AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8&libraries=maps,marker">