"use strict";var undef,has=Object.prototype.hasOwnProperty;function decode(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function encode(e){try{return encodeURIComponent(e)}catch(e){return null}}function querystring(e){for(var n,r=/([^=?#&]+)=?([^&]*)/g,t={};n=r.exec(e);){var o=decode(n[1]),u=decode(n[2]);null===o||null===u||o in t||(t[o]=u)}return t}function querystringify(e,n){n=n||"";var r,t,o=[];for(t in"string"!=typeof n&&(n="?"),e)if(has.call(e,t)){if((r=e[t])||null!==r&&r!==undef&&!isNaN(r)||(r=""),t=encode(t),r=encode(r),null===t||null===r)continue;o.push(t+"="+r)}return o.length?n+o.join("&"):""}exports.stringify=querystringify,exports.parse=querystring;