1import{r as o,j as t}from"./react-vendor.B75MsAI9.js";import{u as e,m as a,o as n,M as i,U as s,ch as l,O as r,a4 as d}from"./AuthModalContainer.D3JsQqnf.js";import{t as f}from"./LazyFontLoader.5DGfhuFK.js";const c=({isVisible:d,book:c,viewport:u,translateTargetLanguage:p,isFetchingTranslateFilters:g,isCheckingTranslations:m,translateOfflineMode:T,offlineTranslateTargetLanguage:h,closeTranslationModal:y,fetchMobileTranslationsWorkflow:b,saveOfflineTranslationsWorkflow:w,addSlimNotification:M,userId:j,windowDimensions:k,isRtl:v})=>{const x=e(),[R,L]=o.useState(!1);o.useEffect(()=>{const o=document.getElementsByTagName("body")[0];o&&(R?(o.style.opacity=.5,o.style.pointerEvents="none"):(o.style.opacity=1,o.style.pointerEvents="initial"))},[R]);const C=()=>{y()};if(!d||!p&&!h)return null;const O=t.jsx("h2",{className:"pb-translation-modal__title",children:x("TranslationModal.title")});let q=u.medium?x("TranslationModal.popup-footer-translate-another-story"):x("TranslationModal.popup-footer-translate-another"),B=t.jsxs(a,{mergeTop:!0,mergeBottom:!0,mergeSides:!0,children:[t.jsx(n,{fullWidth:!0,label:T?x("TranslationModal.popup-footer-pick-another-story"):q,variant:"primary",onClick:()=>{C(),setTimeout(()=>window.scrollTo(0,0),200)}}),t.jsx(n,{fullWidth:!0,label:T?x("TranslationModal.popup-footer-save-to-offline-library-anyway"):u.medium?x("TranslationModal.popup-footer-translate-anyway"):f(x("TranslationModal.popup-footer-translate-anyway"),16),onClick:T?()=>{if(y(),u.medium){let o=Object.assign({},c,{isFromOfflineTranslate:!0});const t=w(o,l(k.width),j,{targetLanguage:h,content:[]});if(t&&"function"==typeof t.then)return t.then(o=>{!o||o.ok?localStorage.setItem("sw-offline-activity","offline"+Math.random()):M({type:"danger",content:"The story could not be saved. Please try again later"})})}else M({id:"Book.mobile-editor-notification",content:x("Book.mobile-editor-notification-text")})}:()=>{return o=c.slug,L(!0),void(u.medium?window.location.href=r.translateBookToLanguage(o,p):b(c.slug,p).then(o=>{window.location.href=r.mobileTranslateBook(o.data.parent_story_id,o.data.translated_story_id)}));var o},loading:R})]});return g||m?t.jsx(i,{onClose:C,children:t.jsx(s,{})}):t.jsxs(i,{footer:B,onClose:C,isRtl:v,children:[O,t.jsx("p",{children:x("TranslationModal.popup-content")})]})};c.propTypes={isVisible:d.bool.isRequired,book:d.object.isRequired,viewport:d.object.isRequired,translateTargetLanguage:d.string,isFetchingTranslateFilters:d.bool,isCheckingTranslations:d.bool,translateOfflineMode:d.bool,offlineTranslateTargetLanguage:d.string,closeTranslationModal:d.func.isRequired,fetchMobileTranslationsWorkflow:d.func.isRequired,saveOfflineTranslationsWorkflow:d.func,addSlimNotification:d.func.isRequired,userId:d.string,windowDimensions:d.object,isRtl:d.bool};export{c as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.