PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.0.2
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.0.2
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
content-control / dist / components.js

components.js in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More 2.0.2, at dist/components.js

8 lines 24.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 !function(){var e={184:function(e,t){var n;!function(){"use strict";var o={}.hasOwnProperty;function l(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n)){if(n.length){var c=l.apply(null,n);c&&e.push(c)}}else if("object"===r){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var a in n)o.call(n,a)&&n[a]&&e.push(a)}}}return e.join(" ")}e.exports?(l.default=l,e.exports=l):void 0===(n=function(){return l}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var l=t[o];if(void 0!==l)return l.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.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,{ConfirmDialogue:function(){return u},ControlledTabPanel:function(){return s},DeviceToggle:function(){return p},EntitySelectControl:function(){return b},ListTable:function(){return L},RadioButtonControl:function(){return A},SearchableMulticheckControl:function(){return j},SmartTokenControl:function(){return w},TextHighlight:function(){return D},URLControl:function(){return $},useControlledState:function(){return T}});var e=window.wp.element,t=n(184),l=n.n(t),r=window.wp.components,c=window.wp.compose,a=({tabId:t,onClick:n,children:o,selected:l,...c})=>(0,e.createElement)(r.Button,{role:"tab",tabIndex:l?void 0:-1,"aria-selected":l,id:t,onClick:n,...c},o),s=(0,c.withInstanceId)((({instanceId:t,orientation:n="horizontal",activeClass:o="is-active",tabsClass:c="tabs",tabClass:s="tab",className:i,tabs:u,selected:m,onSelect:p,children:d})=>{var g;const h=u.find((e=>m===e.name))||u[0],v=`${t}-${null!==(g=h?.name)&&void 0!==g?g:"none"}`;return(0,e.createElement)("div",{className:l()(i,"cc-"+n+"-tabs")},(0,e.createElement)(r.NavigableMenu,{role:"tablist",orientation:n,onNavigate:(e,t)=>{t.click()},className:l()([c,"components-tab-panel__tabs"])},u.map((n=>{var r,c;return(0,e.createElement)(a,{className:l()(s,"components-tab-panel__tabs-item","components-tab-panel__tab",n.className,{[o]:n.name===h.name}),tabId:`${t}-${n.name}`,"aria-controls":`${t}-${n.name}-view`,selected:n.name===h.name,key:n.name,onClick:()=>{return e=n.name,void p?.(e);var e},href:null!==(r=n?.href)&&void 0!==r?r:void 0,target:null!==(c=n?.target)&&void 0!==c?c:void 0},n.title)}))),h&&(0,e.createElement)("div",{key:v,"aria-labelledby":v,role:"tabpanel",id:`${v}-view`,className:"components-tab-panel__tab-content",tabIndex:0},d&&d(h)))})),i=window.wp.i18n,u=({message:t,callback:n,onClose:o,isDestructive:l=!1})=>t&&t.length&&n?(0,e.createElement)(r.Modal,{title:(0,i.__)("Confirm Action","content-control"),onRequestClose:o},(0,e.createElement)("p",null,t),(0,e.createElement)(r.Flex,{justify:"right"},(0,e.createElement)(r.Button,{text:(0,i.__)("Cancel","content-control"),onClick:o}),(0,e.createElement)(r.Button,{variant:"primary",text:(0,i.__)("Confirm","content-control"),isDestructive:l,onClick:()=>{n(),o()}}))):null,m=window.contentControl.utils,p=({label:t,icon:n,isVisible:o,onChange:c=m.noop})=>{const a=o?/* translators: 1. Device type. */
2 (0,i._x)("Show on %1$s","Device toggle option","content-control"):/* translators: 1. Device type. */
3 (0,i._x)("Hide on %1$s","Device toggle option","content-control"),s=o?"visibility":"hidden",u=()=>c(!o);return(0,e.createElement)("div",{className:l()(["cc__component-device-toggle",o&&"is-checked"])},(0,e.createElement)("h3",{className:"cc__component-device-toggle__label"},(0,e.createElement)(r.Icon,{icon:n}),t),(0,e.createElement)("div",{className:"cc__component-device-toggle__control"},(0,e.createElement)(r.Tooltip,{text:(0,i.sprintf)(a,t)},(0,e.createElement)("span",null,(0,e.createElement)(r.Icon,{className:"cc__component-device-toggle__control-icon",onClick:u,icon:s}))),(0,e.createElement)(r.Tooltip,{text:(0,i.sprintf)(a,t)},(0,e.createElement)("span",null,(0,e.createElement)(r.ToggleControl,{className:"cc__component-device-toggle__control-input",checked:o,onChange:u,hideLabelFromVision:!0,"aria-label":a,label:(0,i.sprintf)(/* translators: 1. Device type. */
4 (0,i._x)("Show on %1$s","Device toggle option","content-control"),t)})))))},d=window.wp.data,g=window.wp.coreData,h=window.wp.primitives,v=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(h.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));const f={container:"component-smart-token-control",popover:"component-smart-token-control__suggestions-popover",inputContainer:"component-smart-token-control__input",tokens:"component-smart-token-control__tokens",token:"component-smart-token-control__token",tokenLabel:"component-smart-token-control__token-label",tokenRemove:"component-smart-token-control__token-remove",textInput:"component-smart-token-control__text-input",toggleSuggestions:"component-smart-token-control__toggle",suggestions:"component-smart-token-control__suggestions",suggestion:"component-smart-token-control__suggestion"},E=({value:t,onChange:n,label:o,placeholder:a=(0,i.__)("Enter a value","content-control"),className:s,tokenOnComma:u=!1,classes:p=f,renderToken:d=(t=>(0,e.createElement)(e.Fragment,null,"string"==typeof t?t:t.item)),renderSuggestion:g=(t=>(0,e.createElement)(e.Fragment,null,t)),onInputChange:h=m.noop,saveTransform:w=(e=>e),closeOnSelect:b=!1,hideLabelFromVision:S=!1,extraKeyboardShortcuts:_={},multiple:C=!1,suggestions:k,messages:y={searchTokens:(0,i.__)("Search","content-control"),noSuggestions:(0,i.__)("No suggestions","content-control"),removeToken:(0,i.__)("Remove token","content-control")}},x)=>{const N={...f,...p},I=(0,c.useInstanceId)(E),R=(0,e.useRef)(null),$=(0,e.useRef)(null),O=(0,e.useRef)(null),[F,T]=(0,e.useState)({inputText:"",isFocused:!1,selectedSuggestion:-1,popoverOpen:!1,refocus:!1}),{inputText:B,isFocused:L,selectedSuggestion:D,popoverOpen:M}=F;function A(e){return"object"==typeof e?e.value:e}function P(e){return t.some((t=>A(e)===A(t)))}function z(e){!function(e){const o=[...new Set(e.map(w).filter(Boolean).filter((e=>!P(e))))];o.length>0&&n([...t,...o])}([e]),T({...F,inputText:"",popoverOpen:!b&&M})}const V=e=>T({...F,selectedSuggestion:e}),j=k.length,H=D>j?0:D;(0,e.useEffect)((()=>{setTimeout((()=>{O.current&&O.current.scrollIntoView()}),25)}),[D,M]),(0,e.useEffect)((()=>{F.refocus&&(T({...F,refocus:!1}),$.current?.focus())}),[F,F.refocus]);const U={up:e=>{e.preventDefault(),T({...F,popoverOpen:0===B.length&&!M||M,selectedSuggestion:(0,m.clamp)(H-1>=0?H-1:j,0,j)})},down:e=>{e.preventDefault(),T({...F,popoverOpen:0===B.length&&!M||M,selectedSuggestion:(0,m.clamp)(H+1<=j?H+1:0,0,j)})},"alt+down":()=>T({...F,popoverOpen:!0}),enter:()=>{if(-1===D)return T({...F,popoverOpen:!1});z(k[H])},escape:e=>{e.preventDefault(),e.stopPropagation(),T({...F,selectedSuggestion:-1,popoverOpen:!1})},",":e=>{u&&(e.preventDefault(),0!==B.length&&z(B))},..._};return(0,e.createElement)(r.KeyboardShortcuts,{shortcuts:U},(0,e.createElement)("div",{id:`component-smart-token-control-${I}-wrapper`,className:l()([N.container,L&&"is-focused",s]),ref:e=>{R.current=e,x&&"object"==typeof x&&(x.current=e)},onBlur:e=>{e.relatedTarget&&e.relatedTarget.classList.contains(N.popover)||T({...F,isFocused:!1,popoverOpen:!1})}},(0,e.createElement)(r.BaseControl,{id:`component-smart-token-control-${I}`,label:o,hideLabelFromVision:S},(0,e.createElement)("div",{className:l()([N.inputContainer,!C&&t.length>0&&"input-disabled"])},t.length>0&&(0,e.createElement)("div",{className:N.tokens},t.map((o=>(0,e.createElement)("div",{className:N.token,key:A(o)},(0,e.createElement)("div",{className:N.tokenLabel},d(o)),(0,e.createElement)(r.Button,{className:N.tokenRemove,label:y.removeToken,icon:v,onClick:()=>function(e){T({...F,refocus:!0}),n(t.filter((t=>A(t)!==A(e))))}(o)}))))),(0,e.createElement)("input",{id:`component-smart-token-control-${I}`,type:"text",className:l()([N.textInput]),placeholder:a,disabled:!C&&t.length>0,ref:$,value:null!=B?B:"",onChange:e=>{return t=e.target.value,T({...F,inputText:t,popoverOpen:t.length>=1}),void h(t);var t},autoComplete:"off","aria-autocomplete":"list","aria-controls":`${I}-listbox`,"aria-activedescendant":`sug-${H}`,onFocus:()=>{T({...F,isFocused:!0,popoverOpen:B.length>=1})},onClick:()=>{M||T({...F,popoverOpen:k.length>0})},onBlur:e=>{const t=e.relatedTarget;t&&t.classList.contains(N.popover)||T({...F,isFocused:!1,popoverOpen:!1})}}))),M&&(0,e.createElement)(r.Popover,{focusOnMount:!1,onClose:()=>V(-1),position:"bottom right",anchor:$.current,className:N.popover},(0,e.createElement)("div",{className:N.suggestions,style:{width:$.current?.clientWidth}},k.length?k.map(((t,n)=>(0,e.createElement)("div",{key:n,id:`sug-${n}`,className:l()([N.suggestion,n===H&&"is-currently-highlighted",P(t)&&"is-selected"]),ref:n===H?O:void 0,onFocus:()=>{V(n)},onMouseDown:e=>{e.preventDefault(),z(k[n])},role:"option",tabIndex:n,"aria-selected":n===H},g(t)))):(0,e.createElement)("div",null,y.noSuggestions)))))};var w=(0,e.forwardRef)(E),b=({label:t,value:n,onChange:o,placeholder:l,entityKind:r="postType",entityType:a="post",multiple:s=!1,...u})=>{const[m,p]=(0,e.useState)(""),h=(0,c.useDebounce)((e=>{p(e)}),300),{prefill:v=[]}=(0,d.useSelect)((e=>({prefill:e(g.store).getEntityRecords(r,a,{context:"view",include:n,per_page:-1})})),[n,r,a]),{suggestions:f=[]}=(0,d.useSelect)((e=>({suggestions:e(g.store).getEntityRecords(r,a,{context:"view",search:m,per_page:10})})),[r,a,m]),E=e=>f&&f.find((t=>t.id.toString()===e.toString()))||v&&v.find((t=>t.id.toString()===e.toString())),b=n?(Array.isArray(n)?n:[n]).map((e=>e.toString())):[],S=e=>"object"==typeof e?e.value:e;return(0,e.createElement)("div",{className:"cc-object-search-field"},(0,e.createElement)(w,{label:t||(0,i.sprintf)(
5 // translators: %s: entity type.
6 (0,i.__)("%s(s)","content-control"),a.replace(/_/g," ").charAt(0).toUpperCase()+a.replace(/_/g," ").slice(1)),multiple:s,placeholder:l||(0,i.sprintf)(
7 // translators: %s: entity type.
8 (0,i.__)("Select %s(s)","content-control"),a.replace(/_/g," ").toLowerCase()),...u,tokenOnComma:!0,value:b,onInputChange:h,onChange:e=>{const t=e.map((e=>parseInt(S(e),10))).filter((e=>!isNaN(e)));o(s?t:t[0])},renderToken:e=>{const t=E(S(e));return t?"postType"===r?t.title.rendered:t.name:S(e)},renderSuggestion:t=>{const n=E(t);return n?(0,e.createElement)(e.Fragment,null,"postType"===r?n.title.rendered:n.name):t},suggestions:f?f.map((e=>{var t;return null!==(t=e?.id.toString())&&void 0!==t&&t})):[]}))},S=window.lodash,_=window.contentControl.coreData,C=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(h.Path,{d:"M12 3.3c-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.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"})),k=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(h.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),y=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(h.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"})),x=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,e.createElement)(h.Path,{d:"M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z"})),N=(0,e.forwardRef)((({icon:t,title:n,info:o,type:c,className:a,isSelected:s,onFocus:i=m.noop,onSelect:u=m.noop,...p},d)=>(0,e.createElement)(r.Button,{type:"button",className:l()(["suggestion",s&&"is-selected",a]),ref:d,onClick:u,onFocus:i,onMouseOver:i,"aria-selected":s,role:"option",tabIndex:-1,...p},t&&(0,e.createElement)(r.Icon,{icon:t,className:"suggestion-item-icon"}),(0,e.createElement)("span",{className:"suggestion-item-header"},(0,e.createElement)("span",{className:"suggestion-item-title"},n),o&&(0,e.createElement)("span",{"aria-hidden":"true",className:"suggestion-item-info"},o)),c&&(0,e.createElement)("span",{className:"suggestion-item-type"},c))));const I={id:-1,title:"",url:"",type:(0,i.__)("URL","content-control")},R=({label:t,value:n,onChange:o=(()=>{}),className:a=""},s)=>{var u,m;const p=(0,c.useInstanceId)(R),g=(0,e.useRef)(null),h=(0,e.useRef)(null),v=(0,e.useRef)(null),f=(0,e.useRef)(null),E=(0,e.useRef)(null),w=(0,e.useRef)([]);(0,e.useImperativeHandle)(s,(()=>v.current),[v]);const b="string"==typeof n?{...I,url:n}:null!=n?n:I,$={value:b,query:null!==(u=b.url)&&void 0!==u?u:"",isEditing:!1,isFocused:!1,selected:-1,showSuggestions:!1},[O,F]=(0,e.useState)($),{value:T,query:B,isFocused:L,isEditing:D,selected:M,showSuggestions:A}=O,P=`url-input-control-${p}`,z=`url-input-control-suggestions-${p}`,V=`url-input-${p}-sug-`,{unfilteredSuggestions:j,isFetchingSuggestions:H}=(0,d.useSelect)((e=>({unfilteredSuggestions:e(_.urlSearchStore).getSuggestions(),isFetchingSuggestions:e(_.urlSearchStore).isDispatching("updateSuggestions")})),[]),{updateSuggestions:U}=(0,d.useDispatch)(_.urlSearchStore),G=(0,S.debounce)(U,200,{leading:!0}),q=e=>F({...O,selected:e}),K=e=>{const t={...O,value:{...T,...e},query:"",isEditing:!1,isFocused:!0,selected:-1,showSuggestions:!1};F(t)};(0,e.useEffect)((()=>{b.url!==T.url&&o(T)}),[T,b.url,o]),(0,e.useEffect)((()=>{L&&(D?v.current?.focus():E.current?.focus())}),[D,L]);const Z=(0,e.useMemo)((()=>j.filter(((e,t)=>j.findIndex((t=>e.id===t.id))===t))),[j]).slice(0,10),W=Z.length,J=M>W?0:M,Q={up:()=>F({...O,showSuggestions:0===B.length&&!A||A,selected:(0,S.clamp)(J-1>=0?J-1:W,0,W)}),down:()=>{F({...O,showSuggestions:0===B.length&&!A||A,selected:(0,S.clamp)(J+1<=W?J+1:0,0,W)})},"alt+down":()=>F({...O,showSuggestions:!0}),enter:e=>{e.preventDefault(),A&&J>-1&&J!==W?K(Z[J]):T.url===B?F({...O,isEditing:!1,query:"",showSuggestions:!1,selected:-1}):K({title:(0,i.__)("Custom URL","content-control"),type:"URL",url:B})},escape:e=>{e.preventDefault(),e.stopPropagation(),F({...O,selected:-1,showSuggestions:!1})}};return(0,e.createElement)(r.BaseControl,{id:P,label:t,className:l()(["components-url-control",L&&"is-focused",a])},(0,e.createElement)("div",{ref:g,onFocus:()=>{F({...O,isFocused:!0,showSuggestions:B.length>=1})},onBlur:e=>{if(!g.current?.contains(e.relatedTarget)&&!f.current?.contains(e.relatedTarget)){const e={...O,selected:-1,isFocused:!1,showSuggestions:!1};D&&(e.isEditing=!1,e.value=M>-1?Z[M]:{title:(0,i.__)("Custom URL"),type:"URL",url:B}),F(e)}}},!D&&b.url.length>0?(0,e.createElement)("div",{className:"suggestion"},(0,e.createElement)(r.Icon,{icon:C,className:"suggestion-item-icon"}),(0,e.createElement)("span",{className:"suggestion-item-header"},(0,e.createElement)("span",{className:"suggestion-item-title"},(0,e.createElement)(e.Fragment,null,null!==(m=T?.title)&&void 0!==m?m:T?.url)),(0,e.createElement)("span",{"aria-hidden":"true",className:"suggestion-item-info"},T.url)),(0,e.createElement)(r.Button,{"aria-label":(0,i.__)("Edit","content-control"),icon:k,onClick:()=>{F({...O,isEditing:!0,isFocused:!0,query:b.url})},ref:E})):(0,e.createElement)(r.KeyboardShortcuts,{shortcuts:Q},(0,e.createElement)("div",{className:l()(["url-control-wrapper"]),ref:h},(0,e.createElement)("div",{className:"url-control"},(0,e.createElement)(r.Icon,{icon:y,className:"url-control__input-icon"}),(0,e.createElement)("input",{id:P,className:"url-control__input",ref:v,type:"text",role:"combobox",placeholder:(0,i.__)("Search or type url","content-control"),value:B,onChange:e=>{return t=e.target.value,F({...O,query:t,showSuggestions:t.length>=1}),void G(t.trim(),{type:["post","term"]});var t},autoComplete:"off","aria-autocomplete":"list","aria-controls":z,"aria-expanded":A,"aria-activedescendant":J>=0?`${V}-${J}`:void 0,"aria-label":t?void 0:(0,i.__)("URL")}),(0,e.createElement)("div",{className:"url-control__actions"},H&&(0,e.createElement)(r.Spinner,null),(0,e.createElement)(r.Button,{icon:x,iconSize:30,onClick:()=>K({title:(0,i.__)("Custom URL","content-control"),type:"URL",url:B})}))),A&&Z.length>0&&(0,e.createElement)(r.Popover,{ref:f,focusOnMount:!1,onClose:()=>q(-1),position:"bottom right",anchor:h.current,className:"suggestions-popover"},(0,e.createElement)("div",{className:"suggestions",id:z,role:"listbox"},Z.map(((t,n)=>(0,e.createElement)(N,{key:t.id,id:`${V}-${n}`,title:t.title,info:t.url,type:t.type,isSelected:n===J,onSelect:()=>K(t),onFocus:()=>q(n),ref:e=>{w.current[n]=e}}))),B.length>0&&(0,e.createElement)(N,{key:"use-current-input-text",id:`${V}-${W}`,icon:C,title:B,info:(0,i.__)("Press ENTER to add this link","content-control"),type:(0,i.__)("URL","content-control"),className:"is-url",isSelected:W===J,onSelect:()=>K({title:(0,i.__)("Custom URL","content-control"),type:"URL",url:B}),onFocus:()=>{q(W)},ref:e=>{w.current[W]=e}})))))))};var $=(0,e.forwardRef)(R),O=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(h.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})),F=(0,e.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(h.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"}));function T(t,n,o){const[l,r]=(0,e.useState)(t||n),c=(0,e.useRef)(void 0!==t),a=c.current,s=void 0!==t,i=(0,e.useRef)(l);a!==s&&console.warn(`WARN: A component changed from ${a?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}.`),c.current=s;const u=(0,e.useCallback)(((e,...t)=>{const n=(e,...t)=>{o&&(Object.is(i.current,e)||o(e,...t)),s||(i.current=e)};"function"==typeof e?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),r(((o,...l)=>{const r=e(s?i.current:o,...l);return n(r,...t),s?o:r}))):(s||r(e),n(e,...t))}),[s,o]);return s?i.current=t:t=l,[t,u]}const B=({heading:t=!1,children:n,...o})=>t?(0,e.createElement)("th",{...o},n):(0,e.createElement)("td",{...o},n);var L=({items:t,columns:n,sortableColumns:o=[],idCol:c="id",rowClasses:a=(e=>[`item-${e.id}`]),renderCell:s=((e,t)=>t[e]),noItemsText:u=(0,i.__)("No items found.","content-control"),showBulkSelect:m=!0,className:p,selectedItems:d=[],onSelectItems:g=(()=>{})})=>{var h;const v={[c]:null!==(h=n[c])&&void 0!==h?h:"",...n},f=Object.keys(v).length,[E,w]=T(d,[],g),[b,S]=(0,e.useState)(o.length?o[0]:null),[_,C]=(0,e.useState)("ASC");(0,e.useEffect)((()=>{g(E)}),[E,g]);const k=b?t.sort(((e,t)=>"ASC"===_?e[b]>t[b]?1:-1:t[b]>e[b]?1:-1)):t,y=({header:n=!1})=>(0,e.createElement)(e.Fragment,null,Object.entries(v).map((([a,s])=>{const i=m&&a===c,u=a===b,p=!i&&o.indexOf(a)>=0,d={key:a,heading:!i,id:n&&!i?a:void 0,scope:i?void 0:"col",className:l()([`column-${a}`,...!i&&p?["sortable",_.toLowerCase()]:[],i&&"check-column"])},g=()=>(0,e.createElement)(e.Fragment,null,"function"==typeof s?s():(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",null,s),u&&(0,e.createElement)(r.Icon,{icon:"ASC"===_?O:F,size:16})));return(0,e.createElement)(B,{...d,key:a},i&&(0,e.createElement)(r.CheckboxControl,{onChange:e=>w(e?t.map((e=>e.id)):[]),checked:E.length>0&&E.length===t.length,indeterminate:E.length>0&&E.length<t.length}),!i&&p&&(0,e.createElement)(r.Button,{variant:"link",onClick:()=>{b===a?C("ASC"===_?"DESC":"ASC"):(S(a),C("ASC"))}},(0,e.createElement)(g,null)),!i&&!p&&(0,e.createElement)(g,null))})));return(0,e.createElement)("table",{className:l()([p,"component-list-table","list-table",0===k.length&&"no-items"])},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)(y,{header:!0}))),(0,e.createElement)("tbody",null,k.length?k.map(((t,n)=>(0,e.createElement)("tr",{key:t.id,className:l()(a(t))},Object.entries(v).map((([o])=>{const a=o===c;return(0,e.createElement)(B,{key:o,heading:a,className:l()([`column-${o}`,m&&a&&"check-column"]),scope:a?"row":void 0},a?(0,e.createElement)(r.CheckboxControl,{onChange:e=>{const n=e?[...E,t.id]:E.filter((e=>e!==t.id));w(n)},checked:E.indexOf(t.id)>=0}):s(o,t,n))}))))):(0,e.createElement)("tr",null,(0,e.createElement)("td",{colSpan:f},u))),(0,e.createElement)("tfoot",null,(0,e.createElement)("tr",null,(0,e.createElement)(y,null))))},D=t=>{const{text:n="",highlight:o=""}=t,l=(Array.isArray(o)?o:[o]).map((e=>e.trim())).filter((e=>!!e)).map((e=>(0,S.escapeRegExp)(e)));if(!l.length)return(0,e.createElement)(e.Fragment,null,n);const r=new RegExp(`(${l.join("|")})`,"gi");return(0,e.createInterpolateElement)(n.replace(r,"<mark>$&</mark>"),{mark:(0,e.createElement)("mark",null)})};const M=({label:t,value:n,onChange:o,className:a,options:s=[],orientation:i="horizontal",equalWidth:u=!1,spacing:m})=>{const p=(0,c.useInstanceId)(M);return(0,e.createElement)(r.BaseControl,{id:`radio-button-control-${p}`,label:t,className:l()("components-radio-button-control",i,u&&"equal-width",a)},(0,e.createElement)("div",{className:"options",style:m?{gap:`${m}px`}:void 0},s.map((({label:t,value:l})=>(0,e.createElement)(r.Button,{key:l,variant:l===n?"primary":"secondary",onClick:()=>o(l)},t)))))};var A=M,P=(0,e.createElement)(h.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(h.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),z=(0,e.createElement)(h.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(h.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));const V=({label:t="",placeholder:n="",searchIcon:o,value:a=[],options:s=[],onChange:u=(()=>{}),className:m=""})=>{const p=(0,c.useInstanceId)(V),[d,g]=(0,e.useState)(""),[h,v]=(0,e.useState)("ASC"),f=e=>-1!==a.indexOf(e),E=e=>u(f(e)?[...a.filter((t=>t!==e))]:[...a,e]),w=s.filter((({label:e,value:t,keywords:n})=>e.includes(d)||"string"==typeof t&&t.includes(d)||n&&n.includes(d))),b=w.sort(((e,t)=>"ASC"===h?e.label>t.label?1:-1:t.label>e.label?1:-1));return(0,e.createElement)(r.BaseControl,{id:`searchable-multicheck-control-${p}`,label:t,className:l()(["component-searchable-multicheck-control",m])},(0,e.createElement)("div",{className:"select-actions"},(0,e.createElement)(r.Button,{variant:"link",text:(0,i.__)("Select All","content-control"),onClick:()=>{const e=w.map((({value:e})=>e)),t=[...a,...e];u([...new Set(t)])}}),(0,e.createElement)(r.Button,{variant:"link",text:(0,i.__)("Deselect All","content-control"),onClick:()=>{const e=w.map((({value:e})=>e)),t=[...a.filter((t=>-1===e.indexOf(t)))];u([...new Set(t)])}})),(0,e.createElement)("div",{className:l()([o?"icon-input":null])},(0,e.createElement)("input",{type:"text",className:"components-text-control__input",placeholder:n,value:d,onChange:e=>g(e.target.value)}),o&&(0,e.createElement)(r.Icon,{icon:o})),(0,e.createElement)("table",null,(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",{className:"label-column"},(0,e.createElement)(r.Button,{text:(0,i.__)("Name","content-control"),onClick:()=>v("DESC"===h?"ASC":"DESC"),icon:"DESC"===h?P:z,iconPosition:"right"})),(0,e.createElement)("td",{className:"cb-column"}))),(0,e.createElement)("tbody",null,b.map((({label:t,value:n})=>(0,e.createElement)("tr",{key:n.toString()},(0,e.createElement)("td",null,(0,e.createElement)("span",{role:"button",tabIndex:-1,onClick:()=>E(n),onKeyDown:()=>{}},t)),(0,e.createElement)("th",{className:"cb-column"},(0,e.createElement)(r.CheckboxControl,{checked:f(n),onChange:()=>E(n)}))))))))};var j=V}(),(window.contentControl=window.contentControl||{}).components=o}();