"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("react/jsx-runtime"),r=require("react"),o=require("../../Modal/Modal.js"),n=require("../Store/Store.js");require("../Store/utils.js");var l=require("../../Text/Text.js"),i=require("../types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u,s=a(e),c=(u={},s.default(u,i.ConfirmationModalType.Revert,{title:"Revert to Original Template?",text:"All modifications made to this template will be lost. This action cannot be undone. If needed, save your changes as a new template before reverting.",confirmText:"Revert to original"}),s.default(u,i.ConfirmationModalType.DeleteFolder,{title:"Delete folder?",text:function(e){var t=e.folder,r=null==t?void 0:t.name,o=null==t?void 0:t.items.map((function(e){var t=e.name;return'"'.concat(t,'"')})).join(", ");return'Are you sure you want to delete the "'.concat(r,'" folder, and the following templates: ').concat(o,"?")},confirmText:"Delete"}),s.default(u,i.ConfirmationModalType.DeleteTemplate,{title:"Delete Template?",text:function(e){var r=e.template;return e.isCurrentTemplate?t.jsxs(t.Fragment,{children:["The “",null==r?void 0:r.name,"” template you are about to delete is currently in use. If you proceed, you will lose the template permanently and must rebuild everything from scratch.",t.jsx("br",{}),"Please confirm if you wish to continue, or cancel to keep the template."]}):t.jsxs(t.Fragment,{children:["Deleting the “",null==r?void 0:r.name,"” template will result in the permanent loss of the current version. However, you will be able to recreate the template from scratch if needed.",t.jsx("br",{}),"Please confirm if you wish to proceed or cancel to keep the template."]})},confirmText:"Delete"}),u);exports.ConfirmationModal=function(){var e,i,a,u,s,d=n.storeApi.useConfirmationModalType,m=n.storeApi.useCloseConfirmation,p=n.storeApi.useConfirmationCallback,f=n.storeApi.useConfirmationTemplateId,v=n.storeApi.useTemplateById,y=n.storeApi.useSelectedTemplateId,x=n.storeApi.useConfirmationFolder,T=p(),h=r.useRef(),C=d(),b=m(),j=f(),A=x(),w=v(j),g=y()===j,M=r.useCallback((function(){null==T||T(),b()}),[b,T]);return C&&(h.current=c[C]),t.jsx(o.Modal,{size:"small",open:!!C,onClose:b,title:null===(e=h.current)||void 0===e?void 0:e.title,primaryActionText:null===(i=h.current)||void 0===i?void 0:i.confirmText,primaryActionHandler:M,secondaryActionText:"Cancel",secondaryActionHandler:b,children:t.jsx(l.Text,{size:16,color:"T6",children:"function"==typeof(null===(a=h.current)||void 0===a?void 0:a.text)?null===(u=h.current)||void 0===u?void 0:u.text({template:w,isCurrentTemplate:g,folder:A}):null===(s=h.current)||void 0===s?void 0:s.text})})};
//# sourceMappingURL=ConfirmationModal.js.map
