File: /var/www/delta/wp-content/plugins/better-wp-security/dist/notification-center/settings.js
/*! For license information please see settings.js.LICENSE.txt */
(globalThis.itsecWebpackJsonP=globalThis.itsecWebpackJsonP||[]).push([[384],{3075:e=>{e.exports=function(){return this.wp.i18n}()},8601:e=>{e.exports=function(){return this.wp.element}()},11431:e=>{e.exports=function(){return this.wp.a11y}()},26425:e=>{e.exports=function(){return this.itsec.pages.settings}()},31987:e=>{e.exports=function(){return this.wp.data}()},38125:e=>{e.exports=function(){return this.wp.plugins}()},39959:e=>{e.exports=function(){return this.wp.components}()},46627:e=>{e.exports=function(){return this.itsec.packages.data}()},46942:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,s(n)))}return e}function s(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)}()},51609:e=>{"use strict";e.exports=window.React},55933:e=>{e.exports=function(){return this.wp.primitives}()},57677:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(8601);const i=(0,r.forwardRef)((function({icon:e,size:t=24,...n},i){return(0,r.cloneElement)(e,{width:t,height:t,...n,ref:i})}))},60706:(e,t,n)=>{"use strict";var r=n(51609),i=n(3075),s=n(38125),a=n(66087),o=n(85631),l=n.n(o),c=n(8601),u=n(31987),d=n(98883),m=n(26425),p=n(99103),h=n(46627),f=n(39959),g=n(89897),E=n(88356),_=n(52238),v=n(48620),b=n(81923);const y=(0,b.A)(E.ui,{target:"e1bftilw3"})("border:1px solid ",(({theme:e})=>e.colors.border.normal),";"),w=(0,b.A)("dl",{target:"e1bftilw2"})({name:"ti75j2",styles:"margin:0"}),S=(0,b.A)("dt",{target:"e1bftilw1"})({name:"akdqam",styles:"margin-top:1rem"}),O=(0,b.A)("dd",{target:"e1bftilw0"})({name:"98gkun",styles:"margin:.25rem 0 0 0"}),N=["a","i","b","h2","h3","h4","h5","h6","p"];function R({notification:e,settings:t,onChange:n,usersAndRoles:s,apiError:a}){const o=!e.optional||t.enabled;return(0,r.createElement)(React.Fragment,null,(0,r.createElement)(y,null,(0,r.createElement)(E.zY,{title:e.l10n.label,description:(0,r.createElement)(v.VK,{content:e.l10n.description,noWrap:!0}),hasBorder:!0}),(0,r.createElement)(m.PrimaryForm,{apiError:a,hasPadding:!0},e.optional&&(0,r.createElement)(f.CheckboxControl,{className:"itsec-nc-notification__enabled",label:(0,i.__)("Enabled","better-wp-security"),checked:t.enabled,onChange:e=>n({...t,enabled:e}),__nextHasNoMarginBottom:!0}),o&&(0,r.createElement)(React.Fragment,null,(0,r.createElement)(x,{notification:e,settings:t,onChange:n}),(0,r.createElement)(I,{notification:e,settings:t,onChange:n}),(0,r.createElement)(A,{notification:e,settings:t,onChange:n,usersAndRoles:s})))),(0,r.createElement)(F,null))}function x({notification:e,settings:t,onChange:n}){const s=(0,r.createElement)("span",null,(0,i.sprintf)((0,i.__)("You can use HTML in your message. Allowed HTML includes: %s.","better-wp-security"),N.join(", "))," ",!!e.tags&&(0,c.createInterpolateElement)((0,i.__)("This notification supports email tags. Tags are formatted as follows <tag />.","better-wp-security"),{tag:(0,r.createElement)("code",null,"{{ $tag_name }}")}));return(0,r.createElement)(m.PrimaryFormSection,{heading:(0,i.__)("Customize","better-wp-security")},e.subject_editable&&(0,r.createElement)(f.TextControl,{label:(0,i.__)("Subject","better-wp-security"),placeholder:e.l10n.subject,value:t.subject||e.l10n.subject,onChange:e=>n({...t,subject:e})}),e.message_editable&&(0,r.createElement)(React.Fragment,null,(0,r.createElement)(f.TextareaControl,{label:(0,i.__)("Message","better-wp-security"),placeholder:e.l10n.message,rows:10,value:t.message||e.l10n.message,onChange:e=>n({...t,message:e}),help:s}),e.tags&&(0,r.createElement)(w,null,(0,a.map)(e.l10n.tags,((e,t)=>(0,r.createElement)(c.Fragment,{key:t},(0,r.createElement)(S,null,(0,r.createElement)("code",null,t)),(0,r.createElement)(O,null,e)))))))}function I({notification:e,settings:t,onChange:n}){const s=(0,g.useInstanceId)(A,"itsec-nc-notification__schedule");return(0,a.isPlainObject)(e.schedule)?(0,r.createElement)(m.PrimaryFormSection,{heading:(0,r.createElement)("label",{htmlFor:s},(0,i.__)("Schedule","better-wp-security"))},(0,r.createElement)(f.SelectControl,{id:s,options:e.l10n.schedule,value:t.schedule,onChange:e=>n({...t,schedule:e})})):null}function A({notification:e,settings:t,onChange:n,usersAndRoles:s}){const a=(0,g.useInstanceId)(A,"itsec-nc-notification__recipients");switch(e.recipient){case"user":return(0,r.createElement)(m.PrimaryFormSection,{className:"itsec-nc-notification__recipients",heading:(0,i.__)("Recipient","better-wp-security")},(0,i.__)("Site Users","better-wp-security"));case"admin":return(0,r.createElement)(m.PrimaryFormSection,{className:"itsec-nc-notification__recipients",heading:(0,i.__)("Recipient","better-wp-security")},(0,i.__)("Admin Emails","better-wp-security"));case"per-use":return(0,r.createElement)(m.PrimaryFormSection,{className:"itsec-nc-notification__recipients",heading:(0,i.__)("Recipient","better-wp-security")},(0,i.__)("Specified when sending","better-wp-security"));case"email-list":return(0,r.createElement)(m.PrimaryFormSection,{heading:(0,r.createElement)("label",{htmlFor:a},(0,i.__)("Recipient","better-wp-security"))},(0,r.createElement)(_.KK,{id:a,help:(0,i.__)("The email address(es) this notification will be sent to. One address per line.","better-wp-security"),value:t.email_list,onChange:e=>n({...t,email_list:e})}));case"user-list":return(0,r.createElement)(m.PrimaryFormSection,{className:"itsec-nc-notification__recipients itsec-nc-notification__recipients--user-list",heading:(0,r.createElement)("label",{htmlFor:a},(0,i.__)("Recipient","better-wp-security"))},(0,r.createElement)(f.SelectControl,{value:t.recipient_type,onChange:e=>n({...t,recipient_type:e}),id:a,options:[{value:"default",label:(0,i.__)("Default Recipients","better-wp-security")},{value:"custom",label:(0,i.__)("Custom","better-wp-security")}]}),"custom"===t.recipient_type&&(0,r.createElement)(V,{help:(0,i.__)("Select which users should be emailed.","better-wp-security"),value:t.user_list||[],onChange:e=>n({...t,user_list:e}),usersAndRoles:s}))}}const C=(0,b.A)("div",{target:"ey5u5nb2"})({name:"mdhyel",styles:"width:100%;max-width:600px;flex-grow:1"}),k=(0,b.A)(E.EY,{target:"ey5u5nb1"})({name:"1wfa6r1",styles:"color:#6C6C6C;margin-bottom:6rem"}),L=(0,b.A)(E.$n,{target:"ey5u5nb0"})({name:"1fo50kt",styles:"margin-top:1.5rem"});function M({usersAndRoles:e,apiError:t}){const{goNext:n}=(0,m.useNavigation)(),s=(0,g.useViewportMatch)("medium");return(0,r.createElement)(C,null,s&&(0,r.createElement)(k,{as:"p",align:"center",size:E.$C.EXTRA_LARGE,variant:E.J3.MUTED,text:(0,i.__)("You’re almost done, just one last topic to cover!","better-wp-security")}),(0,r.createElement)(m.OnboardHeader,{title:(0,i.__)("Notifications","better-wp-security"),description:(0,i.__)("Manage and configure email notifications sent by Solid Security related to various features.","better-wp-security"),showIndicator:!0}),(0,r.createElement)(U,{usersAndRoles:e,apiError:t}),(0,r.createElement)(L,{variant:"primary",onClick:n,text:(0,i.__)("Complete Setup","better-wp-security")}))}var D=n(56347);function P({asyncNotifications:e,asyncUsersAndRoles:t}){const{url:n,path:i,params:{root:s}}=(0,D.W5)(),{status:o,value:l}=e,{status:c,value:d}=t,p=(0,u.useSelect)((e=>e(h.MODULES_STORE_NAME).getError("notification-center")),[]);if("success"!==o&&("pending"!==o||!l)||"success"!==c)return null;const f=(0,r.createElement)(m.ChildPages,{pages:(0,a.map)(l,(e=>({title:e.l10n.label,to:`${n}/${e.slug}`,id:e.slug})))});return(0,r.createElement)(D.dO,null,(0,r.createElement)(D.qh,{path:`${i}/:child`},f,(0,r.createElement)(T,{notifications:l,usersAndRoles:d,apiError:p})),(0,r.createElement)(D.qh,{path:i},f,"settings"===s&&(0,r.createElement)(H,{usersAndRoles:d,apiError:p}),"settings"!==s&&(0,r.createElement)(M,{usersAndRoles:d,apiError:p})))}function T({notifications:e,usersAndRoles:t,apiError:n}){const{child:i}=(0,D.g)(),{settings:s}=(0,u.useSelect)((e=>({settings:e(h.MODULES_STORE_NAME).getEditedSetting("notification-center","notifications")})),[]),{editSetting:a}=(0,u.useDispatch)(h.MODULES_STORE_NAME),o=(0,c.useCallback)((e=>a("notification-center","notifications",{...s,[i]:e})),[i,a,s]);return s?(0,r.createElement)(R,{notification:e[i],usersAndRoles:t,settings:s[i]||{},onChange:o,apiError:n}):null}const W=(0,b.A)(f.Flex,{target:"e19alqk00"})({name:"hltamm",styles:"margin-top:2rem"});function F({setErrors:e}){const{isDirty:t,isSaving:n}=(0,u.useSelect)((e=>({isDirty:e(h.MODULES_STORE_NAME).areSettingsDirty("notification-center"),isSaving:e(h.MODULES_STORE_NAME).isSavingSettings("notification-center")})),[]),{saveSettings:s,resetSettingEdits:a,validateSettings:o}=(0,u.useDispatch)(h.MODULES_STORE_NAME);return(0,r.createElement)(W,{justify:"end"},(0,r.createElement)(f.FlexItem,null,(0,r.createElement)(E.$n,{onClick:()=>a("notification-center"),disabled:!t,text:(0,i.__)("Undo Changes","better-wp-security")})),(0,r.createElement)(f.FlexItem,null,(0,r.createElement)(E.$n,{onClick:async()=>{const t=await o("notification-center");!0===t?(e?.([]),s("notification-center")):e?.(t.errorText)},disabled:!t,isBusy:n,variant:"primary",text:(0,i.__)("Save All Changes","better-wp-security")})))}const j=(0,b.A)(E.ui,{target:"emcou8w0"})("border:1px solid ",(({theme:e})=>e.colors.border.normal),";");function H({usersAndRoles:e,apiError:t}){const[n,s]=(0,c.useState)([]);return(0,r.createElement)(React.Fragment,null,(0,r.createElement)(j,null,(0,r.createElement)(E.zY,{title:(0,i.__)("Notifications","better-wp-security"),description:(0,i.__)("Manage and configure email notifications sent by Solid Security related to various features.","better-wp-security"),hasBorder:!0}),(0,r.createElement)(U,{usersAndRoles:e,errors:n,apiError:t,hasPadding:!0})),(0,r.createElement)(F,{setErrors:s}))}function U({usersAndRoles:e,errors:t,apiError:n,hasPadding:s}){const{fromEmail:a,defaultRecipients:o}=(0,u.useSelect)((e=>({isDirty:e(h.MODULES_STORE_NAME).areSettingsDirty("notification-center"),fromEmail:e(h.MODULES_STORE_NAME).getEditedSetting("notification-center","from_email")||"",defaultRecipients:e(h.MODULES_STORE_NAME).getEditedSetting("notification-center","default_recipients")||{}})),[]),{editSetting:l}=(0,u.useDispatch)(h.MODULES_STORE_NAME);return(0,r.createElement)(m.PrimaryForm,{apiError:n,errors:t,hasPadding:s},(0,r.createElement)(f.TextControl,{type:"email",value:a,onChange:e=>l("notification-center","from_email",e),label:(0,i.__)("From Email","better-wp-security"),help:(0,i.__)("Solid Security will send notifications from this email address. Leave blank to use the WordPress default.","better-wp-security")}),(0,r.createElement)(E.DZ,{level:3,size:E.$C.LARGE,weight:E.uL.HEAVY,variant:E.J3.DARK,text:(0,i.__)("Default Recipients","better-wp-security")}),(0,r.createElement)(V,{help:(0,i.__)("Set the default recipients for any admin-facing notifications.","better-wp-security"),value:o.user_list||[],onChange:e=>l("notification-center","default_recipients",{...o,user_list:e}),usersAndRoles:e}))}function V({value:e,onChange:t,usersAndRoles:n,help:s}){return(0,r.createElement)("fieldset",{className:"itsec-nc-user-role-list"},s&&(0,r.createElement)("legend",null,s),(0,r.createElement)("ul",{className:"itsec-nc-user-role-list__group"},n.roles.map((({value:n,label:s})=>(0,r.createElement)("li",{key:n},(0,r.createElement)(f.CheckboxControl,{label:(0,i.sprintf)((0,i.__)("All “%s” Users","better-wp-security"),s),checked:e.includes(n),onChange:r=>t(r?[...e,n]:e.filter((e=>e!==n)))}))))),(0,r.createElement)("ul",{className:"itsec-nc-user-role-list__group"},n.users.map((({value:n,label:i})=>(0,r.createElement)("li",{key:n},(0,r.createElement)(f.CheckboxControl,{label:i,checked:e.includes(n),onChange:r=>t(r?[...e,n]:e.filter((e=>e!==n)))}))))))}const $=()=>l()({path:"/ithemes-security/rpc/notification-center/available-users-roles"});function B(){const e=(0,u.useSelect)((e=>e(h.MODULES_STORE_NAME).getActiveModules())),t=(0,d.Yb)((0,c.useCallback)((()=>l()({path:"/ithemes-security/rpc/notification-center/notifications"})),[e])),n=(0,d.Yb)($);return function(e){const{registerProvider:t}=(0,u.useDispatch)(p.E);(0,c.useEffect)((()=>{t("notifications",(0,i.__)("Notifications","better-wp-security"),50,(({evaluate:t,results:n})=>(0,a.reduce)(e,((e,r,i)=>t.stringMatch(r.l10n.label)||t.stringMatch(r.l10n.description)?(n.items.push({title:r.l10n.label,description:r.l10n.description,route:`/settings/notification-center/${i}`}),e++):e),0)))}),[e,t])}(t.value),(0,r.createElement)(m.Page,{id:"notification-center",title:(0,i.__)("Notifications","better-wp-security"),icon:"email-alt",priority:20,roots:["onboard","import","settings"],key:t.status+n.status},(()=>(0,r.createElement)(P,{asyncNotifications:t,asyncUsersAndRoles:n})))}n.p=window.itsecWebpackPublicPath,(0,i.setLocaleData)({"":{}},"ithemes-security-pro"),(0,s.registerPlugin)("itsec-notification-center-settings",{render:()=>(0,r.createElement)(B,null)})},62247:e=>{e.exports=function(){return this.wp.isShallowEqual}()},66087:e=>{"use strict";e.exports=window.lodash},70404:(e,t,n)=>{"use strict";function r(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function i(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function s(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return i(n.overflowY,t)||i(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function a(e,t,n,r,i,s,a,o){return s<e&&a>t||s>e&&a<t?0:s<=e&&o<=n||a>=t&&o>=n?s-e-r:a>t&&o<n||s<e&&o>n?a-t+i:0}n.d(t,{A:()=>c});var o=function(e,t){var n=window,i=t.scrollMode,o=t.block,l=t.inline,c=t.boundary,u=t.skipOverflowHiddenElements,d="function"==typeof c?c:function(e){return e!==c};if(!r(e))throw new TypeError("Invalid target");for(var m,p,h=document.scrollingElement||document.documentElement,f=[],g=e;r(g)&&d(g);){if((g=null==(p=(m=g).parentElement)?m.getRootNode().host||null:p)===h){f.push(g);break}null!=g&&g===document.body&&s(g)&&!s(document.documentElement)||null!=g&&s(g,u)&&f.push(g)}for(var E=n.visualViewport?n.visualViewport.width:innerWidth,_=n.visualViewport?n.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),w=y.height,S=y.width,O=y.top,N=y.right,R=y.bottom,x=y.left,I="start"===o||"nearest"===o?O:"end"===o?R:O+w/2,A="center"===l?x+S/2:"end"===l?N:x,C=[],k=0;k<f.length;k++){var L=f[k],M=L.getBoundingClientRect(),D=M.height,P=M.width,T=M.top,W=M.right,F=M.bottom,j=M.left;if("if-needed"===i&&O>=0&&x>=0&&R<=_&&N<=E&&O>=T&&R<=F&&x>=j&&N<=W)return C;var H=getComputedStyle(L),U=parseInt(H.borderLeftWidth,10),V=parseInt(H.borderTopWidth,10),$=parseInt(H.borderRightWidth,10),B=parseInt(H.borderBottomWidth,10),Y=0,z=0,q="offsetWidth"in L?L.offsetWidth-L.clientWidth-U-$:0,K="offsetHeight"in L?L.offsetHeight-L.clientHeight-V-B:0,G="offsetWidth"in L?0===L.offsetWidth?0:P/L.offsetWidth:0,J="offsetHeight"in L?0===L.offsetHeight?0:D/L.offsetHeight:0;if(h===L)Y="start"===o?I:"end"===o?I-_:"nearest"===o?a(b,b+_,_,V,B,b+I,b+I+w,w):I-_/2,z="start"===l?A:"center"===l?A-E/2:"end"===l?A-E:a(v,v+E,E,U,$,v+A,v+A+S,S),Y=Math.max(0,Y+b),z=Math.max(0,z+v);else{Y="start"===o?I-T-V:"end"===o?I-F+B+K:"nearest"===o?a(T,F,D,V,B+K,I,I+w,w):I-(T+D/2)+K/2,z="start"===l?A-j-U:"center"===l?A-(j+P/2)+q/2:"end"===l?A-W+$+q:a(j,W,P,U,$+q,A,A+S,S);var X=L.scrollLeft,Z=L.scrollTop;I+=Z-(Y=Math.max(0,Math.min(Z+Y/J,L.scrollHeight-D/J+K))),A+=X-(z=Math.max(0,Math.min(X+z/G,L.scrollWidth-P/G+q)))}C.push({el:L,top:Y,left:z})}return C};function l(e){return e===Object(e)&&0!==Object.keys(e).length}const c=function(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(l(t)&&"function"==typeof t.behavior)return t.behavior(n?o(e,t):[]);if(n){var r=function(e){return!1===e?{block:"end",inline:"nearest"}:l(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach((function(e){var r=e.el,i=e.top,s=e.left;r.scroll&&n?r.scroll({top:i,left:s,behavior:t}):(r.scrollTop=i,r.scrollLeft=s)}))}(o(e,r),r.behavior)}}},74596:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(51609),i=n(55933);const s=(0,r.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(i.Path,{d:"M7 11.5h10V13H7z"}))},75795:e=>{"use strict";e.exports=window.ReactDOM},76154:e=>{"use strict";e.exports=window.moment},77172:e=>{e.exports=function(){return this.wp.url}()},79860:e=>{e.exports=function(){return this.wp.keycodes}()},84156:(e,t,n)=>{"use strict";var r,i;function s(e){return[e]}function a(){var e={clear:function(){e.head=null}};return e}function o(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function l(e,t){var n,l;function c(){n=i?new WeakMap:a()}function u(){var n,r,i,s,a,c=arguments.length;for(s=new Array(c),i=0;i<c;i++)s[i]=arguments[i];for(a=t.apply(null,s),(n=l(a)).isUniqueByDependants||(n.lastDependants&&!o(a,n.lastDependants,0)&&n.clear(),n.lastDependants=a),r=n.head;r;){if(o(r.args,s,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,s)},s[0]=null,r.args=s,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=s),l=i?function(e){var t,i,s,o,l,c=n,u=!0;for(t=0;t<e.length;t++){if(!(l=i=e[t])||"object"!=typeof l){u=!1;break}c.has(i)?c=c.get(i):(s=new WeakMap,c.set(i,s),c=s)}return c.has(r)||((o=a()).isUniqueByDependants=u,c.set(r,o)),c.get(r)}:function(){return n},u.getDependants=t,u.clear=c,c(),u}n.d(t,{A:()=>l}),r={},i="undefined"!=typeof WeakMap},85631:e=>{e.exports=function(){return this.wp.apiFetch}()},89897:e=>{e.exports=function(){return this.wp.compose}()},89959:e=>{e.exports=function(){return this.wp.date}()},99103:(e,t,n)=>{"use strict";n.d(t,{E:()=>H,v:()=>k});var r={};n.r(r),n.d(r,{REGISTER_PROVIDER:()=>W,registerProvider:()=>T});var i={};n.r(i),n.d(i,{getProviders:()=>F});var s=n(58168),a=n(51609),o=n(54625),l=n(56347),c=n(17929),u=n(66087),d=n(39959),m=n(3075),p=n(8601),h=n(31987),f=n(89897),g=n(79860),E=n(11431),_=n(88356),v=n(98883),b=n(52238);function y(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function w(e,t){return e.get(O(e,t))}function S(e,t,n){return e.set(O(e,t),n),n}function O(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var N=new WeakMap,R=new WeakMap,x=new WeakMap,I=new WeakMap,A=new WeakMap;class C{constructor(e,t){y(this,N,void 0),y(this,R,void 0),y(this,x,void 0),y(this,I,void 0),y(this,A,void 0),S(N,this,e),S(R,this,t),S(x,this,t.select(H).getProviders()),this._prepare()}_prepare(){S(A,this,w(N,this).split(/\s+/g).map((e=>e.trim().toLowerCase())).filter((e=>!!e)));const e=w(N,this).endsWith(" ");S(I,this,new RegExp(w(A,this).map(((t,n)=>n+1!==w(A,this).length||e?`(?=.*\\b${(0,u.escapeRegExp)(t)}\\b)`:`(?=.*\\b${(0,u.escapeRegExp)(t)})`)).join("")+".+","gi"))}_stringMatch(e){return e&&w(I,this).test(e)}_keywordMatch(e){return!(!e||!e.length)&&e.some((e=>w(A,this).some(((t,n)=>e.includes(" ")?this._stringMatch(e):n===w(A,this).length-1?e.startsWith(t):t===e))))}getResults(){if(w(N,this).length<3)return[{},0];let e=0;const t=[],n={stringMatch:e=>this._stringMatch(e),keywordMatch:e=>this._keywordMatch(e)};for(const r of w(x,this)){const i={title:r.title,items:[],groups:{}};e+=r.callback({evaluate:n,results:i,registry:w(R,this)}),!i.items.length&&(0,u.isEmpty)(i.groups)||t.push(i)}return[t,e]}}const k=(0,p.forwardRef)((function({onPick:e=u.noop,showResults:t},n){const[r,i]=(0,p.useState)(""),[o,l]=(0,p.useState)(!1),c=(0,p.useRef)(),d=(0,p.useRef)(),[b,y]=(0,p.useState)([]),w=(0,h.useRegistry)(),S=(0,p.useCallback)((e=>{const t=new C(e,w).getResults();y(t[0]),(0,E.speak)((0,m.sprintf)((0,m._n)("%d result found.","%d results found.",t[1],"better-wp-security"),t[1]))}),[w]),O=(0,f.useDebounce)(S,50),N=(0,p.useCallback)((e=>{c.current&&(e.preventDefault(),c.current.focus())}),[c]);return(0,f.useKeyboardShortcut)("/",N),(0,a.createElement)("div",(0,s.A)({className:"itsec-search"},(0,v.$I)((()=>l(!1)))),(0,a.createElement)("div",null,(0,a.createElement)(_.qz,{value:r,onChange:e=>{i(e),O(e)},onFocus:()=>l(!0),onKeyDown:e=>{e.keyCode===g.DOWN&&(e.preventDefault(),d.current.focus())},ref:(0,v.SV)([n,c]),placeholder:(0,m.__)("Search for features, settings, and more","better-wp-security"),omitSeparators:!0,size:"large"}),(o||t)&&r.length>=3&&(0,a.createElement)(L,{results:b,exitSearch:t=>{e(t),l(!1)},ref:d,onPick:e})))})),L=(0,p.forwardRef)((function({results:e,exitSearch:t,onPick:n},r){const i=(0,p.useRef)();(0,p.useImperativeHandle)(r,(()=>({focus(){i.current.focus()}})));const o=(0,f.useInstanceId)(L,"itsec-search"),h=o+"__result__",E=function(){const e=(0,l.W6)();return(t,n="push")=>e[n]((0,c.yJ)(t))}(),[_,v]=(0,p.useState)("");return(0,u.isEmpty)(e)?null:(0,a.createElement)(React.Fragment,null,(0,a.createElement)(d.VisuallyHidden,{id:o+"__label"},(0,m.__)("Search Results","better-wp-security")),(0,a.createElement)(b.NL,{className:"itsec-search__results",id:o,active:_&&h+_,onNavigate:e=>v(e.substring(h.length)),onKeyDown:({keyCode:e})=>{!_||e!==g.ENTER&&e!==g.SPACE||(n(_),E(_),t())},onFocus:()=>{if(!_&&!(0,u.isEmpty)(e)){const[,t]=Object.entries(e)[0];if(t.items?.length)v(t.items[0].route);else if(!(0,u.isEmpty)(t.groups)){const[,e]=Object.entries(t.groups)[0];v(e.items[0].route)}}},role:"listbox",descendantRoles:"option",ref:i,"aria-labelledby":o+"__label"},(0,u.map)(e,((e,n)=>(0,a.createElement)(M,(0,s.A)({key:n},e,{active:_,idPrefix:h,exitSearch:t}))))))}));function M({title:e,items:t,groups:n,...r}){const i=(0,f.useInstanceId)(L,"itsec-search__kind");return(0,a.createElement)("ul",{className:"itsec-search__kind",role:"group","aria-labelledby":i},(0,a.createElement)("li",{role:"presentation",id:i},e),(t||[]).map((e=>(0,a.createElement)(P,(0,s.A)({key:e.route},e,r)))),(0,u.map)(n,((e,t)=>(0,a.createElement)(D,(0,s.A)({key:t},e,r)))))}function D({title:e,items:t,...n}){const r=(0,f.useInstanceId)(L,"itsec-search__group");return(0,a.createElement)("ul",{className:"itsec-search__group",role:"group","aria-labelledby":r},(0,a.createElement)("li",{role:"presentation",id:r},(0,a.createElement)("span",null,e)),(t||[]).map((e=>(0,a.createElement)(P,(0,s.A)({key:e.route},e,n)))))}function P({title:e,description:t,route:n,active:r,idPrefix:i,exitSearch:s}){return(0,a.createElement)("li",{className:"itsec-search__result",role:"option","aria-selected":r===n||void 0,id:i+n,"aria-label":e},(0,a.createElement)(o.N_,{to:n,tabIndex:-1,onClick:()=>s(n)},(0,a.createElement)("span",null,e),(0,a.createElement)(b.VK,{content:t,noHtml:!0,tagName:"p"})))}function T(e,t,n,r){return{type:W,slug:e,title:t,priority:n,callback:r}}const W="REGISTER_PROVIDER",F=(0,n(84156).A)((e=>(0,u.sortBy)(e.providers,"priority")),(e=>e.providers)),j={providers:{}},H="ithemes-security/search";(0,h.registerStore)(H,{actions:r,selectors:i,reducer:function(e=j,t){return t.type===W?{...e,providers:{...e.providers,[t.slug]:(0,u.omit)(t,["type"])}}:e}})}},e=>{e.O(0,[9427,8356,222,3733,8363,1588,2932,8620,2238],(()=>e(e.s=60706)));var t=e.O();((window.itsec=window.itsec||{})["notification-center"]=window.itsec["notification-center"]||{}).settings=t}]);