UNPKG

univ-conv

Version:

The universal binary and text converter

2 lines 10.8 kB
/*! For license information please see 760.univ-conv.js.LICENSE.txt */ (self.webpackChunkuniv_conv=self.webpackChunkuniv_conv||[]).push([[760],{350:t=>{"use strict";function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,s,n,o){s=s||"&",n=n||"=";var h={};if("string"!=typeof t||0===t.length)return h;var r=/\+/g;t=t.split(s);var a=1e3;o&&"number"==typeof o.maxKeys&&(a=o.maxKeys);var i=t.length;a>0&&i>a&&(i=a);for(var c=0;c<i;++c){var u,l,p,f,m=t[c].replace(r,"%20"),v=m.indexOf(n);v>=0?(u=m.substr(0,v),l=m.substr(v+1)):(u=m,l=""),p=decodeURIComponent(u),f=decodeURIComponent(l),e(h,p)?Array.isArray(h[p])?h[p].push(f):h[p]=[h[p],f]:h[p]=f}return h}},104:t=>{"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,s,n,o){return s=s||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(o){var h=encodeURIComponent(e(o))+n;return Array.isArray(t[o])?t[o].map((function(t){return h+encodeURIComponent(e(t))})).join(s):h+encodeURIComponent(e(t[o]))})).join(s):o?encodeURIComponent(e(o))+n+encodeURIComponent(e(t)):""}},966:(t,e,s)=>{"use strict";e.decode=e.parse=s(350),e.encode=e.stringify=s(104)},884:function(t,e,s){var n;t=s.nmd(t),function(o){e&&e.nodeType,t&&t.nodeType;var h="object"==typeof s.g&&s.g;h.global!==h&&h.window!==h&&h.self;var r,a=2147483647,i=36,c=/^xn--/,u=/[^\x20-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,m=String.fromCharCode;function v(t){throw RangeError(p[t])}function d(t,e){for(var s=t.length,n=[];s--;)n[s]=e(t[s]);return n}function g(t,e){var s=t.split("@"),n="";return s.length>1&&(n=s[0]+"@",t=s[1]),n+d((t=t.replace(l,".")).split("."),e).join(".")}function y(t){for(var e,s,n=[],o=0,h=t.length;o<h;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<h?56320==(64512&(s=t.charCodeAt(o++)))?n.push(((1023&e)<<10)+(1023&s)+65536):(n.push(e),o--):n.push(e);return n}function b(t){return d(t,(function(t){var e="";return t>65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+m(t)})).join("")}function j(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function x(t,e,s){var n=0;for(t=s?f(t/700):t>>1,t+=f(t/e);t>455;n+=i)t=f(t/35);return f(n+36*t/(t+38))}function C(t){var e,s,n,o,h,r,c,u,l,p,m,d=[],g=t.length,y=0,j=128,C=72;for((s=t.lastIndexOf("-"))<0&&(s=0),n=0;n<s;++n)t.charCodeAt(n)>=128&&v("not-basic"),d.push(t.charCodeAt(n));for(o=s>0?s+1:0;o<g;){for(h=y,r=1,c=i;o>=g&&v("invalid-input"),((u=(m=t.charCodeAt(o++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:i)>=i||u>f((a-y)/r))&&v("overflow"),y+=u*r,!(u<(l=c<=C?1:c>=C+26?26:c-C));c+=i)r>f(a/(p=i-l))&&v("overflow"),r*=p;C=x(y-h,e=d.length+1,0==h),f(y/e)>a-j&&v("overflow"),j+=f(y/e),y%=e,d.splice(y++,0,j)}return b(d)}function w(t){var e,s,n,o,h,r,c,u,l,p,d,g,b,C,w,O=[];for(g=(t=y(t)).length,e=128,s=0,h=72,r=0;r<g;++r)(d=t[r])<128&&O.push(m(d));for(n=o=O.length,o&&O.push("-");n<g;){for(c=a,r=0;r<g;++r)(d=t[r])>=e&&d<c&&(c=d);for(c-e>f((a-s)/(b=n+1))&&v("overflow"),s+=(c-e)*b,e=c,r=0;r<g;++r)if((d=t[r])<e&&++s>a&&v("overflow"),d==e){for(u=s,l=i;!(u<(p=l<=h?1:l>=h+26?26:l-h));l+=i)w=u-p,C=i-p,O.push(m(j(p+w%C,0))),u=f(w/C);O.push(m(j(u,0))),h=x(s,b,n==o),s=0,++n}++s,++e}return O.join("")}r={version:"1.3.2",ucs2:{decode:y,encode:b},decode:C,encode:w,toASCII:function(t){return g(t,(function(t){return u.test(t)?"xn--"+w(t):t}))},toUnicode:function(t){return g(t,(function(t){return c.test(t)?C(t.slice(4).toLowerCase()):t}))}},void 0===(n=function(){return r}.call(e,s,e,t))||(t.exports=n)}()},760:(t,e,s)=>{var n=s(884);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=g,e.resolve=function(t,e){return g(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?g(t,!1,!0).resolveObject(e):e},e.format=function(t){return y(t)&&(t=g(t)),t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var h=/^([a-z0-9.+-]+:)/i,r=/:[0-9]*$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),i=["'"].concat(a),c=["%","/","?",";","#"].concat(i),u=["/","?","#"],l=/^[a-z0-9A-Z_-]{0,63}$/,p=/^([a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},d=s(966);function g(t,e,s){if(t&&b(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,s),n}function y(t){return"string"==typeof t}function b(t){return"object"==typeof t&&null!==t}function j(t){return null===t}o.prototype.parse=function(t,e,s){if(!y(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t;o=o.trim();var r=h.exec(o);if(r){var a=(r=r[0]).toLowerCase();this.protocol=a,o=o.substr(r.length)}if(s||r||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var g="//"===o.substr(0,2);!g||r&&m[r]||(o=o.substr(2),this.slashes=!0)}if(!m[r]&&(g||r&&!v[r])){for(var b,j,x=-1,C=0;C<u.length;C++)-1!==(w=o.indexOf(u[C]))&&(-1===x||w<x)&&(x=w);for(-1!==(j=-1===x?o.lastIndexOf("@"):o.lastIndexOf("@",x))&&(b=o.slice(0,j),o=o.slice(j+1),this.auth=decodeURIComponent(b)),x=-1,C=0;C<c.length;C++){var w;-1!==(w=o.indexOf(c[C]))&&(-1===x||w<x)&&(x=w)}-1===x&&(x=o.length),this.host=o.slice(0,x),o=o.slice(x),this.parseHost(),this.hostname=this.hostname||"";var O="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!O)for(var A=this.hostname.split(/\./),I=(C=0,A.length);C<I;C++){var q=A[C];if(q&&!q.match(l)){for(var U="",R=0,k=q.length;R<k;R++)q.charCodeAt(R)>127?U+="x":U+=q[R];if(!U.match(l)){var E=A.slice(0,C),F=A.slice(C+1),_=q.match(p);_&&(E.push(_[1]),F.unshift(_[2])),F.length&&(o="/"+F.join(".")+o),this.hostname=E.join(".");break}}}if(this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),!O){var z=this.hostname.split("."),L=[];for(C=0;C<z.length;++C){var T=z[C];L.push(T.match(/[^A-Za-z0-9_-]/)?"xn--"+n.encode(T):T)}this.hostname=L.join(".")}var Z=this.port?":"+this.port:"",$=this.hostname||"";this.host=$+Z,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!f[a])for(C=0,I=i.length;C<I;C++){var H=i[C],K=encodeURIComponent(H);K===H&&(K=escape(H)),o=o.split(H).join(K)}var P=o.indexOf("#");-1!==P&&(this.hash=o.substr(P),o=o.slice(0,P));var S=o.indexOf("?");return-1!==S?(this.search=o.substr(S),this.query=o.substr(S+1),e&&(this.query=d.parse(this.query)),o=o.slice(0,S)):e&&(this.search="",this.query={}),o&&(this.pathname=o),v[a]&&this.hostname&&!this.pathname&&(this.pathname="/"),(this.pathname||this.search)&&(Z=this.pathname||"",T=this.search||"",this.path=Z+T),this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",s=this.pathname||"",n=this.hash||"",o=!1,h="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&b(this.query)&&Object.keys(this.query).length&&(h=d.stringify(this.query));var r=this.search||h&&"?"+h||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||v[e])&&!1!==o?(o="//"+(o||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),r&&"?"!==r.charAt(0)&&(r="?"+r),e+o+(s=s.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(r=r.replace("#","%23"))+n},o.prototype.resolve=function(t){return this.resolveObject(g(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(y(t)){var e=new o;e.parse(t,!1,!0),t=e}var s=new o;if(Object.keys(this).forEach((function(t){s[t]=this[t]}),this),s.hash=t.hash,""===t.href)return s.href=s.format(),s;if(t.slashes&&!t.protocol)return Object.keys(t).forEach((function(e){"protocol"!==e&&(s[e]=t[e])})),v[s.protocol]&&s.hostname&&!s.pathname&&(s.path=s.pathname="/"),s.href=s.format(),s;if(t.protocol&&t.protocol!==s.protocol){if(!v[t.protocol])return Object.keys(t).forEach((function(e){s[e]=t[e]})),s.href=s.format(),s;if(s.protocol=t.protocol,t.host||m[t.protocol])s.pathname=t.pathname;else{for(var n=(t.pathname||"").split("/");n.length&&!(t.host=n.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),s.pathname=n.join("/")}if(s.search=t.search,s.query=t.query,s.host=t.host||"",s.auth=t.auth,s.hostname=t.hostname||t.host,s.port=t.port,s.pathname||s.search){var h=s.pathname||"",r=s.search||"";s.path=h+r}return s.slashes=s.slashes||t.slashes,s.href=s.format(),s}var a=s.pathname&&"/"===s.pathname.charAt(0),i=t.host||t.pathname&&"/"===t.pathname.charAt(0),c=i||a||s.host&&t.pathname,u=c,l=s.pathname&&s.pathname.split("/")||[],p=(n=t.pathname&&t.pathname.split("/")||[],s.protocol&&!v[s.protocol]);if(p&&(s.hostname="",s.port=null,s.host&&(""===l[0]?l[0]=s.host:l.unshift(s.host)),s.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===n[0]?n[0]=t.host:n.unshift(t.host)),t.host=null),c=c&&(""===n[0]||""===l[0])),i)s.host=t.host||""===t.host?t.host:s.host,s.hostname=t.hostname||""===t.hostname?t.hostname:s.hostname,s.search=t.search,s.query=t.query,l=n;else if(n.length)l||(l=[]),l.pop(),l=l.concat(n),s.search=t.search,s.query=t.query;else if(null!=t.search)return p&&(s.hostname=s.host=l.shift(),(x=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=x.shift(),s.host=s.hostname=x.shift())),s.search=t.search,s.query=t.query,j(s.pathname)&&j(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s;if(!l.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var f=l.slice(-1)[0],d=(s.host||t.host)&&("."===f||".."===f)||""===f,g=0,b=l.length;b>=0;b--)"."==(f=l[b])?l.splice(b,1):".."===f?(l.splice(b,1),g++):g&&(l.splice(b,1),g--);if(!c&&!u)for(;g--;g)l.unshift("..");!c||""===l[0]||l[0]&&"/"===l[0].charAt(0)||l.unshift(""),d&&"/"!==l.join("/").substr(-1)&&l.push("");var x,C=""===l[0]||l[0]&&"/"===l[0].charAt(0);return p&&(s.hostname=s.host=C?"":l.length?l.shift():"",(x=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=x.shift(),s.host=s.hostname=x.shift())),(c=c||s.host&&l.length)&&!C&&l.unshift(""),l.length?s.pathname=l.join("/"):(s.pathname=null,s.path=null),j(s.pathname)&&j(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.auth=t.auth||s.auth,s.slashes=s.slashes||t.slashes,s.href=s.format(),s},o.prototype.parseHost=function(){var t=this.host,e=r.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}}}]);