Liferay.Loader.define("redirect-web@2.0.49/js/DestinationUrlInput",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a("@frontend-taglib-clay$clayui/button"),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),u=a("frontend-js-web"),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react")));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}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 a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}const e=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(https?:\/\/|www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))((.*):(\d*)\/?(.*))?)/,o="";var _default=({autofocus:t=!1,initialDestinationUrl:a=o,namespace:c})=>{const[d,f]=(0,i.useState)(!1),[s,p]=(0,i.useState)(!1),[y,m]=(0,i.useState)(a),isAbsoluteUrl=t=>e&&e.test(t);return i.default.createElement(n.default.Group,{className:d||s?"has-error":o},i.default.createElement("label",{htmlFor:"".concat(c,"destinationURL")},Liferay.Language.get("destination-url"),i.default.createElement("span",{className:"inline-item-after reference-mark"},i.default.createElement(l.default,{symbol:"asterisk"}),i.default.createElement("span",{className:"hide-accessible sr-only"},Liferay.Language.get("required")))),i.default.createElement(n.ClayInput.Group,null,i.default.createElement(n.ClayInput.GroupItem,{prepend:!0},i.default.createElement(n.ClayInput,{"aria-label":Liferay.Language.get("destination-url"),autoFocus:t,id:"".concat(c,"destinationURL"),name:"".concat(c,"destinationURL"),onBlur:({currentTarget:e})=>{f(!e.value),p(!isAbsoluteUrl(e.value))},onChange:({currentTarget:e})=>m(e.value),type:"text",value:y})),i.default.createElement(n.ClayInput.GroupItem,{append:!0,shrink:!0},i.default.createElement(r.ClayButtonWithIcon,{disabled:y===o||!isAbsoluteUrl(y),displayType:"secondary",onClick:()=>{let e=y;const t="http";e.startsWith(t)||(e="http://"+e),window.open(e,"_blank")},symbol:"shortcut",title:Liferay.Language.get("check-url")}))),d&&i.default.createElement(n.default.FeedbackGroup,null,i.default.createElement(n.default.FeedbackItem,null,Liferay.Language.get("this-field-is-required"))),!d&&s&&i.default.createElement(n.default.FeedbackGroup,null,i.default.createElement(n.default.FeedbackItem,null,i.default.createElement(n.default.FeedbackIndicator,{symbol:"exclamation-full"}),Liferay.Language.get("this-url-is-not-supported")),i.default.createElement("div",{className:"small",dangerouslySetInnerHTML:{__html:(0,u.sub)(Liferay.Language.get("enter-an-absolute-url"),"<em>","</em>")}})))};t.default=_default}}));
//# sourceMappingURL=DestinationUrlInput.js.map