Liferay.Loader.define("journal-web@5.0.144/js/article/AssetDisplayPagePreview",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","frontend-js-web","liferay!frontend-js-react-web$react","./AssetDisplayPageSelector","./PreviewButton"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function AssetDisplayPagePreview({newArticle:e,portletNamespace:t,previewURL:a,saveAsDraftURL:o,selectAssetDisplayPageEventName:c,selectAssetDisplayPageURL:d,selectSiteEventName:f,siteItemSelectorURL:p,sites:g,sitesCount:m}){const[y,b]=(0,i.useState)(),[v,P]=(0,i.useState)(!1),[w,L]=(0,i.useState)(),D="".concat(t,"siteInput"),R=(0,i.useMemo)((()=>[{groupId:0,name:"- ".concat(Liferay.Language.get("not-selected")," -")},...g].map((e=>({label:e.name,onClick:()=>{P(!1),b({groupId:e.groupId,name:e.name}),e.groupId!==(null==y?void 0:y.groupId)&&L(null)}})))),[g,null==y?void 0:y.groupId]);return i.default.createElement(i.default.Fragment,null,i.default.createElement("label",{className:"control-label",htmlFor:D},Liferay.Language.get("site")),i.default.createElement(r.default,{active:v,"aria-labelledby":D,onActiveChange:P,trigger:i.default.createElement(l.default,{className:"bg-light form-control-select text-left w-100",displayType:"secondary",type:"button"},i.default.createElement("span",null,(null==y?void 0:y.name)||"- ".concat(Liferay.Language.get("not-selected")," -")))},R.map((e=>i.default.createElement(r.default.Item,{key:e.label,onClick:e.onClick},e.label))),m>g.length&&i.default.createElement(i.default.Fragment,null,i.default.createElement(r.default.Caption,null,(0,n.sub)(Liferay.Language.get("showing-x-of-x-items"),g.length,m)),i.default.createElement("div",{className:"d-flex w-100"},i.default.createElement(l.default,{className:"flex-grow-1 mx-3",displayType:"secondary",onClick:()=>{(0,n.openSelectionModal)({containerProps:{className:"cadmin"},onSelect(e){b({groupId:e.groupid,name:e.groupdescriptivename})},selectEventName:f,title:Liferay.Language.get("select-site"),url:p})},size:"sm",type:"button"},Liferay.Language.get("more"))))),i.default.createElement(s.default,{assetDisplayPageSelected:w,disabled:!y,namespace:t,selectAssetDisplayPageEventName:c,selectAssetDisplayPageURL:d,selectedSite:y,setAssetDisplayPageSelected:L}),i.default.createElement(u.default,{disabled:!w,getPreviewURL:({classPK:e,version:t})=>{const l=new URL(a);return l.searchParams.set("classPK",e),l.searchParams.set("selPlid",null==w?void 0:w.plid),l.searchParams.set("version",t),l},namespace:t,newArticle:e,saveAsDraftURL:o}))};var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/drop-down")),n=a("frontend-js-web"),i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),s=_interopRequireDefault(a("./AssetDisplayPageSelector")),u=_interopRequireDefault(a("./PreviewButton"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=AssetDisplayPagePreview.js.map