SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > content-control > dist >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/content-control/dist/

NameTypeSizeLast ModifiedActions
block-editor.asset.php File 333 bytes December 08 2023 15:26:30.
block-editor.css File 3836 bytes December 08 2023 15:26:30.
block-editor.js File 45153 bytes December 08 2023 15:26:30.
components.asset.php File 270 bytes March 15 2025 12:03:42.
components.css File 22095 bytes December 08 2023 15:26:30.
components.js File 28400 bytes March 15 2025 12:03:42.
core-data.asset.php File 166 bytes March 11 2025 14:19:36.
core-data.js File 26691 bytes March 11 2025 14:19:36.
data.asset.php File 150 bytes December 08 2023 15:26:30.
data.js File 854 bytes December 08 2023 15:26:30.
fields.asset.php File 261 bytes March 15 2025 12:03:42.
fields.js File 13464 bytes March 15 2025 12:03:42.
icons.asset.php File 108 bytes October 26 2023 13:40:28.
icons.css File 606 bytes September 18 2023 05:47:10.
icons.js File 14082 bytes October 26 2023 13:40:28.
rule-engine.asset.php File 255 bytes December 08 2023 15:26:30.
rule-engine.css File 9019 bytes December 08 2023 15:26:30.
rule-engine.js File 68792 bytes December 08 2023 15:26:30.
settings-page.asset.php File 377 bytes April 22 2025 10:36:58.
settings-page.css File 47271 bytes March 11 2025 14:19:36.
settings-page.js File 94280 bytes April 22 2025 10:36:58.
style-block-editor.css File 1776 bytes September 18 2023 05:47:10.
utils.asset.php File 84 bytes September 18 2023 05:47:10.
utils.js File 946 bytes September 18 2023 05:47:10.
widget-editor.asset.php File 92 bytes September 18 2023 05:47:10.
widget-editor.css File 128 bytes September 18 2023 05:47:10.
widget-editor.js File 944 bytes September 18 2023 05:47:10.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/content-control/dist//settings-page.js

