Liferay.Loader.define("@liferay/content-dashboard-web@2.0.83/js/components/SidebarPanelInfoView/FileUrlCopyButton",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r("@frontend-taglib-clay$clayui/button"),n=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/form")),l=r("frontend-js-web"),o=(function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(r("liferay!frontend-js-react-web$react")));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}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 r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}const e=2e3;var _default=({url:t})=>{const[r,i]=(0,o.useState)(!1),[u,c]=(0,o.useState)(null);return o.default.createElement("div",{className:"file-url-copy-button"},o.default.createElement(n.default.Group,null,o.default.createElement(n.ClayInput.Group,null,o.default.createElement(n.ClayInput.GroupItem,{prepend:!0},o.default.createElement(n.ClayInput,{readOnly:!0,type:"text",value:t})),o.default.createElement(n.ClayInput.GroupItem,{append:!0,shrink:!0},o.default.createElement(a.ClayButtonWithIcon,{displayType:"secondary",onClick:async()=>{try{await navigator.clipboard.writeText(t),i(!0),(0,l.openToast)({message:Liferay.Language.get("copied-link-to-the-clipboard")})}catch(e){c(e),i(!0),(0,l.openToast)({message:e,title:Liferay.Language.get("an-error-occurred"),type:"warning"})}finally{setTimeout((()=>{i(!1),c(null)}),e)}},symbol:r?"check":u?"exclamation-circle":"copy",title:Liferay.Language.get("copy")})))))};t.default=_default}}));
//# sourceMappingURL=FileUrlCopyButton.js.map