-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser.js
More file actions
3 lines (3 loc) · 9.36 KB
/
Copy pathbrowser.js
File metadata and controls
3 lines (3 loc) · 9.36 KB
1
2
3
// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
var e,r;e=this,r=function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null,r=Object.defineProperty;function t(e){return"number"==typeof e}function n(e){var r,t="";for(r=0;r<e;r++)t+="0";return t}function i(e,r,t){var i=!1,o=r-e.length;return o<0||(function(e){return"-"===e[0]}(e)&&(i=!0,e=e.substr(1)),e=t?e+n(o):n(o)+e,i&&(e="-"+e)),e}var o=String.prototype.toLowerCase,a=String.prototype.toUpperCase;function c(e){var r,n,c;switch(e.specifier){case"b":r=2;break;case"o":r=8;break;case"x":case"X":r=16;break;default:r=10}if(n=e.arg,c=parseInt(n,10),!isFinite(c)){if(!t(n))throw new Error("invalid integer. Value: "+n);c=0}return c<0&&("u"===e.specifier||10!==r)&&(c=4294967295+c+1),c<0?(n=(-c).toString(r),e.precision&&(n=i(n,e.precision,e.padRight)),n="-"+n):(n=c.toString(r),c||e.precision?e.precision&&(n=i(n,e.precision,e.padRight)):n="",e.sign&&(n=e.sign+n)),16===r&&(e.alternate&&(n="0x"+n),n=e.specifier===a.call(e.specifier)?a.call(n):o.call(n)),8===r&&e.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var u=Math.abs,s=String.prototype.toLowerCase,l=String.prototype.toUpperCase,f=String.prototype.replace,p=/e\+(\d)$/,g=/e-(\d)$/,d=/^(\d+)$/,h=/^(\d+)e/,y=/\.0$/,b=/\.0*e/,w=/(\..*[^0])0*e/;function v(e,r){var t,n;switch(r.specifier){case"e":case"E":n=e.toExponential(r.precision);break;case"f":case"F":n=e.toFixed(r.precision);break;case"g":case"G":u(e)<1e-4?((t=r.precision)>0&&(t-=1),n=e.toExponential(t)):n=e.toPrecision(r.precision),r.alternate||(n=f.call(n,w,"$1e"),n=f.call(n,b,"e"),n=f.call(n,y,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=f.call(n,p,"e+0$1"),n=f.call(n,g,"e-0$1"),r.alternate&&(n=f.call(n,d,"$1."),n=f.call(n,h,"$1.e")),e>=0&&r.sign&&(n=r.sign+n),n=r.specifier===l.call(r.specifier)?l.call(n):s.call(n)}function m(e){var r,t="";for(r=0;r<e;r++)t+=" ";return t}var E=String.fromCharCode,j=Array.isArray;function _(e){return e!=e}function x(e){var r={};return r.specifier=e.specifier,r.precision=void 0===e.precision?1:e.precision,r.width=e.width,r.flags=e.flags||"",r.mapping=e.mapping,r}function S(e){var r,n,o,a,u,s,l,f,p,g,d,h,y,b;if(!j(e))throw new TypeError("invalid argument. First argument must be an array. Value: `"+e+"`.");for(s="",l=1,p=0;p<e.length;p++)if("string"==typeof(o=e[p]))s+=o;else{if(r=void 0!==o.precision,!(o=x(o)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+p+"`. Value: `"+o+"`.");for(o.mapping&&(l=o.mapping),n=o.flags,g=0;g<n.length;g++)switch(a=n.charAt(g)){case" ":o.sign=" ";break;case"+":o.sign="+";break;case"-":o.padRight=!0,o.padZeros=!1;break;case"0":o.padZeros=n.indexOf("-")<0;break;case"#":o.alternate=!0;break;default:throw new Error("invalid flag: "+a)}if("*"===o.width){if(o.width=parseInt(arguments[l],10),l+=1,_(o.width))throw new TypeError("the argument for * width at position "+l+" is not a number. Value: `"+o.width+"`.");o.width<0&&(o.padRight=!0,o.width=-o.width)}if(r&&"*"===o.precision){if(o.precision=parseInt(arguments[l],10),l+=1,_(o.precision))throw new TypeError("the argument for * precision at position "+l+" is not a number. Value: `"+o.precision+"`.");o.precision<0&&(o.precision=1,r=!1)}switch(o.arg=arguments[l],o.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":r&&(o.padZeros=!1),o.arg=c(o);break;case"s":o.maxWidth=r?o.precision:-1,o.arg=String(o.arg);break;case"c":if(!_(o.arg)){if((u=parseInt(o.arg,10))<0||u>127)throw new Error("invalid character code. Value: "+o.arg);o.arg=_(u)?String(o.arg):E(u)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(r||(o.precision=6),f=parseFloat(o.arg),!isFinite(f)){if(!t(o.arg))throw new Error("invalid floating-point number. Value: "+s);f=o.arg,o.padZeros=!1}o.arg=v(f,o);break;default:throw new Error("invalid specifier: "+o.specifier)}o.maxWidth>=0&&o.arg.length>o.maxWidth&&(o.arg=o.arg.substring(0,o.maxWidth)),o.padZeros?o.arg=i(o.arg,o.width||o.precision,o.padRight):o.width&&(o.arg=(d=o.arg,h=o.width,y=o.padRight,b=void 0,(b=h-d.length)<0?d:d=y?d+m(b):m(b)+d)),s+=o.arg||"",l+=1}return s}var T=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function k(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function A(e){var r,t,n,i;for(t=[],i=0,n=T.exec(e);n;)(r=e.slice(i,T.lastIndex-n[0].length)).length&&t.push(r),"%"===n[6]?t.push("%"):t.push(k(n)),i=T.lastIndex,n=T.exec(e);return(r=e.slice(i)).length&&t.push(r),t}function V(e){var r,t;if("string"!=typeof e)throw new TypeError(V("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[A(e)],t=1;t<arguments.length;t++)r.push(arguments[t]);return S.apply(null,r)}var O,$=Object.prototype,P=$.toString,R=$.__defineGetter__,F=$.__defineSetter__,C=$.__lookupGetter__,I=$.__lookupSetter__;O=function(){try{return e({},"x",{}),!0}catch(e){return!1}}()?r:function(e,r,t){var n,i,o,a;if("object"!=typeof e||null===e||"[object Array]"===P.call(e))throw new TypeError(V("invalid argument. First argument must be an object. Value: `%s`.",e));if("object"!=typeof t||null===t||"[object Array]"===P.call(t))throw new TypeError(V("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(C.call(e,r)||I.call(e,r)?(n=e.__proto__,e.__proto__=$,delete e[r],e[r]=t.value,e.__proto__=n):e[r]=t.value),o="get"in t,a="set"in t,i&&(o||a))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&R&&R.call(e,r,t.get),a&&F&&F.call(e,r,t.set),e};var B=O;function L(e,r,t){B(e,r,{configurable:!1,enumerable:!1,writable:!1,value:t})}function Z(e){return"string"==typeof e}var G="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function U(){return G&&"symbol"==typeof Symbol.toStringTag}var M=Object.prototype.toString,W=Object.prototype.hasOwnProperty,J="function"==typeof Symbol?Symbol:void 0,X="function"==typeof J?J.toStringTag:"",z=U()?function(e){var r,t,n,i,o;if(null==e)return M.call(e);t=e[X],o=X,r=null!=(i=e)&&W.call(i,o);try{e[X]=void 0}catch(r){return M.call(e)}return n=M.call(e),r?e[X]=t:delete e[X],n}:function(e){return M.call(e)},N=String.prototype.valueOf,q=U();function D(e){return"object"==typeof e&&(e instanceof String||(q?function(e){try{return N.call(e),!0}catch(e){return!1}}(e):"[object String]"===z(e)))}function H(e){return Z(e)||D(e)}L(H,"isPrimitive",Z),L(H,"isObject",D);var K=/[-\/\\^$*+?.()|[\]{}]/g,Q=/./;function Y(e){return"boolean"==typeof e}var ee=Boolean,re=Boolean.prototype.toString,te=U();function ne(e){return"object"==typeof e&&(e instanceof ee||(te?function(e){try{return re.call(e),!0}catch(e){return!1}}(e):"[object Boolean]"===z(e)))}function ie(e){return Y(e)||ne(e)}L(ie,"isPrimitive",Y),L(ie,"isObject",ne);var oe="object"==typeof self?self:null,ae="object"==typeof window?window:null,ce="object"==typeof globalThis?globalThis:null,ue=function(e){if(arguments.length){if(!Y(e))throw new TypeError(V("invalid argument. Must provide a boolean. Value: `%s`.",e));if(e)return new Function("return this;")()}if(ce)return ce;if(oe)return oe;if(ae)return ae;throw new Error("unexpected error. Unable to resolve global object.")}(),se=ue.document&&ue.document.childNodes,le=Int8Array;function fe(){return/^\s*function\s*([^(]*)/i}var pe=/^\s*function\s*([^(]*)/i;L(fe,"REGEXP",pe);var ge=Array.isArray?Array.isArray:function(e){return"[object Array]"===z(e)};function de(e){return null!==e&&"object"==typeof e}function he(e){var r,t,n,i;if(("Object"===(t=z(e).slice(8,-1))||"Error"===t)&&e.constructor){if("string"==typeof(n=e.constructor).name)return n.name;if(r=pe.exec(n.toString()))return r[1]}return de(i=e)&&(i._isBuffer||i.constructor&&"function"==typeof i.constructor.isBuffer&&i.constructor.isBuffer(i))?"Buffer":t}L(de,"isObjectLikeArray",function(e){if("function"!=typeof e)throw new TypeError(V("invalid argument. Must provide a function. Value: `%s`.",e));return function(r){var t,n;if(!ge(r))return!1;if(0===(t=r.length))return!1;for(n=0;n<t;n++)if(!1===e(r[n]))return!1;return!0}}(de));var ye="function"==typeof Q||"object"==typeof le||"function"==typeof se?function(e){return he(e).toLowerCase()}:function(e){var r;return null===e?"null":"object"==(r=typeof e)?he(e).toLowerCase():r},be=RegExp.prototype.exec,we=U();function ve(e){return"object"==typeof e&&(e instanceof RegExp||(we?function(e){try{return be.call(e),!0}catch(e){return!1}}(e):"[object RegExp]"===z(e)))}function me(){var e,r=arguments,t="https://stdlib.io/e/"+r[0]+"?";for(e=1;e<r.length;e++)t+="&arg[]="+encodeURIComponent(r[e]);return t}return function(e,r,t){if(!Z(e))throw new TypeError(me("1PJ3F",e));if(Z(r))r=new RegExp(function(e){var r,t;if(!Z(e))throw new TypeError(V("invalid argument. Must provide a regular expression string. Value: `%s`.",e));if("/"===e[0])for(t=e.length-1;t>=0&&"/"!==e[t];t--);return void 0===t||t<=0?e.replace(K,"\\$&"):(r=(r=e.substring(1,t)).replace(K,"\\$&"),e=e[0]+r+e.substring(t))}(r),"g");else if(!ve(r))throw new TypeError(me("1PJAT",r));if(!Z(t)&&"function"!==ye(t))throw new TypeError(me("1PJAU",t));return function(e,r,t){return e.replace(r,t)}(e,r,t)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).replace=r();
//# sourceMappingURL=browser.js.map