/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2025 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 *
 * @category  Dingedi PrestaShop Modules
 */
"use strict";(self.webpackChunkdgtranslationall=self.webpackChunkdgtranslationall||[]).push([[217],{1029:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1554);
/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2025 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 *
 * @category  Dingedi PrestaShop Modules
 */const r=[{module:"prestablog",selector:"div.page-bar.toolbarBox > div.btn-toolbar > ul.nav.nav-pills:not(#toolbar-nav)",elem:$('<li><button id="'+a.PP+'" class="d-none toolbar_btn'+a.oF+'"></button></li>')},{module:"iqitmegamenu",selector:"div.page-bar.toolbarBox > div.btn-toolbar > ul.nav.nav-pills:not(#toolbar-nav)",elem:$('<li><button id="'+a.PP+'" class="d-none toolbar_btn'+a.oF+'"></button></li>')},{module:"ybc_blog",controller:"AdminModules",selector:"div.page-bar.toolbarBox > div.btn-toolbar > ul.nav.nav-pills:not(#toolbar-nav)",elem:$('<li><button id="'+a.PP+'" class="d-none toolbar_btn'+a.oF+'"></button></li>')}]},1554:(e,t,n)=>{n.d(t,{PP:()=>l,oF:()=>o,t3:()=>c});var a=n(5458);
/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2025 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 * @category  Dingedi PrestaShop Modules
 */function r(){return"undefined"!=typeof _PS_VERSION_&&_PS_VERSION_.startsWith("1.6")?"ps16":""}var o=r(),l="dingedi-mdtr-button",s=document.createElement("button");s.id=l,s.className="d-none btn btn-secondary mr-3 "+o;var i=document.createElement("li");function c(){var e,t=[];try{t=n(1029).A}catch(e){}return[].concat((0,a.A)(t),(0,a.A)([{controller:"AdminProducts",psVersion:{min:"8",max:"99"},selector:"div.product-page-v2 #product-footer-right",elem:s},{controller:"AdminTranslations",psVersion:{min:"1.6",max:"799"},selector:"div.translate-fixed",elem:s}]),(0,a.A)([{selector:"div#dingedi-modal-container",elem:(e=document.createElement("button"),e.id=l,e.className="d-none btn btn-secondary "+r(),e.style.height="39px",e.style.marginRight="10px",e)},{selector:"div.product-footer div.text-right",elem:s},{selector:"div.product-footer div.text-lg-right",elem:s},{selector:"div.header-toolbar div.toolbar-icons div.wrapper",elem:s,margin:!0},{selector:"ul#toolbar-nav",elem:i},{selector:"div.page-bar.toolbarBox > .btn-toolbar > ul.nav",elem:i}]))}i.innerHTML='<button id="'+l+'" class="d-none toolbar_btn mr-3 '+o+'"></button>'},2208:(e,t,n)=>{n.d(t,{M:()=>s.M,P:()=>d});var a=n(4467),r=n(6176),o=n(4644),l=n(7518),s=n(2650);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){(0,a.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}
/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2025 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 *
 * @category  Dingedi PrestaShop Modules
 */var d=(0,o.HY)(c(c({},s.d),{tables:r.Ay,langFileItems:l.Ay}));s.M.replaceReducer(d)},3617:(e,t,n)=>{var a=n(6540),r=n(5338),o=n(1468),l=n(8330),s=n(8938),i=n(2208),c=n(2894),d=n(296),u=n(467),m=n(3029),p=n(2901),f=n(388),g=n(3954),b=n(5501),h=n(4467),y=n(4756),v=n.n(y),E=n(7226),O=n(8765),T=n(3340),w=n(5615),A=n(5523),S=n(5498),k=n(5289),_=n(8004),N=n(1837),P=n(6797),j=n(5184),x=n(7112),F=n(9473),I=n(2630),L=n(4583);function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach(function(t){(0,h.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}n(8199);var D=function(e){function t(e){var n,a,r,o;return(0,m.A)(this,t),a=this,r=t,o=[e],r=(0,g.A)(r),n=(0,f.A)(a,C()?Reflect.construct(r,o||[],(0,g.A)(a).constructor):r.apply(a,o)),(0,h.A)(n,"button",void 0),(0,h.A)(n,"translatable",void 0),(0,h.A)(n,"dgGroupTranslate",!1),n.updateForm=n.updateForm.bind(n),n.handleSubmit=n.handleSubmit.bind(n),n.state={showModal:!1,loading:!1,remainingTime:!1,currentTranslation:!1,form:{overwrite:!1,latinInput:!1,latinOutput:!1,to:[],translationPercent:0,disabled:!0,loading:!1,translationType:"0",isValid:!1,isFormValid:!1}},n}return(0,b.A)(t,e),(0,p.A)(t,[{key:"componentDidMount",value:function(){var e=this;$.ajax({type:"POST",url:(0,S.fN)("ModulesGetWidgetData",this.props.constants),success:function(t){e.props.dispatch((0,A.bH)(t.moduleConfig));var n=new URLSearchParams(window.location.search);e.updateForm({to:t.moduleConfig.languages.filter(function(e){return e.iso_code===n.get("lang")})}),e.setState(function(e){return{}},function(){e.button=document.getElementById("dingedi-mdtr-button"),e.button.innerHTML="<img class='mr-2' onload='SVGInject(this)' height='20px' width='20px' src='"+e.props.constants.psBaseUrl+"/modules/"+e.props.module_name+"/views/img/logo.svg' id='dg-logo-svg'/> "+(0,S.pw)("Translate",e.props.translations),e.button.classList.remove("d-none"),e.button.addEventListener("click",function(t){t.preventDefault(),e.openModal()})})},error:function(e){}})}},{key:"handleInputChange",value:function(e,t){this.setState(function(n){return{form:M(M({},n.form),{},(0,h.A)({},e,t))}},this.updateButton)}},{key:"updateForm",value:(r=(0,u.A)(v().mark(function e(t){var n,a=arguments;return v().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=a.length>1&&void 0!==a[1]?a[1]:null,this.setState(function(e){return{form:M(M({},e.form),t)}}),this.updateButton(n);case 1:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"handleSubmit",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.state.form.loading)return this.setState(function(e){return{loading:!1,form:M(M({},e.form),{},{loading:!1})}}),void("function"==typeof(null===(e=this.dgGroupTranslate)||void 0===e?void 0:e.cancel)&&this.dgGroupTranslate.cancel());this.translateItems(t)}},{key:"getAllTranslatableTexts",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=document.querySelectorAll("#translations_form .table tbody tr"),n=[];return t.forEach(function(t){var a=t.querySelectorAll("td[width='46%']");if(2===a.length){var r,o=a[0].textContent,l=a[1].querySelector("input");r=null!==l?l.value:a[1].querySelector("textarea").value,!e&&r.trim().length>0||n.push({text:o,source:a[0],target:a[1]})}}),n}},{key:"updateTranslatableText",value:function(e,t){this.translatable.forEach(function(n){if(n.text===e){var a=n.target.querySelector("input");if(null!==a)a.select(),$(a).val(t);else{var r=n.target.querySelector("textarea");r.select(),$(r).val(t)}}})}},{key:"translateItems",value:(n=(0,u.A)(v().mark(function e(){var t,n,a,r,o=this;return v().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this.state.form,this.translatable=this.getAllTranslatableTexts("1"===t.translationType),c.A.getAjaxManager().pause(),n=this.props.translations,this.updateForm({loading:!0,translationPercent:0}),a=[],this.translatable.map(function(e,t){return t%25==0?o.translatable.slice(t,t+25):null}).filter(function(e){return e}).map(function(e){var n=new F.S;n.idLangFrom=null===t.from?-1:Number(t.from.value),n.idLangTo=Number(t.to[0].value),n.setTranslations(e.map(function(e){return e.text})),n.setLatin((0,S.fo)(t.latinInput,t.latinOutput)),n.requests=1,n.current=1,a.push(n)}),r=function(e){c.A.getAjaxManager().stopPause(),o.setState({currentTranslation:!1,form:M(M({},t),{},{loading:!1,copyText:!1})},function(){"info"===(null==e?void 0:e.type)?o.props.dispatch((0,I.WT)(e.message)):"success"===(null==e?void 0:e.type)&&o.props.dispatch((0,I.zz)(e.message))})},this.setState({remainingTime:!1,currentTranslation:{total:a.length,current:1,group:a[0]}}),this.dgGroupTranslate=new F.r({path:(0,S.fN)("ModulesTranslateTexts",this.props.constants),always_start:!0},{callbackStart:function(){},callbackUpdate:function(e,t,n){o.updateForm({translationPercent:t}),Object.entries(n.translations).map(function(e){var t=(0,d.A)(e,2),n=t[0],a=t[1];o.updateTranslatableText(n,a)})},callbackNewGroup:function(e){o.setState(function(t){return{currentTranslation:M(M({},t.currentTranslation),{},{group:e,current:t.currentTranslation.group.item.name!==e.item.name?t.currentTranslation.current+1:t.currentTranslation.current})}})},callbackEnd:function(e,t){r({type:"success",message:t},e)},callbackError:function(e,t){var a;a=null!=t&&t.message&&"string"==typeof(null==t?void 0:t.message)?t.message:"string"==typeof t?{title:(0,S.pw)("Server error",n),content:t}:(0,S.pw)("Server error",n),o.props.dispatch((0,I.pU)(a)),r(e)},callbackCancel:function(e){o.dgGroupTranslate=!1,r(e)},callbackUpdateRemainingTime:function(e){o.setState({remainingTime:e})}},a);case 1:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"updateButton",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.setState(function(e){return{form:M(M({},e.form),{},{isFormValid:e.form.isValid})}},e)}},{key:"openModal",value:function(){this.setState({showModal:!0})}},{key:"handleClose",value:function(){this.setState({showModal:!1})}},{key:"getDefaultLanguages",value:function(){return[]}},{key:"render",value:function(){var e=this,t=this.props,n=t.constants,r=t.module_name,o=t.translations;t.languages;if(void 0===this.props.translations)return a.createElement(a.Fragment,null);var l=this.state,s=l.showModal,i=l.currentTranslation,c=l.remainingTime,d=l.form;return a.createElement(E.A,{backdrop:"static",centered:!0,backdropClassName:"dg-modal",dialogClassName:"dg-modal",show:s,onHide:function(){return e.handleClose()}},a.createElement(E.A.Header,{closeButton:!0,className:"h3"},a.createElement("img",{height:20,src:n.psBaseUrl+"/modules/"+r+"/logo.png",alt:r+" logo",className:"mr-3"}),(0,S.pw)("Translate",o)),a.createElement(E.A.Body,{className:"pt-0"},a.createElement(L.A,null),a.createElement("div",{className:"row"},a.createElement("div",{className:"col-md-12 mb-3"},d.loading&&a.createElement(P.A,{remainingTime:c,currentTranslation:i,translationPercent:d.translationPercent}))),a.createElement("div",{className:"row"},a.createElement("div",{className:"col-md-12"},a.createElement("div",{className:"row"},a.createElement(N.A,{loading:this.state.form.loading,defaultLanguagesToTranslate:this.state.form.to,lockLanguageFrom:"",onUpdate:this.updateForm,colSize:"6"})))),a.createElement("div",{className:"row"},a.createElement("div",{className:"col-md-12"},a.createElement("div",{className:"mt-4"},a.createElement(O.A.Check,{value:"0",type:"radio",name:"radio-elems",checked:"0"===d.translationType,onChange:function(){return e.updateForm({translationType:"0"})},label:(0,S.pw)("Translate only the missing elements",o)}),a.createElement(O.A.Check,{value:"1",type:"radio",name:"radio-elems",checked:"1"===d.translationType,onChange:function(){return e.updateForm({translationType:"1"})},label:(0,S.pw)("Translate all (overwrite current translations)",o)})))),a.createElement("div",{className:"my-4 d-flex justify-content-between"},a.createElement("div",null,a.createElement(T.A,null,a.createElement(T.A.Toggle,{as:w.A,className:"pl-0",variant:"link",eventKey:"0"},(0,S.pw)("Advanced parameters",o)),a.createElement(T.A.Collapse,{eventKey:"0"},a.createElement("div",{className:"mt-3"},a.createElement("h4",null,(0,S.pw)("Settings",o)),a.createElement(x.A,{disabled:d.loading,checked:d.overwrite,onChange:function(t){return e.updateForm({overwrite:t.target.checked})},label:(0,S.pw)("Overwrite all translations",o)}),a.createElement("h4",{className:"mt-4 pb-1"},(0,S.pw)("Latin option (for supported languages)",o)),a.createElement("div",{className:"form-group"},a.createElement("div",{className:"md-checkbox"},a.createElement("label",{className:"font-weight-normal"},a.createElement("input",{type:"checkbox",onChange:function(t){return e.updateForm({latinInput:t.target.checked})}}),a.createElement("i",{className:"md-checkbox-control"}),(0,S.pw)("My source text is in Latin characters",o)))),a.createElement("div",{className:"form-group"},a.createElement("div",{className:"md-checkbox"},a.createElement("label",{className:"font-weight-normal"},a.createElement("input",{type:"checkbox",onChange:function(t){return e.updateForm({latinOutput:t.target.checked})}}),a.createElement("i",{className:"md-checkbox-control"}),(0,S.pw)("I want to translate into Latin characters",o)))))))),a.createElement("div",null,a.createElement(j.A,{handleSubmit:this.handleSubmit,loading:d.loading,disabled:!d.isFormValid})))))}}]);var n,r}(a.Component);const B=(0,o.Ng)(function(e){return{languages:(0,k.kr)(e),translationsProviders:(0,k.n$)(e),module_name:(0,k.aR)(e),translations:(0,k.fF)(e),constants:(0,_.c)(e)}})(D);var U=n(1554);document.addEventListener("DOMContentLoaded",function(){var e,t,n;e=(0,U.getSelector)(),t=e.elem,(n=$(e.selector)).prepend(t),n.prepend($('<div id="dingedi-adtr-app"></div>'));var d=document.getElementById("dingedi-adtr-app");d&&(i.M.dispatch((0,s.D)({moduleName:l.UU,action:"dgtranslationall",baseUrl:window.dg_base_url,psBaseUrl:window.ps_base_uri})),c.A.getAjaxManager().run(),(0,r.createRoot)(d).render(a.createElement(o.Kq,{store:i.M},a.createElement(B,null))))})},6176:(e,t,n)=>{n.d(t,{Ay:()=>v,BN:()=>f,BZ:()=>p,C6:()=>c,Fm:()=>m,ST:()=>d,S_:()=>g,Wh:()=>i,Xc:()=>b,_R:()=>y,g$:()=>h,s$:()=>u});var a=n(4467);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){(0,a.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}
/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2025 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 * @category  Dingedi PrestaShop Modules
 */var l=(0,n(5452).Z0)({name:"tables",initialState:{},reducers:{setTablesList:function(e,t){return t.payload.map(function(e){return e.tables=e.tables.map(function(e){return o(o({},e),{},{reload:!1,checked:!1,badges:[],translations:[],selectedFields:[],selected_elems:[]})}),e})},addTableTranslations:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){if(e.name===t.payload.name){var n=e.translations.findIndex(function(e){return Number(e.id_lang)===Number(t.payload.id_lang)});-1!==n?e.translations[n]=t.payload:e.translations.push(t.payload),e.reload=!1}e.translations.sort(function(e,t){return e.id_lang>t.id_lang?1:-1})})})},addTableTranslationsError:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){if(e.name===t.payload.name){var n=e.translations.findIndex(function(e){return Number(e.id_lang)===Number(t.payload.id_lang)});-1!==n?e.translations[n]={error:!0,id_lang:Number(t.payload.id_lang)}:e.translations.push({error:!0,id_lang:Number(t.payload.id_lang)}),e.reload=!1}e.translations.sort(function(e,t){return e.id_lang>t.id_lang?1:-1})})})},selectTable:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){(e.name===t.payload.name||Array.isArray(t.payload.name)&&t.payload.name.includes(e.name)||"*"===t.payload.name)&&(e.checked=t.payload.checked,!1===t.payload.checked&&null!=e&&e.selectedFields&&delete e.selectedFields)})})},resetAndReloadSelectedTables:function(e,t){var n=t.payload.languages.map(function(e){return Number(e.value)});e.forEach(function(e){e.tables.forEach(function(e){!0===e.checked&&(e.reload=!0,e.translations=e.translations.filter(function(e){return!n.includes(Number(e.id_lang))})),e.checked=!1})})},resetAndReloadTable:function(e,t){var n=t.payload.languages_ids;e.forEach(function(e){e.tables.forEach(function(e){e.name===t.payload.name&&(e.reload=!0,e.translations=e.translations.filter(function(e){return!n.includes(e.id_lang)}))})})},reloadTable:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){(e.name===t.payload.name||Array.isArray(t.payload.name)&&t.payload.name.includes(e.name)||"*"===t.payload.name)&&(e.reload=!0,e.translations=[])})})},setSelectedFields:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){e.name===t.payload.name&&(!1!==t.payload.fields?(e.checked=!0,e.selectedFields=t.payload.fields):(e.checked=!1,delete e.selectedFields))})})},setSelectedFilters:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){e.name===t.payload.name&&(!1!==t.payload.filters?e.selectedFilters=t.payload.filters:delete e.selectedFilters)})})},setSelectedRelatedItems:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){e.name===t.payload.name&&(!1!==t.payload.filters?e.selectedRelatedItems=t.payload.relatedItems:delete e.selectedRelatedItems)})})},setSelectedElems:function(e,t){e.forEach(function(e){e.tables.forEach(function(e){e.name===t.payload.name&&(e.selected_elems=t.payload.selected_elems)})})}}}),s=l.actions,i=s.setTablesList,c=s.addTableTranslations,d=s.addTableTranslationsError,u=s.resetAndReloadTable,m=s.setSelectedFilters,p=s.setSelectedRelatedItems,f=s.selectTable,g=s.resetAndReloadSelectedTables,b=s.setSelectedFields,h=s.reloadTable,y=s.setSelectedElems;const v=l.reducer},7518:(e,t,n)=>{n.d(t,{$E:()=>b,Ay:()=>h,Jy:()=>m,TL:()=>u,_R:()=>g,bM:()=>f,l5:()=>c,mL:()=>p,re:()=>d});var a=n(5458),r=n(4467);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){(0,r.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}
/**
 * License limited to a single site, for use on another site please purchase a license for this module.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @author    Dingedi.com
 * @copyright Copyright 2023 © Dingedi All right reserved
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 * @category  Dingedi PrestaShop Modules
 */var s=(0,n(5452).Z0)({name:"langFileItems",initialState:[],reducers:{resetAndReloadSelectedLangFileItems:function(e,t){e=e.map(function(e){return!0===e.checked&&(e.reload=!0,e.translations=e.translations.filter(function(e){return!t.payload.languages_ids.includes(Number(e.id_lang))})),e.checked=!1,e})},selectItem:function(e,t){return e=e.map(function(e){var n;(e.name===t.payload.name||Array.isArray(t.payload.name)&&t.payload.name.includes(e.name))&&(e=l(l({},e),{},{checked:t.payload.checked}),e=!1===t.payload.checked&&null!==(n=e)&&void 0!==n&&n.selected_fields?l(l({},e),{},{selected_fields:[]}):l(l({},e),{},{selected_fields:e.fields}));return e})},resetSelectedItems:function(e,t){e=e.map(function(e){e.checked=!1})},setLangFileItemsList:function(e,t){return t.payload.map(function(e){return l(l({},e),{},{reload:!1,loading:!1,checked:!1,translations:[],selected_elems:[],error:!1})})},addItemTranslations:function(e,t){return e=e.map(function(e){if(e.name===t.payload.name){var n=e.translations,r=n.findIndex(function(e){return Number(e.id_lang)===Number(t.payload.id_lang)});n=-1!==r?n.map(function(e,n){return n===r?t.payload:e}):[].concat((0,a.A)(n),[t.payload]),(e=l(l({},e),{},{reload:!1,translations:n})).translations.sort(function(e,t){return e.id_lang>t.id_lang?1:-1})}return e})},resetAndReloadLangFileItem:function(e,t){var n=t.payload.languages_ids;e.map(function(e){e.name===t.payload.name&&(e.reload=!0,e.translations=e.translations.filter(function(e){return!n.includes(e.id_lang)}))})},addItemTranslationsError:function(e,t){return e=e.map(function(e){if(e.name===t.payload.name){var n=e.translations,r=n.findIndex(function(e){return Number(e.id_lang)===Number(t.payload.id_lang)});-1!==r?n[r]={error:!0,id_lang:Number(t.payload.id_lang)}:n=[].concat((0,a.A)(n),[{error:!0,id_lang:Number(t.payload.id_lang)}]),(e=l(l({},e),{},{reload:!1,translations:n})).translations.sort(function(e,t){return e.id_lang>t.id_lang?1:-1})}return e})},setSelectedElems:function(e,t){e=e.map(function(e){e.name===t.payload.name&&(e.selected_elems=t.payload.selected_elems)})}}}),i=s.actions,c=i.addItemTranslations,d=i.addItemTranslationsError,u=i.resetAndReloadSelectedLangFileItems,m=i.resetAndReloadLangFileItem,p=i.selectItem,f=i.setLangFileItemsList,g=i.setSelectedElems,b=i.resetSelectedItems;const h=s.reducer},8330:e=>{e.exports=JSON.parse('{"UU":"dgtranslationall"}')}},e=>{e.O(0,[96],()=>{return t=3617,e(e.s=t);var t});e.O()}]);