fill({url = null, width = 0, height = 0, usm = {}, webpEnabled = false} = {}) {

        if (!url) {
            return null;
        }

        const size = Math.max(width, height);

        const usmString = getUsmString(usm);

        if (googleImagesApiUrlPattern.test(url)) {
            return `${url}=s${(size >= 0 && size <= googleImagesApiMaxPixels) ? size : 0}`;
        }

        if (wixMediaManagerUrlPattern.test(url)) {
            const extension = url.match(/\.[0-9A-z]+$/) || '.jpg';
            const filename = webpEnabled ? 'file.webp' : ('file' + extension);
            return (width > 0 && height > 0 && width <= wixMediaPlatformMaxPixels && height <= wixMediaPlatformMaxPixels) ? `${url}/v1/fill/w_${width},h_${height}${usmString}/${filename}` : url;
        }

        if (deprecatedMediaPlatformUrlPattern.test(url)) {
            // Following https://jira.wixpress.com/browse/RST-2829 - replacing with new URL and removing the slash / at the end of the URL.
            var newUrl = url.replace(deprecatedMediaPlatformUrlPattern  , newWixMediaPlatformUrlPattern);
            if (newUrl.endsWith("/")) {
                newUrl = newUrl.slice(0, -1);
            }
            return newUrl;
        }

        if (deprecatedMediaPlatformUrlPattern2.test(url)) {
            // Following https://jira.wixpress.com/browse/RST-2829 - replacing with new URL and removing the slash / at the end of the URL.
            var newUrl2 = url.replace(deprecatedMediaPlatformUrlPattern2  , newWixMediaPlatformUrlPattern);
            if (newUrl2.endsWith("/")) {
                newUrl2 = newUrl2.slice(0, -1);
            }
            return newUrl2;
        }

        if (wixMediaPlatformUrlPattern.test(url)) {
            // Media platform we always return the URL since they have weird issues, for example:
            // https://images-rest.wixmp.com/tenant_admin/images/15e7624ee3ee4eeaaaaec9e6175fcdb6~mv2/v1/fill/w_245,h_184/file.jpg
            // https://images-rest.wixmp.com/tenant_admin/images/15e7624ee3ee4eeaaaaec9e6175fcdb6~mv2/v1/fill/w_1084,h_722/file.jpg
            return url;
        }

        return url;
    }
/**
     * @param width    Resized image width, 0 means max size.
     * @param height   Resized image height, 0 means max size.
     */
@param width    Resized image width, 0 means max size.
@param height   Resized image height, 0 means max size.
@param width Resized image width 0 means max size . @param height Resized image height 0 means max size .
fill({url = null, width = 0, height = 0, usm = {}, webpEnabled = false} = {}) {
        if (!url) {
            return null;
        }
        const size = Math.max(width, height);
        const usmString = getUsmString(usm);
        if (googleImagesApiUrlPattern.test(url)) {
            return `${url}=s${(size >= 0 && size <= googleImagesApiMaxPixels) ? size : 0}`;
        }
        if (wixMediaManagerUrlPattern.test(url)) {
            const extension = url.match(/\.[0-9A-z]+$/) || '.jpg';
            const filename = webpEnabled ? 'file.webp' : ('file' + extension);
            return (width > 0 && height > 0 && width <= wixMediaPlatformMaxPixels && height <= wixMediaPlatformMaxPixels) ? `${url}/v1/fill/w_${width},h_${height}${usmString}/${filename}` : url;
        }
        if (deprecatedMediaPlatformUrlPattern.test(url)) {
            var newUrl = url.replace(deprecatedMediaPlatformUrlPattern  , newWixMediaPlatformUrlPattern);
            if (newUrl.endsWith("/")) {
                newUrl = newUrl.slice(0, -1);
            }
            return newUrl;
        }
        if (deprecatedMediaPlatformUrlPattern2.test(url)) {
            var newUrl2 = url.replace(deprecatedMediaPlatformUrlPattern2  , newWixMediaPlatformUrlPattern);
            if (newUrl2.endsWith("/")) {
                newUrl2 = newUrl2.slice(0, -1);
            }
            return newUrl2;
        }
        if (wixMediaPlatformUrlPattern.test(url)) {
            return url;
        }
        return url;
    }
fill ( { url = null , width = 0 , height = 0 , usm = { } , webpEnabled = false } = { } ) { if ( ! url ) { return null ; } const size = Math . max ( width , height ) ; const usmString = getUsmString ( usm ) ; if ( googleImagesApiUrlPattern . test ( url ) ) { return ` ${ url } ${ ( size >= 0 && size <= googleImagesApiMaxPixels ) ? size : 0 } ` ; } if ( wixMediaManagerUrlPattern . test ( url ) ) { const extension = url . match ( / \.[0-9A-z]+$ / ) || '.jpg' ; const filename = webpEnabled ? 'file.webp' : ( 'file' + extension ) ; return ( width > 0 && height > 0 && width <= wixMediaPlatformMaxPixels && height <= wixMediaPlatformMaxPixels ) ? ` ${ url } ${ width } ${ height } ${ usmString } ${ filename } ` : url ; } if ( deprecatedMediaPlatformUrlPattern . test ( url ) ) { var newUrl = url . replace ( deprecatedMediaPlatformUrlPattern , newWixMediaPlatformUrlPattern ) ; if ( newUrl . endsWith ( "/" ) ) { newUrl = newUrl . slice ( 0 , - 1 ) ; } return newUrl ; } if ( deprecatedMediaPlatformUrlPattern2 . test ( url ) ) { var newUrl2 = url . replace ( deprecatedMediaPlatformUrlPattern2 , newWixMediaPlatformUrlPattern ) ; if ( newUrl2 . endsWith ( "/" ) ) { newUrl2 = newUrl2 . slice ( 0 , - 1 ) ; } return newUrl2 ; } if ( wixMediaPlatformUrlPattern . test ( url ) ) { return url ; } return url ; }
@param width    Resized image width, 0 means max size.
@param width Resized image width 0 means max size .
// Following https://jira.wixpress.com/browse/RST-2829 - replacing with new URL and removing the slash / at the end of the URL. // Following https://jira.wixpress.com/browse/RST-2829 - replacing with new URL and removing the slash / at the end of the URL. // Media platform we always return the URL since they have weird issues, for example: // https://images-rest.wixmp.com/tenant_admin/images/15e7624ee3ee4eeaaaaec9e6175fcdb6~mv2/v1/fill/w_245,h_184/file.jpg // https://images-rest.wixmp.com/tenant_admin/images/15e7624ee3ee4eeaaaaec9e6175fcdb6~mv2/v1/fill/w_1084,h_722/file.jpg