"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../utils.js"),o=require("../Store/Store.js");require("../Store/utils.js");var r=require("./PublishTemplate.js"),n=require("./MoveTemplateOutOfFolder.js"),l=require("./MoveTemplateToFolder.js"),i=require("./RevertTemplate.js"),a=require("./UnfollowTemplate.js"),s=require("./CopyTemplate.js"),p=require("./ShareTemplate.js"),u=require("./ExportTemplate.js"),m=require("./RemoveTemplate.js"),d=require("./TemplateControls.js"),T=[{id:"PublishTemplate",Component:r.PublishTemplate,isShown:function(e){var o=e.template,r=e.publishEnabled;return e.canPublish&&t.isOwnTemplate(o)&&r}},{id:"MoveTemplateOutOfFolder",Component:n.MoveTemplateOutOfFolder,isShown:function(e){var o=e.template;return e.foldersEnabled&&t.isOwnTemplate(o)&&t.isTemplateInFolder(o)}},{id:"MoveTemplateToOtherFolder",Component:l.MoveTemplateToFolder,isShown:function(e){var o=e.template;return e.foldersEnabled&&t.isOwnTemplate(o)&&t.isTemplateInFolder(o)}},{id:"RevertTemplate",Component:i.RevertTemplate,isShown:function(e){return!!e.hasUnsavedChanges},hasDividerBefore:!0},{id:"UnfollowTemplate",Component:a.UnfollowTemplate,isShown:function(e){return!!e.template.shared},hasDividerBefore:!0},{id:"CopyTemplate",Component:s.CopyTemplate,isShown:function(){return!0}},{id:"ShareTemplate",Component:p.ShareTemplate,isShown:function(e){var o=e.template;return t.isOwnTemplate(o)}},{id:"ExportTemplate",Component:u.ExportTemplate,isShown:function(){return!0}},{id:"MoveTemplateToFolder",Component:l.MoveTemplateToFolder,isShown:function(e){var o=e.template;return e.foldersEnabled&&t.isOwnTemplate(o)&&!t.isTemplateInFolder(o)},hasDividerBefore:!0},{id:"TemplateControls",Component:d.TemplateControls,isShown:function(e){return!!e.controls}},{id:"RemoveTemplate",Component:m.RemoveTemplate,isShown:function(e){var o=e.template,r=e.canPublish;return t.isOwnTemplate(o)||!!o.published&&r},hasDividerBefore:!0}];exports.useTemplateActions=function(t){var r=o.storeApi.useCanPublish,n=o.storeApi.usePublishEnabled,l=o.storeApi.useFoldersEnabled,i=o.storeApi.useHasUnsavedChanges,a=o.storeApi.useTemplateControls,s=r(),p=n(),u=l(),m=!!i(null==t?void 0:t.id),d=a();return e.useMemo((function(){return T.filter((function(e){return!!t&&e.isShown({hasUnsavedChanges:m,template:t,controls:d,canPublish:s,publishEnabled:p,foldersEnabled:u})})).map((function(e){return{Component:e.Component,hasDividerBefore:e.hasDividerBefore,id:e.id}}))}),[m,t,d,s,p,u])};
//# sourceMappingURL=index.js.map
