tenebrous-dicebot/api/node_modules/url-parse/dist/url-parse.min.js

1 line
5.4 KiB
JavaScript

!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).URLParse=e()}(function(){return function n(r,s,a){function i(t,e){if(!s[t]){if(!r[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(u)return u(t,!0);throw(o=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",o}o=s[t]={exports:{}},r[t][0].call(o.exports,function(e){return i(r[t][1][e]||e)},o,o.exports,n,r,s,a)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e<a.length;e++)i(a[e]);return i}({1:[function(e,n,t){!function(a){!function(){"use strict";var f=e("requires-port"),h=e("querystringify"),r=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,t=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,o=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function d(e){return(e||"").toString().replace(o,"")}var y=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],s={hash:1,query:1};function m(e){var t,o="undefined"!=typeof window?window:void 0!==a?a:"undefined"!=typeof self?self:{},o=o.location||{},n={},o=typeof(e=e||o);if("blob:"===e.protocol)n=new w(unescape(e.pathname),{});else if("string"==o)for(t in n=new w(e,{}),s)delete n[t];else if("object"==o){for(t in e)t in s||(n[t]=e[t]);void 0===n.slashes&&(n.slashes=r.test(e.href))}return n}function g(e){e=d(e);e=t.exec(e);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!(e[2]&&2<=e[2].length),rest:e[2]&&1===e[2].length?"/"+e[3]:e[3]}}function w(e,t,o){if(e=d(e),!(this instanceof w))return new w(e,t,o);var n,r,s,a,i,u=y.slice(),l=typeof t,c=this,p=0;for("object"!=l&&"string"!=l&&(o=t,t=null),o&&"function"!=typeof o&&(o=h.parse),t=m(t),n=!(l=g(e||"")).protocol&&!l.slashes,c.slashes=l.slashes||n&&t.slashes,c.protocol=l.protocol||t.protocol||"",e=l.rest,l.slashes||(u[3]=[/(.*)/,"pathname"]);p<u.length;p++)"function"!=typeof(s=u[p])?(r=s[0],i=s[1],r!=r?c[i]=e:"string"==typeof r?~(a=e.indexOf(r))&&(e="number"==typeof s[2]?(c[i]=e.slice(0,a),e.slice(a+s[2])):(c[i]=e.slice(a),e.slice(0,a))):(a=r.exec(e))&&(c[i]=a[1],e=e.slice(0,a.index)),c[i]=c[i]||n&&s[3]&&t[i]||"",s[4]&&(c[i]=c[i].toLowerCase())):e=s(e);o&&(c.query=o(c.query)),n&&t.slashes&&"/"!==c.pathname.charAt(0)&&(""!==c.pathname||""!==t.pathname)&&(c.pathname=function(e,t){if(""===e)return t;for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=o.length,e=o[n-1],r=!1,s=0;n--;)"."===o[n]?o.splice(n,1):".."===o[n]?(o.splice(n,1),s++):s&&(0===n&&(r=!0),o.splice(n,1),s--);return r&&o.unshift(""),"."!==e&&".."!==e||o.push(""),o.join("/")}(c.pathname,t.pathname)),"/"!==c.pathname.charAt(0)&&c.hostname&&(c.pathname="/"+c.pathname),f(c.port,c.protocol)||(c.host=c.hostname,c.port=""),c.username=c.password="",c.auth&&(s=c.auth.split(":"),c.username=s[0]||"",c.password=s[1]||""),c.origin=c.protocol&&c.host&&"file:"!==c.protocol?c.protocol+"//"+c.host:"null",c.href=c.toString()}w.prototype={set:function(e,t,o){var n,r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||h.parse)(t)),r[e]=t;break;case"port":r[e]=t,f(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":t?(n="pathname"===e?"/":"#",r[e]=t.charAt(0)!==n?n+t:t):r[e]=t;break;default:r[e]=t}for(var s=0;s<y.length;s++){var a=y[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=h.stringify);var t=this,o=t.protocol;return o&&":"!==o.charAt(o.length-1)&&(o+=":"),o+=t.slashes?"//":"",t.username&&(o+=t.username,t.password&&(o+=":"+t.password),o+="@"),o+=t.host+t.pathname,(e="object"==typeof t.query?e(t.query):t.query)&&(o+="?"!==e.charAt(0)?"?"+e:e),t.hash&&(o+=t.hash),o}},w.extractProtocol=g,w.location=m,w.trimLeft=d,w.qs=h,n.exports=w}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:2,"requires-port":3}],2:[function(e,t,o){"use strict";var s=Object.prototype.hasOwnProperty;function a(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}o.stringify=function(e,t){var o,n,r=[];for(n in"string"!=typeof(t=t||"")&&(t="?"),e)s.call(e,n)&&((o=e[n])||null!=o&&!isNaN(o)||(o=""),n=i(n),o=i(o),null!==n&&null!==o&&r.push(n+"="+o));return r.length?t+r.join("&"):""},o.parse=function(e){for(var t=/([^=?#&]+)=?([^&]*)/g,o={};r=t.exec(e);){var n=a(r[1]),r=a(r[2]);null===n||null===r||n in o||(o[n]=r)}return o}},{}],3:[function(e,t,o){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}]},{},[1])(1)});