| 1 |
!function(){var e={4184:function(e,s){var n;!function(){"use strict";var t={}.hasOwnProperty;function r(){for(var e=[],s=0;s<arguments.length;s++){var n=arguments[s];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var c in n)t.call(n,c)&&n[c]&&e.push(c);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(s,[]))||(e.exports=n)}()},5251:function(e,s,n){"use strict";var t=n(9196),r=60103;if(s.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var i=Symbol.for;r=i("react.element"),s.Fragment=i("react.fragment")}var a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c=Object.prototype.hasOwnProperty,o={key:!0,ref:!0,__self:!0,__source:!0};function l(e,s,n){var t,i={},l=null,d=null;for(t in void 0!==n&&(l=""+n),void 0!==s.key&&(l=""+s.key),void 0!==s.ref&&(d=s.ref),s)c.call(s,t)&&!o.hasOwnProperty(t)&&(i[t]=s[t]);if(e&&e.defaultProps)for(t in s=e.defaultProps)void 0===i[t]&&(i[t]=s[t]);return{$$typeof:r,type:e,key:l,ref:d,props:i,_owner:a.current}}s.jsx=l,s.jsxs=l},5893:function(e,s,n){"use strict";e.exports=n(5251)},9196:function(e){"use strict";e.exports=window.React}},s={};function n(t){var r=s[t];if(void 0!==r)return r.exports;var i=s[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(s,{a:s}),s},n.d=function(e,s){for(var t in s)n.o(s,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:s[t]})},n.o=function(e,s){return Object.prototype.hasOwnProperty.call(e,s)},function(){"use strict";var e={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let s;const t=new Uint8Array(16);function r(){if(!s&&(s="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!s))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return s(t)}const i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));function a(e,s=0){return(i[e[s+0]]+i[e[s+1]]+i[e[s+2]]+i[e[s+3]]+"-"+i[e[s+4]]+i[e[s+5]]+"-"+i[e[s+6]]+i[e[s+7]]+"-"+i[e[s+8]]+i[e[s+9]]+"-"+i[e[s+10]]+i[e[s+11]]+i[e[s+12]]+i[e[s+13]]+i[e[s+14]]+i[e[s+15]]).toLowerCase()}var c=function(s,n,t){if(e.randomUUID&&!n&&!s)return e.randomUUID();const i=(s=s||{}).random||(s.rng||r)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,n){t=t||0;for(let e=0;e<16;++e)n[t+e]=i[e];return n}return a(i)},o=window.wp.element,l=window.wp.i18n;const{auto_start_index:d,ajax_url:u,index_meta:p=null,is_epio:y,ep_last_sync_date:m=null,ep_last_sync_failed:h=!1,nonce:_}=window.epDash,g=e=>{let s=0;return e.current_sync_item&&(s+=e.current_sync_item.found_items),s=e.sync_stack.reduce(((e,s)=>e+s.found_items),s),s+=e.totals.failed,s+=e.totals.skipped,s+=e.totals.synced,s},x=e=>{let s=0;return e.current_sync_item&&(s+=e.current_sync_item.failed,s+=e.current_sync_item.skipped,s+=e.current_sync_item.synced),s+=e.totals.failed,s+=e.totals.skipped,s+=e.totals.synced,s};var w=window.wp.components,f=window.wp.primitives;var S=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,o.createElement)(f.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"}));var v=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,o.createElement)(f.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),b=n(5893),j=()=>(0,b.jsx)(f.SVG,{version:"1.1",xmlns:"https://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,b.jsx)(f.Path,{d:"M5 16v-12h3v12h-3zM12 4h3v12h-3v-12z"})}),C=()=>(0,b.jsx)(f.SVG,{version:"1.1",xmlns:"https://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,b.jsx)(f.Path,{d:"M5 4l10 6-10 6v-12z"})}),P=()=>(0,b.jsx)(f.SVG,{version:"1.1",xmlns:"https://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,b.jsx)(f.Path,{d:"M 4 16 L 4 4 L 16 4 L 16 16 L 4 16 Z"})}),D=({disabled:e,isPaused:s,isSyncing:n,onPause:t,onResume:r,onStop:i,onSync:a,showSync:c})=>(0,b.jsxs)("div",{className:"ep-sync-controls",children:[c&&!n?(0,b.jsx)("div",{className:"ep-sync-controls__sync",children:(0,b.jsx)(w.Button,{className:"ep-sync-button ep-sync-button--sync",disabled:e,icon:v,isPrimary:!0,onClick:a,children:(0,l.__)("Sync Now","elasticpress")})}):null,n?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"ep-sync-controls__pause-resume",children:s?(0,b.jsx)(w.Button,{className:"ep-sync-button ep-sync-button--resume",disabled:e,icon:C,isPrimary:!0,onClick:r,children:(0,l.__)("Resume","elasticpress")}):(0,b.jsx)(w.Button,{className:"ep-sync-button ep-sync-button--pause",disabled:e,icon:j,isPrimary:!0,onClick:t,children:(0,l.__)("Pause","elasticpress")})}),(0,b.jsx)("div",{className:"ep-sync-controls__stop",children:(0,b.jsx)(w.Button,{className:"ep-sync-button ep-sync-button--stop",icon:P,isSecondary:!0,onClick:i,children:(0,l.__)("Stop","elasticpress")})})]}):null,c?(0,b.jsx)("div",{className:"ep-sync-controls__learn-more",children:(0,b.jsx)(w.Button,{href:"https://elasticpress.zendesk.com/hc/en-us/articles/5205632443533",target:"_blank",variant:"link",children:(0,l.__)("Learn more","elasticpress")})}):null]}),k=({messages:e})=>(0,b.jsxs)("div",{className:"ep-sync-messages",children:[e.map(((e,s)=>(0,b.jsx)("div",{className:"ep-sync-messages__line-number",role:"presentation",children:s+1},`line-${e.id}`))),e.map((e=>(0,b.jsx)("div",{className:`ep-sync-messages__message ep-sync-messages__message--${e.status}`,children:e.message},`message-${e.id}`)))]}),N=({messages:e})=>{const[s,n]=(0,o.useState)(!1),t=e.filter((e=>"error"===e.status||"warning"===e.status));(0,o.useEffect)((()=>{t.length>0&&n(!0)}),[t.length]);const r=[{messages:e,name:"full",title:(0,l.__)("Full Log","elasticpress")},{messages:t,name:"error",title:(0,l.sprintf)((0,l.__)("Errors (%d)","elasticpress"),t.length)}];return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w.ToggleControl,{checked:s,onChange:e=>{n(e)},label:(0,l.__)("Show log","elasticpress")}),s?(0,b.jsx)(w.TabPanel,{tabs:r,children:({messages:e})=>(0,b.jsx)(k,{messages:e})}):null]})},T=n(4184),L=n.n(T),F=window.wp.date,E=({dateTime:e,...s})=>(0,b.jsx)("time",{dateTime:(0,F.dateI18n)("c",e),...s,children:(0,F.dateI18n)("D, F d, Y H:i",e)}),I=({isComplete:e,isFailed:s,current:n,total:t})=>{const r=t?Math.floor(n/t*100):100;return(0,b.jsx)("div",{"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":r,className:L()("ep-sync-progress-bar",{"ep-sync-progress-bar--complete":e,"ep-sync-progress-bar--failed":s}),role:"progressbar",children:(0,b.jsx)("div",{className:"ep-sync-progress-bar__progress",style:{minWidth:`${r}%`},children:`${r}%`})})},R=()=>(0,b.jsx)(f.SVG,{version:"1.1",xmlns:"https://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,b.jsx)(f.Path,{d:"M 7.543 17.501 L 10 15 L 10 16.25 C 11.216 16.25 12.405 15.884 13.416 15.197 C 14.427 14.509 15.213 13.531 15.679 12.389 C 16.144 11.246 16.264 9.988 16.027 8.775 C 15.788 7.561 15.201 6.448 14.34 5.573 L 16.072 3.804 C 16.875 4.615 17.512 5.582 17.946 6.645 C 18.38 7.709 18.603 8.85 18.601 10.002 C 18.601 14.834 14.751 18.75 10.002 18.75 L 10.001 18.75 L 10.001 20 L 7.543 17.501 Z M 1.399 10.001 C 1.406 5.171 5.253 1.256 10 1.25 L 10.001 1.25 L 10.001 0 L 12.458 2.501 L 10.001 5 L 10.001 3.75 L 9.999 3.75 C 8.784 3.75 7.595 4.117 6.584 4.804 C 5.574 5.493 4.786 6.469 4.321 7.612 C 3.856 8.756 3.735 10.013 3.974 11.227 C 4.211 12.439 4.798 13.552 5.659 14.427 L 3.928 16.197 C 3.126 15.39 2.489 14.429 2.055 13.369 C 1.62 12.309 1.398 11.172 1.399 10.025 L 1.399 9.999 L 1.399 10.002 L 1.399 10.001 Z"})}),M=({isCli:e,isComplete:s,isFailed:n,isPaused:t,itemsProcessed:r,itemsTotal:i,dateTime:a})=>{const c=(0,o.useMemo)((()=>n?(0,l.__)("Sync failed","elasticpress"):s?(0,l.__)("Sync complete","elasticpress"):t?(0,l.__)("Sync paused","elasticpress"):e?(0,l.__)("WP CLI sync in progress","elasticpress"):(0,l.__)("Sync in progress","elasticpress")),[e,s,n,t]);return(0,b.jsxs)("div",{className:L()("ep-sync-progress",{"ep-sync-progress--syncing":!t&&!s&&!n}),children:[(0,b.jsx)(w.Icon,{icon:R}),(0,b.jsxs)("div",{className:"ep-sync-progress__details",children:[(0,b.jsx)("strong",{children:c}),a?(0,b.jsxs)(b.Fragment,{children:[(0,l.__)("Started on","elasticpress")," ",(0,b.jsx)(E,{dateTime:(0,F.dateI18n)("c",a)})]}):null]}),(0,b.jsx)("div",{className:"ep-sync-progress__progress-bar",children:(0,b.jsx)(I,{current:r,isComplete:s,isFailed:n,total:i})})]})},B=()=>(0,b.jsx)(f.SVG,{version:"1.1",xmlns:"https://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,b.jsx)(f.Path,{d:"M7.28 18c-0.15 0.020-0.26-0.020-0.41-0.070-0.56-0.19-0.83-0.79-0.66-1.35 0.17-0.55 1-3.040 1-3.58 0-0.53-0.75-1-1.35-1h-3c-0.6 0-1-0.4-1-1s2-7 2-7c0.17-0.39 0.55-1 1-1h9.14v9h-2.14c-0.41 0.41-3.3 4.71-3.58 5.27-0.21 0.41-0.6 0.68-1 0.73zM18 12h-2v-9h2v9z"})}),O=()=>(0,b.jsx)(f.SVG,{version:"1.1",xmlns:"https://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,b.jsx)(f.Path,{d:"M12.72 2c0.15-0.020 0.26 0.020 0.41 0.070 0.56 0.19 0.83 0.79 0.66 1.35-0.17 0.55-1 3.040-1 3.58 0 0.53 0.75 1 1.35 1h3c0.6 0 1 0.4 1 1s-2 7-2 7c-0.17 0.39-0.55 1-1 1h-9.14v-9h2.14c0.41-0.41 3.3-4.71 3.58-5.27 0.21-0.41 0.6-0.68 1-0.73zM2 8h2v9h-2v-9z"})}),z=({dateTime:e,isSuccess:s})=>(0,b.jsxs)("p",{className:"ep-sync-status "+(s?"ep-sync-status--success":"ep-sync-status--error"),children:[(0,b.jsx)(w.Icon,{icon:s?O:B}),(0,b.jsxs)("span",{className:"ep-sync-status__label",children:[s?(0,l.__)("Sync success on","elasticpress"):(0,l.__)("Sync unsuccessful on","elasticpress")," ",(0,b.jsx)(E,{dateTime:(0,F.dateI18n)("c",e),className:"ep-sync-status__time"})]})]}),A=({heading:e,introduction:s,isCli:n,isComplete:t,isDisabled:r,isFailed:i,isPaused:a,isSyncing:c,itemsProcessed:o,itemsTotal:d,lastSyncDateTime:u,lastSyncFailed:p,logMessages:y,onDelete:m,onPause:h,onResume:_,onStop:g,onSync:x,showDelete:f,showLastSync:v,showProgress:j,showSync:C,syncStartDateTime:P,warningMessage:k})=>(0,b.jsxs)(b.Fragment,{children:[e?(0,b.jsx)("h2",{className:"ep-sync-heading",children:e}):null,(0,b.jsx)(w.Panel,{className:"ep-sync-panel",children:(0,b.jsxs)(w.PanelBody,{className:"ep-sync-panel__body",children:[(0,b.jsxs)("div",{className:"ep-sync-panel__description",children:[s?(0,b.jsx)("p",{className:"ep-sync-panel__introduction",children:s}):null,v&&u?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("h3",{className:"ep-sync-heading",children:(0,l.__)("Last Sync","elasticpress")}),(0,b.jsx)(z,{dateTime:u,isSuccess:!p})]}):null,f?(0,b.jsx)("p",{children:(0,b.jsx)(w.Button,{className:"ep-sync-button ep-sync-button--delete",disabled:r||c,isSecondary:!0,isDestructive:!0,onClick:m,children:(0,l.__)("Delete all Data and Start a Fresh Sync","elasticpress")})}):null]}),(0,b.jsx)("div",{className:"ep-sync-panel__controls",children:(0,b.jsx)(D,{disabled:r,isPaused:a,isSyncing:c,onPause:h,onResume:_,onStop:g,onSync:x,showSync:C})}),j?(0,b.jsx)("div",{className:"ep-sync-panel__row",children:(0,b.jsx)(M,{dateTime:P,isCli:n,isComplete:t,isFailed:i,isPaused:a,itemsProcessed:o,itemsTotal:d})}):null,(0,b.jsx)("div",{className:"ep-sync-panel__row",children:(0,b.jsx)(N,{messages:y})}),k?(0,b.jsx)("div",{className:"ep-sync-panel__row",children:(0,b.jsxs)("p",{className:"ep-sync-warning",children:[(0,b.jsx)(w.Icon,{icon:S}),k]})}):null]})})]}),U=({isCli:e,isComplete:s,isDeleting:n,isEpio:t,isFailed:r,isSyncing:i,log:a,...c})=>{const o=null===c.lastSyncDateTime;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("h1",{className:"ep-sync-heading",children:(0,l.__)("Sync Settings","elasticpress")}),(0,b.jsx)(A,{introduction:o?(0,l.sprintf)((0,l.__)("Run a sync to index your existing content %s. Once syncing finishes, your site is officially supercharged.","elasticpress"),t?(0,l.__)("on ElasticPress.io","elasticpress"):(0,l.__)("in Elasticsearch","elasticpress")):(0,l.__)("If you are missing data in your search results or have recently added custom content types to your site, you should run a sync to reflect these changes.","elasticpress"),isComplete:s,isDisabled:i&&n||i&&e,isFailed:r,isSyncing:i&&!n,logMessages:a.filter((e=>!e.isDeleting)),showLastSync:!0,showProgress:!n&&(i||s||r),showSync:!0,...c}),o?null:(0,b.jsx)(A,{heading:(0,l.__)("Delete All Data and Sync","elasticpress"),introduction:(0,l.__)("If you are still having issues with your search results, you may need to do a completely fresh sync.","elasticpress"),isComplete:s,isDisabled:i&&!n||i&&e,isFailed:r,isSyncing:i&&n,logMessages:a.filter((e=>e.isDeleting)),showDelete:!0,showProgress:n&&(i||s||r),warningMessage:(0,l.__)("All indexed data on ElasticPress will be deleted without affecting anything on your WordPress website. This may take a few hours depending on the amount of content that needs to be synced and indexed. While this is happening, searches will use the default WordPress results","elasticpress"),...c})]})};const V=()=>{const{cancelIndex:e,index:s,indexStatus:n}=(()=>{const e=(0,o.useRef)(new AbortController),s=(0,o.useRef)(null),n=(0,o.useCallback)((async e=>{const s=await e.text(),n=`${(0,l.__)("ElasticPress: Unexpected response.","elasticpress")}\n${s}`;if(!e.ok)throw 403===e.status?new Error((0,l.__)("Permission denied. Reload the sync page and try again.","elasticpress")):(console.error(n),new Error((0,l.__)("Something went wrong. Find troubleshooting steps at https://elasticpress.zendesk.com/hc/en-us/sections/360010868652-Troubleshooting.","elasticpress")));try{return JSON.parse(s)}catch(e){throw console.error(e.message),console.error(n),new Error((0,l.__)("Unable to parse response. Find troubleshooting steps at https://elasticpress.zendesk.com/hc/en-us/sections/360010868652-Troubleshooting.","elasticpress"))}}),[]),t=(0,o.useCallback)((()=>{s.current=null}),[]),r=(0,o.useCallback)((e=>(s.current=fetch(u,e).then(n).finally(t),s.current)),[t,n]);return{cancelIndex:(0,o.useCallback)((async()=>{e.current.abort(),e.current=new AbortController;const s=new FormData;s.append("action","ep_cancel_index"),s.append("nonce",_);const n={method:"POST",body:s,signal:e.current.signal};return r(n)}),[r]),index:(0,o.useCallback)((async s=>{e.current.abort(),e.current=new AbortController;const n=new FormData;n.append("action","ep_index"),n.append("put_mapping",s?1:0),n.append("nonce",_);const t={method:"POST",body:n,signal:e.current.signal};return r(t)}),[r]),indexStatus:(0,o.useCallback)((async()=>{e.current.abort(),e.current=new AbortController;const s=new FormData;s.append("action","ep_index_status"),s.append("nonce",_);const n={method:"POST",body:s,signal:e.current.signal};return r(n)}),[r])}})(),[t,r]=(0,o.useState)([]),[i,a]=(0,o.useState)({isComplete:!1,isDeleting:!1,isFailed:!1,isSyncing:!1,itemsProcessed:0,itemsTotal:100,lastSyncDateTime:m,lastSyncFailed:h,syncStartDateTime:null}),w=(0,o.useRef)(i),f=e=>{w.current={...w.current,...e},a((s=>({...s,...e})))},S=(0,o.useCallback)(((e,s)=>{const{isDeleting:n}=w.current,t=Array.isArray(e)?e:[e];for(const e of t)r((t=>[...t,{message:e,status:s,isDeleting:n,id:c()}]))}),[]),v=(0,o.useCallback)((()=>{f({isPaused:!1,isSyncing:!1}),e()}),[e]),j=(0,o.useCallback)((e=>{f({isComplete:!0,isPaused:!1,isSyncing:!1,lastSyncDateTime:e.end_date_time,lastSyncFailed:e.failed>0}),document.querySelector('[data-ep-notice="no_sync"]')?.remove()}),[]),C=(0,o.useCallback)((e=>{"AbortError"!==e.name&&(e.message&&S(e.message,"error"),S((0,l.__)("Sync failed","elasticpress"),"error"),f({isFailed:!0,isSyncing:!1,lastSyncDateTime:w.current.syncStartDateTime,lastSyncFailed:!0}))}),[S]),P=(0,o.useCallback)((()=>{const{isDeleting:e}=w.current,s=e?(0,l.sprintf)((0,l.__)("Your indexing process has been stopped by WP-CLI and your %s index could be missing content. To restart indexing, please click the Start button or use WP-CLI commands to perform the reindex. Please note that search results could be incorrect or incomplete until the reindex finishes.","elasticpress"),y?(0,l.__)("ElasticPress.io","elasticpress"):(0,l.__)("Elasticsearch","elasticpress")):(0,l.__)("Sync interrupted by WP-CLI command.","elasticpress");S(s,"info"),f({isSyncing:!1})}),[S]),D=(0,o.useCallback)((e=>{const s=!(null===w.current.lastSyncDateTime)&&e.put_mapping;f({isCli:"cli"===e.method,isDeleting:s,isSyncing:!0,itemsProcessed:x(e),itemsTotal:g(e),syncStartDateTime:e.start_date_time})}),[]),k=(0,o.useCallback)((e=>{const{isPaused:s,isSyncing:n}=w.current,{message:t,status:r,totals:i=[],index_meta:a}=e.data;return new Promise((c=>{n&&("error"!==r?(t&&S(t,r),Array.isArray(i)?(D(a),a.should_interrupt_sync?P():s?S((0,l.__)("Sync paused","elasticpress"),"info"):c(a.method)):j(i)):C(e.data))}))}),[j,C,D,P,S]),N=(0,o.useCallback)((()=>{n().then(k).then(N).catch(C)}),[n,C,k]),T=(0,o.useCallback)((e=>{s(e).then(k).then((s=>{"cli"===s?N():T(e)})).catch(C)}),[N,s,C,k]),L=(0,o.useCallback)((()=>{f({isPaused:!0,isSyncing:!0})}),[]),F=(0,o.useCallback)((()=>{const{isDeleting:e,lastSyncDateTime:s}=w.current,n=null===s||e;f({isPaused:!1,isSyncing:!0}),T(n)}),[T]),E=(0,o.useCallback)((e=>{const{lastSyncDateTime:s}=w.current,n=null===s,t=n||e;f({isComplete:!1,isFailed:!1,isDeleting:!n&&e,isPaused:!1,isSyncing:!0}),f({itemsProcessed:0,syncStartDateTime:Date.now()}),T(t)}),[T]);return(0,o.useEffect)((()=>{if(window.history.replaceState({},document.title,document.location.pathname+document.location.search.replace(/&do_sync/,"")),p)return D(p),void("cli"===p.method?(N(),S((0,l.__)("WP CLI sync in progress","elasticpress"),"info")):(L(),S((0,l.__)("Sync paused","elasticpress"),"info")));d&&(E(!0),S((0,l.__)("Starting delete and sync…","elasticpress"),"info"))}),[N,D,S,L,E]),(0,b.jsx)(U,{isEpio:y,log:t,onDelete:async()=>{E(!0),S((0,l.__)("Starting delete and sync…","elasticpress"),"info")},onPause:()=>{L(),S((0,l.__)("Pausing sync…","elasticpress"),"info")},onResume:()=>{F(),S((0,l.__)("Resuming sync…","elasticpress"),"info")},onStop:()=>{v(),S((0,l.__)("Sync stopped","elasticpress"),"info")},onSync:async()=>{E(!1),S((0,l.__)("Starting sync…","elasticpress"),"info")},...i})};if("function"===typeof o.createRoot){(0,o.createRoot)(document.getElementById("ep-sync")).render((0,b.jsx)(V,{}))}else(0,o.render)((0,b.jsx)(V,{}),document.getElementById("ep-sync"))}()}(); |