katoikia-app/web-ui/web-react/node_modules/primereact/password/password.min.js

2 lines
12 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.password=function(e,t,n,r,i,o,s,l,a){"use strict";function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=p(t),c=p(s);function h(){return h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h.apply(this,arguments)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function g(e,t){if(t&&("object"===b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){O(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function R(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var x=function(e){m(L,e);var p,v,b,O,w,x=(p=L,v=R(),function(){var e,t=k(p);if(v){var n=k(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return g(this,e)});function L(e){var n;return f(this,L),(n=x.call(this,e)).state={overlayVisible:!1,meter:null,infoText:n.promptLabel(),focused:!1,unmasked:!1},n.onFocus=n.onFocus.bind(y(n)),n.onBlur=n.onBlur.bind(y(n)),n.onKeyup=n.onKeyup.bind(y(n)),n.onInput=n.onInput.bind(y(n)),n.onMaskToggle=n.onMaskToggle.bind(y(n)),n.onOverlayEnter=n.onOverlayEnter.bind(y(n)),n.onOverlayEntered=n.onOverlayEntered.bind(y(n)),n.onOverlayExit=n.onOverlayExit.bind(y(n)),n.onOverlayExited=n.onOverlayExited.bind(y(n)),n.onPanelClick=n.onPanelClick.bind(y(n)),n.overlayRef=t.createRef(),n.inputRef=t.createRef(n.props.inputRef),n.mediumCheckRegExp=new RegExp(n.props.mediumRegex),n.strongCheckRegExp=new RegExp(n.props.strongRegex),n}return b=L,(O=[{key:"promptLabel",value:function(){return this.props.promptLabel||s.localeOption("passwordPrompt")}},{key:"weakLabel",value:function(){return this.props.weakLabel||s.localeOption("weak")}},{key:"mediumLabel",value:function(){return this.props.mediumLabel||s.localeOption("medium")}},{key:"strongLabel",value:function(){return this.props.strongLabel||s.localeOption("strong")}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.inputRef&&this.inputRef.current&&n.DomHandler.hasClass(this.inputRef.current,"p-filled")}},{key:"getInputType",value:function(){return this.state.unmasked?"text":"password"}},{key:"updateLabels",value:function(){if(this.state.meter){var e=null;switch(this.state.meter.strength){case"weak":e=this.weakLabel();break;case"medium":e=this.mediumLabel();break;case"strong":e=this.strongLabel()}e&&this.state.infoText!==e&&this.setState({infoText:e})}else{var t=this.promptLabel();this.state.infoText!==t&&this.setState({infoText:t})}}},{key:"onPanelClick",value:function(e){this.props.feedback&&l.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onMaskToggle",value:function(){this.setState((function(e){return{unmasked:!e.unmasked}}))}},{key:"showOverlay",value:function(){this.updateLabels(),this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1})}},{key:"alignOverlay",value:function(){this.inputRef&&this.inputRef.current&&n.DomHandler.alignOverlay(this.overlayRef.current,this.inputRef.current.parentElement,this.props.appendTo||c.default.appendTo)}},{key:"onOverlayEnter",value:function(){n.ZIndexUtils.set("overlay",this.overlayRef.current,c.default.autoZIndex,c.default.zIndex.overlay),this.alignOverlay()}},{key:"onOverlayEntered",value:function(){this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){n.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"onFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.feedback&&t.showOverlay(),t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.feedback&&t.hideOverlay(),t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onKeyup",value:function(e){var t=this,n=e.keyCode||e.which;if(this.props.feedback){var r=null,i=null;switch(this.testStrength(e.target.value)){case 1:r=this.weakLabel(),i={strength:"weak",width:"33.33%"};break;case 2:r=this.mediumLabel(),i={strength:"medium",width:"66.66%"};break;case 3:r=this.strongLabel(),i={strength:"strong",width:"100%"};break;default:r=this.promptLabel(),i=null}this.setState({meter:i,infoText:r},(function(){n&&!t.state.overlayVisible&&t.showOverlay()}))}this.props.onKeyUp&&this.props.onKeyUp(e)}},{key:"onInput",value:function(e,t){this.props.onInput&&this.props.onInput(e,t),this.props.onChange||(e.target.value.length>0?n.DomHandler.addClass(this.container,"p-inputwrapper-filled"):n.DomHandler.removeClass(this.container,"p-inputwrapper-filled"))}},{key:"testStrength",value:function(e){var t=0;return this.strongCheckRegExp.test(e)?t=3:this.mediumCheckRegExp.test(e)?t=2:e.length&&(t=1),t}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.inputEl,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!n.DomHandler.isTouchDevice()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(E({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),e.mediumRegex!==this.props.mediumRegex&&(this.mediumCheckRegExp=new RegExp(this.props.mediumRegex)),e.strongRegex!==this.props.strongRegex&&(this.strongCheckRegExp=new RegExp(this.props.strongRegex)),!this.isFilled()&&n.DomHandler.hasClass(this.container,"p-inputwrapper-filled")&&n.DomHandler.removeClass(this.container,"p-inputwrapper-filled")}},{key:"componentWillUnmount",value:function(){this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),n.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderTooltip",value:function(){this.tooltip=r.tip({target:this.inputEl,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderIcon",value:function(){if(this.props.toggleMask){var e=this.state.unmasked?"pi pi-eye-slash":"pi pi-eye",t=u.default.createElement("i",{className:e,onClick:this.onMaskToggle});return this.props.icon&&(t=n.ObjectUtils.getJSXElement(this.props.icon,{onClick:this.onMaskToggle,className:e,element:t,props:this.props})),t}return null}},{key:"renderPanel",value:function(){var e=n.classNames("p-password-panel p-component",this.props.panelClassName),t=this.state.meter||{strength:"",width:"0%"},r=t.strength,i=t.width,s=n.ObjectUtils.getJSXElement(this.props.header,this.props),l=n.ObjectUtils.getJSXElement(this.props.footer,this.props),p=this.props.content?n.ObjectUtils.getJSXElement(this.props.content,this.props):u.default.createElement(u.default.Fragment,null,u.default.createElement("div",{className:"p-password-meter"},u.default.createElement("div",{className:"p-password-strength ".concat(r),style:{width:i}})),u.default.createElement("div",{className:"p-password-info"},this.state.infoText));return u.default.createElement(a.Portal,{element:u.default.createElement(o.CSSTransition,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.overlayVisible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onOverlayEnter,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited},u.default.createElement("div",{ref:this.overlayRef,className:e,style:this.props.panelStyle,onClick:this.onPanelClick},s,p,l)),appendTo:this.props.appendTo})}},{key:"render",value:function(){var e=this,t=n.classNames("p-password p-component p-inputwrapper",{"p-inputwrapper-filled":this.isFilled(),"p-inputwrapper-focus":this.state.focused,"p-input-icon-right":this.props.toggleMask},this.props.className),r=n.classNames("p-password-input",this.props.inputClassName),o=this.getInputType(),s=n.ObjectUtils.findDiffKeys(this.props,L.defaultProps),l=this.renderIcon(),a=this.renderPanel();return u.default.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:t,style:this.props.style},u.default.createElement(i.InputText,h({ref:this.inputRef,id:this.props.inputId},s,{type:o,className:r,style:this.props.inputStyle,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyup,onInput:this.onInput})),l,a)}}])&&d(b.prototype,O),w&&d(b,w),Object.defineProperty(b,"prototype",{writable:!1}),L}(t.Component);return O(x,"defaultProps",{id:null,inputId:null,inputRef:null,promptLabel:null,weakLabel:null,mediumLabel:null,strongLabel:null,mediumRegex:"^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})",strongRegex:"^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})",feedback:!0,toggleMask:!1,appendTo:null,header:null,content:null,footer:null,icon:null,tooltip:null,tooltipOptions:null,style:null,className:null,inputStyle:null,inputClassName:null,panelStyle:null,panelClassName:null,transitionOptions:null,onInput:null,onShow:null,onHide:null}),e.Password=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.tooltip,primereact.inputtext,primereact.csstransition,primereact.api,primereact.overlayservice,primereact.portal);