{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6*","webpack:/webpack/bootstrap 32ff00c1e4c8629564e2?1d65*","webpack:///src/createAutocompleteDataset.js?1b89*","webpack:///src/navigatorLanguage.js?b003*","webpack:///~/insert-css/index.js?f60e*","webpack:///src/createAutocompleteSource.js?ddf0*","webpack:///src/defaultTemplates.js?34d1*","webpack:///src/findCountryCode.js?d09b*","webpack:///src/findType.js?4fba*","webpack:///src/formatDropdownValue.js?9a5f*","webpack:///src/formatHit.js?aa26*","webpack:///src/formatInputValue.js?0f7a*"],"names":["root","factory","exports","module","define","amd","this","modules","installedModules","moduleId","i","l","__webpack_require__","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","templates","source","formatInputValue","default","_extends","options","undefined","displayKey","navigator","language","insertCss","css","Error","usage","position","prepend","container","document","querySelector","containerId","containers","push","styleElements","styleElement","insertBefore","childNodes","appendChild","styleSheet","cssText","textContent","createStyleElement","createElement","setAttribute","algoliasearch","clientOptions","_ref","apiKey","appId","hitsPerPage","aroundLatLng","aroundRadius","aroundLatLngViaIP","insideBoundingBox","insidePolygon","countries","computeQueryParams","_ref$computeQueryPara","params","useDeviceLocation","_ref$useDeviceLocatio","_ref$language","split","onHits","onError","_ref$onHits","_ref$onError","e","onRateLimitReached","type","placesClient","addAlgoliaAgent","initPlaces","defaultQueryParams","toLowerCase","map","country","coords","_ref2","userCoords","latitude","longitude","query","cb","hits","content","hitIndex","_extends2","_defineProperty","then","hit","rawAnswer","statusCode","footer","value","_algolia2","trim","_osm2","suggestion","findCountryCode","tagIndex","tag","tags","length","find","match","types","city","amenity/bus_station","amenity/townhall","railway/station","aeroway/aerodrome","aeroway/terminal","aeroway/gate","indexOf","t","highlight","administrative","token","icons","filter","address","busStop","trainStation","townhall","airport","_plane2","defaultValue","highlightedValues","bestAttributes","matchLevel","index","words","matchedWords","sort","a","b","suburb","getBestHighlightedForm","_highlightResult","county","countryCode","_findCountryCode2","_tags","latlng","_findType2","lat","lng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,EAAA,KAAA4E,QAAA,YAAA,KAAAxD,wDAba3G,EAAAyB,QAASD","file":"dist/cdn/placesAutocompleteDataset.min.js","sourceRoot":"","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"placesAutocompleteDataset\"] = factory();\n\telse\n\t\troot[\"placesAutocompleteDataset\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 83);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 32ff00c1e4c8629564e2","import createAutocompleteSource from './createAutocompleteSource.js';\nimport defaultTemplates from './defaultTemplates.js';\n\nexport default function createAutocompleteDataset(options) {\n const templates = {\n ...defaultTemplates,\n ...options.templates,\n };\n\n const source = createAutocompleteSource({\n ...options,\n formatInputValue: templates.value,\n templates: undefined,\n });\n\n return {\n source,\n templates,\n displayKey: 'value',\n name: 'places',\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/createAutocompleteDataset.js","// polyfill for navigator.language (IE <= 10)\n// not polyfilled by https://cdn.polyfill.io/v2/docs/\n\n// Defined: http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#navigatorlanguage\n// with allowable values at http://www.ietf.org/rfc/bcp/bcp47.txt\n// Note that the HTML spec suggests that anonymizing services return \"en-US\" by default for\n// user privacy (so your app may wish to provide a means of changing the locale)\nif (!('language' in navigator)) {\n navigator.language =\n // IE 10 in IE8 mode on Windows 7 uses upper-case in\n // navigator.userLanguage country codes but per\n // http://msdn.microsoft.com/en-us/library/ie/ms533052.aspx (via\n // http://msdn.microsoft.com/en-us/library/ie/ms534713.aspx), they\n // appear to be in lower case, so we bring them into harmony with navigator.language.\n (navigator.userLanguage &&\n navigator.userLanguage.replace(\n /-[a-z]{2}$/,\n String.prototype.toUpperCase\n )) ||\n 'en-US'; // Default for anonymizing services: http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#navigatorlanguage\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/navigatorLanguage.js","var containers = []; // will store container HTMLElement references\nvar styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}\n\nvar usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';\n\nfunction insertCss(css, options) {\n options = options || {};\n\n if (css === undefined) {\n throw new Error(usage);\n }\n\n var position = options.prepend === true ? 'prepend' : 'append';\n var container = options.container !== undefined ? options.container : document.querySelector('head');\n var containerId = containers.indexOf(container);\n\n // first time we see this container, create the necessary entries\n if (containerId === -1) {\n containerId = containers.push(container) - 1;\n styleElements[containerId] = {};\n }\n\n // try to get the correponding container + position styleElement, create it otherwise\n var styleElement;\n\n if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {\n styleElement = styleElements[containerId][position];\n } else {\n styleElement = styleElements[containerId][position] = createStyleElement();\n\n if (position === 'prepend') {\n container.insertBefore(styleElement, container.childNodes[0]);\n } else {\n container.appendChild(styleElement);\n }\n }\n\n // strip potential UTF-8 BOM if css was read from a file\n if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }\n\n // actually add the stylesheet\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText += css\n } else {\n styleElement.textContent += css;\n }\n\n return styleElement;\n};\n\nfunction createStyleElement() {\n var styleElement = document.createElement('style');\n styleElement.setAttribute('type', 'text/css');\n return styleElement;\n}\n\nmodule.exports = insertCss;\nmodule.exports.insertCss = insertCss;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/insert-css/index.js\n// module id = 16\n// module chunks = 0 1 2","import formatHit from './formatHit.js';\nimport version from './version.js';\n\nexport default function createAutocompleteSource({\n algoliasearch,\n clientOptions,\n apiKey,\n appId,\n hitsPerPage,\n aroundLatLng,\n aroundRadius,\n aroundLatLngViaIP,\n insideBoundingBox,\n insidePolygon,\n countries,\n formatInputValue,\n computeQueryParams = params => params,\n useDeviceLocation = false,\n language = navigator.language.split('-')[0],\n onHits = () => {},\n onError = e => {\n throw e;\n },\n onRateLimitReached,\n type,\n}) {\n const placesClient = algoliasearch.initPlaces(appId, apiKey, clientOptions);\n placesClient.as.addAlgoliaAgent(`Algolia Places ${version}`);\n\n const defaultQueryParams = {\n countries,\n hitsPerPage: hitsPerPage || 5,\n language,\n type,\n };\n\n if (Array.isArray(defaultQueryParams.countries)) {\n defaultQueryParams.countries = defaultQueryParams.countries.map(country =>\n country.toLowerCase()\n );\n }\n\n if (typeof defaultQueryParams.language === 'string') {\n defaultQueryParams.language = defaultQueryParams.language.toLowerCase();\n }\n\n if (aroundLatLng) {\n defaultQueryParams.aroundLatLng = aroundLatLng;\n } else if (aroundLatLngViaIP !== undefined) {\n defaultQueryParams.aroundLatLngViaIP = aroundLatLngViaIP;\n }\n\n if (aroundRadius) {\n defaultQueryParams.aroundRadius = aroundRadius;\n }\n\n if (insideBoundingBox) {\n defaultQueryParams.insideBoundingBox = insideBoundingBox;\n }\n\n if (insidePolygon) {\n defaultQueryParams.insidePolygon = insidePolygon;\n }\n\n let userCoords;\n if (useDeviceLocation) {\n navigator.geolocation.watchPosition(({ coords }) => {\n userCoords = `${coords.latitude},${coords.longitude}`;\n });\n }\n\n return (query, cb) =>\n placesClient\n .search(\n computeQueryParams({\n ...defaultQueryParams,\n [userCoords ? 'aroundLatLng' : undefined]: userCoords,\n query,\n })\n )\n .then(content => {\n const hits = content.hits.map((hit, hitIndex) =>\n formatHit({\n formatInputValue,\n hit,\n hitIndex,\n query,\n rawAnswer: content,\n })\n );\n\n onHits({\n hits,\n query,\n rawAnswer: content,\n });\n\n return hits;\n })\n .then(cb)\n .catch(e => {\n if (e.statusCode === 429) {\n onRateLimitReached();\n return;\n }\n\n onError(e);\n });\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/createAutocompleteSource.js","import value from './formatInputValue.js';\nimport suggestion from './formatDropdownValue.js';\nimport algoliaLogo from './icons/algolia.svg';\nimport osmLogo from './icons/osm.svg';\n\nexport default {\n footer: `
`,\n value,\n suggestion,\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/defaultTemplates.js","export default function findCountryCode(tags) {\n for (let tagIndex = 0; tagIndex < tags.length; tagIndex++) {\n const tag = tags[tagIndex];\n const find = tag.match(/country\\/(.*)?/);\n if (find) {\n return find[1];\n }\n }\n\n return undefined;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/findCountryCode.js","export default function findType(tags) {\n const types = {\n country: 'country',\n city: 'city',\n 'amenity/bus_station': 'busStop',\n 'amenity/townhall': 'townhall',\n 'railway/station': 'trainStation',\n 'aeroway/aerodrome': 'airport',\n 'aeroway/terminal': 'airport',\n 'aeroway/gate': 'airport',\n };\n\n for (const t in types) {\n if (tags.indexOf(t) !== -1) {\n return types[t];\n }\n }\n\n return 'address';\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/findType.js","import addressIcon from './icons/address.svg';\nimport cityIcon from './icons/city.svg';\nimport countryIcon from './icons/country.svg';\nimport busIcon from './icons/bus.svg';\nimport trainIcon from './icons/train.svg';\nimport townhallIcon from './icons/townhall.svg';\nimport planeIcon from './icons/plane.svg';\n\nconst icons = {\n address: addressIcon,\n city: cityIcon,\n country: countryIcon,\n busStop: busIcon,\n trainStation: trainIcon,\n townhall: townhallIcon,\n airport: planeIcon,\n};\n\nexport default function formatDropdownValue({ type, highlight }) {\n const { name, administrative, city, country } = highlight;\n\n const out = ` \n${name}\n\n ${[city, administrative, country]\n .filter(token => token !== undefined)\n .join(', ')}`.replace(/\\s*\\n\\s*/g, ' ');\n\n return out;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/formatDropdownValue.js","import findCountryCode from './findCountryCode.js';\nimport findType from './findType.js';\n\nfunction getBestHighlightedForm(highlightedValues) {\n const defaultValue = highlightedValues[0].value;\n // collect all other matches\n const bestAttributes = [];\n for (let i = 1; i < highlightedValues.length; ++i) {\n if (highlightedValues[i].matchLevel !== 'none') {\n bestAttributes.push({\n index: i,\n words: highlightedValues[i].matchedWords,\n });\n }\n }\n // no matches in this attribute, retrieve first value\n if (bestAttributes.length === 0) {\n return defaultValue;\n }\n // sort the matches by `desc(words), asc(index)`\n bestAttributes.sort((a, b) => {\n if (a.words > b.words) {\n return -1;\n } else if (a.words < b.words) {\n return 1;\n }\n return a.index - b.index;\n });\n // and append the best match to the first value\n return bestAttributes[0].index === 0\n ? `${defaultValue} (${highlightedValues[bestAttributes[1].index].value})`\n : `${highlightedValues[bestAttributes[0].index].value} (${defaultValue})`;\n}\n\nexport default function formatHit({\n formatInputValue,\n hit,\n hitIndex,\n query,\n rawAnswer,\n}) {\n try {\n const name = hit.locale_names[0];\n const country = hit.country;\n const administrative = hit.administrative && hit.administrative[0] !== name\n ? hit.administrative[0]\n : undefined;\n const city = hit.city && hit.city[0] !== name ? hit.city[0] : undefined;\n const suburb = hit.suburb && hit.suburb[0] !== name\n ? hit.suburb[0]\n : undefined;\n\n const county = hit.county && hit.county[0] !== name\n ? hit.county[0]\n : undefined;\n\n const highlight = {\n name: getBestHighlightedForm(hit._highlightResult.locale_names),\n city: city\n ? getBestHighlightedForm(hit._highlightResult.city)\n : undefined,\n administrative: administrative\n ? getBestHighlightedForm(hit._highlightResult.administrative)\n : undefined,\n country: country ? hit._highlightResult.country.value : undefined,\n suburb: suburb\n ? getBestHighlightedForm(hit._highlightResult.suburb)\n : undefined,\n county: county\n ? getBestHighlightedForm(hit._highlightResult.county)\n : undefined,\n };\n\n const suggestion = {\n name,\n administrative,\n county,\n city,\n suburb,\n country,\n countryCode: findCountryCode(hit._tags),\n type: findType(hit._tags),\n latlng: {\n lat: hit._geoloc.lat,\n lng: hit._geoloc.lng,\n },\n postcode: hit.postcode && hit.postcode[0],\n };\n\n // this is the value to put inside the