-
Notifications
You must be signed in to change notification settings - Fork 18
/
imgix-js-core.umd.js
1 lines (1 loc) · 19.2 KB
/
imgix-js-core.umd.js
1
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ImgixClient=e()}(this,function(){"use strict";function e(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function s(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?e(Object(o),!0).forEach(function(t){var e,r;e=n,r=o[t=t],(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||r(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||r(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){var r;if(t)return"string"==typeof t?o(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);if("object"!=typeof(r=r.call(t,e||"default")))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}var k="3.7.2",z="function"==typeof atob,t="function"==typeof btoa,a="function"==typeof Buffer;const u="function"==typeof TextDecoder?new TextDecoder:void 0,c="function"==typeof TextEncoder?new TextEncoder:void 0;const d=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),y=(t=>{let r={};return t.forEach((t,e)=>r[t]=e),r})(d),F=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,p=String.fromCharCode.bind(String),g="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(t,e=t=>t)=>new Uint8Array(Array.prototype.slice.call(t,0).map(e)),b=t=>t.replace(/=/g,"").replace(/[+\/]/g,t=>"+"==t?"-":"_"),v=t=>t.replace(/[^A-Za-z0-9\+\/]/g,"");var m=e=>{let r,n,o,i,a="";var t=e.length%3;for(let t=0;t<e.length;){if(255<(n=e.charCodeAt(t++))||255<(o=e.charCodeAt(t++))||255<(i=e.charCodeAt(t++)))throw new TypeError("invalid character found");r=n<<16|o<<8|i,a+=d[r>>18&63]+d[r>>12&63]+d[r>>6&63]+d[63&r]}return t?a.slice(0,t-3)+"===".substring(t):a};const w=t?t=>btoa(t):a?t=>Buffer.from(t,"binary").toString("base64"):m,A=a?t=>Buffer.from(t).toString("base64"):r=>{var n=[];for(let t=0,e=r.length;t<e;t+=4096)n.push(p.apply(null,r.subarray(t,t+4096)));return w(n.join(""))},S=(t,e=!1)=>e?b(A(t)):A(t),D=t=>{var e;return t.length<2?(e=t.charCodeAt(0))<128?t:e<2048?p(192|e>>>6)+p(128|63&e):p(224|e>>>12&15)+p(128|e>>>6&63)+p(128|63&e):(e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320),p(240|e>>>18&7)+p(128|e>>>12&63)+p(128|e>>>6&63)+p(128|63&e))},W=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,x=t=>t.replace(W,D),T=a?t=>Buffer.from(t,"utf8").toString("base64"):c?t=>A(c.encode(t)):t=>w(x(t)),P=(t,e=!1)=>e?b(T(t)):T(t);t=t=>P(t,!0);const H=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,M=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return p(55296+(e>>>10))+p(56320+(1023&e));case 3:return p((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return p((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},U=t=>t.replace(H,M);var j=e=>{if(e=e.replace(/\s+/g,""),!F.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let r,n="",o,i;for(let t=0;t<e.length;)r=y[e.charAt(t++)]<<18|y[e.charAt(t++)]<<12|(o=y[e.charAt(t++)])<<6|(i=y[e.charAt(t++)]),n+=64===o?p(r>>16&255):64===i?p(r>>16&255,r>>8&255):p(r>>16&255,r>>8&255,255&r);return n};const B=z?t=>atob(v(t)):a?t=>Buffer.from(t,"base64").toString("binary"):j,C=a?t=>g(Buffer.from(t,"base64")):t=>g(B(t),t=>t.charCodeAt(0)),R=t=>C(O(t)),Z=a?t=>Buffer.from(t,"base64").toString("utf8"):u?t=>u.decode(C(t)):t=>U(B(t)),O=t=>v(t.replace(/[-_]/g,t=>"-"==t?"+":"/")),_=t=>Z(O(t));function N(){var t=(t,e)=>Object.defineProperty(String.prototype,t,Q(e));t("fromBase64",function(){return _(this)}),t("toBase64",function(t){return P(this,t)}),t("toBase64URI",function(){return P(this,!0)}),t("toBase64URL",function(){return P(this,!0)}),t("toUint8Array",function(){return R(this)})}function q(){var t=(t,e)=>Object.defineProperty(Uint8Array.prototype,t,Q(e));t("toBase64",function(t){return S(this,t)}),t("toBase64URI",function(){return S(this,!0)}),t("toBase64URL",function(){return S(this,!0)})}const Q=t=>({value:t,enumerable:!1,writable:!0,configurable:!0});const V={version:k,VERSION:"3.7.2",atob:B,atobPolyfill:j,btoa:w,btoaPolyfill:m,fromBase64:_,toBase64:P,encode:P,encodeURI:t,encodeURL:t,utob:x,btou:U,decode:_,isValid:t=>{return"string"==typeof t&&(t=t.replace(/\s+/g,"").replace(/={0,2}$/,""),!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t))},fromUint8Array:S,toUint8Array:R,extendString:N,extendUint8Array:q,extendBuiltins:()=>{N(),q()}};function $(t,e){return t(e={exports:{}},e.exports),e.exports}function G(t){return null!=t&&(X(t)||"function"==typeof(e=t).readFloatLE&&"function"==typeof e.slice&&X(e.slice(0,0))||!!t._isBuffer);var e}var J=$(function(t){var i,r;i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&r.rotl(t,8)|4278255360&r.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=r.endian(t[e]);return t},randomBytes:function(t){for(var e=[];0<t;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],r=0;r<t.length;r+=3)for(var n=t[r]<<16|t[r+1]<<8|t[r+2],o=0;o<4;o++)8*r+6*o<=8*t.length?e.push(i.charAt(n>>>6*(3-o)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],r=0,n=0;r<t.length;n=++r%4)0!=n&&e.push((i.indexOf(t.charAt(r-1))&Math.pow(2,-2*n+8)-1)<<2*n|i.indexOf(t.charAt(r))>>>6-2*n);return e}},t.exports=r}),E={utf8:{stringToBytes:function(t){return E.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(E.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}},K=E;function X(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Y=$(function(t){function g(t,e){t.constructor==String?t=(e&&"binary"===e.encoding?w:v).stringToBytes(t):m(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||(t=t.toString());for(var r=b.bytesToWords(t),e=8*t.length,n=1732584193,o=-271733879,i=-1732584194,a=271733878,u=0;u<r.length;u++)r[u]=16711935&(r[u]<<8|r[u]>>>24)|4278255360&(r[u]<<24|r[u]>>>8);r[e>>>5]|=128<<e%32,r[14+(64+e>>>9<<4)]=e;for(var c=g._ff,s=g._gg,l=g._hh,f=g._ii,u=0;u<r.length;u+=16){var h=n,d=o,y=i,p=a,n=c(n,o,i,a,r[u+0],7,-680876936),a=c(a,n,o,i,r[u+1],12,-389564586),i=c(i,a,n,o,r[u+2],17,606105819),o=c(o,i,a,n,r[u+3],22,-1044525330);n=c(n,o,i,a,r[u+4],7,-176418897),a=c(a,n,o,i,r[u+5],12,1200080426),i=c(i,a,n,o,r[u+6],17,-1473231341),o=c(o,i,a,n,r[u+7],22,-45705983),n=c(n,o,i,a,r[u+8],7,1770035416),a=c(a,n,o,i,r[u+9],12,-1958414417),i=c(i,a,n,o,r[u+10],17,-42063),o=c(o,i,a,n,r[u+11],22,-1990404162),n=c(n,o,i,a,r[u+12],7,1804603682),a=c(a,n,o,i,r[u+13],12,-40341101),i=c(i,a,n,o,r[u+14],17,-1502002290),n=s(n,o=c(o,i,a,n,r[u+15],22,1236535329),i,a,r[u+1],5,-165796510),a=s(a,n,o,i,r[u+6],9,-1069501632),i=s(i,a,n,o,r[u+11],14,643717713),o=s(o,i,a,n,r[u+0],20,-373897302),n=s(n,o,i,a,r[u+5],5,-701558691),a=s(a,n,o,i,r[u+10],9,38016083),i=s(i,a,n,o,r[u+15],14,-660478335),o=s(o,i,a,n,r[u+4],20,-405537848),n=s(n,o,i,a,r[u+9],5,568446438),a=s(a,n,o,i,r[u+14],9,-1019803690),i=s(i,a,n,o,r[u+3],14,-187363961),o=s(o,i,a,n,r[u+8],20,1163531501),n=s(n,o,i,a,r[u+13],5,-1444681467),a=s(a,n,o,i,r[u+2],9,-51403784),i=s(i,a,n,o,r[u+7],14,1735328473),n=l(n,o=s(o,i,a,n,r[u+12],20,-1926607734),i,a,r[u+5],4,-378558),a=l(a,n,o,i,r[u+8],11,-2022574463),i=l(i,a,n,o,r[u+11],16,1839030562),o=l(o,i,a,n,r[u+14],23,-35309556),n=l(n,o,i,a,r[u+1],4,-1530992060),a=l(a,n,o,i,r[u+4],11,1272893353),i=l(i,a,n,o,r[u+7],16,-155497632),o=l(o,i,a,n,r[u+10],23,-1094730640),n=l(n,o,i,a,r[u+13],4,681279174),a=l(a,n,o,i,r[u+0],11,-358537222),i=l(i,a,n,o,r[u+3],16,-722521979),o=l(o,i,a,n,r[u+6],23,76029189),n=l(n,o,i,a,r[u+9],4,-640364487),a=l(a,n,o,i,r[u+12],11,-421815835),i=l(i,a,n,o,r[u+15],16,530742520),n=f(n,o=l(o,i,a,n,r[u+2],23,-995338651),i,a,r[u+0],6,-198630844),a=f(a,n,o,i,r[u+7],10,1126891415),i=f(i,a,n,o,r[u+14],15,-1416354905),o=f(o,i,a,n,r[u+5],21,-57434055),n=f(n,o,i,a,r[u+12],6,1700485571),a=f(a,n,o,i,r[u+3],10,-1894986606),i=f(i,a,n,o,r[u+10],15,-1051523),o=f(o,i,a,n,r[u+1],21,-2054922799),n=f(n,o,i,a,r[u+8],6,1873313359),a=f(a,n,o,i,r[u+15],10,-30611744),i=f(i,a,n,o,r[u+6],15,-1560198380),o=f(o,i,a,n,r[u+13],21,1309151649),n=f(n,o,i,a,r[u+4],6,-145523070),a=f(a,n,o,i,r[u+11],10,-1120210379),i=f(i,a,n,o,r[u+2],15,718787259),o=f(o,i,a,n,r[u+9],21,-343485551),n=n+h>>>0,o=o+d>>>0,i=i+y>>>0,a=a+p>>>0}return b.endian([n,o,i,a])}var b,v,m,w;b=J,v=K.utf8,m=G,w=K.bin,g._ff=function(t,e,r,n,o,i,a){t=t+(e&r|~e&n)+(o>>>0)+a;return(t<<i|t>>>32-i)+e},g._gg=function(t,e,r,n,o,i,a){t=t+(e&n|r&~n)+(o>>>0)+a;return(t<<i|t>>>32-i)+e},g._hh=function(t,e,r,n,o,i,a){t=t+(e^r^n)+(o>>>0)+a;return(t<<i|t>>>32-i)+e},g._ii=function(t,e,r,n,o,i,a){t=t+(r^(e|~n))+(o>>>0)+a;return(t<<i|t>>>32-i)+e},g._blocksize=16,g._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);t=b.wordsToBytes(g(t,e));return e&&e.asBytes?t:e&&e.asString?w.bytesToString(t):b.bytesToHex(t)}});const tt=/\+/g;function et(t=""){try{return decodeURIComponent(""+t)}catch{return""+t}}function rt(t=""){var e={};for(const o of(t="?"===t[0]?t.slice(1):t).split("&")){var r,n=o.match(/([^=]+)=?(.*)/)||[];n.length<2||"__proto__"!==(r=et(n[1]))&&"constructor"!==r&&(n=et((n[2]||"").replace(tt," ")),void 0!==e[r]?Array.isArray(e[r])?e[r].push(n):e[r]=[e[r],n]:e[r]=n)}return e}const nt=/^\w{2,}:(\/\/)?/,ot=/^\/\/[^/]+/;function it(t,e=!1){return nt.test(t)||e&&ot.test(t)}function at(t){return rt(I(t).search)}function I(t="",e){var r,n,o,i,a,u;return it(t,!0)?([r="",n,o=""]=(t.replace(/\\/g,"/").match(/([^/:]+:)?\/\/([^/@]+@)?(.*)/)||[]).splice(1),[o="",i=""]=(o.match(/([^#/?]*)(.*)?/)||[]).splice(1),{pathname:i,search:a,hash:u}=ut(i.replace(/\/(?=[A-Za-z]:)/,"")),{protocol:r,auth:n?n.slice(0,Math.max(0,n.length-1)):"",host:o,pathname:i,search:a,hash:u}):e?I(e+t):ut(t)}function ut(t=""){var[t="",e="",r=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:e,hash:r}}var ct=/^(?:[a-z\d\-_]{1,62}\.){0,125}(?:[a-z\d](?:\-(?=\-*[a-z\d])|[a-z]|\d){0,62}\.)[a-z\d]{1,63}$/i,st={1:75,2:50,3:35,4:23,5:20},lt=[1,2,3,4,5],ft={domain:null,useHTTPS:!0,includeLibraryParam:!0,urlPrefix:"https://",secureURLToken:null};function L(t){var e=t.url,e=void 0===e?"":e,t=t.useHttps,t=void 0!==t&&t?"https://":"http://";return it(e,!0)?I(e):L({url:t+e})}function ht(t,e){if(!Number.isInteger(t)||!Number.isInteger(e)||t<=0||e<=0||e<t)throw new Error("The min and max srcset widths can only be passed positive Number values, and min must be less than max. Found min: ".concat(t," and max: ").concat(e,"."))}function dt(t){if("number"!=typeof t||t<.01)throw new Error("The srcset widthTolerance must be a number greater than or equal to 0.01")}return function(){function c(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=this,r=c;if(!(e instanceof r))throw new TypeError("Cannot call a class as a function");if(this.settings=s(s({},ft),t),this.targetWidthsCache={},"string"!=typeof this.settings.domain)throw new Error("ImgixClient must be passed a valid string domain");if(null==ct.exec(this.settings.domain))throw new Error('Domain must be passed in as fully-qualified domain name and should not include a protocol or any path element, i.e. "example.imgix.net".');this.settings.includeLibraryParam&&(this.settings.libraryParam="js-"+c.version()),this.settings.urlPrefix=this.settings.useHTTPS?"https://":"http://"}var t,e,r;return t=c,r=[{key:"version",value:function(){return"3.7.1"}},{key:"_buildURL",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(null==t)return"";var t=L({url:t,useHTTPS:r.useHTTPS}),n=t.host,o=t.pathname,t=s(s({},at(t.search)),e);if(n.length&&o.length)return new c(s({domain:n},r)).buildURL(o,t);throw new Error("_buildURL: URL must match {host}/{pathname}?{query}")}},{key:"_buildSrcSet",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(null==t)return"";var t=L({url:t,useHTTPS:n.useHTTPS}),o=t.host,i=t.pathname,t=s(s({},at(t.search)),e);if(o.length&&i.length)return new c(s({domain:o},n)).buildSrcSet(i,t,r);throw new Error("_buildOneStepURL: URL must match {host}/{pathname}?{query}")}},{key:"targetWidths",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:100,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8192,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.08,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},o=Math.floor(t),i=Math.floor(e),t=(ht(t,e),dt(r),r+"/"+o+"/"+i);if(t in n)return n[t];if(o===i)return[o];for(var a=[],u=o;u<i;)a.push(Math.round(u)),u*=1+2*r;return a[a.length-1]<i&&a.push(i),n[t]=a}}],(e=[{key:"buildURL",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},t=this._sanitizePath(t,r),e=this._buildParams(e,r);return this.settings.secureURLToken&&(e=this._signParams(t,e)),this.settings.urlPrefix+this.settings.domain+t+e}},{key:"_buildParams",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=!!e.encoder,i=e.encoder,e=[].concat(h(this.settings.libraryParam?["ixlib=".concat(this.settings.libraryParam)]:[]),h(Object.entries(t).reduce(function(t,e){var r,e=f(e,2),n=e[0],e=e[1];return null!=e&&(r=o?i(n,e):encodeURIComponent(n),n="64"===n.substr(-2)?o?i(e,n):V.encodeURI(e):o?i(e,n):encodeURIComponent(e),t.push("".concat(r,"=").concat(n))),t},[])));return"".concat(0<e.length?"?":"").concat(e.join("&"))}},{key:"_signParams",value:function(t,e){t=this.settings.secureURLToken+t+e,t=Y(t);return 0<e.length?e+"&s="+t:"?s="+t}},{key:"_sanitizePath",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=t.replace(/^\//,"");return"/"+(t=e.disablePathEncoding?t:e.encoder?e.encoder(t):/^https?:\/\//.test(t)?encodeURIComponent(t):encodeURI(t).replace(/[#?:+]/g,encodeURIComponent))}},{key:"buildSrcSet",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=e.w,o=e.h;return n||o?this._buildDPRSrcSet(t,e,r):this._buildSrcSetPairs(t,e,r)}},{key:"_buildSrcSetPairs",value:function(e){var r=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};t=void 0!==(a=o).widthTolerance?(dt(a.widthTolerance),a.widthTolerance):.08,i=void 0===a.minWidth?100:a.minWidth,a=void 0===a.maxWidth?8192:a.maxWidth,100==i&&8192==a||ht(i,a);var t=f([t,i,a],3),i=t[0],a=t[1],t=t[2];if(o.widths){var u=o.widths;if(!Array.isArray(u)||!u.length)throw new Error("The widths argument can only be passed a valid non-empty array of integers");if(!u.every(function(t){return Number.isInteger(t)&&0<t}))throw new Error("A custom widths argument can only contain positive integer values");u=h(o.widths)}else u=c.targetWidths(a,t,i,this.targetWidthsCache);return u.map(function(t){return"".concat(r.buildURL(e,s(s({},n),{},{w:t}),o)," ").concat(t,"w")}).join(",\n")}},{key:"_buildDPRSrcSet",value:function(r){var n=this,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(i.devicePixelRatios){var t=i.devicePixelRatios;if(!Array.isArray(t)||!t.length)throw new Error("The devicePixelRatios argument can only be passed a valid non-empty array of integers");if(!t.every(function(t){return"number"==typeof t&&1<=t&&t<=5}))throw new Error("The devicePixelRatios argument can only contain positive integer values between 1 and 5")}var t=i.devicePixelRatios||lt,e=i.disableVariableQuality||!1;if(!e){var a=e;if("boolean"!=typeof a)throw new Error("The disableVariableQuality argument can only be passed a Boolean value")}if(i.variableQualities){a=i.variableQualities;if("object"!==l(a))throw new Error("The variableQualities argument can only be an object")}var u=s(s({},st),i.variableQualities);return(e?t.map(function(t){return"".concat(n.buildURL(r,s(s({},o),{},{dpr:t}),i)," ").concat(t,"x")}):t.map(function(t){return e=o,t=t,"".concat(n.buildURL(r,s(s({},e),{},{dpr:t,q:e.q||u[t]||u[Math.floor(t)]}),i)," ").concat(t,"x");var e})).join(",\n")}}])&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}()});