!function(){var e={184:function(e,t){var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var l=typeof n;if("string"===l||"number"===l)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===l){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var c in n)o.call(n,c)&&n[c]&&e.push(c)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};!function(){"use strict";n.r(o),n.d(o,{init:function(){return gn}});var e,t,r=window.React;function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}(t=e||(e={})).Pop="POP",t.Push="PUSH",t.Replace="REPLACE";const a="popstate";function c(e,t){if(!1===e||null==e)throw new Error(t)}function s(e,t){return{usr:e.state,key:e.key,idx:t}}function i(e,t,n,o){return void 0===n&&(n=null),l({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?d(t):t,{state:n,key:t&&t.key||o||Math.random().toString(36).substr(2,8)})}function u(e){let{pathname:t="/",search:n="",hash:o=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),o&&"#"!==o&&(t+="#"===o.charAt(0)?o:"#"+o),t}function d(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let o=e.indexOf("?");o>=0&&(t.search=e.substr(o),e=e.substr(0,o)),e&&(t.pathname=e)}return t}var m;function p(e,t,n,o){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(o)+"].  Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(m||(m={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const g=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",h=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const _=["post","put","patch","delete"],v=(new Set(_),["get",..._]);new Set(v),new Set([301,302,303,307,308]),new Set([307,308]),"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,Symbol("deferred");const E="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:f,useEffect:b,useLayoutEffect:y,useDebugValue:w}=r;function C(e){const t=e.getSnapshot,n=e.value;try{const e=t();return!E(n,e)}catch(e){return!0}}"undefined"==typeof window||void 0===window.document||window.document.createElement;"useSyncExternalStore"in r&&r.useSyncExternalStore;const S=r.createContext(null),k=r.createContext(null),x=r.createContext(null),N=r.createContext({outlet:null,matches:[]});function P(){return null!=r.useContext(x)}function R(){return P()||c(!1),r.useContext(x).location}function T(){P()||c(!1);let{basename:e,navigator:t}=r.useContext(k),{matches:n}=r.useContext(N),{pathname:o}=R(),a=JSON.stringify(function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(n).map((e=>e.pathnameBase))),s=r.useRef(!1);r.useEffect((()=>{s.current=!0}));let i=r.useCallback((function(n,r){if(void 0===r&&(r={}),!s.current)return;if("number"==typeof n)return void t.go(n);let i=function(e,t,n,o){let r;void 0===o&&(o=!1),"string"==typeof e?r=d(e):(r=l({},e),c(!r.pathname||!r.pathname.includes("?"),p("?","pathname","search",r)),c(!r.pathname||!r.pathname.includes("#"),p("#","pathname","hash",r)),c(!r.search||!r.search.includes("#"),p("#","search","hash",r)));let a,s=""===e||""===r.pathname,i=s?"/":r.pathname;if(o||null==i)a=n;else{let e=t.length-1;if(i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;r.pathname=t.join("/")}a=e>=0?t[e]:"/"}let u=function(e,t){void 0===t&&(t="/");let{pathname:n,search:o="",hash:r=""}="string"==typeof e?d(e):e,l=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:l,search:g(o),hash:h(r)}}(r,a),m=i&&"/"!==i&&i.endsWith("/"),_=(s||"."===i)&&n.endsWith("/");return u.pathname.endsWith("/")||!m&&!_||(u.pathname+="/"),u}(n,JSON.parse(a),o,"path"===r.relative);"/"!==e&&(i.pathname="/"===i.pathname?e:[e,i.pathname].join("/").replace(/\/\/+/g,"/")),(r.replace?t.replace:t.push)(i,r.state,r)}),[e,t,a,o]);return i}var M,L,B,F,D;function A(t){let{basename:n="/",children:o=null,location:l,navigationType:a=e.Pop,navigator:s,static:i=!1}=t;P()&&c(!1);let u=n.replace(/^\/*/,"/"),m=r.useMemo((()=>({basename:u,navigator:s,static:i})),[u,s,i]);"string"==typeof l&&(l=d(l));let{pathname:p="/",search:g="",hash:h="",state:_=null,key:v="default"}=l,E=r.useMemo((()=>{let e=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,o=e.charAt(n);return o&&"/"!==o?null:e.slice(n)||"/"}(p,u);return null==e?null:{location:{pathname:e,search:g,hash:h,state:_,key:v},navigationType:a}}),[u,p,g,h,_,v,a]);return null==E?null:r.createElement(k.Provider,{value:m},r.createElement(x.Provider,{children:o,value:E}))}function O(t){let{basename:n,children:o,window:d}=t,m=r.useRef();null==m.current&&(m.current=function(t){return void 0===t&&(t={}),function(t,n,o,r){void 0===r&&(r={});let{window:d=document.defaultView,v5Compat:m=!1}=r,p=d.history,g=e.Pop,h=null,_=v();function v(){return(p.state||{idx:null}).idx}function E(){g=e.Pop;let t=v(),n=null==t?null:t-_;_=t,h&&h({action:g,location:b.location,delta:n})}function f(e){let t="null"!==d.location.origin?d.location.origin:d.location.href,n="string"==typeof e?e:u(e);return c(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==_&&(_=0,p.replaceState(l({},p.state,{idx:_}),""));let b={get action(){return g},get location(){return t(d,p)},listen(e){if(h)throw new Error("A history only accepts one active listener");return d.addEventListener(a,E),h=e,()=>{d.removeEventListener(a,E),h=null}},createHref(e){return n(d,e)},createURL:f,encodeLocation(e){let t=f(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(t,n){g=e.Push;let r=i(b.location,t,n);o&&o(r,t),_=v()+1;let l=s(r,_),a=b.createHref(r);try{p.pushState(l,"",a)}catch(e){d.location.assign(a)}m&&h&&h({action:g,location:b.location,delta:1})},replace:function(t,n){g=e.Replace;let r=i(b.location,t,n);o&&o(r,t),_=v();let l=s(r,_),a=b.createHref(r);p.replaceState(l,"",a),m&&h&&h({action:g,location:b.location,delta:0})},go(e){return p.go(e)}};return b}((function(e,t){let{pathname:n,search:o,hash:r}=e.location;return i("",{pathname:n,search:o,hash:r},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:u(t)}),null,t)}({window:d,v5Compat:!0}));let p=m.current,[g,h]=r.useState({action:p.action,location:p.location});return r.useLayoutEffect((()=>p.listen(h)),[p]),r.createElement(A,{basename:n,children:o,location:g.location,navigationType:g.action,navigator:p})}function I(e,t,n=!0){return{...e,default:t,decode:(...o)=>{const r=e.decode(...o);return void 0===r||n&&null===r?t:r}}}function U(e,t){if(null==e)return e;if(0===e.length&&(!t||t&&""!==e))return null;const n=e instanceof Array?e[0]:e;return null==n||t||""!==n?n:null}r.Component,function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator"}(M||(M={})),function(e){e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"}(L||(L={})),function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"}(B||(B={})),new Promise((()=>{})),r.Component,"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"}(F||(F={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(D||(D={}));const V={encode:function(e){return null==e?e:String(e)},decode:function(e){const t=U(e,!0);return null==t?t:String(t)}},z={encode:function(e){return null==e?e:String(e)},decode:function(e){const t=U(e);return null==t?t:""===t?null:+t}},j={encode:function(e){return null==e?e:e?"1":"0"},decode:function(e){const t=U(e);return null==t?t:"1"===t||"0"!==t&&null}};'{}[],":'.split("").map((e=>[e,encodeURIComponent(e)]));const H=new class{constructor(){this.paramsMap=new Map,this.registeredParams=new Map}set(e,t,n,o){this.paramsMap.set(e,{stringified:t,decoded:n,decode:o})}has(e,t,n){if(!this.paramsMap.has(e))return!1;const o=this.paramsMap.get(e);return!!o&&o.stringified===t&&(null==n||o.decode===n)}get(e){var t;if(this.paramsMap.has(e))return null==(t=this.paramsMap.get(e))?void 0:t.decoded}registerParams(e){for(const t of e){const e=this.registeredParams.get(t)||0;this.registeredParams.set(t,e+1)}}unregisterParams(e){for(const t of e){const e=(this.registeredParams.get(t)||0)-1;e<=0?(this.registeredParams.delete(t),this.paramsMap.has(t)&&this.paramsMap.delete(t)):this.registeredParams.set(t,e)}}clear(){this.paramsMap.clear(),this.registeredParams.clear()}};function $(e,t,n,o){var r;if(!n||!t.length)return e;let l={...e},a=!1;for(const e of t)Object.prototype.hasOwnProperty.call(l,e)||(l[e]=null!=(r=n[e])?r:o,a=!0);return a?l:e}const W=Object.prototype.hasOwnProperty;function G(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function Q(e,t,n){var o,r;if(G(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const l=Object.keys(e),a=Object.keys(t);if(l.length!==a.length)return!1;for(let a=0;a<l.length;a++){const c=null!=(r=null==(o=null==n?void 0:n[l[a]])?void 0:o.equals)?r:G;if(!W.call(t,l[a])||!c(e[l[a]],t[l[a]]))return!1}return!0}function q(e,t,n){const o={},r=Object.keys(t);for(const l of r){const r=t[l],a=e[l];let c;if(n.has(l,a,r.decode))c=n.get(l);else{if(c=r.decode(a),r.equals&&n.has(l,a)){const e=n.get(l);r.equals(c,e)&&(c=e)}void 0!==c&&n.set(l,a,c,r.decode)}void 0===c&&void 0!==r.default&&(c=r.default),o[l]=c}return o}function Y(){let e;return function(t,n,o){const r=q(t,n,o);return null!=e&&Q(e,r)?e:(e=r,r)}}let K,J,Z,X={};const ee=(e,t,n)=>{if(K===t&&Z===e&&J===n)return X;K=t,Z=e;const o=e(null!=t?t:"");J=n;const r=function(e){if(e)return Object.fromEntries(e.split("\n").map((e=>e.split("\0"))))}(n);for(let[e,t]of Object.entries(o)){(null==r?void 0:r[e])&&(delete o[e],e=r[e],o[e]=t);const n=X[e];Q(t,n)&&(o[e]=n)}return X=o,o};function te(e,t){null==t&&(t={});const n={...e,...t};return t.params&&e.params&&(n.params={...e.params,...t.params}),n}const ne={adapter:{},options:{searchStringToObject:function(e){const t=new URLSearchParams(e),n={};for(let[e,o]of t)Object.prototype.hasOwnProperty.call(n,e)?Array.isArray(n[e])?n[e].push(o):n[e]=[n[e],o]:n[e]=o;return n},objectToSearchString:function(e){const t=new URLSearchParams,n=Object.entries(e);for(const[e,o]of n)if(null!=o)if(Array.isArray(o))for(const n of o)t.append(e,null!=n?n:"");else t.append(e,o);return t.toString()},updateType:"pushIn",includeKnownParams:void 0,includeAllParams:!1,removeDefaultsFromUrl:!1,enableBatching:!1,skipUpdateWhenNoChange:!0}},oe=r.createContext(ne);function re({children:e,adapter:t,options:n}){const{adapter:o,options:l}=r.useContext(oe),a=r.useMemo((()=>({adapter:null!=t?t:o,options:te(l,n)})),[t,n,o,l]);return r.createElement(oe.Provider,{value:a},e)}function le({children:e,adapter:t,options:n}){const o=t;return o?r.createElement(o,null,(t=>r.createElement(re,{adapter:t,options:n},e))):r.createElement(re,{options:n},e)}function ae({changes:e,updateType:t,currentSearchString:n,paramConfigMap:o,options:r}){const{searchStringToObject:l,objectToSearchString:a}=r;let c;null==t&&(t=r.updateType);const s=ee(l,n),i=$(o,Object.keys(e),r.params);let u,d;return u="function"==typeof e?e(q(s,i,H)):e,c=function(e,t){const n={},o=Object.keys(t);for(const r of o){const o=t[r];e[r]?n[r]=e[r].encode(t[r]):n[r]=null==o?o:String(o)}return n}(i,u),r.removeDefaultsFromUrl&&function(e,t){var n;for(const o in e)void 0!==(null==(n=t[o])?void 0:n.default)&&void 0!==e[o]&&t[o].encode(t[o].default)===e[o]&&(e[o]=void 0)}(c,i),c=function(e,t){var n;let o={};for(const r in e)null!=(null==(n=t[r])?void 0:n.urlName)?o[t[r].urlName]=e[r]:o[r]=e[r];return o}(c,i),d=a("push"===t||"replace"===t?c:{...s,...c}),(null==d?void 0:d.length)&&"?"!==d[0]&&(d=`?${d}`),null!=d?d:""}const ce=e=>e(),se=e=>setTimeout((()=>e()),0),ie=[];function ue(e,t){const{adapter:n,options:o}=function(){const e=r.useContext(oe);if(void 0===e||e===ne)throw new Error("useQueryParams must be used within a QueryParamProvider");return e}(),[l]=(0,r.useState)(Y),{paramConfigMap:a,options:c}=function(e,t){let n,o;return void 0===e?(n={},o=t):Array.isArray(e)?(n=Object.fromEntries(e.map((e=>[e,"inherit"]))),o=t):(n=e,o=t),{paramConfigMap:n,options:o}}(e,t),s=(0,r.useMemo)((()=>te(o,c)),[o,c]);let i=function(e,t){var n,o,r;const l={};let a=!1;const c=Object.keys(e);let s=c;if(t.includeKnownParams||!1!==t.includeKnownParams&&0===c.length){const e=Object.keys(null!=(n=t.params)?n:{});s.push(...e)}for(const n of s){const c=e[n];null==c||"object"!=typeof c?(a=!0,l[n]=null!=(r=null==(o=t.params)?void 0:o[n])?r:V):l[n]=c}return a?l:e}(a,s);const u=ee(s.searchStringToObject,n.location.search,function(e){let t;for(const n in e)if(e[n].urlName){const o=`${e[n].urlName}\0${n}`;t?t.push(o):t=[o]}return t?t.join("\n"):void 0}(i));s.includeAllParams&&(i=$(i,Object.keys(u),s.params,V));const d=l(u,i,H),m=Object.keys(i).join("\0");(0,r.useEffect)((()=>{const e=m.split("\0");return H.registerParams(e),()=>{H.unregisterParams(e)}}),[m]);const p={adapter:n,paramConfigMap:i,options:s},g=(0,r.useRef)(p);null==g.current&&(g.current=p),(0,r.useEffect)((()=>{g.current.adapter=n,g.current.paramConfigMap=i,g.current.options=s}),[n,i,s]);const[h]=(0,r.useState)((()=>(e,t)=>{const{adapter:n,paramConfigMap:o,options:r}=g.current;null==t&&(t=r.updateType),function(e,{immediate:t}={}){ie.push(e);let n=t?ce:se;1===ie.length&&n((()=>{const t=ie.slice();ie.length=0;const n=t[0].currentSearchString;let o;for(let e=0;e<t.length;++e)o=ae(0===e?t[e]:{...t[e],currentSearchString:o});e.options.skipUpdateWhenNoChange&&o===n||function({searchString:e,adapter:t,navigate:n,updateType:o}){const r={...t.location,search:e};n&&("string"==typeof o&&o.startsWith("replace")?t.replace(r):t.push(r))}({searchString:null!=o?o:"",adapter:t[t.length-1].adapter,navigate:!0,updateType:t[t.length-1].updateType})}))}({changes:e,updateType:t,currentSearchString:n.location.search,paramConfigMap:o,options:r,adapter:n},{immediate:!r.enableBatching})}));return[d,h]}var de=ue;const me=(e,t,n)=>{const o=(0,r.useMemo)((()=>({[e]:null!=t?t:"inherit"})),[e,t]),[l,a]=de(o,n);return[l[e],(0,r.useCallback)(((t,n)=>a("function"==typeof t?n=>{const o=t(n[e]);return{[e]:o}}:{[e]:t},n)),[e,a])]},pe=({children:e})=>{var t;const{navigator:n}=(0,r.useContext)(k),o=T(),l=null==(t=(0,r.useContext)(S))?void 0:t.router,a=R();return e({replace(e){o(e.search||"?",{replace:!0,state:e.state})},push(e){o(e.search||"?",{replace:!1,state:e.state})},get location(){var e,t,o;return null!=(o=null!=(t=null==(e=null==l?void 0:l.state)?void 0:e.location)?t:null==n?void 0:n.location)?o:a}})};var ge=window.contentControl.data,he=window.wp.data,_e=window.wp.element,ve=n(184),Ee=n.n(ve),fe=window.wp.i18n,be=window.wp.hooks,ye=window.contentControl.icons,we=window.wp.components,Ce=window.contentControl.coreData,Se=window.contentControl.components,ke=window.wp.primitives,xe=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{fillRule:"evenodd",d:"M17.375 15.656A6.47 6.47 0 0018.5 12a6.47 6.47 0 00-.943-3.374l-1.262.813c.448.749.705 1.625.705 2.561a4.977 4.977 0 01-.887 2.844l1.262.813zm-1.951 1.87l-.813-1.261A4.976 4.976 0 0112 17c-.958 0-1.852-.27-2.613-.736l-.812 1.261A6.47 6.47 0 0012 18.5a6.47 6.47 0 003.424-.974zm-8.8-1.87A6.47 6.47 0 015.5 12c0-1.235.344-2.39.943-3.373l1.261.812A4.977 4.977 0 007 12c0 1.056.328 2.036.887 2.843l-1.262.813zm2.581-7.803A4.977 4.977 0 0112 7c1.035 0 1.996.314 2.794.853l.812-1.262A6.47 6.47 0 0012 5.5a6.47 6.47 0 00-3.607 1.092l.812 1.261zM12 20a8 8 0 100-16 8 8 0 000 16zm0-4.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7z",clipRule:"evenodd"})),Ne=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M7 13.8h6v-1.5H7v1.5zM18 16V4c0-1.1-.9-2-2-2H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2zM5.5 16V4c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5zM7 10.5h8V9H7v1.5zm0-3.3h8V5.8H7v1.4zM20.2 6v13c0 .7-.6 1.2-1.2 1.2H8v1.5h11c1.5 0 2.7-1.2 2.7-2.8V6h-1.5z"})),Pe=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),Re=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M11 14.5l1.1 1.1 3-3 .5-.5-.6-.6-3-3-1 1 1.7 1.7H5v1.5h7.7L11 14.5zM16.8 5h-7c-1.1 0-2 .9-2 2v1.5h1.5V7c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v10c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5v-1.5H7.8V17c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z"}));const{pluginUrl:Te,adminUrl:Me,wpVersion:Le}=contentControlSettingsPage,Be={showNotice:!1,ignoreNotice:!1,retryView:""};var Fe=({tabs:e})=>{const[t="restrictions",n]=me("view",V),o=(0,_e.useRef)(null),[l,a]=(0,_e.useState)(Be),{showNotice:c,ignoreNotice:s,retryView:i}=l,u=()=>a(Be),d=(0,he.useSelect)((e=>e(Ce.settingsStore).hasUnsavedChanges()),[]),{saveSettings:m}=(0,he.useDispatch)(Ce.settingsStore);return(0,_e.useEffect)((()=>{const e=e=>{d&&(e.preventDefault(),e.returnValue=!1)};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[d]),(0,_e.useEffect)((()=>(d||u(),d&&!s||!i||n(i),()=>u())),[d,s]),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"cc-settings-page__header"},(0,r.createElement)("h1",{className:"branding wp-heading-inline"},(0,r.createElement)("a",{href:"https://contentcontrolplugin.com?utm_campaign=plugin-info&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=header-logo",target:"_blank",rel:"noopener noreferrer"},(0,r.createElement)("img",{src:`${Te}assets/images/logo.svg`,alt:(0,fe.__)("Content Control","content-control")}),(0,fe.__)("Content Control","content-control"))),(0,r.createElement)(Se.ControlledTabPanel,{className:"tabs",orientation:"horizontal",selected:null!==t?t:void 0,onSelect:o=>{const r=e.find((e=>e.name===o));var c;r?.onClick&&!1===r.onClick()||(c=o,"settings"!==t||!d||s?n(c):a({...l,showNotice:!0,retryView:c}))},tabs:e}),(0,r.createElement)(we.DropdownMenu,{label:(0,fe.__)("Support","content-control"),icon:xe,toggleProps:Le>=6.2?{as:({onClick:e})=>(0,r.createElement)(we.Button,{icon:xe,variant:"link",onClick:e,className:"components-tab-panel__tabs-item support-link"},(0,r.createElement)("span",{ref:o},(0,fe.__)("Support","content-control")))}:void 0,popoverProps:{noArrow:!1,position:"bottom left",className:"cc-settings-page__support-menu",anchor:Le>=6.2?{getBoundingClientRect:()=>o?.current?.getBoundingClientRect()}:void 0}},(({onClose:e})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.MenuGroup,null,(0,r.createElement)(we.MenuItem,{icon:Ne,href:"https://contentcontrolplugin.com/docs/?utm_campaign=plugin-support&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=view-documentation-link",target:"_blank"},(0,fe.__)("View Documentation","content-control")),(0,r.createElement)(we.MenuItem,{icon:Pe,href:"https://contentcontrolplugin.com/support/?utm_campaign=plugin-support&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=get-support-link",target:"_blank"},(0,fe.__)("Get Support","content-control"))),(0,r.createElement)(we.MenuGroup,null,(0,r.createElement)(we.MenuItem,{icon:Re,onClick:()=>{window.location.href=`${Me}options-general.php?page=grant-content-control-access`,e()}},(0,fe.__)("Grant Support Access","content-control"))))))),c&&(0,r.createElement)(we.Modal,{title:(0,fe.__)("Unsaved changes","content-control"),onRequestClose:()=>u()},(0,r.createElement)("p",null,(0,fe.__)("Changes you made may not be saved.","content-control")),(0,r.createElement)(we.Flex,{justify:"right"},(0,r.createElement)(we.Button,{isDestructive:!0,onClick:()=>a({...l,showNotice:!1,ignoreNotice:!0}),text:(0,fe.__)("Ignore","content-control")}),(0,r.createElement)(we.Button,{variant:"primary",onClick:()=>m(),text:(0,fe.__)("Save Settings","content-control")}))))},De=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})),Ae=window.contentControl.ruleEngine,Oe=n.n(Ae),Ie=()=>{const{isEditorActive:e,editorId:t}=(0,he.useSelect)((e=>{const t=e(Ce.restrictionsStore);return{editorId:t.getEditorId(),isEditorActive:t.isEditorActive()}}),[]),{changeEditorId:n}=(0,he.useDispatch)(Ce.restrictionsStore),[o,r]=ue({edit:z,add:j,tab:V}),l=()=>r({add:void 0,edit:void 0,tab:void 0}),{edit:a,add:c,tab:s}=o;return(0,_e.useEffect)((()=>{let e=a&&a>0?a:void 0;c&&(e="new"),e!==t&&n(e)}),[a,c,t,n]),(0,_e.useEffect)((()=>{c||a||e||l()}),[e,c,a]),{tab:s,setTab:e=>r({tab:e}),setEditorId:e=>{r({add:"new"===e||void 0,edit:"number"==typeof e&&e>0?e:void 0}),n(e)},clearEditorParams:l}},Ue=({values:e,updateSettings:t})=>(0,r.createElement)("div",{className:"content-tab"},(0,r.createElement)("h3",null,(0,fe.__)("Apply this restriction if the user views content that is:","content-control")),(0,r.createElement)("p",null,(0,fe.__)("When users visit your site, the plugin will check the viewed content against your selection below and permit or deny access.","content-control")),(0,r.createElement)(Oe(),{value:e.settings.conditions,onChange:e=>t({conditions:e}),options:{features:{notOperand:!0,groups:!0},rulesFilter:e=>(Array.isArray(e.context)?e.context:e.context.split(" ")).indexOf("content")>=0}})),Ve=window.contentControl.utils,ze=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})),je=window.wp.compose,He=()=>{const{updateEditorValues:e}=(0,he.useDispatch)(Ce.restrictionsStore),{values:t={}}=(0,he.useSelect)((e=>({values:e(Ce.restrictionsStore).getEditorValues(),isEditorActive:e(Ce.restrictionsStore).isEditorActive()})),[]),{settings:n}=t,o=(0,_e.useCallback)((n=>{e({...t,settings:{...t?.settings,...n}})}),[e,t]),r=(e,t)=>{const o=(0,be.applyFilters)("contentControl.restrictionEditor.fieldIsVisible",void 0,e,n,t);return void 0===o||o},l=(0,_e.useMemo)((()=>(0,be.applyFilters)("contentControl.restrictionEditor.tabFields",{},n,o)),[n,o]);return{values:t,fieldIsVisible:r,getTabFields:e=>{var t;return(0,be.applyFilters)(`contentControl.restrictionEditor.tabFields.${e}`,null!==(t=l[e])&&void 0!==t?t:[]).sort(((e,t)=>e.priority-t.priority)).filter((t=>r(t.id,e))).map((t=>{const n=(0,be.applyFilters)("contentControl.restrictionEditor.renderField",t.component,t.id,e);return{...t,component:n}}))},updateSettings:o,updateField:(e,t)=>{o({[e]:t})}}},$e=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"}));const We=[{value:"redirect",label:(0,fe.__)("Redirect","content-control"),icon:ye.protectedRedirect},{value:"replace",label:(0,fe.__)("Replace Content","content-control"),icon:ye.protectedMessage}],Ge=[{value:"login",label:(0,fe.__)("Login & Back","content-control"),icon:Re},{value:"home",label:(0,fe.__)("Home Page","content-control"),icon:$e},{value:"custom",label:(0,fe.__)("Custom URL","content-control"),icon:De}],Qe=[{value:"message",label:(0,fe.__)("Custom Message","content-control")},{value:"page",label:(0,fe.__)("Use Existing Page","content-control")}],qe=[{label:(0,fe.__)("Filter the restricted items' content.","content-control"),value:"filter_post_content"},{label:(0,fe.__)("Hide the restricted items from the archive page.","content-control"),value:"hide"},{label:(0,fe.__)("Replace the entire archive page with a custom page.","content-control"),value:"replace_archive_page"},{label:(0,fe.__)("Redirect to a different page.","content-control"),value:"redirect"}],Ye=[{label:(0,fe.__)("Filter the restricted items' content.","content-control"),value:"filter_post_content"},{label:(0,fe.__)("Hide the restricted items from the list page.","content-control"),value:"hide"}],{userRoles:Ke}=contentControlSettingsPage,Je=({settings:e,updateSettings:t})=>{var n;const o=(0,je.useInstanceId)(Je);let l=[];return Array.isArray(e.userRoles)?l=e.userRoles:"object"==typeof e.userRoles&&(l=Object.entries(e.userRoles).map((([e])=>e))),(0,r.createElement)(Se.FieldPanel,{title:(0,fe.__)("User Status","content-control")},(0,r.createElement)(Se.RadioButtonControl,{label:(0,fe.__)("Who can see this content?","content-control"),value:e.userStatus,onChange:e=>t({userStatus:e}),options:(0,be.applyFilters)("contentControl.restrictionEditor.userStatusOptions",[{value:"logged_in",label:(0,fe.__)("Logged In Users","content-control"),icon:ye.lockedUser},{value:"logged_out",label:(0,fe.__)("Logged Out Users","content-control"),icon:ye.incognito}]),className:"userStatus-field"}),"logged_in"===e.userStatus&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("br",null),(0,r.createElement)("hr",null),(0,r.createElement)(Se.FieldRow,{id:`content-control-role-match-${o}`,label:(0,fe.__)("User Role","content-control"),description:(0,fe.__)("Which user roles should be allowed to see this content.","content-control"),className:"components-base-control__label"},(0,r.createElement)(we.SelectControl,{id:`content-control-role-match-${o}`,label:(0,fe.__)("User Role","content-control"),value:null!==(n=e.roleMatch)&&void 0!==n?n:"any",options:[{label:(0,fe.__)("Any","content-control"),value:"any"},{label:(0,fe.__)("Matching","content-control"),value:"match"},{label:(0,fe.__)("Excluding","content-control"),value:"exclude"}],onChange:e=>t({roleMatch:e}),className:"is-large roleMatch-field",hideLabelFromVision:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),"any"!==e.roleMatch&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("hr",null),(0,r.createElement)("br",null),(0,r.createElement)(Se.SearchableMulticheckControl,{label:"exclude"===e.roleMatch?(0,fe.__)("Roles to exclude","content-control"):(0,fe.__)("Roles to include","content-control"),searchIcon:ze,placeholder:(0,fe.__)("Search roles…","content-control"),className:"is-large userRoles-field",value:l,onChange:e=>t({userRoles:e}),options:Object.entries(Ke).map((([e,t])=>({value:e,label:t})))}))))};(0,be.addFilter)("contentControl.restrictionEditor.tabFields","content-control",((e,t,n)=>{const o={settings:t,updateSettings:n};return{...e,general:[{id:"userStatus",priority:3,component:(0,r.createElement)(Je,{...o})}]}}));var Ze=({values:e,updateValues:t})=>{const{getTabFields:n}=He(),o=e.description.length/80,l=(0,Ve.clamp)(o,1,5);return(0,r.createElement)("div",{className:"general-tab"},(0,r.createElement)(we.TextControl,{label:(0,fe.__)("Restriction label","content-control"),hideLabelFromVision:!0,placeholder:(0,fe.__)("Name…","content-control"),className:"title-field",value:e.title,onChange:e=>t({title:e})}),(0,r.createElement)(we.TextareaControl,{rows:l,scrolling:l>5?"auto":"no",label:(0,fe.__)("Restriction description","content-control"),hideLabelFromVision:!0,placeholder:(0,fe.__)("Add description…","content-control"),className:"description-field",value:e.description,onChange:e=>t({description:e})}),e.title.length<=0&&(0,r.createElement)(we.Notice,{status:"warning",isDismissible:!1,className:"title-field-notice"},(0,fe.__)("Enter a label for this set.","content-control")),n("general").map((e=>(0,r.createElement)("div",{key:e.id},e.component))))};const{isProActivated:Xe=!1}=contentControlSettingsPage;(0,be.addFilter)("contentControl.restrictionEditor.tabFields","content-control",((e,t,n)=>{var o;const l=t.customMessage?.length/80,a=(0,Ve.clamp)(l,4,20);return{...e,protection:[{id:"protectionMethod",priority:1,component:(0,r.createElement)(Se.RadioButtonControl,{label:(0,fe.__)("How do you want to protect your content?","content-control"),value:t.protectionMethod,onChange:e=>n({protectionMethod:e}),options:(0,be.applyFilters)("contentControl.restrictionEditor.protectionMethodOptions",We)})},{id:"redirectType",priority:2,component:(0,r.createElement)(Se.RadioButtonControl,{label:(0,fe.__)("Where will the user be taken?","content-control"),value:t.redirectType,onChange:e=>n({redirectType:e}),options:Ge})},{id:"redirectUrl",priority:3,component:(0,r.createElement)(Se.URLControl,{label:(0,fe.__)("Custom Redirect URL","content-control"),className:"is-large",value:t.redirectUrl,onChange:({url:e})=>{n({redirectUrl:e})}})},{id:"replacementType",priority:4,component:(0,r.createElement)(Se.RadioButtonControl,{label:(0,fe.__)("Replacement Type","content-control"),value:t.replacementType,options:Qe,onChange:e=>n({replacementType:e})})},{id:"replacementPage",priority:5,component:(0,r.createElement)(Se.EntitySelectControl,{label:(0,fe.__)("Choose a page to replace the content with.","content-control"),placeholder:(0,fe.__)("Choose a page to replace the content with.","content-control"),value:t.replacementPage,multiple:!1,onChange:e=>n({replacementPage:e}),entityKind:"postType",entityType:"page",closeOnSelect:!0})},{id:"showExcerpts",priority:6,component:(0,r.createElement)(we.CheckboxControl,{label:(0,fe.__)("Show excerpts above access denied message?","content-control"),checked:t.showExcerpts,onChange:e=>n({showExcerpts:e})})},{id:"overrideMessage",priority:7,component:(0,r.createElement)(we.CheckboxControl,{label:(0,fe.__)("Override the default message?","content-control"),checked:t.overrideMessage,onChange:e=>n({overrideMessage:e}),help:(0,fe.__)("Edit the default message via the plugin's Settings page.","content-control")})},{id:"customMessage",priority:8,component:(0,r.createElement)(we.TextareaControl,{label:(0,fe.__)("Enter a custom message to display to restricted users","content-control"),rows:a,value:t.customMessage,onChange:e=>n({customMessage:e})})},{id:"showInSearch",priority:9,component:(0,r.createElement)(et,{settings:t,updateSettings:n})},{id:"archiveHandling",priority:10,component:(0,r.createElement)(we.RadioControl,{label:(0,fe.__)("Handling matches within archives","content-control"),help:(0,fe.__)("Choose how to handle matched content found within archive pages. This option applies to restricted content within the archive page, not the archive page itself.","content-control"),selected:t.archiveHandling,options:qe,onChange:e=>n({archiveHandling:e})})},{id:"archiveReplacementPage",priority:11,component:(0,r.createElement)(Se.EntitySelectControl,{label:(0,fe.__)("Choose a page to replace the archive with","content-control"),placeholder:(0,fe.__)("Choose a page to replace the archive with","content-control"),value:t.archiveReplacementPage,multiple:!1,onChange:e=>n({archiveReplacementPage:e}),entityKind:"postType",entityType:"page",closeOnSelect:!0})},{id:"archiveRedirectType",priority:12,component:(0,r.createElement)(Se.RadioButtonControl,{label:(0,fe.__)("Where will the user be taken?","content-control"),value:t.archiveRedirectType,onChange:e=>n({archiveRedirectType:e}),options:Ge})},{id:"archiveRedirectUrl",priority:13,component:(0,r.createElement)(Se.URLControl,{label:(0,fe.__)("Custom Redirect URL","content-control"),className:"is-large",value:t.archiveRedirectUrl,onChange:({url:e})=>{n({archiveRedirectUrl:e})}})},{id:"additionalQueryHandling",priority:14,component:(0,r.createElement)(we.RadioControl,{label:(0,fe.__)("Handling matches everywhere else","content-control"),help:(0,fe.__)("Choose how to handle matched content in all other areas outside the main content. This option applies to restricted content found in non-main queries, sidebars, widgets, footers, or within the page content itself.","content-control"),selected:t.additionalQueryHandling,options:Ye,onChange:e=>n({additionalQueryHandling:e})})},{id:"restApiQueryHandling",priority:15,component:(0,r.createElement)(we.BaseControl,{label:(0,fe.__)("Handling matches in REST API requests","content-control"),id:"restApiQueryHandling"},(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,fe.__)('By default restricted posts in a REST API list will follow "everywhere else" rules set above, single posts & taxonomies will show restricted access notices.',"content-control"))),!Xe&&(0,r.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,fe.sprintf)(
// translators: 1: Content Control Pro, 2: </a>
(0,fe.__)("If you need more control over your REST API, try %1$sContent Control Pro%2$s:"),'<a href="https://contentcontrolplugin.com/features/rest-api/" target="_blank">',"</a>")}}))},...null!==(o=e.protection)&&void 0!==o?o:[]]}})),(0,be.addFilter)("contentControl.restrictionEditor.fieldIsVisible","content-control",((e,t,n)=>{switch(t){case"redirectType":return"redirect"===n.protectionMethod;case"redirectUrl":return"redirect"===n.protectionMethod&&"custom"===n.redirectType;case"replacementType":return"replace"===n.protectionMethod;case"replacementPage":return"replace"===n.protectionMethod&&"page"===n.replacementType;case"showExcerpts":case"showInSearch":case"overrideMessage":return"replace"===n.protectionMethod&&"message"===n.replacementType;case"customMessage":return"replace"===n.protectionMethod&&"message"===n.replacementType&&n.overrideMessage;case"archiveReplacementPage":return"replace_archive_page"===n.archiveHandling;case"archiveRedirectType":return"redirect"===n.archiveHandling;case"archiveRedirectUrl":return"redirect"===n.archiveHandling&&"custom"===n.archiveRedirectType;default:return e}}));const et=({settings:e,updateSettings:t})=>{const[n,o]=(0,r.useState)(!1);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.CheckboxControl,{label:(0,fe.__)("Show in search results?","content-control"),help:(0,fe.__)("When enabled, restricted items will appear in search results but with a restricted access message. Disable to completely hide from search.","content-control"),checked:e.showInSearch,onChange:e=>t({showInSearch:e})}),e.showInSearch&&(0,r.createElement)("div",{className:"cc-warning-icon",style:{marginTop:"-20px",marginBottom:"32px",color:"#757575",cursor:"help"},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1)},(0,r.createElement)("span",null,"⚠️"," ",(0,fe.__)("Warning: Enabling this option may expose restricted content","content-control")),n&&(0,r.createElement)(we.Popover,{offset:10,position:"bottom right",focusOnMount:!1,noArrow:!1,animate:!1},(0,r.createElement)("div",{className:"cc-warning-popover",style:{padding:"16px",maxWidth:"450px",minWidth:"450px"}},(0,r.createElement)("h4",{style:{marginTop:0}},"Security Consideration"),(0,r.createElement)("p",null,"Only enable this if you fully understand the risks or have properly mitigated them."),(0,r.createElement)("p",null,"WordPress search can reveal parts of your protected content through simple trial and error searching."),(0,r.createElement)("p",null,'For example: If your protected post contains "Annual Revenue: $500,000", someone could discover this by searching for "An", then "Ann", then "Annu", and so on. Each successful search confirms more of the content, even if they cannot access the full post.'),(0,r.createElement)("p",null,"With simple scripts a bot can discover restricted content in seconds if there is no brute force protection in place such as rate limiting."),(0,r.createElement)("p",null,"The issue can be mitigated, but not fully eliminated with rate limiting and/or blocking IPs with an active firewall."),(0,r.createElement)("p",{style:{margin:"0"}},"Learn more in"," ",(0,r.createElement)("a",{href:"https://contentcontrolplugin.com/docs/security/preventing-bots-from-discovering-restricted-content/?utm_source=plugin&utm_medium=settings-page&utm_campaign=show-in-search-warning",target:"_blank",rel:"noreferrer"},"our documentation"))))))};var tt=e=>{const{getTabFields:t}=He();return(0,r.createElement)("div",{className:"protection-tab"},(0,r.createElement)("h3",null,(0,fe.__)("Protecting Content","content-control")),(0,r.createElement)("p",null,(0,fe.__)("When a user does not have access, the following options help control their experience.","content-control")),t("protection").map((e=>(0,r.createElement)("div",{key:e.id},e.component))))};const nt=()=>{};var ot=({onSave:e=nt,onClose:t=nt})=>{const{tab:n,setTab:o,clearEditorParams:l}=Ie(),[a,c]=(0,_e.useState)(!1),[s,i]=(0,_e.useState)(null),{editorId:u,isEditorActive:d,values:m,isSaving:p,dispatchStatus:g,dispatchErrors:h}=(0,he.useSelect)((e=>({editorId:e(Ce.restrictionsStore).getEditorId(),values:e(Ce.restrictionsStore).getEditorValues(),isEditorActive:e(Ce.restrictionsStore).isEditorActive(),isSaving:e(Ce.restrictionsStore).isDispatching(["createRestriction","updateRestriction"]),dispatchStatus:{create:e(Ce.restrictionsStore).getDispatchStatus("createRestriction"),update:e(Ce.restrictionsStore).getDispatchStatus("updateRestriction")},dispatchErrors:{create:e(Ce.restrictionsStore).getDispatchError("createRestriction"),update:e(Ce.restrictionsStore).getDispatchError("updateRestriction")}})),[]),{updateEditorValues:_,createRestriction:v,updateRestriction:E,clearEditorData:f}=(0,he.useDispatch)(Ce.restrictionsStore);if((0,_e.useEffect)((()=>l),[]),(0,_e.useEffect)((()=>{var e;if(!a)return;if(Ce.Status.Success===g.create||Ce.Status.Success===g.update)return void b();const t=null!==(e=h.create)&&void 0!==e?e:h.update;void 0!==t&&i(t)}),[g,h]),!d)return null;if(!u)return(0,r.createElement)(r.Fragment,null,(0,fe.__)("Editor requires a valid id","content-control"));if(!m)return(0,r.createElement)(r.Fragment,null,(0,fe.__)("Editor requires a valid restriction.","content-control"));const b=()=>{f(),t()},y={values:m,updateValues:_,updateSettings:e=>{_({...m,settings:{...m?.settings,...e}})},onSave:e,onClose:t},w=(0,be.applyFilters)("contentControl.restrictionEditor.tabs",[{name:"general",title:(0,fe.__)("General","content-control"),comp:()=>(0,r.createElement)(Ze,{...y})},{name:"protection",title:(0,fe.__)("Protection","content-control"),comp:()=>(0,r.createElement)(tt,{...y})},{name:"content",title:(0,fe.__)("Content","content-control"),comp:()=>(0,r.createElement)(Ue,{...y})}],y);if("object"==typeof s&&s?.tabName?.length){const e=w.find((e=>e.name===s.tabName));e&&(w[w.indexOf(e)].className=w[w.indexOf(e)].className?w[w.indexOf(e)].className+" error":"error")}const C=(0,fe.sprintf)(
// translators: 1. Id of set to edit.
(0,fe.__)("Restriction Editor%s","content-control"),"new"===u?": "+(0,fe.__)("New Restriction","content-control"):`: #${m.id} - ${m.title}`);return(0,r.createElement)(we.Modal,{title:C,className:"restriction-editor",onRequestClose:()=>b(),shouldCloseOnClickOutside:!1},(0,r.createElement)("div",{className:Ee()(["restriction-enabled-toggle","publish"===m.status?"enabled":"disabled"])},(0,r.createElement)(we.ToggleControl,{label:"publish"===m.status?(0,fe.__)("Enabled","content-control"):(0,fe.__)("Disabled","content-control"),checked:"publish"===m.status,onChange:e=>_({...m,status:e?"publish":"draft"})})),s&&(0,r.createElement)(we.Notice,{status:"error",className:"restriction-editor-error",onDismiss:()=>{i(null)}},"string"==typeof s?s:s.message),(0,r.createElement)(we.TabPanel,{orientation:"vertical",initialTabName:null!=n?n:"general",onSelect:o,tabs:w,className:"editor-tabs"},(({title:e,comp:t})=>void 0===t?e:t())),(0,r.createElement)("div",{className:"modal-actions"},(0,r.createElement)(we.Button,{text:(0,fe.__)("Cancel","content-control"),variant:"tertiary",isDestructive:!0,onClick:()=>b(),disabled:p,className:"cancel-button"}),(0,r.createElement)(we.Button,{variant:"primary",disabled:p,onClick:()=>{const t=(0,Ce.validateRestriction)(m);!0===t?function(){if(!u||!m)return;const t="new"!==u&&u>0,n={...m,settings:{...m.settings,conditions:(0,Ae.removeEmptyItems)(m.settings.conditions)}};t?E(n):v(n),c(!0),i(null),e(n)}():"object"==typeof t&&i(t)}},p&&(0,r.createElement)(we.Spinner,null),"new"===u?(0,fe.__)("Add Restriction","content-control"):(0,fe.__)("Save Restriction","content-control")),(0,r.createElement)(we.Button,{text:(0,fe.__)("Documentation","content-control"),href:"https://contentcontrolplugin.com/docs/?utm_campaign=documentation&utm_source=restriction-editor&utm_medium=plugin-ui&utm_content=footer-documentation-link",target:"_blank",icon:De,iconSize:20})))},rt=()=>{const{setEditorId:e}=Ie(),{restrictions:t,isLoading:n}=(0,he.useSelect)((e=>{const t=e(Ce.restrictionsStore);return{restrictions:t.getRestrictions(),isLoading:t.isResolving("getRestrictions")}}),[]),o=t.length;return(0,r.createElement)("header",{className:"cc-settings-view__header"},(0,r.createElement)("h1",{className:"view-title wp-heading-inline"},(0,fe.__)("Restrictions","content-control")),(0,r.createElement)("span",{className:"item-count"},n?(0,r.createElement)(we.Spinner,null):(0,fe.sprintf)(/* translators: 1. Number of items */
(0,fe._n)("%d item","%d items",o,"content-control"),o)),(0,r.createElement)(we.Button,{className:"add-restriction",onClick:()=>e("new"),variant:"primary"},(0,fe.__)("Add Restriction","content-control")))},lt=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),at=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z"})),ct=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})),st=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"}));const it=()=>{},ut={restrictions:[],filteredRestrictions:[],bulkSelection:[],setBulkSelection:it,updateRestriction:it,deleteRestriction:it,increasePriority:it,decreasePriority:it,swapPriority:it,updatePrioritySortOrder:it,isLoading:!1,isDeleting:!1,filters:{roles:"",status:"all",searchText:"",restrictedTo:""},setFilters:it},dt=(0,_e.createContext)(ut),{Provider:mt,Consumer:pt}=dt,gt=({value:e={},children:t})=>{const[n,o]=(0,_e.useState)([]),[l,a]=ue({roles:I(V,""),status:I(V,"all"),searchText:I(V,""),restrictedTo:I(V,"")}),c=()=>a({status:void 0,searchText:void 0});(0,_e.useEffect)((()=>c),[]);const{restrictions:s,isLoading:i,isDeleting:u}=(0,he.useSelect)((e=>{const t=e(Ce.restrictionsStore);return{restrictions:t.getRestrictions(),isLoading:t.isResolving("getRestrictions"),isDeleting:t.isDispatching("deleteRestriction")}}),[]),{updateRestriction:d,deleteRestriction:m}=(0,he.useDispatch)(Ce.restrictionsStore),p=(0,_e.useMemo)((()=>{var e;const t=""===l?.roles?[]:null!==(e=l?.roles?.trim().split(","))&&void 0!==e?e:[];return s.filter((e=>!t.length||t.some((t=>e.settings.userRoles?.includes(t))))).filter((e=>""===l.restrictedTo||e.settings.userStatus===l.restrictedTo)).filter((e=>"all"===l.status||l.status===e.status)).filter((e=>!l.searchText||!l.searchText.length||e.title.toLowerCase().indexOf(l.searchText.toLowerCase())>=0||e.description.toLowerCase().indexOf(l.searchText.toLowerCase())>=0))}),[s,l]),g=(e,t)=>{const n=[...p],o=n[e],r=n[t];o&&r&&(n[e]=r,n[t]=o,h(n))},h=e=>{let t=!1;const n=(e||p).map(((e,n)=>e.priority!==n?(t=!0,{...e,priority:n}):e));t&&n.forEach((e=>d(e)))};return(0,r.createElement)(mt,{value:{...e,filters:l,setFilters:a,bulkSelection:n,setBulkSelection:o,restrictions:s,filteredRestrictions:p,updateRestriction:d,deleteRestriction:m,increasePriority:e=>{g(e,e-1)},decreasePriority:e=>{g(e,e+1)},swapPriority:g,updatePrioritySortOrder:h,isLoading:i,isDeleting:u}},t)},ht=()=>(0,_e.useContext)(dt);var _t=(0,r.createElement)(ke.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(ke.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),vt=(0,r.createElement)(ke.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(ke.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),Et=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})),ft=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})),bt=(0,r.createElement)(ke.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(ke.Path,{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM15.5303 8.46967C15.8232 8.76256 15.8232 9.23744 15.5303 9.53033L13.0607 12L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L12 13.0607L9.53033 15.5303C9.23744 15.8232 8.76256 15.8232 8.46967 15.5303C8.17678 15.2374 8.17678 14.7626 8.46967 14.4697L10.9393 12L8.46967 9.53033C8.17678 9.23744 8.17678 8.76256 8.46967 8.46967C8.76256 8.17678 9.23744 8.17678 9.53033 8.46967L12 10.9393L14.4697 8.46967C14.7626 8.17678 15.2374 8.17678 15.5303 8.46967Z"}));const yt=e=>{const{id:t,slug:n,status:o,title:r,description:l,settings:a}=e;return{id:t,slug:n,status:o,title:r,description:l,settings:a}},{version:wt}=contentControlSettingsPage;var Ct=()=>{const e=(0,he.useRegistry)(),{bulkSelection:t=[],setBulkSelection:n,restrictions:o=[],deleteRestriction:l,updateRestriction:a}=ht(),{getRestriction:c}=(0,he.useSelect)((e=>({getRestriction:e(Ce.restrictionsStore).getRestriction})),[]),{addNotice:s}=(0,he.useDispatch)(Ce.restrictionsStore),[i,u]=(0,_e.useState)(),d=(0,_e.useRef)();return 0===t.length?null:(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Se.ConfirmDialogue,{...i,onClose:()=>u(void 0)}),(0,r.createElement)(we.Dropdown,{className:"list-table-bulk-actions",contentClassName:"list-table-bulk-actions__popover",placement:"bottom left",focusOnMount:"firstElement",popoverProps:{noArrow:!1,anchor:{getBoundingClientRect:()=>d?.current?.getBoundingClientRect()}},renderToggle:({isOpen:e,onToggle:n})=>(0,r.createElement)(we.Flex,null,(0,r.createElement)("span",{className:"selected-items"},(0,fe.sprintf)(
// translators: 1. number of items.
(0,fe._n)("%d item selected","%d items selected",t.length,"content-control"),t.length)),(0,r.createElement)(we.Button,{className:"popover-toggle",ref:e=>{d.current=e},"aria-label":(0,fe.__)("Bulk Actions","content-control"),variant:"secondary",onClick:n,"aria-expanded":e,icon:ye.checkAll,iconSize:20},(0,fe.__)("Bulk Actions","content-control"),(0,r.createElement)(we.Icon,{className:"toggle-icon",icon:e?_t:vt}))),renderContent:()=>(0,r.createElement)(we.NavigableMenu,{orientation:"vertical"},(0,r.createElement)(we.Button,{text:(0,fe.__)("Export Selected","content-control"),icon:Et,onClick:()=>{const e={version:wt,restrictions:o.filter((({id:e})=>t.indexOf(e)>=0)).map(yt)};(0,Ve.saveFile)(JSON.stringify(e),"content-control-restrictions.json","text/json")}}),(0,r.createElement)("hr",null),(0,r.createElement)(we.Button,{text:(0,fe.__)("Enable","content-control"),icon:De,onClick:()=>{e.batch((()=>{const e=t.length;t.forEach((e=>{const t=c(e);t?.id===e&&a({...t,status:"publish"})})),n([]),s({id:"bulk-enable",type:"success",message:(0,fe.sprintf)(
// translators: 1. number of items
(0,fe._n)("%d restriction enabled.","%d restrictions enabled.",e,"content-control"),e),closeDelay:3e3})}))}}),(0,r.createElement)(we.Button,{text:(0,fe.__)("Disable","content-control"),icon:ft,onClick:()=>{e.batch((()=>{const e=t.length;t.forEach((e=>{const t=c(e);t?.id===e&&a({...t,status:"draft"})})),n([]),s({id:"bulk-disable",type:"success",message:(0,fe.sprintf)(
// translators: 1. number of items
(0,fe._n)("%d restriction disabled.","%d restrictions disabled.",e),e),closeDelay:3e3})}))}}),(0,r.createElement)("hr",null),(0,r.createElement)(we.Button,{text:(0,fe.__)("Trash","content-control"),icon:at,onClick:()=>{u({isDestructive:!0,message:(0,fe.sprintf)(
// translators: 1. number of items
(0,fe.__)("Are you sure you want to trash %d items?","content-control"),t.length),callback:()=>{e.batch((()=>{const e=t.length;t.forEach((e=>l(e))),n([]),s({id:"bulk-trash",type:"success",message:(0,fe.sprintf)(
// translators: 1. number of items
(0,fe._n)("%d restriction moved to trash.","%d restrictions moved to trash.",e),e),closeDelay:3e3})}))}})}}),(0,r.createElement)(we.Button,{text:(0,fe.__)("Delete Permanently","content-control"),icon:bt,isDestructive:!0,onClick:()=>{u({isDestructive:!0,message:(0,fe.sprintf)(
// translators: 1. restriction label.
(0,fe.__)("Are you sure you want to premanently delete %d items?","content-control"),t.length),callback:()=>{e.batch((()=>{const e=t.length;t.forEach((e=>l(e,!0))),n([]),s({id:"bulk-delete",type:"success",message:(0,fe.sprintf)(
// translators: 1. number of items
(0,fe._n)("%d restriction deleted.","%d restrictions deleted.",e),e),closeDelay:3e3})}))}})}}))}))},St=window.contentControl.fields;const{userRoles:kt}=contentControlSettingsPage,xt={all:(0,fe.__)("All","content-control"),publish:(0,fe.__)("Enabled","content-control"),draft:(0,fe.__)("Disabled","content-control"),pending:(0,fe.__)("Pending","content-control"),trash:(0,fe.__)("Trash","content-control")};var Nt=()=>{var e,t,n,o,l;const{filters:a={},setFilters:c,bulkSelection:s=[],restrictions:i=[],filteredRestrictions:u=[]}=ht(),[d,m]=(0,_e.useState)(""),p=(0,_e.useRef)({}),g=(0,_e.useMemo)((()=>i.reduce(((e,t)=>{var n;return e[t.status]=(null!==(n=e[t.status])&&void 0!==n?n:0)+1,e.all++,e}),{all:0})),[i]),h=(0,_e.useMemo)((()=>u.reduce(((e,t)=>{var n;return e[t.status]=(null!==(n=e[t.status])&&void 0!==n?n:0)+1,e.all++,e}),{all:0})),[u]);if(s.length>0)return null;const _=({name:e,label:t,currentSelection:n,children:o})=>{const l=d===e;return(0,r.createElement)("div",{className:Ee()([`list-table-filter list-table-filter--${e}`,l?"is-active":""])},(0,r.createElement)(we.Button,{className:"filter-button",onClick:()=>m(l?"":e),ref:t=>{p.current[e]=t}},(0,r.createElement)("span",{className:"filter-label"},t,":")," ",(0,r.createElement)("span",{className:"filter-selection"},n),(0,r.createElement)(we.Icon,{className:"filter-icon",icon:l?_t:vt})),l&&(0,r.createElement)(we.Popover,{className:"list-table-filters__popover",anchor:{getBoundingClientRect:()=>p.current[e].getBoundingClientRect()},onClose:()=>m(""),position:"bottom right",onFocusOutside:()=>m("")},o))},v=""===a?.roles?[]:null!==(e=a?.roles?.trim().split(","))&&void 0!==e?e:[],E=[{label:(0,fe.__)("All","content-control"),value:""},{label:(0,fe.__)("Logged In","content-control"),value:"logged_in"},{label:(0,fe.__)("Logged Out","content-control"),value:"logged_out"}];return(0,r.createElement)("div",{className:"list-table-filters"},(0,r.createElement)(_,{name:"role",label:(0,fe.__)("Role","content-control"),currentSelection:(()=>{switch(v.length){case 0:return(0,fe.__)("All","content-control");case 1:return kt[v[0]];case 2:return v.map((e=>{var t;return null!==(t=kt[e])&&void 0!==t?t:""})).join(", ");default:return v.slice(0,1).map((e=>{var t;return null!==(t=kt[e])&&void 0!==t?t:""})).join(", ")+` +${v.length-1} more`}})()},(0,r.createElement)(St.MulticheckField,{label:(0,fe.__)("Role","content-control"),value:v,options:Object.entries(kt).map((([e,t])=>({value:e,label:t}))),onChange:e=>{c({roles:e.join(",")}),m("")},type:"multicheck",id:""})),(0,r.createElement)(_,{name:"who",label:(0,fe.__)("Restricted To","content-control"),currentSelection:null!==(t=E.find((e=>e.value===a?.restrictedTo))?.label)&&void 0!==t?t:""},(0,r.createElement)(we.RadioControl,{label:(0,fe.__)("Restricted To","content-control"),selected:null!==(n=a?.restrictedTo)&&void 0!==n?n:"",options:E,onChange:e=>{c({restrictedTo:e}),m("")}})),(0,r.createElement)(_,{name:"status",label:(0,fe.__)("Status","content-control"),currentSelection:xt[null!==(o=a?.status)&&void 0!==o?o:""]},(0,r.createElement)(we.RadioControl,{label:(0,fe.__)("Status","content-control"),hideLabelFromVision:!0,selected:null!==(l=a?.status)&&void 0!==l?l:"",options:Object.entries(xt).filter((([e])=>{var t,n;return g[null!==(t=a?.status)&&void 0!==t?t:""]>0?(n=e,h?.[n]>0):g[e]>0})).map((([e,t])=>{var n;return{label:`${t} (${null!==(n=h[e])&&void 0!==n?n:0})`,value:e}})),onChange:e=>{c({status:e}),m("")}})))},Pt=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})),Rt=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})),Tt=()=>{const{createRestriction:e,addNotice:t}=(0,he.useDispatch)(Ce.restrictionsStore),{getNextPriority:n}=(0,he.useSelect)((e=>({getNextPriority:e(Ce.restrictionsStore).getNextPriority})),[]),o=o=>{const r=JSON.parse(o);if(!r?.restrictions?.length)return;let l=0,a=n();if(r.restrictions.forEach((t=>{try{e({...t,status:"draft",priority:a})}catch(e){l++}a++})),l&&t({id:"content-control-import-error",type:"error",message:(0,fe.sprintf)(
// translators: %d is the number of restrictions that failed to import.
(0,fe._n)("%d Restriction failed to import.","%d Restrictions failed to import.",l,"content-control"),l),isDismissible:!0}),l===r?.restrictions?.length)return;const c=r?.restrictions?.length-l;t({id:"content-control-import-success",type:"success",message:(0,fe.sprintf)(
// translators: %d is the number of restrictions imported.
(0,fe._n)("%d Restriction imported successfully.","%d Restrictions imported successfully.",c,"content-control"),c),isDismissible:!0,closeDelay:5e3})};return(0,r.createElement)(we.Dropdown,{className:"list-table-options-menu",contentClassName:"list-table-options-menu__popover",placement:"bottom left",focusOnMount:"firstElement",popoverProps:{noArrow:!1},renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(we.Button,{className:"popover-toggle","aria-label":(0,fe.__)("Additional options","content-control"),onClick:t,"aria-expanded":e,icon:Pt}),renderContent:({onClose:e})=>(0,r.createElement)(we.NavigableMenu,{orientation:"vertical"},(0,r.createElement)(we.FormFileUpload,{icon:Rt,text:(0,fe.__)("Import","content-control"),accept:"text/json",onChange:t=>{var n;const r=null!==(n=t.currentTarget.files?.length)&&void 0!==n?n:0;for(let e=0;e<r;e++)t.currentTarget.files?.[e].text().then(o);e()}}))})},Mt=()=>{const{setEditorId:e}=Ie(),[t,n]=(0,_e.useState)(!1),[o,l]=(0,_e.useState)(),a=()=>l(void 0);return(0,r.createElement)(gt,null,(0,r.createElement)(pt,null,(({isLoading:c,isDeleting:s,bulkSelection:i=[],setBulkSelection:u=Ve.noop,filteredRestrictions:d=[],updateRestriction:m=Ve.noop,deleteRestriction:p=Ve.noop,increasePriority:g=Ve.noop,decreasePriority:h=Ve.noop,filters:{searchText:_=""},setFilters:v})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Se.ConfirmDialogue,{...o,onClose:a}),(0,r.createElement)("div",{className:"list-table-container"},c&&(0,r.createElement)("div",{className:"is-loading"},(0,r.createElement)(we.Spinner,null)),(0,r.createElement)("div",{className:"list-table-header"},(0,r.createElement)("div",{className:"list-search"},(0,r.createElement)(we.Icon,{icon:ze}),(0,r.createElement)(we.TextControl,{placeholder:(0,fe.__)("Search Restrictions…","content-control"),value:null!=_?_:"",onChange:e=>v({searchText:""!==e?e:void 0})})),(0,r.createElement)(Ct,null),0===i.length&&(0,r.createElement)(we.Button,{className:"filters-toggle",variant:"secondary",onClick:()=>{n(!t)},"aria-expanded":t,icon:ye.filterLines,iconSize:20,text:t?(0,fe.__)("Hide Filters","content-control"):(0,fe.__)("Filters","content-control")}),(0,r.createElement)(Tt,null)),t&&(0,r.createElement)(Nt,null),(0,r.createElement)(Se.ListTable,{selectedItems:i,onSelectItems:e=>u(e),items:c?[]:d,columns:{enabled:()=>(0,r.createElement)(we.Tooltip,{text:(0,fe.__)("Enable or disable the restriction","content-control"),position:"top right"},(0,r.createElement)("span",null,(0,r.createElement)(we.Icon,{icon:lt}))),title:(0,fe.__)("Name","content-control"),description:(0,fe.__)("Description","content-control"),restrictedTo:(0,fe.__)("Restricted to","content-control"),status:(0,fe.__)("Status","content-control"),roles:(0,fe.__)("Roles","content-control"),priority:(0,fe.__)("Priority","content-control")},sortableColumns:["priority","title"],rowClasses:e=>[`restriction-${e.id}`,`status-${e.status}`],renderCell:(t,n)=>{var o,a,c;const i=n.status,u="trash"===i,_="publish"===i;switch(t){case"enabled":return(0,r.createElement)(we.ToggleControl,{label:"","aria-label":(0,fe.__)("Enable or disable the restriction","content-control"),checked:_,disabled:u,onChange:e=>{m({...n,status:e?"publish":"draft"})}});case"status":return u?(0,r.createElement)(we.Icon,{"aria-label":(0,fe.__)("In Trash","content-control"),icon:at,size:20}):(0,r.createElement)("span",null,_?(0,fe.__)("Enabled","content-control"):(0,fe.__)("Disabled","content-control"));case"title":return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.Button,{variant:"link",onClick:()=>e(n.id)},n.title),(0,r.createElement)("div",{className:"item-actions"},`${(0,fe.__)("ID","content-control")}: ${n.id}`,(0,r.createElement)(we.Button,{text:(0,fe.__)("Edit","content-control"),variant:"link",onClick:()=>e(n.id)}),(0,r.createElement)(we.Button,{text:u?(0,fe.__)("Untrash","content-control"):(0,fe.__)("Trash","content-control"),variant:"link",isDestructive:!0,isBusy:!!s,onClick:()=>u?m({...n,status:"draft"}):p(n.id)}),u&&(0,r.createElement)(we.Button,{text:(0,fe.__)("Delete Permanently","content-control"),variant:"link",isDestructive:!0,isBusy:!!s,onClick:()=>l({message:(0,fe.__)("Are you sure you want to premanently delete this restriction?"),callback:()=>{p(n.id,!0)},isDestructive:!0})})));case"restrictedTo":return"logged_in"===n.settings.userStatus?(0,r.createElement)(we.Flex,null,(0,r.createElement)(we.Icon,{icon:ye.lockedUser,size:20}),(0,r.createElement)("span",null,(0,fe.__)("Logged in users","content-control"))):(0,r.createElement)(we.Flex,null,(0,r.createElement)(we.Icon,{icon:ye.incognito,size:20}),(0,r.createElement)("span",null,(0,fe.__)("Logged out users","content-control")));case"roles":{const{userRoles:e,userStatus:t,roleMatch:o="any"}=n.settings;return"logged_out"===t||"any"===o||0===e.length?(0,r.createElement)(we.Flex,null,(0,r.createElement)("span",null,(0,fe.__)("Everyone","content-control"))):(0,r.createElement)(we.Flex,null,"exclude"===o&&(0,fe._n)("Exclude:","Excludes:",e.length,"content-control"),e.slice(0,2).map((e=>(0,r.createElement)("span",{key:e},e))),e.length>2&&(0,r.createElement)("span",{className:"remaining"},"+"+(e.length-2)))}case"priority":return(0,r.createElement)(we.Flex,{gap:0},(0,r.createElement)("strong",null,(null!==(o=n.priority)&&void 0!==o?o:0)+1),(0,r.createElement)(we.Button,{className:"priority-up",variant:"link",disabled:0===n.priority,iconSize:18,icon:ct,onClick:()=>{g(n.priority)}}),(0,r.createElement)(we.Button,{className:"priority-down",variant:"link",disabled:d.length-1===n.priority,iconSize:18,icon:st,onClick:()=>{h(n.priority)}}));default:return null!==(a=null!==(c=n[t])&&void 0!==c?c:n.settings[t])&&void 0!==a?a:""}}}))))))},Lt=()=>{const e=(0,_e.useRef)({}),{notices:t}=(0,he.useSelect)((e=>({notices:e(Ce.restrictionsStore).getNotices()})),[]),{clearNotice:n}=(0,he.useDispatch)(Ce.restrictionsStore),o=(0,_e.useCallback)((t=>{e.current[t]&&(clearTimeout(e.current[t]),delete e.current[t]),n(t)}),[n]);return(0,_e.useLayoutEffect)((()=>{t.forEach((t=>{if(t.closeDelay){if(e.current[t.id])return;e.current[t.id]=setTimeout((()=>{o(t.id)}),t.closeDelay)}}))}),[t,o]),t.length?(0,r.createElement)("div",{className:"notices"},t.map((e=>(0,r.createElement)(we.Notice,{key:e.id,status:e.type,isDismissible:e.isDismissible,onRemove:()=>o(e.id)},e.message)))):null};const{hasSettingsUpgrades:Bt,hasRestrictionUpgrades:Ft}=contentControlSettingsPage;var Dt=e=>{const{type:t}=e,n="settings"===t?Bt:Ft;return(0,r.createElement)(r.Fragment,null,n&&(0,r.createElement)("div",{className:"has-upgrades"},(0,r.createElement)("span",null,(()=>{switch(t){case"settings":return(0,fe.__)("You have upgrades available for your plugin settings.","content-control");case"restrictions":return(0,fe.__)("You have upgrades available for your restrictions.","content-control");default:return""}})()," ⤴")))};const{permissions:{edit_restrictions:At}}=contentControlSettingsPage;var Ot=()=>{const e=(0,he.useSelect)((e=>e(Ce.restrictionsStore).isEditorActive()),[]);return At?(0,r.createElement)("div",{className:"restriction-list"},(0,r.createElement)(Dt,{type:"restrictions"}),(0,r.createElement)(Lt,null),(0,r.createElement)(rt,null),(0,r.createElement)(Mt,null),e&&(0,r.createElement)(ot,null)):(0,r.createElement)("div",{className:"restriction-list permission-denied"},(0,r.createElement)(Lt,null),(0,r.createElement)("h3",null,(0,fe.__)("Permission Denied","content-control")),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,fe.__)("You do not have permission to manage Content Control settings.","content-control"))))},It=({tabs:e})=>{const[t,n]=me("tab",V),{isSaving:o,saveSettings:l,hasUnsavedChanges:a}=(0,Ce.useSettings)();return(0,r.createElement)("div",{className:"cc-settings-view__header"},(0,r.createElement)("div",{className:"header-top-bar"},(0,r.createElement)("h1",{className:"wp-heading-inline"},(0,fe.__)("Settings","content-control")),(0,r.createElement)(we.Button,{variant:"primary",disabled:o||!a,className:"save-settings",onClick:()=>l()},o&&(0,r.createElement)(we.Spinner,null),(0,fe.__)("Save Settings","content-control"))),(0,r.createElement)(Se.ControlledTabPanel,{className:"tabs",orientation:"horizontal",selected:null!==t?t:void 0,onSelect:t=>{const o=e.find((e=>e.name===t));o?.onClick&&!1===o.onClick()||n(t)},tabs:e},(()=>(0,r.createElement)(r.Fragment,null))))},Ut=({name:e,title:t,badge:n,icon:o,children:l})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.Panel,{className:Ee()("settings-section-panel",e?`settings-section-panel--${e}`:"")},(0,r.createElement)("div",{className:"components-panel__header"},o&&(0,r.createElement)("span",{className:"panel-icon"},(0,r.createElement)(we.Icon,{icon:o})),(0,r.createElement)("span",{className:"panel-title"},t),n&&(0,r.createElement)("span",{className:"panel-badge"},n)),(0,r.createElement)(we.PanelBody,null,l))),Vt=()=>{const{settings:{excludedBlocks:e=[]},stageUnsavedChanges:t}=(0,Ce.useSettings)(),{knownBlockTypes:n=[]}=(0,he.useSelect)((e=>({knownBlockTypes:e(Ce.settingsStore).getKnownBlockTypes()})),[]),[o,l]=(0,_e.useState)(""),a=t=>e?.indexOf(t)>=0,c=(0,be.applyFilters)("contentControl.settingsPage.knownBlockTypes",n),s=(0,_e.useMemo)((()=>o&&0!==o.length?c.filter((({title:e,description:t="",keywords:n,category:r=""})=>-1===[...o.split(" ").map((o=>{const l=o.trim().toLowerCase();return e.trim().toLowerCase().indexOf(l)>=0||t.trim().toLowerCase().indexOf(l)>=0||r.trim().toLowerCase().indexOf(l)>=0||void 0!==n?.find((e=>e.trim().toLowerCase().indexOf(l)>=0))}))].indexOf(!1))):c),[o,c]);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("header",null,(0,r.createElement)("div",{className:"block-info"},(0,r.createElement)("h3",null,(0,fe.__)("Available Blocks","content-control")),(0,r.createElement)("p",null,(0,fe.__)("Control which blocks controls will be available for.","content-control"))),(0,r.createElement)("div",{className:"block-search"},(0,r.createElement)(we.Icon,{icon:ze}),(0,r.createElement)(we.TextControl,{placeholder:(0,fe.__)("Search Blocks…","content-control"),value:o,onChange:l}),(0,r.createElement)(we.Flex,{justify:"space-around"},(0,r.createElement)(we.Button,{variant:"link",onClick:()=>{const n=s.map((e=>e.name)).filter((t=>a(t)&&e.includes(t)));t({excludedBlocks:e.filter((e=>!n.includes(e)))})}},(0,fe.__)("Enable All","content-control")),(0,r.createElement)(we.Button,{variant:"link",onClick:()=>{const n=s.map((e=>e.name)).filter((t=>!a(t)&&!e.includes(t)));t({excludedBlocks:[...e.filter((e=>!n.includes(e))),...n]})}},(0,fe.__)("Disable All","content-control"))))),(0,r.createElement)("div",{className:"block-list"},c.length>0?s.map((({name:n,title:o,description:l})=>{const c=a(n);return(0,r.createElement)("div",{key:n,className:Ee()("block-list-item",c&&"is-disabled")},(0,r.createElement)("div",{className:"block-icon"},(0,r.createElement)(we.Icon,{icon:ye.block,size:30})),(0,r.createElement)("div",{className:"block-info"},(0,r.createElement)("h4",{className:"block-name"},o),l&&(0,r.createElement)("p",{className:"block-description"},l)),(0,r.createElement)("div",{className:"block-toggle"},(0,r.createElement)(we.ToggleControl,{label:c?(0,fe.__)("Disabled","content-control"):(0,fe.__)("Enabled","content-control"),hideLabelFromVision:!0,checked:!c,onChange:()=>{return t({excludedBlocks:a(o=n)?e.filter((e=>o!==e)):[...e,o]});var o}})))})):(0,r.createElement)(we.Notice,{status:"warning",isDismissible:!1},(0,fe.__)("If there are no blocks shown when you load this page, you may need to open the editor for a few different pages & posts to index the list of block types.","content-control"))))},zt=()=>{const[,e]=ue({tab:V,view:V}),{settings:t,stageUnsavedChanges:n}=(0,Ce.useSettings)(),o=(0,be.applyFilters)("contentControl.settingsPage.customMediaQueries",[{id:"mobile",name:(0,fe.__)("Mobile","content-control"),description:"",type:"__built_in"},{id:"tablet",name:(0,fe.__)("Tablet","content-control"),description:"",type:"__built_in"},{id:"desktop",name:(0,fe.__)("Desktop","content-control"),description:"",type:"__built_in"}]);return(0,r.createElement)(r.Fragment,null,o.map((({id:e,name:o,description:l,type:a})=>{var c;const s=null!==(c=t.mediaQueries?.[e])&&void 0!==c?c:{},{override:i=!1,breakpoint:u=""}=s;return(0,r.createElement)("div",{key:o,className:"field-group"},(0,r.createElement)("div",{className:"field-group__label"},(0,r.createElement)("h3",null,o),l&&(0,r.createElement)("p",null,l)),(0,r.createElement)("div",{className:"field-group__controls"},(0,r.createElement)(we.ToggleControl,{label:(0,fe.__)("Customize Breakpoint","content-control"),checked:i,onChange:o=>n({mediaQueries:{...t.mediaQueries,[e]:{...s,override:o}}})}),i&&(0,r.createElement)(we.TextControl,{type:"number",label:(0,fe.__)("Breakpoint (px)","content-control"),autoComplete:"off",value:u,onChange:o=>n({mediaQueries:{...t.mediaQueries,[e]:{...s,breakpoint:parseInt(o)}}})})))})),!1)},jt=()=>{const e=(0,be.applyFilters)("contentControl.settingsPage.blockControlSections",[{name:"media-queries",title:(0,fe.__)("Device & Media Queries","content-control"),icon:ye.monitor,comp:zt},{name:"block-manager",title:(0,fe.__)("Block Manager","content-control"),icon:ye.blockManager,comp:Vt}]);return(0,r.createElement)(r.Fragment,null,e.map((({name:e,title:t,badge:n,icon:o,comp:l})=>(0,r.createElement)(Ut,{key:e,name:e,badge:n,title:t,icon:o},l?(0,r.createElement)(l,null):t))))};const{rolesAndCaps:Ht}=contentControlSettingsPage,$t=(()=>{const e=[];return Object.entries(Ht).forEach((([t,{name:n}])=>{void 0===e.find((e=>e.value===t))&&e.push({label:n,value:t})})),Object.values(Ht).forEach((({capabilities:t})=>{Object.keys(t).forEach((t=>{void 0===e.find((({value:e})=>t===e))&&e.push({label:t,value:t})}))})),e})();var Wt=()=>{const{settings:e,stageUnsavedChanges:t}=(0,Ce.useSettings)(),n=(0,be.applyFilters)("contentControl.settingsPage.pluginPermissionLabels",[{name:"view_block_controls",label:(0,fe.__)("View Block Controls","content-control"),default:"edit_posts",description:(0,fe.__)("Choose who can view block controls in the block editor. These users will see the settings created by others.","content-control")},{name:"edit_block_controls",label:(0,fe.__)("Edit Block Controls","content-control"),default:"edit_posts",description:(0,fe.__)("Choose who can edit block controls in the block editor. Users with this role can add or edit controls on blocks.","content-control")},{name:"edit_restrictions",label:(0,fe.__)("Edit Restriction","content-control"),default:"manage_options",description:(0,fe.__)("Choose who can manage global restrictions. These users can create, edit, and delete restrictions.","content-control")},{name:"manage_settings",label:(0,fe.__)("Manage Settings","content-control"),default:"manage_options",description:(0,fe.__)("Choose who can manage the plugin settings. These users will see the settings page and can change the plugin settings.","content-control")}]),o=(n,o)=>{t({permissions:{...e.permissions,[n]:o}})};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.Notice,{status:"warning",isDismissible:!1},(0,r.createElement)(we.Icon,{icon:"warning"})," ",(0,fe.__)("Note: Administrators always have access.","content-control")),n.map((({name:t,label:n,description:l,default:a})=>{const c=e?.permissions?.[t],s=void 0!==$t.find((({value:e})=>e===c)),i=c&&!s;return(0,r.createElement)("div",{key:t,className:"field-group"},(0,r.createElement)("div",{className:"field-group__label"},(0,r.createElement)("h3",null,n),l&&(0,r.createElement)("p",null,l)),(0,r.createElement)("div",{className:"field-group__controls"},(0,r.createElement)(we.ToggleControl,{label:(0,fe.sprintf)(
// translators: %s: default capability
(0,fe.__)("Override the default (%s)","content-control"),a),checked:!!c,onChange:e=>o(t,!!e&&a)}),c&&(0,r.createElement)(we.ComboboxControl,{"aria-label":(0,fe.__)("Choose the role or cap to use","content-control"),value:i?"other":null!=c?c:a,onChange:e=>o(t,"other"===e?"custom_cap":null!=e?e:a),options:[...$t,{label:(0,fe.__)("Other (custom)","content-control"),value:"other"}]}),i&&(0,r.createElement)(we.TextControl,{label:(0,fe.__)("Enter custom role or cap here","content-control"),help:(0,fe.__)("Be certain you know what you are doing, this can prevent you from accessing the given feature.","content-control"),value:c,onChange:e=>o(t,e)})))})))};const{logUrl:Gt=!1}=contentControlSettingsPage;var Qt=()=>{const[e,t]=(0,_e.useState)("");return(0,_e.useEffect)((()=>{!1!==Gt&&Gt.length&&fetch(Gt).then((e=>e.text())).then((e=>t(e))).catch((e=>console.error(e)))}),[]),(0,r.createElement)(we.TextareaControl,{label:"Log Contents",value:e,onChange:e=>t(e)})},qt=()=>{const{settings:e,stageUnsavedChanges:t}=(0,Ce.useSettings)(),{defaultDenialMessage:n,excludeAdmins:o}=e;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.TextareaControl,{label:(0,fe.__)("Default Denial Message","content-control"),help:(0,fe.__)("This message will be shown to users when they do not have access to content.","content-control"),value:n,onChange:e=>t({defaultDenialMessage:e})}),(0,r.createElement)(we.CheckboxControl,{label:(0,fe.__)("Exclude administrators from being restricted.","content-control"),help:(0,fe.__)("Administrators will not be restricted by any restrictions.","content-control"),checked:o,onChange:e=>t({excludeAdmins:e})}))};const{logUrl:Yt=!1}=contentControlSettingsPage;(0,be.addFilter)("contentControl.settingsPage.generalSections","content-control/general-settings/restriction-options",(e=>[...e,{name:"restrictions",title:(0,fe.__)("Restriction Settings","content-control"),icon:ye.permissions,comp:qt}]),5),(0,be.addFilter)("contentControl.settingsPage.generalSections","content-control/general-settings/permissions-options",(e=>[...e,{name:"permissions",title:(0,fe.__)("Plugin Permissions","content-control"),icon:ye.permissions,comp:Wt}]),10),(0,be.addFilter)("contentControl.settingsPage.generalSections","content-control/general-settings/log-viewer",(e=>[...e,!1!==Yt&&{name:"log",title:(0,fe.__)("Log Viewer","content-control"),icon:"editor-code",comp:Qt}]),50);var Kt=()=>{const e=(0,be.applyFilters)("contentControl.settingsPage.generalSections",[]);return(0,r.createElement)(r.Fragment,null,e.map((({name:e,title:t,badge:n,icon:o,comp:l})=>(0,r.createElement)(Ut,{key:e,name:e,badge:n,title:t,icon:o},l?(0,r.createElement)(l,null):t))))},Jt=(0,r.createElement)(ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(ke.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Zt=()=>(0,r.createElement)("div",{className:"upgrade-features"},(0,r.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,fe.sprintf)(
// translators: %s: Upgrade link.
(0,fe.__)('To unlock the following features, <a href="%s" target="_blank">upgrade to Pro</a> and enter your license key above.',"content-control"),"https://contentcontrolplugin.com/pricing/?utm_campaign=upgrade-to-pro&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=license-tab-upgrade-text")}}),(0,r.createElement)(we.Flex,{justify:"flex-start",align:"flex-start",wrap:!1,gap:10},(0,r.createElement)(we.Flex,{direction:"column",style:{maxWidth:"40%"}},(0,r.createElement)("div",{className:"upgrade-notice__feature"},(0,r.createElement)("h3",null,"Monetizing Content Has Never Been So Easy"),(0,r.createElement)("ul",null,(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Content Teasers: "),"Effortlessly create engaging, high-quality content teasers akin to those seen in the New York Times or WSJ."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"WooCommerce Integration: "),"Build exclusive membership sites and tailor content access based on user purchase history, cart contents, and more."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Easy Digital Downloads: "),"Limit access to users with active licenses or subscriptions, adding an extra layer of content protection."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Enhanced User Restrictions:"),"Expand control beyond standard logins & user roles for more precise management."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Customized Login URLs: "),"Redirect users seamlessly to tailored login and registration pages, enhancing user experience and site security.")))),(0,r.createElement)(we.Flex,{direction:"column",style:{maxWidth:"40%"}},(0,r.createElement)("div",{className:"upgrade-notice__feature"},(0,r.createElement)("h3",null,"Advanced Block Controls:"),(0,r.createElement)("ul",null,(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Block Scheduling: "),"Schedule content blocks for specific dates, times, or on a recurring basis, ensuring your site stays dynamic and relevant."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"WooCommerce Rules: "),"Utilize rules based on customer purchase history or subscription status for targeted content delivery."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Easy Digital Download Rules: "),"Manage content access based on digital cart contents and purchase history for a more personalized user experience."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"Boolean Logic: "),"Employ AND, OR, NOT operations to create sophisticated and tailored content rules."),(0,r.createElement)("li",null,(0,r.createElement)(we.Icon,{icon:Jt,size:28}),(0,r.createElement)("strong",null,"More Rules: "),"Advanced rule types, giving you unparalleled control over your content.")))))),Xt=()=>{const{connectInfo:e,licenseKey:t,licenseStatus:n,isSaving:o,activateLicense:l,deactivateLicense:a,checkLicenseStatus:c,removeLicense:s,activatePro:i,isActivatingPro:u,proWasActivated:d,getLicenseStatusName:m,isLicenseKeyValid:p,isLicenseActive:g,isLicenseDeactivated:h,isLicenseMissing:_,isLicenseExpired:v,isLicenseOverQuota:E,isLicenseDisabled:f,hasError:b}=(0,Ce.useLicense)(),{expires:y,error_message:w}=n,[C,S]=(0,_e.useState)(t),[k,x]=(0,_e.useState)(!1),[N,P]=(0,_e.useState)(!1),R=(0,_e.useRef)(null),[T,M]=(0,_e.useState)(!1),[L,B]=(0,_e.useState)({installed:"1"===contentControlSettingsPage?.isProInstalled,activated:"1"===contentControlSettingsPage?.isProInstalled&&"1"===contentControlSettingsPage?.isProActivated}),F=C!==t;(0,_e.useEffect)((()=>{if(void 0===e)return R.current?.close(),void(R.current=null);M(!0),R.current=window.open(e.url,"content-control-license-connect","width=580,height=600");const t=setInterval((()=>{R.current?.closed&&(clearInterval(t),c(),M(!1),setTimeout((()=>{window.location.reload()}),1e3))}),1e3)}),[e,c]),(0,_e.useEffect)((()=>{d&&setTimeout((()=>{window.location.reload()}),1e3)}),[d]),(0,_e.useEffect)((()=>{F&&S(t)}),[t,F]),(0,_e.useEffect)((()=>{k&&!o&&x(!1)}),[o,k]),(0,_e.useEffect)((()=>{N&&!o&&(P(!1),B({...L,installed:!0}))}),[o,N,L]);const D=L.installed&&!L.activated;return(0,r.createElement)(r.Fragment,null,T&&(0,r.createElement)(we.Popover,{className:"content-control-license-connect-notice",position:"middle center"},(0,r.createElement)("p",null,(0,fe.__)("Please wait while we connect to the license store…","content-control"))),(0,r.createElement)("div",{className:"content-control__upgrade-notice"},(0,r.createElement)("h3",{className:"upgrade-notice__title"},(0,fe.__)("Enter your Content Control License Key","content-control")),(0,r.createElement)("p",{className:"upgrade-notice__description",dangerouslySetInnerHTML:{__html:g?(0,fe.__)("You are currently using Content Control Pro. Thanks for supporting us! <span>😄</span>","content-control"):(0,fe.__)("You are currently using Content Control Lite — no license key required. Enjoy! <span>😄</span>","content-control")}}),(0,r.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,fe.sprintf)(
// translators: 1: opening strong tag, 2: closing strong tag.
(0,fe.__)("Enter your license key below to activate %1$sContent Control Pro%2$s!","content-control"),"<strong>","</strong>")}}),(0,r.createElement)("div",{className:Ee()(["content-control-license-controls","content-control-license-controls--"+m])},(0,r.createElement)(we.TextControl,{label:(0,fe.__)("Enter your license key.","content-control"),hideLabelFromVision:!0,placeholder:(0,fe.__)("Paste or enter your license key here.","content-control"),value:p?C.replace(/^(.{3})(.*)(.{5})$/,((e,t,n,o)=>t+n.replace(/./g,"*")+o)):C,maxLength:32,width:500,onChange:S,readOnly:k||p,tabIndex:k||p?-1:0,onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text");o||(x(!0),l(t),S(t))}}),(0,r.createElement)(we.ButtonGroup,null,g&&(0,r.createElement)(r.Fragment,null,!L.installed&&(0,r.createElement)(we.Button,{className:"install-pro",variant:"primary",onClick:()=>{P(!0),l(_?C:void 0)},title:(0,fe.__)("Install Pro","content-control")},N?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,(0,fe.__)("Installing…","content-control")),(0,r.createElement)(we.Spinner,null)):(0,r.createElement)("span",null,(0,fe.__)("Install Pro","content-control"))),D&&(0,r.createElement)(we.Button,{className:"activate-pro",variant:"primary",onClick:()=>{i()},title:(0,fe.__)("Activate Pro","content-control")},u||d?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,(0,fe.__)("Activating…","content-control")),(0,r.createElement)(we.Spinner,null)):(0,r.createElement)("span",null,(0,fe.__)("Activate Pro","content-control")))),(0,r.createElement)(we.Button,{className:"activate-license",variant:"primary",onClick:()=>{x(!0),l(_?C:void 0)},disabled:(o||!F)&&!h,title:(0,fe.__)("Activate","content-control")},k?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,(0,fe.__)("Activating…","content-control")),(0,r.createElement)(we.Spinner,null)):(0,r.createElement)("span",null,(0,fe.__)("Activate","content-control"))),(0,r.createElement)(we.Button,{className:"deactivate-license",variant:"tertiary",onClick:()=>a(),disabled:o||!g,title:(0,fe.__)("Deactivate","content-control")},(0,r.createElement)("span",null,(0,fe.__)("Deactivate","content-control"))),(0,r.createElement)(we.Button,{className:"remove-license",variant:"tertiary",isDestructive:!0,onClick:()=>s(),disabled:o||!p,title:(0,fe.__)("Delete","content-control")},(0,r.createElement)(we.Icon,{icon:at}),(0,r.createElement)("span",null,(0,fe.__)("Delete","content-control"))))),(0,r.createElement)("div",{className:"content-control-license-status",dangerouslySetInnerHTML:{__html:_?(0,fe.sprintf)(
// translators: 1: opening a tag, 2: closing a tag.
(0,fe.__)("Enter your license key to activate. If you do not have a license key, you can %1$spurchase one here%2$s","content-control"),'<a href="https://contentcontrolplugin.com/pricing/?utm_campaign=upgrade-to-pro&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=license-field-upgrade-text" target="_blank">',"</a>"):g?(0,fe.sprintf)(
// translators: 1: date
(0,fe.__)("Your license key is active%1$s. Thank you for supporting Content Control!","content-control"),"lifetime"!==y?" until "+new Date(y).toLocaleDateString():" and never expires"):v?(0,fe.sprintf)(
// translators: 1: date, 2: opening a tag, 3: closing a tag.
(0,fe.__)("Your license key has expired on %1$s. Please %2$srenew your license$3$s to continue receiving updates and support.","content-control"),new Date(y).toLocaleDateString(),'<a href="https://contentcontrolplugin.com/checkout/?edd_license_key='+t+'&utm_campaign=renew-license&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=license-tab-renew-link" target="_blank">',"</a>"):E?(0,fe.sprintf)(
// translators: 1: opening a tag, 2: closing a tag, 3: opening a tag, 4: closing a tag.
(0,fe.__)("Your license key has reached its site limit. %1$sUpgrade your license%2$s to add more sites, or %3$slog in%4$s to manage current activations.","content-control"),'<a href="https://contentcontrolplugin.com/checkout/?edd_license_key='+t+'&utm_campaign=upgrade-to-pro&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=license-tab-upgrade-link" target="_blank">',"</a>",'<a href="https://contentcontrolplugin.com/your-account/?utm_campaign=manage-activations&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=license-tab-login-link" target="_blank">',"</a>"):h?(0,fe.__)("Your license key is currently deactivated. Click the button above to activate now.","content-control"):f?(0,fe.__)("Your license key has been disabled. Please contact support.","content-control"):b?(0,fe.sprintf)(
// translators: 1: error message.
(0,fe.__)("Your license key failed to activate with the following error: %1$s","content-control"),w):(0,fe.__)("There was an error with your license key. Please check your key and try again.","content-control")}}),!p&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("br",null),(0,r.createElement)("hr",null),(0,r.createElement)(Zt,null))))};(0,be.addFilter)("contentControl.settingsPage.upgradeSections","content-control/general-settings/license-options",(e=>{const{isLicenseActive:t}=(0,Ce.useLicense)();return[...e,{name:"license",title:(0,fe.__)("Pro Licensing","content-control"),badge:(0,r.createElement)(r.Fragment,null,t&&(0,r.createElement)("span",{className:"license-status-bubble"},(0,fe.__)("Activated","content-control"))),icon:ye.licenseKey,comp:Xt}]}),5);var en=()=>{const e=(0,be.applyFilters)("contentControl.settingsPage.upgradeSections",[]);return(0,r.createElement)(r.Fragment,null,e.map((({name:e,title:t,badge:n,icon:o,comp:l})=>(0,r.createElement)(Ut,{key:e,name:e,badge:n,title:t,icon:o},l?(0,r.createElement)(l,null):t))))};const{permissions:{manage_settings:tn}}=contentControlSettingsPage;var nn=()=>{var e;const[{tab:t="general"}]=ue({tab:V,view:V}),n=(0,be.applyFilters)("contentControl.settingsPage.tabs",[{name:"general",title:(0,fe.__)("General","content-control"),comp:Kt},{name:"block-controls",title:(0,fe.__)("Block Controls","content-control"),comp:jt},{name:"license-and-updates",title:(0,fe.__)("Licensing","content-control"),comp:en}]),{title:o,comp:l}=null!==(e=n.find((e=>e.name===t)))&&void 0!==e?e:{};return tn?(0,r.createElement)("div",{className:Ee()(["cc-settings-view",`tab-${t}`])},(0,r.createElement)("div",{className:"plugin-settings"},(0,r.createElement)(Dt,{type:"settings"}),(0,r.createElement)(It,{tabs:n}),(0,r.createElement)("div",{className:"cc-settings-view__content"},l?(0,r.createElement)(l,null):o))):(0,r.createElement)("div",{className:"cc-settings-view permission-denied"},(0,r.createElement)("h3",null,(0,fe.__)("Permission Denied","content-control")),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,fe.__)("You do not have permission to access this page.","content-control"))))};const on={total:1,progress:0,currentTask:void 0,error:void 0},{hasUpgrades:rn,upgradeNonce:ln,upgradeUrl:an}=contentControlSettingsPage;var cn=()=>{const e=(0,_e.useRef)(null),[t,n]=(0,_e.useState)({running:!1,done:!1,logs:[],showLogs:!1,status:on}),[o,l]=(0,_e.useState)(-1),{running:a,done:c,logs:s,showLogs:i,status:u}=t,[d]=function(e,t,n=EventSource){const o=(0,r.useRef)(null),[l,a]=(0,r.useState)("init");return(0,r.useEffect)((()=>{if(e){const r=new n(e,{withCredentials:t});return o.current=r,r.addEventListener("open",(()=>a("open"))),r.addEventListener("error",(()=>a("error"))),()=>{o.current=null,r.close()}}a("closed")}),[e,t,n]),[o.current,l]}(a?`${an}&nonce=${ln}`:"",!0);!function(e,t,n,o=[]){(0,r.useEffect)((()=>{if(e)return t.forEach((t=>e.addEventListener(t,n))),()=>t.forEach((t=>e.removeEventListener(t,n)))}),[e,...o])}(d,["upgrades:start","upgrades:progress","upgrades:complete","upgrades:error","task:start","task:progress","task:complete","task:retry","task:error"],(({type:e,data:o})=>{const r=JSON.parse(o),{message:a="",status:c}=r,i={...t,status:c,logs:a.length?[...s,a]:s};switch(e){case"upgrades:start":case"upgrades:progress":case"upgrades:complete":case"task:retry":case"task:start":case"task:complete":case"task:progress":"upgrades:complete"===e&&(i.done=!0,l(15),d?.close()),n(i);break;case"upgrades:error":case"task:error":case"error":console.log("Error:",a,r),"upgrades:error"===e&&(i.done=!0,d?.close(),i.status={...i.status,error:a}),n({...i,logs:[...s,`ERROR: ${a}`,JSON.stringify(r)]});break;default:console.log("Unknown event:",e)}}),[t]);const{total:m,progress:p,currentTask:g}=u,{progress:h=NaN,total:_=NaN}=g||{};(0,_e.useEffect)((()=>{a&&c&&o>=0&&(e.current=setTimeout((()=>{0===o?window.location.reload():l(o-1)}),1e3))}),[c,o,a]);const v=p+1,E=m-p-1,f=(0,Ve.clamp)(p/m*100,0,100),b=(0,Ve.clamp)(v/m*100,0,100),y=h/_,w=f,C=(0,_e.useMemo)((()=>100-w-E/m*100),[w,E,m]),S=(0,_e.useMemo)((()=>u.currentTask?y*C:0),[y,C,u.currentTask]);return rn?(0,r.createElement)("div",{className:"content-control-upgrades-panel"},a?(0,r.createElement)("div",{className:Ee()(["upgrade-progress",u.error?"upgrade-errors":""])},(0,r.createElement)("div",{className:"upgrade-progress__header"},(0,r.createElement)("h3",{className:"upgrade-progress__title"},(0,fe.__)("Upgrade Progress","content-control")),(0,r.createElement)("div",{className:"upgrade-progress__task-percentage"},c?(0,r.createElement)(we.Button,{onClick:()=>{var t;clearTimeout(null!==(t=e.current)&&void 0!==t?t:0),window.location.reload()},variant:"link"},`${(0,fe.__)("Reload","content-control")} (${o})`):`${Math.round(f)}%`)),(0,r.createElement)("div",{className:"upgrade-progress__bar"},(0,r.createElement)("div",{className:Ee()("upgrade-progress__bar__fill","upgrade-progress__bar__fill--next",b>=100?"complete":""),style:{width:`${b}%`}}),(0,r.createElement)("div",{className:Ee()("upgrade-progress__bar__fill","upgrade-progress__bar__fill--current",f>=100?"complete":""),style:{width:`${f}%`}}),(0,r.createElement)("div",{className:Ee()("upgrade-progress__bar__fill","upgrade-progress__bar__fill--task",y>=1?"complete":""),style:{left:`${w}%`,width:`${(0,Ve.clamp)(S,0,100)}%`}},(0,r.createElement)("div",{className:"task-progress"},y>0?Math.round(100*y):0,"%"))),(0,r.createElement)("div",{className:"upgrade-progress__logs__header"},(0,r.createElement)("div",{className:"upgrade-progress__logs__header__status"},s[s.length-1]),(0,r.createElement)(we.Button,{variant:"link",onClick:()=>{n({...t,showLogs:!i})}},i?(0,fe.__)("Hide Logs","content-control"):(0,fe.__)("Show Logs","content-control"))),i&&(0,r.createElement)("div",{className:"upgrade-progress__logs"},(0,r.createElement)("div",{className:"upgrade-progress__logs__content"},s.map(((e,t)=>(0,r.createElement)("div",{key:t},e)))))):(0,r.createElement)("div",{className:"upgrade-notice"},(0,r.createElement)("div",{className:"notice-icon"},(0,r.createElement)("img",{alt:(0,fe.__)("Content Control requires an upgrade to the database.","content-control"),src:`${contentControlSettingsPage.pluginUrl}assets/images/illustration-check.svg`})),(0,r.createElement)("div",{className:"notice-content"},(0,r.createElement)("h2",null,(0,fe.__)("Content Control requires an upgrade to the database.","content-control")),(0,r.createElement)("p",null,(0,fe.__)("Click the button below to start the upgrade process.","content-control"))),(0,r.createElement)(we.Button,{variant:"secondary",onClick:()=>{n({...t,running:!0})}},(0,fe.__)("Start Upgrades","content-control")))):null};const{permissions:{manage_settings:sn,edit_restrictions:un}}=contentControlSettingsPage;var dn=()=>{const{isLicenseActive:e,isLicenseKeyValid:t,licenseLevel:n}=(0,Ce.useLicense)(),[{view:o="restrictions"},l]=ue({tab:V,view:V}),a=(0,_e.useMemo)((()=>{let a=[];return un&&a.push({name:"restrictions",title:(0,fe.__)("Restrictions","content-control"),className:"restrictions",pageTitle:(0,fe.__)("Content Control - Global Restrictions","content-control"),heading:(0,fe.__)("Content Control - Global Restrictions","content-control"),comp:Ot}),sn&&a.push({name:"settings",title:(0,fe.__)("Settings","content-control"),className:"settings",pageTitle:(0,fe.__)("Content Control - Plugin Settings","content-control"),heading:(0,fe.__)("Plugin Settings","content-control"),comp:nn}),a=(0,be.applyFilters)("contentControl.adminViews",[...a,{name:"upgrade",className:"upgrade",title:(0,r.createElement)(r.Fragment,null,(0,r.createElement)(we.Icon,{size:20,icon:ye.upgrade}),e?(0,fe.__)("License Status","content-control"):(0,fe.__)("Upgrade to Pro","content-control")),pageTitle:(0,fe.__)("Content Control - Upgrade to Pro","content-control"),heading:(0,fe.__)("Content Control - Upgrade to Pro","content-control"),href:t?void 0:"https://contentcontrolplugin.com/pricing/?utm_campaign=upgrade-to-pro&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=main-menu-upgrade-button",target:"_blank",onClick:()=>(l({view:"settings",tab:"license-and-updates"}),!1)}],{view:o,setParams:l,isLicenseActive:e,isLicenseKeyValid:t,licenseLevel:n}),a}),[e,t,n,l,o]),c=a.find((e=>e.name===o)),s=c?.comp?c.comp:()=>(0,r.createElement)(r.Fragment,null);return(0,_e.useEffect)((()=>{var e;document.title=null!==(e=a.find((e=>e.name===o))?.pageTitle)&&void 0!==e?e:(0,fe.__)("Content Control","content-control")}),[o,a]),(0,r.createElement)(we.SlotFillProvider,null,(0,r.createElement)("div",{className:Ee()(["cc-settings-page",`view-${o}`])},(0,r.createElement)(cn,null),(0,r.createElement)(Fe,{tabs:a}),(0,r.createElement)("div",{className:"cc-settings-page__content"},(0,r.createElement)(s,null)),(0,r.createElement)(we.Popover.Slot,null)))};const{wpVersion:mn}=contentControlSettingsPage,pn=()=>(0,r.createElement)(O,null,(0,r.createElement)(le,{adapter:pe},(0,r.createElement)(he.RegistryProvider,{value:ge.registry},(0,r.createElement)(dn,null)))),gn=()=>{const e=document.getElementById("content-control-root-container");e&&(mn>=6.2||"function"==typeof _e.createRoot?(0,_e.createRoot)(e).render(pn()):(0,_e.render)(pn(),e))}}(),(window.contentControl=window.contentControl||{}).settingsPage=o}();

SILENT KILLER Tool