-
Notifications
You must be signed in to change notification settings - Fork 1
/
thataway.umd.js
1 lines (1 loc) · 8.48 KB
/
thataway.umd.js
1
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).thataway=e()}}(function(){return function e(r,t,n){function o(a,u){if(!t[a]){if(!r[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var p=t[a]={exports:{}};r[a][0].call(p.exports,function(e){var t=r[a][1][e];return o(t||e)},p,p.exports,e,r,t,n)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,r,t){var n=e("in-window"),o=e("query-string"),i=e("router-params"),a=n?window.location:{pathname:"/",search:""};r.exports=function(e){e=e||{};var r={},t=[],u=[];function c(e){(e=e||p(a.pathname))&&t.forEach(function(r){r(e)})}function f(e){return"/"===e?e:e&&e.replace(/\/*$/,"")}function p(e){e=f(e);var t=r[e]||function(e){for(var r,t,n,o=0,i=u.length;o<i;o++)if(t=(r=u[o]).matcher(e)){(n=r.data).params=t;break}return n}(e)||{};return t.query=o.parse(a.search),t.hash=o.parse(a.hash),t.path=e,t}return n&&(window.onpopstate=function(){var e=p(a.pathname);e.back=!0,c(e)}),p.subscribe=function(e){return"function"==typeof e&&t.push(e),t.length},p.unsubscribe=function(e){var r=t.indexOf(e);if(e&&-1!==r)return t.splice(r,1),!0},p.register=function(e,t){if(e=f(e)){var n=i(e);n?u.push({matcher:n,data:t}):r[e]=t}return Object.keys(r).length},p.navigate=function(e,r,t){e=f(e),n&&function(e){return e&&e!==f(a.pathname)}(e)&&(window.history.pushState(r,t,e),c())},p}},{"in-window":2,"query-string":6,"router-params":7}],2:[function(e,r,t){r.exports="undefined"!=typeof window},{}],3:[function(e,r,t){r.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],4:[function(e,r,t){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;r.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,r){for(var t,a,u=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var f in t=Object(arguments[c]))o.call(t,f)&&(u[f]=t[f]);if(n){a=n(t);for(var p=0;p<a.length;p++)i.call(t,a[p])&&(u[a[p]]=t[a[p]])}}return u}},{}],5:[function(e,r,t){var n=e("isarray");r.exports=d,r.exports.parse=i,r.exports.compile=function(e,r){return u(i(e,r))},r.exports.tokensToFunction=u,r.exports.tokensToRegExp=l;var o=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function i(e,r){for(var t,n=[],i=0,a=0,u="",p=r&&r.delimiter||"/";null!=(t=o.exec(e));){var s=t[0],l=t[1],d=t.index;if(u+=e.slice(a,d),a=d+s.length,l)u+=l[1];else{var h=e[a],g=t[2],y=t[3],v=t[4],m=t[5],b=t[6],w=t[7];u&&(n.push(u),u="");var x=null!=g&&null!=h&&h!==g,j="+"===b||"*"===b,O="?"===b||"*"===b,E=t[2]||p,k=v||m;n.push({name:y||i++,prefix:g||"",delimiter:E,optional:O,repeat:j,partial:x,asterisk:!!w,pattern:k?f(k):w?".*":"[^"+c(E)+"]+?"})}}return a<e.length&&(u+=e.substr(a)),u&&n.push(u),n}function a(e){return encodeURI(e).replace(/[\/?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function u(e){for(var r=new Array(e.length),t=0;t<e.length;t++)"object"==typeof e[t]&&(r[t]=new RegExp("^(?:"+e[t].pattern+")$"));return function(t,o){for(var i="",u=t||{},c=(o||{}).pretty?a:encodeURIComponent,f=0;f<e.length;f++){var p=e[f];if("string"!=typeof p){var s,l=u[p.name];if(null==l){if(p.optional){p.partial&&(i+=p.prefix);continue}throw new TypeError('Expected "'+p.name+'" to be defined')}if(n(l)){if(!p.repeat)throw new TypeError('Expected "'+p.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(0===l.length){if(p.optional)continue;throw new TypeError('Expected "'+p.name+'" to not be empty')}for(var d=0;d<l.length;d++){if(s=c(l[d]),!r[f].test(s))throw new TypeError('Expected all "'+p.name+'" to match "'+p.pattern+'", but received `'+JSON.stringify(s)+"`");i+=(0===d?p.prefix:p.delimiter)+s}}else{if(s=p.asterisk?encodeURI(l).replace(/[?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}):c(l),!r[f].test(s))throw new TypeError('Expected "'+p.name+'" to match "'+p.pattern+'", but received "'+s+'"');i+=p.prefix+s}}else i+=p}return i}}function c(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function f(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function p(e,r){return e.keys=r,e}function s(e){return e.sensitive?"":"i"}function l(e,r,t){n(r)||(t=r||t,r=[]);for(var o=(t=t||{}).strict,i=!1!==t.end,a="",u=0;u<e.length;u++){var f=e[u];if("string"==typeof f)a+=c(f);else{var l=c(f.prefix),d="(?:"+f.pattern+")";r.push(f),f.repeat&&(d+="(?:"+l+d+")*"),a+=d=f.optional?f.partial?l+"("+d+")?":"(?:"+l+"("+d+"))?":l+"("+d+")"}}var h=c(t.delimiter||"/"),g=a.slice(-h.length)===h;return o||(a=(g?a.slice(0,-h.length):a)+"(?:"+h+"(?=$))?"),a+=i?"$":o&&g?"":"(?="+h+"|$)",p(new RegExp("^"+a,s(t)),r)}function d(e,r,t){return n(r)||(t=r||t,r=[]),t=t||{},e instanceof RegExp?function(e,r){var t=e.source.match(/\((?!\?)/g);if(t)for(var n=0;n<t.length;n++)r.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return p(e,r)}(e,r):n(e)?function(e,r,t){for(var n=[],o=0;o<e.length;o++)n.push(d(e[o],r,t).source);return p(new RegExp("(?:"+n.join("|")+")",s(t)),r)}(e,r,t):function(e,r,t){return l(i(e,t),r,t)}(e,r,t)}},{isarray:3}],6:[function(e,r,t){"use strict";var n=e("strict-uri-encode"),o=e("object-assign");function i(e,r){return r.encode?r.strict?n(e):encodeURIComponent(e):e}t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e,r){var t=function(e){var r;switch(e.arrayFormat){case"index":return function(e,t,n){r=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),r?(void 0===n[e]&&(n[e]={}),n[e][r[1]]=t):n[e]=t};case"bracket":return function(e,t,n){r=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),r?void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=[t]:n[e]=t};default:return function(e,r,t){void 0!==t[e]?t[e]=[].concat(t[e],r):t[e]=r}}}(r=o({arrayFormat:"none"},r)),n=Object.create(null);return"string"!=typeof e?n:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var r=e.replace(/\+/g," ").split("="),o=r.shift(),i=r.length>0?r.join("="):void 0;i=void 0===i?null:decodeURIComponent(i),t(decodeURIComponent(o),i,n)}),Object.keys(n).sort().reduce(function(e,r){var t=n[r];return Boolean(t)&&"object"==typeof t&&!Array.isArray(t)?e[r]=function e(r){return Array.isArray(r)?r.sort():"object"==typeof r?e(Object.keys(r)).sort(function(e,r){return Number(e)-Number(r)}).map(function(e){return r[e]}):r}(t):e[r]=t,e},Object.create(null))):n},t.stringify=function(e,r){var t=function(e){switch(e.arrayFormat){case"index":return function(r,t,n){return null===t?[i(r,e),"[",n,"]"].join(""):[i(r,e),"[",i(n,e),"]=",i(t,e)].join("")};case"bracket":return function(r,t){return null===t?i(r,e):[i(r,e),"[]=",i(t,e)].join("")};default:return function(r,t){return null===t?i(r,e):[i(r,e),"=",i(t,e)].join("")}}}(r=o({encode:!0,strict:!0,arrayFormat:"none"},r));return e?Object.keys(e).sort().map(function(n){var o=e[n];if(void 0===o)return"";if(null===o)return i(n,r);if(Array.isArray(o)){var a=[];return o.slice().forEach(function(e){void 0!==e&&a.push(t(n,e,a.length))}),a.join("&")}return i(n,r)+"="+i(o,r)}).filter(function(e){return e.length>0}).join("&"):""}},{"object-assign":4,"strict-uri-encode":8}],7:[function(e,r,t){var n=e("path-to-regexp");r.exports=function(e){var r=[],t=n(e,r);return!!r.length&&function(e){var n={},o=t.exec(e);if(o)return n.path=o.shift(),o.forEach(function(e,t){var o=r[t].name,i=function(e){if("string"!=typeof e||0===e.length)return e;try{return decodeURIComponent(e)}catch(r){throw r instanceof URIError&&(r.message="Failed to decode param '"+e+"'"),r}}(e);i&&(n[o]=i)}),n}}},{"path-to-regexp":5}],8:[function(e,r,t){"use strict";r.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},{}]},{},[1])(1)});