┌────────────────────────────────┐ │ ░░░ ░░▓ ░▓▓ ███ ▓▓░ ▓░░ │ │ ~ M O O N ~ │ └────────────────────────────────┘
prd-web-01.centraldc.gr
LOCATION:
/var/www/html/adconect/wp-content/plugins/easyfonts/assets/admin/dist
☗ ROOT
↻ REFRESH
✎ EDIT FILE
EDITING: index.js
(()=>{"use strict";var e,t={892(){const e=window.React,t=window.wp.element,a=window.EasyFontsAdmin||{root:"",nonce:"",siteUrl:""};async function n(e,t={}){const n=await fetch(a.root+e,{headers:{"Content-Type":"application/json","X-WP-Nonce":a.nonce},...t});if(!n.ok)throw new Error(`Request failed (${n.status})`);return n.json()}const l={config:a,getSettings:()=>n("/settings"),saveSettings:e=>n("/settings",{method:"POST",body:JSON.stringify(e)}),getFonts:()=>n("/fonts"),toggleFont:e=>n("/font/toggle",{method:"POST",body:JSON.stringify(e)}),bulkToggle:e=>n("/fonts/bulk",{method:"POST",body:JSON.stringify(e)}),optimize:()=>n("/optimize",{method:"POST"}),getUsage:()=>n("/usage"),getStats:()=>n("/stats"),getDiagnostics:()=>n("/diagnostics"),purge:()=>n("/purge",{method:"POST"}),repair:()=>n("/repair",{method:"POST"}),exportSettings:()=>n("/export"),importSettings:e=>n("/import",{method:"POST",body:JSON.stringify(e)})},s={stats:l.getStats,fonts:l.getFonts,usage:l.getUsage,diagnostics:l.getDiagnostics,settings:l.getSettings},r={stats:{},fonts:[],usage:[],diagnostics:{},settings:{}},c=(0,t.createContext)(null);function i(e){const a=(0,t.useContext)(c);if(!a)throw new Error("useResource must be used within StoreProvider");const{data:n,load:l,refresh:s,setLocal:r}=a;return(0,t.useEffect)(()=>{l(e)},[e,l]),{value:n[e],refresh:()=>s(e),setLocal:t=>r(e,t)}}const o={link:"Direct <link> tags",inline:"Inline <style> blocks",local_css:"Theme / plugin CSS files",external_css:"External / CDN CSS",webfont:"Web Font Loader (JS)",async:"Async / JS-injected fonts"},m=window.EasyFontsAdmin&&window.EasyFontsAdmin.optimizer||{label:"Activate Easy Optimizer",url:"https://fluxpress.io",state:"install"},d=(window.EasyFontsAdmin&&window.EasyFontsAdmin.siteUrl||"").replace(/\/+$/,"");function u(e){return(o[e]||e).replace("<link>","<code><link></code>").replace("<style>","<code><style></code>")}function p(){return(0,e.createElement)("span",{className:"ef-spinner","aria-hidden":"true"})}function E({checked:t,onChange:a,disabled:n,sm:l,stop:s}){return(0,e.createElement)("label",{className:"sw"+(l?" sm":""),onClick:s?e=>e.stopPropagation():void 0},(0,e.createElement)("input",{type:"checkbox",checked:!!t,disabled:n,onChange:e=>a(e.target.checked)}),(0,e.createElement)("span",null))}function h({family:a,onToggle:n,expandSignal:l}){const[s,r]=(0,t.useState)(!1);(0,t.useEffect)(()=>{l&&l.seq>0&&r(!!l.value)},[l]);const c=(e,t,l)=>n({family:a.family,weight:e.weight,style:e.style,field:t,value:l}),i=Math.round((a.total_size||0)/1024),o=a.variants.length;return(0,e.createElement)("div",{className:"fam"+(s?" open":"")},(0,e.createElement)("div",{className:"fam-hd",onClick:()=>r(!s)},(0,e.createElement)("span",{className:"caret"},"▶"),(0,e.createElement)("span",{className:"name"},a.family),!!a.is_variable&&(0,e.createElement)("span",{className:"vbadge"},"VARIABLE"),(0,e.createElement)("div",{className:"meta"},(0,e.createElement)("span",{className:"kb"},i," KB"),(0,e.createElement)("span",{className:"nweights"},o," ",1===o?"weight":"weights"),(0,e.createElement)("span",{className:"load"},"Load",(0,e.createElement)(E,{stop:!0,checked:a.enabled,onChange:e=>{return t=e,n({family:a.family,field:"enabled",value:t,scope:"family"});var t}})))),(0,e.createElement)("div",{className:"fam-body"},(0,e.createElement)("table",{className:"vtable"},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,"Weight / Style"),(0,e.createElement)("th",null,"Subsets"),(0,e.createElement)("th",{className:"c"},"Load"),(0,e.createElement)("th",{className:"c"},"Preload"))),(0,e.createElement)("tbody",null,a.variants.map(t=>(0,e.createElement)("tr",{key:t.weight+t.style},(0,e.createElement)("td",{className:"wt"+("italic"===t.style?" ital":"")},function(e){if(e.is_variable&&e.range)return e.range;const t=e.weight||"400";return"italic"===e.style?`${t} italic`:`${t}`}(t)),(0,e.createElement)("td",{className:"subs"},(t.subsets||[]).join(", ")),(0,e.createElement)("td",{className:"c"},(0,e.createElement)(E,{sm:!0,checked:t.is_enabled,onChange:e=>c(t,"enabled",e)})),(0,e.createElement)("td",{className:"c"},(0,e.createElement)(E,{sm:!0,checked:t.is_preloaded,disabled:!t.is_enabled,onChange:e=>c(t,"preloaded",e)}))))))))}function b({title:t,desc:a,families:n,scope:l,onToggle:s,onBulk:r,expandSignal:c}){const i=n.length>0&&n.every(e=>e.enabled);return(0,e.createElement)("div",{className:"group"},(0,e.createElement)("div",{className:"group-hd"},(0,e.createElement)("h3",null,t," ",(0,e.createElement)("span",{className:"count"},n.length)),(0,e.createElement)("span",{className:"desc"},a),(0,e.createElement)("span",{className:"allon"},"All on",(0,e.createElement)("label",{className:"sw sm"},(0,e.createElement)("input",{type:"checkbox",checked:i,onChange:e=>r(l,e.target.checked)}),(0,e.createElement)("span",null)))),0===n.length?(0,e.createElement)("p",{className:"empty"},"Nothing here yet."):n.map(t=>(0,e.createElement)(h,{key:t.family,family:t,onToggle:s,expandSignal:c})))}function v({tone:t,children:a}){const n={ok:"var(--ok-soft)",warn:"var(--warn-soft)",info:"var(--accent-soft)"}[t],l={ok:"var(--ok)",warn:"var(--warn)",info:"var(--accent-ink)"}[t];return(0,e.createElement)("span",{style:{display:"inline-block",fontSize:"10.5px",fontWeight:700,letterSpacing:".06em",textTransform:"uppercase",padding:"3px 8px",borderRadius:"5px",marginLeft:"6px",background:n,color:l}},a)}const g=["swap","fallback","optional","block","auto"],f=[{value:"arabic",label:"Arabic"},{value:"bengali",label:"Bengali"},{value:"chinese-hongkong",label:"Chinese (Hong Kong)"},{value:"chinese-simplified",label:"Chinese (Simplified)"},{value:"chinese-traditional",label:"Chinese (Traditional)"},{value:"cyrillic",label:"Cyrillic"},{value:"cyrillic-ext",label:"Cyrillic Extended"},{value:"devanagari",label:"Devanagari"},{value:"greek",label:"Greek"},{value:"greek-ext",label:"Greek Extended"},{value:"gujarati",label:"Gujarati"},{value:"gurmukhi",label:"Gurmukhi"},{value:"hebrew",label:"Hebrew"},{value:"japanese",label:"Japanese"},{value:"kannada",label:"Kannada"},{value:"khmer",label:"Khmer"},{value:"korean",label:"Korean"},{value:"latin",label:"Latin"},{value:"latin-ext",label:"Latin Extended"},{value:"malayalam",label:"Malayalam"},{value:"math",label:"Math"},{value:"myanmar",label:"Myanmar"},{value:"oriya",label:"Oriya"},{value:"sinhala",label:"Sinhala"},{value:"symbols",label:"Symbols"},{value:"tamil",label:"Tamil"},{value:"telugu",label:"Telugu"},{value:"thai",label:"Thai"},{value:"tibetan",label:"Tibetan"},{value:"vietnamese",label:"Vietnamese"}],y=[["optimisation","Optimisation"],["fontdisplay","font-display"],["subsets","Subsets"],["cdn","CDN"],["excluded","Excluded URLs"],["importexport","Import / Export"],["uninstall","Uninstall"]];function N({checked:t,onChange:a,disabled:n}){return(0,e.createElement)("label",{className:"sw"},(0,e.createElement)("input",{type:"checkbox",checked:!!t,disabled:n,onChange:e=>a(e.target.checked)}),(0,e.createElement)("span",null))}function k({h:t,p:a,code:n,children:l}){return(0,e.createElement)("div",{className:"opt"},(0,e.createElement)("div",{className:"txt"},(0,e.createElement)("h4",null,t),(0,e.createElement)("p",null,function(t,a){if(!a||!a.length)return t;const n=[];let l=t;return a.forEach((t,a)=>{const s=l.indexOf(t);-1!==s&&(n.push(l.slice(0,s)),n.push((0,e.createElement)("code",{key:a},t)),l=l.slice(s+t.length))}),n.push(l),n}(a,n))),(0,e.createElement)("div",{className:"ctrl"},l))}function w({label:t,value:a,ok:n}){const l="boolean"==typeof n,s=n?{bg:"var(--ok-soft)",fg:"var(--ok)"}:{bg:"var(--warn-soft)",fg:"var(--warn)"};return(0,e.createElement)("div",{className:"opt"},(0,e.createElement)("div",{className:"txt"},(0,e.createElement)("h4",{style:{fontWeight:600}},t)),(0,e.createElement)("div",{className:"ctrl"},l?(0,e.createElement)("span",{style:{fontSize:"11px",fontWeight:700,letterSpacing:".05em",padding:"4px 10px",borderRadius:"6px",background:s.bg,color:s.fg}},String(a)):(0,e.createElement)("span",{style:{fontFamily:"var(--mono)",fontSize:"12.5px",color:"var(--ink-2)"}},String(a))))}const S=[{id:"dashboard",label:"Dashboard",component:function(){var a,n,s,r;const{data:i,load:p,refresh:E}=function(){const e=(0,t.useContext)(c);if(!e)throw new Error("useStore must be used within StoreProvider");return e}(),h=i.stats,b=i.diagnostics,[v,g]=(0,t.useState)(!1),[f,y]=(0,t.useState)(!1),[N,k]=(0,t.useState)(!1),[w,S]=(0,t.useState)("");(0,t.useEffect)(()=>{p("stats"),p("diagnostics")},[p]);const x=e=>{const t=[E("stats"),E("diagnostics")];return e&&t.push(E("fonts"),E("usage")),Promise.all(t)};if(!h)return(0,e.createElement)("div",{className:"loading"},(0,e.createElement)("span",{className:"spinner"})," Loading…");const C=h.detectors||[],_=b&&!1===b.tables_ok,O=(e,t)=>Math.max(6,Math.min(100,Math.round(Number(e||0)/t*100)));return(0,e.createElement)(e.Fragment,null,_&&(0,e.createElement)("div",{className:"banner-warn"},(0,e.createElement)("div",null,(0,e.createElement)("strong",null,"Database needs a rebuild."),(0,e.createElement)("span",null," One or more Easy Fonts tables are missing or using an old schema, so detected fonts can’t be saved. Click Rebuild to fix it.")),(0,e.createElement)("div",{className:"right"},(0,e.createElement)("button",{className:"btn primary",disabled:f,onClick:async()=>{if(window.confirm("Rebuild the Easy Fonts database tables? This fixes a stale or incompatible schema. Hosted fonts will be re-detected on the next page view.")){y(!0);try{await l.repair(),await x(!0)}finally{y(!1)}}}},f?"Rebuilding…":"Rebuild database"))),(0,e.createElement)("div",{className:"grid"},(0,e.createElement)("div",{className:"col"},(0,e.createElement)("div",{className:"stats"},(0,e.createElement)("div",{className:"stat"},(0,e.createElement)("div",{className:"k"},"Families hosted"),(0,e.createElement)("div",{className:"v"},null!==(a=h.families)&&void 0!==a?a:0),(0,e.createElement)("div",{className:"spark"},(0,e.createElement)("i",{style:{width:O(h.families,20)+"%"}}))),(0,e.createElement)("div",{className:"stat"},(0,e.createElement)("div",{className:"k"},"Variants"),(0,e.createElement)("div",{className:"v"},null!==(n=h.variants)&&void 0!==n?n:0),(0,e.createElement)("div",{className:"spark"},(0,e.createElement)("i",{style:{width:O(h.variants,200)+"%"}}))),(0,e.createElement)("div",{className:"stat"},(0,e.createElement)("div",{className:"k"},"Hosted fonts"),(0,e.createElement)("div",{className:"v"},(null!==(s=h.hosted_kb)&&void 0!==s?s:0).toLocaleString(),(0,e.createElement)("small",null,"KB")),(0,e.createElement)("div",{className:"spark"},(0,e.createElement)("i",{style:{width:O(h.hosted_kb,5e3)+"%"}}))),(0,e.createElement)("div",{className:"stat"},(0,e.createElement)("div",{className:"k"},"Total cache"),(0,e.createElement)("div",{className:"v"},(null!==(r=h.cache_kb)&&void 0!==r?r:0).toLocaleString(),(0,e.createElement)("small",null,"KB")),(0,e.createElement)("div",{className:"spark"},(0,e.createElement)("i",{style:{width:O(h.cache_kb,5e3)+"%"}})))),(0,e.createElement)("div",{className:"card"},(0,e.createElement)("div",{className:"hd"},(0,e.createElement)("div",null,(0,e.createElement)("h2",null,"Maintenance"),(0,e.createElement)("p",null,"Optimize renders your homepage in the background to find and measure fonts — no manual visit needed. Empty cache clears everything to start fresh.")),(0,e.createElement)("div",{className:"actions"},(0,e.createElement)("button",{className:"btn",disabled:v,onClick:async()=>{if(window.confirm("Empty all hosted fonts, caches and learned detectors? Click Optimize now afterwards (or visit your site) to rebuild.")){g(!0),S("");try{await l.purge(),await x(!0),S("Cache cleared. Click “Optimize now” to rebuild from your homepage.")}finally{g(!1)}}}},v?"Emptying…":"⟲ Empty cache"),(0,e.createElement)("button",{className:"btn primary",disabled:N,onClick:async()=>{k(!0),S("Optimizing… detecting and self-hosting your fonts.");try{const a=await l.optimize();if(!a||!a.families)return S("Optimize ran, but no Google Fonts were found on the homepage. If your fonts only load on other pages, visit one of those pages (the beacon measures every front-end visit), or check Settings → excluded URLs."),void await x(!0);S(`Self-hosted ${a.families} font ${1===a.families?"family":"families"}. Measuring real usage in the background…`);const n=await(e=a.probe_url,t=a.beacon_before,new Promise(a=>{if(!e)return void a("blocked");const n=document.createElement("iframe");n.setAttribute("aria-hidden","true"),n.setAttribute("tabindex","-1"),n.style.cssText="position:fixed;left:-10000px;top:0;width:1280px;height:900px;border:0;opacity:0;pointer-events:none;",n.src=e,document.body.appendChild(n);let s=0;const r=1e3,c=e=>{try{n.remove()}catch(e){}a(e)},i=async()=>{s+=r;try{const e=await l.getStats();if(e&&Number(e.last_beacon||0)>Number(t||0))return void c("measured")}catch(e){}s>=12e3?c("blocked"):setTimeout(i,r)};setTimeout(i,r)}));await x(!0),S("measured"===n?`Done — ${a.families} font ${1===a.families?"family":"families"} self-hosted and measured. See Used vs Unused on the Fonts tab.`:`Done — ${a.families} font ${1===a.families?"family":"families"} self-hosted. The background usage scan couldn’t run (your server likely blocks framing its own pages). Used vs Unused will still fill in automatically as visitors browse your site — or open your homepage in a new tab once to measure it now.`)}finally{k(!1)}var e,t}},N?"Optimizing…":"⚡ Optimize now"))),(0,e.createElement)("div",{className:"bd"},w&&(0,e.createElement)("p",{className:"notice"},w),(0,e.createElement)("div",{className:"cli"},(0,e.createElement)("span",{className:"c"},"# x-ray any page (admins only)"),(0,e.createElement)("br",null),d,"/?easyfonts_xray=",(0,e.createElement)("span",{className:"tok"},"1")),(0,e.createElement)("p",{className:"muted",style:{marginTop:"12px",marginBottom:0}},"Need to rebuild the database? See the ",(0,e.createElement)("strong",null,"Diagnostics")," tab."))),(0,e.createElement)("div",{className:"card"},(0,e.createElement)("div",{className:"hd"},(0,e.createElement)("div",null,(0,e.createElement)("h2",null,"Active detectors"),(0,e.createElement)("p",null,"Auto-Config learns where your fonts come from and lights these up as it finds them."))),(0,e.createElement)("div",{className:"bd",style:{paddingTop:"4px",paddingBottom:"6px"}},0===C.length?(0,e.createElement)("p",{className:"muted"},"Nothing learned yet. Click ",(0,e.createElement)("strong",null,"Optimize now")," (or visit your site’s front end) so Easy Fonts can see a real page."):Object.keys(o).map(t=>{const a=C.includes(t);return(0,e.createElement)("div",{key:t,className:"det"},(0,e.createElement)("span",{className:"led "+(a?"on":"off")}),(0,e.createElement)("span",{className:"nm",dangerouslySetInnerHTML:{__html:u(t)}}),(0,e.createElement)("span",{className:"badge "+(a?"on":"off")},a?"ACTIVE":"Not detected"))})))),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("div",{className:"promo"},(0,e.createElement)("div",{className:"glow"}),(0,e.createElement)("div",{className:"inner"},(0,e.createElement)("span",{className:"tag"},"◆ FluxPress Suite"),(0,e.createElement)("h3",null,"Speed up the rest of your site."),(0,e.createElement)("p",{className:"lede"},"Easy Fonts handles your fonts. ",(0,e.createElement)("b",null,"Easy Optimizer")," handles everything else."),(0,e.createElement)("div",{className:"feat"},(0,e.createElement)("div",{className:"row"},(0,e.createElement)("span",{className:"ck"},"✓"),"Full-page & object caching"),(0,e.createElement)("div",{className:"row"},(0,e.createElement)("span",{className:"ck"},"✓"),"Lazy-load images & iframes"),(0,e.createElement)("div",{className:"row"},(0,e.createElement)("span",{className:"ck"},"✓"),"Remove unused CSS"),(0,e.createElement)("div",{className:"row"},(0,e.createElement)("span",{className:"ck"},"✓"),"Delay & defer JavaScript"),(0,e.createElement)("div",{className:"row"},(0,e.createElement)("span",{className:"ck"},"✓"),"Smart preloading & tuning")),(0,e.createElement)("a",{className:"cta",href:m.url},m.label," →"),(0,e.createElement)("div",{className:"foot"},(0,e.createElement)("a",{href:"https://fluxpress.io",target:"_blank",rel:"noopener noreferrer"},"Free Optimization plugin by FluxPress")))),(0,e.createElement)("div",{className:"side-note"},"Trusted by 2,000+ sites to cut Core Web Vitals time."))))}},{id:"fonts",label:"Fonts",component:function(){const{value:a,refresh:n,setLocal:s}=i("fonts"),[r,c]=(0,t.useState)(""),[o,m]=(0,t.useState)({value:!1,seq:0}),[d,u]=(0,t.useState)(!1),E=async e=>{s(t=>function(e,t){return(e||[]).map(e=>{if(e.family!==t.family)return e;if("family"===t.scope){const a=t.value;return{...e,enabled:a,variants:e.variants.map(e=>({...e,is_enabled:a,is_preloaded:!!a&&e.is_preloaded}))}}const a=e.variants.map(e=>e.weight!==t.weight||e.style!==t.style?e:"enabled"===t.field?{...e,is_enabled:t.value,is_preloaded:!!t.value&&e.is_preloaded}:{...e,is_preloaded:t.value});return{...e,enabled:a.some(e=>e.is_enabled),variants:a}})}(t,e));try{await l.toggleFont(e)}catch(e){n()}},h=async(e,t)=>{s(a=>(a||[]).map(a=>{const n=!!a.used;return("used"===e?n:!n)?{...a,enabled:t,variants:a.variants.map(e=>({...e,is_enabled:t,is_preloaded:!!t&&e.is_preloaded}))}:a}));try{await l.bulkToggle({field:"enabled",value:t,scope:e})}catch(e){n()}},v=(0,t.useMemo)(()=>{const e=a||[];if(!r.trim())return e;const t=r.trim().toLowerCase();return e.filter(e=>e.family.toLowerCase().includes(t))},[a,r]);if(!a)return(0,e.createElement)("div",{className:"loading"},(0,e.createElement)(p,null)," Loading…");const g=v.filter(e=>e.used),f=v.filter(e=>!e.used);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"page-head"},(0,e.createElement)("div",null,(0,e.createElement)("h2",null,"Hosted fonts"),(0,e.createElement)("p",null,"Toggle whole families or individual weights. Preload only what renders above the fold.")),(0,e.createElement)("div",{className:"tools"},(0,e.createElement)("div",{className:"search"},(0,e.createElement)("span",{className:"mag"},"⌕"),(0,e.createElement)("input",{type:"text",placeholder:"Filter families…",value:r,onChange:e=>c(e.target.value)})),(0,e.createElement)("button",{className:"btn sm",onClick:()=>{const e=!d;u(e),m(t=>({value:e,seq:t.seq+1}))}},d?"Collapse all":"Expand all"))),(0,e.createElement)(b,{title:"Used fonts",desc:"— render on your site, measured in real browsers",families:g,scope:"used",onToggle:E,onBulk:h,expandSignal:o}),(0,e.createElement)(b,{title:"Unused fonts",desc:(0,e.createElement)(e.Fragment,null,"— hosted but never observed rendering. ",(0,e.createElement)("span",{className:"safe"},"Safe to disable the whole group.")),families:f,scope:"unused",onToggle:E,onBulk:h,expandSignal:o}))}},{id:"usage",label:"Usage",component:function(){const{value:t}=i("usage");return t?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"page-head"},(0,e.createElement)("div",null,(0,e.createElement)("h2",null,"What actually renders"),(0,e.createElement)("p",null,"Measured in real browsers by the beacon — so you can preload the fonts your visitors see and trim the ones they never do."))),(0,e.createElement)("section",{className:"section"},0===t.length?(0,e.createElement)("div",{className:"s-bd"},(0,e.createElement)("p",{className:"muted",style:{margin:0}},"No beacon data yet. Visit a few front-end pages so the beacon can report real usage.")):(0,e.createElement)("table",{className:"vtable"},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,"Family"),(0,e.createElement)("th",null,"Weights"),(0,e.createElement)("th",{className:"c"},"Pages"),(0,e.createElement)("th",{className:"c"},"Hits"),(0,e.createElement)("th",null,"Status"))),(0,e.createElement)("tbody",null,t.map(t=>(0,e.createElement)("tr",{key:t.family},(0,e.createElement)("td",{className:"wt",style:{fontFamily:"var(--sans)",fontWeight:700}},t.family),(0,e.createElement)("td",{className:"subs"},t.weights),(0,e.createElement)("td",{className:"c subs"},t.pages),(0,e.createElement)("td",{className:"c subs"},t.hits),(0,e.createElement)("td",null,1===Number(t.above_fold)&&(0,e.createElement)(v,{tone:"info"},"above fold"),1===Number(t.rendered)?(0,e.createElement)(v,{tone:"ok"},"rendered"):(0,e.createElement)(v,{tone:"warn"},"unseen")))))))):(0,e.createElement)("div",{className:"loading"},(0,e.createElement)(p,null)," Loading…")}},{id:"settings",label:"Settings",component:function(){const{value:a,refresh:n,setLocal:s}=i("settings"),[r,c]=(0,t.useState)(null),[o,m]=(0,t.useState)(!1),[d,u]=(0,t.useState)(!1),[E,h]=(0,t.useState)(""),[b,v]=(0,t.useState)("optimisation"),[w,S]=(0,t.useState)(!1),[x,C]=(0,t.useState)(""),_=(0,t.useRef)(null),O=(0,t.useRef)(null);if((0,t.useEffect)(()=>{a&&!r&&c(a)},[a]),(0,t.useEffect)(()=>{const e=e=>{O.current&&!O.current.contains(e.target)&&S(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),!r)return(0,e.createElement)("div",{className:"loading"},(0,e.createElement)(p,null)," Loading…");const T=(e,t)=>{c({...r,[e]:t}),u(!1)},F=r.subsets||[],L=r.excluded_urls||[],P=e=>{T("subsets",F.includes(e)?F.filter(t=>t!==e):[...F,e])},R=()=>{const e=x.trim();e&&!L.includes(e)&&T("excluded_urls",[...L,e]),C("")};return(0,e.createElement)("div",{className:"set-layout"},(0,e.createElement)("nav",{className:"set-nav"},y.map(([t,a],n)=>(0,e.createElement)("button",{key:t,className:b===t?"active":"",onClick:()=>(e=>{v(e);const t=document.getElementById("set-"+e);t&&t.scrollIntoView({behavior:"smooth",block:"start"})})(t)},(0,e.createElement)("span",{className:"n"},String(n+1).padStart(2,"0"))," ",a))),(0,e.createElement)("div",{className:"set-col"},(0,e.createElement)("section",{className:"section",id:"set-optimisation"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Optimisation"),(0,e.createElement)("p",null,"Core front-end behaviour. These control how Easy Fonts processes and serves your fonts.")),(0,e.createElement)(k,{h:"Enable Easy Fonts",p:"Master switch for all front-end processing."},(0,e.createElement)(N,{checked:r.enabled,onChange:e=>T("enabled",e)})),(0,e.createElement)(k,{h:"Auto-Config",p:"Keep learning where fonts come from. Turn off to freeze to the detectors already learned."},(0,e.createElement)(N,{checked:r.auto_config,onChange:e=>T("auto_config",e)})),(0,e.createElement)(k,{h:"Metric-matched fallbacks",p:"Generate zero-CLS fallback faces from each font’s real metrics."},(0,e.createElement)(N,{checked:r.metric_fallbacks,onChange:e=>T("metric_fallbacks",e)})),(0,e.createElement)(k,{h:"Smart preload",p:"Preload above-the-fold fonts using real beacon data."},(0,e.createElement)(N,{checked:r.smart_preload,onChange:e=>T("smart_preload",e)})),(0,e.createElement)(k,{h:"Strip Google resource hints",code:["preconnect","dns-prefetch"],p:"Remove now-useless preconnect / dns-prefetch to Google."},(0,e.createElement)(N,{checked:r.strip_hints,onChange:e=>T("strip_hints",e)})),(0,e.createElement)(k,{h:"Usage beacon",p:"Measure real font rendering in visitors’ browsers."},(0,e.createElement)(N,{checked:r.beacon,onChange:e=>T("beacon",e)})),(0,e.createElement)(k,{h:"Inline the combined stylesheet",code:["<style>"],p:"Output the consolidated font CSS as a minified inline <style> instead of a linked file — removes the extra request so it’s not render-blocking."},(0,e.createElement)(N,{checked:r.inline_css,onChange:e=>T("inline_css",e)})),(0,e.createElement)(k,{h:"Block async (JS-injected) Google Fonts",p:"Catch fonts injected by JavaScript at runtime and self-host them on the next page view."},(0,e.createElement)(N,{checked:r.async_blocker,onChange:e=>T("async_blocker",e)}))),(0,e.createElement)("section",{className:"section",id:"set-fontdisplay"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"font-display"),(0,e.createElement)("p",null,"How text behaves while a web font loads.")),(0,e.createElement)("div",{className:"s-bd"},(0,e.createElement)("div",{className:"seg"},g.map(t=>(0,e.createElement)("label",{key:t},(0,e.createElement)("input",{type:"radio",name:"fd",checked:r.font_display===t,onChange:()=>T("font_display",t)}),(0,e.createElement)("span",null,t)))))),(0,e.createElement)("section",{className:"section"+(w?" section--open":""),id:"set-subsets"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Subsets"),(0,e.createElement)("p",null,"Only keep the character sets you need — everything else is dropped to shrink payload. Latin and Latin Extended are selected by default; remove them if your site doesn’t need them.")),(0,e.createElement)("div",{className:"s-bd"},(0,e.createElement)("div",{className:"ms",ref:O},(0,e.createElement)("div",{className:"chips",onClick:()=>S(!0)},F.map(t=>{const a=f.find(e=>e.value===t);return(0,e.createElement)("span",{key:t,className:"chip"},a?a.label:t,(0,e.createElement)("button",{type:"button",className:"x",onClick:e=>{e.stopPropagation(),P(t)},"aria-label":"Remove"},"×"))}),(0,e.createElement)("input",{className:"add",placeholder:"Add subset…",onFocus:()=>S(!0),readOnly:!0})),w&&(0,e.createElement)("ul",{className:"ms-menu",role:"listbox","aria-multiselectable":"true"},f.map(t=>{const a=F.includes(t.value);return(0,e.createElement)("li",{key:t.value,role:"option","aria-selected":a,className:"ms-opt"+(a?" sel":""),onClick:()=>P(t.value)},(0,e.createElement)("span",{className:"ms-check"+(a?" on":"")},a?"✓":""),t.label)}))))),(0,e.createElement)("section",{className:"section",id:"set-cdn"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"CDN"),(0,e.createElement)("p",null,"Optionally serve the hosted fonts and stylesheet from a CDN. Enter your CDN base URL (a pull-zone that mirrors your site). Leave empty to serve from your own domain.")),(0,e.createElement)("div",{className:"s-bd"},(0,e.createElement)("div",{className:"field"},(0,e.createElement)("label",null,"CDN base URL"),(0,e.createElement)("div",{className:"help"},"Example: https://cdn.yourdomain.com"),(0,e.createElement)("input",{className:"input",type:"text",placeholder:"https://cdn.yourdomain.com",value:r.cdn_url||"",onChange:e=>T("cdn_url",e.target.value)})))),(0,e.createElement)("section",{className:"section",id:"set-excluded"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Excluded URLs"),(0,e.createElement)("p",null,"Paths containing any of these strings are skipped entirely.")),(0,e.createElement)("div",{className:"s-bd"},L.length>0&&(0,e.createElement)("div",{className:"chips",style:{marginBottom:"10px"}},L.map(t=>(0,e.createElement)("span",{key:t,className:"chip"},t,(0,e.createElement)("button",{type:"button",className:"x",onClick:()=>T("excluded_urls",L.filter(e=>e!==t)),"aria-label":"Remove"},"×")))),(0,e.createElement)("div",{className:"inline-add"},(0,e.createElement)("input",{className:"input",type:"text",placeholder:"/path-to-exclude",value:x,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),R())}}),(0,e.createElement)("button",{className:"btn",onClick:R},"Add")))),(0,e.createElement)("section",{className:"section",id:"set-importexport"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Import / Export"),(0,e.createElement)("p",null,"Move your configuration between sites.")),(0,e.createElement)("div",{className:"s-bd"},(0,e.createElement)("div",{className:"inline-add",style:{gap:"10px"}},(0,e.createElement)("button",{className:"btn",onClick:async()=>{h("");try{const e=await l.exportSettings(),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download="easyfonts-settings.json",document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(a)}catch(e){h("Export failed.")}}},"⭳ Export settings"),(0,e.createElement)("button",{className:"btn",onClick:()=>_.current&&_.current.click()},"⭱ Import settings"),(0,e.createElement)("input",{ref:_,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:async e=>{const t=e.target.files&&e.target.files[0];if(e.target.value="",t){h("");try{const e=JSON.parse(await t.text()),a=await l.importSettings(e),n=a.settings||a;c(n),s(n),h("Settings imported successfully."),u(!1)}catch(e){h("Import failed — that file isn’t a valid Easy Fonts settings export.")}}}})),E&&(0,e.createElement)("p",{className:"notice",style:{marginTop:"12px",marginBottom:0}},E))),(0,e.createElement)("section",{className:"section",id:"set-uninstall"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Uninstall"),(0,e.createElement)("p",null,"Control what happens to your data if you delete Easy Fonts.")),(0,e.createElement)(k,{h:"Remove all data on uninstall",p:"When on, deleting the plugin also drops its database tables, options, and the hosted-fonts cache. Off (default) keeps everything so you can reinstall without reconfiguring."},(0,e.createElement)(N,{checked:r.remove_data_on_uninstall,onChange:e=>T("remove_data_on_uninstall",e)}))),(0,e.createElement)("div",{className:"savebar-sticky"},(0,e.createElement)("span",{className:"note"},"Changes apply on the next page view across your site."),d&&(0,e.createElement)("span",{className:"saved"},"Saved ✓"),(0,e.createElement)("div",{className:"right"},(0,e.createElement)("button",{className:"btn",onClick:()=>{n().then(e=>{e&&(c(e),u(!1))})}},"Reset"),(0,e.createElement)("button",{className:"btn primary",disabled:o,onClick:async()=>{m(!0);try{const e=await l.saveSettings(r);c(e),s(e),u(!0)}finally{m(!1)}}},o?"Saving…":"Save changes")))))}},{id:"diagnostics",label:"Diagnostics",component:function(){const{value:a,refresh:n}=i("diagnostics"),[s,r]=(0,t.useState)(!1),[c,o]=(0,t.useState)(!1);if(!a)return(0,e.createElement)("div",{className:"loading"},(0,e.createElement)(p,null)," Loading…");const m=a.environment||{},d=a.cache||{},u=a.plugin||{},E=a.tables||{};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"page-head"},(0,e.createElement)("div",null,(0,e.createElement)("h2",null,"Diagnostics"),(0,e.createElement)("p",null,"Everything support needs, in one place.")),(0,e.createElement)("div",{className:"tools"},(0,e.createElement)("button",{className:"btn",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(a,null,2)),r(!0),setTimeout(()=>r(!1),1500)}},s?"Copied ✓":"Copy report"),(0,e.createElement)("button",{className:"btn primary",disabled:c,onClick:async()=>{if(window.confirm("Rebuild the Easy Fonts database tables? This fixes a stale or incompatible schema. Hosted fonts re-detect on the next page view or Optimize.")){o(!0);try{await l.repair(),await n()}finally{o(!1)}}}},c?"Rebuilding…":"Rebuild database"))),(0,e.createElement)("section",{className:"section"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Environment")),(0,e.createElement)(w,{label:"Plugin version",value:u.version}),(0,e.createElement)(w,{label:"WordPress",value:m.wp}),(0,e.createElement)(w,{label:"PHP",value:m.php}),(0,e.createElement)(w,{label:"Native HTML API",value:m.has_html_api?"available":"missing",ok:!!m.has_html_api}),(0,e.createElement)(w,{label:"Brotli (woff2 metrics)",value:m.brotli?"available":"fetches TTF instead",ok:!0}),(0,e.createElement)(w,{label:"Cache directory writable",value:u.cache_writable?"yes":"no",ok:!!u.cache_writable}),(0,e.createElement)(w,{label:"Multisite",value:m.is_multisite?"yes":"no",ok:!0})),(0,e.createElement)("section",{className:"section"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Database")),(0,e.createElement)(w,{label:"Tables healthy",value:a.tables_ok?"yes":"no",ok:!!a.tables_ok}),Object.keys(E).map(t=>(0,e.createElement)(w,{key:t,label:"Table: "+t,value:E[t].schema_ok?E[t].rows+" rows":"missing / wrong schema",ok:!!E[t].schema_ok})),a.last_db_error?(0,e.createElement)(w,{label:"Last DB error",value:a.last_db_error,ok:!1}):null),(0,e.createElement)("section",{className:"section"},(0,e.createElement)("div",{className:"s-hd"},(0,e.createElement)("h2",null,"Cache")),(0,e.createElement)(w,{label:"Families hosted",value:d.families}),(0,e.createElement)(w,{label:"Variants",value:d.variants}),(0,e.createElement)(w,{label:"Total cache (KB)",value:d.total_kb})))}}],x=window.EasyFontsAdmin&&window.EasyFontsAdmin.version||"",C=document.getElementById("easyfonts-admin-root");C&&(0,t.render)((0,e.createElement)(function({children:a}){const[n,l]=(0,t.useState)({stats:null,fonts:null,usage:null,diagnostics:null,settings:null}),i=(0,t.useRef)({}),o=(0,t.useCallback)((e,t)=>{const a=s[e];return a?!t&&i.current[e]?Promise.resolve():(i.current[e]=!0,a().then(t=>(l(a=>({...a,[e]:t})),t)).catch(()=>{l(t=>({...t,[e]:r[e]}))})):Promise.resolve()},[]),m=(0,t.useCallback)(e=>o(e,!0),[o]),d=(0,t.useCallback)((e,t)=>{l(a=>({...a,[e]:"function"==typeof t?t(a[e]):t}))},[]);return(0,e.createElement)(c.Provider,{value:{data:n,load:o,refresh:m,setLocal:d}},a)},null,(0,e.createElement)(function(){const[a,n]=(0,t.useState)("dashboard"),l=(S.find(e=>e.id===a)||S[0]).component;return(0,e.createElement)("div",{className:"ef-app"},(0,e.createElement)("div",{className:"ef-wrap"},(0,e.createElement)("div",{className:"shell"},(0,e.createElement)("div",{className:"topbar"},(0,e.createElement)("div",{className:"brand"},(0,e.createElement)("div",{className:"logo"},"E"),(0,e.createElement)("div",null,(0,e.createElement)("h1",null,"Easy Fonts"))),x&&(0,e.createElement)("div",{className:"savebar"},(0,e.createElement)("span",{className:"ver"},"v",x))),(0,e.createElement)("nav",{className:"tabs",role:"tablist"},S.map(t=>(0,e.createElement)("button",{key:t.id,role:"tab","aria-selected":a===t.id,className:a===t.id?"active":"",onClick:()=>n(t.id)},t.label))),(0,e.createElement)(l,null),(0,e.createElement)("div",{className:"footer"},(0,e.createElement)("span",null,"Easy Fonts ",x||""," · by FluxPress")))))},null)),C)}},a={};function n(e){var l=a[e];if(void 0!==l)return l.exports;var s=a[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.m=t,e=[],n.O=(t,a,l,s)=>{if(!a){var r=1/0;for(m=0;m<e.length;m++){for(var[a,l,s]=e[m],c=!0,i=0;i<a.length;i++)(!1&s||r>=s)&&Object.keys(n.O).every(e=>n.O[e](a[i]))?a.splice(i--,1):(c=!1,s<r&&(r=s));if(c){e.splice(m--,1);var o=l();void 0!==o&&(t=o)}}return t}s=s||0;for(var m=e.length;m>0&&e[m-1][2]>s;m--)e[m]=e[m-1];e[m]=[a,l,s]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var l,s,[r,c,i]=a,o=0;if(r.some(t=>0!==e[t])){for(l in c)n.o(c,l)&&(n.m[l]=c[l]);if(i)var m=i(n)}for(t&&t(a);o<r.length;o++)s=r[o],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(m)},a=globalThis.webpackChunkeasyfonts_admin=globalThis.webpackChunkeasyfonts_admin||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var l=n.O(void 0,[350],()=>n(892));l=n.O(l)})();
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 index.asset.php
PHP
105 B
2026-06-10 13:15
EDIT
📄 index.js
JS
34.2 KB
2026-06-10 13:15
EDIT
📄 style-index-rtl.css
CSS
16.9 KB
2026-06-10 13:15
EDIT
📄 style-index.css
CSS
16.9 KB
2026-06-10 13:15
EDIT