Plugin Directory

Changeset 3478972


Ignore:
Timestamp:
03/10/2026 10:44:19 AM (3 weeks ago)
Author:
bfintal
Message:

version 1.2.3

Location:
cimo-image-optimizer
Files:
7 deleted
12 edited
28 copied

Legend:

Unmodified
Added
Removed
  • cimo-image-optimizer/tags/1.2.3/build/admin/admin-page-styles-rtl.css

    r3402030 r3478972  
    1 .cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-left:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-left:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-right:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
     1.cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-left:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list,.cimo-premium-features-list hr{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-left:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-right:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
  • cimo-image-optimizer/tags/1.2.3/build/admin/admin-page-styles.asset.php

    r3402030 r3478972  
    1 <?php return array('dependencies' => array(), 'version' => 'c394a42532050d284802');
     1<?php return array('dependencies' => array(), 'version' => 'e0cbf9e945202176c3d4');
  • cimo-image-optimizer/tags/1.2.3/build/admin/admin-page-styles.css

    r3402030 r3478972  
    1 .cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-right:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-right:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-left:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
     1.cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-right:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list,.cimo-premium-features-list hr{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-right:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-left:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
  • cimo-image-optimizer/tags/1.2.3/build/admin/admin-page.asset.php

    r3402030 r3478972  
    1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '48f89642dbaf07f34e19');
     1<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'f8ea9175ba446d4ccf17');
  • cimo-image-optimizer/tags/1.2.3/build/admin/admin-page.js

    r3402030 r3478972  
    1 (()=>{"use strict";var e={n:i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return e.d(a,{a}),a},d:(i,a)=>{for(var t in a)e.o(a,t)&&!e.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:a[t]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{var i;e.g.importScripts&&(i=e.g.location+"");var a=e.g.document;if(!i&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(i=a.currentScript.src),!i)){var t=a.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!i||!/^http(s?):/.test(i));)i=t[o--].src}if(!i)throw new Error("Automatic publicPath is not supported in this browser");i=i.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=i+"../"})();const i=window.wp.element,a=window.wp.components,t=window.wp.hooks,o=window.wp.apiFetch;var s=e.n(o);const n=window.wp.i18n,l=e.p+"images/logo-long.cca876ef.webp",r=window.ReactJSXRuntime,m=(0,t.applyFilters)("cimo.admin.settings.buildType","free"),c=()=>{const[e,t]=(0,i.useState)({webpQuality:80,maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[],lqipEnabled:0,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:"",videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"",audioOptimizationEnabled:1,audioQuality:128}),[o,c]=(0,i.useState)([]),[p,u]=(0,i.useState)(!1),[h,g]=(0,i.useState)(""),[x,_]=(0,i.useState)(!0),[v,w]=(0,i.useState)(!1),[j,b]=(0,i.useState)(()=>"undefined"!=typeof window&&"1"===window.cimoAdmin?.ratingDismissed);(0,i.useEffect)(()=>{(async()=>{window.cimoAdmin&&window.cimoAdmin.imageSizes&&c(window.cimoAdmin.imageSizes),await z(),_(!1)})()},[]);const z=async()=>{try{const e=(await s()({path:"/wp/v2/settings"})).cimo_options||{},i={webpQuality:void 0!==e.webp_quality?e.webp_quality:80,maxImageDimension:e.max_image_dimension||"",disableWpScaling:void 0!==e.disable_wp_scaling?e.disable_wp_scaling:1,disableThumbnailGeneration:void 0!==e.disable_thumbnail_generation?e.disable_thumbnail_generation:0,thumbnailSizes:e.thumbnail_sizes||[],lqipEnabled:void 0!==e.lqip_enabled?e.lqip_enabled:0,lqipPulseSpeed:void 0!==e.lqip_pulse_speed?e.lqip_pulse_speed:"",lqipBrightness:void 0!==e.lqip_brightness?e.lqip_brightness:"",lqipFadeDuration:void 0!==e.lqip_fade_duration?e.lqip_fade_duration:"",videoOptimizationEnabled:void 0!==e.video_optimization_enabled?e.video_optimization_enabled:1,videoQuality:void 0!==e.video_quality?e.video_quality:3,videoMaxResolution:e.video_max_resolution||"",audioOptimizationEnabled:void 0!==e.audio_optimization_enabled?e.audio_optimization_enabled:1,audioQuality:void 0!==e.audio_quality?e.audio_quality:128};t(i),w(!1)}catch(e){}},f=(0,i.useCallback)((e,i)=>{t(a=>({...a,[e]:i})),w(!0)},[]),y=(0,i.useCallback)(async()=>{b(!0);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_rating_dismissed:"1"}})}catch(e){b(!1)}},[]);return x?(0,r.jsx)("div",{className:"cimo-admin-settings-wrap",children:(0,r.jsx)("div",{className:"cimo-loading",children:(0,r.jsx)("p",{children:(0,n.__)("Loading settings…","cimo-image-optimizer")})})}):(0,r.jsxs)("div",{className:"cimo-admin-settings-wrap",children:[(0,r.jsxs)("div",{className:"cimo-header",children:[(0,r.jsx)("img",{className:"cimo-logo",src:l,alt:(0,n.__)("Cimo Logo","cimo-image-optimizer"),height:"35"}),(0,r.jsxs)("div",{className:"cimo-stats-section",children:[(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-big",children:[(0,r.jsx)("h3",{children:(0,n.__)("Total Storage Saved","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-stats-main",children:[(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.total_storage_saved}),(0,r.jsxs)("span",{className:"cimo-stat-percentage",children:["↓ ",window.cimoAdmin.stats.percentage_saved,"% ",(0,n.__)("reduction","cimo-image-optimizer")]})]}),(0,r.jsx)("div",{className:"cimo-stats-details",children:(0,n.__)("Across all optimized media files","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image w-5 h-5 text-primary","data-lov-id":"src/pages/Index.tsx:66:22","data-lov-name":"Image","data-component-path":"src/pages/Index.tsx","data-component-line":"66","data-component-file":"Index.tsx","data-component-name":"Image","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-primary%22%7D",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.media_optimized}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Media Files Optimized","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-hard-drive w-5 h-5 text-destructive","data-lov-id":"src/pages/Index.tsx:80:22","data-lov-name":"HardDrive","data-component-path":"src/pages/Index.tsx","data-component-line":"80","data-component-file":"Index.tsx","data-component-name":"HardDrive","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-destructive%22%7D",children:[(0,r.jsx)("line",{x1:"22",x2:"2",y1:"12",y2:"12"}),(0,r.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"16",y2:"16"}),(0,r.jsx)("line",{x1:"10",x2:"10.01",y1:"16",y2:"16"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.before}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Original Size","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-zap w-5 h-5 text-accent","data-lov-id":"src/pages/Index.tsx:94:22","data-lov-name":"Zap","data-component-path":"src/pages/Index.tsx","data-component-line":"94","data-component-file":"Index.tsx","data-component-name":"Zap","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-accent%22%7D",children:(0,r.jsx)("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.after}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Optimized Size","cimo-image-optimizer")})]})]})]}),(()=>{const e=window.cimoAdmin?.stats?.total_storage_saved;let i=!1;if("string"==typeof e){const a=e.match(/^([\d.]+)\s*([a-zA-Z]+)/);if(a){const e=parseFloat(a[1]);"MB"===a[2].toUpperCase()&&e>100&&(i=!0)}}return i&&!j?(0,r.jsx)("div",{className:"cimo-header cimo-rating-notice",children:(0,r.jsxs)("div",{className:"cimo-rating-notice-content",children:[(0,r.jsx)("h3",{className:"cimo-rating-title",children:(0,n.__)("Loving the instant storage & server resource savings?","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"cimo-rating-description",children:(0,n.sprintf)(
     1(()=>{"use strict";var e={n:i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return e.d(a,{a}),a},d:(i,a)=>{for(var t in a)e.o(a,t)&&!e.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:a[t]})},o:(e,i)=>Object.prototype.hasOwnProperty.call(e,i)};(()=>{var i;globalThis.importScripts&&(i=globalThis.location+"");var a=globalThis.document;if(!i&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(i=a.currentScript.src),!i)){var t=a.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!i||!/^http(s?):/.test(i));)i=t[o--].src}if(!i)throw new Error("Automatic publicPath is not supported in this browser");i=i.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=i+"../"})();const i=window.wp.element,a=window.wp.components,t=window.wp.hooks,o=window.wp.apiFetch;var s=e.n(o);const n=window.wp.i18n,l=e.p+"images/logo-long.cca876ef.webp",r=window.ReactJSXRuntime,m=(0,t.applyFilters)("cimo.admin.settings.buildType","free"),c=()=>{const[e,t]=(0,i.useState)({webpQuality:80,maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[],lqipEnabled:0,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:"",videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"",audioOptimizationEnabled:1,audioQuality:128,svgUpload:0,svgOptimizationEnabled:1}),[o,c]=(0,i.useState)([]),[p,h]=(0,i.useState)(!1),[u,g]=(0,i.useState)(""),[x,_]=(0,i.useState)(!0),[v,w]=(0,i.useState)(!1),[j,b]=(0,i.useState)(()=>"undefined"!=typeof window&&"1"===window.cimoAdmin?.ratingDismissed);(0,i.useEffect)(()=>{(async()=>{window.cimoAdmin&&window.cimoAdmin.imageSizes&&c(window.cimoAdmin.imageSizes),await z(),_(!1)})()},[]);const z=async()=>{try{const e=(await s()({path:"/wp/v2/settings"})).cimo_options||{},i={webpQuality:void 0!==e.webp_quality?e.webp_quality:80,maxImageDimension:e.max_image_dimension||"",disableWpScaling:void 0!==e.disable_wp_scaling?e.disable_wp_scaling:1,disableThumbnailGeneration:void 0!==e.disable_thumbnail_generation?e.disable_thumbnail_generation:0,thumbnailSizes:e.thumbnail_sizes||[],lqipEnabled:void 0!==e.lqip_enabled?e.lqip_enabled:0,lqipPulseSpeed:void 0!==e.lqip_pulse_speed?e.lqip_pulse_speed:"",lqipBrightness:void 0!==e.lqip_brightness?e.lqip_brightness:"",lqipFadeDuration:void 0!==e.lqip_fade_duration?e.lqip_fade_duration:"",videoOptimizationEnabled:void 0!==e.video_optimization_enabled?e.video_optimization_enabled:1,videoQuality:void 0!==e.video_quality?e.video_quality:3,videoMaxResolution:e.video_max_resolution||"",audioOptimizationEnabled:void 0!==e.audio_optimization_enabled?e.audio_optimization_enabled:1,audioQuality:void 0!==e.audio_quality?e.audio_quality:128,svgUpload:void 0!==e.svg_upload?e.svg_upload:0,svgOptimizationEnabled:void 0!==e.svg_optimization_enabled?e.svg_optimization_enabled:1};t(i),w(!1)}catch(e){}},f=(0,i.useCallback)((e,i)=>{t(a=>({...a,[e]:i})),w(!0)},[]),y=(0,i.useCallback)(async()=>{b(!0);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_rating_dismissed:"1"}})}catch(e){b(!1)}},[]);return x?(0,r.jsx)("div",{className:"cimo-admin-settings-wrap",children:(0,r.jsx)("div",{className:"cimo-loading",children:(0,r.jsx)("p",{children:(0,n.__)("Loading settings…","cimo-image-optimizer")})})}):(0,r.jsxs)("div",{className:"cimo-admin-settings-wrap",children:[(0,r.jsxs)("div",{className:"cimo-header",children:[(0,r.jsx)("img",{className:"cimo-logo",src:l,alt:(0,n.__)("Cimo Logo","cimo-image-optimizer"),height:"35"}),(0,r.jsxs)("div",{className:"cimo-stats-section",children:[(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-big",children:[(0,r.jsx)("h3",{children:(0,n.__)("Total Storage Saved","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-stats-main",children:[(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.total_storage_saved}),(0,r.jsxs)("span",{className:"cimo-stat-percentage",children:["↓ ",window.cimoAdmin.stats.percentage_saved,"% ",(0,n.__)("reduction","cimo-image-optimizer")]})]}),(0,r.jsx)("div",{className:"cimo-stats-details",children:(0,n.__)("Across all optimized media files","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image w-5 h-5 text-primary","data-lov-id":"src/pages/Index.tsx:66:22","data-lov-name":"Image","data-component-path":"src/pages/Index.tsx","data-component-line":"66","data-component-file":"Index.tsx","data-component-name":"Image","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-primary%22%7D",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.media_optimized}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Media Files Optimized","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-hard-drive w-5 h-5 text-destructive","data-lov-id":"src/pages/Index.tsx:80:22","data-lov-name":"HardDrive","data-component-path":"src/pages/Index.tsx","data-component-line":"80","data-component-file":"Index.tsx","data-component-name":"HardDrive","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-destructive%22%7D",children:[(0,r.jsx)("line",{x1:"22",x2:"2",y1:"12",y2:"12"}),(0,r.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"16",y2:"16"}),(0,r.jsx)("line",{x1:"10",x2:"10.01",y1:"16",y2:"16"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.before}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Original Size","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-zap w-5 h-5 text-accent","data-lov-id":"src/pages/Index.tsx:94:22","data-lov-name":"Zap","data-component-path":"src/pages/Index.tsx","data-component-line":"94","data-component-file":"Index.tsx","data-component-name":"Zap","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-accent%22%7D",children:(0,r.jsx)("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.after}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Optimized Size","cimo-image-optimizer")})]})]})]}),(()=>{const e=window.cimoAdmin?.stats?.total_storage_saved;let i=!1;if("string"==typeof e){const a=e.match(/^([\d.]+)\s*([a-zA-Z]+)/);if(a){const e=parseFloat(a[1]);"MB"===a[2].toUpperCase()&&e>100&&(i=!0)}}return i&&!j?(0,r.jsx)("div",{className:"cimo-header cimo-rating-notice",children:(0,r.jsxs)("div",{className:"cimo-rating-notice-content",children:[(0,r.jsx)("h3",{className:"cimo-rating-title",children:(0,n.__)("Loving the instant storage & server resource savings?","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"cimo-rating-description",children:(0,n.sprintf)(
    22// translators: %s is replaced with the total storage saved (e.g. "1.5 GB")
    33// translators: %s is replaced with the total storage saved (e.g. "1.5 GB")
    4 (0,n.__)("You've saved over %s! If Cimo is helping your site, please consider leaving us a 5-star rating and help others discover Cimo!","cimo-image-optimizer"),window.cimoAdmin.stats.total_storage_saved)}),(0,r.jsxs)("div",{className:"cimo-rating-buttons",children:[(0,r.jsxs)(a.Button,{variant:"primary",href:"https://wordpress.org/support/plugin/cimo-image-optimizer/reviews/#new-post",target:"_blank",rel:"noopener noreferrer",className:"cimo-rating-rate-now",__next40pxDefaultSize:!0,children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-star-icon lucide-star",children:(0,r.jsx)("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})}),(0,n.__)("Rate Now","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-rating-no-thanks",onClick:y,__next40pxDefaultSize:!0,children:(0,n.__)("Don't show this again, I've already rated","cimo-image-optimizer")})]})]})}):null})(),(0,r.jsxs)("form",{onSubmit:async i=>{i.preventDefault(),u(!0),g(""),w(!1);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_options:{webp_quality:parseInt(e.webpQuality)||0,max_image_dimension:parseInt(e.maxImageDimension)||0,disable_wp_scaling:e.disableWpScaling,disable_thumbnail_generation:e.disableThumbnailGeneration,thumbnail_sizes:e.thumbnailSizes,lqip_enabled:e.lqipEnabled,lqip_pulse_speed:parseFloat(e.lqipPulseSpeed)||0,lqip_brightness:parseFloat(e.lqipBrightness)||0,lqip_fade_duration:parseFloat(e.lqipFadeDuration)||0,video_optimization_enabled:e.videoOptimizationEnabled,video_quality:e.videoQuality||0,video_max_resolution:e.videoMaxResolution||"",audio_optimization_enabled:e.audioOptimizationEnabled,audio_quality:e.audioQuality||0}}}),g((0,n.__)("Settings saved successfully!","cimo-image-optimizer"))}catch(e){g((0,n.__)("Error saving settings.","cimo-image-optimizer"))}finally{u(!1),setTimeout(()=>g(""),3e3)}},className:"cimo-settings-form",children:[(0,r.jsxs)("div",{className:"cimo-settings-section-wrapper",children:[(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-section-info",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-info-icon lucide-info",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 16v-4"}),(0,r.jsx)("path",{d:"M12 8h.01"})]}),"free"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")}),"premium"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images, videos and audio files are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Image Optimization Settings","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,webpQuality:80,maxImageDimension:1920,disableWpScaling:1,disableThumbnailGeneration:1,thumbnailSizes:[]}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"webpQuality",label:(0,n.__)("WebP Image Quality","cimo-image-optimizer"),value:e.webpQuality||"",onChange:e=>f("webpQuality",e||""),min:"1",max:"100",step:"1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:80,help:(0,n.__)("Set the quality / compression level for generated .webp images. Default is 80%. Higher values mean better quality and larger file size; lower values reduce file size with more compression but lower quality.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.TextControl,{label:(0,n.__)("Maximum Image Dimension","cimo-image-optimizer"),type:"number",value:e.maxImageDimension,onChange:e=>f("maxImageDimension",e),help:(0,n.__)("Maximum width or height in pixels for uploaded images. Images exceeding this dimension will be automatically resized while preserving aspect ratio. Leave empty to disable resizing. We recommend a value of 1920px.","cimo-image-optimizer"),__next40pxDefaultSize:!0})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Automatic Image Scaling","cimo-image-optimizer"),checked:1===e.disableWpScaling,onChange:e=>f("disableWpScaling",e?1:0),help:(0,n.__)("WordPress automatically scales images larger than 2560px. Disable this option to allow uploads of any size.","cimo-image-optimizer")})}),(0,r.jsxs)("div",{className:"cimo-setting-field",children:[(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Thumbnail Generation","cimo-image-optimizer"),checked:0===e.disableThumbnailGeneration,onChange:e=>f("disableThumbnailGeneration",e?0:1),help:(0,n.__)("By default, WordPress generates multiple image sizes (thumbnail, medium, large, etc.) when you upload images. Disable this option to save disk space.","cimo-image-optimizer")}),0===e.disableThumbnailGeneration&&(0,r.jsxs)("div",{className:"cimo-image-sizes-list",children:[(0,r.jsx)("h4",{className:"cimo-image-sizes-heading",children:(0,n.__)("Individual Image Sizes","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"description",children:(0,n.__)("You can turn off generation for individual image sizes:","cimo-image-optimizer")}),o.map(i=>{const o=!e.thumbnailSizes.includes(i.name);return(0,r.jsx)(a.ToggleControl,{label:i.name,checked:o,onChange:e=>{return a=i.name,o=e,void t(e=>{let i=[...e.thumbnailSizes];return o?i=i.filter(e=>e!==a):i.includes(a)||i.push(a),{...e,thumbnailSizes:i}});var a,o}},i.name)}),0===o.length&&(0,r.jsx)("div",{className:"notice notice-warning cimo-image-sizes-warning",children:(0,r.jsx)("p",{children:(0,n.__)("No image sizes detected. If you just re-enabled thumbnail generation, please save settings and refresh this page.","cimo-image-optimizer")})})]})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,webpQuality:"",maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[]}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Low Quality Image Placeholder Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Show a low-quality preview while the image loads, then fade in the final image.","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable LQIP","cimo-image-optimizer"),checked:1===e.lqipEnabled,onChange:e=>f("lqipEnabled",e?1:0),help:(0,n.__)("Turn this option on to enable LQIP for all images. LQIP is only supported by Native Image Blocks.","cimo-image-optimizer")})}),1===e.lqipEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipPulseSpeed",label:(0,n.__)("Placeholder Pulse Speed (seconds)","cimo-image-optimizer"),value:e.lqipPulseSpeed||"",onChange:e=>f("lqipPulseSpeed",e||""),min:"0.1",max:"5",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:2.5,help:(0,n.__)("Set the speed of the pulse animation when the image is loading. Default is 2.5s.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipBrightness",label:(0,n.__)("Placeholder Pulse Brightness","cimo-image-optimizer"),value:e.lqipBrightness||"",onChange:e=>f("lqipBrightness",e||""),min:"0.5",max:"1.5",step:"0.05",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:1.3,help:(0,n.__)("Set the brightness of the pulse animation when the image is loading. Default is 1.3x brightness.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipFadeDuration",label:(0,n.__)("Image Fade In Duration (seconds)","cimo-image-optimizer"),value:e.lqipFadeDuration||"",onChange:e=>f("lqipFadeDuration",e||""),min:"0.1",max:"3",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:.5,help:(0,n.__)("Set the duration of the fade in animation when the image is loaded. Default is 0.5s.","cimo-image-optimizer")})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video-icon lucide-video",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,n.__)("Video Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]}),"premium"===m&&(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"1440"}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize video files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Video Optimization","cimo-image-optimizer"),checked:1===e.videoOptimizationEnabled,onChange:e=>f("videoOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload videos without optimizing them.","cimo-image-optimizer")})}),1===e.videoOptimizationEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Quality","cimo-image-optimizer"),value:e.videoQuality||3,onChange:e=>f("videoQuality",e),isBlock:!0,help:(0,n.__)("Set the quality / compression level for optimized .MP4 video uploads. Default is Medium (Balanced). Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:1,label:(0,n.__)("Very Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:2,label:(0,n.__)("Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:3,label:(0,n.__)("Medium","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:4,label:(0,n.__)("High Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:5,label:(0,n.__)("Very High Quality","cimo-image-optimizer")})]})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Maximum Resolution","cimo-image-optimizer"),value:e.videoMaxResolution||"",onChange:e=>f("videoMaxResolution",e),isBlock:!0,help:(0,n.__)("Set the maximum resolution for optimized video uploads. If the video uploaded is bigger than this, the video will not be resized down to this maximum resolution. Default is the video will not be resized.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"",label:(0,n.__)("Keep original","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"480",label:"480p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"720",label:"720p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1080",label:"1080p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1440",label:"1440p (2K)"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"2160",label:"2160p (4K)"})]})})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:"",videoMaxResolution:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music-icon lucide-music",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,n.__)("Audio Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize audio files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Audio Optimization","cimo-image-optimizer"),checked:1===e.audioOptimizationEnabled,onChange:e=>f("audioOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload audio files without optimizing them.","cimo-image-optimizer")})}),1===e.audioOptimizationEnabled&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{label:(0,n.__)("Audio Quality (kbps)","cimo-image-optimizer"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:e.audioQuality||128,onChange:e=>f("audioQuality",e),min:"32",max:"320",step:"32",help:(0,n.__)("Set the quality / compression level for optimized .MP3 audio uploads. Default is 128kbps. Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer")})})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,audioOptimizationEnabled:1,audioQuality:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsx)("div",{className:"cimo-setting-field cimo-submit-section",children:(0,r.jsxs)("div",{className:"cimo-submit-buttons",children:[(0,r.jsx)(a.Button,{variant:"primary",className:"cimo-save-button",disabled:p,__next40pxDefaultSize:!0,onClick:e=>{e.preventDefault(),p||document.querySelector("form").dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))},children:p?(0,n.__)("Saving…","cimo-image-optimizer"):(0,n.__)("Save Changes","cimo-image-optimizer")}),v&&(0,r.jsx)("span",{className:"cimo-unsaved-note",children:(0,n.__)("You have unsaved changes","cimo-image-optimizer")}),h&&(0,r.jsx)("p",{children:h})]})})]}),"free"===m&&(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-sidebar",children:[(0,r.jsxs)("div",{className:"cimo-sidebar-heading",children:[(0,r.jsx)("div",{className:"cimo-sidebar-heading-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-crown-icon lucide-crown",children:[(0,r.jsx)("path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z"}),(0,r.jsx)("path",{d:"M5 21h14"})]})}),(0,r.jsx)("h2",{children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),(0,r.jsx)("p",{className:"cimo-premium-intro",children:(0,n.__)("Optimize more things and get premium support for a faster, happier site.","cimo-image-optimizer")}),(0,r.jsxs)("ul",{className:"cimo-premium-features-list",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:310:20","data-lov-name":"Video","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"310","data-component-file":"WordPressAdmin.tsx","data-component-name":"Video","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize videos on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:316:20","data-lov-name":"Music","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"316","data-component-file":"WordPressAdmin.tsx","data-component-name":"Music","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize audio on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Low Quality Image Placeholder","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-icon customizable lucide-infinity-icon lucide-infinity lucide-icon customizable",children:(0,r.jsx)("path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8"})})}),(0,r.jsx)("span",{children:(0,n.__)("Still without limits","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-premium-cta",children:[(0,r.jsx)(a.Button,{href:"https://wpcimo.com/pricing",variant:"primary",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade Now","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-premium-guarantee",children:[(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#16a249",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M8 13.5l2.5 2.5L16 9"})]}),(0,n.__)("30-day money back guarantee","cimo-image-optimizer")]})]})]})]})},d=e=>(0,r.jsxs)("div",{className:"cimo-settings-premium-placeholder",children:[e.label,(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-premium-cta",href:"https://wpcimo.com/pricing",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),p=document.getElementById("cimo-admin-settings");p&&(0,i.createRoot)(p).render((0,r.jsx)(c,{}))})();
     4(0,n.__)("You've saved over %s! If Cimo is helping your site, please consider leaving us a 5-star rating and help others discover Cimo!","cimo-image-optimizer"),window.cimoAdmin.stats.total_storage_saved)}),(0,r.jsxs)("div",{className:"cimo-rating-buttons",children:[(0,r.jsxs)(a.Button,{variant:"primary",href:"https://wordpress.org/support/plugin/cimo-image-optimizer/reviews/#new-post",target:"_blank",rel:"noopener noreferrer",className:"cimo-rating-rate-now",__next40pxDefaultSize:!0,children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-star-icon lucide-star",children:(0,r.jsx)("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})}),(0,n.__)("Rate Now","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-rating-no-thanks",onClick:y,__next40pxDefaultSize:!0,children:(0,n.__)("Don't show this again, I've already rated","cimo-image-optimizer")})]})]})}):null})(),(0,r.jsxs)("form",{onSubmit:async i=>{i.preventDefault(),h(!0),g(""),w(!1);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_options:{webp_quality:parseInt(e.webpQuality)||0,max_image_dimension:parseInt(e.maxImageDimension)||0,disable_wp_scaling:e.disableWpScaling,disable_thumbnail_generation:e.disableThumbnailGeneration,thumbnail_sizes:e.thumbnailSizes,lqip_enabled:e.lqipEnabled,lqip_pulse_speed:parseFloat(e.lqipPulseSpeed)||0,lqip_brightness:parseFloat(e.lqipBrightness)||0,lqip_fade_duration:parseFloat(e.lqipFadeDuration)||0,video_optimization_enabled:e.videoOptimizationEnabled,video_quality:e.videoQuality||0,video_max_resolution:e.videoMaxResolution||"",audio_optimization_enabled:e.audioOptimizationEnabled,audio_quality:e.audioQuality||0,svg_upload:e.svgUpload,svg_optimization_enabled:e.svgOptimizationEnabled}}}),g((0,n.__)("Settings saved successfully!","cimo-image-optimizer"))}catch(e){g((0,n.__)("Error saving settings.","cimo-image-optimizer"))}finally{h(!1),setTimeout(()=>g(""),3e3)}},className:"cimo-settings-form",children:[(0,r.jsxs)("div",{className:"cimo-settings-section-wrapper",children:[(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-section-info",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-info-icon lucide-info",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 16v-4"}),(0,r.jsx)("path",{d:"M12 8h.01"})]}),"free"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")}),"premium"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images, videos and audio files are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Image Optimization Settings","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,webpQuality:80,maxImageDimension:1920,disableWpScaling:1,disableThumbnailGeneration:1,thumbnailSizes:[]}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"webpQuality",label:(0,n.__)("WebP Image Quality","cimo-image-optimizer"),value:e.webpQuality||"",onChange:e=>f("webpQuality",e||""),min:"1",max:"100",step:"1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:80,help:(0,n.__)("Set the quality / compression level for generated .webp images. Default is 80%. Higher values mean better quality and larger file size; lower values reduce file size with more compression but lower quality.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.TextControl,{label:(0,n.__)("Maximum Image Dimension","cimo-image-optimizer"),type:"number",value:e.maxImageDimension,onChange:e=>f("maxImageDimension",e),help:(0,n.__)("Maximum width or height in pixels for uploaded images. Images exceeding this dimension will be automatically resized while preserving aspect ratio. Leave empty to disable resizing. We recommend a value of 1920px.","cimo-image-optimizer"),__next40pxDefaultSize:!0})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Automatic Image Scaling","cimo-image-optimizer"),checked:1===e.disableWpScaling,onChange:e=>f("disableWpScaling",e?1:0),help:(0,n.__)("WordPress automatically scales images larger than 2560px. Disable this option to allow uploads of any size.","cimo-image-optimizer")})}),(0,r.jsxs)("div",{className:"cimo-setting-field",children:[(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Thumbnail Generation","cimo-image-optimizer"),checked:0===e.disableThumbnailGeneration,onChange:e=>f("disableThumbnailGeneration",e?0:1),help:(0,n.__)("By default, WordPress generates multiple image sizes (thumbnail, medium, large, etc.) when you upload images. Disable this option to save disk space.","cimo-image-optimizer")}),0===e.disableThumbnailGeneration&&(0,r.jsxs)("div",{className:"cimo-image-sizes-list",children:[(0,r.jsx)("h4",{className:"cimo-image-sizes-heading",children:(0,n.__)("Individual Image Sizes","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"description",children:(0,n.__)("You can turn off generation for individual image sizes:","cimo-image-optimizer")}),o.map(i=>{const o=!e.thumbnailSizes.includes(i.name);return(0,r.jsx)(a.ToggleControl,{label:i.name,checked:o,onChange:e=>{return a=i.name,o=e,void t(e=>{let i=[...e.thumbnailSizes];return o?i=i.filter(e=>e!==a):i.includes(a)||i.push(a),{...e,thumbnailSizes:i}});var a,o}},i.name)}),0===o.length&&(0,r.jsx)("div",{className:"notice notice-warning cimo-image-sizes-warning",children:(0,r.jsx)("p",{children:(0,n.__)("No image sizes detected. If you just re-enabled thumbnail generation, please save settings and refresh this page.","cimo-image-optimizer")})})]})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,webpQuality:"",maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[]}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Low Quality Image Placeholder Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Show a low-quality preview while the image loads, then fade in the final image.","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable LQIP","cimo-image-optimizer"),checked:1===e.lqipEnabled,onChange:e=>f("lqipEnabled",e?1:0),help:(0,n.__)("Turn this option on to enable LQIP for all images. LQIP is only supported by Native Image Blocks.","cimo-image-optimizer")})}),1===e.lqipEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipPulseSpeed",label:(0,n.__)("Placeholder Pulse Speed (seconds)","cimo-image-optimizer"),value:e.lqipPulseSpeed||"",onChange:e=>f("lqipPulseSpeed",e||""),min:"0.1",max:"5",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:2.5,help:(0,n.__)("Set the speed of the pulse animation when the image is loading. Default is 2.5s.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipBrightness",label:(0,n.__)("Placeholder Pulse Brightness","cimo-image-optimizer"),value:e.lqipBrightness||"",onChange:e=>f("lqipBrightness",e||""),min:"0.5",max:"1.5",step:"0.05",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:1.3,help:(0,n.__)("Set the brightness of the pulse animation when the image is loading. Default is 1.3x brightness.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipFadeDuration",label:(0,n.__)("Image Fade In Duration (seconds)","cimo-image-optimizer"),value:e.lqipFadeDuration||"",onChange:e=>f("lqipFadeDuration",e||""),min:"0.1",max:"3",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:.5,help:(0,n.__)("Set the duration of the fade in animation when the image is loaded. Default is 0.5s.","cimo-image-optimizer")})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video-icon lucide-video",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,n.__)("Video Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]}),"premium"===m&&(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"1440"}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize video files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Video Optimization","cimo-image-optimizer"),checked:1===e.videoOptimizationEnabled,onChange:e=>f("videoOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload videos without optimizing them.","cimo-image-optimizer")})}),1===e.videoOptimizationEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Quality","cimo-image-optimizer"),value:e.videoQuality||3,onChange:e=>f("videoQuality",e),isBlock:!0,help:(0,n.__)("Set the quality / compression level for optimized .MP4 video uploads. Default is Medium (Balanced). Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:1,label:(0,n.__)("Very Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:2,label:(0,n.__)("Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:3,label:(0,n.__)("Medium","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:4,label:(0,n.__)("High Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:5,label:(0,n.__)("Very High Quality","cimo-image-optimizer")})]})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Maximum Resolution","cimo-image-optimizer"),value:e.videoMaxResolution||"",onChange:e=>f("videoMaxResolution",e),isBlock:!0,help:(0,n.__)("Set the maximum resolution for optimized video uploads. If the video uploaded is bigger than this, the video will not be resized down to this maximum resolution. Default is the video will not be resized.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"",label:(0,n.__)("Keep original","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"480",label:"480p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"720",label:"720p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1080",label:"1080p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1440",label:"1440p (2K)"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"2160",label:"2160p (4K)"})]})})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:"",videoMaxResolution:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music-icon lucide-music",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,n.__)("Audio Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize audio files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Audio Optimization","cimo-image-optimizer"),checked:1===e.audioOptimizationEnabled,onChange:e=>f("audioOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload audio files without optimizing them.","cimo-image-optimizer")})}),1===e.audioOptimizationEnabled&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{label:(0,n.__)("Audio Quality (kbps)","cimo-image-optimizer"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:e.audioQuality||128,onChange:e=>f("audioQuality",e),min:"32",max:"320",step:"32",help:(0,n.__)("Set the quality / compression level for optimized .MP3 audio uploads. Default is 128kbps. Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer")})})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,audioOptimizationEnabled:1,audioQuality:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-file-image-icon lucide-file-image",children:[(0,r.jsx)("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),(0,r.jsx)("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),(0,r.jsx)("circle",{cx:"10",cy:"12",r:"2"}),(0,r.jsx)("path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22"})]})}),(0,n.__)("SVG Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize SVG files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable SVG uploads","cimo-image-optimizer"),checked:1===e.svgUpload,onChange:e=>f("svgUpload",e?1:0),help:(0,n.__)("Allow SVG files to be uploaded in the media library. WordPress has this option disabled by default","cimo-image-optimizer")})}),1===e.svgUpload&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable SVG Optimization","cimo-image-optimizer"),checked:1===e.svgOptimizationEnabled,onChange:e=>f("svgOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload SVG files without optimizing them.","cimo-image-optimizer")})})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,svgUpload:0,svgOptimizationEnabled:1}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsx)("div",{className:"cimo-setting-field cimo-submit-section",children:(0,r.jsxs)("div",{className:"cimo-submit-buttons",children:[(0,r.jsx)(a.Button,{variant:"primary",className:"cimo-save-button",disabled:p,__next40pxDefaultSize:!0,onClick:e=>{e.preventDefault(),p||document.querySelector("form").dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))},children:p?(0,n.__)("Saving…","cimo-image-optimizer"):(0,n.__)("Save Changes","cimo-image-optimizer")}),v&&(0,r.jsx)("span",{className:"cimo-unsaved-note",children:(0,n.__)("You have unsaved changes","cimo-image-optimizer")}),u&&(0,r.jsx)("p",{children:u})]})})]}),"free"===m&&(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-sidebar",children:[(0,r.jsxs)("div",{className:"cimo-sidebar-heading",children:[(0,r.jsx)("div",{className:"cimo-sidebar-heading-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-crown-icon lucide-crown",children:[(0,r.jsx)("path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z"}),(0,r.jsx)("path",{d:"M5 21h14"})]})}),(0,r.jsx)("h2",{children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),(0,r.jsx)("p",{className:"cimo-premium-intro",children:(0,n.__)("Optimize more things and get premium support for a faster, happier site.","cimo-image-optimizer")}),(0,r.jsxs)("ul",{className:"cimo-premium-features-list",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-smartphone-icon lucide-smartphone",children:[(0,r.jsx)("rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M12 18h.01"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Support for HEIC image format","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Low Quality Image Placeholder","cimo-image-optimizer")})]}),(0,r.jsx)("hr",{}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:310:20","data-lov-name":"Video","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"310","data-component-file":"WordPressAdmin.tsx","data-component-name":"Video","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize videos on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:316:20","data-lov-name":"Music","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"316","data-component-file":"WordPressAdmin.tsx","data-component-name":"Music","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize audio on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-file-code-icon lucide-file-code",children:[(0,r.jsx)("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),(0,r.jsx)("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),(0,r.jsx)("path",{d:"M10 12.5 8 15l2 2.5"}),(0,r.jsx)("path",{d:"m14 12.5 2 2.5-2 2.5"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize SVG files on upload","cimo-image-optimizer")})]}),(0,r.jsx)("hr",{}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-icon customizable lucide-infinity-icon lucide-infinity lucide-icon customizable",children:(0,r.jsx)("path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8"})})}),(0,r.jsx)("span",{children:(0,n.__)("Still without limits","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-premium-cta",children:[(0,r.jsx)(a.Button,{href:"https://wpcimo.com/pricing",variant:"primary",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade Now","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-premium-guarantee",children:[(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#16a249",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M8 13.5l2.5 2.5L16 9"})]}),(0,n.__)("30-day money back guarantee","cimo-image-optimizer")]})]})]})]})},d=e=>(0,r.jsxs)("div",{className:"cimo-settings-premium-placeholder",children:[e.label,(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-premium-cta",href:"https://wpcimo.com/pricing",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),p=document.getElementById("cimo-admin-settings");p&&(0,i.createRoot)(p).render((0,r.jsx)(c,{}))})();
  • cimo-image-optimizer/tags/1.2.3/build/admin/index.asset.php

    r3448132 r3478972  
    1 <?php return array('dependencies' => array('wp-hooks', 'wp-i18n'), 'version' => '6344fc3a5d4fb7fae14b');
     1<?php return array('dependencies' => array('wp-hooks', 'wp-i18n'), 'version' => 'b5f864d04db75cb35099');
  • cimo-image-optimizer/tags/1.2.3/build/admin/index.js

    r3448132 r3478972  
    1 (()=>{"use strict";function t(t){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",t):t())}const e=window.wp.i18n;class n{constructor(t,n={}){this.file=t,this.options=n,this._progress=0,this._status=(0,e.__)("Ready","cimo-image-optimizer"),this._errorMessage=null}static get mimeTypes(){throw new Error("mimeTypes getter must be implemented by subclass")}static supportsMimeType(t){if(!t||"string"!=typeof t)return!1;const e=this.mimeTypes;return!!Array.isArray(e)&&e.includes(t)}get status(){return this._status}get errorMessage(){return this._errorMessage}get progress(){return this._progress}static get showProgress(){return!0}get showProgress(){return this.constructor.showProgress}async convert(){throw new Error("convert() must be implemented by subclass")}cancel(){}}const i=[{value:"webp",mimeType:"image/webp"},{value:"jpg",mimeType:"image/jpeg"},{value:"png",mimeType:"image/png"}];class s extends n{static get mimeTypes(){return["image/jpeg","image/png","image/webp","image/jpg"]}static get showProgress(){return!1}calculateDimensions(t,e,n){const i=(n=n||{}).scale?n.scale:1,s=n.width?n.width:"auto",o=n.height?n.height:"auto",r=n.aspectRatio?n.aspectRatio:"auto",a=n.maxDimension?n.maxDimension:0;let l=t*i,c=e*i;if(a&&"number"==typeof a&&a>0){const t=Math.max(l,c);if(t>a){const e=a/t;l*=e,c*=e}}if("auto"!==s&&"number"==typeof s&&(l=s,"auto"===o&&(c=e/t*l)),"auto"!==o&&"number"==typeof o&&(c=o,"auto"===s&&(l=t/e*c)),"auto"!==r){if("custom"===r)return{width:l,height:c};const[t,e]=r.split(":").map(Number),n=t/e,i=l/c;if(Math.abs(i-n)>.01)if(i>n)l=c*n;else{const t=l;l=t,c=t/n}}return{width:Math.round(l),height:Math.round(c)}}async convertImage(t,e="webp",n={}){let s=(n=n||{}).quality?n.quality:.8,o=n.maxDimension?n.maxDimension:0;return"string"==typeof s&&(s=parseFloat(s)/100,s||(s=.8)),"string"==typeof o&&(o=parseFloat(o)),new Promise((n,r)=>{const a=new Image;let l=null;a.onload=async()=>{const t=document.createElement("canvas"),{width:c,height:m}=this.calculateDimensions(a.width,a.height,{maxDimension:o});t.width=c,t.height=m;const d=t.getContext("2d"),p=a.width/a.height,u=c/m;let h=a.height,g=a.width,f=0,w=0;Math.abs(p-u)>.01&&(p>u?(g=a.height*u,f=(a.width-g)/2):(h=a.width/u,w=(a.height-h)/2)),d.drawImage(a,f,w,g,h,0,0,c,m);const y=i.find(t=>t.value===e),v="webp"===e||"jpg"===e?s:void 0;t.toBlob(function(e){URL.revokeObjectURL(l),l=null,d.clearRect(0,0,t.width,t.height),t.width=0,t.height=0,e?n(e):r(new Error("Failed to convert image"))},y.mimeType,v)},a.onerror=()=>{l&&(URL.revokeObjectURL(l),l=null),r(new Error("Failed to load image"))},l=URL.createObjectURL(t.file),a.src=l})}async convert(){const t=this.file,e=this.options?.format||"webp";if(!t.type||!t.type.startsWith("image/"))return{file:t,metadata:null};const n=i.find(t=>t.value===e);if(n&&t.type===n.mimeType)return{file:t,metadata:null};const s=document.createElement("canvas");if(n&&!s.toDataURL(n.mimeType).startsWith(`data:${n.mimeType}`))return console.error("[Cimo] "+e+" is not supported by the browser, please use another modern browser"),{file:t,metadata:null};if("image/gif"===t.type){const e=await t.slice(0,51200).arrayBuffer(),n=new Uint8Array(e);let i=0;for(let e=0;e<n.length-2;e++)if(33===n[e]&&249===n[e+1]&&4===n[e+2]&&(i++,i>1))return{file:t,metadata:null}}const o={file:t};try{const i=performance.now(),s=await this.convertImage(o,e,{quality:this.options?.quality||.8,maxDimension:this.options?.maxDimension||0}),r=performance.now();if(s.size>t.size)throw new Error("Resulting image is bigger than the input, skipping conversion.");const a="jpeg"===e?"jpg":e,l=t.name.replace(/\.[^/.]+$/,"")+"."+a,c={filename:l,originalFormat:t.type,originalFilesize:t.size,convertedFormat:n.mimeType,convertedFilesize:s.size,conversionTime:r-i,compressionSavings:t.size>0?s.size/t.size:null};return{file:new(0,t.constructor)([s],l,{type:n.mimeType,lastModified:Date.now()}),metadata:c}}catch(t){throw new Error(`Failed to convert image: ${t.message}`)}}}class o extends n{static get showProgress(){return!1}async convert(){return{file:this.file,metadata:null}}}const r=window.wp.hooks,a=t=>{let e=t;if(!e||"object"!=typeof e||"string"!=typeof e.name||"number"!=typeof e.size||"string"!=typeof e.type||"function"!=typeof e.slice)return new o(e);if(!(e instanceof File)){const t=e;e=new File(t?[t]:[],t?.name||"unknown",{type:t?.type||"application/octet-stream",lastModified:"number"==typeof t?.lastModified?t.lastModified:Date.now()})}if(e.type.startsWith("image/")){if(!function(t){const e={webp:"image/webp",avif:"image/avif"}[t.toLowerCase()]||(t.startsWith("image/")?t:null);if(!e)return!1;const n=document.createElement("canvas");n.width=1,n.height=1;try{return n.toDataURL(e).startsWith(`data:${e}`)}catch(t){return!1}}("webp"))return new o(e);if(s.supportsMimeType(e.type))return new s(e,{format:"webp",quality:window.cimoSettings?.webpQuality||.8,maxDimension:window.cimoSettings?.maxImageDimension||0})}return(0,r.applyFilters)("cimo.getFileConverter",null,e)||new o(e)};function l(t){return!t.every(t=>"NullConverter"===t.constructor.name)}function c(t){return("string"!=typeof t?String(t):t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/`/g,"&#96;")}function m(t,e="editor-canvas"){const n=()=>{const n=document.querySelector(`iframe[name="${e}"]`);if(n&&n.contentDocument){const e=()=>{n.contentDocument.body?t(n.contentDocument):setTimeout(e,50)};"loading"===n.contentDocument.readyState?n.addEventListener("load",()=>{e()}):e()}};n();let i=0;const s=setInterval(()=>{i>=10?clearInterval(s):(i++,n())},1e3),o=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&("IFRAME"===t.tagName&&t.name===e||t.querySelector&&t.querySelector(`iframe[name="${e}"]`))&&n()})})});return o.observe(document.body,{childList:!0,subtree:!0}),o}const d=t=>{if(!Array.isArray(t))return Promise.resolve();const e=t.filter(t=>null!==t);return 0===e.length?Promise.resolve():(e.forEach(t=>{t.filename&&p(t.filename,t)}),new Promise((t,n)=>{fetch(`${window.cimoSettings?.restUrl||"/wp-json/cimo/v1/"}metadata`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-WP-Nonce":window.cimoSettings?.nonce||window.wpApiSettings?.nonce},body:JSON.stringify({metadata:e}),credentials:"same-origin"}).then(t=>t.ok?t.json():t.json().then(e=>{throw new Error(e.message||t.statusText)})).then(e=>{t(e)}).catch(t=>{console.error(`Failed to save metadata for filenames: [${e.map(t=>t.filename).join(", ")}]:`,t),n(new Error(`Failed to save metadata: ${t.message}`))})}))},p=(t,e)=>{window.cimoMetadataCache||(window.cimoMetadataCache={}),window.cimoMetadataCache[t.replaceAll(/\s+/g,"-")]={...e}};class u{constructor(t=[],e=null){this.converters=Array.isArray(t)?t.filter(t=>!0===t?.showProgress):[],this.closeHandler="function"==typeof e?e:null,this.interval=null,this.modal=null,this.progressBars=[],this._setupModal()}open(){this.modal&&0!==this.converters.length&&(this.modal.style.display="flex",this._startInterval())}_handleCloseClick(){confirm((0,e.__)("Closing this dialog will cancel the uploading process. Are you sure you want to continue?","cimo-image-optimizer"))&&(this.closeHandler&&this.closeHandler(),this.close())}close(){this.modal&&0!==this.converters.length&&setTimeout(()=>{this.modal.style.display="none",this._stopInterval(),this.modal.remove(),this.modal=null},300)}_setupModal(){this.modal=document.createElement("div"),this.modal.className="cimo-progress-modal",this.modal.style.cssText="\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100vw;\n\t\t\theight: 100vh;\n\t\t\tbackground: rgba(0,0,0,0.35);\n\t\t\tdisplay: none;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tz-index: 9999999;\n\t\t",this.modal.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()});const t=document.createElement("div");t.className="cimo-progress-wrapper",t.style.cssText="\n\t\t\tbackground: #fff;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 2em 2em 1em 2em;\n\t\t\tmax-width: 500px;\n\t\t\tbox-shadow: 0 6px 32px rgba(0,0,0,0.24);\n\t\t\tposition: relative;\n\t\t\twidth: 90%;\n\t\t";const n=document.createElement("h3");n.className="cimo-progress-title",n.innerText=(0,e.__)("Optimizing your files","cimo-image-optimizer"),n.style.cssText="\n\t\t\tfont-size: 1.6em !important;\n\t\t\tfont-weight: 600 !important;\n\t\t\tmargin: 0 0 0.5em !important;\n\t\t",t.appendChild(n);const i=document.createElement("div");if(i.className="cimo-progress-subtitle",i.innerText=(0,e.__)("Preparing your files for upload…","cimo-image-optimizer"),i.style.cssText="\n\t\t\tmargin-bottom: 2em;\n\t\t",t.appendChild(i),this.errorNote=document.createElement("div"),this.errorNote.className="cimo-progress-error-note",this.errorNote.innerText=(0,e.__)("Some media files could not be optimized and were uploaded in their original format.","cimo-image-optimizer"),this.errorNote.style.cssText="\n\t\t\tdisplay: none;\n\t\t\tbackground: #fff3cd;\n\t\t\tcolor: #856404;\n\t\t\tborder: 1px solid #ffeeba;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t\tfont-size: 1em;\n\t\t",t.appendChild(this.errorNote),this.closeHandler){const e=document.createElement("button");e.className="cimo-progress-close",e.type="button",e.innerHTML="&times;",e.style.cssText="\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0.7em;\n\t\t\t\tright: 1em;\n\t\t\t\tbackground: transparent;\n\t\t\t\tborder: none;\n\t\t\t\tfont-size: 2em;\n\t\t\t\tcursor: pointer;\n\t\t\t\tcolor: #888;\n\t\t\t",e.addEventListener("click",()=>this._handleCloseClick()),t.appendChild(e)}this.progressBars=[],this.progressList=document.createElement("div"),this.progressList.className="cimo-progress-list",t.appendChild(this.progressList),this.modal.appendChild(t),document.body.appendChild(this.modal),this._renderProgressBars()}_renderProgressBars(){this.progressList.innerHTML="",this.progressBars=[],this.converters.forEach((t,e)=>{const n=document.createElement("div");n.className="cimo-progress-bar-container",n.style.cssText="\n\t\t\t\tmargin-bottom: 1em;\n\t\t\t\tpadding: 16px 16px 16px 70px;\n\t\t\t\tborder: 1px solid #e2e8f0;\n\t\t\t\tborder-radius: 12px;\n\t\t\t\tposition: relative;\n\t\t\t";const i=document.createElement("span");i.className="cimo-stat-icon",i.style.cssText="\n\t\t\t\tbackground: #16a2491a;\n        \t\tcolor: #16a249;\n\t\t\t\tpadding: 8px;\n\t\t\t\tborder-radius: 8px;\n\t\t\t\tmargin-bottom: 8px;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 16px;\n\t\t\t\ttop: 16px;\n\t\t\t";let s="";s=t.file&&t.file.type&&t.file.type.startsWith("video/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video-icon lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>':t.file&&t.file.type&&t.file.type.startsWith("audio/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-music-icon lucide-music"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image-icon lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',i.innerHTML=s,n.appendChild(i);const o=document.createElement("div");o.className="cimo-progress-label",o.innerText=t.file?.name||`File ${e+1}`,o.style.cssText="\n\t\t\t\tmargin-bottom: 0.2em;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tfont-weight: 600;\n\t\t\t\tmax-width: 80%;\n\t\t\t\twhite-space: nowrap;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t\toverflow: hidden;\n\t\t\t";const r=document.createElement("div");r.className="cimo-size-label",r.innerText=t.file&&t.file.size?t.file.size/1024/1024>=1?(t.file.size/1024/1024).toFixed(2)+" MB":(t.file.size/1024).toFixed(1)+" KB":"",r.style.cssText="\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t\tfont-size: 1em;\n\t\t\t";const a=document.createElement("div");a.style.cssText="\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: space-between;\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t";const l=document.createElement("div");l.className="cimo-progress-status-label",l.innerText="",l.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t\tcolor: #3b3b3b;\n\t\t\t";const c=document.createElement("div");c.className="cimo-percentage-label",c.innerText="0%",c.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t",a.appendChild(l),a.appendChild(c);const m=document.createElement("div");m.className="cimo-progress-bar-bg",m.style.cssText="\n\t\t\t\tbackground: #e8ecef;\n\t\t\t\tborder-radius: 5px;\n\t\t\t\theight: 8px;\n\t\t\t\twidth: 100%;\n\t\t\t\toverflow: hidden;\n\t\t\t";const d=document.createElement("div");d.className="cimo-progress-bar",d.style.cssText="\n\t\t\t\tbackground: linear-gradient(90deg, #00d8f0 0%, #2bc566 100%);\n\t\t\t\twidth: 0%;\n\t\t\t\theight: 100%;\n\t\t\t\ttransition: width 0.5s linear;\n\t\t\t\tborder-radius: 5px 0 0 5px;\n\t\t\t",d.sizeLabelEl=r,d.statusLabelEl=l,d.percentageLabelEl=c,m.appendChild(d),n.appendChild(o),n.appendChild(r),n.appendChild(a),n.appendChild(m),this.progressList.appendChild(n),this.progressBars.push(d)})}_startInterval(){this.interval||(this._updateProgress(),this.interval=setInterval(()=>this._updateProgress(),500))}_stopInterval(){this.interval&&(clearInterval(this.interval),this.interval=null)}_updateProgress(){let t=!0,e=!1;this.converters.forEach((n,i)=>{let s=100*n.progress;("number"!=typeof s||isNaN(s)||s<0)&&(s=0),s>=100&&(s=100),s<100&&(t=!1),n.errorMessage&&(e=!0,this.errorNote.style.display="block"),this.progressBars[i]&&(this.progressBars[i].statusLabelEl.style.cssText=`\n\t\t\t\t\tcolor: ${n.errorMessage?"#dc3545":"inherit"};\n\t\t\t\t`,this.progressBars[i].statusLabelEl.innerText=n.errorMessage||n.status,this.progressBars[i].style.width=s+"%",this.progressBars[i].percentageLabelEl.innerText=parseInt(s)+"%")}),t&&"block"===this.modal.style.display&&(e||setTimeout(()=>this.close(),750))}}function h(t){if(!t)return;if(!t.body)return;t.body.__cimo_dropzone_listener_attached||(t.body.addEventListener("drop",async e=>{if(e.__cimo_converted)return;const n=Array.from(e.dataTransfer.files).map(t=>a(t));if(!l(n))return;if(!(e.target.closest(".media-frame-uploader")||e.target.closest(".supports-drag-drop").querySelector(".media-frame-uploader")||e.target.closest(".media-upload-form")||e.target.closest(".editor-post-featured-image")||e.target.closest(".editor-styles-wrapper")||e.target.closest(".uploader-window")))return;let i;for(e.preventDefault(),e.stopPropagation();i=document.querySelector('.uploader-window[style*="display: block"]');)i.style.display="none";const s=new u(n,()=>{n.forEach(t=>t.cancel())});s.open();let o=!1;const r=await Promise.all(n.map(async t=>{try{return await t.convert()}catch(e){return o=!0,console.warn(e),{file:t.file,metadata:null}}})),c=r.map(t=>t.file),m=r.map(t=>t.metadata),p=new DataTransfer;if(c.forEach(t=>{p.items.add(t)}),await d(m),e.target?.classList.contains("components-drop-zone")){const n=t!==document,i=new Event("drop",{bubbles:!n});Object.defineProperty(i,"dataTransfer",{value:p,writable:!1}),i.__cimo_converted=!0,e.target.dispatchEvent(i)}else{const n=document.querySelector('.media-modal input[type="file"]')||document.querySelector('.media-upload-form input[type="file"]')||document.querySelector('input[type="file"]');if(n){n.files=p.files;const e=t!==document,i=new Event("change",{bubbles:!e});i.__cimo_converted=!0,n.dispatchEvent(i)}else{const t=new Event("drop",{bubbles:!0});Object.defineProperty(t,"dataTransfer",{value:p,writable:!1}),t.__cimo_converted=!0,e.target.dispatchEvent(t)}}o||s.close()},!0),t.body.__cimo_dropzone_listener_attached=!0)}function g(t){if(!window.wp&&!t)return;if(!t.body)return;t.body.__cimo_selectfiles_listener_attached||(t.body.addEventListener("change",async t=>{if("file"!==t.target.type)return;if(t.__cimo_converted)return;const e=Array.from(t.target.files).map(t=>a(t));if(!l(e))return;if(!(t.target.closest(".components-form-file-upload")||t.target.closest(".media-frame")||t.target.closest(".media-upload-form")||t.target.closest(".moxie-shim")))return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();const n=new u(e,()=>{e.forEach(t=>t.cancel())});n.open();let i=!1;const s=await Promise.all(e.map(async t=>{try{return await t.convert()}catch(e){return i=!0,console.warn(e),{file:t.file,metadata:null}}})),o=s.map(t=>t.file),r=s.map(t=>t.metadata),c=new DataTransfer;o.forEach(t=>{c.items.add(t)}),await d(r),t.target.files=c.files;const m=new Event("change",{bubbles:!0});m.__cimo_converted=!0,t.target.dispatchEvent(m),i||n.close()},!0),t.body.__cimo_selectfiles_listener_attached=!0)}function f(t,e=2,n=!1){if(0===t)return"0 Bytes";const i=e<0?0:e,s=Math.abs(t),o=Math.floor(Math.log(s)/Math.log(1024));let r=t<0?"-":"";return n&&(r="-"===r?"":"-"),r+parseFloat((s/Math.pow(1024,o)).toFixed(i))+" "+["Bytes","KB","MB","GB"][o]}function w({model:t,container:n}){if(!t||!n)return;if(n.querySelector(".cimo-media-manager-metadata"))return;let i=t.get("cimo")||null;var s;if(i&&0!==Object.keys(i).length||(s=t.get("originalImageName")||t.get("filename"),i=window.cimoMetadataCache?.[s?.replaceAll(/\s+/g,"-")]||null),!i)return;const o=document.createElement("div");o.className="cimo-media-manager-metadata";const r=function(t){if(!t)return"Media";const[e="media"]=t.split("/");switch(e.toLowerCase()){case"image":return"Image";case"video":return"Video";case"audio":return"Audio";default:return"Media"}}(i.convertedFormat||t.get("mime")||"");let a=`\n\t\t<div class="cimo-media-manager-metadata-title-container">\n\t\t\t<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 672 672" height="20" width="20">\n\t\t\t\t<path d="M132.5 132.5C182.4 82.5 253 56 336 56C419 56 489.6 82.5 539.5 132.5C589.4 182.5 616 253 616 336C616 419 589.5 489.6 539.5 539.5C489.5 589.4 419 616 336 616C253 616 182.4 589.5 132.5 539.5C82.6 489.5 56 419 56 336C56 253 82.5 182.4 132.5 132.5z"/>\n\t\t\t</svg>\n\t\t\t<h3 class="cimo-media-manager-metadata-title">\n\t\t\t\t${c((0,e.sprintf)((0,e.__)("%s Optimized by Cimo","cimo-image-optimizer"),r))}\n\t\t\t</h3>\n\t\t</div>\n\t\t<ul>\n\t`;const l=i.compressionSavings?(100-100*i.compressionSavings).toFixed(2):null,m=f(i.originalFilesize-i.convertedFilesize,1,!0);a+=`\n\t\t<li class="cimo-compression-savings ${c(l>0?"cimo-optimization-savings-up":"cimo-optimization-savings-down")}">\n\t\t\tSaved ${c(l)}%\n\t\t\t<span class="cimo-compression-savings-bytes">(${c(m)})</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-filesize-original">\n\t\t\tOriginal: <span class="cimo-value">${c(f(parseInt(i.originalFilesize)||0))}</span>\n\t\t</li>\n\t\t<li class="cimo-filesize-optimized">\n\t\t\tOptimized: <span class="cimo-value">${c(f(parseInt(i.convertedFilesize)||0))}</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-converted">\n\t\t\t🏞️ Converted to <span class="cimo-value">${c(function(t){if(!t)return"";const e=t.split("/"),n=e[1]||e[0]||"";return"webp"===n?"WebP":n.charAt(0).toUpperCase()+n.slice(1)}(i.convertedFormat))}</span>\n\t\t</li>\n\t`;let d="N/A";if(i.conversionTime){const t=parseFloat(i.conversionTime);d=t<1e3?`${t.toFixed(0)} ms`:t<6e4?`${(t/1e3).toFixed(1)} sec`:`${(t/6e4).toFixed(1)} min`}a+=`\n\t\t<li class="cimo-time">\n\t\t\t⚡️ Done in <span class="cimo-value">${c(d)}</span>\n\t\t</li>\n\t\t</ul>\n\t`,o.innerHTML=a,n.appendChild(o)}t(()=>{h(document),m(t=>{h(t)})}),t(()=>{g(document),m(t=>{g(t)})}),t(()=>{if("undefined"!=typeof wp&&wp.media&&wp.media.view&&wp.media.view.Attachment&&wp.media.view.Attachment.Details&&(wp.media.view.Attachment.Details=wp.media.view.Attachment.Details.extend({template(t){const e=wp.media.template("attachment-details")(t),n=document.createElement("div");n.innerHTML=e;const i=n.querySelector(".attachment-info");return w({model:t.model,container:i}),n.innerHTML}}),wp.media.view.Attachment.Details.TwoColumn)){const t=wp.media.view.Attachment.Details.TwoColumn;wp.media.view.Attachment.Details.TwoColumn=t.extend({render(){t.prototype.render.apply(this,arguments);const e=this.el.querySelector(".attachment-info > .details");return w({model:this.model,container:e}),this}})}})})();
     1(()=>{"use strict";function t(t){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",t):t())}const e=window.wp.i18n;class n{constructor(t,n={}){this.file=t,this.options=n,this._progress=0,this._status=(0,e.__)("Ready","cimo-image-optimizer"),this._errorMessage=null}static get mimeTypes(){throw new Error("mimeTypes getter must be implemented by subclass")}static supportsMimeType(t){if(!t||"string"!=typeof t)return!1;const e=this.mimeTypes;return!!Array.isArray(e)&&e.includes(t)}get status(){return this._status}get errorMessage(){return this._errorMessage}get progress(){return this._progress}static get showProgress(){return!0}get showProgress(){return this.constructor.showProgress}async convert(){throw new Error("convert() must be implemented by subclass")}cancel(){}}const i=window.wp.hooks,s=[{value:"webp",mimeType:"image/webp"},{value:"jpg",mimeType:"image/jpeg"},{value:"png",mimeType:"image/png"}];class o extends n{static get mimeTypes(){return(0,i.applyFilters)("cimo.imageConverter.mimeTypes",["image/jpeg","image/png","image/webp","image/jpg"])}static get showProgress(){return!1}calculateDimensions(t,e,n){const i=(n=n||{}).scale?n.scale:1,s=n.width?n.width:"auto",o=n.height?n.height:"auto",r=n.aspectRatio?n.aspectRatio:"auto",a=n.maxDimension?n.maxDimension:0;let l=t*i,c=e*i;if(a&&"number"==typeof a&&a>0){const t=Math.max(l,c);if(t>a){const e=a/t;l*=e,c*=e}}if("auto"!==s&&"number"==typeof s&&(l=s,"auto"===o&&(c=e/t*l)),"auto"!==o&&"number"==typeof o&&(c=o,"auto"===s&&(l=t/e*c)),"auto"!==r){if("custom"===r)return{width:l,height:c};const[t,e]=r.split(":").map(Number),n=t/e,i=l/c;if(Math.abs(i-n)>.01)if(i>n)l=c*n;else{const t=l;l=t,c=t/n}}return{width:Math.round(l),height:Math.round(c)}}async convertImage(t,e="webp",n={}){let o=(n=n||{}).quality?n.quality:.8,r=n.maxDimension?n.maxDimension:0;"string"==typeof o&&(o=parseFloat(o)/100,o||(o=.8)),"string"==typeof r&&(r=parseFloat(r));const a=await(0,i.applyFiltersAsync)("cimo.convertImage.prepare",t.file,e,n);return a&&(t.file=a),new Promise((n,i)=>{const a=new Image;let l=null;a.onload=async()=>{const t=document.createElement("canvas"),{width:c,height:m}=this.calculateDimensions(a.width,a.height,{maxDimension:r});t.width=c,t.height=m;const d=t.getContext("2d"),p=a.width/a.height,u=c/m;let h=a.height,g=a.width,f=0,w=0;Math.abs(p-u)>.01&&(p>u?(g=a.height*u,f=(a.width-g)/2):(h=a.width/u,w=(a.height-h)/2)),d.drawImage(a,f,w,g,h,0,0,c,m);const y=s.find(t=>t.value===e),v="webp"===e||"jpg"===e?o:void 0;t.toBlob(function(e){URL.revokeObjectURL(l),l=null,d.clearRect(0,0,t.width,t.height),t.width=0,t.height=0,e?n(e):i(new Error("Failed to convert image"))},y.mimeType,v)},a.onerror=()=>{l&&(URL.revokeObjectURL(l),l=null),i(new Error("Failed to load image"))},l=URL.createObjectURL(t.file),a.src=l})}async convert(){const t=this.file,e=this.options?.format||"webp";if(!t.type||!t.type.startsWith("image/"))return{file:t,metadata:null};const n=s.find(t=>t.value===e);if(n&&t.type===n.mimeType)return{file:t,metadata:null};const i=document.createElement("canvas");if(n&&!i.toDataURL(n.mimeType).startsWith(`data:${n.mimeType}`))return console.error("[Cimo] "+e+" is not supported by the browser, please use another modern browser"),{file:t,metadata:null};if("image/gif"===t.type){const e=await t.slice(0,51200).arrayBuffer(),n=new Uint8Array(e);let i=0;for(let e=0;e<n.length-2;e++)if(33===n[e]&&249===n[e+1]&&4===n[e+2]&&(i++,i>1))return{file:t,metadata:null}}const o={file:t};try{const i=performance.now(),s=await this.convertImage(o,e,{quality:this.options?.quality||.8,maxDimension:this.options?.maxDimension||0}),r=performance.now();if(s.size>t.size)throw new Error("Resulting image is bigger than the input, skipping conversion.");const a="jpeg"===e?"jpg":e,l=t.name.replace(/\.[^/.]+$/,"")+"."+a,c={filename:l,originalFormat:t.type,originalFilesize:t.size,convertedFormat:n.mimeType,convertedFilesize:s.size,conversionTime:r-i,compressionSavings:t.size>0?s.size/t.size:null};return{file:new(0,t.constructor)([s],l,{type:n.mimeType,lastModified:Date.now()}),metadata:c}}catch(t){throw new Error(`Failed to convert image: ${t.message}`)}}}class r extends n{static get showProgress(){return!1}async convert(){return{file:this.file,metadata:null}}}const a=t=>{let e=t;if(!e||"object"!=typeof e||"string"!=typeof e.name||"number"!=typeof e.size||"string"!=typeof e.type||"function"!=typeof e.slice)return new r(e);if(!(e instanceof File)){const t=e;e=new File(t?[t]:[],t?.name||"unknown",{type:t?.type||"application/octet-stream",lastModified:"number"==typeof t?.lastModified?t.lastModified:Date.now()})}if(e.type.startsWith("image/")){if(!function(t){const e={webp:"image/webp",avif:"image/avif"}[t.toLowerCase()]||(t.startsWith("image/")?t:null);if(!e)return!1;const n=document.createElement("canvas");n.width=1,n.height=1;try{return n.toDataURL(e).startsWith(`data:${e}`)}catch(t){return!1}}("webp"))return new r(e);if(o.supportsMimeType(e.type))return new o(e,{format:"webp",quality:window.cimoSettings?.webpQuality||.8,maxDimension:window.cimoSettings?.maxImageDimension||0})}return(0,i.applyFilters)("cimo.getFileConverter",null,e)||new r(e)};function l(t){return!t.every(t=>"NullConverter"===t.constructor.name)}function c(t){return("string"!=typeof t?String(t):t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/`/g,"&#96;")}function m(t,e="editor-canvas"){const n=()=>{const n=document.querySelector(`iframe[name="${e}"]`);if(n&&n.contentDocument){const e=()=>{n.contentDocument.body?t(n.contentDocument):setTimeout(e,50)};"loading"===n.contentDocument.readyState?n.addEventListener("load",()=>{e()}):e()}};n();let i=0;const s=setInterval(()=>{i>=10?clearInterval(s):(i++,n())},1e3),o=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&("IFRAME"===t.tagName&&t.name===e||t.querySelector&&t.querySelector(`iframe[name="${e}"]`))&&n()})})});return o.observe(document.body,{childList:!0,subtree:!0}),o}const d=t=>{if(!Array.isArray(t))return Promise.resolve();const e=t.filter(t=>null!==t);return 0===e.length?Promise.resolve():(e.forEach(t=>{t.filename&&p(t.filename,t)}),new Promise((t,n)=>{fetch(`${window.cimoSettings?.restUrl||"/wp-json/cimo/v1/"}metadata`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-WP-Nonce":window.cimoSettings?.nonce||window.wpApiSettings?.nonce},body:JSON.stringify({metadata:e}),credentials:"same-origin"}).then(t=>t.ok?t.json():t.json().then(e=>{throw new Error(e.message||t.statusText)})).then(e=>{t(e)}).catch(t=>{console.error(`Failed to save metadata for filenames: [${e.map(t=>t.filename).join(", ")}]:`,t),n(new Error(`Failed to save metadata: ${t.message}`))})}))},p=(t,e)=>{window.cimoMetadataCache||(window.cimoMetadataCache={}),window.cimoMetadataCache[t.replaceAll(/\s+/g,"-")]={...e}};class u{constructor(t=[],e=null){this.converters=Array.isArray(t)?t.filter(t=>!0===t?.showProgress):[],this.closeHandler="function"==typeof e?e:null,this.interval=null,this.modal=null,this.progressBars=[],this._setupModal()}open(){this.modal&&0!==this.converters.length&&(this.modal.style.display="flex",this._startInterval())}_handleCloseClick(){confirm((0,e.__)("Closing this dialog will cancel the uploading process. Are you sure you want to continue?","cimo-image-optimizer"))&&(this.closeHandler&&this.closeHandler(),this.close())}close(){this.modal&&0!==this.converters.length&&setTimeout(()=>{this.modal.style.display="none",this._stopInterval(),this.modal.remove(),this.modal=null},300)}_setupModal(){this.modal=document.createElement("div"),this.modal.className="cimo-progress-modal",this.modal.style.cssText="\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100vw;\n\t\t\theight: 100vh;\n\t\t\tbackground: rgba(0,0,0,0.35);\n\t\t\tdisplay: none;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tz-index: 9999999;\n\t\t",this.modal.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()});const t=document.createElement("div");t.className="cimo-progress-wrapper",t.style.cssText="\n\t\t\tbackground: #fff;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 2em 2em 1em 2em;\n\t\t\tmax-width: 500px;\n\t\t\tbox-shadow: 0 6px 32px rgba(0,0,0,0.24);\n\t\t\tposition: relative;\n\t\t\twidth: 90%;\n\t\t";const n=document.createElement("h3");n.className="cimo-progress-title",n.innerText=(0,e.__)("Optimizing your files","cimo-image-optimizer"),n.style.cssText="\n\t\t\tfont-size: 1.6em !important;\n\t\t\tfont-weight: 600 !important;\n\t\t\tmargin: 0 0 0.5em !important;\n\t\t",t.appendChild(n);const i=document.createElement("div");if(i.className="cimo-progress-subtitle",i.innerText=(0,e.__)("Preparing your files for upload…","cimo-image-optimizer"),i.style.cssText="\n\t\t\tmargin-bottom: 2em;\n\t\t",t.appendChild(i),this.errorNote=document.createElement("div"),this.errorNote.className="cimo-progress-error-note",this.errorNote.innerText=(0,e.__)("Some media files could not be optimized and were uploaded in their original format.","cimo-image-optimizer"),this.errorNote.style.cssText="\n\t\t\tdisplay: none;\n\t\t\tbackground: #fff3cd;\n\t\t\tcolor: #856404;\n\t\t\tborder: 1px solid #ffeeba;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t\tfont-size: 1em;\n\t\t",t.appendChild(this.errorNote),this.closeHandler){const e=document.createElement("button");e.className="cimo-progress-close",e.type="button",e.innerHTML="&times;",e.style.cssText="\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0.7em;\n\t\t\t\tright: 1em;\n\t\t\t\tbackground: transparent;\n\t\t\t\tborder: none;\n\t\t\t\tfont-size: 2em;\n\t\t\t\tcursor: pointer;\n\t\t\t\tcolor: #888;\n\t\t\t",e.addEventListener("click",()=>this._handleCloseClick()),t.appendChild(e)}this.progressBars=[],this.progressList=document.createElement("div"),this.progressList.className="cimo-progress-list",t.appendChild(this.progressList),this.modal.appendChild(t),document.body.appendChild(this.modal),this._renderProgressBars()}_renderProgressBars(){this.progressList.innerHTML="",this.progressBars=[],this.converters.forEach((t,e)=>{const n=document.createElement("div");n.className="cimo-progress-bar-container",n.style.cssText="\n\t\t\t\tmargin-bottom: 1em;\n\t\t\t\tpadding: 16px 16px 16px 70px;\n\t\t\t\tborder: 1px solid #e2e8f0;\n\t\t\t\tborder-radius: 12px;\n\t\t\t\tposition: relative;\n\t\t\t";const i=document.createElement("span");i.className="cimo-stat-icon",i.style.cssText="\n\t\t\t\tbackground: #16a2491a;\n        \t\tcolor: #16a249;\n\t\t\t\tpadding: 8px;\n\t\t\t\tborder-radius: 8px;\n\t\t\t\tmargin-bottom: 8px;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 16px;\n\t\t\t\ttop: 16px;\n\t\t\t";let s="";s=t.file&&t.file.type&&t.file.type.startsWith("video/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video-icon lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>':t.file&&t.file.type&&t.file.type.startsWith("audio/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-music-icon lucide-music"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image-icon lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',i.innerHTML=s,n.appendChild(i);const o=document.createElement("div");o.className="cimo-progress-label",o.innerText=t.file?.name||`File ${e+1}`,o.style.cssText="\n\t\t\t\tmargin-bottom: 0.2em;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tfont-weight: 600;\n\t\t\t\tmax-width: 80%;\n\t\t\t\twhite-space: nowrap;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t\toverflow: hidden;\n\t\t\t";const r=document.createElement("div");r.className="cimo-size-label",r.innerText=t.file&&t.file.size?t.file.size/1024/1024>=1?(t.file.size/1024/1024).toFixed(2)+" MB":(t.file.size/1024).toFixed(1)+" KB":"",r.style.cssText="\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t\tfont-size: 1em;\n\t\t\t";const a=document.createElement("div");a.style.cssText="\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: space-between;\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t";const l=document.createElement("div");l.className="cimo-progress-status-label",l.innerText="",l.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t\tcolor: #3b3b3b;\n\t\t\t";const c=document.createElement("div");c.className="cimo-percentage-label",c.innerText="0%",c.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t",a.appendChild(l),a.appendChild(c);const m=document.createElement("div");m.className="cimo-progress-bar-bg",m.style.cssText="\n\t\t\t\tbackground: #e8ecef;\n\t\t\t\tborder-radius: 5px;\n\t\t\t\theight: 8px;\n\t\t\t\twidth: 100%;\n\t\t\t\toverflow: hidden;\n\t\t\t";const d=document.createElement("div");d.className="cimo-progress-bar",d.style.cssText="\n\t\t\t\tbackground: linear-gradient(90deg, #00d8f0 0%, #2bc566 100%);\n\t\t\t\twidth: 0%;\n\t\t\t\theight: 100%;\n\t\t\t\ttransition: width 0.5s linear;\n\t\t\t\tborder-radius: 5px 0 0 5px;\n\t\t\t",d.sizeLabelEl=r,d.statusLabelEl=l,d.percentageLabelEl=c,m.appendChild(d),n.appendChild(o),n.appendChild(r),n.appendChild(a),n.appendChild(m),this.progressList.appendChild(n),this.progressBars.push(d)})}_startInterval(){this.interval||(this._updateProgress(),this.interval=setInterval(()=>this._updateProgress(),500))}_stopInterval(){this.interval&&(clearInterval(this.interval),this.interval=null)}_updateProgress(){let t=!0,e=!1;this.converters.forEach((n,i)=>{let s=100*n.progress;("number"!=typeof s||isNaN(s)||s<0)&&(s=0),s>=100&&(s=100),s<100&&(t=!1),n.errorMessage&&(e=!0,this.errorNote.style.display="block"),this.progressBars[i]&&(this.progressBars[i].statusLabelEl.style.cssText=`\n\t\t\t\t\tcolor: ${n.errorMessage?"#dc3545":"inherit"};\n\t\t\t\t`,this.progressBars[i].statusLabelEl.innerText=n.errorMessage||n.status,this.progressBars[i].style.width=s+"%",this.progressBars[i].percentageLabelEl.innerText=parseInt(s)+"%")}),t&&"block"===this.modal.style.display&&(e||setTimeout(()=>this.close(),750))}}function h(t){if(!t)return;if(!t.body)return;t.body.__cimo_dropzone_listener_attached||(t.body.addEventListener("drop",async e=>{if(e.__cimo_converted)return;const n=Array.from(e.dataTransfer.files).map(t=>a(t));if(!l(n))return;if(!(e.target.closest(".media-frame-uploader")||e.target.closest(".supports-drag-drop")?.querySelector(".media-frame-uploader")||e.target.closest(".media-upload-form")||e.target.closest(".editor-post-featured-image")||e.target.closest(".editor-styles-wrapper")||e.target.closest(".uploader-window")))return;let i;for(e.preventDefault(),e.stopPropagation();i=document.querySelector('.uploader-window[style*="display: block"]');)i.style.display="none";const s=new u(n,()=>{n.forEach(t=>t.cancel())});s.open();let o=!1;const r=await Promise.all(n.map(async t=>{try{return await t.convert()}catch(e){return o=!0,console.warn(e),{file:t.file,metadata:null}}})),c=r.map(t=>t.file),m=r.map(t=>t.metadata),p=new DataTransfer;if(c.forEach(t=>{p.items.add(t)}),await d(m),e.target?.classList.contains("components-drop-zone")){const n=t!==document,i=new Event("drop",{bubbles:!n});Object.defineProperty(i,"dataTransfer",{value:p,writable:!1}),i.__cimo_converted=!0,e.target.dispatchEvent(i)}else{const n=document.querySelector('.media-modal input[type="file"]')||document.querySelector('.media-upload-form input[type="file"]')||document.querySelector('input[type="file"]');if(n){n.files=p.files;const e=t!==document,i=new Event("change",{bubbles:!e});i.__cimo_converted=!0,n.dispatchEvent(i)}else{const t=new Event("drop",{bubbles:!0});Object.defineProperty(t,"dataTransfer",{value:p,writable:!1}),t.__cimo_converted=!0,e.target.dispatchEvent(t)}}o||s.close()},!0),t.body.__cimo_dropzone_listener_attached=!0)}function g(t){if(!window.wp&&!t)return;if(!t.body)return;t.body.__cimo_selectfiles_listener_attached||(t.body.addEventListener("change",async t=>{if("file"!==t.target.type)return;if(t.__cimo_converted)return;const e=Array.from(t.target.files).map(t=>a(t));if(!l(e))return;if(!(t.target.closest(".components-form-file-upload")||t.target.closest(".media-frame")||t.target.closest(".media-upload-form")||t.target.closest(".moxie-shim")))return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();const n=new u(e,()=>{e.forEach(t=>t.cancel())});n.open();let i=!1;const s=await Promise.all(e.map(async t=>{try{return await t.convert()}catch(e){return i=!0,console.warn(e),{file:t.file,metadata:null}}})),o=s.map(t=>t.file),r=s.map(t=>t.metadata),c=new DataTransfer;o.forEach(t=>{c.items.add(t)}),await d(r),t.target.files=c.files;const m=new Event("change",{bubbles:!0});m.__cimo_converted=!0,t.target.dispatchEvent(m),i||n.close()},!0),t.body.__cimo_selectfiles_listener_attached=!0)}function f(t,e=2,n=!1){if(0===t)return"0 Bytes";const i=e<0?0:e,s=Math.abs(t),o=Math.floor(Math.log(s)/Math.log(1024));let r=t<0?"-":"";return n&&(r="-"===r?"":"-"),r+parseFloat((s/Math.pow(1024,o)).toFixed(i))+" "+["Bytes","KB","MB","GB"][o]}function w({model:t,container:n}){if(!t||!n)return;if(n.querySelector(".cimo-media-manager-metadata"))return;let i=t.get("cimo")||null;var s;if(i&&0!==Object.keys(i).length||(s=t.get("originalImageName")||t.get("filename"),i=window.cimoMetadataCache?.[s?.replaceAll(/\s+/g,"-")]||null),!i)return;const o=document.createElement("div");o.className="cimo-media-manager-metadata";const r=function(t){if(!t)return"Media";const[e="media"]=t.split("/");switch(e.toLowerCase()){case"image":return"Image";case"video":return"Video";case"audio":return"Audio";default:return"Media"}}(i.convertedFormat||t.get("mime")||"");let a=`\n\t\t<div class="cimo-media-manager-metadata-title-container">\n\t\t\t<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 672 672" height="20" width="20">\n\t\t\t\t<path d="M132.5 132.5C182.4 82.5 253 56 336 56C419 56 489.6 82.5 539.5 132.5C589.4 182.5 616 253 616 336C616 419 589.5 489.6 539.5 539.5C489.5 589.4 419 616 336 616C253 616 182.4 589.5 132.5 539.5C82.6 489.5 56 419 56 336C56 253 82.5 182.4 132.5 132.5z"/>\n\t\t\t</svg>\n\t\t\t<h3 class="cimo-media-manager-metadata-title">\n\t\t\t\t${c((0,e.sprintf)((0,e.__)("%s Optimized by Cimo","cimo-image-optimizer"),r))}\n\t\t\t</h3>\n\t\t</div>\n\t\t<ul>\n\t`;const l=i.compressionSavings?(100-100*i.compressionSavings).toFixed(2):null,m=f(i.originalFilesize-i.convertedFilesize,1,!0);a+=`\n\t\t<li class="cimo-compression-savings ${c(l>0?"cimo-optimization-savings-up":"cimo-optimization-savings-down")}">\n\t\t\tSaved ${c(l)}%\n\t\t\t<span class="cimo-compression-savings-bytes">(${c(m)})</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-filesize-original">\n\t\t\tOriginal: <span class="cimo-value">${c(f(parseInt(i.originalFilesize)||0))}</span>\n\t\t</li>\n\t\t<li class="cimo-filesize-optimized">\n\t\t\tOptimized: <span class="cimo-value">${c(f(parseInt(i.convertedFilesize)||0))}</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-converted">\n\t\t\t🏞️ Converted to <span class="cimo-value">${c(function(t){if(!t)return"";const e=t.split("/"),n=e[1]||e[0]||"";return"webp"===n?"WebP":n.charAt(0).toUpperCase()+n.slice(1)}(i.convertedFormat))}</span>\n\t\t</li>\n\t`;let d="N/A";if(i.conversionTime){const t=parseFloat(i.conversionTime);d=t<1e3?`${t.toFixed(0)} ms`:t<6e4?`${(t/1e3).toFixed(1)} sec`:`${(t/6e4).toFixed(1)} min`}a+=`\n\t\t<li class="cimo-time">\n\t\t\t⚡️ Done in <span class="cimo-value">${c(d)}</span>\n\t\t</li>\n\t\t</ul>\n\t`,o.innerHTML=a,n.appendChild(o)}t(()=>{h(document),m(t=>{h(t)})}),t(()=>{g(document),m(t=>{g(t)})}),t(()=>{if("undefined"!=typeof wp&&wp.media&&wp.media.view&&wp.media.view.Attachment&&wp.media.view.Attachment.Details&&(wp.media.view.Attachment.Details=wp.media.view.Attachment.Details.extend({template(t){const e=wp.media.template("attachment-details")(t),n=document.createElement("div");n.innerHTML=e;const i=n.querySelector(".attachment-info");return w({model:t.model,container:i}),n.innerHTML}}),wp.media.view.Attachment.Details.TwoColumn)){const t=wp.media.view.Attachment.Details.TwoColumn;wp.media.view.Attachment.Details.TwoColumn=t.extend({render(){t.prototype.render.apply(this,arguments);const e=this.el.querySelector(".attachment-info > .details");return w({model:this.model,container:e}),this}})}})})();
  • cimo-image-optimizer/tags/1.2.3/cimo.php

    r3448132 r3478972  
    88 * License: GPLv2 or later
    99 * Text Domain: cimo-image-optimizer
    10  * Version: 1.2.2
     10 * Version: 1.2.3
    1111 *
    1212 * @fs_premium_only /freemius.php, /freemius/, /lib/freemius-php-sdk
  • cimo-image-optimizer/tags/1.2.3/composer.json

    r3352840 r3478972  
    44    "type": "wordpress-plugin",
    55    "license": "GPL-2.0-or-later",
    6     "require": {},
     6    "require": {
     7        "enshrined/svg-sanitize": "^0.22.0"
     8    },
    79    "require-dev": {
    810        "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
     
    1416            "phpcs --standard=phpcs.xml.dist -s"
    1517        ]
     18    },
     19    "config": {
     20        "allow-plugins": {
     21            "dealerdirect/phpcodesniffer-composer-installer": true
     22        }
    1623    }
    1724}
    18 
    19 
  • cimo-image-optimizer/tags/1.2.3/readme.txt

    r3448132 r3478972  
    33Tags: image, optimization, compress, convert, webp
    44Requires at least: 6.7.4
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable tag: 1.2.2
     7Stable tag: 1.2.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    205205== Changelog ==
    206206
     207= 1.2.3 =
     208
     209* New: Added SVG Optimization (premium)
     210* New: Added HEIC image format support (premium)
     211* Fixed: Dropping files stopped working in some instances #32
     212
    207213= 1.2.2 =
    208214
  • cimo-image-optimizer/tags/1.2.3/src/admin/class-admin.php

    r3402030 r3478972  
    109109                                ],
    110110                                'audio_quality' => [
     111                                    'type' => 'integer',
     112                                ],
     113
     114                                // SVG Optimization settings
     115                                'svg_upload' => [
     116                                    'type' => 'integer',
     117                                ],
     118                                'svg_optimization_enabled' => [
    111119                                    'type' => 'integer',
    112120                                ],
     
    281289            }
    282290
     291            // Sanitize svg_upload
     292            if ( isset( $options['svg_upload'] ) ) {
     293                $sanitized['svg_upload'] = $options['svg_upload'] ? 1 : 0;
     294            }
     295            // Sanitize svg_optimization_enabled
     296            if ( isset( $options['svg_optimization_enabled'] ) ) {
     297                $sanitized['svg_optimization_enabled'] = $options['svg_optimization_enabled'] ? 1 : 0;
     298            }
     299
    283300            return $sanitized;
    284301        }
  • cimo-image-optimizer/tags/1.2.3/src/admin/class-script-loader.php

    r3402030 r3478972  
    9292                    'audioOptimizationEnabled' => isset( $settings['audio_optimization_enabled'] ) ? (int) $settings['audio_optimization_enabled'] : 1,
    9393                    'audioQuality' => ! empty( $settings['audio_quality'] ) ? (int) $settings['audio_quality'] : 128,
     94                    'svgUpload' => isset( $settings['svg_upload'] ) ? (int) $settings['svg_upload'] : 0,
     95                    'svgOptimizationEnabled' => isset( $settings['svg_optimization_enabled'] ) ? (int) $settings['svg_optimization_enabled'] : 1,
    9496                ]
    9597            );
  • cimo-image-optimizer/trunk/build/admin/admin-page-styles-rtl.css

    r3402030 r3478972  
    1 .cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-left:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-left:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-right:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
     1.cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-left:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list,.cimo-premium-features-list hr{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-left:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-right:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
  • cimo-image-optimizer/trunk/build/admin/admin-page-styles.asset.php

    r3402030 r3478972  
    1 <?php return array('dependencies' => array(), 'version' => 'c394a42532050d284802');
     1<?php return array('dependencies' => array(), 'version' => 'e0cbf9e945202176c3d4');
  • cimo-image-optimizer/trunk/build/admin/admin-page-styles.css

    r3402030 r3478972  
    1 .cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-right:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-right:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-left:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
     1.cimo-admin-settings-wrap{align-items:flex-start;display:grid;gap:24px;grid-template-columns:minmax(0,750px) 300px 1fr;margin-top:20px;margin-inline-end:20px}.cimo-loading{color:#646970;font-size:16px;padding:60px 20px;text-align:center}.cimo-header{grid-column:1/4}.cimo-header,.cimo-settings-section,.cimo-settings-sidebar{background:#fff;border-radius:16px;display:flex;flex-direction:column;gap:38px;padding:30px}.cimo-logo{align-self:start;margin-right:24px}.cimo-admin-settings{max-width:800px}.cimo-settings-section{gap:0;.notice{margin:1.5em 0 0}}.cimo-stats-section{display:grid;gap:16px;grid-template-columns:2fr 1fr 1fr 1fr;text-align:center;h3{margin:0}}.cimo-stat-value{font-size:2.2em;font-weight:700;line-height:1.1;white-space:nowrap}.cimo-stat-label,.cimo-stats-details{color:#65758b;line-height:1.1}.cimo-stat-icon{background:#3c83f61a;border-radius:8px;color:#3c83f6;margin-bottom:8px;padding:8px;svg{display:block}}.cimo-stats-column{align-items:center;display:flex;flex-direction:column;gap:8px;&:nth-child(3) .cimo-stat-icon{background:#ef43431a;color:#ef4343}&:nth-child(4) .cimo-stat-icon{background:#16a2491a;color:#16a249}}.cimo-stats-column-big{align-items:start;text-align:start;.cimo-stat-value{font-size:3.2em}}.cimo-stats-column-small{align-items:center;justify-content:center}.cimo-stats-main{align-items:center;display:flex;gap:16px}.cimo-premium-feature-label,.cimo-stat-percentage{background:#16a24933;border-radius:8px;color:#16a249;font-weight:700;line-height:1;padding:8px 12px}.cimo-settings-section-wrapper{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-settings-header{align-items:flex-start;display:flex;gap:20px;justify-content:space-between;margin-bottom:30px}.cimo-submit-buttons{align-items:center;display:flex;gap:12px}.cimo-settings-section h2{align-items:center;border:0;display:flex;gap:8px;justify-content:start;margin:0;padding:0;[aria-hidden=true]{display:flex}}.cimo-settings-sidebar{background:#faf6ff;border:1px solid #d4bbf1;.components-button{border-radius:6px;justify-content:center;width:100%}}.cimo-settings-form{align-items:start;display:grid;gap:24px;grid-template-columns:1fr}.cimo-sidebar-heading{display:flex;gap:12px;h2{margin:0}}.cimo-sidebar-heading-icon{align-items:center;aspect-ratio:1/1;background:#eaddf7;border-radius:8px;color:#9333ea;display:flex;justify-content:center;padding:8px}.cimo-premium-features-list,.cimo-premium-features-list hr{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.cimo-premium-features-list li{align-items:baseline;display:flex;gap:12px}.cimo-premium-icon{align-items:center;background:#eaddf7;border-radius:6px;color:#9333ea;display:flex;padding:4px;position:relative;top:2px;svg{height:16px;width:16px}}.cimo-premium-cta{margin-top:24px;text-align:center;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#29a739}.cimo-premium-guarantee{align-items:center;color:#65758b;display:flex;font-size:13px;gap:6px;justify-content:center;margin-top:10px}.cimo-premium-guarantee svg{margin-right:4px}.cimo-rating-buttons,.cimo-save-button{border-radius:6px;--wp-components-color-accent:#31bf43;--wp-components-color-accent-darker-10:#249433;--wp-components-color-accent-darker-20:#196a24}.cimo-rating-buttons{display:flex;gap:16px}.cimo-rating-no-thanks{--wp-components-color-accent:#666;--wp-components-color-accent-darker-10:#555;--wp-components-color-accent-darker-20:#333}.cimo-rating-notice{background:#3c83f61a;border:1px solid #4e80ac;border-radius:16px;box-shadow:0 4px 18px 0 #3c83f610;color:#23425e;position:relative}.cimo-rating-title{margin-top:0!important}.cimo-rating-description{margin-bottom:2em}.cimo-rating-notice .cimo-rating-description,.cimo-rating-notice .cimo-rating-title{color:#23425e!important}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-rate-now{--wp-components-color-accent:#3c83f6;--wp-components-color-accent-darker-10:#2163b0;--wp-components-color-accent-darker-20:#153a64;background:#3c83f6;border:none;border-radius:6px;color:#fff;font-weight:600;gap:8px}.cimo-rating-rate-now svg{fill:none;height:18px;width:18px}.cimo-rating-notice .cimo-rating-buttons .cimo-rating-no-thanks{background:#0000;border:1.5px solid #3c83f6;border-radius:6px;box-shadow:none!important;color:#3c83f6;font-weight:600}.cimo-reset-button{--wp-components-color-accent:#555;align-self:flex-end}.cimo-submit-section{background:#fff;border-radius:16px;bottom:0;margin-bottom:0!important;padding:16px;position:sticky;z-index:9}.cimo-setting-field{margin-bottom:24px}.cimo-setting-field .description{color:#646970;font-size:13px;line-height:1.5;margin:8px 0 0}.cimo-setting-field .description strong{color:#1d2327;font-weight:600}.cimo-image-sizes-list{background:#fafafa;border:1px solid #e2e1e1;border-radius:16px;margin-left:40px;margin-top:16px;padding:24px}.cimo-image-sizes-heading{color:#1d2327;font-size:11px;font-weight:500;margin:0 0 8px;padding:0;text-transform:uppercase}.cimo-image-sizes-list>.description{color:#757575;font-size:12px;font-style:normal;margin:0 0 1.5em}.cimo-setting-field .description+.description{margin-top:8px}@media (max-width:782px){.cimo-admin-settings-wrap{align-items:stretch;display:flex;flex-direction:column}.cimo-settings-form{order:2}.cimo-stats-section{grid-template-columns:1fr 1fr;row-gap:40px}.cimo-stats-column,.cimo-stats-main{align-items:center!important}.cimo-admin-settings{max-width:100%}.cimo-stats-card{padding:24px}.cimo-stats-main{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:24px}.cimo-stats-value{font-size:36px}.cimo-stats-details{gap:16px;grid-template-columns:1fr}.cimo-stat-item{padding:16px}}.cimo-premium-feature-label{display:flex;gap:4px;svg{height:14px;width:14px}}.cimo-settings-premium-placeholder{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-block:20px;.components-button{margin-top:12px;--wp-components-color-accent:#555!important;--wp-admin-theme-color-darker-20:#333!important}}.cimo-settings-section:has(.cimo-settings-premium-placeholder){opacity:.65}.components-toggle-group-control{--wp-components-color-foreground:var(--wp-admin-theme-color,#3858e9)}.cimo-settings-section-info{align-items:center;background:#ffffff80;box-shadow:0 0 30px #35bd4738;display:flex;flex-direction:row;gap:8px;svg{color:#259f35}}
  • cimo-image-optimizer/trunk/build/admin/admin-page.asset.php

    r3402030 r3478972  
    1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '48f89642dbaf07f34e19');
     1<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'f8ea9175ba446d4ccf17');
  • cimo-image-optimizer/trunk/build/admin/admin-page.js

    r3402030 r3478972  
    1 (()=>{"use strict";var e={n:i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return e.d(a,{a}),a},d:(i,a)=>{for(var t in a)e.o(a,t)&&!e.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:a[t]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{var i;e.g.importScripts&&(i=e.g.location+"");var a=e.g.document;if(!i&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(i=a.currentScript.src),!i)){var t=a.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!i||!/^http(s?):/.test(i));)i=t[o--].src}if(!i)throw new Error("Automatic publicPath is not supported in this browser");i=i.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=i+"../"})();const i=window.wp.element,a=window.wp.components,t=window.wp.hooks,o=window.wp.apiFetch;var s=e.n(o);const n=window.wp.i18n,l=e.p+"images/logo-long.cca876ef.webp",r=window.ReactJSXRuntime,m=(0,t.applyFilters)("cimo.admin.settings.buildType","free"),c=()=>{const[e,t]=(0,i.useState)({webpQuality:80,maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[],lqipEnabled:0,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:"",videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"",audioOptimizationEnabled:1,audioQuality:128}),[o,c]=(0,i.useState)([]),[p,u]=(0,i.useState)(!1),[h,g]=(0,i.useState)(""),[x,_]=(0,i.useState)(!0),[v,w]=(0,i.useState)(!1),[j,b]=(0,i.useState)(()=>"undefined"!=typeof window&&"1"===window.cimoAdmin?.ratingDismissed);(0,i.useEffect)(()=>{(async()=>{window.cimoAdmin&&window.cimoAdmin.imageSizes&&c(window.cimoAdmin.imageSizes),await z(),_(!1)})()},[]);const z=async()=>{try{const e=(await s()({path:"/wp/v2/settings"})).cimo_options||{},i={webpQuality:void 0!==e.webp_quality?e.webp_quality:80,maxImageDimension:e.max_image_dimension||"",disableWpScaling:void 0!==e.disable_wp_scaling?e.disable_wp_scaling:1,disableThumbnailGeneration:void 0!==e.disable_thumbnail_generation?e.disable_thumbnail_generation:0,thumbnailSizes:e.thumbnail_sizes||[],lqipEnabled:void 0!==e.lqip_enabled?e.lqip_enabled:0,lqipPulseSpeed:void 0!==e.lqip_pulse_speed?e.lqip_pulse_speed:"",lqipBrightness:void 0!==e.lqip_brightness?e.lqip_brightness:"",lqipFadeDuration:void 0!==e.lqip_fade_duration?e.lqip_fade_duration:"",videoOptimizationEnabled:void 0!==e.video_optimization_enabled?e.video_optimization_enabled:1,videoQuality:void 0!==e.video_quality?e.video_quality:3,videoMaxResolution:e.video_max_resolution||"",audioOptimizationEnabled:void 0!==e.audio_optimization_enabled?e.audio_optimization_enabled:1,audioQuality:void 0!==e.audio_quality?e.audio_quality:128};t(i),w(!1)}catch(e){}},f=(0,i.useCallback)((e,i)=>{t(a=>({...a,[e]:i})),w(!0)},[]),y=(0,i.useCallback)(async()=>{b(!0);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_rating_dismissed:"1"}})}catch(e){b(!1)}},[]);return x?(0,r.jsx)("div",{className:"cimo-admin-settings-wrap",children:(0,r.jsx)("div",{className:"cimo-loading",children:(0,r.jsx)("p",{children:(0,n.__)("Loading settings…","cimo-image-optimizer")})})}):(0,r.jsxs)("div",{className:"cimo-admin-settings-wrap",children:[(0,r.jsxs)("div",{className:"cimo-header",children:[(0,r.jsx)("img",{className:"cimo-logo",src:l,alt:(0,n.__)("Cimo Logo","cimo-image-optimizer"),height:"35"}),(0,r.jsxs)("div",{className:"cimo-stats-section",children:[(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-big",children:[(0,r.jsx)("h3",{children:(0,n.__)("Total Storage Saved","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-stats-main",children:[(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.total_storage_saved}),(0,r.jsxs)("span",{className:"cimo-stat-percentage",children:["↓ ",window.cimoAdmin.stats.percentage_saved,"% ",(0,n.__)("reduction","cimo-image-optimizer")]})]}),(0,r.jsx)("div",{className:"cimo-stats-details",children:(0,n.__)("Across all optimized media files","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image w-5 h-5 text-primary","data-lov-id":"src/pages/Index.tsx:66:22","data-lov-name":"Image","data-component-path":"src/pages/Index.tsx","data-component-line":"66","data-component-file":"Index.tsx","data-component-name":"Image","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-primary%22%7D",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.media_optimized}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Media Files Optimized","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-hard-drive w-5 h-5 text-destructive","data-lov-id":"src/pages/Index.tsx:80:22","data-lov-name":"HardDrive","data-component-path":"src/pages/Index.tsx","data-component-line":"80","data-component-file":"Index.tsx","data-component-name":"HardDrive","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-destructive%22%7D",children:[(0,r.jsx)("line",{x1:"22",x2:"2",y1:"12",y2:"12"}),(0,r.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"16",y2:"16"}),(0,r.jsx)("line",{x1:"10",x2:"10.01",y1:"16",y2:"16"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.before}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Original Size","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-zap w-5 h-5 text-accent","data-lov-id":"src/pages/Index.tsx:94:22","data-lov-name":"Zap","data-component-path":"src/pages/Index.tsx","data-component-line":"94","data-component-file":"Index.tsx","data-component-name":"Zap","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-accent%22%7D",children:(0,r.jsx)("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.after}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Optimized Size","cimo-image-optimizer")})]})]})]}),(()=>{const e=window.cimoAdmin?.stats?.total_storage_saved;let i=!1;if("string"==typeof e){const a=e.match(/^([\d.]+)\s*([a-zA-Z]+)/);if(a){const e=parseFloat(a[1]);"MB"===a[2].toUpperCase()&&e>100&&(i=!0)}}return i&&!j?(0,r.jsx)("div",{className:"cimo-header cimo-rating-notice",children:(0,r.jsxs)("div",{className:"cimo-rating-notice-content",children:[(0,r.jsx)("h3",{className:"cimo-rating-title",children:(0,n.__)("Loving the instant storage & server resource savings?","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"cimo-rating-description",children:(0,n.sprintf)(
     1(()=>{"use strict";var e={n:i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return e.d(a,{a}),a},d:(i,a)=>{for(var t in a)e.o(a,t)&&!e.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:a[t]})},o:(e,i)=>Object.prototype.hasOwnProperty.call(e,i)};(()=>{var i;globalThis.importScripts&&(i=globalThis.location+"");var a=globalThis.document;if(!i&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(i=a.currentScript.src),!i)){var t=a.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!i||!/^http(s?):/.test(i));)i=t[o--].src}if(!i)throw new Error("Automatic publicPath is not supported in this browser");i=i.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=i+"../"})();const i=window.wp.element,a=window.wp.components,t=window.wp.hooks,o=window.wp.apiFetch;var s=e.n(o);const n=window.wp.i18n,l=e.p+"images/logo-long.cca876ef.webp",r=window.ReactJSXRuntime,m=(0,t.applyFilters)("cimo.admin.settings.buildType","free"),c=()=>{const[e,t]=(0,i.useState)({webpQuality:80,maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[],lqipEnabled:0,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:"",videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"",audioOptimizationEnabled:1,audioQuality:128,svgUpload:0,svgOptimizationEnabled:1}),[o,c]=(0,i.useState)([]),[p,h]=(0,i.useState)(!1),[u,g]=(0,i.useState)(""),[x,_]=(0,i.useState)(!0),[v,w]=(0,i.useState)(!1),[j,b]=(0,i.useState)(()=>"undefined"!=typeof window&&"1"===window.cimoAdmin?.ratingDismissed);(0,i.useEffect)(()=>{(async()=>{window.cimoAdmin&&window.cimoAdmin.imageSizes&&c(window.cimoAdmin.imageSizes),await z(),_(!1)})()},[]);const z=async()=>{try{const e=(await s()({path:"/wp/v2/settings"})).cimo_options||{},i={webpQuality:void 0!==e.webp_quality?e.webp_quality:80,maxImageDimension:e.max_image_dimension||"",disableWpScaling:void 0!==e.disable_wp_scaling?e.disable_wp_scaling:1,disableThumbnailGeneration:void 0!==e.disable_thumbnail_generation?e.disable_thumbnail_generation:0,thumbnailSizes:e.thumbnail_sizes||[],lqipEnabled:void 0!==e.lqip_enabled?e.lqip_enabled:0,lqipPulseSpeed:void 0!==e.lqip_pulse_speed?e.lqip_pulse_speed:"",lqipBrightness:void 0!==e.lqip_brightness?e.lqip_brightness:"",lqipFadeDuration:void 0!==e.lqip_fade_duration?e.lqip_fade_duration:"",videoOptimizationEnabled:void 0!==e.video_optimization_enabled?e.video_optimization_enabled:1,videoQuality:void 0!==e.video_quality?e.video_quality:3,videoMaxResolution:e.video_max_resolution||"",audioOptimizationEnabled:void 0!==e.audio_optimization_enabled?e.audio_optimization_enabled:1,audioQuality:void 0!==e.audio_quality?e.audio_quality:128,svgUpload:void 0!==e.svg_upload?e.svg_upload:0,svgOptimizationEnabled:void 0!==e.svg_optimization_enabled?e.svg_optimization_enabled:1};t(i),w(!1)}catch(e){}},f=(0,i.useCallback)((e,i)=>{t(a=>({...a,[e]:i})),w(!0)},[]),y=(0,i.useCallback)(async()=>{b(!0);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_rating_dismissed:"1"}})}catch(e){b(!1)}},[]);return x?(0,r.jsx)("div",{className:"cimo-admin-settings-wrap",children:(0,r.jsx)("div",{className:"cimo-loading",children:(0,r.jsx)("p",{children:(0,n.__)("Loading settings…","cimo-image-optimizer")})})}):(0,r.jsxs)("div",{className:"cimo-admin-settings-wrap",children:[(0,r.jsxs)("div",{className:"cimo-header",children:[(0,r.jsx)("img",{className:"cimo-logo",src:l,alt:(0,n.__)("Cimo Logo","cimo-image-optimizer"),height:"35"}),(0,r.jsxs)("div",{className:"cimo-stats-section",children:[(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-big",children:[(0,r.jsx)("h3",{children:(0,n.__)("Total Storage Saved","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-stats-main",children:[(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.total_storage_saved}),(0,r.jsxs)("span",{className:"cimo-stat-percentage",children:["↓ ",window.cimoAdmin.stats.percentage_saved,"% ",(0,n.__)("reduction","cimo-image-optimizer")]})]}),(0,r.jsx)("div",{className:"cimo-stats-details",children:(0,n.__)("Across all optimized media files","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image w-5 h-5 text-primary","data-lov-id":"src/pages/Index.tsx:66:22","data-lov-name":"Image","data-component-path":"src/pages/Index.tsx","data-component-line":"66","data-component-file":"Index.tsx","data-component-name":"Image","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-primary%22%7D",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.media_optimized}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Media Files Optimized","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-hard-drive w-5 h-5 text-destructive","data-lov-id":"src/pages/Index.tsx:80:22","data-lov-name":"HardDrive","data-component-path":"src/pages/Index.tsx","data-component-line":"80","data-component-file":"Index.tsx","data-component-name":"HardDrive","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-destructive%22%7D",children:[(0,r.jsx)("line",{x1:"22",x2:"2",y1:"12",y2:"12"}),(0,r.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"16",y2:"16"}),(0,r.jsx)("line",{x1:"10",x2:"10.01",y1:"16",y2:"16"})]})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.before}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Original Size","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-stats-column cimo-stats-column-small",children:[(0,r.jsx)("div",{className:"cimo-stat-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-zap w-5 h-5 text-accent","data-lov-id":"src/pages/Index.tsx:94:22","data-lov-name":"Zap","data-component-path":"src/pages/Index.tsx","data-component-line":"94","data-component-file":"Index.tsx","data-component-name":"Zap","data-component-content":"%7B%22className%22%3A%22w-5%20h-5%20text-accent%22%7D",children:(0,r.jsx)("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})})}),(0,r.jsx)("span",{className:"cimo-stat-value",children:window.cimoAdmin.stats.after}),(0,r.jsx)("span",{className:"cimo-stat-label",children:(0,n.__)("Optimized Size","cimo-image-optimizer")})]})]})]}),(()=>{const e=window.cimoAdmin?.stats?.total_storage_saved;let i=!1;if("string"==typeof e){const a=e.match(/^([\d.]+)\s*([a-zA-Z]+)/);if(a){const e=parseFloat(a[1]);"MB"===a[2].toUpperCase()&&e>100&&(i=!0)}}return i&&!j?(0,r.jsx)("div",{className:"cimo-header cimo-rating-notice",children:(0,r.jsxs)("div",{className:"cimo-rating-notice-content",children:[(0,r.jsx)("h3",{className:"cimo-rating-title",children:(0,n.__)("Loving the instant storage & server resource savings?","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"cimo-rating-description",children:(0,n.sprintf)(
    22// translators: %s is replaced with the total storage saved (e.g. "1.5 GB")
    33// translators: %s is replaced with the total storage saved (e.g. "1.5 GB")
    4 (0,n.__)("You've saved over %s! If Cimo is helping your site, please consider leaving us a 5-star rating and help others discover Cimo!","cimo-image-optimizer"),window.cimoAdmin.stats.total_storage_saved)}),(0,r.jsxs)("div",{className:"cimo-rating-buttons",children:[(0,r.jsxs)(a.Button,{variant:"primary",href:"https://wordpress.org/support/plugin/cimo-image-optimizer/reviews/#new-post",target:"_blank",rel:"noopener noreferrer",className:"cimo-rating-rate-now",__next40pxDefaultSize:!0,children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-star-icon lucide-star",children:(0,r.jsx)("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})}),(0,n.__)("Rate Now","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-rating-no-thanks",onClick:y,__next40pxDefaultSize:!0,children:(0,n.__)("Don't show this again, I've already rated","cimo-image-optimizer")})]})]})}):null})(),(0,r.jsxs)("form",{onSubmit:async i=>{i.preventDefault(),u(!0),g(""),w(!1);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_options:{webp_quality:parseInt(e.webpQuality)||0,max_image_dimension:parseInt(e.maxImageDimension)||0,disable_wp_scaling:e.disableWpScaling,disable_thumbnail_generation:e.disableThumbnailGeneration,thumbnail_sizes:e.thumbnailSizes,lqip_enabled:e.lqipEnabled,lqip_pulse_speed:parseFloat(e.lqipPulseSpeed)||0,lqip_brightness:parseFloat(e.lqipBrightness)||0,lqip_fade_duration:parseFloat(e.lqipFadeDuration)||0,video_optimization_enabled:e.videoOptimizationEnabled,video_quality:e.videoQuality||0,video_max_resolution:e.videoMaxResolution||"",audio_optimization_enabled:e.audioOptimizationEnabled,audio_quality:e.audioQuality||0}}}),g((0,n.__)("Settings saved successfully!","cimo-image-optimizer"))}catch(e){g((0,n.__)("Error saving settings.","cimo-image-optimizer"))}finally{u(!1),setTimeout(()=>g(""),3e3)}},className:"cimo-settings-form",children:[(0,r.jsxs)("div",{className:"cimo-settings-section-wrapper",children:[(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-section-info",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-info-icon lucide-info",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 16v-4"}),(0,r.jsx)("path",{d:"M12 8h.01"})]}),"free"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")}),"premium"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images, videos and audio files are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Image Optimization Settings","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,webpQuality:80,maxImageDimension:1920,disableWpScaling:1,disableThumbnailGeneration:1,thumbnailSizes:[]}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"webpQuality",label:(0,n.__)("WebP Image Quality","cimo-image-optimizer"),value:e.webpQuality||"",onChange:e=>f("webpQuality",e||""),min:"1",max:"100",step:"1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:80,help:(0,n.__)("Set the quality / compression level for generated .webp images. Default is 80%. Higher values mean better quality and larger file size; lower values reduce file size with more compression but lower quality.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.TextControl,{label:(0,n.__)("Maximum Image Dimension","cimo-image-optimizer"),type:"number",value:e.maxImageDimension,onChange:e=>f("maxImageDimension",e),help:(0,n.__)("Maximum width or height in pixels for uploaded images. Images exceeding this dimension will be automatically resized while preserving aspect ratio. Leave empty to disable resizing. We recommend a value of 1920px.","cimo-image-optimizer"),__next40pxDefaultSize:!0})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Automatic Image Scaling","cimo-image-optimizer"),checked:1===e.disableWpScaling,onChange:e=>f("disableWpScaling",e?1:0),help:(0,n.__)("WordPress automatically scales images larger than 2560px. Disable this option to allow uploads of any size.","cimo-image-optimizer")})}),(0,r.jsxs)("div",{className:"cimo-setting-field",children:[(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Thumbnail Generation","cimo-image-optimizer"),checked:0===e.disableThumbnailGeneration,onChange:e=>f("disableThumbnailGeneration",e?0:1),help:(0,n.__)("By default, WordPress generates multiple image sizes (thumbnail, medium, large, etc.) when you upload images. Disable this option to save disk space.","cimo-image-optimizer")}),0===e.disableThumbnailGeneration&&(0,r.jsxs)("div",{className:"cimo-image-sizes-list",children:[(0,r.jsx)("h4",{className:"cimo-image-sizes-heading",children:(0,n.__)("Individual Image Sizes","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"description",children:(0,n.__)("You can turn off generation for individual image sizes:","cimo-image-optimizer")}),o.map(i=>{const o=!e.thumbnailSizes.includes(i.name);return(0,r.jsx)(a.ToggleControl,{label:i.name,checked:o,onChange:e=>{return a=i.name,o=e,void t(e=>{let i=[...e.thumbnailSizes];return o?i=i.filter(e=>e!==a):i.includes(a)||i.push(a),{...e,thumbnailSizes:i}});var a,o}},i.name)}),0===o.length&&(0,r.jsx)("div",{className:"notice notice-warning cimo-image-sizes-warning",children:(0,r.jsx)("p",{children:(0,n.__)("No image sizes detected. If you just re-enabled thumbnail generation, please save settings and refresh this page.","cimo-image-optimizer")})})]})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,webpQuality:"",maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[]}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Low Quality Image Placeholder Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Show a low-quality preview while the image loads, then fade in the final image.","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable LQIP","cimo-image-optimizer"),checked:1===e.lqipEnabled,onChange:e=>f("lqipEnabled",e?1:0),help:(0,n.__)("Turn this option on to enable LQIP for all images. LQIP is only supported by Native Image Blocks.","cimo-image-optimizer")})}),1===e.lqipEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipPulseSpeed",label:(0,n.__)("Placeholder Pulse Speed (seconds)","cimo-image-optimizer"),value:e.lqipPulseSpeed||"",onChange:e=>f("lqipPulseSpeed",e||""),min:"0.1",max:"5",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:2.5,help:(0,n.__)("Set the speed of the pulse animation when the image is loading. Default is 2.5s.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipBrightness",label:(0,n.__)("Placeholder Pulse Brightness","cimo-image-optimizer"),value:e.lqipBrightness||"",onChange:e=>f("lqipBrightness",e||""),min:"0.5",max:"1.5",step:"0.05",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:1.3,help:(0,n.__)("Set the brightness of the pulse animation when the image is loading. Default is 1.3x brightness.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipFadeDuration",label:(0,n.__)("Image Fade In Duration (seconds)","cimo-image-optimizer"),value:e.lqipFadeDuration||"",onChange:e=>f("lqipFadeDuration",e||""),min:"0.1",max:"3",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:.5,help:(0,n.__)("Set the duration of the fade in animation when the image is loaded. Default is 0.5s.","cimo-image-optimizer")})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video-icon lucide-video",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,n.__)("Video Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]}),"premium"===m&&(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"1440"}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize video files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Video Optimization","cimo-image-optimizer"),checked:1===e.videoOptimizationEnabled,onChange:e=>f("videoOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload videos without optimizing them.","cimo-image-optimizer")})}),1===e.videoOptimizationEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Quality","cimo-image-optimizer"),value:e.videoQuality||3,onChange:e=>f("videoQuality",e),isBlock:!0,help:(0,n.__)("Set the quality / compression level for optimized .MP4 video uploads. Default is Medium (Balanced). Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:1,label:(0,n.__)("Very Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:2,label:(0,n.__)("Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:3,label:(0,n.__)("Medium","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:4,label:(0,n.__)("High Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:5,label:(0,n.__)("Very High Quality","cimo-image-optimizer")})]})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Maximum Resolution","cimo-image-optimizer"),value:e.videoMaxResolution||"",onChange:e=>f("videoMaxResolution",e),isBlock:!0,help:(0,n.__)("Set the maximum resolution for optimized video uploads. If the video uploaded is bigger than this, the video will not be resized down to this maximum resolution. Default is the video will not be resized.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"",label:(0,n.__)("Keep original","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"480",label:"480p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"720",label:"720p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1080",label:"1080p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1440",label:"1440p (2K)"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"2160",label:"2160p (4K)"})]})})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:"",videoMaxResolution:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music-icon lucide-music",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,n.__)("Audio Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize audio files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Audio Optimization","cimo-image-optimizer"),checked:1===e.audioOptimizationEnabled,onChange:e=>f("audioOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload audio files without optimizing them.","cimo-image-optimizer")})}),1===e.audioOptimizationEnabled&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{label:(0,n.__)("Audio Quality (kbps)","cimo-image-optimizer"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:e.audioQuality||128,onChange:e=>f("audioQuality",e),min:"32",max:"320",step:"32",help:(0,n.__)("Set the quality / compression level for optimized .MP3 audio uploads. Default is 128kbps. Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer")})})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,audioOptimizationEnabled:1,audioQuality:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsx)("div",{className:"cimo-setting-field cimo-submit-section",children:(0,r.jsxs)("div",{className:"cimo-submit-buttons",children:[(0,r.jsx)(a.Button,{variant:"primary",className:"cimo-save-button",disabled:p,__next40pxDefaultSize:!0,onClick:e=>{e.preventDefault(),p||document.querySelector("form").dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))},children:p?(0,n.__)("Saving…","cimo-image-optimizer"):(0,n.__)("Save Changes","cimo-image-optimizer")}),v&&(0,r.jsx)("span",{className:"cimo-unsaved-note",children:(0,n.__)("You have unsaved changes","cimo-image-optimizer")}),h&&(0,r.jsx)("p",{children:h})]})})]}),"free"===m&&(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-sidebar",children:[(0,r.jsxs)("div",{className:"cimo-sidebar-heading",children:[(0,r.jsx)("div",{className:"cimo-sidebar-heading-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-crown-icon lucide-crown",children:[(0,r.jsx)("path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z"}),(0,r.jsx)("path",{d:"M5 21h14"})]})}),(0,r.jsx)("h2",{children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),(0,r.jsx)("p",{className:"cimo-premium-intro",children:(0,n.__)("Optimize more things and get premium support for a faster, happier site.","cimo-image-optimizer")}),(0,r.jsxs)("ul",{className:"cimo-premium-features-list",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:310:20","data-lov-name":"Video","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"310","data-component-file":"WordPressAdmin.tsx","data-component-name":"Video","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize videos on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:316:20","data-lov-name":"Music","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"316","data-component-file":"WordPressAdmin.tsx","data-component-name":"Music","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize audio on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Low Quality Image Placeholder","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-icon customizable lucide-infinity-icon lucide-infinity lucide-icon customizable",children:(0,r.jsx)("path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8"})})}),(0,r.jsx)("span",{children:(0,n.__)("Still without limits","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-premium-cta",children:[(0,r.jsx)(a.Button,{href:"https://wpcimo.com/pricing",variant:"primary",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade Now","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-premium-guarantee",children:[(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#16a249",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M8 13.5l2.5 2.5L16 9"})]}),(0,n.__)("30-day money back guarantee","cimo-image-optimizer")]})]})]})]})},d=e=>(0,r.jsxs)("div",{className:"cimo-settings-premium-placeholder",children:[e.label,(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-premium-cta",href:"https://wpcimo.com/pricing",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),p=document.getElementById("cimo-admin-settings");p&&(0,i.createRoot)(p).render((0,r.jsx)(c,{}))})();
     4(0,n.__)("You've saved over %s! If Cimo is helping your site, please consider leaving us a 5-star rating and help others discover Cimo!","cimo-image-optimizer"),window.cimoAdmin.stats.total_storage_saved)}),(0,r.jsxs)("div",{className:"cimo-rating-buttons",children:[(0,r.jsxs)(a.Button,{variant:"primary",href:"https://wordpress.org/support/plugin/cimo-image-optimizer/reviews/#new-post",target:"_blank",rel:"noopener noreferrer",className:"cimo-rating-rate-now",__next40pxDefaultSize:!0,children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-star-icon lucide-star",children:(0,r.jsx)("path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"})}),(0,n.__)("Rate Now","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-rating-no-thanks",onClick:y,__next40pxDefaultSize:!0,children:(0,n.__)("Don't show this again, I've already rated","cimo-image-optimizer")})]})]})}):null})(),(0,r.jsxs)("form",{onSubmit:async i=>{i.preventDefault(),h(!0),g(""),w(!1);try{await s()({path:"/wp/v2/settings",method:"POST",data:{cimo_options:{webp_quality:parseInt(e.webpQuality)||0,max_image_dimension:parseInt(e.maxImageDimension)||0,disable_wp_scaling:e.disableWpScaling,disable_thumbnail_generation:e.disableThumbnailGeneration,thumbnail_sizes:e.thumbnailSizes,lqip_enabled:e.lqipEnabled,lqip_pulse_speed:parseFloat(e.lqipPulseSpeed)||0,lqip_brightness:parseFloat(e.lqipBrightness)||0,lqip_fade_duration:parseFloat(e.lqipFadeDuration)||0,video_optimization_enabled:e.videoOptimizationEnabled,video_quality:e.videoQuality||0,video_max_resolution:e.videoMaxResolution||"",audio_optimization_enabled:e.audioOptimizationEnabled,audio_quality:e.audioQuality||0,svg_upload:e.svgUpload,svg_optimization_enabled:e.svgOptimizationEnabled}}}),g((0,n.__)("Settings saved successfully!","cimo-image-optimizer"))}catch(e){g((0,n.__)("Error saving settings.","cimo-image-optimizer"))}finally{h(!1),setTimeout(()=>g(""),3e3)}},className:"cimo-settings-form",children:[(0,r.jsxs)("div",{className:"cimo-settings-section-wrapper",children:[(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-section-info",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-info-icon lucide-info",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 16v-4"}),(0,r.jsx)("path",{d:"M12 8h.01"})]}),"free"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")}),"premium"===m&&(0,r.jsx)("span",{children:(0,n.__)("Your images, videos and audio files are instantly optimized within your browser as you upload — only the optimized versions ever touch your site!","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Image Optimization Settings","cimo-image-optimizer")]}),(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,webpQuality:80,maxImageDimension:1920,disableWpScaling:1,disableThumbnailGeneration:1,thumbnailSizes:[]}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"webpQuality",label:(0,n.__)("WebP Image Quality","cimo-image-optimizer"),value:e.webpQuality||"",onChange:e=>f("webpQuality",e||""),min:"1",max:"100",step:"1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:80,help:(0,n.__)("Set the quality / compression level for generated .webp images. Default is 80%. Higher values mean better quality and larger file size; lower values reduce file size with more compression but lower quality.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.TextControl,{label:(0,n.__)("Maximum Image Dimension","cimo-image-optimizer"),type:"number",value:e.maxImageDimension,onChange:e=>f("maxImageDimension",e),help:(0,n.__)("Maximum width or height in pixels for uploaded images. Images exceeding this dimension will be automatically resized while preserving aspect ratio. Leave empty to disable resizing. We recommend a value of 1920px.","cimo-image-optimizer"),__next40pxDefaultSize:!0})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Automatic Image Scaling","cimo-image-optimizer"),checked:1===e.disableWpScaling,onChange:e=>f("disableWpScaling",e?1:0),help:(0,n.__)("WordPress automatically scales images larger than 2560px. Disable this option to allow uploads of any size.","cimo-image-optimizer")})}),(0,r.jsxs)("div",{className:"cimo-setting-field",children:[(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("WordPress Thumbnail Generation","cimo-image-optimizer"),checked:0===e.disableThumbnailGeneration,onChange:e=>f("disableThumbnailGeneration",e?0:1),help:(0,n.__)("By default, WordPress generates multiple image sizes (thumbnail, medium, large, etc.) when you upload images. Disable this option to save disk space.","cimo-image-optimizer")}),0===e.disableThumbnailGeneration&&(0,r.jsxs)("div",{className:"cimo-image-sizes-list",children:[(0,r.jsx)("h4",{className:"cimo-image-sizes-heading",children:(0,n.__)("Individual Image Sizes","cimo-image-optimizer")}),(0,r.jsx)("p",{className:"description",children:(0,n.__)("You can turn off generation for individual image sizes:","cimo-image-optimizer")}),o.map(i=>{const o=!e.thumbnailSizes.includes(i.name);return(0,r.jsx)(a.ToggleControl,{label:i.name,checked:o,onChange:e=>{return a=i.name,o=e,void t(e=>{let i=[...e.thumbnailSizes];return o?i=i.filter(e=>e!==a):i.includes(a)||i.push(a),{...e,thumbnailSizes:i}});var a,o}},i.name)}),0===o.length&&(0,r.jsx)("div",{className:"notice notice-warning cimo-image-sizes-warning",children:(0,r.jsx)("p",{children:(0,n.__)("No image sizes detected. If you just re-enabled thumbnail generation, please save settings and refresh this page.","cimo-image-optimizer")})})]})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,webpQuality:"",maxImageDimension:"",disableWpScaling:1,disableThumbnailGeneration:0,thumbnailSizes:[]}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,n.__)("Low Quality Image Placeholder Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Show a low-quality preview while the image loads, then fade in the final image.","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable LQIP","cimo-image-optimizer"),checked:1===e.lqipEnabled,onChange:e=>f("lqipEnabled",e?1:0),help:(0,n.__)("Turn this option on to enable LQIP for all images. LQIP is only supported by Native Image Blocks.","cimo-image-optimizer")})}),1===e.lqipEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipPulseSpeed",label:(0,n.__)("Placeholder Pulse Speed (seconds)","cimo-image-optimizer"),value:e.lqipPulseSpeed||"",onChange:e=>f("lqipPulseSpeed",e||""),min:"0.1",max:"5",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:2.5,help:(0,n.__)("Set the speed of the pulse animation when the image is loading. Default is 2.5s.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipBrightness",label:(0,n.__)("Placeholder Pulse Brightness","cimo-image-optimizer"),value:e.lqipBrightness||"",onChange:e=>f("lqipBrightness",e||""),min:"0.5",max:"1.5",step:"0.05",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:1.3,help:(0,n.__)("Set the brightness of the pulse animation when the image is loading. Default is 1.3x brightness.","cimo-image-optimizer")})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{id:"lqipFadeDuration",label:(0,n.__)("Image Fade In Duration (seconds)","cimo-image-optimizer"),value:e.lqipFadeDuration||"",onChange:e=>f("lqipFadeDuration",e||""),min:"0.1",max:"3",step:"0.1",__next40pxDefaultSize:!0,allowReset:!0,initialPosition:.5,help:(0,n.__)("Set the duration of the fade in animation when the image is loaded. Default is 0.5s.","cimo-image-optimizer")})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,lqipPulseSpeed:"",lqipBrightness:"",lqipFadeDuration:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video-icon lucide-video",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,n.__)("Video Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]}),"premium"===m&&(0,r.jsx)(a.Button,{variant:"secondary",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:3,videoMaxResolution:"1440"}))},children:(0,n.__)("Recommended","cimo-image-optimizer")})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize video files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Video Optimization","cimo-image-optimizer"),checked:1===e.videoOptimizationEnabled,onChange:e=>f("videoOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload videos without optimizing them.","cimo-image-optimizer")})}),1===e.videoOptimizationEnabled&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Quality","cimo-image-optimizer"),value:e.videoQuality||3,onChange:e=>f("videoQuality",e),isBlock:!0,help:(0,n.__)("Set the quality / compression level for optimized .MP4 video uploads. Default is Medium (Balanced). Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:1,label:(0,n.__)("Very Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:2,label:(0,n.__)("Low Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:3,label:(0,n.__)("Medium","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:4,label:(0,n.__)("High Quality","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:5,label:(0,n.__)("Very High Quality","cimo-image-optimizer")})]})}),(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsxs)(a.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,n.__)("Video Maximum Resolution","cimo-image-optimizer"),value:e.videoMaxResolution||"",onChange:e=>f("videoMaxResolution",e),isBlock:!0,help:(0,n.__)("Set the maximum resolution for optimized video uploads. If the video uploaded is bigger than this, the video will not be resized down to this maximum resolution. Default is the video will not be resized.","cimo-image-optimizer"),children:[(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"",label:(0,n.__)("Keep original","cimo-image-optimizer")}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"480",label:"480p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"720",label:"720p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1080",label:"1080p"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"1440",label:"1440p (2K)"}),(0,r.jsx)(a.__experimentalToggleGroupControlOption,{value:"2160",label:"2160p (4K)"})]})})]}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,videoOptimizationEnabled:1,videoQuality:"",videoMaxResolution:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music-icon lucide-music",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,n.__)("Audio Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize audio files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable Audio Optimization","cimo-image-optimizer"),checked:1===e.audioOptimizationEnabled,onChange:e=>f("audioOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload audio files without optimizing them.","cimo-image-optimizer")})}),1===e.audioOptimizationEnabled&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.RangeControl,{label:(0,n.__)("Audio Quality (kbps)","cimo-image-optimizer"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:e.audioQuality||128,onChange:e=>f("audioQuality",e),min:"32",max:"320",step:"32",help:(0,n.__)("Set the quality / compression level for optimized .MP3 audio uploads. Default is 128kbps. Lower quality means a smaller file size and lower quality, higher quality means a higher quality but larger file size.","cimo-image-optimizer")})})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,audioOptimizationEnabled:1,audioQuality:""}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-settings-section",style:{gridColumn:"1 / 2"},children:[(0,r.jsxs)("div",{className:"cimo-settings-header",children:[(0,r.jsxs)("h2",{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-file-image-icon lucide-file-image",children:[(0,r.jsx)("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),(0,r.jsx)("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),(0,r.jsx)("circle",{cx:"10",cy:"12",r:"2"}),(0,r.jsx)("path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22"})]})}),(0,n.__)("SVG Optimization Settings","cimo-image-optimizer")]}),"free"===m&&(0,r.jsxs)("span",{className:"cimo-premium-feature-label",children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-lock-icon lucide-lock",children:[(0,r.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,n.__)("Premium","cimo-image-optimizer")]})]}),"free"===m&&(0,r.jsx)(d,{label:(0,n.__)("Upgrade to Premium to compress and optimize SVG files on upload","cimo-image-optimizer")}),"premium"===m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable SVG uploads","cimo-image-optimizer"),checked:1===e.svgUpload,onChange:e=>f("svgUpload",e?1:0),help:(0,n.__)("Allow SVG files to be uploaded in the media library. WordPress has this option disabled by default","cimo-image-optimizer")})}),1===e.svgUpload&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"cimo-setting-field",children:(0,r.jsx)(a.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Enable SVG Optimization","cimo-image-optimizer"),checked:1===e.svgOptimizationEnabled,onChange:e=>f("svgOptimizationEnabled",e?1:0),help:(0,n.__)("Turn this option off to upload SVG files without optimizing them.","cimo-image-optimizer")})})}),(0,r.jsx)(a.Button,{variant:"tertiary",className:"cimo-reset-button",onClick:()=>{t(e=>({...e,svgUpload:0,svgOptimizationEnabled:1}))},children:(0,n.__)("Reset to Default","cimo-image-optimizer")})]})]})]}),(0,r.jsx)("div",{className:"cimo-setting-field cimo-submit-section",children:(0,r.jsxs)("div",{className:"cimo-submit-buttons",children:[(0,r.jsx)(a.Button,{variant:"primary",className:"cimo-save-button",disabled:p,__next40pxDefaultSize:!0,onClick:e=>{e.preventDefault(),p||document.querySelector("form").dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))},children:p?(0,n.__)("Saving…","cimo-image-optimizer"):(0,n.__)("Save Changes","cimo-image-optimizer")}),v&&(0,r.jsx)("span",{className:"cimo-unsaved-note",children:(0,n.__)("You have unsaved changes","cimo-image-optimizer")}),u&&(0,r.jsx)("p",{children:u})]})})]}),"free"===m&&(0,r.jsxs)("div",{className:"cimo-settings-section cimo-settings-sidebar",children:[(0,r.jsxs)("div",{className:"cimo-sidebar-heading",children:[(0,r.jsx)("div",{className:"cimo-sidebar-heading-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-crown-icon lucide-crown",children:[(0,r.jsx)("path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z"}),(0,r.jsx)("path",{d:"M5 21h14"})]})}),(0,r.jsx)("h2",{children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),(0,r.jsx)("p",{className:"cimo-premium-intro",children:(0,n.__)("Optimize more things and get premium support for a faster, happier site.","cimo-image-optimizer")}),(0,r.jsxs)("ul",{className:"cimo-premium-features-list",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-smartphone-icon lucide-smartphone",children:[(0,r.jsx)("rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M12 18h.01"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Support for HEIC image format","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-image-icon lucide-image",children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,r.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Low Quality Image Placeholder","cimo-image-optimizer")})]}),(0,r.jsx)("hr",{}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-video h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:310:20","data-lov-name":"Video","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"310","data-component-file":"WordPressAdmin.tsx","data-component-name":"Video","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),(0,r.jsx)("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize videos on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-music h-3 w-3 text-purple-600","data-lov-id":"src/components/WordPressAdmin.tsx:316:20","data-lov-name":"Music","data-component-path":"src/components/WordPressAdmin.tsx","data-component-line":"316","data-component-file":"WordPressAdmin.tsx","data-component-name":"Music","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%20text-purple-600%22%7D",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize audio on upload","cimo-image-optimizer")})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-file-code-icon lucide-file-code",children:[(0,r.jsx)("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),(0,r.jsx)("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),(0,r.jsx)("path",{d:"M10 12.5 8 15l2 2.5"}),(0,r.jsx)("path",{d:"m14 12.5 2 2.5-2 2.5"})]})}),(0,r.jsx)("span",{children:(0,n.__)("Optimize SVG files on upload","cimo-image-optimizer")})]}),(0,r.jsx)("hr",{}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"cimo-premium-icon",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-icon customizable lucide-infinity-icon lucide-infinity lucide-icon customizable",children:(0,r.jsx)("path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8"})})}),(0,r.jsx)("span",{children:(0,n.__)("Still without limits","cimo-image-optimizer")})]})]}),(0,r.jsxs)("div",{className:"cimo-premium-cta",children:[(0,r.jsx)(a.Button,{href:"https://wpcimo.com/pricing",variant:"primary",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade Now","cimo-image-optimizer")}),(0,r.jsxs)("div",{className:"cimo-premium-guarantee",children:[(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#16a249",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M8 13.5l2.5 2.5L16 9"})]}),(0,n.__)("30-day money back guarantee","cimo-image-optimizer")]})]})]})]})},d=e=>(0,r.jsxs)("div",{className:"cimo-settings-premium-placeholder",children:[e.label,(0,r.jsx)(a.Button,{variant:"secondary",className:"cimo-premium-cta",href:"https://wpcimo.com/pricing",target:"_blank",rel:"noopener noreferrer",children:(0,n.__)("Upgrade to Premium","cimo-image-optimizer")})]}),p=document.getElementById("cimo-admin-settings");p&&(0,i.createRoot)(p).render((0,r.jsx)(c,{}))})();
  • cimo-image-optimizer/trunk/build/admin/index.asset.php

    r3448132 r3478972  
    1 <?php return array('dependencies' => array('wp-hooks', 'wp-i18n'), 'version' => '6344fc3a5d4fb7fae14b');
     1<?php return array('dependencies' => array('wp-hooks', 'wp-i18n'), 'version' => 'b5f864d04db75cb35099');
  • cimo-image-optimizer/trunk/build/admin/index.js

    r3448132 r3478972  
    1 (()=>{"use strict";function t(t){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",t):t())}const e=window.wp.i18n;class n{constructor(t,n={}){this.file=t,this.options=n,this._progress=0,this._status=(0,e.__)("Ready","cimo-image-optimizer"),this._errorMessage=null}static get mimeTypes(){throw new Error("mimeTypes getter must be implemented by subclass")}static supportsMimeType(t){if(!t||"string"!=typeof t)return!1;const e=this.mimeTypes;return!!Array.isArray(e)&&e.includes(t)}get status(){return this._status}get errorMessage(){return this._errorMessage}get progress(){return this._progress}static get showProgress(){return!0}get showProgress(){return this.constructor.showProgress}async convert(){throw new Error("convert() must be implemented by subclass")}cancel(){}}const i=[{value:"webp",mimeType:"image/webp"},{value:"jpg",mimeType:"image/jpeg"},{value:"png",mimeType:"image/png"}];class s extends n{static get mimeTypes(){return["image/jpeg","image/png","image/webp","image/jpg"]}static get showProgress(){return!1}calculateDimensions(t,e,n){const i=(n=n||{}).scale?n.scale:1,s=n.width?n.width:"auto",o=n.height?n.height:"auto",r=n.aspectRatio?n.aspectRatio:"auto",a=n.maxDimension?n.maxDimension:0;let l=t*i,c=e*i;if(a&&"number"==typeof a&&a>0){const t=Math.max(l,c);if(t>a){const e=a/t;l*=e,c*=e}}if("auto"!==s&&"number"==typeof s&&(l=s,"auto"===o&&(c=e/t*l)),"auto"!==o&&"number"==typeof o&&(c=o,"auto"===s&&(l=t/e*c)),"auto"!==r){if("custom"===r)return{width:l,height:c};const[t,e]=r.split(":").map(Number),n=t/e,i=l/c;if(Math.abs(i-n)>.01)if(i>n)l=c*n;else{const t=l;l=t,c=t/n}}return{width:Math.round(l),height:Math.round(c)}}async convertImage(t,e="webp",n={}){let s=(n=n||{}).quality?n.quality:.8,o=n.maxDimension?n.maxDimension:0;return"string"==typeof s&&(s=parseFloat(s)/100,s||(s=.8)),"string"==typeof o&&(o=parseFloat(o)),new Promise((n,r)=>{const a=new Image;let l=null;a.onload=async()=>{const t=document.createElement("canvas"),{width:c,height:m}=this.calculateDimensions(a.width,a.height,{maxDimension:o});t.width=c,t.height=m;const d=t.getContext("2d"),p=a.width/a.height,u=c/m;let h=a.height,g=a.width,f=0,w=0;Math.abs(p-u)>.01&&(p>u?(g=a.height*u,f=(a.width-g)/2):(h=a.width/u,w=(a.height-h)/2)),d.drawImage(a,f,w,g,h,0,0,c,m);const y=i.find(t=>t.value===e),v="webp"===e||"jpg"===e?s:void 0;t.toBlob(function(e){URL.revokeObjectURL(l),l=null,d.clearRect(0,0,t.width,t.height),t.width=0,t.height=0,e?n(e):r(new Error("Failed to convert image"))},y.mimeType,v)},a.onerror=()=>{l&&(URL.revokeObjectURL(l),l=null),r(new Error("Failed to load image"))},l=URL.createObjectURL(t.file),a.src=l})}async convert(){const t=this.file,e=this.options?.format||"webp";if(!t.type||!t.type.startsWith("image/"))return{file:t,metadata:null};const n=i.find(t=>t.value===e);if(n&&t.type===n.mimeType)return{file:t,metadata:null};const s=document.createElement("canvas");if(n&&!s.toDataURL(n.mimeType).startsWith(`data:${n.mimeType}`))return console.error("[Cimo] "+e+" is not supported by the browser, please use another modern browser"),{file:t,metadata:null};if("image/gif"===t.type){const e=await t.slice(0,51200).arrayBuffer(),n=new Uint8Array(e);let i=0;for(let e=0;e<n.length-2;e++)if(33===n[e]&&249===n[e+1]&&4===n[e+2]&&(i++,i>1))return{file:t,metadata:null}}const o={file:t};try{const i=performance.now(),s=await this.convertImage(o,e,{quality:this.options?.quality||.8,maxDimension:this.options?.maxDimension||0}),r=performance.now();if(s.size>t.size)throw new Error("Resulting image is bigger than the input, skipping conversion.");const a="jpeg"===e?"jpg":e,l=t.name.replace(/\.[^/.]+$/,"")+"."+a,c={filename:l,originalFormat:t.type,originalFilesize:t.size,convertedFormat:n.mimeType,convertedFilesize:s.size,conversionTime:r-i,compressionSavings:t.size>0?s.size/t.size:null};return{file:new(0,t.constructor)([s],l,{type:n.mimeType,lastModified:Date.now()}),metadata:c}}catch(t){throw new Error(`Failed to convert image: ${t.message}`)}}}class o extends n{static get showProgress(){return!1}async convert(){return{file:this.file,metadata:null}}}const r=window.wp.hooks,a=t=>{let e=t;if(!e||"object"!=typeof e||"string"!=typeof e.name||"number"!=typeof e.size||"string"!=typeof e.type||"function"!=typeof e.slice)return new o(e);if(!(e instanceof File)){const t=e;e=new File(t?[t]:[],t?.name||"unknown",{type:t?.type||"application/octet-stream",lastModified:"number"==typeof t?.lastModified?t.lastModified:Date.now()})}if(e.type.startsWith("image/")){if(!function(t){const e={webp:"image/webp",avif:"image/avif"}[t.toLowerCase()]||(t.startsWith("image/")?t:null);if(!e)return!1;const n=document.createElement("canvas");n.width=1,n.height=1;try{return n.toDataURL(e).startsWith(`data:${e}`)}catch(t){return!1}}("webp"))return new o(e);if(s.supportsMimeType(e.type))return new s(e,{format:"webp",quality:window.cimoSettings?.webpQuality||.8,maxDimension:window.cimoSettings?.maxImageDimension||0})}return(0,r.applyFilters)("cimo.getFileConverter",null,e)||new o(e)};function l(t){return!t.every(t=>"NullConverter"===t.constructor.name)}function c(t){return("string"!=typeof t?String(t):t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/`/g,"&#96;")}function m(t,e="editor-canvas"){const n=()=>{const n=document.querySelector(`iframe[name="${e}"]`);if(n&&n.contentDocument){const e=()=>{n.contentDocument.body?t(n.contentDocument):setTimeout(e,50)};"loading"===n.contentDocument.readyState?n.addEventListener("load",()=>{e()}):e()}};n();let i=0;const s=setInterval(()=>{i>=10?clearInterval(s):(i++,n())},1e3),o=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&("IFRAME"===t.tagName&&t.name===e||t.querySelector&&t.querySelector(`iframe[name="${e}"]`))&&n()})})});return o.observe(document.body,{childList:!0,subtree:!0}),o}const d=t=>{if(!Array.isArray(t))return Promise.resolve();const e=t.filter(t=>null!==t);return 0===e.length?Promise.resolve():(e.forEach(t=>{t.filename&&p(t.filename,t)}),new Promise((t,n)=>{fetch(`${window.cimoSettings?.restUrl||"/wp-json/cimo/v1/"}metadata`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-WP-Nonce":window.cimoSettings?.nonce||window.wpApiSettings?.nonce},body:JSON.stringify({metadata:e}),credentials:"same-origin"}).then(t=>t.ok?t.json():t.json().then(e=>{throw new Error(e.message||t.statusText)})).then(e=>{t(e)}).catch(t=>{console.error(`Failed to save metadata for filenames: [${e.map(t=>t.filename).join(", ")}]:`,t),n(new Error(`Failed to save metadata: ${t.message}`))})}))},p=(t,e)=>{window.cimoMetadataCache||(window.cimoMetadataCache={}),window.cimoMetadataCache[t.replaceAll(/\s+/g,"-")]={...e}};class u{constructor(t=[],e=null){this.converters=Array.isArray(t)?t.filter(t=>!0===t?.showProgress):[],this.closeHandler="function"==typeof e?e:null,this.interval=null,this.modal=null,this.progressBars=[],this._setupModal()}open(){this.modal&&0!==this.converters.length&&(this.modal.style.display="flex",this._startInterval())}_handleCloseClick(){confirm((0,e.__)("Closing this dialog will cancel the uploading process. Are you sure you want to continue?","cimo-image-optimizer"))&&(this.closeHandler&&this.closeHandler(),this.close())}close(){this.modal&&0!==this.converters.length&&setTimeout(()=>{this.modal.style.display="none",this._stopInterval(),this.modal.remove(),this.modal=null},300)}_setupModal(){this.modal=document.createElement("div"),this.modal.className="cimo-progress-modal",this.modal.style.cssText="\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100vw;\n\t\t\theight: 100vh;\n\t\t\tbackground: rgba(0,0,0,0.35);\n\t\t\tdisplay: none;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tz-index: 9999999;\n\t\t",this.modal.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()});const t=document.createElement("div");t.className="cimo-progress-wrapper",t.style.cssText="\n\t\t\tbackground: #fff;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 2em 2em 1em 2em;\n\t\t\tmax-width: 500px;\n\t\t\tbox-shadow: 0 6px 32px rgba(0,0,0,0.24);\n\t\t\tposition: relative;\n\t\t\twidth: 90%;\n\t\t";const n=document.createElement("h3");n.className="cimo-progress-title",n.innerText=(0,e.__)("Optimizing your files","cimo-image-optimizer"),n.style.cssText="\n\t\t\tfont-size: 1.6em !important;\n\t\t\tfont-weight: 600 !important;\n\t\t\tmargin: 0 0 0.5em !important;\n\t\t",t.appendChild(n);const i=document.createElement("div");if(i.className="cimo-progress-subtitle",i.innerText=(0,e.__)("Preparing your files for upload…","cimo-image-optimizer"),i.style.cssText="\n\t\t\tmargin-bottom: 2em;\n\t\t",t.appendChild(i),this.errorNote=document.createElement("div"),this.errorNote.className="cimo-progress-error-note",this.errorNote.innerText=(0,e.__)("Some media files could not be optimized and were uploaded in their original format.","cimo-image-optimizer"),this.errorNote.style.cssText="\n\t\t\tdisplay: none;\n\t\t\tbackground: #fff3cd;\n\t\t\tcolor: #856404;\n\t\t\tborder: 1px solid #ffeeba;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t\tfont-size: 1em;\n\t\t",t.appendChild(this.errorNote),this.closeHandler){const e=document.createElement("button");e.className="cimo-progress-close",e.type="button",e.innerHTML="&times;",e.style.cssText="\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0.7em;\n\t\t\t\tright: 1em;\n\t\t\t\tbackground: transparent;\n\t\t\t\tborder: none;\n\t\t\t\tfont-size: 2em;\n\t\t\t\tcursor: pointer;\n\t\t\t\tcolor: #888;\n\t\t\t",e.addEventListener("click",()=>this._handleCloseClick()),t.appendChild(e)}this.progressBars=[],this.progressList=document.createElement("div"),this.progressList.className="cimo-progress-list",t.appendChild(this.progressList),this.modal.appendChild(t),document.body.appendChild(this.modal),this._renderProgressBars()}_renderProgressBars(){this.progressList.innerHTML="",this.progressBars=[],this.converters.forEach((t,e)=>{const n=document.createElement("div");n.className="cimo-progress-bar-container",n.style.cssText="\n\t\t\t\tmargin-bottom: 1em;\n\t\t\t\tpadding: 16px 16px 16px 70px;\n\t\t\t\tborder: 1px solid #e2e8f0;\n\t\t\t\tborder-radius: 12px;\n\t\t\t\tposition: relative;\n\t\t\t";const i=document.createElement("span");i.className="cimo-stat-icon",i.style.cssText="\n\t\t\t\tbackground: #16a2491a;\n        \t\tcolor: #16a249;\n\t\t\t\tpadding: 8px;\n\t\t\t\tborder-radius: 8px;\n\t\t\t\tmargin-bottom: 8px;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 16px;\n\t\t\t\ttop: 16px;\n\t\t\t";let s="";s=t.file&&t.file.type&&t.file.type.startsWith("video/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video-icon lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>':t.file&&t.file.type&&t.file.type.startsWith("audio/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-music-icon lucide-music"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image-icon lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',i.innerHTML=s,n.appendChild(i);const o=document.createElement("div");o.className="cimo-progress-label",o.innerText=t.file?.name||`File ${e+1}`,o.style.cssText="\n\t\t\t\tmargin-bottom: 0.2em;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tfont-weight: 600;\n\t\t\t\tmax-width: 80%;\n\t\t\t\twhite-space: nowrap;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t\toverflow: hidden;\n\t\t\t";const r=document.createElement("div");r.className="cimo-size-label",r.innerText=t.file&&t.file.size?t.file.size/1024/1024>=1?(t.file.size/1024/1024).toFixed(2)+" MB":(t.file.size/1024).toFixed(1)+" KB":"",r.style.cssText="\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t\tfont-size: 1em;\n\t\t\t";const a=document.createElement("div");a.style.cssText="\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: space-between;\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t";const l=document.createElement("div");l.className="cimo-progress-status-label",l.innerText="",l.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t\tcolor: #3b3b3b;\n\t\t\t";const c=document.createElement("div");c.className="cimo-percentage-label",c.innerText="0%",c.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t",a.appendChild(l),a.appendChild(c);const m=document.createElement("div");m.className="cimo-progress-bar-bg",m.style.cssText="\n\t\t\t\tbackground: #e8ecef;\n\t\t\t\tborder-radius: 5px;\n\t\t\t\theight: 8px;\n\t\t\t\twidth: 100%;\n\t\t\t\toverflow: hidden;\n\t\t\t";const d=document.createElement("div");d.className="cimo-progress-bar",d.style.cssText="\n\t\t\t\tbackground: linear-gradient(90deg, #00d8f0 0%, #2bc566 100%);\n\t\t\t\twidth: 0%;\n\t\t\t\theight: 100%;\n\t\t\t\ttransition: width 0.5s linear;\n\t\t\t\tborder-radius: 5px 0 0 5px;\n\t\t\t",d.sizeLabelEl=r,d.statusLabelEl=l,d.percentageLabelEl=c,m.appendChild(d),n.appendChild(o),n.appendChild(r),n.appendChild(a),n.appendChild(m),this.progressList.appendChild(n),this.progressBars.push(d)})}_startInterval(){this.interval||(this._updateProgress(),this.interval=setInterval(()=>this._updateProgress(),500))}_stopInterval(){this.interval&&(clearInterval(this.interval),this.interval=null)}_updateProgress(){let t=!0,e=!1;this.converters.forEach((n,i)=>{let s=100*n.progress;("number"!=typeof s||isNaN(s)||s<0)&&(s=0),s>=100&&(s=100),s<100&&(t=!1),n.errorMessage&&(e=!0,this.errorNote.style.display="block"),this.progressBars[i]&&(this.progressBars[i].statusLabelEl.style.cssText=`\n\t\t\t\t\tcolor: ${n.errorMessage?"#dc3545":"inherit"};\n\t\t\t\t`,this.progressBars[i].statusLabelEl.innerText=n.errorMessage||n.status,this.progressBars[i].style.width=s+"%",this.progressBars[i].percentageLabelEl.innerText=parseInt(s)+"%")}),t&&"block"===this.modal.style.display&&(e||setTimeout(()=>this.close(),750))}}function h(t){if(!t)return;if(!t.body)return;t.body.__cimo_dropzone_listener_attached||(t.body.addEventListener("drop",async e=>{if(e.__cimo_converted)return;const n=Array.from(e.dataTransfer.files).map(t=>a(t));if(!l(n))return;if(!(e.target.closest(".media-frame-uploader")||e.target.closest(".supports-drag-drop").querySelector(".media-frame-uploader")||e.target.closest(".media-upload-form")||e.target.closest(".editor-post-featured-image")||e.target.closest(".editor-styles-wrapper")||e.target.closest(".uploader-window")))return;let i;for(e.preventDefault(),e.stopPropagation();i=document.querySelector('.uploader-window[style*="display: block"]');)i.style.display="none";const s=new u(n,()=>{n.forEach(t=>t.cancel())});s.open();let o=!1;const r=await Promise.all(n.map(async t=>{try{return await t.convert()}catch(e){return o=!0,console.warn(e),{file:t.file,metadata:null}}})),c=r.map(t=>t.file),m=r.map(t=>t.metadata),p=new DataTransfer;if(c.forEach(t=>{p.items.add(t)}),await d(m),e.target?.classList.contains("components-drop-zone")){const n=t!==document,i=new Event("drop",{bubbles:!n});Object.defineProperty(i,"dataTransfer",{value:p,writable:!1}),i.__cimo_converted=!0,e.target.dispatchEvent(i)}else{const n=document.querySelector('.media-modal input[type="file"]')||document.querySelector('.media-upload-form input[type="file"]')||document.querySelector('input[type="file"]');if(n){n.files=p.files;const e=t!==document,i=new Event("change",{bubbles:!e});i.__cimo_converted=!0,n.dispatchEvent(i)}else{const t=new Event("drop",{bubbles:!0});Object.defineProperty(t,"dataTransfer",{value:p,writable:!1}),t.__cimo_converted=!0,e.target.dispatchEvent(t)}}o||s.close()},!0),t.body.__cimo_dropzone_listener_attached=!0)}function g(t){if(!window.wp&&!t)return;if(!t.body)return;t.body.__cimo_selectfiles_listener_attached||(t.body.addEventListener("change",async t=>{if("file"!==t.target.type)return;if(t.__cimo_converted)return;const e=Array.from(t.target.files).map(t=>a(t));if(!l(e))return;if(!(t.target.closest(".components-form-file-upload")||t.target.closest(".media-frame")||t.target.closest(".media-upload-form")||t.target.closest(".moxie-shim")))return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();const n=new u(e,()=>{e.forEach(t=>t.cancel())});n.open();let i=!1;const s=await Promise.all(e.map(async t=>{try{return await t.convert()}catch(e){return i=!0,console.warn(e),{file:t.file,metadata:null}}})),o=s.map(t=>t.file),r=s.map(t=>t.metadata),c=new DataTransfer;o.forEach(t=>{c.items.add(t)}),await d(r),t.target.files=c.files;const m=new Event("change",{bubbles:!0});m.__cimo_converted=!0,t.target.dispatchEvent(m),i||n.close()},!0),t.body.__cimo_selectfiles_listener_attached=!0)}function f(t,e=2,n=!1){if(0===t)return"0 Bytes";const i=e<0?0:e,s=Math.abs(t),o=Math.floor(Math.log(s)/Math.log(1024));let r=t<0?"-":"";return n&&(r="-"===r?"":"-"),r+parseFloat((s/Math.pow(1024,o)).toFixed(i))+" "+["Bytes","KB","MB","GB"][o]}function w({model:t,container:n}){if(!t||!n)return;if(n.querySelector(".cimo-media-manager-metadata"))return;let i=t.get("cimo")||null;var s;if(i&&0!==Object.keys(i).length||(s=t.get("originalImageName")||t.get("filename"),i=window.cimoMetadataCache?.[s?.replaceAll(/\s+/g,"-")]||null),!i)return;const o=document.createElement("div");o.className="cimo-media-manager-metadata";const r=function(t){if(!t)return"Media";const[e="media"]=t.split("/");switch(e.toLowerCase()){case"image":return"Image";case"video":return"Video";case"audio":return"Audio";default:return"Media"}}(i.convertedFormat||t.get("mime")||"");let a=`\n\t\t<div class="cimo-media-manager-metadata-title-container">\n\t\t\t<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 672 672" height="20" width="20">\n\t\t\t\t<path d="M132.5 132.5C182.4 82.5 253 56 336 56C419 56 489.6 82.5 539.5 132.5C589.4 182.5 616 253 616 336C616 419 589.5 489.6 539.5 539.5C489.5 589.4 419 616 336 616C253 616 182.4 589.5 132.5 539.5C82.6 489.5 56 419 56 336C56 253 82.5 182.4 132.5 132.5z"/>\n\t\t\t</svg>\n\t\t\t<h3 class="cimo-media-manager-metadata-title">\n\t\t\t\t${c((0,e.sprintf)((0,e.__)("%s Optimized by Cimo","cimo-image-optimizer"),r))}\n\t\t\t</h3>\n\t\t</div>\n\t\t<ul>\n\t`;const l=i.compressionSavings?(100-100*i.compressionSavings).toFixed(2):null,m=f(i.originalFilesize-i.convertedFilesize,1,!0);a+=`\n\t\t<li class="cimo-compression-savings ${c(l>0?"cimo-optimization-savings-up":"cimo-optimization-savings-down")}">\n\t\t\tSaved ${c(l)}%\n\t\t\t<span class="cimo-compression-savings-bytes">(${c(m)})</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-filesize-original">\n\t\t\tOriginal: <span class="cimo-value">${c(f(parseInt(i.originalFilesize)||0))}</span>\n\t\t</li>\n\t\t<li class="cimo-filesize-optimized">\n\t\t\tOptimized: <span class="cimo-value">${c(f(parseInt(i.convertedFilesize)||0))}</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-converted">\n\t\t\t🏞️ Converted to <span class="cimo-value">${c(function(t){if(!t)return"";const e=t.split("/"),n=e[1]||e[0]||"";return"webp"===n?"WebP":n.charAt(0).toUpperCase()+n.slice(1)}(i.convertedFormat))}</span>\n\t\t</li>\n\t`;let d="N/A";if(i.conversionTime){const t=parseFloat(i.conversionTime);d=t<1e3?`${t.toFixed(0)} ms`:t<6e4?`${(t/1e3).toFixed(1)} sec`:`${(t/6e4).toFixed(1)} min`}a+=`\n\t\t<li class="cimo-time">\n\t\t\t⚡️ Done in <span class="cimo-value">${c(d)}</span>\n\t\t</li>\n\t\t</ul>\n\t`,o.innerHTML=a,n.appendChild(o)}t(()=>{h(document),m(t=>{h(t)})}),t(()=>{g(document),m(t=>{g(t)})}),t(()=>{if("undefined"!=typeof wp&&wp.media&&wp.media.view&&wp.media.view.Attachment&&wp.media.view.Attachment.Details&&(wp.media.view.Attachment.Details=wp.media.view.Attachment.Details.extend({template(t){const e=wp.media.template("attachment-details")(t),n=document.createElement("div");n.innerHTML=e;const i=n.querySelector(".attachment-info");return w({model:t.model,container:i}),n.innerHTML}}),wp.media.view.Attachment.Details.TwoColumn)){const t=wp.media.view.Attachment.Details.TwoColumn;wp.media.view.Attachment.Details.TwoColumn=t.extend({render(){t.prototype.render.apply(this,arguments);const e=this.el.querySelector(".attachment-info > .details");return w({model:this.model,container:e}),this}})}})})();
     1(()=>{"use strict";function t(t){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",t):t())}const e=window.wp.i18n;class n{constructor(t,n={}){this.file=t,this.options=n,this._progress=0,this._status=(0,e.__)("Ready","cimo-image-optimizer"),this._errorMessage=null}static get mimeTypes(){throw new Error("mimeTypes getter must be implemented by subclass")}static supportsMimeType(t){if(!t||"string"!=typeof t)return!1;const e=this.mimeTypes;return!!Array.isArray(e)&&e.includes(t)}get status(){return this._status}get errorMessage(){return this._errorMessage}get progress(){return this._progress}static get showProgress(){return!0}get showProgress(){return this.constructor.showProgress}async convert(){throw new Error("convert() must be implemented by subclass")}cancel(){}}const i=window.wp.hooks,s=[{value:"webp",mimeType:"image/webp"},{value:"jpg",mimeType:"image/jpeg"},{value:"png",mimeType:"image/png"}];class o extends n{static get mimeTypes(){return(0,i.applyFilters)("cimo.imageConverter.mimeTypes",["image/jpeg","image/png","image/webp","image/jpg"])}static get showProgress(){return!1}calculateDimensions(t,e,n){const i=(n=n||{}).scale?n.scale:1,s=n.width?n.width:"auto",o=n.height?n.height:"auto",r=n.aspectRatio?n.aspectRatio:"auto",a=n.maxDimension?n.maxDimension:0;let l=t*i,c=e*i;if(a&&"number"==typeof a&&a>0){const t=Math.max(l,c);if(t>a){const e=a/t;l*=e,c*=e}}if("auto"!==s&&"number"==typeof s&&(l=s,"auto"===o&&(c=e/t*l)),"auto"!==o&&"number"==typeof o&&(c=o,"auto"===s&&(l=t/e*c)),"auto"!==r){if("custom"===r)return{width:l,height:c};const[t,e]=r.split(":").map(Number),n=t/e,i=l/c;if(Math.abs(i-n)>.01)if(i>n)l=c*n;else{const t=l;l=t,c=t/n}}return{width:Math.round(l),height:Math.round(c)}}async convertImage(t,e="webp",n={}){let o=(n=n||{}).quality?n.quality:.8,r=n.maxDimension?n.maxDimension:0;"string"==typeof o&&(o=parseFloat(o)/100,o||(o=.8)),"string"==typeof r&&(r=parseFloat(r));const a=await(0,i.applyFiltersAsync)("cimo.convertImage.prepare",t.file,e,n);return a&&(t.file=a),new Promise((n,i)=>{const a=new Image;let l=null;a.onload=async()=>{const t=document.createElement("canvas"),{width:c,height:m}=this.calculateDimensions(a.width,a.height,{maxDimension:r});t.width=c,t.height=m;const d=t.getContext("2d"),p=a.width/a.height,u=c/m;let h=a.height,g=a.width,f=0,w=0;Math.abs(p-u)>.01&&(p>u?(g=a.height*u,f=(a.width-g)/2):(h=a.width/u,w=(a.height-h)/2)),d.drawImage(a,f,w,g,h,0,0,c,m);const y=s.find(t=>t.value===e),v="webp"===e||"jpg"===e?o:void 0;t.toBlob(function(e){URL.revokeObjectURL(l),l=null,d.clearRect(0,0,t.width,t.height),t.width=0,t.height=0,e?n(e):i(new Error("Failed to convert image"))},y.mimeType,v)},a.onerror=()=>{l&&(URL.revokeObjectURL(l),l=null),i(new Error("Failed to load image"))},l=URL.createObjectURL(t.file),a.src=l})}async convert(){const t=this.file,e=this.options?.format||"webp";if(!t.type||!t.type.startsWith("image/"))return{file:t,metadata:null};const n=s.find(t=>t.value===e);if(n&&t.type===n.mimeType)return{file:t,metadata:null};const i=document.createElement("canvas");if(n&&!i.toDataURL(n.mimeType).startsWith(`data:${n.mimeType}`))return console.error("[Cimo] "+e+" is not supported by the browser, please use another modern browser"),{file:t,metadata:null};if("image/gif"===t.type){const e=await t.slice(0,51200).arrayBuffer(),n=new Uint8Array(e);let i=0;for(let e=0;e<n.length-2;e++)if(33===n[e]&&249===n[e+1]&&4===n[e+2]&&(i++,i>1))return{file:t,metadata:null}}const o={file:t};try{const i=performance.now(),s=await this.convertImage(o,e,{quality:this.options?.quality||.8,maxDimension:this.options?.maxDimension||0}),r=performance.now();if(s.size>t.size)throw new Error("Resulting image is bigger than the input, skipping conversion.");const a="jpeg"===e?"jpg":e,l=t.name.replace(/\.[^/.]+$/,"")+"."+a,c={filename:l,originalFormat:t.type,originalFilesize:t.size,convertedFormat:n.mimeType,convertedFilesize:s.size,conversionTime:r-i,compressionSavings:t.size>0?s.size/t.size:null};return{file:new(0,t.constructor)([s],l,{type:n.mimeType,lastModified:Date.now()}),metadata:c}}catch(t){throw new Error(`Failed to convert image: ${t.message}`)}}}class r extends n{static get showProgress(){return!1}async convert(){return{file:this.file,metadata:null}}}const a=t=>{let e=t;if(!e||"object"!=typeof e||"string"!=typeof e.name||"number"!=typeof e.size||"string"!=typeof e.type||"function"!=typeof e.slice)return new r(e);if(!(e instanceof File)){const t=e;e=new File(t?[t]:[],t?.name||"unknown",{type:t?.type||"application/octet-stream",lastModified:"number"==typeof t?.lastModified?t.lastModified:Date.now()})}if(e.type.startsWith("image/")){if(!function(t){const e={webp:"image/webp",avif:"image/avif"}[t.toLowerCase()]||(t.startsWith("image/")?t:null);if(!e)return!1;const n=document.createElement("canvas");n.width=1,n.height=1;try{return n.toDataURL(e).startsWith(`data:${e}`)}catch(t){return!1}}("webp"))return new r(e);if(o.supportsMimeType(e.type))return new o(e,{format:"webp",quality:window.cimoSettings?.webpQuality||.8,maxDimension:window.cimoSettings?.maxImageDimension||0})}return(0,i.applyFilters)("cimo.getFileConverter",null,e)||new r(e)};function l(t){return!t.every(t=>"NullConverter"===t.constructor.name)}function c(t){return("string"!=typeof t?String(t):t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/`/g,"&#96;")}function m(t,e="editor-canvas"){const n=()=>{const n=document.querySelector(`iframe[name="${e}"]`);if(n&&n.contentDocument){const e=()=>{n.contentDocument.body?t(n.contentDocument):setTimeout(e,50)};"loading"===n.contentDocument.readyState?n.addEventListener("load",()=>{e()}):e()}};n();let i=0;const s=setInterval(()=>{i>=10?clearInterval(s):(i++,n())},1e3),o=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&("IFRAME"===t.tagName&&t.name===e||t.querySelector&&t.querySelector(`iframe[name="${e}"]`))&&n()})})});return o.observe(document.body,{childList:!0,subtree:!0}),o}const d=t=>{if(!Array.isArray(t))return Promise.resolve();const e=t.filter(t=>null!==t);return 0===e.length?Promise.resolve():(e.forEach(t=>{t.filename&&p(t.filename,t)}),new Promise((t,n)=>{fetch(`${window.cimoSettings?.restUrl||"/wp-json/cimo/v1/"}metadata`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-WP-Nonce":window.cimoSettings?.nonce||window.wpApiSettings?.nonce},body:JSON.stringify({metadata:e}),credentials:"same-origin"}).then(t=>t.ok?t.json():t.json().then(e=>{throw new Error(e.message||t.statusText)})).then(e=>{t(e)}).catch(t=>{console.error(`Failed to save metadata for filenames: [${e.map(t=>t.filename).join(", ")}]:`,t),n(new Error(`Failed to save metadata: ${t.message}`))})}))},p=(t,e)=>{window.cimoMetadataCache||(window.cimoMetadataCache={}),window.cimoMetadataCache[t.replaceAll(/\s+/g,"-")]={...e}};class u{constructor(t=[],e=null){this.converters=Array.isArray(t)?t.filter(t=>!0===t?.showProgress):[],this.closeHandler="function"==typeof e?e:null,this.interval=null,this.modal=null,this.progressBars=[],this._setupModal()}open(){this.modal&&0!==this.converters.length&&(this.modal.style.display="flex",this._startInterval())}_handleCloseClick(){confirm((0,e.__)("Closing this dialog will cancel the uploading process. Are you sure you want to continue?","cimo-image-optimizer"))&&(this.closeHandler&&this.closeHandler(),this.close())}close(){this.modal&&0!==this.converters.length&&setTimeout(()=>{this.modal.style.display="none",this._stopInterval(),this.modal.remove(),this.modal=null},300)}_setupModal(){this.modal=document.createElement("div"),this.modal.className="cimo-progress-modal",this.modal.style.cssText="\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100vw;\n\t\t\theight: 100vh;\n\t\t\tbackground: rgba(0,0,0,0.35);\n\t\t\tdisplay: none;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tz-index: 9999999;\n\t\t",this.modal.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()});const t=document.createElement("div");t.className="cimo-progress-wrapper",t.style.cssText="\n\t\t\tbackground: #fff;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 2em 2em 1em 2em;\n\t\t\tmax-width: 500px;\n\t\t\tbox-shadow: 0 6px 32px rgba(0,0,0,0.24);\n\t\t\tposition: relative;\n\t\t\twidth: 90%;\n\t\t";const n=document.createElement("h3");n.className="cimo-progress-title",n.innerText=(0,e.__)("Optimizing your files","cimo-image-optimizer"),n.style.cssText="\n\t\t\tfont-size: 1.6em !important;\n\t\t\tfont-weight: 600 !important;\n\t\t\tmargin: 0 0 0.5em !important;\n\t\t",t.appendChild(n);const i=document.createElement("div");if(i.className="cimo-progress-subtitle",i.innerText=(0,e.__)("Preparing your files for upload…","cimo-image-optimizer"),i.style.cssText="\n\t\t\tmargin-bottom: 2em;\n\t\t",t.appendChild(i),this.errorNote=document.createElement("div"),this.errorNote.className="cimo-progress-error-note",this.errorNote.innerText=(0,e.__)("Some media files could not be optimized and were uploaded in their original format.","cimo-image-optimizer"),this.errorNote.style.cssText="\n\t\t\tdisplay: none;\n\t\t\tbackground: #fff3cd;\n\t\t\tcolor: #856404;\n\t\t\tborder: 1px solid #ffeeba;\n\t\t\tborder-radius: 8px;\n\t\t\tpadding: 1em;\n\t\t\tmargin-bottom: 1.5em;\n\t\t\tfont-size: 1em;\n\t\t",t.appendChild(this.errorNote),this.closeHandler){const e=document.createElement("button");e.className="cimo-progress-close",e.type="button",e.innerHTML="&times;",e.style.cssText="\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0.7em;\n\t\t\t\tright: 1em;\n\t\t\t\tbackground: transparent;\n\t\t\t\tborder: none;\n\t\t\t\tfont-size: 2em;\n\t\t\t\tcursor: pointer;\n\t\t\t\tcolor: #888;\n\t\t\t",e.addEventListener("click",()=>this._handleCloseClick()),t.appendChild(e)}this.progressBars=[],this.progressList=document.createElement("div"),this.progressList.className="cimo-progress-list",t.appendChild(this.progressList),this.modal.appendChild(t),document.body.appendChild(this.modal),this._renderProgressBars()}_renderProgressBars(){this.progressList.innerHTML="",this.progressBars=[],this.converters.forEach((t,e)=>{const n=document.createElement("div");n.className="cimo-progress-bar-container",n.style.cssText="\n\t\t\t\tmargin-bottom: 1em;\n\t\t\t\tpadding: 16px 16px 16px 70px;\n\t\t\t\tborder: 1px solid #e2e8f0;\n\t\t\t\tborder-radius: 12px;\n\t\t\t\tposition: relative;\n\t\t\t";const i=document.createElement("span");i.className="cimo-stat-icon",i.style.cssText="\n\t\t\t\tbackground: #16a2491a;\n        \t\tcolor: #16a249;\n\t\t\t\tpadding: 8px;\n\t\t\t\tborder-radius: 8px;\n\t\t\t\tmargin-bottom: 8px;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 16px;\n\t\t\t\ttop: 16px;\n\t\t\t";let s="";s=t.file&&t.file.type&&t.file.type.startsWith("video/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video-icon lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>':t.file&&t.file.type&&t.file.type.startsWith("audio/")?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-music-icon lucide-music"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image-icon lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',i.innerHTML=s,n.appendChild(i);const o=document.createElement("div");o.className="cimo-progress-label",o.innerText=t.file?.name||`File ${e+1}`,o.style.cssText="\n\t\t\t\tmargin-bottom: 0.2em;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tfont-weight: 600;\n\t\t\t\tmax-width: 80%;\n\t\t\t\twhite-space: nowrap;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t\toverflow: hidden;\n\t\t\t";const r=document.createElement("div");r.className="cimo-size-label",r.innerText=t.file&&t.file.size?t.file.size/1024/1024>=1?(t.file.size/1024/1024).toFixed(2)+" MB":(t.file.size/1024).toFixed(1)+" KB":"",r.style.cssText="\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t\tfont-size: 1em;\n\t\t\t";const a=document.createElement("div");a.style.cssText="\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: space-between;\n\t\t\t\tmargin-bottom: 0.5em;\n\t\t\t";const l=document.createElement("div");l.className="cimo-progress-status-label",l.innerText="",l.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t\tcolor: #3b3b3b;\n\t\t\t";const c=document.createElement("div");c.className="cimo-percentage-label",c.innerText="0%",c.style.cssText="\n\t\t\t\tfont-size: 1em;\n\t\t\t",a.appendChild(l),a.appendChild(c);const m=document.createElement("div");m.className="cimo-progress-bar-bg",m.style.cssText="\n\t\t\t\tbackground: #e8ecef;\n\t\t\t\tborder-radius: 5px;\n\t\t\t\theight: 8px;\n\t\t\t\twidth: 100%;\n\t\t\t\toverflow: hidden;\n\t\t\t";const d=document.createElement("div");d.className="cimo-progress-bar",d.style.cssText="\n\t\t\t\tbackground: linear-gradient(90deg, #00d8f0 0%, #2bc566 100%);\n\t\t\t\twidth: 0%;\n\t\t\t\theight: 100%;\n\t\t\t\ttransition: width 0.5s linear;\n\t\t\t\tborder-radius: 5px 0 0 5px;\n\t\t\t",d.sizeLabelEl=r,d.statusLabelEl=l,d.percentageLabelEl=c,m.appendChild(d),n.appendChild(o),n.appendChild(r),n.appendChild(a),n.appendChild(m),this.progressList.appendChild(n),this.progressBars.push(d)})}_startInterval(){this.interval||(this._updateProgress(),this.interval=setInterval(()=>this._updateProgress(),500))}_stopInterval(){this.interval&&(clearInterval(this.interval),this.interval=null)}_updateProgress(){let t=!0,e=!1;this.converters.forEach((n,i)=>{let s=100*n.progress;("number"!=typeof s||isNaN(s)||s<0)&&(s=0),s>=100&&(s=100),s<100&&(t=!1),n.errorMessage&&(e=!0,this.errorNote.style.display="block"),this.progressBars[i]&&(this.progressBars[i].statusLabelEl.style.cssText=`\n\t\t\t\t\tcolor: ${n.errorMessage?"#dc3545":"inherit"};\n\t\t\t\t`,this.progressBars[i].statusLabelEl.innerText=n.errorMessage||n.status,this.progressBars[i].style.width=s+"%",this.progressBars[i].percentageLabelEl.innerText=parseInt(s)+"%")}),t&&"block"===this.modal.style.display&&(e||setTimeout(()=>this.close(),750))}}function h(t){if(!t)return;if(!t.body)return;t.body.__cimo_dropzone_listener_attached||(t.body.addEventListener("drop",async e=>{if(e.__cimo_converted)return;const n=Array.from(e.dataTransfer.files).map(t=>a(t));if(!l(n))return;if(!(e.target.closest(".media-frame-uploader")||e.target.closest(".supports-drag-drop")?.querySelector(".media-frame-uploader")||e.target.closest(".media-upload-form")||e.target.closest(".editor-post-featured-image")||e.target.closest(".editor-styles-wrapper")||e.target.closest(".uploader-window")))return;let i;for(e.preventDefault(),e.stopPropagation();i=document.querySelector('.uploader-window[style*="display: block"]');)i.style.display="none";const s=new u(n,()=>{n.forEach(t=>t.cancel())});s.open();let o=!1;const r=await Promise.all(n.map(async t=>{try{return await t.convert()}catch(e){return o=!0,console.warn(e),{file:t.file,metadata:null}}})),c=r.map(t=>t.file),m=r.map(t=>t.metadata),p=new DataTransfer;if(c.forEach(t=>{p.items.add(t)}),await d(m),e.target?.classList.contains("components-drop-zone")){const n=t!==document,i=new Event("drop",{bubbles:!n});Object.defineProperty(i,"dataTransfer",{value:p,writable:!1}),i.__cimo_converted=!0,e.target.dispatchEvent(i)}else{const n=document.querySelector('.media-modal input[type="file"]')||document.querySelector('.media-upload-form input[type="file"]')||document.querySelector('input[type="file"]');if(n){n.files=p.files;const e=t!==document,i=new Event("change",{bubbles:!e});i.__cimo_converted=!0,n.dispatchEvent(i)}else{const t=new Event("drop",{bubbles:!0});Object.defineProperty(t,"dataTransfer",{value:p,writable:!1}),t.__cimo_converted=!0,e.target.dispatchEvent(t)}}o||s.close()},!0),t.body.__cimo_dropzone_listener_attached=!0)}function g(t){if(!window.wp&&!t)return;if(!t.body)return;t.body.__cimo_selectfiles_listener_attached||(t.body.addEventListener("change",async t=>{if("file"!==t.target.type)return;if(t.__cimo_converted)return;const e=Array.from(t.target.files).map(t=>a(t));if(!l(e))return;if(!(t.target.closest(".components-form-file-upload")||t.target.closest(".media-frame")||t.target.closest(".media-upload-form")||t.target.closest(".moxie-shim")))return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();const n=new u(e,()=>{e.forEach(t=>t.cancel())});n.open();let i=!1;const s=await Promise.all(e.map(async t=>{try{return await t.convert()}catch(e){return i=!0,console.warn(e),{file:t.file,metadata:null}}})),o=s.map(t=>t.file),r=s.map(t=>t.metadata),c=new DataTransfer;o.forEach(t=>{c.items.add(t)}),await d(r),t.target.files=c.files;const m=new Event("change",{bubbles:!0});m.__cimo_converted=!0,t.target.dispatchEvent(m),i||n.close()},!0),t.body.__cimo_selectfiles_listener_attached=!0)}function f(t,e=2,n=!1){if(0===t)return"0 Bytes";const i=e<0?0:e,s=Math.abs(t),o=Math.floor(Math.log(s)/Math.log(1024));let r=t<0?"-":"";return n&&(r="-"===r?"":"-"),r+parseFloat((s/Math.pow(1024,o)).toFixed(i))+" "+["Bytes","KB","MB","GB"][o]}function w({model:t,container:n}){if(!t||!n)return;if(n.querySelector(".cimo-media-manager-metadata"))return;let i=t.get("cimo")||null;var s;if(i&&0!==Object.keys(i).length||(s=t.get("originalImageName")||t.get("filename"),i=window.cimoMetadataCache?.[s?.replaceAll(/\s+/g,"-")]||null),!i)return;const o=document.createElement("div");o.className="cimo-media-manager-metadata";const r=function(t){if(!t)return"Media";const[e="media"]=t.split("/");switch(e.toLowerCase()){case"image":return"Image";case"video":return"Video";case"audio":return"Audio";default:return"Media"}}(i.convertedFormat||t.get("mime")||"");let a=`\n\t\t<div class="cimo-media-manager-metadata-title-container">\n\t\t\t<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 672 672" height="20" width="20">\n\t\t\t\t<path d="M132.5 132.5C182.4 82.5 253 56 336 56C419 56 489.6 82.5 539.5 132.5C589.4 182.5 616 253 616 336C616 419 589.5 489.6 539.5 539.5C489.5 589.4 419 616 336 616C253 616 182.4 589.5 132.5 539.5C82.6 489.5 56 419 56 336C56 253 82.5 182.4 132.5 132.5z"/>\n\t\t\t</svg>\n\t\t\t<h3 class="cimo-media-manager-metadata-title">\n\t\t\t\t${c((0,e.sprintf)((0,e.__)("%s Optimized by Cimo","cimo-image-optimizer"),r))}\n\t\t\t</h3>\n\t\t</div>\n\t\t<ul>\n\t`;const l=i.compressionSavings?(100-100*i.compressionSavings).toFixed(2):null,m=f(i.originalFilesize-i.convertedFilesize,1,!0);a+=`\n\t\t<li class="cimo-compression-savings ${c(l>0?"cimo-optimization-savings-up":"cimo-optimization-savings-down")}">\n\t\t\tSaved ${c(l)}%\n\t\t\t<span class="cimo-compression-savings-bytes">(${c(m)})</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-filesize-original">\n\t\t\tOriginal: <span class="cimo-value">${c(f(parseInt(i.originalFilesize)||0))}</span>\n\t\t</li>\n\t\t<li class="cimo-filesize-optimized">\n\t\t\tOptimized: <span class="cimo-value">${c(f(parseInt(i.convertedFilesize)||0))}</span>\n\t\t</li>\n\t`,a+=`\n\t\t<li class="cimo-converted">\n\t\t\t🏞️ Converted to <span class="cimo-value">${c(function(t){if(!t)return"";const e=t.split("/"),n=e[1]||e[0]||"";return"webp"===n?"WebP":n.charAt(0).toUpperCase()+n.slice(1)}(i.convertedFormat))}</span>\n\t\t</li>\n\t`;let d="N/A";if(i.conversionTime){const t=parseFloat(i.conversionTime);d=t<1e3?`${t.toFixed(0)} ms`:t<6e4?`${(t/1e3).toFixed(1)} sec`:`${(t/6e4).toFixed(1)} min`}a+=`\n\t\t<li class="cimo-time">\n\t\t\t⚡️ Done in <span class="cimo-value">${c(d)}</span>\n\t\t</li>\n\t\t</ul>\n\t`,o.innerHTML=a,n.appendChild(o)}t(()=>{h(document),m(t=>{h(t)})}),t(()=>{g(document),m(t=>{g(t)})}),t(()=>{if("undefined"!=typeof wp&&wp.media&&wp.media.view&&wp.media.view.Attachment&&wp.media.view.Attachment.Details&&(wp.media.view.Attachment.Details=wp.media.view.Attachment.Details.extend({template(t){const e=wp.media.template("attachment-details")(t),n=document.createElement("div");n.innerHTML=e;const i=n.querySelector(".attachment-info");return w({model:t.model,container:i}),n.innerHTML}}),wp.media.view.Attachment.Details.TwoColumn)){const t=wp.media.view.Attachment.Details.TwoColumn;wp.media.view.Attachment.Details.TwoColumn=t.extend({render(){t.prototype.render.apply(this,arguments);const e=this.el.querySelector(".attachment-info > .details");return w({model:this.model,container:e}),this}})}})})();
  • cimo-image-optimizer/trunk/cimo.php

    r3448132 r3478972  
    88 * License: GPLv2 or later
    99 * Text Domain: cimo-image-optimizer
    10  * Version: 1.2.2
     10 * Version: 1.2.3
    1111 *
    1212 * @fs_premium_only /freemius.php, /freemius/, /lib/freemius-php-sdk
  • cimo-image-optimizer/trunk/composer.json

    r3352840 r3478972  
    44    "type": "wordpress-plugin",
    55    "license": "GPL-2.0-or-later",
    6     "require": {},
     6    "require": {
     7        "enshrined/svg-sanitize": "^0.22.0"
     8    },
    79    "require-dev": {
    810        "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
     
    1416            "phpcs --standard=phpcs.xml.dist -s"
    1517        ]
     18    },
     19    "config": {
     20        "allow-plugins": {
     21            "dealerdirect/phpcodesniffer-composer-installer": true
     22        }
    1623    }
    1724}
    18 
    19 
  • cimo-image-optimizer/trunk/readme.txt

    r3448132 r3478972  
    33Tags: image, optimization, compress, convert, webp
    44Requires at least: 6.7.4
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable tag: 1.2.2
     7Stable tag: 1.2.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    205205== Changelog ==
    206206
     207= 1.2.3 =
     208
     209* New: Added SVG Optimization (premium)
     210* New: Added HEIC image format support (premium)
     211* Fixed: Dropping files stopped working in some instances #32
     212
    207213= 1.2.2 =
    208214
  • cimo-image-optimizer/trunk/src/admin/class-admin.php

    r3402030 r3478972  
    109109                                ],
    110110                                'audio_quality' => [
     111                                    'type' => 'integer',
     112                                ],
     113
     114                                // SVG Optimization settings
     115                                'svg_upload' => [
     116                                    'type' => 'integer',
     117                                ],
     118                                'svg_optimization_enabled' => [
    111119                                    'type' => 'integer',
    112120                                ],
     
    281289            }
    282290
     291            // Sanitize svg_upload
     292            if ( isset( $options['svg_upload'] ) ) {
     293                $sanitized['svg_upload'] = $options['svg_upload'] ? 1 : 0;
     294            }
     295            // Sanitize svg_optimization_enabled
     296            if ( isset( $options['svg_optimization_enabled'] ) ) {
     297                $sanitized['svg_optimization_enabled'] = $options['svg_optimization_enabled'] ? 1 : 0;
     298            }
     299
    283300            return $sanitized;
    284301        }
  • cimo-image-optimizer/trunk/src/admin/class-script-loader.php

    r3402030 r3478972  
    9292                    'audioOptimizationEnabled' => isset( $settings['audio_optimization_enabled'] ) ? (int) $settings['audio_optimization_enabled'] : 1,
    9393                    'audioQuality' => ! empty( $settings['audio_quality'] ) ? (int) $settings['audio_quality'] : 128,
     94                    'svgUpload' => isset( $settings['svg_upload'] ) ? (int) $settings['svg_upload'] : 0,
     95                    'svgOptimizationEnabled' => isset( $settings['svg_optimization_enabled'] ) ? (int) $settings['svg_optimization_enabled'] : 1,
    9496                ]
    9597            );
Note: See TracChangeset for help on using the changeset viewer.