diff --git a/CHANGELOG.md b/CHANGELOG.md index 480682a..d2f224b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,16 @@ _Breaking changes, which may affect downstream projects, are marked with a_ ⚠ [#xxx]: https://github.com/osmlab/osm-auth/issues/xxx --> +## 2.1.0 +##### 2023-May-17 +* Add fetch wrapper ([#112], thanks [@dschep]) +* Fix singlepage authentication support ([#113], thanks [@dschep]) + +[#112]: https://github.com/osmlab/osm-auth/issues/112 +[#113]: https://github.com/osmlab/osm-auth/issues/113 +[@dschep]: https://github.com/dschep + + ## 2.0.1 ##### 2022-Sep-27 * Fix `osm-auth.d.ts` types declaration ([#106], thanks [@caspg]) diff --git a/dist/osm-auth.cjs b/dist/osm-auth.cjs index ecb8c32..8cf9c6c 100644 --- a/dist/osm-auth.cjs +++ b/dist/osm-auth.cjs @@ -55,7 +55,14 @@ function osmAuth(o) { response_type: "code", scope: o.scope }); - if (!o.singlepage) { + if (o.singlepage) { + var params = utilStringQs(window.location.search.slice(1)); + if (params.code) { + getAccessToken(params.code); + } else { + window.location = url; + } + } else { var w = 600; var h = 550; var settings = [ @@ -76,8 +83,8 @@ function osmAuth(o) { } } window.authComplete = function(url2) { - var params = utilStringQs(url2.split("?")[1]); - getAccessToken(params.code); + var params2 = utilStringQs(url2.split("?")[1]); + getAccessToken(params2.code); delete window.authComplete; }; function getAccessToken(auth_code) { diff --git a/dist/osm-auth.cjs.map b/dist/osm-auth.cjs.map index 0e2835a..9d7117e 100644 --- a/dist/osm-auth.cjs.map +++ b/dist/osm-auth.cjs.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/osm-auth.mjs"], - "sourcesContent": ["import store from 'store';\n\n\n/**\n * osmAuth\n * Easy authentication with OpenStreetMap over OAuth 2.0.\n * @module\n *\n * @param o `Object` containing options:\n * @param o.scope OAuth2 scopes requested (e.g. \"read_prefs write_api\")\n * @param o.client_id OAuth2 client ID\n * @param o.client_secret OAuth2 client secret\n * @param o.redirect_uri OAuth2 redirect URI (e.g. \"http://127.0.0.1:8080/land.html\")\n * @param o.access_token Can pre-authorize with an OAuth2 bearer token if you have one\n * @param o.url A base url (default: \"https://www.openstreetmap.org\")\n * @param o.auto If `true`, attempt to authenticate automatically when calling `.xhr()` (default: `false`)\n * @param o.singlepage If `true`, use page redirection instead of a popup (default: `false`)\n * @param o.loading Function called when auth-related xhr calls start\n * @param o.done Function called when auth-related xhr calls end\n * @return `self`\n */\nexport function osmAuth(o) {\n var oauth = {};\n\n /**\n * authenticated\n * Test whether the user is currently authenticated\n * @return `true` if authenticated, `false` if not\n */\n oauth.authenticated = function () {\n return !!token('oauth2_access_token');\n };\n\n\n /**\n * logout\n * Removes any stored authentication tokens (legacy OAuth1 tokens too)\n *\n * @return `self`\n */\n oauth.logout = function () {\n token('oauth2_access_token', ''); // OAuth2\n token('oauth_token', ''); // OAuth1\n token('oauth_token_secret', ''); // OAuth1\n token('oauth_request_token_secret', ''); // OAuth1\n return oauth;\n };\n\n\n /**\n * authenticate\n * First logs out, then runs the authentiation flow, finally calls the callback.\n * TODO: detect lack of click event (probably can settimeout it)\n *\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.authenticate = function (callback) {\n if (oauth.authenticated()) {\n callback(null, oauth);\n return;\n }\n\n oauth.logout();\n\n // ## Request authorization to access resources from the user\n // and receive authorization code\n var url =\n o.url +\n '/oauth2/authorize?' +\n utilQsString({\n client_id: o.client_id,\n redirect_uri: o.redirect_uri,\n response_type: 'code',\n scope: o.scope,\n });\n\n if (!o.singlepage) {\n // Create a 600x550 popup window in the center of the screen\n var w = 600;\n var h = 550;\n var settings = [\n ['width', w],\n ['height', h],\n ['left', window.screen.width / 2 - w / 2],\n ['top', window.screen.height / 2 - h / 2],\n ]\n .map(function (x) { return x.join('='); })\n .join(',');\n\n var popup = window.open('about:blank', 'oauth_window', settings);\n oauth.popupWindow = popup;\n popup.location = url;\n\n if (!popup) {\n var error = new Error('Popup was blocked');\n error.status = 'popup-blocked';\n throw error;\n }\n }\n\n // Called by a function in the redirect URL page, in the popup window. The\n // window closes itself.\n window.authComplete = function (url) {\n var params = utilStringQs(url.split('?')[1]);\n getAccessToken(params.code);\n delete window.authComplete;\n };\n\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the `auth_code`, brought\n // in from a function call on a landing page popup.\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n };\n\n\n /**\n * bringPopupWindowToFront\n * Tries to bring an existing authentication popup to the front.\n * @return `true` if it succeeded, `false` if not\n */\n oauth.bringPopupWindowToFront = function () {\n var broughtPopupToFront = false;\n try {\n // This may cause a cross-origin error:\n // `DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.`\n if (oauth.popupWindow && !oauth.popupWindow.closed) {\n oauth.popupWindow.focus();\n broughtPopupToFront = true;\n }\n } catch (err) {\n // Bringing popup window to front failed (probably because of the cross-origin error mentioned above)\n }\n return broughtPopupToFront;\n };\n\n\n /**\n * bootstrapToken\n * The authorization code is a temporary code that a client can exchange for an access token.\n * If using this library in single-page mode, you'll need to call this once your application\n * has an `auth_code` and wants to get an access_token.\n *\n * @param auth_code The OAuth2 `auth_code`\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.bootstrapToken = function (auth_code, callback) {\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the authorization_code\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n\n getAccessToken(auth_code);\n };\n\n /**\n * fetch\n * A `fetch` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/fetch\n *\n * @param path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `options.prefix`=`false`)\n * @param options\n * @param options.method Passed to `fetch` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.body Passed to `fetch`\n * @param options.headers `Object` containing request headers\n * @return `Promise` that resolves to a `Response` if authenticated, otherwise `null`\n */\n oauth.fetch = function (path, options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? o.url + path : path;\n var headers = options.headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n headers.Authorization = 'Bearer ' + token('oauth2_access_token');\n return fetch(url, {\n method: options.method,\n body: options.body,\n headers: headers,\n }).then((resp) => {\n var contentType = resp.headers.get('content-type').split(';')[0];\n switch (contentType) {\n case 'text/html':\n case 'text/xml':\n return resp\n .text()\n .then((txt) =>\n new window.DOMParser().parseFromString(txt, contentType)\n );\n case 'application/html':\n return resp.json();\n default:\n return resp.text();\n }\n });\n }\n };\n\n /**\n * xhr\n * A `XMLHttpRequest` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param options\n * @param options.method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `prefix`=`false`)\n * @param options.content Passed to `xhr.send`\n * @param options.headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest` if authenticated, otherwise `null`\n */\n oauth.xhr = function (options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? (o.url + options.path) : options.path;\n return oauth.rawxhr(\n options.method,\n url,\n token('oauth2_access_token'),\n options.content,\n options.headers,\n done\n );\n }\n\n function done(err, xhr) {\n if (err) {\n callback(err);\n } else if (xhr.responseXML) {\n callback(err, xhr.responseXML);\n } else {\n callback(err, xhr.response);\n }\n }\n };\n\n\n /**\n * rawxhr\n * Creates the XMLHttpRequest set up with a header and response handling\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param url Passed to `xhr.open`\n * @param access_token OAuth2 bearer token\n * @param data Passed to `xhr.send`\n * @param headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest`\n */\n oauth.rawxhr = function (method, url, access_token, data, headers, callback) {\n headers = headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n\n if (access_token) {\n headers.Authorization = 'Bearer ' + access_token;\n }\n\n var xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function () {\n if (4 === xhr.readyState && 0 !== xhr.status) {\n if (/^20\\d$/.test(xhr.status)) { // a 20x status code - OK\n callback(null, xhr);\n } else {\n callback(xhr, null);\n }\n }\n };\n xhr.onerror = function (e) {\n callback(e, null);\n };\n\n xhr.open(method, url, true);\n for (var h in headers) xhr.setRequestHeader(h, headers[h]);\n\n xhr.send(data);\n return xhr;\n };\n\n\n /**\n * preauth\n * Pre-authorize this object, if we already have access token from the start\n *\n * @param val `Object` containing `access_token` property\n * @return `self`\n */\n oauth.preauth = function (val) {\n if (val && val.access_token) {\n token('oauth2_access_token', val.access_token);\n }\n return oauth;\n };\n\n\n /**\n * options (getter / setter)\n * If passed with no arguments, just return the options\n * If passed an Object, set the options then attempt to pre-authorize\n *\n * @param val? Object containing options\n * @return current `options` (if getting), or `self` (if setting)\n */\n oauth.options = function (val) {\n if (!arguments.length) return o;\n\n o = val;\n o.url = o.url || 'https://www.openstreetmap.org';\n o.auto = o.auto || false;\n o.singlepage = o.singlepage || false;\n\n // Optional loading and loading-done functions for nice UI feedback.\n // by default, no-ops\n o.loading = o.loading || function () {};\n o.done = o.done || function () {};\n return oauth.preauth(o);\n };\n\n\n // Everything below here is initialization/setup code\n\n // get/set tokens. These are prefixed with the base URL so that `osm-auth`\n // can be used with multiple APIs and the keys in `localStorage`\n // will not clash\n var token;\n\n if (store.enabled) {\n token = function (x, y) {\n if (arguments.length === 1) return store.get(o.url + x);\n else if (arguments.length === 2) return store.set(o.url + x, y);\n };\n } else {\n var storage = {};\n token = function (x, y) {\n if (arguments.length === 1) return storage[o.url + x];\n else if (arguments.length === 2) return (storage[o.url + x] = y);\n };\n }\n\n // Handle options and attempt to pre-authorize\n oauth.options(o);\n\n return oauth;\n}\n\n\n/** Transforms object into query string\n * @param obj\n * @param noencode\n * @returns query string\n */\nfunction utilQsString(obj) {\n return Object.keys(obj)\n .sort()\n .map(function(key) {\n return (encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n })\n .join('&');\n}\n\n/** Transforms query string into object\n * @param str\n * @returns object\n */\nfunction utilStringQs(str) {\n var i = 0; // advance past any leading '?' or '#' characters\n while (i < str.length && (str[i] === '?' || str[i] === '#')) i++;\n str = str.slice(i);\n\n return str.split('&').reduce(function(obj, pair) {\n var parts = pair.split('=');\n if (parts.length === 2) {\n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,IAAI,MAAM,CAAC;AAEjB,SAAO,IAAI,MAAM,GAAG,EAAE,OAAO,SAAS,KAAK,MAAM;AAC/C,QAAI,QAAQ,KAAK,MAAM,GAAG;AAC1B,QAAI,MAAM,WAAW,GAAG;AACtB,UAAI,MAAM,CAAC,CAAC,IAAI,mBAAmB,MAAM,CAAC,CAAC;AAAA,IAC7C;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;", - "names": ["url", "auth_code", "store"] + "sourcesContent": ["import store from 'store';\n\n\n/**\n * osmAuth\n * Easy authentication with OpenStreetMap over OAuth 2.0.\n * @module\n *\n * @param o `Object` containing options:\n * @param o.scope OAuth2 scopes requested (e.g. \"read_prefs write_api\")\n * @param o.client_id OAuth2 client ID\n * @param o.client_secret OAuth2 client secret\n * @param o.redirect_uri OAuth2 redirect URI (e.g. \"http://127.0.0.1:8080/land.html\")\n * @param o.access_token Can pre-authorize with an OAuth2 bearer token if you have one\n * @param o.url A base url (default: \"https://www.openstreetmap.org\")\n * @param o.auto If `true`, attempt to authenticate automatically when calling `.xhr()` (default: `false`)\n * @param o.singlepage If `true`, use page redirection instead of a popup (default: `false`)\n * @param o.loading Function called when auth-related xhr calls start\n * @param o.done Function called when auth-related xhr calls end\n * @return `self`\n */\nexport function osmAuth(o) {\n var oauth = {};\n\n /**\n * authenticated\n * Test whether the user is currently authenticated\n * @return `true` if authenticated, `false` if not\n */\n oauth.authenticated = function () {\n return !!token('oauth2_access_token');\n };\n\n\n /**\n * logout\n * Removes any stored authentication tokens (legacy OAuth1 tokens too)\n *\n * @return `self`\n */\n oauth.logout = function () {\n token('oauth2_access_token', ''); // OAuth2\n token('oauth_token', ''); // OAuth1\n token('oauth_token_secret', ''); // OAuth1\n token('oauth_request_token_secret', ''); // OAuth1\n return oauth;\n };\n\n\n /**\n * authenticate\n * First logs out, then runs the authentiation flow, finally calls the callback.\n * TODO: detect lack of click event (probably can settimeout it)\n *\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.authenticate = function (callback) {\n if (oauth.authenticated()) {\n callback(null, oauth);\n return;\n }\n\n oauth.logout();\n\n // ## Request authorization to access resources from the user\n // and receive authorization code\n var url =\n o.url +\n '/oauth2/authorize?' +\n utilQsString({\n client_id: o.client_id,\n redirect_uri: o.redirect_uri,\n response_type: 'code',\n scope: o.scope,\n });\n\n if (o.singlepage) {\n var params = utilStringQs(window.location.search.slice(1));\n if (params.code) {\n getAccessToken(params.code);\n } else {\n window.location = url;\n }\n } else {\n // Create a 600x550 popup window in the center of the screen\n var w = 600;\n var h = 550;\n var settings = [\n ['width', w],\n ['height', h],\n ['left', window.screen.width / 2 - w / 2],\n ['top', window.screen.height / 2 - h / 2],\n ]\n .map(function (x) { return x.join('='); })\n .join(',');\n\n var popup = window.open('about:blank', 'oauth_window', settings);\n oauth.popupWindow = popup;\n popup.location = url;\n\n if (!popup) {\n var error = new Error('Popup was blocked');\n error.status = 'popup-blocked';\n throw error;\n }\n }\n\n // Called by a function in the redirect URL page, in the popup window. The\n // window closes itself.\n window.authComplete = function (url) {\n var params = utilStringQs(url.split('?')[1]);\n getAccessToken(params.code);\n delete window.authComplete;\n };\n\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the `auth_code`, brought\n // in from a function call on a landing page popup.\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n };\n\n\n /**\n * bringPopupWindowToFront\n * Tries to bring an existing authentication popup to the front.\n * @return `true` if it succeeded, `false` if not\n */\n oauth.bringPopupWindowToFront = function () {\n var broughtPopupToFront = false;\n try {\n // This may cause a cross-origin error:\n // `DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.`\n if (oauth.popupWindow && !oauth.popupWindow.closed) {\n oauth.popupWindow.focus();\n broughtPopupToFront = true;\n }\n } catch (err) {\n // Bringing popup window to front failed (probably because of the cross-origin error mentioned above)\n }\n return broughtPopupToFront;\n };\n\n\n /**\n * bootstrapToken\n * The authorization code is a temporary code that a client can exchange for an access token.\n * If using this library in single-page mode, you'll need to call this once your application\n * has an `auth_code` and wants to get an access_token.\n *\n * @param auth_code The OAuth2 `auth_code`\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.bootstrapToken = function (auth_code, callback) {\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the authorization_code\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n\n getAccessToken(auth_code);\n };\n\n /**\n * fetch\n * A `fetch` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/fetch\n *\n * @param path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `options.prefix`=`false`)\n * @param options\n * @param options.method Passed to `fetch` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.body Passed to `fetch`\n * @param options.headers `Object` containing request headers\n * @return `Promise` that resolves to a `Response` if authenticated, otherwise `null`\n */\n oauth.fetch = function (path, options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? o.url + path : path;\n var headers = options.headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n headers.Authorization = 'Bearer ' + token('oauth2_access_token');\n return fetch(url, {\n method: options.method,\n body: options.body,\n headers: headers,\n }).then((resp) => {\n var contentType = resp.headers.get('content-type').split(';')[0];\n switch (contentType) {\n case 'text/html':\n case 'text/xml':\n return resp\n .text()\n .then((txt) =>\n new window.DOMParser().parseFromString(txt, contentType)\n );\n case 'application/html':\n return resp.json();\n default:\n return resp.text();\n }\n });\n }\n };\n\n /**\n * xhr\n * A `XMLHttpRequest` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param options\n * @param options.method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `prefix`=`false`)\n * @param options.content Passed to `xhr.send`\n * @param options.headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest` if authenticated, otherwise `null`\n */\n oauth.xhr = function (options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? (o.url + options.path) : options.path;\n return oauth.rawxhr(\n options.method,\n url,\n token('oauth2_access_token'),\n options.content,\n options.headers,\n done\n );\n }\n\n function done(err, xhr) {\n if (err) {\n callback(err);\n } else if (xhr.responseXML) {\n callback(err, xhr.responseXML);\n } else {\n callback(err, xhr.response);\n }\n }\n };\n\n\n /**\n * rawxhr\n * Creates the XMLHttpRequest set up with a header and response handling\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param url Passed to `xhr.open`\n * @param access_token OAuth2 bearer token\n * @param data Passed to `xhr.send`\n * @param headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest`\n */\n oauth.rawxhr = function (method, url, access_token, data, headers, callback) {\n headers = headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n\n if (access_token) {\n headers.Authorization = 'Bearer ' + access_token;\n }\n\n var xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function () {\n if (4 === xhr.readyState && 0 !== xhr.status) {\n if (/^20\\d$/.test(xhr.status)) { // a 20x status code - OK\n callback(null, xhr);\n } else {\n callback(xhr, null);\n }\n }\n };\n xhr.onerror = function (e) {\n callback(e, null);\n };\n\n xhr.open(method, url, true);\n for (var h in headers) xhr.setRequestHeader(h, headers[h]);\n\n xhr.send(data);\n return xhr;\n };\n\n\n /**\n * preauth\n * Pre-authorize this object, if we already have access token from the start\n *\n * @param val `Object` containing `access_token` property\n * @return `self`\n */\n oauth.preauth = function (val) {\n if (val && val.access_token) {\n token('oauth2_access_token', val.access_token);\n }\n return oauth;\n };\n\n\n /**\n * options (getter / setter)\n * If passed with no arguments, just return the options\n * If passed an Object, set the options then attempt to pre-authorize\n *\n * @param val? Object containing options\n * @return current `options` (if getting), or `self` (if setting)\n */\n oauth.options = function (val) {\n if (!arguments.length) return o;\n\n o = val;\n o.url = o.url || 'https://www.openstreetmap.org';\n o.auto = o.auto || false;\n o.singlepage = o.singlepage || false;\n\n // Optional loading and loading-done functions for nice UI feedback.\n // by default, no-ops\n o.loading = o.loading || function () {};\n o.done = o.done || function () {};\n return oauth.preauth(o);\n };\n\n\n // Everything below here is initialization/setup code\n\n // get/set tokens. These are prefixed with the base URL so that `osm-auth`\n // can be used with multiple APIs and the keys in `localStorage`\n // will not clash\n var token;\n\n if (store.enabled) {\n token = function (x, y) {\n if (arguments.length === 1) return store.get(o.url + x);\n else if (arguments.length === 2) return store.set(o.url + x, y);\n };\n } else {\n var storage = {};\n token = function (x, y) {\n if (arguments.length === 1) return storage[o.url + x];\n else if (arguments.length === 2) return (storage[o.url + x] = y);\n };\n }\n\n // Handle options and attempt to pre-authorize\n oauth.options(o);\n\n return oauth;\n}\n\n\n/** Transforms object into query string\n * @param obj\n * @param noencode\n * @returns query string\n */\nfunction utilQsString(obj) {\n return Object.keys(obj)\n .sort()\n .map(function(key) {\n return (encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n })\n .join('&');\n}\n\n/** Transforms query string into object\n * @param str\n * @returns object\n */\nfunction utilStringQs(str) {\n var i = 0; // advance past any leading '?' or '#' characters\n while (i < str.length && (str[i] === '?' || str[i] === '#')) i++;\n str = str.slice(i);\n\n return str.split('&').reduce(function(obj, pair) {\n var parts = pair.split('=');\n if (parts.length === 2) {\n obj[parts[0]] = decodeURIComponent(parts[1]);\n }\n return obj;\n }, {});\n}"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAqBX,SAAS,QAAQ,GAAG;AACzB,MAAI,QAAQ,CAAC;AAOb,QAAM,gBAAgB,WAAY;AAChC,WAAO,CAAC,CAAC,MAAM,qBAAqB;AAAA,EACtC;AASA,QAAM,SAAS,WAAY;AACzB,UAAM,uBAAuB,EAAE;AAC/B,UAAM,eAAe,EAAE;AACvB,UAAM,sBAAsB,EAAE;AAC9B,UAAM,8BAA8B,EAAE;AACtC,WAAO;AAAA,EACT;AAWA,QAAM,eAAe,SAAU,UAAU;AACvC,QAAI,MAAM,cAAc,GAAG;AACzB,eAAS,MAAM,KAAK;AACpB;AAAA,IACF;AAEA,UAAM,OAAO;AAIb,QAAI,MACF,EAAE,MACF,uBACA,aAAa;AAAA,MACX,WAAW,EAAE;AAAA,MACb,cAAc,EAAE;AAAA,MAChB,eAAe;AAAA,MAC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I,UAAU,WAAW;AAAG,eAAO,aAAAA,QAAM,IAAI,EAAE,MAAM,CAAC;AAAA,eAC7C,UAAU,WAAW;AAAG,eAAO,aAAAA,QAAM,IAAI,EAAE,MAAM,GAAG,CAAC;AAAA,IAChE;AAAA,EACF,OAAO;AACL,QAAI,UAAU,CAAC;AACf,YAAQ,SAAU,GAAG,GAAG;AACtB,UAAI,UAAU,WAAW;AAAG,eAAO,QAAQ,EAAE,MAAM,CAAC;AAAA,eAC3C,UAAU,WAAW;AAAG,eAAQ,QAAQ,EAAE,MAAM,CAAC,IAAI;AAAA,IAChE;AAAA,EACF;AAGA,QAAM,QAAQ,CAAC;AAEf,SAAO;AACT;AAQA,SAAS,aAAa,KAAK;AACzB,SAAO,OAAO,KAAK,GAAG,EACnB,KAAK,EACL,IAAI,SAAS,KAAK;AACjB,WAAQ,mBAAmB,GAAG,IAAI,MAAM,mBAAmB,IAAI,GAAG,CAAC;AAAA,EACrE,CAAC,EACA,KAAK,GAAG;AACb;AAMA,SAAS,aAAa,KAAK;AACzB,MAAI,IAAI;AACR,SAAO,IAAI,IAAI,WAAW,IAAI,CAAC,MAAM,OAAO,IAAI,CAAC,MAAM;AAAM;AAC7D,QAAM,IAAI,MAAM,CAAC;AAEjB,SAAO,IAAI,MAAM,GAAG,EAAE,OAAO,SAAS,KAAK,MAAM;AAC/C,QAAI,QAAQ,KAAK,MAAM,GAAG;AAC1B,QAAI,MAAM,WAAW,GAAG;AACtB,UAAI,MAAM,CAAC,CAAC,IAAI,mBAAmB,MAAM,CAAC,CAAC;AAAA,IAC7C;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;", + "names": ["url", "params", "auth_code", "store"] } diff --git a/dist/osm-auth.iife.js b/dist/osm-auth.iife.js index 64bf693..3d0d7e2 100644 --- a/dist/osm-auth.iife.js +++ b/dist/osm-auth.iife.js @@ -1,2 +1,2 @@ -var osmAuth=(function(){var ye=Object.create;var T=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var h=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},je=function(e,t){for(var r in t)T(e,r,{get:t[r],enumerable:!0})},D=function(e,t,r,i){if(t&&typeof t=="object"||typeof t=="function")for(var a=Oe(t),o=0,l=a.length,u;o=0;t--){var r=y().key(t);e(W(r),r)}}function Ze(e){return y().removeItem(e)}function Ye(){return y().clear()}});var Y=h(function(zt,Z){var Ve=_(),et=Ve.Global;Z.exports={name:"oldFF-globalStorage",read:tt,write:rt,each:Q,remove:nt,clearAll:at};var w=et.globalStorage;function tt(e){return w[e]}function rt(e,t){w[e]=t}function Q(e){for(var t=w.length-1;t>=0;t--){var r=w.key(t);e(w[r],r)}}function nt(e){return w.removeItem(e)}function at(){Q(function(e,t){delete w[e]})}});var te=h(function(Lt,ee){var it=_(),R=it.Global;ee.exports={name:"oldIE-userDataStorage",write:ot,read:ut,each:ct,remove:st,clearAll:ft};var A="storejs",O=R.document,P=pt(),V=(R.navigator?R.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function ot(e,t){if(!V){var r=z(e);P(function(i){i.setAttribute(r,t),i.save(A)})}}function ut(e){if(!V){var t=z(e),r=null;return P(function(i){r=i.getAttribute(t)}),r}}function ct(e){P(function(t){for(var r=t.XMLDocument.documentElement.attributes,i=r.length-1;i>=0;i--){var a=r[i];e(t.getAttribute(a.name),a.name)}})}function st(e){var t=z(e);P(function(r){r.removeAttribute(t),r.save(A)})}function ft(){P(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(A);for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save(A)})}var lt=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function z(e){return e.replace(/^\d/,"___$&").replace(lt,"___")}function pt(){if(!O||!O.documentElement||!O.documentElement.addBehavior)return null;var e="script",t,r,i;try{r=new ActiveXObject("htmlfile"),r.open(),r.write("<"+e+">document.w=window'),r.close(),t=r.w.frames[0].document,i=t.createElement("div")}catch(a){i=O.createElement("div"),t=O.body}return function(a){var o=[].slice.call(arguments,0);o.unshift(i),t.appendChild(i),i.addBehavior("#default#userData"),i.load(A),a.apply(this,o),t.removeChild(i)}}});var ue=h(function(Dt,oe){var re=_(),dt=re.Global,gt=re.trim;oe.exports={name:"cookieStorage",read:ht,write:vt,each:ne,remove:ae,clearAll:mt};var F=dt.document;function ht(e){if(!e||!ie(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(F.cookie.replace(new RegExp(t),"$1"))}function ne(e){for(var t=F.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(gt(t[r])){var i=t[r].split("="),a=unescape(i[0]),o=unescape(i[1]);e(o,a)}}function vt(e,t){e&&(F.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function ae(e){!e||!ie(e)||(F.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function mt(){ne(function(e,t){ae(t)})}function ie(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(F.cookie)}});var fe=h(function(Ut,se){var _t=_(),wt=_t.Global;se.exports={name:"sessionStorage",read:ce,write:xt,each:bt,remove:yt,clearAll:St};function S(){return wt.sessionStorage}function ce(e){return S().getItem(e)}function xt(e,t){return S().setItem(e,t)}function bt(e){for(var t=S().length-1;t>=0;t--){var r=S().key(t);e(ce(r),r)}}function yt(e){return S().removeItem(e)}function St(){return S().clear()}});var pe=h(function($t,le){le.exports={name:"memoryStorage",read:Ot,write:At,each:Pt,remove:jt,clearAll:Ft};var x={};function Ot(e){return x[e]}function At(e,t){x[e]=t}function Pt(e){for(var t in x)x.hasOwnProperty(t)&&e(x[t],t)}function jt(e){delete x[e]}function Ft(e){x={}}});var ge=h(function(Bt,de){de.exports=[H(),Y(),te(),ue(),fe(),pe()]});var he=h(function(exports,module){typeof JSON!="object"&&(JSON={});(function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(t){var r=meta[t];return typeof r=="string"?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var r,i,a,o,l=gap,u,n=t[e];switch(n&&typeof n=="object"&&typeof n.toJSON=="function"&&(n=n.toJSON(e)),typeof rep=="function"&&(n=rep.call(t,e,n)),typeof n){case"string":return quote(n);case"number":return isFinite(n)?String(n):"null";case"boolean":case"null":return String(n);case"object":if(!n)return"null";if(gap+=indent,u=[],Object.prototype.toString.apply(n)==="[object Array]"){for(o=n.length,r=0;r=0;t--){var r=S().key(t);e(K(r),r)}}function Ye(e){return S().removeItem(e)}function Ve(){return S().clear()}});var V=g(function(zt,Y){var et=w(),tt=et.Global;Y.exports={name:"oldFF-globalStorage",read:rt,write:nt,each:Z,remove:at,clearAll:it};var x=tt.globalStorage;function rt(e){return x[e]}function nt(e,t){x[e]=t}function Z(e){for(var t=x.length-1;t>=0;t--){var r=x.key(t);e(x[r],r)}}function at(e){return x.removeItem(e)}function it(){Z(function(e,t){delete x[e]})}});var re=g(function(Lt,te){var ot=w(),z=ot.Global;te.exports={name:"oldIE-userDataStorage",write:ut,read:ct,each:st,remove:ft,clearAll:lt};var P="storejs",A=z.document,F=dt(),ee=(z.navigator?z.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function ut(e,t){if(!ee){var r=L(e);F(function(i){i.setAttribute(r,t),i.save(P)})}}function ct(e){if(!ee){var t=L(e),r=null;return F(function(i){r=i.getAttribute(t)}),r}}function st(e){F(function(t){for(var r=t.XMLDocument.documentElement.attributes,i=r.length-1;i>=0;i--){var a=r[i];e(t.getAttribute(a.name),a.name)}})}function ft(e){var t=L(e);F(function(r){r.removeAttribute(t),r.save(P)})}function lt(){F(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(P);for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save(P)})}var pt=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function L(e){return e.replace(/^\d/,"___$&").replace(pt,"___")}function dt(){if(!A||!A.documentElement||!A.documentElement.addBehavior)return null;var e="script",t,r,i;try{r=new ActiveXObject("htmlfile"),r.open(),r.write("<"+e+">document.w=window'),r.close(),t=r.w.frames[0].document,i=t.createElement("div")}catch(a){i=A.createElement("div"),t=A.body}return function(a){var o=[].slice.call(arguments,0);o.unshift(i),t.appendChild(i),i.addBehavior("#default#userData"),i.load(P),a.apply(this,o),t.removeChild(i)}}});var ce=g(function(Dt,ue){var ne=w(),gt=ne.Global,ht=ne.trim;ue.exports={name:"cookieStorage",read:vt,write:mt,each:ae,remove:ie,clearAll:_t};var T=gt.document;function vt(e){if(!e||!oe(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(T.cookie.replace(new RegExp(t),"$1"))}function ae(e){for(var t=T.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(ht(t[r])){var i=t[r].split("="),a=unescape(i[0]),o=unescape(i[1]);e(o,a)}}function mt(e,t){e&&(T.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function ie(e){!e||!oe(e)||(T.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function _t(){ae(function(e,t){ie(t)})}function oe(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(T.cookie)}});var le=g(function(Ut,fe){var wt=w(),xt=wt.Global;fe.exports={name:"sessionStorage",read:se,write:bt,each:yt,remove:St,clearAll:Ot};function O(){return xt.sessionStorage}function se(e){return O().getItem(e)}function bt(e,t){return O().setItem(e,t)}function yt(e){for(var t=O().length-1;t>=0;t--){var r=O().key(t);e(se(r),r)}}function St(e){return O().removeItem(e)}function Ot(){return O().clear()}});var de=g(function($t,pe){pe.exports={name:"memoryStorage",read:At,write:Pt,each:jt,remove:Ft,clearAll:Tt};var b={};function At(e){return b[e]}function Pt(e,t){b[e]=t}function jt(e){for(var t in b)b.hasOwnProperty(t)&&e(b[t],t)}function Ft(e){delete b[e]}function Tt(e){b={}}});var he=g(function(Bt,ge){ge.exports=[Q(),V(),re(),ce(),le(),de()]});var ve=g(function(exports,module){typeof JSON!="object"&&(JSON={});(function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(t){var r=meta[t];return typeof r=="string"?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var r,i,a,o,l=gap,u,n=t[e];switch(n&&typeof n=="object"&&typeof n.toJSON=="function"&&(n=n.toJSON(e)),typeof rep=="function"&&(n=rep.call(t,e,n)),typeof n){case"string":return quote(n);case"number":return isFinite(n)?String(n):"null";case"boolean":case"null":return String(n);case"object":if(!n)return"null";if(gap+=indent,u=[],Object.prototype.toString.apply(n)==="[object Array]"){for(o=n.length,r=0;r= 0; i--) {\n\t\tvar key = localStorage().key(i)\n\t\tfn(read(key), key)\n\t}\n}\n\nfunction remove(key) {\n\treturn localStorage().removeItem(key)\n}\n\nfunction clearAll() {\n\treturn localStorage().clear()\n}\n", "// oldFF-globalStorage provides storage for Firefox\n// versions 6 and 7, where no localStorage, etc\n// is available.\n\nvar util = require('../src/util')\nvar Global = util.Global\n\nmodule.exports = {\n\tname: 'oldFF-globalStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar globalStorage = Global.globalStorage\n\nfunction read(key) {\n\treturn globalStorage[key]\n}\n\nfunction write(key, data) {\n\tglobalStorage[key] = data\n}\n\nfunction each(fn) {\n\tfor (var i = globalStorage.length - 1; i >= 0; i--) {\n\t\tvar key = globalStorage.key(i)\n\t\tfn(globalStorage[key], key)\n\t}\n}\n\nfunction remove(key) {\n\treturn globalStorage.removeItem(key)\n}\n\nfunction clearAll() {\n\teach(function(key, _) {\n\t\tdelete globalStorage[key]\n\t})\n}\n", "// oldIE-userDataStorage provides storage for Internet Explorer\n// versions 6 and 7, where no localStorage, sessionStorage, etc\n// is available.\n\nvar util = require('../src/util')\nvar Global = util.Global\n\nmodule.exports = {\n\tname: 'oldIE-userDataStorage',\n\twrite: write,\n\tread: read,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar storageName = 'storejs'\nvar doc = Global.document\nvar _withStorageEl = _makeIEStorageElFunction()\nvar disable = (Global.navigator ? Global.navigator.userAgent : '').match(/ (MSIE 8|MSIE 9|MSIE 10)\\./) // MSIE 9.x, MSIE 10.x\n\nfunction write(unfixedKey, data) {\n\tif (disable) { return }\n\tvar fixedKey = fixKey(unfixedKey)\n\t_withStorageEl(function(storageEl) {\n\t\tstorageEl.setAttribute(fixedKey, data)\n\t\tstorageEl.save(storageName)\n\t})\n}\n\nfunction read(unfixedKey) {\n\tif (disable) { return }\n\tvar fixedKey = fixKey(unfixedKey)\n\tvar res = null\n\t_withStorageEl(function(storageEl) {\n\t\tres = storageEl.getAttribute(fixedKey)\n\t})\n\treturn res\n}\n\nfunction each(callback) {\n\t_withStorageEl(function(storageEl) {\n\t\tvar attributes = storageEl.XMLDocument.documentElement.attributes\n\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\tvar attr = attributes[i]\n\t\t\tcallback(storageEl.getAttribute(attr.name), attr.name)\n\t\t}\n\t})\n}\n\nfunction remove(unfixedKey) {\n\tvar fixedKey = fixKey(unfixedKey)\n\t_withStorageEl(function(storageEl) {\n\t\tstorageEl.removeAttribute(fixedKey)\n\t\tstorageEl.save(storageName)\n\t})\n}\n\nfunction clearAll() {\n\t_withStorageEl(function(storageEl) {\n\t\tvar attributes = storageEl.XMLDocument.documentElement.attributes\n\t\tstorageEl.load(storageName)\n\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\tstorageEl.removeAttribute(attributes[i].name)\n\t\t}\n\t\tstorageEl.save(storageName)\n\t})\n}\n\n// Helpers\n//////////\n\n// In IE7, keys cannot start with a digit or contain certain chars.\n// See https://github.com/marcuswestin/store.js/issues/40\n// See https://github.com/marcuswestin/store.js/issues/83\nvar forbiddenCharsRegex = new RegExp(\"[!\\\"#$%&'()*+,/\\\\\\\\:;<=>?@[\\\\]^`{|}~]\", \"g\")\nfunction fixKey(key) {\n\treturn key.replace(/^\\d/, '___$&').replace(forbiddenCharsRegex, '___')\n}\n\nfunction _makeIEStorageElFunction() {\n\tif (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {\n\t\treturn null\n\t}\n\tvar scriptTag = 'script',\n\t\tstorageOwner,\n\t\tstorageContainer,\n\t\tstorageEl\n\n\t// Since #userData storage applies only to specific paths, we need to\n\t// somehow link our data to a specific path. We choose /favicon.ico\n\t// as a pretty safe option, since all browsers already make a request to\n\t// this URL anyway and being a 404 will not hurt us here. We wrap an\n\t// iframe pointing to the favicon in an ActiveXObject(htmlfile) object\n\t// (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)\n\t// since the iframe access rules appear to allow direct access and\n\t// manipulation of the document element, even for a 404 page. This\n\t// document can be used instead of the current document (which would\n\t// have been limited to the current path) to perform #userData storage.\n\ttry {\n\t\t/* global ActiveXObject */\n\t\tstorageContainer = new ActiveXObject('htmlfile')\n\t\tstorageContainer.open()\n\t\tstorageContainer.write('<'+scriptTag+'>document.w=window')\n\t\tstorageContainer.close()\n\t\tstorageOwner = storageContainer.w.frames[0].document\n\t\tstorageEl = storageOwner.createElement('div')\n\t} catch(e) {\n\t\t// somehow ActiveXObject instantiation failed (perhaps some special\n\t\t// security settings or otherwse), fall back to per-path storage\n\t\tstorageEl = doc.createElement('div')\n\t\tstorageOwner = doc.body\n\t}\n\n\treturn function(storeFunction) {\n\t\tvar args = [].slice.call(arguments, 0)\n\t\targs.unshift(storageEl)\n\t\t// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx\n\t\t// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx\n\t\tstorageOwner.appendChild(storageEl)\n\t\tstorageEl.addBehavior('#default#userData')\n\t\tstorageEl.load(storageName)\n\t\tstoreFunction.apply(this, args)\n\t\tstorageOwner.removeChild(storageEl)\n\t\treturn\n\t}\n}\n", "// cookieStorage is useful Safari private browser mode, where localStorage\n// doesn't work but cookies do. This implementation is adopted from\n// https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage\n\nvar util = require('../src/util')\nvar Global = util.Global\nvar trim = util.trim\n\nmodule.exports = {\n\tname: 'cookieStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar doc = Global.document\n\nfunction read(key) {\n\tif (!key || !_has(key)) { return null }\n\tvar regexpStr = \"(?:^|.*;\\\\s*)\" +\n\t\tescape(key).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") +\n\t\t\"\\\\s*\\\\=\\\\s*((?:[^;](?!;))*[^;]?).*\"\n\treturn unescape(doc.cookie.replace(new RegExp(regexpStr), \"$1\"))\n}\n\nfunction each(callback) {\n\tvar cookies = doc.cookie.split(/; ?/g)\n\tfor (var i = cookies.length - 1; i >= 0; i--) {\n\t\tif (!trim(cookies[i])) {\n\t\t\tcontinue\n\t\t}\n\t\tvar kvp = cookies[i].split('=')\n\t\tvar key = unescape(kvp[0])\n\t\tvar val = unescape(kvp[1])\n\t\tcallback(val, key)\n\t}\n}\n\nfunction write(key, data) {\n\tif(!key) { return }\n\tdoc.cookie = escape(key) + \"=\" + escape(data) + \"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/\"\n}\n\nfunction remove(key) {\n\tif (!key || !_has(key)) {\n\t\treturn\n\t}\n\tdoc.cookie = escape(key) + \"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/\"\n}\n\nfunction clearAll() {\n\teach(function(_, key) {\n\t\tremove(key)\n\t})\n}\n\nfunction _has(key) {\n\treturn (new RegExp(\"(?:^|;\\\\s*)\" + escape(key).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") + \"\\\\s*\\\\=\")).test(doc.cookie)\n}\n", "var util = require('../src/util')\nvar Global = util.Global\n\nmodule.exports = {\n\tname: 'sessionStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll\n}\n\nfunction sessionStorage() {\n\treturn Global.sessionStorage\n}\n\nfunction read(key) {\n\treturn sessionStorage().getItem(key)\n}\n\nfunction write(key, data) {\n\treturn sessionStorage().setItem(key, data)\n}\n\nfunction each(fn) {\n\tfor (var i = sessionStorage().length - 1; i >= 0; i--) {\n\t\tvar key = sessionStorage().key(i)\n\t\tfn(read(key), key)\n\t}\n}\n\nfunction remove(key) {\n\treturn sessionStorage().removeItem(key)\n}\n\nfunction clearAll() {\n\treturn sessionStorage().clear()\n}\n", "// memoryStorage is a useful last fallback to ensure that the store\n// is functions (meaning store.get(), store.set(), etc will all function).\n// However, stored values will not persist when the browser navigates to\n// a new page or reloads the current page.\n\nmodule.exports = {\n\tname: 'memoryStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar memoryStorage = {}\n\nfunction read(key) {\n\treturn memoryStorage[key]\n}\n\nfunction write(key, data) {\n\tmemoryStorage[key] = data\n}\n\nfunction each(callback) {\n\tfor (var key in memoryStorage) {\n\t\tif (memoryStorage.hasOwnProperty(key)) {\n\t\t\tcallback(memoryStorage[key], key)\n\t\t}\n\t}\n}\n\nfunction remove(key) {\n\tdelete memoryStorage[key]\n}\n\nfunction clearAll(key) {\n\tmemoryStorage = {}\n}\n", "module.exports = [\n\t// Listed in order of usage preference\n\trequire('./localStorage'),\n\trequire('./oldFF-globalStorage'),\n\trequire('./oldIE-userDataStorage'),\n\trequire('./cookieStorage'),\n\trequire('./sessionStorage'),\n\trequire('./memoryStorage')\n]\n", "/* eslint-disable */\n\n// json2.js\n// 2016-10-28\n// Public Domain.\n// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n// See http://www.JSON.org/js.html\n// This code should be minified before deployment.\n// See http://javascript.crockford.com/jsmin.html\n\n// USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO\n// NOT CONTROL.\n\n// This file creates a global JSON object containing two methods: stringify\n// and parse. This file provides the ES5 JSON capability to ES3 systems.\n// If a project might run on IE8 or earlier, then this file should be included.\n// This file does nothing on ES5 systems.\n\n// JSON.stringify(value, replacer, space)\n// value any JavaScript value, usually an object or array.\n// replacer an optional parameter that determines how object\n// values are stringified for objects. It can be a\n// function or an array of strings.\n// space an optional parameter that specifies the indentation\n// of nested structures. If it is omitted, the text will\n// be packed without extra whitespace. If it is a number,\n// it will specify the number of spaces to indent at each\n// level. If it is a string (such as \"\\t\" or \" \"),\n// it contains the characters used to indent at each level.\n// This method produces a JSON text from a JavaScript value.\n// When an object value is found, if the object contains a toJSON\n// method, its toJSON method will be called and the result will be\n// stringified. A toJSON method does not serialize: it returns the\n// value represented by the name/value pair that should be serialized,\n// or undefined if nothing should be serialized. The toJSON method\n// will be passed the key associated with the value, and this will be\n// bound to the value.\n\n// For example, this would serialize Dates as ISO strings.\n\n// Date.prototype.toJSON = function (key) {\n// function f(n) {\n// // Format integers to have at least two digits.\n// return (n < 10)\n// ? \"0\" + n\n// : n;\n// }\n// return this.getUTCFullYear() + \"-\" +\n// f(this.getUTCMonth() + 1) + \"-\" +\n// f(this.getUTCDate()) + \"T\" +\n// f(this.getUTCHours()) + \":\" +\n// f(this.getUTCMinutes()) + \":\" +\n// f(this.getUTCSeconds()) + \"Z\";\n// };\n\n// You can provide an optional replacer method. It will be passed the\n// key and value of each member, with this bound to the containing\n// object. The value that is returned from your method will be\n// serialized. If your method returns undefined, then the member will\n// be excluded from the serialization.\n\n// If the replacer parameter is an array of strings, then it will be\n// used to select the members to be serialized. It filters the results\n// such that only members with keys listed in the replacer array are\n// stringified.\n\n// Values that do not have JSON representations, such as undefined or\n// functions, will not be serialized. Such values in objects will be\n// dropped; in arrays they will be replaced with null. You can use\n// a replacer function to replace those with JSON values.\n\n// JSON.stringify(undefined) returns undefined.\n\n// The optional space parameter produces a stringification of the\n// value that is filled with line breaks and indentation to make it\n// easier to read.\n\n// If the space parameter is a non-empty string, then that string will\n// be used for indentation. If the space parameter is a number, then\n// the indentation will be that many spaces.\n\n// Example:\n\n// text = JSON.stringify([\"e\", {pluribus: \"unum\"}]);\n// // text is '[\"e\",{\"pluribus\":\"unum\"}]'\n\n// text = JSON.stringify([\"e\", {pluribus: \"unum\"}], null, \"\\t\");\n// // text is '[\\n\\t\"e\",\\n\\t{\\n\\t\\t\"pluribus\": \"unum\"\\n\\t}\\n]'\n\n// text = JSON.stringify([new Date()], function (key, value) {\n// return this[key] instanceof Date\n// ? \"Date(\" + this[key] + \")\"\n// : value;\n// });\n// // text is '[\"Date(---current time---)\"]'\n\n// JSON.parse(text, reviver)\n// This method parses a JSON text to produce an object or array.\n// It can throw a SyntaxError exception.\n\n// The optional reviver parameter is a function that can filter and\n// transform the results. It receives each of the keys and values,\n// and its return value is used instead of the original value.\n// If it returns what it received, then the structure is not modified.\n// If it returns undefined then the member is deleted.\n\n// Example:\n\n// // Parse the text. Values that look like ISO date strings will\n// // be converted to Date objects.\n\n// myData = JSON.parse(text, function (key, value) {\n// var a;\n// if (typeof value === \"string\") {\n// a =\n// /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)Z$/.exec(value);\n// if (a) {\n// return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],\n// +a[5], +a[6]));\n// }\n// }\n// return value;\n// });\n\n// myData = JSON.parse('[\"Date(09/09/2001)\"]', function (key, value) {\n// var d;\n// if (typeof value === \"string\" &&\n// value.slice(0, 5) === \"Date(\" &&\n// value.slice(-1) === \")\") {\n// d = new Date(value.slice(5, -1));\n// if (d) {\n// return d;\n// }\n// }\n// return value;\n// });\n\n// This is a reference implementation. You are free to copy, modify, or\n// redistribute.\n\n/*jslint\n eval, for, this\n*/\n\n/*property\n JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,\n getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,\n lastIndex, length, parse, prototype, push, replace, slice, stringify,\n test, toJSON, toString, valueOf\n*/\n\n\n// Create a JSON object only if one does not already exist. We create the\n// methods in a closure to avoid creating global variables.\n\nif (typeof JSON !== \"object\") {\n JSON = {};\n}\n\n(function () {\n \"use strict\";\n\n var rx_one = /^[\\],:{}\\s]*$/;\n var rx_two = /\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g;\n var rx_three = /\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g;\n var rx_four = /(?:^|:|,)(?:\\s*\\[)+/g;\n var rx_escapable = /[\\\\\"\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g;\n var rx_dangerous = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g;\n\n function f(n) {\n // Format integers to have at least two digits.\n return n < 10\n ? \"0\" + n\n : n;\n }\n\n function this_value() {\n return this.valueOf();\n }\n\n if (typeof Date.prototype.toJSON !== \"function\") {\n\n Date.prototype.toJSON = function () {\n\n return isFinite(this.valueOf())\n ? this.getUTCFullYear() + \"-\" +\n f(this.getUTCMonth() + 1) + \"-\" +\n f(this.getUTCDate()) + \"T\" +\n f(this.getUTCHours()) + \":\" +\n f(this.getUTCMinutes()) + \":\" +\n f(this.getUTCSeconds()) + \"Z\"\n : null;\n };\n\n Boolean.prototype.toJSON = this_value;\n Number.prototype.toJSON = this_value;\n String.prototype.toJSON = this_value;\n }\n\n var gap;\n var indent;\n var meta;\n var rep;\n\n\n function quote(string) {\n\n// If the string contains no control characters, no quote characters, and no\n// backslash characters, then we can safely slap some quotes around it.\n// Otherwise we must also replace the offending characters with safe escape\n// sequences.\n\n rx_escapable.lastIndex = 0;\n return rx_escapable.test(string)\n ? \"\\\"\" + string.replace(rx_escapable, function (a) {\n var c = meta[a];\n return typeof c === \"string\"\n ? c\n : \"\\\\u\" + (\"0000\" + a.charCodeAt(0).toString(16)).slice(-4);\n }) + \"\\\"\"\n : \"\\\"\" + string + \"\\\"\";\n }\n\n\n function str(key, holder) {\n\n// Produce a string from holder[key].\n\n var i; // The loop counter.\n var k; // The member key.\n var v; // The member value.\n var length;\n var mind = gap;\n var partial;\n var value = holder[key];\n\n// If the value has a toJSON method, call it to obtain a replacement value.\n\n if (value && typeof value === \"object\" &&\n typeof value.toJSON === \"function\") {\n value = value.toJSON(key);\n }\n\n// If we were called with a replacer function, then call the replacer to\n// obtain a replacement value.\n\n if (typeof rep === \"function\") {\n value = rep.call(holder, key, value);\n }\n\n// What happens next depends on the value's type.\n\n switch (typeof value) {\n case \"string\":\n return quote(value);\n\n case \"number\":\n\n// JSON numbers must be finite. Encode non-finite numbers as null.\n\n return isFinite(value)\n ? String(value)\n : \"null\";\n\n case \"boolean\":\n case \"null\":\n\n// If the value is a boolean or null, convert it to a string. Note:\n// typeof null does not produce \"null\". The case is included here in\n// the remote chance that this gets fixed someday.\n\n return String(value);\n\n// If the type is \"object\", we might be dealing with an object or an array or\n// null.\n\n case \"object\":\n\n// Due to a specification blunder in ECMAScript, typeof null is \"object\",\n// so watch out for that case.\n\n if (!value) {\n return \"null\";\n }\n\n// Make an array to hold the partial results of stringifying this object value.\n\n gap += indent;\n partial = [];\n\n// Is the value an array?\n\n if (Object.prototype.toString.apply(value) === \"[object Array]\") {\n\n// The value is an array. Stringify every element. Use null as a placeholder\n// for non-JSON values.\n\n length = value.length;\n for (i = 0; i < length; i += 1) {\n partial[i] = str(i, value) || \"null\";\n }\n\n// Join all of the elements together, separated with commas, and wrap them in\n// brackets.\n\n v = partial.length === 0\n ? \"[]\"\n : gap\n ? \"[\\n\" + gap + partial.join(\",\\n\" + gap) + \"\\n\" + mind + \"]\"\n : \"[\" + partial.join(\",\") + \"]\";\n gap = mind;\n return v;\n }\n\n// If the replacer is an array, use it to select the members to be stringified.\n\n if (rep && typeof rep === \"object\") {\n length = rep.length;\n for (i = 0; i < length; i += 1) {\n if (typeof rep[i] === \"string\") {\n k = rep[i];\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (\n gap\n ? \": \"\n : \":\"\n ) + v);\n }\n }\n }\n } else {\n\n// Otherwise, iterate through all of the keys in the object.\n\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (\n gap\n ? \": \"\n : \":\"\n ) + v);\n }\n }\n }\n }\n\n// Join all of the member texts together, separated with commas,\n// and wrap them in braces.\n\n v = partial.length === 0\n ? \"{}\"\n : gap\n ? \"{\\n\" + gap + partial.join(\",\\n\" + gap) + \"\\n\" + mind + \"}\"\n : \"{\" + partial.join(\",\") + \"}\";\n gap = mind;\n return v;\n }\n }\n\n// If the JSON object does not yet have a stringify method, give it one.\n\n if (typeof JSON.stringify !== \"function\") {\n meta = { // table of character substitutions\n \"\\b\": \"\\\\b\",\n \"\\t\": \"\\\\t\",\n \"\\n\": \"\\\\n\",\n \"\\f\": \"\\\\f\",\n \"\\r\": \"\\\\r\",\n \"\\\"\": \"\\\\\\\"\",\n \"\\\\\": \"\\\\\\\\\"\n };\n JSON.stringify = function (value, replacer, space) {\n\n// The stringify method takes a value and an optional replacer, and an optional\n// space parameter, and returns a JSON text. The replacer can be a function\n// that can replace values, or an array of strings that will select the keys.\n// A default replacer method can be provided. Use of the space parameter can\n// produce text that is more easily readable.\n\n var i;\n gap = \"\";\n indent = \"\";\n\n// If the space parameter is a number, make an indent string containing that\n// many spaces.\n\n if (typeof space === \"number\") {\n for (i = 0; i < space; i += 1) {\n indent += \" \";\n }\n\n// If the space parameter is a string, it will be used as the indent string.\n\n } else if (typeof space === \"string\") {\n indent = space;\n }\n\n// If there is a replacer, it must be a function or an array.\n// Otherwise, throw an error.\n\n rep = replacer;\n if (replacer && typeof replacer !== \"function\" &&\n (typeof replacer !== \"object\" ||\n typeof replacer.length !== \"number\")) {\n throw new Error(\"JSON.stringify\");\n }\n\n// Make a fake root object containing our value under the key of \"\".\n// Return the result of stringifying the value.\n\n return str(\"\", {\"\": value});\n };\n }\n\n\n// If the JSON object does not yet have a parse method, give it one.\n\n if (typeof JSON.parse !== \"function\") {\n JSON.parse = function (text, reviver) {\n\n// The parse method takes a text and an optional reviver function, and returns\n// a JavaScript value if the text is a valid JSON text.\n\n var j;\n\n function walk(holder, key) {\n\n// The walk method is used to recursively walk the resulting structure so\n// that modifications can be made.\n\n var k;\n var v;\n var value = holder[key];\n if (value && typeof value === \"object\") {\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = walk(value, k);\n if (v !== undefined) {\n value[k] = v;\n } else {\n delete value[k];\n }\n }\n }\n }\n return reviver.call(holder, key, value);\n }\n\n\n// Parsing happens in four stages. In the first stage, we replace certain\n// Unicode characters with escape sequences. JavaScript handles many characters\n// incorrectly, either silently deleting them, or treating them as line endings.\n\n text = String(text);\n rx_dangerous.lastIndex = 0;\n if (rx_dangerous.test(text)) {\n text = text.replace(rx_dangerous, function (a) {\n return \"\\\\u\" +\n (\"0000\" + a.charCodeAt(0).toString(16)).slice(-4);\n });\n }\n\n// In the second stage, we run the text against regular expressions that look\n// for non-JSON patterns. We are especially concerned with \"()\" and \"new\"\n// because they can cause invocation, and \"=\" because it can cause mutation.\n// But just to be safe, we want to reject all unexpected forms.\n\n// We split the second stage into 4 regexp operations in order to work around\n// crippling inefficiencies in IE's and Safari's regexp engines. First we\n// replace the JSON backslash pairs with \"@\" (a non-JSON character). Second, we\n// replace all simple value tokens with \"]\" characters. Third, we delete all\n// open brackets that follow a colon or comma or that begin the text. Finally,\n// we look to see that the remaining characters are only whitespace or \"]\" or\n// \",\" or \":\" or \"{\" or \"}\". If that is so, then the text is safe for eval.\n\n if (\n rx_one.test(\n text\n .replace(rx_two, \"@\")\n .replace(rx_three, \"]\")\n .replace(rx_four, \"\")\n )\n ) {\n\n// In the third stage we use the eval function to compile the text into a\n// JavaScript structure. The \"{\" operator is subject to a syntactic ambiguity\n// in JavaScript: it can begin a block or an object literal. We wrap the text\n// in parens to eliminate the ambiguity.\n\n j = eval(\"(\" + text + \")\");\n\n// In the optional fourth stage, we recursively walk the new structure, passing\n// each name/value pair to a reviver function for possible transformation.\n\n return (typeof reviver === \"function\")\n ? walk({\"\": j}, \"\")\n : j;\n }\n\n// If the text is not JSON parseable, then a SyntaxError is thrown.\n\n throw new SyntaxError(\"JSON.parse\");\n };\n }\n}());", "module.exports = json2Plugin\n\nfunction json2Plugin() {\n\trequire('./lib/json2')\n\treturn {}\n}\n", "var engine = require('../src/store-engine')\n\nvar storages = require('../storages/all')\nvar plugins = [require('../plugins/json2')]\n\nmodule.exports = engine.createStore(storages, plugins)\n", "import store from 'store';\n\n\n/**\n * osmAuth\n * Easy authentication with OpenStreetMap over OAuth 2.0.\n * @module\n *\n * @param o `Object` containing options:\n * @param o.scope OAuth2 scopes requested (e.g. \"read_prefs write_api\")\n * @param o.client_id OAuth2 client ID\n * @param o.client_secret OAuth2 client secret\n * @param o.redirect_uri OAuth2 redirect URI (e.g. \"http://127.0.0.1:8080/land.html\")\n * @param o.access_token Can pre-authorize with an OAuth2 bearer token if you have one\n * @param o.url A base url (default: \"https://www.openstreetmap.org\")\n * @param o.auto If `true`, attempt to authenticate automatically when calling `.xhr()` (default: `false`)\n * @param o.singlepage If `true`, use page redirection instead of a popup (default: `false`)\n * @param o.loading Function called when auth-related xhr calls start\n * @param o.done Function called when auth-related xhr calls end\n * @return `self`\n */\nexport function osmAuth(o) {\n var oauth = {};\n\n /**\n * authenticated\n * Test whether the user is currently authenticated\n * @return `true` if authenticated, `false` if not\n */\n oauth.authenticated = function () {\n return !!token('oauth2_access_token');\n };\n\n\n /**\n * logout\n * Removes any stored authentication tokens (legacy OAuth1 tokens too)\n *\n * @return `self`\n */\n oauth.logout = function () {\n token('oauth2_access_token', ''); // OAuth2\n token('oauth_token', ''); // OAuth1\n token('oauth_token_secret', ''); // OAuth1\n token('oauth_request_token_secret', ''); // OAuth1\n return oauth;\n };\n\n\n /**\n * authenticate\n * First logs out, then runs the authentiation flow, finally calls the callback.\n * TODO: detect lack of click event (probably can settimeout it)\n *\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.authenticate = function (callback) {\n if (oauth.authenticated()) {\n callback(null, oauth);\n return;\n }\n\n oauth.logout();\n\n // ## Request authorization to access resources from the user\n // and receive authorization code\n var url =\n o.url +\n '/oauth2/authorize?' +\n utilQsString({\n client_id: o.client_id,\n redirect_uri: o.redirect_uri,\n response_type: 'code',\n scope: o.scope,\n });\n\n if (!o.singlepage) {\n // Create a 600x550 popup window in the center of the screen\n var w = 600;\n var h = 550;\n var settings = [\n ['width', w],\n ['height', h],\n ['left', window.screen.width / 2 - w / 2],\n ['top', window.screen.height / 2 - h / 2],\n ]\n .map(function (x) { return x.join('='); })\n .join(',');\n\n var popup = window.open('about:blank', 'oauth_window', settings);\n oauth.popupWindow = popup;\n popup.location = url;\n\n if (!popup) {\n var error = new Error('Popup was blocked');\n error.status = 'popup-blocked';\n throw error;\n }\n }\n\n // Called by a function in the redirect URL page, in the popup window. The\n // window closes itself.\n window.authComplete = function (url) {\n var params = utilStringQs(url.split('?')[1]);\n getAccessToken(params.code);\n delete window.authComplete;\n };\n\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the `auth_code`, brought\n // in from a function call on a landing page popup.\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n };\n\n\n /**\n * bringPopupWindowToFront\n * Tries to bring an existing authentication popup to the front.\n * @return `true` if it succeeded, `false` if not\n */\n oauth.bringPopupWindowToFront = function () {\n var broughtPopupToFront = false;\n try {\n // This may cause a cross-origin error:\n // `DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.`\n if (oauth.popupWindow && !oauth.popupWindow.closed) {\n oauth.popupWindow.focus();\n broughtPopupToFront = true;\n }\n } catch (err) {\n // Bringing popup window to front failed (probably because of the cross-origin error mentioned above)\n }\n return broughtPopupToFront;\n };\n\n\n /**\n * bootstrapToken\n * The authorization code is a temporary code that a client can exchange for an access token.\n * If using this library in single-page mode, you'll need to call this once your application\n * has an `auth_code` and wants to get an access_token.\n *\n * @param auth_code The OAuth2 `auth_code`\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.bootstrapToken = function (auth_code, callback) {\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the authorization_code\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n\n getAccessToken(auth_code);\n };\n\n /**\n * fetch\n * A `fetch` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/fetch\n *\n * @param path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `options.prefix`=`false`)\n * @param options\n * @param options.method Passed to `fetch` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.body Passed to `fetch`\n * @param options.headers `Object` containing request headers\n * @return `Promise` that resolves to a `Response` if authenticated, otherwise `null`\n */\n oauth.fetch = function (path, options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? o.url + path : path;\n var headers = options.headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n headers.Authorization = 'Bearer ' + token('oauth2_access_token');\n return fetch(url, {\n method: options.method,\n body: options.body,\n headers: headers,\n }).then((resp) => {\n var contentType = resp.headers.get('content-type').split(';')[0];\n switch (contentType) {\n case 'text/html':\n case 'text/xml':\n return resp\n .text()\n .then((txt) =>\n new window.DOMParser().parseFromString(txt, contentType)\n );\n case 'application/html':\n return resp.json();\n default:\n return resp.text();\n }\n });\n }\n };\n\n /**\n * xhr\n * A `XMLHttpRequest` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param options\n * @param options.method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `prefix`=`false`)\n * @param options.content Passed to `xhr.send`\n * @param options.headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest` if authenticated, otherwise `null`\n */\n oauth.xhr = function (options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? (o.url + options.path) : options.path;\n return oauth.rawxhr(\n options.method,\n url,\n token('oauth2_access_token'),\n options.content,\n options.headers,\n done\n );\n }\n\n function done(err, xhr) {\n if (err) {\n callback(err);\n } else if (xhr.responseXML) {\n callback(err, xhr.responseXML);\n } else {\n callback(err, xhr.response);\n }\n }\n };\n\n\n /**\n * rawxhr\n * Creates the XMLHttpRequest set up with a header and response handling\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param url Passed to `xhr.open`\n * @param access_token OAuth2 bearer token\n * @param data Passed to `xhr.send`\n * @param headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest`\n */\n oauth.rawxhr = function (method, url, access_token, data, headers, callback) {\n headers = headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n\n if (access_token) {\n headers.Authorization = 'Bearer ' + access_token;\n }\n\n var xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function () {\n if (4 === xhr.readyState && 0 !== xhr.status) {\n if (/^20\\d$/.test(xhr.status)) { // a 20x status code - OK\n callback(null, xhr);\n } else {\n callback(xhr, null);\n }\n }\n };\n xhr.onerror = function (e) {\n callback(e, null);\n };\n\n xhr.open(method, url, true);\n for (var h in headers) xhr.setRequestHeader(h, headers[h]);\n\n xhr.send(data);\n return xhr;\n };\n\n\n /**\n * preauth\n * Pre-authorize this object, if we already have access token from the start\n *\n * @param val `Object` containing `access_token` property\n * @return `self`\n */\n oauth.preauth = function (val) {\n if (val && val.access_token) {\n token('oauth2_access_token', val.access_token);\n }\n return oauth;\n };\n\n\n /**\n * options (getter / setter)\n * If passed with no arguments, just return the options\n * If passed an Object, set the options then attempt to pre-authorize\n *\n * @param val? Object containing options\n * @return current `options` (if getting), or `self` (if setting)\n */\n oauth.options = function (val) {\n if (!arguments.length) return o;\n\n o = val;\n o.url = o.url || 'https://www.openstreetmap.org';\n o.auto = o.auto || false;\n o.singlepage = o.singlepage || false;\n\n // Optional loading and loading-done functions for nice UI feedback.\n // by default, no-ops\n o.loading = o.loading || function () {};\n o.done = o.done || function () {};\n return oauth.preauth(o);\n };\n\n\n // Everything below here is initialization/setup code\n\n // get/set tokens. These are prefixed with the base URL so that `osm-auth`\n // can be used with multiple APIs and the keys in `localStorage`\n // will not clash\n var token;\n\n if (store.enabled) {\n token = function (x, y) {\n if (arguments.length === 1) return store.get(o.url + x);\n else if (arguments.length === 2) return store.set(o.url + x, y);\n };\n } else {\n var storage = {};\n token = function (x, y) {\n if (arguments.length === 1) return storage[o.url + x];\n else if (arguments.length === 2) return (storage[o.url + x] = y);\n };\n }\n\n // Handle options and attempt to pre-authorize\n oauth.options(o);\n\n return oauth;\n}\n\n\n/** Transforms object into query string\n * @param obj\n * @param noencode\n * @returns query string\n */\nfunction utilQsString(obj) {\n return Object.keys(obj)\n .sort()\n .map(function(key) {\n return (encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n })\n .join('&');\n}\n\n/** Transforms query string into object\n * @param str\n * @returns object\n */\nfunction utilStringQs(str) {\n var i = 0; // advance past any leading '?' or '#' characters\n while (i < str.length && (str[i] === '?' || str[i] === '#')) i++;\n str = str.slice(i);\n\n return str.split('&').reduce(function(obj, pair) {\n var parts = pair.split('=');\n if (parts.length === 2) {\n obj[parts[0]] = decodeURIComponent(parts[1]);\n }\n return obj;\n }, {});\n}"], - "mappings": "4wBAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,KAAIC,EAASC,GAAY,EACrBC,GAASC,GAAY,EACrBC,GAAOC,GAAU,EACjBC,GAAU,OAAO,QAAW,YAAc,OAAS,OAEvDP,EAAO,QAAU,CAChB,OAAQC,EACR,OAAQE,GACR,KAAME,GACN,KAAMG,GACN,MAAOC,EACP,KAAMC,EACN,IAAKC,GACL,MAAOC,EACP,OAAQC,EACR,WAAYC,GACZ,SAAUC,GACV,OAAQR,EACT,EAEA,SAASL,IAAc,CACtB,OAAI,OAAO,OACH,OAAO,OAEP,SAAoBc,EAAKC,EAAQC,EAAQC,EAAK,CACpD,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IACrCV,EAAK,OAAO,UAAUU,CAAC,CAAC,EAAG,SAASC,EAAKC,EAAK,CAC7CN,EAAIM,CAAG,EAAID,CACZ,CAAC,EAEF,OAAOL,CACR,CAEF,CAEA,SAASZ,IAAc,CACtB,GAAI,OAAO,OACV,OAAO,SAAgBY,EAAKO,EAAcC,EAAcL,EAAK,CAC5D,IAAIM,EAAiBhB,EAAM,UAAW,CAAC,EACvC,OAAOR,EAAO,MAAM,KAAM,CAAC,OAAO,OAAOe,CAAG,CAAC,EAAE,OAAOS,CAAc,CAAC,CACtE,EAEA,IAASC,EAAT,UAAa,CAAC,EAALA,IACT,OAAO,SAAgBV,EAAKO,EAAcC,EAAcL,EAAK,CAC5D,IAAIM,EAAiBhB,EAAM,UAAW,CAAC,EACvC,OAAAiB,EAAE,UAAYV,EACPf,EAAO,MAAM,KAAM,CAAC,IAAIyB,CAAG,EAAE,OAAOD,CAAc,CAAC,CAC3D,CAEF,CAEA,SAASnB,IAAY,CACpB,OAAI,OAAO,UAAU,KACb,SAAcqB,EAAK,CACzB,OAA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,EAAID,EAAI,SAAWA,EAAIC,CAAC,IAAM,KAAOD,EAAIC,CAAC,IAAM,MAAMA,IAC7D,OAAAD,EAAMA,EAAI,MAAMC,CAAC,EAEVD,EAAI,MAAM,GAAG,EAAE,OAAO,SAASF,EAAKI,EAAM,CAC/C,IAAIC,EAAQD,EAAK,MAAM,GAAG,EAC1B,OAAIC,EAAM,SAAW,IACnBL,EAAIK,EAAM,CAAC,CAAC,EAAI,mBAAmBA,EAAM,CAAC,CAAC,GAEtCL,CACT,EAAG,CAAC,CAAC,CACP", - "names": ["require_util", "__commonJSMin", "exports", "module", "assign", "make_assign", "create", "make_create", "trim", "make_trim", "Global", "bind", "slice", "each", "map", "pluck", "isList", "isFunction", "isObject", "obj", "props1", "props2", "etc", "i", "val", "key", "assignProps1", "assignProps2", "assignArgsList", "F", "str", "fn", "arr", "index", "res", "v", "k", "require_store_engine", "__commonJSMin", "exports", "module", "util", "slice", "pluck", "each", "bind", "create", "isList", "isFunction", "isObject", "createStore", "storeAPI", "key", "optionalDefaultValue", "data", "value", "callback", "self", "val", "namespacedKey", "namespace", "plugin", "_warn", "_console", "fn", "storages", "plugins", "namespacePrefix", "namespaceRegexp", "legalNamespaces", "_privateStoreProps", "storage", "testStr", "ok", "e", "pluginFnProp", "propName", "oldFn", "args", "super_fn", "arg", "i", "newFnArgs", "obj", "strVal", "defaultVal", "seenPlugin", "pluginProperties", "store", "prop", "require_localStorage", "__commonJSMin", "exports", "module", "util", "Global", "read", "write", "each", "remove", "clearAll", "localStorage", "key", "data", "fn", "i", "require_oldFF_globalStorage", "__commonJSMin", "exports", "module", "util", "Global", "read", "write", "each", "remove", "clearAll", "globalStorage", "key", "data", "fn", "i", "_", "require_oldIE_userDataStorage", "__commonJSMin", "exports", "module", "util", "Global", "write", "read", "each", "remove", "clearAll", "storageName", "doc", "_withStorageEl", "_makeIEStorageElFunction", "disable", "unfixedKey", "data", "fixedKey", "fixKey", "storageEl", "res", "callback", "attributes", "attr", "i", "forbiddenCharsRegex", "key", "scriptTag", "storageOwner", "storageContainer", "e", "storeFunction", "args", "require_cookieStorage", "__commonJSMin", "exports", "module", "util", "Global", "trim", "read", "write", "each", "remove", "clearAll", "doc", "key", "_has", "regexpStr", "callback", "cookies", "i", "kvp", "val", "data", "_", "require_sessionStorage", "__commonJSMin", "exports", "module", "util", "Global", "read", "write", "each", "remove", "clearAll", "sessionStorage", "key", "data", "fn", "i", "require_memoryStorage", "__commonJSMin", "exports", "module", "read", "write", "each", "remove", "clearAll", "memoryStorage", "key", "data", "callback", "require_all", "__commonJSMin", "exports", "module", "require_json2", "__commonJSMin", "n", "string", "a", "c", "key", "holder", "i", "k", "v", "length", "mind", "partial", "value", "replacer", "space", "require_json2", "__commonJSMin", "exports", "module", "json2Plugin", "require_store_legacy", "__commonJSMin", "exports", "module", "engine", "storages", "plugins", "osm_auth_exports", "__export", "osmAuth", "import_store", "o", "oauth", "token", "callback", "url", "utilQsString", "w", "h", "settings", "x", "popup", "error", "params", "utilStringQs", "getAccessToken", "auth_code", "accessTokenDone", "err", "xhr", "access_token", "broughtPopupToFront", "path", "options", "run", "headers", "resp", "contentType", "txt", "done", "method", "data", "e", "val", "store", "y", "storage", "obj", "key", "str", "i", "pair", "parts"] + "sourcesContent": ["var assign = make_assign()\nvar create = make_create()\nvar trim = make_trim()\nvar Global = (typeof window !== 'undefined' ? window : global)\n\nmodule.exports = {\n\tassign: assign,\n\tcreate: create,\n\ttrim: trim,\n\tbind: bind,\n\tslice: slice,\n\teach: each,\n\tmap: map,\n\tpluck: pluck,\n\tisList: isList,\n\tisFunction: isFunction,\n\tisObject: isObject,\n\tGlobal: Global\n}\n\nfunction make_assign() {\n\tif (Object.assign) {\n\t\treturn Object.assign\n\t} else {\n\t\treturn function shimAssign(obj, props1, props2, etc) {\n\t\t\tfor (var i = 1; i < arguments.length; i++) {\n\t\t\t\teach(Object(arguments[i]), function(val, key) {\n\t\t\t\t\tobj[key] = val\n\t\t\t\t})\n\t\t\t}\t\t\t\n\t\t\treturn obj\n\t\t}\n\t}\n}\n\nfunction make_create() {\n\tif (Object.create) {\n\t\treturn function create(obj, assignProps1, assignProps2, etc) {\n\t\t\tvar assignArgsList = slice(arguments, 1)\n\t\t\treturn assign.apply(this, [Object.create(obj)].concat(assignArgsList))\n\t\t}\n\t} else {\n\t\tfunction F() {} // eslint-disable-line no-inner-declarations\n\t\treturn function create(obj, assignProps1, assignProps2, etc) {\n\t\t\tvar assignArgsList = slice(arguments, 1)\n\t\t\tF.prototype = obj\n\t\t\treturn assign.apply(this, [new F()].concat(assignArgsList))\n\t\t}\n\t}\n}\n\nfunction make_trim() {\n\tif (String.prototype.trim) {\n\t\treturn function trim(str) {\n\t\t\treturn String.prototype.trim.call(str)\n\t\t}\n\t} else {\n\t\treturn function trim(str) {\n\t\t\treturn str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '')\n\t\t}\n\t}\n}\n\nfunction bind(obj, fn) {\n\treturn function() {\n\t\treturn fn.apply(obj, Array.prototype.slice.call(arguments, 0))\n\t}\n}\n\nfunction slice(arr, index) {\n\treturn Array.prototype.slice.call(arr, index || 0)\n}\n\nfunction each(obj, fn) {\n\tpluck(obj, function(val, key) {\n\t\tfn(val, key)\n\t\treturn false\n\t})\n}\n\nfunction map(obj, fn) {\n\tvar res = (isList(obj) ? [] : {})\n\tpluck(obj, function(v, k) {\n\t\tres[k] = fn(v, k)\n\t\treturn false\n\t})\n\treturn res\n}\n\nfunction pluck(obj, fn) {\n\tif (isList(obj)) {\n\t\tfor (var i=0; i= 0; i--) {\n\t\tvar key = localStorage().key(i)\n\t\tfn(read(key), key)\n\t}\n}\n\nfunction remove(key) {\n\treturn localStorage().removeItem(key)\n}\n\nfunction clearAll() {\n\treturn localStorage().clear()\n}\n", "// oldFF-globalStorage provides storage for Firefox\n// versions 6 and 7, where no localStorage, etc\n// is available.\n\nvar util = require('../src/util')\nvar Global = util.Global\n\nmodule.exports = {\n\tname: 'oldFF-globalStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar globalStorage = Global.globalStorage\n\nfunction read(key) {\n\treturn globalStorage[key]\n}\n\nfunction write(key, data) {\n\tglobalStorage[key] = data\n}\n\nfunction each(fn) {\n\tfor (var i = globalStorage.length - 1; i >= 0; i--) {\n\t\tvar key = globalStorage.key(i)\n\t\tfn(globalStorage[key], key)\n\t}\n}\n\nfunction remove(key) {\n\treturn globalStorage.removeItem(key)\n}\n\nfunction clearAll() {\n\teach(function(key, _) {\n\t\tdelete globalStorage[key]\n\t})\n}\n", "// oldIE-userDataStorage provides storage for Internet Explorer\n// versions 6 and 7, where no localStorage, sessionStorage, etc\n// is available.\n\nvar util = require('../src/util')\nvar Global = util.Global\n\nmodule.exports = {\n\tname: 'oldIE-userDataStorage',\n\twrite: write,\n\tread: read,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar storageName = 'storejs'\nvar doc = Global.document\nvar _withStorageEl = _makeIEStorageElFunction()\nvar disable = (Global.navigator ? Global.navigator.userAgent : '').match(/ (MSIE 8|MSIE 9|MSIE 10)\\./) // MSIE 9.x, MSIE 10.x\n\nfunction write(unfixedKey, data) {\n\tif (disable) { return }\n\tvar fixedKey = fixKey(unfixedKey)\n\t_withStorageEl(function(storageEl) {\n\t\tstorageEl.setAttribute(fixedKey, data)\n\t\tstorageEl.save(storageName)\n\t})\n}\n\nfunction read(unfixedKey) {\n\tif (disable) { return }\n\tvar fixedKey = fixKey(unfixedKey)\n\tvar res = null\n\t_withStorageEl(function(storageEl) {\n\t\tres = storageEl.getAttribute(fixedKey)\n\t})\n\treturn res\n}\n\nfunction each(callback) {\n\t_withStorageEl(function(storageEl) {\n\t\tvar attributes = storageEl.XMLDocument.documentElement.attributes\n\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\tvar attr = attributes[i]\n\t\t\tcallback(storageEl.getAttribute(attr.name), attr.name)\n\t\t}\n\t})\n}\n\nfunction remove(unfixedKey) {\n\tvar fixedKey = fixKey(unfixedKey)\n\t_withStorageEl(function(storageEl) {\n\t\tstorageEl.removeAttribute(fixedKey)\n\t\tstorageEl.save(storageName)\n\t})\n}\n\nfunction clearAll() {\n\t_withStorageEl(function(storageEl) {\n\t\tvar attributes = storageEl.XMLDocument.documentElement.attributes\n\t\tstorageEl.load(storageName)\n\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\tstorageEl.removeAttribute(attributes[i].name)\n\t\t}\n\t\tstorageEl.save(storageName)\n\t})\n}\n\n// Helpers\n//////////\n\n// In IE7, keys cannot start with a digit or contain certain chars.\n// See https://github.com/marcuswestin/store.js/issues/40\n// See https://github.com/marcuswestin/store.js/issues/83\nvar forbiddenCharsRegex = new RegExp(\"[!\\\"#$%&'()*+,/\\\\\\\\:;<=>?@[\\\\]^`{|}~]\", \"g\")\nfunction fixKey(key) {\n\treturn key.replace(/^\\d/, '___$&').replace(forbiddenCharsRegex, '___')\n}\n\nfunction _makeIEStorageElFunction() {\n\tif (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {\n\t\treturn null\n\t}\n\tvar scriptTag = 'script',\n\t\tstorageOwner,\n\t\tstorageContainer,\n\t\tstorageEl\n\n\t// Since #userData storage applies only to specific paths, we need to\n\t// somehow link our data to a specific path. We choose /favicon.ico\n\t// as a pretty safe option, since all browsers already make a request to\n\t// this URL anyway and being a 404 will not hurt us here. We wrap an\n\t// iframe pointing to the favicon in an ActiveXObject(htmlfile) object\n\t// (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)\n\t// since the iframe access rules appear to allow direct access and\n\t// manipulation of the document element, even for a 404 page. This\n\t// document can be used instead of the current document (which would\n\t// have been limited to the current path) to perform #userData storage.\n\ttry {\n\t\t/* global ActiveXObject */\n\t\tstorageContainer = new ActiveXObject('htmlfile')\n\t\tstorageContainer.open()\n\t\tstorageContainer.write('<'+scriptTag+'>document.w=window')\n\t\tstorageContainer.close()\n\t\tstorageOwner = storageContainer.w.frames[0].document\n\t\tstorageEl = storageOwner.createElement('div')\n\t} catch(e) {\n\t\t// somehow ActiveXObject instantiation failed (perhaps some special\n\t\t// security settings or otherwse), fall back to per-path storage\n\t\tstorageEl = doc.createElement('div')\n\t\tstorageOwner = doc.body\n\t}\n\n\treturn function(storeFunction) {\n\t\tvar args = [].slice.call(arguments, 0)\n\t\targs.unshift(storageEl)\n\t\t// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx\n\t\t// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx\n\t\tstorageOwner.appendChild(storageEl)\n\t\tstorageEl.addBehavior('#default#userData')\n\t\tstorageEl.load(storageName)\n\t\tstoreFunction.apply(this, args)\n\t\tstorageOwner.removeChild(storageEl)\n\t\treturn\n\t}\n}\n", "// cookieStorage is useful Safari private browser mode, where localStorage\n// doesn't work but cookies do. This implementation is adopted from\n// https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage\n\nvar util = require('../src/util')\nvar Global = util.Global\nvar trim = util.trim\n\nmodule.exports = {\n\tname: 'cookieStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar doc = Global.document\n\nfunction read(key) {\n\tif (!key || !_has(key)) { return null }\n\tvar regexpStr = \"(?:^|.*;\\\\s*)\" +\n\t\tescape(key).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") +\n\t\t\"\\\\s*\\\\=\\\\s*((?:[^;](?!;))*[^;]?).*\"\n\treturn unescape(doc.cookie.replace(new RegExp(regexpStr), \"$1\"))\n}\n\nfunction each(callback) {\n\tvar cookies = doc.cookie.split(/; ?/g)\n\tfor (var i = cookies.length - 1; i >= 0; i--) {\n\t\tif (!trim(cookies[i])) {\n\t\t\tcontinue\n\t\t}\n\t\tvar kvp = cookies[i].split('=')\n\t\tvar key = unescape(kvp[0])\n\t\tvar val = unescape(kvp[1])\n\t\tcallback(val, key)\n\t}\n}\n\nfunction write(key, data) {\n\tif(!key) { return }\n\tdoc.cookie = escape(key) + \"=\" + escape(data) + \"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/\"\n}\n\nfunction remove(key) {\n\tif (!key || !_has(key)) {\n\t\treturn\n\t}\n\tdoc.cookie = escape(key) + \"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/\"\n}\n\nfunction clearAll() {\n\teach(function(_, key) {\n\t\tremove(key)\n\t})\n}\n\nfunction _has(key) {\n\treturn (new RegExp(\"(?:^|;\\\\s*)\" + escape(key).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") + \"\\\\s*\\\\=\")).test(doc.cookie)\n}\n", "var util = require('../src/util')\nvar Global = util.Global\n\nmodule.exports = {\n\tname: 'sessionStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll\n}\n\nfunction sessionStorage() {\n\treturn Global.sessionStorage\n}\n\nfunction read(key) {\n\treturn sessionStorage().getItem(key)\n}\n\nfunction write(key, data) {\n\treturn sessionStorage().setItem(key, data)\n}\n\nfunction each(fn) {\n\tfor (var i = sessionStorage().length - 1; i >= 0; i--) {\n\t\tvar key = sessionStorage().key(i)\n\t\tfn(read(key), key)\n\t}\n}\n\nfunction remove(key) {\n\treturn sessionStorage().removeItem(key)\n}\n\nfunction clearAll() {\n\treturn sessionStorage().clear()\n}\n", "// memoryStorage is a useful last fallback to ensure that the store\n// is functions (meaning store.get(), store.set(), etc will all function).\n// However, stored values will not persist when the browser navigates to\n// a new page or reloads the current page.\n\nmodule.exports = {\n\tname: 'memoryStorage',\n\tread: read,\n\twrite: write,\n\teach: each,\n\tremove: remove,\n\tclearAll: clearAll,\n}\n\nvar memoryStorage = {}\n\nfunction read(key) {\n\treturn memoryStorage[key]\n}\n\nfunction write(key, data) {\n\tmemoryStorage[key] = data\n}\n\nfunction each(callback) {\n\tfor (var key in memoryStorage) {\n\t\tif (memoryStorage.hasOwnProperty(key)) {\n\t\t\tcallback(memoryStorage[key], key)\n\t\t}\n\t}\n}\n\nfunction remove(key) {\n\tdelete memoryStorage[key]\n}\n\nfunction clearAll(key) {\n\tmemoryStorage = {}\n}\n", "module.exports = [\n\t// Listed in order of usage preference\n\trequire('./localStorage'),\n\trequire('./oldFF-globalStorage'),\n\trequire('./oldIE-userDataStorage'),\n\trequire('./cookieStorage'),\n\trequire('./sessionStorage'),\n\trequire('./memoryStorage')\n]\n", "/* eslint-disable */\n\n// json2.js\n// 2016-10-28\n// Public Domain.\n// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n// See http://www.JSON.org/js.html\n// This code should be minified before deployment.\n// See http://javascript.crockford.com/jsmin.html\n\n// USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO\n// NOT CONTROL.\n\n// This file creates a global JSON object containing two methods: stringify\n// and parse. This file provides the ES5 JSON capability to ES3 systems.\n// If a project might run on IE8 or earlier, then this file should be included.\n// This file does nothing on ES5 systems.\n\n// JSON.stringify(value, replacer, space)\n// value any JavaScript value, usually an object or array.\n// replacer an optional parameter that determines how object\n// values are stringified for objects. It can be a\n// function or an array of strings.\n// space an optional parameter that specifies the indentation\n// of nested structures. If it is omitted, the text will\n// be packed without extra whitespace. If it is a number,\n// it will specify the number of spaces to indent at each\n// level. If it is a string (such as \"\\t\" or \" \"),\n// it contains the characters used to indent at each level.\n// This method produces a JSON text from a JavaScript value.\n// When an object value is found, if the object contains a toJSON\n// method, its toJSON method will be called and the result will be\n// stringified. A toJSON method does not serialize: it returns the\n// value represented by the name/value pair that should be serialized,\n// or undefined if nothing should be serialized. The toJSON method\n// will be passed the key associated with the value, and this will be\n// bound to the value.\n\n// For example, this would serialize Dates as ISO strings.\n\n// Date.prototype.toJSON = function (key) {\n// function f(n) {\n// // Format integers to have at least two digits.\n// return (n < 10)\n// ? \"0\" + n\n// : n;\n// }\n// return this.getUTCFullYear() + \"-\" +\n// f(this.getUTCMonth() + 1) + \"-\" +\n// f(this.getUTCDate()) + \"T\" +\n// f(this.getUTCHours()) + \":\" +\n// f(this.getUTCMinutes()) + \":\" +\n// f(this.getUTCSeconds()) + \"Z\";\n// };\n\n// You can provide an optional replacer method. It will be passed the\n// key and value of each member, with this bound to the containing\n// object. The value that is returned from your method will be\n// serialized. If your method returns undefined, then the member will\n// be excluded from the serialization.\n\n// If the replacer parameter is an array of strings, then it will be\n// used to select the members to be serialized. It filters the results\n// such that only members with keys listed in the replacer array are\n// stringified.\n\n// Values that do not have JSON representations, such as undefined or\n// functions, will not be serialized. Such values in objects will be\n// dropped; in arrays they will be replaced with null. You can use\n// a replacer function to replace those with JSON values.\n\n// JSON.stringify(undefined) returns undefined.\n\n// The optional space parameter produces a stringification of the\n// value that is filled with line breaks and indentation to make it\n// easier to read.\n\n// If the space parameter is a non-empty string, then that string will\n// be used for indentation. If the space parameter is a number, then\n// the indentation will be that many spaces.\n\n// Example:\n\n// text = JSON.stringify([\"e\", {pluribus: \"unum\"}]);\n// // text is '[\"e\",{\"pluribus\":\"unum\"}]'\n\n// text = JSON.stringify([\"e\", {pluribus: \"unum\"}], null, \"\\t\");\n// // text is '[\\n\\t\"e\",\\n\\t{\\n\\t\\t\"pluribus\": \"unum\"\\n\\t}\\n]'\n\n// text = JSON.stringify([new Date()], function (key, value) {\n// return this[key] instanceof Date\n// ? \"Date(\" + this[key] + \")\"\n// : value;\n// });\n// // text is '[\"Date(---current time---)\"]'\n\n// JSON.parse(text, reviver)\n// This method parses a JSON text to produce an object or array.\n// It can throw a SyntaxError exception.\n\n// The optional reviver parameter is a function that can filter and\n// transform the results. It receives each of the keys and values,\n// and its return value is used instead of the original value.\n// If it returns what it received, then the structure is not modified.\n// If it returns undefined then the member is deleted.\n\n// Example:\n\n// // Parse the text. Values that look like ISO date strings will\n// // be converted to Date objects.\n\n// myData = JSON.parse(text, function (key, value) {\n// var a;\n// if (typeof value === \"string\") {\n// a =\n// /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)Z$/.exec(value);\n// if (a) {\n// return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],\n// +a[5], +a[6]));\n// }\n// }\n// return value;\n// });\n\n// myData = JSON.parse('[\"Date(09/09/2001)\"]', function (key, value) {\n// var d;\n// if (typeof value === \"string\" &&\n// value.slice(0, 5) === \"Date(\" &&\n// value.slice(-1) === \")\") {\n// d = new Date(value.slice(5, -1));\n// if (d) {\n// return d;\n// }\n// }\n// return value;\n// });\n\n// This is a reference implementation. You are free to copy, modify, or\n// redistribute.\n\n/*jslint\n eval, for, this\n*/\n\n/*property\n JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,\n getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,\n lastIndex, length, parse, prototype, push, replace, slice, stringify,\n test, toJSON, toString, valueOf\n*/\n\n\n// Create a JSON object only if one does not already exist. We create the\n// methods in a closure to avoid creating global variables.\n\nif (typeof JSON !== \"object\") {\n JSON = {};\n}\n\n(function () {\n \"use strict\";\n\n var rx_one = /^[\\],:{}\\s]*$/;\n var rx_two = /\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g;\n var rx_three = /\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g;\n var rx_four = /(?:^|:|,)(?:\\s*\\[)+/g;\n var rx_escapable = /[\\\\\"\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g;\n var rx_dangerous = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g;\n\n function f(n) {\n // Format integers to have at least two digits.\n return n < 10\n ? \"0\" + n\n : n;\n }\n\n function this_value() {\n return this.valueOf();\n }\n\n if (typeof Date.prototype.toJSON !== \"function\") {\n\n Date.prototype.toJSON = function () {\n\n return isFinite(this.valueOf())\n ? this.getUTCFullYear() + \"-\" +\n f(this.getUTCMonth() + 1) + \"-\" +\n f(this.getUTCDate()) + \"T\" +\n f(this.getUTCHours()) + \":\" +\n f(this.getUTCMinutes()) + \":\" +\n f(this.getUTCSeconds()) + \"Z\"\n : null;\n };\n\n Boolean.prototype.toJSON = this_value;\n Number.prototype.toJSON = this_value;\n String.prototype.toJSON = this_value;\n }\n\n var gap;\n var indent;\n var meta;\n var rep;\n\n\n function quote(string) {\n\n// If the string contains no control characters, no quote characters, and no\n// backslash characters, then we can safely slap some quotes around it.\n// Otherwise we must also replace the offending characters with safe escape\n// sequences.\n\n rx_escapable.lastIndex = 0;\n return rx_escapable.test(string)\n ? \"\\\"\" + string.replace(rx_escapable, function (a) {\n var c = meta[a];\n return typeof c === \"string\"\n ? c\n : \"\\\\u\" + (\"0000\" + a.charCodeAt(0).toString(16)).slice(-4);\n }) + \"\\\"\"\n : \"\\\"\" + string + \"\\\"\";\n }\n\n\n function str(key, holder) {\n\n// Produce a string from holder[key].\n\n var i; // The loop counter.\n var k; // The member key.\n var v; // The member value.\n var length;\n var mind = gap;\n var partial;\n var value = holder[key];\n\n// If the value has a toJSON method, call it to obtain a replacement value.\n\n if (value && typeof value === \"object\" &&\n typeof value.toJSON === \"function\") {\n value = value.toJSON(key);\n }\n\n// If we were called with a replacer function, then call the replacer to\n// obtain a replacement value.\n\n if (typeof rep === \"function\") {\n value = rep.call(holder, key, value);\n }\n\n// What happens next depends on the value's type.\n\n switch (typeof value) {\n case \"string\":\n return quote(value);\n\n case \"number\":\n\n// JSON numbers must be finite. Encode non-finite numbers as null.\n\n return isFinite(value)\n ? String(value)\n : \"null\";\n\n case \"boolean\":\n case \"null\":\n\n// If the value is a boolean or null, convert it to a string. Note:\n// typeof null does not produce \"null\". The case is included here in\n// the remote chance that this gets fixed someday.\n\n return String(value);\n\n// If the type is \"object\", we might be dealing with an object or an array or\n// null.\n\n case \"object\":\n\n// Due to a specification blunder in ECMAScript, typeof null is \"object\",\n// so watch out for that case.\n\n if (!value) {\n return \"null\";\n }\n\n// Make an array to hold the partial results of stringifying this object value.\n\n gap += indent;\n partial = [];\n\n// Is the value an array?\n\n if (Object.prototype.toString.apply(value) === \"[object Array]\") {\n\n// The value is an array. Stringify every element. Use null as a placeholder\n// for non-JSON values.\n\n length = value.length;\n for (i = 0; i < length; i += 1) {\n partial[i] = str(i, value) || \"null\";\n }\n\n// Join all of the elements together, separated with commas, and wrap them in\n// brackets.\n\n v = partial.length === 0\n ? \"[]\"\n : gap\n ? \"[\\n\" + gap + partial.join(\",\\n\" + gap) + \"\\n\" + mind + \"]\"\n : \"[\" + partial.join(\",\") + \"]\";\n gap = mind;\n return v;\n }\n\n// If the replacer is an array, use it to select the members to be stringified.\n\n if (rep && typeof rep === \"object\") {\n length = rep.length;\n for (i = 0; i < length; i += 1) {\n if (typeof rep[i] === \"string\") {\n k = rep[i];\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (\n gap\n ? \": \"\n : \":\"\n ) + v);\n }\n }\n }\n } else {\n\n// Otherwise, iterate through all of the keys in the object.\n\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (\n gap\n ? \": \"\n : \":\"\n ) + v);\n }\n }\n }\n }\n\n// Join all of the member texts together, separated with commas,\n// and wrap them in braces.\n\n v = partial.length === 0\n ? \"{}\"\n : gap\n ? \"{\\n\" + gap + partial.join(\",\\n\" + gap) + \"\\n\" + mind + \"}\"\n : \"{\" + partial.join(\",\") + \"}\";\n gap = mind;\n return v;\n }\n }\n\n// If the JSON object does not yet have a stringify method, give it one.\n\n if (typeof JSON.stringify !== \"function\") {\n meta = { // table of character substitutions\n \"\\b\": \"\\\\b\",\n \"\\t\": \"\\\\t\",\n \"\\n\": \"\\\\n\",\n \"\\f\": \"\\\\f\",\n \"\\r\": \"\\\\r\",\n \"\\\"\": \"\\\\\\\"\",\n \"\\\\\": \"\\\\\\\\\"\n };\n JSON.stringify = function (value, replacer, space) {\n\n// The stringify method takes a value and an optional replacer, and an optional\n// space parameter, and returns a JSON text. The replacer can be a function\n// that can replace values, or an array of strings that will select the keys.\n// A default replacer method can be provided. Use of the space parameter can\n// produce text that is more easily readable.\n\n var i;\n gap = \"\";\n indent = \"\";\n\n// If the space parameter is a number, make an indent string containing that\n// many spaces.\n\n if (typeof space === \"number\") {\n for (i = 0; i < space; i += 1) {\n indent += \" \";\n }\n\n// If the space parameter is a string, it will be used as the indent string.\n\n } else if (typeof space === \"string\") {\n indent = space;\n }\n\n// If there is a replacer, it must be a function or an array.\n// Otherwise, throw an error.\n\n rep = replacer;\n if (replacer && typeof replacer !== \"function\" &&\n (typeof replacer !== \"object\" ||\n typeof replacer.length !== \"number\")) {\n throw new Error(\"JSON.stringify\");\n }\n\n// Make a fake root object containing our value under the key of \"\".\n// Return the result of stringifying the value.\n\n return str(\"\", {\"\": value});\n };\n }\n\n\n// If the JSON object does not yet have a parse method, give it one.\n\n if (typeof JSON.parse !== \"function\") {\n JSON.parse = function (text, reviver) {\n\n// The parse method takes a text and an optional reviver function, and returns\n// a JavaScript value if the text is a valid JSON text.\n\n var j;\n\n function walk(holder, key) {\n\n// The walk method is used to recursively walk the resulting structure so\n// that modifications can be made.\n\n var k;\n var v;\n var value = holder[key];\n if (value && typeof value === \"object\") {\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = walk(value, k);\n if (v !== undefined) {\n value[k] = v;\n } else {\n delete value[k];\n }\n }\n }\n }\n return reviver.call(holder, key, value);\n }\n\n\n// Parsing happens in four stages. In the first stage, we replace certain\n// Unicode characters with escape sequences. JavaScript handles many characters\n// incorrectly, either silently deleting them, or treating them as line endings.\n\n text = String(text);\n rx_dangerous.lastIndex = 0;\n if (rx_dangerous.test(text)) {\n text = text.replace(rx_dangerous, function (a) {\n return \"\\\\u\" +\n (\"0000\" + a.charCodeAt(0).toString(16)).slice(-4);\n });\n }\n\n// In the second stage, we run the text against regular expressions that look\n// for non-JSON patterns. We are especially concerned with \"()\" and \"new\"\n// because they can cause invocation, and \"=\" because it can cause mutation.\n// But just to be safe, we want to reject all unexpected forms.\n\n// We split the second stage into 4 regexp operations in order to work around\n// crippling inefficiencies in IE's and Safari's regexp engines. First we\n// replace the JSON backslash pairs with \"@\" (a non-JSON character). Second, we\n// replace all simple value tokens with \"]\" characters. Third, we delete all\n// open brackets that follow a colon or comma or that begin the text. Finally,\n// we look to see that the remaining characters are only whitespace or \"]\" or\n// \",\" or \":\" or \"{\" or \"}\". If that is so, then the text is safe for eval.\n\n if (\n rx_one.test(\n text\n .replace(rx_two, \"@\")\n .replace(rx_three, \"]\")\n .replace(rx_four, \"\")\n )\n ) {\n\n// In the third stage we use the eval function to compile the text into a\n// JavaScript structure. The \"{\" operator is subject to a syntactic ambiguity\n// in JavaScript: it can begin a block or an object literal. We wrap the text\n// in parens to eliminate the ambiguity.\n\n j = eval(\"(\" + text + \")\");\n\n// In the optional fourth stage, we recursively walk the new structure, passing\n// each name/value pair to a reviver function for possible transformation.\n\n return (typeof reviver === \"function\")\n ? walk({\"\": j}, \"\")\n : j;\n }\n\n// If the text is not JSON parseable, then a SyntaxError is thrown.\n\n throw new SyntaxError(\"JSON.parse\");\n };\n }\n}());", "module.exports = json2Plugin\n\nfunction json2Plugin() {\n\trequire('./lib/json2')\n\treturn {}\n}\n", "var engine = require('../src/store-engine')\n\nvar storages = require('../storages/all')\nvar plugins = [require('../plugins/json2')]\n\nmodule.exports = engine.createStore(storages, plugins)\n", "import store from 'store';\n\n\n/**\n * osmAuth\n * Easy authentication with OpenStreetMap over OAuth 2.0.\n * @module\n *\n * @param o `Object` containing options:\n * @param o.scope OAuth2 scopes requested (e.g. \"read_prefs write_api\")\n * @param o.client_id OAuth2 client ID\n * @param o.client_secret OAuth2 client secret\n * @param o.redirect_uri OAuth2 redirect URI (e.g. \"http://127.0.0.1:8080/land.html\")\n * @param o.access_token Can pre-authorize with an OAuth2 bearer token if you have one\n * @param o.url A base url (default: \"https://www.openstreetmap.org\")\n * @param o.auto If `true`, attempt to authenticate automatically when calling `.xhr()` (default: `false`)\n * @param o.singlepage If `true`, use page redirection instead of a popup (default: `false`)\n * @param o.loading Function called when auth-related xhr calls start\n * @param o.done Function called when auth-related xhr calls end\n * @return `self`\n */\nexport function osmAuth(o) {\n var oauth = {};\n\n /**\n * authenticated\n * Test whether the user is currently authenticated\n * @return `true` if authenticated, `false` if not\n */\n oauth.authenticated = function () {\n return !!token('oauth2_access_token');\n };\n\n\n /**\n * logout\n * Removes any stored authentication tokens (legacy OAuth1 tokens too)\n *\n * @return `self`\n */\n oauth.logout = function () {\n token('oauth2_access_token', ''); // OAuth2\n token('oauth_token', ''); // OAuth1\n token('oauth_token_secret', ''); // OAuth1\n token('oauth_request_token_secret', ''); // OAuth1\n return oauth;\n };\n\n\n /**\n * authenticate\n * First logs out, then runs the authentiation flow, finally calls the callback.\n * TODO: detect lack of click event (probably can settimeout it)\n *\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.authenticate = function (callback) {\n if (oauth.authenticated()) {\n callback(null, oauth);\n return;\n }\n\n oauth.logout();\n\n // ## Request authorization to access resources from the user\n // and receive authorization code\n var url =\n o.url +\n '/oauth2/authorize?' +\n utilQsString({\n client_id: o.client_id,\n redirect_uri: o.redirect_uri,\n response_type: 'code',\n scope: o.scope,\n });\n\n if (o.singlepage) {\n var params = utilStringQs(window.location.search.slice(1));\n if (params.code) {\n getAccessToken(params.code);\n } else {\n window.location = url;\n }\n } else {\n // Create a 600x550 popup window in the center of the screen\n var w = 600;\n var h = 550;\n var settings = [\n ['width', w],\n ['height', h],\n ['left', window.screen.width / 2 - w / 2],\n ['top', window.screen.height / 2 - h / 2],\n ]\n .map(function (x) { return x.join('='); })\n .join(',');\n\n var popup = window.open('about:blank', 'oauth_window', settings);\n oauth.popupWindow = popup;\n popup.location = url;\n\n if (!popup) {\n var error = new Error('Popup was blocked');\n error.status = 'popup-blocked';\n throw error;\n }\n }\n\n // Called by a function in the redirect URL page, in the popup window. The\n // window closes itself.\n window.authComplete = function (url) {\n var params = utilStringQs(url.split('?')[1]);\n getAccessToken(params.code);\n delete window.authComplete;\n };\n\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the `auth_code`, brought\n // in from a function call on a landing page popup.\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n };\n\n\n /**\n * bringPopupWindowToFront\n * Tries to bring an existing authentication popup to the front.\n * @return `true` if it succeeded, `false` if not\n */\n oauth.bringPopupWindowToFront = function () {\n var broughtPopupToFront = false;\n try {\n // This may cause a cross-origin error:\n // `DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.`\n if (oauth.popupWindow && !oauth.popupWindow.closed) {\n oauth.popupWindow.focus();\n broughtPopupToFront = true;\n }\n } catch (err) {\n // Bringing popup window to front failed (probably because of the cross-origin error mentioned above)\n }\n return broughtPopupToFront;\n };\n\n\n /**\n * bootstrapToken\n * The authorization code is a temporary code that a client can exchange for an access token.\n * If using this library in single-page mode, you'll need to call this once your application\n * has an `auth_code` and wants to get an access_token.\n *\n * @param auth_code The OAuth2 `auth_code`\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return none\n */\n oauth.bootstrapToken = function (auth_code, callback) {\n // ## Getting an access token\n // The client requests an access token by authenticating with the\n // authorization server and presenting the authorization_code\n function getAccessToken(auth_code) {\n var url =\n o.url +\n '/oauth2/token?' +\n utilQsString({\n client_id: o.client_id,\n grant_type: 'authorization_code',\n code: auth_code,\n redirect_uri: o.redirect_uri,\n client_secret: o.client_secret,\n });\n\n // The authorization server authenticates the client and validates\n // the authorization grant, and if valid, issues an access token.\n oauth.rawxhr('POST', url, null, null, null, accessTokenDone);\n o.loading();\n }\n\n function accessTokenDone(err, xhr) {\n o.done();\n if (err) {\n callback(err);\n return;\n }\n var access_token = JSON.parse(xhr.response);\n token('oauth2_access_token', access_token.access_token);\n callback(null, oauth);\n }\n\n getAccessToken(auth_code);\n };\n\n /**\n * fetch\n * A `fetch` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/fetch\n *\n * @param path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `options.prefix`=`false`)\n * @param options\n * @param options.method Passed to `fetch` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.body Passed to `fetch`\n * @param options.headers `Object` containing request headers\n * @return `Promise` that resolves to a `Response` if authenticated, otherwise `null`\n */\n oauth.fetch = function (path, options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? o.url + path : path;\n var headers = options.headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n headers.Authorization = 'Bearer ' + token('oauth2_access_token');\n return fetch(url, {\n method: options.method,\n body: options.body,\n headers: headers,\n }).then((resp) => {\n var contentType = resp.headers.get('content-type').split(';')[0];\n switch (contentType) {\n case 'text/html':\n case 'text/xml':\n return resp\n .text()\n .then((txt) =>\n new window.DOMParser().parseFromString(txt, contentType)\n );\n case 'application/html':\n return resp.json();\n default:\n return resp.text();\n }\n });\n }\n };\n\n /**\n * xhr\n * A `XMLHttpRequest` wrapper that does authenticated calls if the user has logged in.\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param options\n * @param options.method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param options.prefix If `true` path contains a path, if `false` path contains the full url\n * @param options.path The URL path (e.g. \"/api/0.6/user/details\") (or full url, if `prefix`=`false`)\n * @param options.content Passed to `xhr.send`\n * @param options.headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest` if authenticated, otherwise `null`\n */\n oauth.xhr = function (options, callback) {\n if (oauth.authenticated()) {\n return run();\n } else {\n if (o.auto) {\n oauth.authenticate(run);\n return;\n } else {\n callback('not authenticated', null);\n return;\n }\n }\n\n function run() {\n var url = options.prefix !== false ? (o.url + options.path) : options.path;\n return oauth.rawxhr(\n options.method,\n url,\n token('oauth2_access_token'),\n options.content,\n options.headers,\n done\n );\n }\n\n function done(err, xhr) {\n if (err) {\n callback(err);\n } else if (xhr.responseXML) {\n callback(err, xhr.responseXML);\n } else {\n callback(err, xhr.response);\n }\n }\n };\n\n\n /**\n * rawxhr\n * Creates the XMLHttpRequest set up with a header and response handling\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n *\n * @param method Passed to `xhr.open` (e.g. 'GET', 'POST')\n * @param url Passed to `xhr.open`\n * @param access_token OAuth2 bearer token\n * @param data Passed to `xhr.send`\n * @param headers `Object` containing request headers\n * @param callback An \"errback\"-style callback (`err`, `result`), called when complete\n * @return `XMLHttpRequest`\n */\n oauth.rawxhr = function (method, url, access_token, data, headers, callback) {\n headers = headers || { 'Content-Type': 'application/x-www-form-urlencoded' };\n\n if (access_token) {\n headers.Authorization = 'Bearer ' + access_token;\n }\n\n var xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function () {\n if (4 === xhr.readyState && 0 !== xhr.status) {\n if (/^20\\d$/.test(xhr.status)) { // a 20x status code - OK\n callback(null, xhr);\n } else {\n callback(xhr, null);\n }\n }\n };\n xhr.onerror = function (e) {\n callback(e, null);\n };\n\n xhr.open(method, url, true);\n for (var h in headers) xhr.setRequestHeader(h, headers[h]);\n\n xhr.send(data);\n return xhr;\n };\n\n\n /**\n * preauth\n * Pre-authorize this object, if we already have access token from the start\n *\n * @param val `Object` containing `access_token` property\n * @return `self`\n */\n oauth.preauth = function (val) {\n if (val && val.access_token) {\n token('oauth2_access_token', val.access_token);\n }\n return oauth;\n };\n\n\n /**\n * options (getter / setter)\n * If passed with no arguments, just return the options\n * If passed an Object, set the options then attempt to pre-authorize\n *\n * @param val? Object containing options\n * @return current `options` (if getting), or `self` (if setting)\n */\n oauth.options = function (val) {\n if (!arguments.length) return o;\n\n o = val;\n o.url = o.url || 'https://www.openstreetmap.org';\n o.auto = o.auto || false;\n o.singlepage = o.singlepage || false;\n\n // Optional loading and loading-done functions for nice UI feedback.\n // by default, no-ops\n o.loading = o.loading || function () {};\n o.done = o.done || function () {};\n return oauth.preauth(o);\n };\n\n\n // Everything below here is initialization/setup code\n\n // get/set tokens. These are prefixed with the base URL so that `osm-auth`\n // can be used with multiple APIs and the keys in `localStorage`\n // will not clash\n var token;\n\n if (store.enabled) {\n token = function (x, y) {\n if (arguments.length === 1) return store.get(o.url + x);\n else if (arguments.length === 2) return store.set(o.url + x, y);\n };\n } else {\n var storage = {};\n token = function (x, y) {\n if (arguments.length === 1) return storage[o.url + x];\n else if (arguments.length === 2) return (storage[o.url + x] = y);\n };\n }\n\n // Handle options and attempt to pre-authorize\n oauth.options(o);\n\n return oauth;\n}\n\n\n/** Transforms object into query string\n * @param obj\n * @param noencode\n * @returns query string\n */\nfunction utilQsString(obj) {\n return Object.keys(obj)\n .sort()\n .map(function(key) {\n return (encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n })\n .join('&');\n}\n\n/** Transforms query string into object\n * @param str\n * @returns object\n */\nfunction utilStringQs(str) {\n var i = 0; // advance past any leading '?' or '#' characters\n while (i < str.length && (str[i] === '?' || str[i] === '#')) i++;\n str = str.slice(i);\n\n return str.split('&').reduce(function(obj, pair) {\n var parts = pair.split('=');\n if (parts.length === 2) {\n obj[parts[0]] = decodeURIComponent(parts[1]);\n }\n return obj;\n }, {});\n}"], + "mappings": "4wBAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,KAAIC,EAASC,GAAY,EACrBC,GAASC,GAAY,EACrBC,GAAOC,GAAU,EACjBC,GAAU,OAAO,QAAW,YAAc,OAAS,OAEvDP,EAAO,QAAU,CAChB,OAAQC,EACR,OAAQE,GACR,KAAME,GACN,KAAMG,GACN,MAAOC,EACP,KAAMC,EACN,IAAKC,GACL,MAAOC,EACP,OAAQC,EACR,WAAYC,GACZ,SAAUC,GACV,OAAQR,EACT,EAEA,SAASL,IAAc,CACtB,OAAI,OAAO,OACH,OAAO,OAEP,SAAoBc,EAAKC,EAAQC,EAAQC,EAAK,CACpD,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IACrCV,EAAK,OAAO,UAAUU,CAAC,CAAC,EAAG,SAASC,EAAKC,EAAK,CAC7CN,EAAIM,CAAG,EAAID,CACZ,CAAC,EAEF,OAAOL,CACR,CAEF,CAEA,SAASZ,IAAc,CACtB,GAAI,OAAO,OACV,OAAO,SAAgBY,EAAKO,EAAcC,EAAcL,EAAK,CAC5D,IAAIM,EAAiBhB,EAAM,UAAW,CAAC,EACvC,OAAOR,EAAO,MAAM,KAAM,CAAC,OAAO,OAAOe,CAAG,CAAC,EAAE,OAAOS,CAAc,CAAC,CACtE,EAEA,IAASC,EAAT,UAAa,CAAC,EAALA,IACT,OAAO,SAAgBV,EAAKO,EAAcC,EAAcL,EAAK,CAC5D,IAAIM,EAAiBhB,EAAM,UAAW,CAAC,EACvC,OAAAiB,EAAE,UAAYV,EACPf,EAAO,MAAM,KAAM,CAAC,IAAIyB,CAAG,EAAE,OAAOD,CAAc,CAAC,CAC3D,CAEF,CAEA,SAASnB,IAAY,CACpB,OAAI,OAAO,UAAU,KACb,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BAAmBA,CAAG,EAAI,IAAM,mBAAmBD,EAAIC,CAAG,CAAC,CACrE,CAAC,EACA,KAAK,GAAG,CACb,CAMA,SAAS9B,GAAa+B,EAAK,CAEzB,QADIC,EAAI,EACDA,EAAID,EAAI,SAAWA,EAAIC,CAAC,IAAM,KAAOD,EAAIC,CAAC,IAAM,MAAMA,IAC7D,OAAAD,EAAMA,EAAI,MAAMC,CAAC,EAEVD,EAAI,MAAM,GAAG,EAAE,OAAO,SAASF,EAAKI,EAAM,CAC/C,IAAIC,EAAQD,EAAK,MAAM,GAAG,EAC1B,OAAIC,EAAM,SAAW,IACnBL,EAAIK,EAAM,CAAC,CAAC,EAAI,mBAAmBA,EAAM,CAAC,CAAC,GAEtCL,CACT,EAAG,CAAC,CAAC,CACP", + "names": ["require_util", "__commonJSMin", "exports", "module", "assign", "make_assign", "create", "make_create", "trim", "make_trim", "Global", "bind", "slice", "each", "map", "pluck", "isList", "isFunction", "isObject", "obj", "props1", "props2", "etc", "i", "val", "key", "assignProps1", "assignProps2", "assignArgsList", "F", "str", "fn", "arr", "index", "res", "v", "k", "require_store_engine", "__commonJSMin", "exports", "module", "util", "slice", "pluck", "each", "bind", "create", "isList", "isFunction", "isObject", "createStore", "storeAPI", "key", "optionalDefaultValue", "data", "value", "callback", "self", "val", "namespacedKey", "namespace", "plugin", "_warn", "_console", "fn", "storages", "plugins", "namespacePrefix", "namespaceRegexp", "legalNamespaces", "_privateStoreProps", "storage", "testStr", "ok", "e", "pluginFnProp", "propName", "oldFn", "args", "super_fn", "arg", "i", "newFnArgs", "obj", "strVal", "defaultVal", "seenPlugin", "pluginProperties", "store", "prop", "require_localStorage", "__commonJSMin", "exports", "module", "util", "Global", "read", "write", "each", "remove", "clearAll", "localStorage", "key", "data", "fn", "i", "require_oldFF_globalStorage", "__commonJSMin", "exports", "module", "util", "Global", "read", "write", "each", "remove", "clearAll", "globalStorage", "key", "data", "fn", "i", "_", "require_oldIE_userDataStorage", "__commonJSMin", "exports", "module", "util", "Global", "write", "read", "each", "remove", "clearAll", "storageName", "doc", "_withStorageEl", "_makeIEStorageElFunction", "disable", "unfixedKey", "data", "fixedKey", "fixKey", "storageEl", "res", "callback", "attributes", "attr", "i", "forbiddenCharsRegex", "key", "scriptTag", "storageOwner", "storageContainer", "e", "storeFunction", "args", "require_cookieStorage", "__commonJSMin", "exports", "module", "util", "Global", "trim", "read", "write", "each", "remove", "clearAll", "doc", "key", "_has", "regexpStr", "callback", "cookies", "i", "kvp", "val", "data", "_", "require_sessionStorage", "__commonJSMin", "exports", "module", "util", "Global", "read", "write", "each", "remove", "clearAll", "sessionStorage", "key", "data", "fn", "i", "require_memoryStorage", "__commonJSMin", "exports", "module", "read", "write", "each", "remove", "clearAll", "memoryStorage", "key", "data", "callback", "require_all", "__commonJSMin", "exports", "module", "require_json2", "__commonJSMin", "n", "string", "a", "c", "key", "holder", "i", "k", "v", "length", "mind", "partial", "value", "replacer", "space", "require_json2", "__commonJSMin", "exports", "module", "json2Plugin", "require_store_legacy", "__commonJSMin", "exports", "module", "engine", "storages", "plugins", "osm_auth_exports", "__export", "osmAuth", "import_store", "o", "oauth", "token", "callback", "url", "utilQsString", "params", "utilStringQs", "getAccessToken", "w", "h", "settings", "x", "popup", "error", "auth_code", "accessTokenDone", "err", "xhr", "access_token", "broughtPopupToFront", "path", "options", "run", "headers", "resp", "contentType", "txt", "done", "method", "data", "e", "val", "store", "y", "storage", "obj", "key", "str", "i", "pair", "parts"] } diff --git a/package.json b/package.json index 165c4c5..ff3286b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "osm-auth", - "version": "2.0.1", + "version": "2.1.0", "license": "ISC", "repository": "github:osmlab/osm-auth", "description": "A usable example of JavaScript OAuth 2.0 with OpenStreetMap", @@ -11,6 +11,7 @@ ], "contributors": [ "Bryan Housel (https://github.com/bhousel)", + "Daniel Schep (https://github.com/dschep)", "Hel Nershing Thapa (https://github.com/HelNershingThapa)", "Tom MacWright (https://github.com/tmcw)" ], @@ -50,4 +51,4 @@ "engines": { "node": ">=16" } -} +} \ No newline at end of file