← Back
Editing: settings-ui.js
(()=>{var e,t,n,i={20:(e,t,n)=>{"use strict";var i=n(609),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var i,s={},c=null,u=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,i)&&!a.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===s[i]&&(s[i]=t[i]);return{$$typeof:r,type:e,key:c,ref:u,props:s,_owner:l.current}}t.Fragment=s,t.jsx=c,t.jsxs=c},493:(e,t,n)=>{"use strict";var i=n(609),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useState,o=i.useEffect,l=i.useLayoutEffect,a=i.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=s({inst:{value:n,getSnapshot:t}}),r=i[0].inst,u=i[1];return l(function(){r.value=n,r.getSnapshot=t,c(r)&&u({inst:r})},[e,n,t]),o(function(){return c(r)&&u({inst:r}),e(function(){c(r)&&u({inst:r})})},[e]),a(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},506:(e,t,n)=>{"use strict";const i=window.wp.components,r=window.wp.element;var s=n(848);const o=({field:e,value:t,onChange:n})=>{const o=(0,r.useMemo)(()=>(e=>{const t=e&&e.customAttributes?e.customAttributes["data-descriptions"]:void 0;if(!t)return{};if("object"==typeof t)return t;try{const e=JSON.parse(t);return e&&"object"==typeof e?e:{}}catch(e){return{}}})(e),[e]),l=null==t?"":String(t),a=(c=o[l]||e.description||"")?(0,s.jsx)("span",{dangerouslySetInnerHTML:{__html:c}}):void 0;var c;return(0,s.jsx)(i.SelectControl,{className:"wc-settings-ui__control",label:e.label,help:a,value:l,options:e.options||[],disabled:e.disabled,onChange:n,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})},l=({field:e})=>(0,s.jsx)("h4",{className:"woocommerce-subscriptions-settings__subheading",children:e.label}),a=window.wp.primitives,c=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z"})}),u=({field:e})=>(0,s.jsxs)("p",{className:"woocommerce-subscriptions-settings__field-error",role:"alert",children:[(0,s.jsx)(i.Icon,{className:"woocommerce-subscriptions-settings__field-error-icon",icon:c,size:20}),e.label]}),d=window.wp.i18n,m=e=>Math.abs(Math.trunc(Number(e))),p=window.wp.compose,f=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),v=window.wp.apiFetch;var _=n.n(v);const g=(0,r.createContext)(null),b=async(e,t)=>{try{const n=await e();if(n.success){const e={success:!0,message:n.message};return void 0!==n.data&&(e.data=n.data),e}throw new Error(n.message||t)}catch(e){return{success:!1,error:e.message||t,details:e.data?.details||{}}}};function h({children:e,productId:t=null}){const n=!!t,[i,o]=(0,r.useState)("simple");(0,r.useEffect)(()=>{if(n){const e=document.getElementById("wcsatt-product-plans-root");if(e){const t=e.getAttribute("data-product-type")||"simple";o(t)}}},[n]);const l=n?{title:(0,d.__)("Subscription plans for this product","woocommerce-subscriptions"),addButtonText:(0,d.__)("Add subscription plan","woocommerce-subscriptions"),modalTitle:(0,d.__)("Add custom subscription plan","woocommerce-subscriptions"),modalTitleEdit:(0,d.__)("Edit custom subscription plan","woocommerce-subscriptions"),emptyStateMessage:(0,d.__)("No custom subscription plans","woocommerce-subscriptions")}:{title:(0,d.__)("Storewide Subscription Plans","woocommerce-subscriptions"),addButtonText:(0,d.__)("Add subscription plan","woocommerce-subscriptions"),modalTitle:(0,d.__)("Add subscription plan","woocommerce-subscriptions"),modalTitleEdit:(0,d.__)("Edit subscription plan","woocommerce-subscriptions"),emptyStateMessage:(0,d.__)("No storewide subscription plans","woocommerce-subscriptions")},[a,c]=(0,r.useState)(null);(0,r.useEffect)(()=>{const e=n?window.wcsatt_product_plans:window.wcsatt_admin_params;if(e&&(e.plans||e.storewide_plans)){const t=n?e.plans:e.storewide_plans;c(Array.isArray(t)?t:[])}else c([])},[n]);const u=(0,r.useCallback)(async e=>{const i=n?`/wc/v3/products/${t}/subscription-plans`:"/wc/v3/subscriptions/storewide-plans",r=await b(()=>_()({path:i,method:"POST",data:e}),(0,d.__)("Unable to save the plan. Please try again.","woocommerce-subscriptions"));return r.success&&c(e=>[...e,r.data]),r},[n,t]),m=(0,r.useCallback)(async(e,i)=>{const r=n?`/wc/v3/products/${t}/subscription-plans/${e}`:`/wc/v3/subscriptions/storewide-plans/${e}`,s=await b(()=>_()({path:r,method:"PUT",data:i}),(0,d.__)("Unable to update the plan. Please try again.","woocommerce-subscriptions"));return s.success&&c(t=>t.map(t=>t.id===e?s.data:t)),s},[n,t]),p=(0,r.useCallback)(async e=>{const i=n?`/wc/v3/products/${t}/subscription-plans/${e}`:`/wc/v3/subscriptions/storewide-plans/${e}`,r=await b(()=>_()({path:i,method:"DELETE"}),(0,d.__)("Unable to delete the plan. Please try again.","woocommerce-subscriptions"));return r.success&&c(t=>t.filter(t=>t.id!==e)),r},[n,t]),f=(0,r.useCallback)(async e=>{const i=a;c(e);const r=e.map(e=>e.id),s=n?`/wc/v3/products/${t}/subscription-plans/reorder`:"/wc/v3/subscriptions/storewide-plans/reorder",o=await b(()=>_()({path:s,method:"PUT",data:{plan_ids:r}}),(0,d.__)("Unable to save your changes. Please try again.","woocommerce-subscriptions"));return o.success||c(i),o},[a,n,t]),v={labels:l,productId:t,productType:i,isProductContext:n,plans:a,addPlan:u,updatePlan:m,deletePlan:p,reorderPlans:f};return(0,s.jsx)(g.Provider,{value:v,children:e})}function w(){const e=(0,r.useContext)(g);if(!e)throw new Error("usePlanContext must be used within a PlanContextProvider");return e}const x=window.wp.data,y=window.wp.notices,j=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),C=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),S=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),I=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),E=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),k=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.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"})}),V="is",P="isNot",N="isAny",M="isNone",F="isAll",O="isNotAll",A=[V,P,N,M,F,O],D={[V]:{key:"is-filter",label:(0,d.__)("Is")},[P]:{key:"is-not-filter",label:(0,d.__)("Is not")},[N]:{key:"is-any-filter",label:(0,d.__)("Is any")},[M]:{key:"is-none-filter",label:(0,d.__)("Is none")},[F]:{key:"is-all-filter",label:(0,d.__)("Is all")},[O]:{key:"is-not-all-filter",label:(0,d.__)("Is not all")}},T=["asc","desc"],B={asc:"↑",desc:"↓"},L={asc:"ascending",desc:"descending"},R={asc:(0,d.__)("Sort ascending"),desc:(0,d.__)("Sort descending")},z={asc:E,desc:k},H="table",$="grid",W=(0,r.createContext)({view:{type:H},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,containerWidth:0}),U=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})});function K(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=K(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}const G=function(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=K(e))&&(i&&(i+=" "),i+=t);return i},q=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});function Y(...e){}function Z(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function X(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function J(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Q(e){return e}function ee(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function te(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function ne(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function ie(...e){for(const t of e)if(void 0!==t)return t}var re=n(609),se=n.t(re,2);function oe(e,t){"function"==typeof e?e(t):e&&(e.current=t)}var le,ae="undefined"!=typeof window&&!!(null==(le=window.document)?void 0:le.createElement);function ce(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function ue(e,t=!1){var n;const{activeElement:i}=ce(e);if(!(null==i?void 0:i.nodeName))return null;if("IFRAME"===i.tagName&&(null==(n=i.contentDocument)?void 0:n.body))return ue(i.contentDocument.body,t);if(t){const e=i.getAttribute("aria-activedescendant");if(e){const t=ce(i).getElementById(e);if(t)return t}}return i}function de(e,t){return e===t||e.contains(t)}function me(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==pe.indexOf(e.type)}var pe=["button","color","file","image","reset","submit"];function fe(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function ve(e){return e.isContentEditable||fe(e)}function _e(e){let t=0,n=0;if(fe(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const i=ce(e).getSelection();if((null==i?void 0:i.rangeCount)&&i.anchorNode&&de(e,i.anchorNode)&&i.focusNode&&de(e,i.focusNode)){const r=i.getRangeAt(0),s=r.cloneRange();s.selectNodeContents(e),s.setEnd(r.startContainer,r.startOffset),t=s.toString().length,s.setEnd(r.endContainer,r.endOffset),n=s.toString().length}}return{start:t,end:n}}function ge(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function be(e){if(!e)return null;const t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:n}=getComputedStyle(e);if(t(n))return e}return be(e.parentElement)||document.scrollingElement||document.body}function he(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function we(){return!!ae&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function xe(){return ae&&we()&&/apple/i.test(navigator.vendor)}function ye(e){return e.target===e.currentTarget}function je(e,t){const n=new FocusEvent("blur",t),i=e.dispatchEvent(n),r={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent("focusout",r)),i}function Ce(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function Se(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return!i||!de(n,i)}function Ie(e,t,n,i){const r=(e=>{if(i){const t=setTimeout(e,i);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,s,!0),n()}),s=()=>{r(),n()};return e.addEventListener(t,s,{once:!0,capture:!0}),r}function Ee(e,t,n,i=window){const r=[];try{i.document.addEventListener(e,t,n);for(const s of Array.from(i.frames))r.push(Ee(e,t,n,s))}catch{}return()=>{try{i.document.removeEventListener(e,t,n)}catch{}for(const e of r)e()}}var ke={...se},Ve=ke.useId,Pe=(ke.useDeferredValue,ke.useInsertionEffect),Ne=ae?re.useLayoutEffect:re.useEffect;function Me(e){const t=(0,re.useRef)(()=>{throw new Error("Cannot call an event handler while rendering.")});return Pe?Pe(()=>{t.current=e}):t.current=e,(0,re.useCallback)((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}function Fe(...e){return(0,re.useMemo)(()=>{if(e.some(Boolean))return t=>{for(const n of e)oe(n,t)}},e)}function Oe(e){if(Ve){const t=Ve();return e||t}const[t,n]=(0,re.useState)(e);return Ne(()=>{if(e||t)return;const i=Math.random().toString(36).slice(2,8);n(`id-${i}`)},[e,t]),e||t}function Ae(e,t){const n=(0,re.useRef)(!1);(0,re.useEffect)(()=>{if(n.current)return e();n.current=!0},t),(0,re.useEffect)(()=>()=>{n.current=!1},[])}function De(e){return Me("function"==typeof e?e:()=>e)}function Te(e,t,n=[]){const i=(0,re.useCallback)(n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n)),[...n,e.wrapElement]);return{...e,wrapElement:i}}function Be(e,t,n){const i=e.onLoadedMetadataCapture,r=(0,re.useMemo)(()=>Object.assign(()=>{},i,...void 0!==n?[{[t]:n}]:[]),[i,t,n]);return[null==i?void 0:i[t],{onLoadedMetadataCapture:r}]}var Le=!1,Re=!1,ze=0,He=0;function $e(e){(function(e){const t=e.movementX||e.screenX-ze,n=e.movementY||e.screenY-He;return ze=e.screenX,He=e.screenY,t||n||!1})(e)&&(Re=!0)}function We(){Re=!1}function Ue(e){const t=re.forwardRef((t,n)=>e({...t,ref:n}));return t.displayName=e.displayName||e.name,t}function Ke(e,t){return re.memo(e,t)}function Ge(e,t){const{wrapElement:n,render:i,...r}=t,o=Fe(t.ref,function(e){return function(e){return!!e&&!!(0,re.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e)?{...e.props}.ref||e.ref:null}(i));let l;if(re.isValidElement(i)){const e={...i.props,ref:o};l=re.cloneElement(i,function(e,t){const n={...e};for(const i in t){if(!Z(t,i))continue;if("className"===i){const i="className",r=e[i],s=t[i];n[i]=r&&s?`${r} ${s}`:s||r;continue}if("style"===i){const i="style";n[i]=e[i]?{...e[i],...t[i]}:t[i];continue}const r=t[i];if(i.startsWith("on")){if("function"!=typeof r)continue;const t=e[i];if("function"==typeof t){n[i]=(...e)=>{r(...e),t(...e)};continue}}n[i]=r}return n}(r,e))}else l=i?i(r):(0,s.jsx)(e,{...r});return n?n(l):l}function qe(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function Ye(e=[],t=[]){const n=re.createContext(void 0),i=re.createContext(void 0),r=()=>re.useContext(n),o=t=>e.reduceRight((e,n)=>(0,s.jsx)(n,{...t,children:e}),(0,s.jsx)(n.Provider,{...t}));return{context:n,scopedContext:i,useContext:r,useScopedContext:(e=!1)=>{const t=re.useContext(i),n=r();return e?t:t||n},useProviderContext:()=>{const e=re.useContext(i),t=r();if(!e||e!==t)return t},ContextProvider:o,ScopedContextProvider:e=>(0,s.jsx)(o,{...e,children:t.reduceRight((t,n)=>(0,s.jsx)(n,{...e,children:t}),(0,s.jsx)(i.Provider,{...e}))})}}var Ze=Ye(),Xe=Ze.useContext,Je=(Ze.useScopedContext,Ze.useProviderContext,Ye([Ze.ContextProvider],[Ze.ScopedContextProvider])),Qe=Je.useContext,et=(Je.useScopedContext,Je.useProviderContext),tt=Je.ContextProvider,nt=Je.ScopedContextProvider,it=(0,re.createContext)(void 0),rt=(0,re.createContext)(void 0),st=((0,re.createContext)(null),(0,re.createContext)(null),Ye([tt],[nt])),ot=st.useContext;function lt(e,t){const n=e.__unstableInternals;return ee(n,"Invalid store"),n[t]}function at(e,...t){let n=e,i=n,r=Symbol(),s=Y;const o=new Set,l=new Set,a=new Set,c=new Set,u=new Set,d=new WeakMap,m=new WeakMap,p=(e,t,n=c)=>(n.add(t),m.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),m.delete(t),n.delete(t)}),f=(e,s,o=!1)=>{var a;if(!Z(n,e))return;const p=(f=s,v=n[e],function(e){return"function"==typeof e}(f)?f(function(e){return"function"==typeof e}(v)?v():v):f);var f,v;if(p===n[e])return;if(!o)for(const n of t)null==(a=null==n?void 0:n.setState)||a.call(n,e,p);const _=n;n={...n,[e]:p};const g=Symbol();r=g,l.add(e);const b=(t,i,r)=>{var s;const o=m.get(t);o&&!o.some(t=>r?r.has(t):t===e)||(null==(s=d.get(t))||s(),d.set(t,t(n,i)))};for(const e of c)b(e,_);queueMicrotask(()=>{if(r!==g)return;const e=n;for(const e of u)b(e,i,l);i=e,l.clear()})},v={getState:()=>n,setState:f,__unstableInternals:{setup:e=>(a.add(e),()=>a.delete(e)),init:()=>{const e=o.size,i=Symbol();o.add(i);const r=()=>{o.delete(i),o.size||s()};if(e)return r;const l=(c=n,Object.keys(c)).map(e=>X(...t.map(t=>{var n;const i=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(i&&Z(i,e))return mt(t,[e],t=>{f(e,t[e],!0)})})));var c;const u=[];for(const e of a)u.push(e());const d=t.map(ut);return s=X(...l,...u,...d),r},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(d.set(t,t(n,n)),p(e,t)),batch:(e,t)=>(d.set(t,t(n,i)),p(e,t,u)),pick:e=>at(function(e,t){const n={};for(const i of t)Z(e,i)&&(n[i]=e[i]);return n}(n,e),v),omit:e=>at(function(e,t){const n={...e};for(const e of t)Z(n,e)&&delete n[e];return n}(n,e),v)}};return v}function ct(e,...t){if(e)return lt(e,"setup")(...t)}function ut(e,...t){if(e)return lt(e,"init")(...t)}function dt(e,...t){if(e)return lt(e,"subscribe")(...t)}function mt(e,...t){if(e)return lt(e,"sync")(...t)}function pt(e,...t){if(e)return lt(e,"batch")(...t)}function ft(e,...t){if(e)return lt(e,"omit")(...t)}function vt(...e){var t;const n={};for(const i of e){const e=null==(t=null==i?void 0:i.getState)?void 0:t.call(i);e&&Object.assign(n,e)}const i=at(n,...e);return Object.assign({},...e,i)}st.useScopedContext,st.useProviderContext,st.ContextProvider,st.ScopedContextProvider;var _t=n(888);function gt(e,t=Q){const n=re.useCallback(t=>e?dt(e,null,t):()=>{},[e]),i=()=>{const n="string"==typeof t?t:null,i="function"==typeof t?t:null,r=null==e?void 0:e.getState();return i?i(r):r&&n&&Z(r,n)?r[n]:void 0};return(0,_t.useSyncExternalStore)(n,i,i)}function bt(e,t){const n=re.useRef({}),i=re.useCallback(t=>e?dt(e,null,t):()=>{},[e]),r=()=>{const i=null==e?void 0:e.getState();let r=!1;const s=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(i);t!==s[e]&&(s[e]=t,r=!0)}if("string"==typeof n){if(!i)continue;if(!Z(i,n))continue;const t=i[n];t!==s[e]&&(s[e]=t,r=!0)}}return r&&(n.current={...s}),n.current};return(0,_t.useSyncExternalStore)(i,r,r)}function ht(e,t,n,i){const r=Z(t,n)?t[n]:void 0,s=i?t[i]:void 0,o=function(e){const t=(0,re.useRef)(e);return Ne(()=>{t.current=e}),t}({value:r,setValue:s});Ne(()=>mt(e,[n],(e,t)=>{const{value:i,setValue:r}=o.current;r&&e[n]!==t[n]&&e[n]!==i&&r(e[n])}),[e,n]),Ne(()=>{if(void 0!==r)return e.setState(n,r),pt(e,[n],()=>{void 0!==r&&e.setState(n,r)})})}function wt(e,t,n){return function(e,t,n){return Ae(t,[n.store,n.disclosure]),ht(e,n,"open","setOpen"),ht(e,n,"mounted","setMounted"),ht(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}(e,t,n)}function xt(e,t,n){return ht(e=function(e,t,n){return Ae(t,[n.store]),ht(e,n,"items","setItems"),e}(e,t,n),n,"activeId","setActiveId"),ht(e,n,"includesBaseElement"),ht(e,n,"virtualFocus"),ht(e,n,"orientation"),ht(e,n,"rtl"),ht(e,n,"focusLoop"),ht(e,n,"focusWrap"),ht(e,n,"focusShift"),e}function yt(e){const t=[];for(const n of e)t.push(...n);return t}function jt(e){return e.slice().reverse()}function Ct(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),i=ie(e.items,null==n?void 0:n.items,e.defaultItems,[]),r=new Map(i.map(e=>[e.id,e])),s={items:i,renderedItems:ie(null==n?void 0:n.renderedItems,[])},o=null==(l=e.store)?void 0:l.__unstablePrivateStore;var l;const a=at({items:i,renderedItems:s.renderedItems},o),c=at(s,e.store),u=e=>{const t=function(e,t){const n=e.map((e,t)=>[t,e]);let i=!1;return n.sort(([e,n],[r,s])=>{const o=t(n),l=t(s);return o===l?0:o&&l?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(o,l)?(e>r&&(i=!0),-1):(e<r&&(i=!0),1):0}),i?n.map(([e,t])=>t):e}(e,e=>e.element);a.setState("renderedItems",t),c.setState("renderedItems",t)};ct(c,()=>ut(a)),ct(a,()=>pt(a,["items"],e=>{c.setState("items",e.items)})),ct(a,()=>pt(a,["renderedItems"],e=>{let t=!0,n=requestAnimationFrame(()=>{const{renderedItems:t}=c.getState();e.renderedItems!==t&&u(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const i=function(e){var t,n;const i=e.find(e=>!!e.element),r=null==(t=[...e].reverse().find(e=>!!e.element))?void 0:t.element;let s=null==(n=null==i?void 0:i.element)?void 0:n.parentElement;if(!r)return ce(s).body;for(;s;){if(s.contains(r))return s;s=s.parentElement}return ce(s).body}(e.renderedItems),r=new IntersectionObserver(()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame(()=>u(e.renderedItems)))},{root:i});for(const t of e.renderedItems)t.element&&r.observe(t.element);return()=>{cancelAnimationFrame(n),r.disconnect()}}));const d=(e,t,n=!1)=>{let i;return t(t=>{const n=t.findIndex(({id:t})=>t===e.id),s=t.slice();if(-1!==n){i=t[n];const o={...i,...e};s[n]=o,r.set(e.id,o)}else s.push(e),r.set(e.id,e);return s}),()=>{t(t=>{if(!i)return n&&r.delete(e.id),t.filter(({id:t})=>t!==e.id);const s=t.findIndex(({id:t})=>t===e.id);if(-1===s)return t;const o=t.slice();return o[s]=i,r.set(e.id,i),o})}},m=e=>d(e,e=>a.setState("items",e),!0);return{...c,registerItem:m,renderItem:e=>X(m(e),d(e,e=>a.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=r.get(e);if(!t){const{items:n}=a.getState();t=n.find(t=>t.id===e),t&&r.set(e,t)}return t||null},__unstablePrivateStore:a}}var St={id:null};function It(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function Et(e,t){return e.filter(e=>e.rowId===t)}function kt(e){const t=[];for(const n of e){const e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId});e?e.push(n):t.push([n])}return t}function Vt(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function Pt(e){return{id:"__EMPTY_ITEM__",disabled:!0,rowId:e}}var Nt=xe()&&ae&&!!navigator.maxTouchPoints;function Mt({tag:e,...t}={}){const n=vt(t.store,function(e,...t){if(e)return lt(e,"pick")(...t)}(e,["value","rtl"])),i=null==e?void 0:e.getState(),r=null==n?void 0:n.getState(),s=ie(t.activeId,null==r?void 0:r.activeId,t.defaultActiveId,null),o=function(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),i=Ct(e),r=ie(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),s=at({...i.getState(),id:ie(e.id,null==n?void 0:n.id)??`id-${Math.random().toString(36).slice(2,8)}`,activeId:r,baseElement:ie(null==n?void 0:n.baseElement,null),includesBaseElement:ie(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===r),moves:ie(null==n?void 0:n.moves,0),orientation:ie(e.orientation,null==n?void 0:n.orientation,"both"),rtl:ie(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:ie(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:ie(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:ie(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:ie(e.focusShift,null==n?void 0:n.focusShift,!1)},i,e.store);ct(s,()=>mt(s,["renderedItems","activeId"],e=>{s.setState("activeId",t=>{var n;return void 0!==t?t:null==(n=It(e.renderedItems))?void 0:n.id})}));const o=(e="next",t={})=>{var n,i;const r=s.getState(),{skip:o=0,activeId:l=r.activeId,focusShift:a=r.focusShift,focusLoop:c=r.focusLoop,focusWrap:u=r.focusWrap,includesBaseElement:d=r.includesBaseElement,renderedItems:m=r.renderedItems,rtl:p=r.rtl}=t,f="up"===e||"down"===e,v="next"===e||"down"===e,_=v?p&&!f:!p||f,g=a&&!o;let b=f?yt(function(e,t,n){const i=Vt(e);for(const r of e)for(let e=0;e<i;e+=1){const i=r[e];if(!i||n&&i.disabled){const i=0===e&&n?It(r):r[e-1];r[e]=i&&t!==i.id&&n?i:Pt(null==i?void 0:i.rowId)}}return e}(kt(m),l,g)):m;if(b=_?jt(b):b,b=f?function(e){const t=kt(e),n=Vt(t),i=[];for(let e=0;e<n;e+=1)for(const n of t){const t=n[e];t&&i.push({...t,rowId:t.rowId?`${e}`:void 0})}return i}(b):b,null==l)return null==(n=It(b))?void 0:n.id;const h=b.find(e=>e.id===l);if(!h)return null==(i=It(b))?void 0:i.id;const w=b.some(e=>e.rowId),x=b.indexOf(h),y=b.slice(x+1),j=Et(y,h.rowId);if(o){const e=function(e,t){return e.filter(e=>t?!e.disabled&&e.id!==t:!e.disabled)}(j,l),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}const C=c&&(f?"horizontal"!==c:"vertical"!==c),S=w&&u&&(f?"horizontal"!==u:"vertical"!==u),I=v?(!w||f)&&C&&d:!!f&&d;if(C){const e=function(e,t,n=!1){const i=e.findIndex(e=>e.id===t);return[...e.slice(i+1),...n?[St]:[],...e.slice(0,i)]}(S&&!I?b:Et(b,h.rowId),l,I),t=It(e,l);return null==t?void 0:t.id}if(S){const e=It(I?j:y,l);return I?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const E=It(j,l);return!E&&I?null:null==E?void 0:E.id};return{...i,...s,setBaseElement:e=>s.setState("baseElement",e),setActiveId:e=>s.setState("activeId",e),move:e=>{void 0!==e&&(s.setState("activeId",e),s.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=It(s.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=It(jt(s.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:s,includesBaseElement:ie(t.includesBaseElement,null==r?void 0:r.includesBaseElement,!0),orientation:ie(t.orientation,null==r?void 0:r.orientation,"vertical"),focusLoop:ie(t.focusLoop,null==r?void 0:r.focusLoop,!0),focusWrap:ie(t.focusWrap,null==r?void 0:r.focusWrap,!0),virtualFocus:ie(t.virtualFocus,null==r?void 0:r.virtualFocus,!0)}),l=function({popover:e,...t}={}){const n=vt(t.store,ft(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),i=null==n?void 0:n.getState(),r=function(e={}){return function(e={}){const t=vt(e.store,ft(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),i=ie(e.open,null==n?void 0:n.open,e.defaultOpen,!1),r=ie(e.animated,null==n?void 0:n.animated,!1),s=at({open:i,animated:r,animating:!!r&&i,mounted:i,contentElement:ie(null==n?void 0:n.contentElement,null),disclosureElement:ie(null==n?void 0:n.disclosureElement,null)},t);return ct(s,()=>mt(s,["animated","animating"],e=>{e.animated||s.setState("animating",!1)})),ct(s,()=>dt(s,["open"],()=>{s.getState().animated&&s.setState("animating",!0)})),ct(s,()=>mt(s,["open","animating"],e=>{s.setState("mounted",e.open||e.animating)})),{...s,disclosure:e.disclosure,setOpen:e=>s.setState("open",e),show:()=>s.setState("open",!0),hide:()=>s.setState("open",!1),toggle:()=>s.setState("open",e=>!e),stopAnimation:()=>s.setState("animating",!1),setContentElement:e=>s.setState("contentElement",e),setDisclosureElement:e=>s.setState("disclosureElement",e)}}(e)}({...t,store:n}),s=ie(t.placement,null==i?void 0:i.placement,"bottom"),o=at({...r.getState(),placement:s,currentPlacement:s,anchorElement:ie(null==i?void 0:i.anchorElement,null),popoverElement:ie(null==i?void 0:i.popoverElement,null),arrowElement:ie(null==i?void 0:i.arrowElement,null),rendered:Symbol("rendered")},r,n);return{...r,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:ie(t.placement,null==r?void 0:r.placement,"bottom-start")}),a=ie(t.value,null==r?void 0:r.value,t.defaultValue,""),c=ie(t.selectedValue,null==r?void 0:r.selectedValue,null==i?void 0:i.values,t.defaultSelectedValue,""),u=Array.isArray(c),d={...o.getState(),...l.getState(),value:a,selectedValue:c,resetValueOnSelect:ie(t.resetValueOnSelect,null==r?void 0:r.resetValueOnSelect,u),resetValueOnHide:ie(t.resetValueOnHide,null==r?void 0:r.resetValueOnHide,u&&!e),activeValue:null==r?void 0:r.activeValue},m=at(d,o,l,n);return Nt&&ct(m,()=>mt(m,["virtualFocus"],()=>{m.setState("virtualFocus",!1)})),ct(m,()=>{if(e)return X(mt(m,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),mt(e,["values"],e=>{m.setState("selectedValue",e.values)}))}),ct(m,()=>mt(m,["resetValueOnHide","mounted"],e=>{e.resetValueOnHide&&(e.mounted||m.setState("value",a))})),ct(m,()=>mt(m,["open"],e=>{e.open||(m.setState("activeId",s),m.setState("moves",0))})),ct(m,()=>mt(m,["moves","activeId"],(e,t)=>{e.moves===t.moves&&m.setState("activeValue",void 0)})),ct(m,()=>pt(m,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=m.getState(),i=o.item(n);m.setState("activeValue",null==i?void 0:i.value)})),{...l,...o,...m,tag:e,setValue:e=>m.setState("value",e),resetValue:()=>m.setState("value",d.value),setSelectedValue:e=>m.setState("selectedValue",e)}}function Ft(e={}){e=function(e){const t=ot();return function(e){return{id:Oe(e.id),...e}}(e={...e,tag:void 0!==e.tag?e.tag:t})}(e);const[t,n]=function(e,t){const[n,i]=re.useState(()=>e(t));Ne(()=>ut(n),[n]);const r=re.useCallback(e=>gt(n,e),[n]);return[re.useMemo(()=>({...n,useState:r}),[n,r]),Me(()=>{i(n=>e({...t,...n.getState()}))})]}(Mt,e);return function(e,t,n){return Ae(t,[n.tag]),ht(e,n,"value","setValue"),ht(e,n,"selectedValue","setSelectedValue"),ht(e,n,"resetValueOnHide"),ht(e,n,"resetValueOnSelect"),Object.assign(xt(function(e,t,n){return Ae(t,[n.popover]),ht(e,n,"placement"),wt(e,t,n)}(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var Ot=Ye(),At=(Ot.useContext,Ot.useScopedContext,Ot.useProviderContext),Dt=Ye([Ot.ContextProvider],[Ot.ScopedContextProvider]),Tt=(Dt.useContext,Dt.useScopedContext,Dt.useProviderContext,Dt.ContextProvider),Bt=Dt.ScopedContextProvider,Lt=((0,re.createContext)(void 0),(0,re.createContext)(void 0),Ye([Tt],[Bt])),Rt=(Lt.useContext,Lt.useScopedContext,Lt.useProviderContext),zt=Lt.ContextProvider,Ht=Lt.ScopedContextProvider,$t=(0,re.createContext)(void 0),Wt=Ye([zt,tt],[Ht,nt]),Ut=Wt.useContext,Kt=Wt.useScopedContext,Gt=Wt.useProviderContext,qt=Wt.ContextProvider,Yt=Wt.ScopedContextProvider,Zt=(0,re.createContext)(void 0),Xt=(0,re.createContext)(!1);function Jt(e={}){const t=Ft(e);return(0,s.jsx)(qt,{value:t,children:e.children})}var Qt=qe(function({store:e,...t}){const n=Gt();ee(e=e||n,!1);const i=gt(e,e=>{var t;return null==(t=e.baseElement)?void 0:t.id});return ne(t={htmlFor:i,...t})}),en=Ke(Ue(function(e){return Ge("label",Qt(e))}));function tn(e,t){return t&&e.item(t)||null}var nn=Symbol("FOCUS_SILENTLY");function rn(e,t,n){if(!t)return!1;if(t===n)return!1;const i=e.item(t.id);return!(!i||n&&i.element===n)}var sn=(0,re.createContext)(!0);function on(e){return!!e.matches("input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])")&&!!function(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!e.closest("[inert]")}function ln(e){const t=ue(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}var an=Symbol("accessibleWhenDisabled"),cn=xe(),un=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],dn=["button","color","file","image","reset","submit"];function mn({focusable:e,trulyDisabled:t,nativeTabbable:n,supportsDisabled:i,safariTabIndex:r,tabIndexProp:s}){return e?t?n&&!i?-1:void 0:n?r&&null==s?0:s:null!=s?s:0:s}function pn(e,t){return Me(n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())})}var fn=!1,vn=!0;function gn(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(vn=!1))}function bn(e){e.metaKey||e.ctrlKey||e.altKey||(vn=!0)}var hn=qe(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:n,onFocusVisible:i,...r}){const s=(0,re.useRef)(null),[o,l]=Be(r,an,t);null!=t||(t=o),(0,re.useEffect)(()=>{e&&(fn||(Ee("mousedown",gn,!0),Ee("keydown",bn,!0),fn=!0))},[e]);const a=e&&te(r),c=a&&!t,[u,d]=(0,re.useState)(!1);(0,re.useEffect)(()=>{e&&c&&u&&d(!1)},[e,c,u]),(0,re.useEffect)(()=>{if(!e)return;if(!u)return;const t=s.current;if(!t)return;if("undefined"==typeof IntersectionObserver)return;const n=new IntersectionObserver(()=>{on(t)||d(!1)});return n.observe(t),()=>n.disconnect()},[e,u]);const m=pn(r.onKeyPressCapture,a),p=pn(r.onMouseDownCapture,a),f=pn(r.onClickCapture,a),v=(t,n)=>{if(n&&(t.currentTarget=n),!e)return;const r=t.currentTarget;r&&ln(r)&&(null==i||i(t),t.defaultPrevented||(r.dataset.focusVisible="true",d(!0)))},_=r.onKeyDownCapture,g=Me(t=>{if(null==_||_(t),t.defaultPrevented)return;if(!e)return;if(u)return;if(t.metaKey)return;if(t.altKey)return;if(t.ctrlKey)return;if(!ye(t))return;const n=t.currentTarget;Ie(n,"focusout",()=>v(t,n))}),b=r.onFocusCapture,h=Me(t=>{if(null==b||b(t),t.defaultPrevented)return;if(!e)return;if(!ye(t))return void d(!1);const n=t.currentTarget;vn||function(e){const{tagName:t,readOnly:n,type:i}=e;return"TEXTAREA"===t&&!n||"SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable||!("combobox"!==e.getAttribute("role")||!e.dataset.name):un.includes(i))}(t.target)?Ie(t.target,"focusout",()=>v(t,n)):d(!1)}),w=r.onBlur,x=Me(t=>{null==w||w(t),e&&Se(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),d(!1))}),y=(0,re.useContext)(sn),j=Me(t=>{e&&n&&t&&y&&queueMicrotask(()=>{ln(t)||on(t)&&t.focus()})}),C=function(e,t){const n=e=>{if("string"==typeof e)return e},[i,r]=(0,re.useState)(()=>n(t));return Ne(()=>{const i=e&&"current"in e?e.current:e;r((null==i?void 0:i.tagName.toLowerCase())||n(t))},[e,t]),i}(s),S=e&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(C),I=e&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(C),[E,k]=(0,re.useState)(!1);cn&&(0,re.useEffect)(()=>{if(!e)return;const t=s.current;if(!t)return;const n=t.tagName.toLowerCase(),i=t.type;k(function(e,t){return"button"===e||!("input"!==e||!t)&&("checkbox"===t||"radio"===t||dn.includes(t))}(n,i))},[e]);const V=r.style,P=(0,re.useMemo)(()=>c?{pointerEvents:"none",...V}:V,[c,V]);return ne(r={"data-focus-visible":e&&u||void 0,"data-autofocus":n||void 0,"aria-disabled":a||void 0,...r,...l,ref:Fe(s,j,r.ref),style:P,tabIndex:mn({focusable:e,trulyDisabled:c,nativeTabbable:S,supportsDisabled:I,safariTabIndex:E,tabIndexProp:r.tabIndex}),disabled:!(!I||!c)||void 0,contentEditable:a?void 0:r.contentEditable,onKeyPressCapture:m,onClickCapture:f,onMouseDownCapture:p,onKeyDownCapture:g,onFocusCapture:h,onBlur:x})});function wn(e,t,n){return Me(i=>{var r;if(null==t||t(i),i.defaultPrevented)return;if(i.isPropagationStopped())return;if(!ye(i))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(i))return;if(function(e){const t=e.target;return!(t&&!fe(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(i))return;const s=e.getState(),o=null==(r=tn(e,s.activeId))?void 0:r.element;if(!o)return;const{view:l,...a}=i;o!==(null==n?void 0:n.current)&&o.focus(),function(e,t,n){const i=new KeyboardEvent(t,n);return e.dispatchEvent(i)}(o,i.type,a)||i.preventDefault(),i.currentTarget.contains(o)&&i.stopPropagation()})}function xn(e,t){const{virtualFocus:n,baseElement:i}=e.getState();if(!n||!i||!fe(i))return void t();const r=i.scrollLeft,s=i.scrollTop;t(),i.scrollLeft=r,i.scrollTop=s}Ue(function(e){return Ge("div",hn(e))});var yn=qe(function({store:e,composite:t=!0,focusOnMove:n=t,moveOnKeyPress:i=!0,...r}){const o=et();ee(e=e||o,!1);const l=(0,re.useRef)(null),a=(0,re.useRef)(null),c=function(e){const[t,n]=(0,re.useState)(!1),i=(0,re.useCallback)(()=>n(!0),[]),r=gt(e,t=>tn(e,t.activeId));return(0,re.useEffect)(()=>{const i=null==r?void 0:r.element;t&&i&&(n(!1),xn(e,()=>{i.focus({preventScroll:!0})}))},[e,r,t]),i}(e),u=gt(e,"moves"),[,d]=function(e){const[t,n]=(0,re.useState)(null);return Ne(()=>{if(null==t)return;if(!e)return;let n=null;return e(e=>(n=e,t)),()=>{e(n)}},[t,e]),[t,n]}(t?e.setBaseElement:null);(0,re.useEffect)(()=>{var i;if(!e)return;if(!u)return;if(!t)return;if(!n)return;const{activeId:r}=e.getState(),s=null==(i=tn(e,r))?void 0:i.element;s&&xn(e,()=>{var e;"scrollIntoView"in(e=s)?(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"})):e.focus()})},[e,u,t,n]),Ne(()=>{if(!e)return;if(!u)return;if(!t)return;const{baseElement:n,activeId:i}=e.getState();if(null!==i)return;if(!n)return;const r=a.current;a.current=null,r&&je(r,{relatedTarget:n}),ln(n)||n.focus()},[e,u,t]);const m=gt(e,"activeId"),p=gt(e,"virtualFocus");Ne(()=>{var n;if(!e)return;if(!t)return;if(!p)return;const i=a.current;if(a.current=null,!i)return;const r=(null==(n=tn(e,m))?void 0:n.element)||ue(i);r!==i&&je(i,{relatedTarget:r})},[e,m,p,t]);const f=wn(e,r.onKeyDownCapture,a),v=wn(e,r.onKeyUpCapture,a),_=r.onFocusCapture,g=Me(t=>{if(null==_||_(t),t.defaultPrevented)return;if(!e)return;const{virtualFocus:n}=e.getState();if(!n)return;const i=t.relatedTarget,r=function(e){const t=e[nn];return delete e[nn],t}(t.currentTarget);ye(t)&&r&&(t.stopPropagation(),a.current=i)}),b=r.onFocus,h=Me(n=>{if(null==b||b(n),n.defaultPrevented)return;if(!t)return;if(!e)return;const{relatedTarget:i}=n,{virtualFocus:r}=e.getState();r?ye(n)&&!rn(e,i)&&queueMicrotask(c):ye(n)&&e.setActiveId(null)}),w=r.onBlurCapture,x=Me(t=>{var n;if(null==w||w(t),t.defaultPrevented)return;if(!e)return;const{virtualFocus:i,activeId:r}=e.getState();if(!i)return;const s=null==(n=tn(e,r))?void 0:n.element,o=t.relatedTarget,l=rn(e,o),c=a.current;a.current=null,ye(t)&&l?(o===s?c&&c!==o&&je(c,t):s?je(s,t):c&&je(c,t),t.stopPropagation()):!rn(e,t.target)&&s&&je(s,t)}),y=r.onKeyDown,j=De(i),C=Me(t=>{var n;if(null==y||y(t),t.nativeEvent.isComposing)return;if(t.defaultPrevented)return;if(!e)return;if(!ye(t))return;const{orientation:i,renderedItems:r,activeId:s}=e.getState(),o=tn(e,s);if(null==(n=null==o?void 0:o.element)?void 0:n.isConnected)return;const l="horizontal"!==i,a="vertical"!==i,c=r.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&fe(t.currentTarget))return;const u={ArrowUp:(c||l)&&(()=>{if(c){const e=function(e){return e.find(e=>!e.disabled)}(yt(jt(function(e){const t=[];for(const n of e){const e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId});e?e.push(n):t.push([n])}return t}(r))));return null==e?void 0:e.id}return null==e?void 0:e.last()}),ArrowRight:(c||a)&&e.first,ArrowDown:(c||l)&&e.first,ArrowLeft:(c||a)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last},d=u[t.key];if(d){const n=d();if(void 0!==n){if(!j(t))return;t.preventDefault(),e.move(n)}}});r=Te(r,t=>(0,s.jsx)(tt,{value:e,children:t}),[e]);const S=gt(e,n=>{var i;if(e&&t&&n.virtualFocus)return null==(i=tn(e,n.activeId))?void 0:i.id});r={"aria-activedescendant":S,...r,ref:Fe(l,d,r.ref),onKeyDownCapture:f,onKeyUpCapture:v,onFocusCapture:g,onFocus:h,onBlurCapture:x,onKeyDown:C};const I=gt(e,e=>t&&(e.virtualFocus||null===e.activeId));return hn({focusable:I,...r})}),jn=(Ue(function(e){return Ge("div",yn(e))}),qe(function({store:e,...t}){const n=Rt();return e=e||n,{...t,ref:Fe(null==e?void 0:e.setAnchorElement,t.ref)}}));function Cn(e,t,n){if(!n)return!1;const i=e.find(e=>!e.disabled&&e.value);return(null==i?void 0:i.value)===t}function Sn(e,t){return!!t&&null!=e&&(e=J(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}Ue(function(e){return Ge("div",jn(e))});var In=qe(function({store:e,focusable:t=!0,autoSelect:n=!1,getAutoSelectId:i,setValueOnChange:r,showMinLength:s=0,showOnChange:o,showOnMouseDown:l,showOnClick:a=l,showOnKeyDown:c,showOnKeyPress:u=c,blurActiveItemOnClick:d,setValueOnClick:m=!0,moveOnKeyPress:p=!0,autoComplete:f="list",...v}){const _=Gt();ee(e=e||_,!1);const g=(0,re.useRef)(null),[b,h]=(0,re.useReducer)(()=>[],[]),w=(0,re.useRef)(!1),x=(0,re.useRef)(!1),y=gt(e,e=>e.virtualFocus&&n),j="inline"===f||"both"===f,[C,S]=(0,re.useState)(j);!function(e,t){const n=(0,re.useRef)(!1);Ne(()=>{n.current?j&&S(!0):n.current=!0},t),Ne(()=>()=>{n.current=!1},[])}(0,[j]);const I=gt(e,"value"),E=(0,re.useRef)(void 0);(0,re.useEffect)(()=>mt(e,["selectedValue","activeId"],(e,t)=>{E.current=t.selectedValue}),[e]);const k=gt(e,e=>{var t;if(j&&C){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=E.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}}),V=gt(e,"renderedItems"),P=gt(e,"open"),N=gt(e,"contentElement"),M=(0,re.useMemo)(()=>{if(!j)return I;if(!C)return I;if(Cn(V,k,y)){if(Sn(I,k)){const e=(null==k?void 0:k.slice(I.length))||"";return I+e}return I}return k||I},[j,C,V,k,y,I]);(0,re.useEffect)(()=>{const e=g.current;if(!e)return;const t=()=>S(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,re.useEffect)(()=>{if(!j)return;if(!C)return;if(!k)return;if(!Cn(V,k,y))return;if(!Sn(I,k))return;let e=Y;return queueMicrotask(()=>{const t=g.current;if(!t)return;const{start:n,end:i}=_e(t),r=I.length,s=k.length;he(t,r,s),e=()=>{if(!ln(t))return;const{start:e,end:o}=_e(t);e===r&&o===s&&he(t,n,i)}}),()=>e()},[b,j,C,k,V,y,I]);const F=(0,re.useRef)(null),O=Me(i),A=(0,re.useRef)(null),D=(0,re.useRef)(!1),T=(0,re.useRef)(!1);(0,re.useEffect)(()=>{if(!P)return;if(!N)return;const t=be(N);if(!t)return;F.current=t;const n=()=>{w.current=!1,D.current=!0},i=()=>{if(T.current||(D.current=!0),!e)return;if(!w.current)return;const{activeId:t}=e.getState();null!==t&&t!==A.current&&(w.current=!1)},r={passive:!0,capture:!0};return t.addEventListener("wheel",n,r),t.addEventListener("touchmove",n,r),t.addEventListener("scroll",i,r),()=>{t.removeEventListener("wheel",n,!0),t.removeEventListener("touchmove",n,!0),t.removeEventListener("scroll",i,!0)}},[P,N,e]),Ne(()=>{D.current=!1,I&&(x.current||(w.current=!0))},[I]),Ne(()=>{"always"!==y&&P||(w.current=P)},[y,P]);const B=gt(e,"resetValueOnSelect");Ae(()=>{var t,n;const i=w.current;if(!e)return;if(!P)return;if(!i&&(!B||D.current))return;const{baseElement:r,contentElement:s,activeId:o}=e.getState();if(!r||ln(r)){if(null==s?void 0:s.hasAttribute("data-placing")){const e=new MutationObserver(h);return e.observe(s,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(y&&i){const n=O(V),i=void 0!==n?n:null!=(t=function(e){const t=e.find(e=>{var t;return!e.disabled&&"tab"!==(null==(t=e.element)?void 0:t.getAttribute("role"))});return null==t?void 0:t.id}(V))?t:e.first();A.current=i,e.move(null!=i?i:null)}else{const t=null==(n=e.item(o||e.first()))?void 0:n.element;t&&"scrollIntoView"in t&&(T.current=!0,t.scrollIntoView({block:"nearest",inline:"nearest"}),requestAnimationFrame(()=>{T.current=!1}))}}},[e,P,b,I,y,B,O,V]),(0,re.useEffect)(()=>{if(!j)return;const t=g.current;if(!t)return;const n=[t,N].filter(e=>!!e),i=t=>{n.every(e=>Se(t,e))&&(null==e||e.setValue(M))};for(const e of n)e.addEventListener("focusout",i);return()=>{for(const e of n)e.removeEventListener("focusout",i)}},[j,N,e,M]);const L=e=>e.currentTarget.value.length>=s,R=v.onChange,z=De(null!=o?o:L),H=De(null!=r?r:!e.tag),$=Me(t=>{if(null==R||R(t),t.defaultPrevented)return;if(!e)return;const n=t.currentTarget,{value:i,selectionStart:r,selectionEnd:s}=n,o=t.nativeEvent;if(w.current=!0,function(e){return"input"===e.type}(o)&&(o.isComposing&&(w.current=!1,x.current=!0),j)){const e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=r===i.length;S(e&&t)}if(H(t)){const t=i===e.getState().value;e.setValue(i),queueMicrotask(()=>{he(n,r,s)}),j&&y&&t&&h()}z(t)&&e.show(),y&&w.current||e.setActiveId(null)}),W=v.onCompositionEnd,U=Me(e=>{w.current=!0,x.current=!1,null==W||W(e),e.defaultPrevented||y&&h()}),K=v.onMouseDown,G=De(null!=d?d:()=>e.getState().includesBaseElement),q=De(m),Z=De(null!=a?a:L),X=Me(t=>{null==K||K(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(G(t)&&e.setActiveId(null),q(t)&&e.setValue(M),Z(t)&&Ie(t.currentTarget,"mouseup",e.show))}),J=v.onKeyDown,Q=De(null!=u?u:L),te=Me(t=>{if(null==J||J(t),t.repeat||(w.current=!1),t.defaultPrevented)return;if(!e)return;const{open:n}=e.getState();n&&"Enter"===t.key?t.preventDefault():t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||n||"ArrowUp"!==t.key&&"ArrowDown"!==t.key||Q(t)&&(t.preventDefault(),e.show())}),ne=v.onBlur,ie=Me(e=>{w.current=!1,null==ne||ne(e),e.defaultPrevented}),se=Oe(v.id),oe=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(f)?f:void 0,le=gt(e,e=>null===e.activeId);return v={role:"combobox","aria-autocomplete":oe,"aria-haspopup":ge(N,"listbox"),"aria-expanded":P,"aria-controls":null==N?void 0:N.id,"data-active-item":le||void 0,value:M,...v,id:se,ref:Fe(g,v.ref),onChange:$,onCompositionEnd:U,onMouseDown:X,onKeyDown:te,onBlur:ie},v=yn({store:e,focusable:t,...v,moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(p,e)&&(j&&S(!0),!0)}),v=jn({store:e,...v}),{autoComplete:"off",...v}}),En=Ue(function(e){return Ge("input",In(e))});const kn=window.ReactDOM;function Vn(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function Pn(...e){return e.join(", ").split(", ").reduce((e,t)=>{const n=t.endsWith("ms")?1:1e3,i=Number.parseFloat(t||"0s")*n;return i>e?i:e},0)}function Nn(e,t,n){return!(n||!1===t||e&&!t)}var Mn=qe(function({store:e,alwaysVisible:t,...n}){const i=At();ee(e=e||i,!1);const r=(0,re.useRef)(null),o=Oe(n.id),[l,a]=(0,re.useState)(null),c=gt(e,"open"),u=gt(e,"mounted"),d=gt(e,"animated"),m=gt(e,"contentElement"),p=gt(e.disclosure,"contentElement"),f=(0,re.useRef)(!1);Ne(()=>{r.current&&(null==e||e.setContentElement(r.current))},[e]),Ne(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),Ne(()=>{if(d){if(null==m?void 0:m.isConnected)return function(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}(()=>{a(c?"enter":u?"leave":null)});a(null)}else c?f.current&&(f.current=!1,a("enter")):(f.current=!0,a(null))},[d,m,c,u]),Ne(()=>{if(!e)return;if(!d)return;if(!l)return;if(!m)return;const t=()=>null==e?void 0:e.setState("animating",!1),n=()=>(0,kn.flushSync)(t);if("leave"===l&&c)return;if("enter"===l&&!c)return;if("number"==typeof d)return Vn(d,n);const{transitionDuration:i,animationDuration:r,transitionDelay:s,animationDelay:o}=getComputedStyle(m),{transitionDuration:a="0",animationDuration:u="0",transitionDelay:f="0",animationDelay:v="0"}=p?getComputedStyle(p):{},_=Pn(s,o,f,v)+Pn(i,r,a,u);return _?Vn(Math.max(_-1e3/60,0),n):("enter"===l&&e.setState("animated",!1),void t())},[e,d,m,p,c,l]),n=Te(n,t=>(0,s.jsx)(Bt,{value:e,children:t}),[e]);const v=Nn(u,n.hidden,t),_=n.style,g=(0,re.useMemo)(()=>v?{..._,display:"none"}:_,[v,_]);return ne(n={"data-open":c||void 0,"data-enter":"enter"===l||void 0,"data-leave":"leave"===l||void 0,hidden:v,...n,id:o,ref:Fe(o?e.setContentElement:null,r,n.ref),style:g})}),Fn=Ue(function(e){return Ge("div",Mn(e))}),On=(Ue(function({unmountOnHide:e,...t}){const n=At();return!1===gt(t.store||n,t=>!e||(null==t?void 0:t.mounted))?null:(0,s.jsx)(Fn,{...t})}),qe(function({store:e,alwaysVisible:t,...n}){const i=Kt(!0),r=Ut(),o=!!(e=e||r)&&e===i;ee(e,!1);const l=(0,re.useRef)(null),a=Oe(n.id),c=gt(e,"mounted"),u=Nn(c,n.hidden,t),d=u?{...n.style,display:"none"}:n.style,m=gt(e,e=>Array.isArray(e.selectedValue)),p=function(e,t,n){const i=function(e){const[t]=(0,re.useState)(e);return t}(n),[r,s]=(0,re.useState)(i);return(0,re.useEffect)(()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const r=()=>{const e=n.getAttribute(t);s(null==e?i:e)},o=new MutationObserver(r);return o.observe(n,{attributeFilter:[t]}),r(),()=>o.disconnect()},[e,t,i]),r}(l,"role",n.role),f=("listbox"===p||"tree"===p||"grid"===p)&&m||void 0,[v,_]=(0,re.useState)(!1),g=gt(e,"contentElement");Ne(()=>{if(!c)return;const e=l.current;if(!e)return;if(g!==e)return;const t=()=>{_(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()},[c,g]),v||(n={role:"listbox","aria-multiselectable":f,...n}),n=Te(n,t=>(0,s.jsx)(Yt,{value:e,children:(0,s.jsx)($t.Provider,{value:p,children:t})}),[e,p]);const b=!a||i&&o?null:e.setContentElement;return ne(n={hidden:u,...n,id:a,ref:Fe(b,l,n.ref),style:d})})),An=Ue(function(e){return Ge("div",On(e))});function Dn(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var Tn=Symbol("composite-hover"),Bn=qe(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:n=!!t,...i}){const r=Qe();ee(e=e||r,!1);const s=((0,re.useEffect)(()=>{Le||(Ee("mousemove",$e,!0),Ee("mousedown",We,!0),Ee("mouseup",We,!0),Ee("keydown",We,!0),Ee("scroll",We,!0),Le=!0)},[]),Me(()=>Re)),o=i.onMouseMove,l=De(t),a=Me(t=>{if(null==o||o(t),!t.defaultPrevented&&s()&&l(t)){if(!function(e){const t=ue(e);if(!t)return!1;if(de(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&"id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`))}(t.currentTarget)){const t=null==e?void 0:e.getState().baseElement;t&&!ln(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),c=i.onMouseLeave,u=De(n),d=Me(t=>{var n;null==c||c(t),t.defaultPrevented||s()&&(function(e){const t=Dn(e);return!!t&&de(e.currentTarget,t)}(t)||function(e){let t=Dn(e);if(!t)return!1;do{if(Z(t,Tn)&&t[Tn])return!0;t=t.parentElement}while(t);return!1}(t)||l(t)&&u(t)&&(null==e||e.setActiveId(null),null==(n=null==e?void 0:e.getState().baseElement)||n.focus()))}),m=(0,re.useCallback)(e=>{e&&(e[Tn]=!0)},[]);return ne(i={...i,ref:Fe(m,i.ref),onMouseMove:a,onMouseLeave:d})}),Ln=(Ke(Ue(function(e){return Ge("div",Bn(e))})),qe(function({store:e,shouldRegisterItem:t=!0,getItem:n=Q,element:i,...r}){const s=Xe();e=e||s;const o=Oe(r.id),l=(0,re.useRef)(i);return(0,re.useEffect)(()=>{const i=l.current;if(!o)return;if(!i)return;if(!t)return;const r=n({id:o,element:i});return null==e?void 0:e.renderItem(r)},[o,t,n,e]),ne(r={...r,ref:Fe(l,r.ref)})}));function Rn(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?me(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(me(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}Ue(function(e){return Ge("div",Ln(e))});var zn=Symbol("command"),Hn=qe(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...n}){const i=(0,re.useRef)(null),[r,s]=(0,re.useState)(!1);(0,re.useEffect)(()=>{i.current&&s(me(i.current))},[]);const[o,l]=(0,re.useState)(!1),a=(0,re.useRef)(!1),c=te(n),[u,d]=Be(n,zn,!0),m=n.onKeyDown,p=Me(n=>{null==m||m(n);const i=n.currentTarget;if(n.defaultPrevented)return;if(u)return;if(c)return;if(!ye(n))return;if(fe(i))return;if(i.isContentEditable)return;const r=e&&"Enter"===n.key,s=t&&" "===n.key,o="Enter"===n.key&&!e,d=" "===n.key&&!t;if(o||d)n.preventDefault();else if(r||s){const e=Rn(n);if(r){if(!e){n.preventDefault();const{view:e,...t}=n,r=()=>Ce(i,t);ae&&/firefox\//i.test(navigator.userAgent)?Ie(i,"keyup",r):queueMicrotask(r)}}else s&&(a.current=!0,e||(n.preventDefault(),l(!0)))}}),f=n.onKeyUp,v=Me(e=>{if(null==f||f(e),e.defaultPrevented)return;if(u)return;if(c)return;if(e.metaKey)return;const n=t&&" "===e.key;if(a.current&&n&&(a.current=!1,!Rn(e))){e.preventDefault(),l(!1);const t=e.currentTarget,{view:n,...i}=e;queueMicrotask(()=>Ce(t,i))}});return n={"data-active":o||void 0,type:r?"button":void 0,...d,...n,ref:Fe(i,n.ref),onKeyDown:p,onKeyUp:v},hn(n)});function $n(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function Wn(e,t,n,i=!1){var r;if(!t)return;if(!n)return;const{renderedItems:s}=t.getState(),o=be(e);if(!o)return;const l=function(e,t=!1){const n=e.clientHeight,{top:i}=e.getBoundingClientRect(),r=1.5*Math.max(.875*n,n-40),s=t?n-r+i:r+i;return"HTML"===e.tagName?s+e.scrollTop:s}(o,i);let a,c;for(let e=0;e<s.length;e+=1){const s=a;if(a=n(e),!a)break;if(a===s)continue;const o=null==(r=tn(t,a))?void 0:r.element;if(!o)continue;const u=$n(o,i)-l,d=Math.abs(u);if(i&&u<=0||!i&&u>=0){void 0!==c&&c<d&&(a=s);break}c=d}return a}Ue(function(e){return Ge("button",Hn(e))});var Un=qe(function({store:e,rowId:t,preventScrollOnKeyDown:n=!1,moveOnKeyPress:i=!0,tabbable:r=!1,getItem:o,"aria-setsize":l,"aria-posinset":a,...c}){const u=Qe();e=e||u;const d=Oe(c.id),m=(0,re.useRef)(null),p=(0,re.useContext)(rt),f=te(c)&&!c.accessibleWhenDisabled,{rowId:v,baseElement:_,isActiveItem:g,ariaSetSize:b,ariaPosInSet:h,isTabbable:w}=bt(e,{rowId:e=>t||(e&&(null==p?void 0:p.baseElement)&&p.baseElement===e.baseElement?p.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===d,ariaSetSize:e=>null!=l?l:e&&(null==p?void 0:p.ariaSetSize)&&p.baseElement===e.baseElement?p.ariaSetSize:void 0,ariaPosInSet(e){if(null!=a)return a;if(!e)return;if(!(null==p?void 0:p.ariaPosInSet))return;if(p.baseElement!==e.baseElement)return;const t=e.renderedItems.filter(e=>e.rowId===v);return p.ariaPosInSet+t.findIndex(e=>e.id===d)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(r)return!0;if(null===t.activeId)return!1;const n=null==e?void 0:e.item(t.activeId);return!!(null==n?void 0:n.disabled)||!(null==n?void 0:n.element)||t.activeId===d}}),x=(0,re.useCallback)(e=>{var t;const n={...e,id:d||e.id,rowId:v,disabled:f,children:null==(t=e.element)?void 0:t.textContent};return o?o(n):n},[d,v,f,o]),y=c.onFocus,j=(0,re.useRef)(!1),C=Me(t=>{if(null==y||y(t),t.defaultPrevented)return;if(function(e){return Boolean(e.currentTarget&&!de(e.currentTarget,e.target))}(t))return;if(!d)return;if(!e)return;if(function(e,t){return!ye(e)&&rn(t,e.target)}(t,e))return;const{virtualFocus:n,baseElement:i}=e.getState();var r;(e.setActiveId(d),ve(t.currentTarget)&&function(e,t=!1){if(fe(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=ce(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(t.currentTarget),n)&&(ye(t)&&(ve(r=t.currentTarget)||"INPUT"===r.tagName&&!me(r)||(null==i?void 0:i.isConnected)&&(xe()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),j.current=!0,t.relatedTarget===i||rn(e,t.relatedTarget)?function(e){e[nn]=!0,e.focus({preventScroll:!0})}(i):i.focus())))}),S=c.onBlurCapture,I=Me(t=>{if(null==S||S(t),t.defaultPrevented)return;const n=null==e?void 0:e.getState();(null==n?void 0:n.virtualFocus)&&j.current&&(j.current=!1,t.preventDefault(),t.stopPropagation())}),E=c.onKeyDown,k=De(n),V=De(i),P=Me(t=>{if(null==E||E(t),t.defaultPrevented)return;if(!ye(t))return;if(!e)return;const{currentTarget:n}=t,i=e.getState(),r=e.item(d),s=!!(null==r?void 0:r.rowId),o="horizontal"!==i.orientation,l="vertical"!==i.orientation,a=()=>!(!s&&!l&&i.baseElement&&fe(i.baseElement)),c={ArrowUp:(s||o)&&e.up,ArrowRight:(s||l)&&e.next,ArrowDown:(s||o)&&e.down,ArrowLeft:(s||l)&&e.previous,Home:()=>{if(a())return!s||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(a())return!s||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>Wn(n,e,null==e?void 0:e.up,!0),PageDown:()=>Wn(n,e,null==e?void 0:e.down)}[t.key];if(c){if(ve(n)){const e=_e(n),i=l&&"ArrowLeft"===t.key,r=l&&"ArrowRight"===t.key,s=o&&"ArrowUp"===t.key,a=o&&"ArrowDown"===t.key;if(r||a){const{length:t}=function(e){if(fe(e))return e.value;if(e.isContentEditable){const t=ce(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(n);if(e.end!==t)return}else if((i||s)&&0!==e.start)return}const i=c();if(k(t)||void 0!==i){if(!V(t))return;t.preventDefault(),e.move(i)}}}),N=(0,re.useMemo)(()=>({id:d,baseElement:_}),[d,_]);return c=Te(c,e=>(0,s.jsx)(it.Provider,{value:N,children:e}),[N]),c={"data-active-item":g||void 0,...c,id:d,ref:Fe(m,c.ref),tabIndex:w?c.tabIndex:-1,onFocus:C,onBlurCapture:I,onKeyDown:P},c=Hn(c),c=Ln({store:e,...c,getItem:x,shouldRegisterItem:!!d&&c.shouldRegisterItem}),ne({...c,"aria-setsize":b,"aria-posinset":h})});function Kn(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}Ke(Ue(function(e){return Ge("button",Un(e))}));var Gn=qe(function({store:e,value:t,hideOnClick:n,setValueOnClick:i,selectValueOnClick:r=!0,resetValueOnSelect:o,focusOnHover:l=!1,moveOnKeyPress:a=!0,getItem:c,...u}){var d;const m=Kt();ee(e=e||m,!1);const{resetValueOnSelectState:p,multiSelectable:f,selected:v}=bt(e,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,t)}),_=(0,re.useCallback)(e=>{const n={...e,value:t};return c?c(n):n},[t,c]);i=null!=i?i:!f,n=null!=n?n:null!=t&&!f;const g=u.onClick,b=De(i),h=De(r),w=De(null!=(d=null!=o?o:p)?d:f),x=De(n),y=Me(n=>{null==g||g(n),n.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const n=t.tagName.toLowerCase();return!!e.altKey&&("a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type)}(n)||function(e){const t=e.currentTarget;if(!t)return!1;const n=we();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const i=t.tagName.toLowerCase();return"a"===i||"button"===i&&"submit"===t.type||"input"===i&&"submit"===t.type}(n)||(null!=t&&(h(n)&&(w(n)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),b(n)&&(null==e||e.setValue(t))),x(n)&&(null==e||e.hide()))}),j=u.onKeyDown,C=Me(t=>{if(null==j||j(t),t.defaultPrevented)return;const n=null==e?void 0:e.getState().baseElement;n&&(ln(n)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>n.focus()),fe(n)&&(null==e||e.setValue(n.value))))});f&&null!=v&&(u={"aria-selected":v,...u}),u=Te(u,e=>(0,s.jsx)(Zt.Provider,{value:t,children:(0,s.jsx)(Xt.Provider,{value:null!=v&&v,children:e})}),[t,v]),u={role:Kn((0,re.useContext)($t)),children:t,...u,onClick:y,onKeyDown:C};const S=De(a);return u=Un({store:e,...u,getItem:_,moveOnKeyPress:t=>{if(!S(t))return!1;const n=new Event("combobox-item-move"),i=null==e?void 0:e.getState().baseElement;return null==i||i.dispatchEvent(n),!0}}),Bn({store:e,focusOnHover:l,...u})}),qn=Ke(Ue(function(e){return Ge("div",Gn(e))}));function Yn(e){return J(e).toLowerCase()}var Zn=qe(function({store:e,value:t,userValue:n,...i}){const r=Kt();e=e||r;const o=(0,re.useContext)(Zt),l=null!=t?t:o,a=gt(e,e=>null!=n?n:null==e?void 0:e.value);return ne(i={children:(0,re.useMemo)(()=>{if(l)return a?function(e,t){if(!e)return e;if(!t)return e;const n=(i=t,Array.isArray(i)?i:void 0!==i?[i]:[]).filter(Boolean).map(Yn);var i;const r=[],o=(e,t=!1)=>(0,s.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},r.length),l=function(e){return e.sort(([e],[t])=>e-t)}(function(e){return e.filter(([e,t],n,i)=>!i.some(([i,r],s)=>s!==n&&i<=e&&i+r>=e+t))}(function(e,t){const n=[];for(const i of t){let t=0;const r=i.length;for(;-1!==e.indexOf(i,t);){const s=e.indexOf(i,t);-1!==s&&n.push([s,r]),t=s+1}}return n}(Yn(e),new Set(n)))),a=l[0];if(!a)return r.push(o(e,!0)),r;const[c]=a,u=[e.slice(0,c),...l.flatMap(([t,n],i)=>{var r;const s=e.slice(t,t+n),o=null==(r=l[i+1])?void 0:r[0];return[s,e.slice(t+n,o)]})];return u.forEach((e,t)=>{e&&r.push(o(e,t%2==0))}),r}(l,a):l},[l,a]),...i})}),Xn=Ue(function(e){return Ge("span",Zn(e))}),Jn=n(731),Qn=n.n(Jn);const ei=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),ti=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.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"})}),ni=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Circle,{cx:12,cy:12,r:3})});function ii(e=""){return Qn()(e.trim().toLowerCase())}const ri=[],si=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:ri,oi=(e,t,n)=>e.singleSelection?n:Array.isArray(t?.value)?t.value.includes(n)?t.value.filter(e=>e!==n):[...t.value,n]:[n];function li(e,t){return`${e}-${t}`}function ai({view:e,filter:t,onChangeView:n}){const o=(0,p.useInstanceId)(ai,"dataviews-filter-list-box"),[l,a]=(0,r.useState)(1===t.operators?.length?void 0:null),c=e.filters?.find(e=>e.field===t.field),u=si(t,c);return(0,s.jsx)(i.Composite,{virtualFocus:!0,focusLoop:!0,activeId:l,setActiveId:a,role:"listbox",className:"dataviews-filters__search-widget-listbox","aria-label":(0,d.sprintf)(/* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ (0,d.__)("List of: %1$s"),t.name),onFocusVisible:()=>{!l&&t.elements.length&&a(li(o,t.elements[0].value))},render:(0,s.jsx)(i.Composite.Typeahead,{}),children:t.elements.map(r=>(0,s.jsxs)(i.Composite.Hover,{render:(0,s.jsx)(i.Composite.Item,{id:li(o,r.value),render:(0,s.jsx)("div",{"aria-label":r.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{var i,s;const o=c?[...(null!==(i=e.filters)&&void 0!==i?i:[]).map(e=>e.field===t.field?{...e,operator:c.operator||t.operators[0],value:oi(t,c,r.value)}:e)]:[...null!==(s=e.filters)&&void 0!==s?s:[],{field:t.field,operator:t.operators[0],value:oi(t,c,r.value)}];n({...e,page:1,filters:o})}}),children:[(0,s.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&u===r.value&&(0,s.jsx)(i.Icon,{icon:ni}),!t.singleSelection&&u.includes(r.value)&&(0,s.jsx)(i.Icon,{icon:ei})]}),(0,s.jsx)("span",{children:r.label})]},r.value))})}function ci({view:e,filter:t,onChangeView:n}){const[o,l]=(0,r.useState)(""),a=(0,r.useDeferredValue)(o),c=e.filters?.find(e=>e.field===t.field),u=si(t,c),m=(0,r.useMemo)(()=>{const e=ii(a);return t.elements.filter(t=>ii(t.label).includes(e))},[t.elements,a]);return(0,s.jsxs)(Jt,{selectedValue:u,setSelectedValue:i=>{var r,s;const o=c?[...(null!==(r=e.filters)&&void 0!==r?r:[]).map(e=>e.field===t.field?{...e,operator:c.operator||t.operators[0],value:i}:e)]:[...null!==(s=e.filters)&&void 0!==s?s:[],{field:t.field,operator:t.operators[0],value:i}];n({...e,page:1,filters:o})},setValue:l,children:[(0,s.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,s.jsx)(en,{render:(0,s.jsx)(i.VisuallyHidden,{children:(0,d.__)("Search items")}),children:(0,d.__)("Search items")}),(0,s.jsx)(En,{autoSelect:"always",placeholder:(0,d.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,s.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,s.jsx)(i.Icon,{icon:ti})})]}),(0,s.jsxs)(An,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[m.map(e=>(0,s.jsxs)(qn,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[(0,s.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&u===e.value&&(0,s.jsx)(i.Icon,{icon:ni}),!t.singleSelection&&u.includes(e.value)&&(0,s.jsx)(i.Icon,{icon:ei})]}),(0,s.jsxs)("span",{children:[(0,s.jsx)(Xn,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,s.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value)),!m.length&&(0,s.jsx)("p",{children:(0,d.__)("No results found")})]})]})}function ui(e){const t=e.filter.elements.length>10?ci:ai;return(0,s.jsx)(t,{...e})}const di="Enter",mi=" ",pi=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const i={Name:(0,s.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,s.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};return t?.operator===N?(0,r.createInterpolateElement)((0,d.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */ /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */ (0,d.__)("<Name>%1$s is any: </Name><Value>%2$s</Value>"),n.name,e.map(e=>e.label).join(", ")),i):t?.operator===M?(0,r.createInterpolateElement)((0,d.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */ /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */ (0,d.__)("<Name>%1$s is none: </Name><Value>%2$s</Value>"),n.name,e.map(e=>e.label).join(", ")),i):t?.operator===F?(0,r.createInterpolateElement)((0,d.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */ /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */ (0,d.__)("<Name>%1$s is all: </Name><Value>%2$s</Value>"),n.name,e.map(e=>e.label).join(", ")),i):t?.operator===O?(0,r.createInterpolateElement)((0,d.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */ /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */ (0,d.__)("<Name>%1$s is not all: </Name><Value>%2$s</Value>"),n.name,e.map(e=>e.label).join(", ")),i):t?.operator===V?(0,r.createInterpolateElement)((0,d.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */ /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */ (0,d.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),n.name,e[0].label),i):t?.operator===P?(0,r.createInterpolateElement)((0,d.sprintf)(/* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */ /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */ (0,d.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),n.name,e[0].label),i):(0,d.sprintf)(/* translators: 1: Filter name e.g.: "Unknown status for Author". */ /* translators: 1: Filter name e.g.: "Unknown status for Author". */ (0,d.__)("Unknown status for %1$s"),n.name)};function fi({filter:e,view:t,onChangeView:n}){const r=e.operators?.map(e=>({value:e,label:D[e]?.label})),o=t.filters?.find(t=>t.field===e.field),l=o?.operator||e.operators[0];return r.length>1&&(0,s.jsxs)(i.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,s.jsx)(i.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,s.jsx)(i.SelectControl,{label:(0,d.__)("Conditions"),value:l,options:r,onChange:i=>{var r,s;const l=i,a=o?[...(null!==(r=t.filters)&&void 0!==r?r:[]).map(t=>t.field===e.field?{...t,operator:l}:t)]:[...null!==(s=t.filters)&&void 0!==s?s:[],{field:e.field,operator:l,value:void 0}];n({...t,page:1,filters:a})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function vi({addFilterRef:e,openedFilter:t,...n}){const o=(0,r.useRef)(null),{filter:l,view:a,onChangeView:c}=n,u=a.filters?.find(e=>e.field===l.field),m=l.elements.filter(e=>l.singleSelection?e.value===u?.value:u?.value?.includes(e.value)),p=l.isPrimary,f=void 0!==u?.value,v=!p||f;return(0,s.jsx)(i.Dropdown,{defaultOpen:t===l.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{o.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,s.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,s.jsx)(i.Tooltip,{text:(0,d.sprintf)(/* translators: 1: Filter name. */ /* translators: 1: Filter name. */ (0,d.__)("Filter by: %1$s"),l.name.toLowerCase()),placement:"top",children:(0,s.jsx)("div",{className:G("dataviews-filters__summary-chip",{"has-reset":v,"has-values":f}),role:"button",tabIndex:0,onClick:n,onKeyDown:e=>{[di,mi].includes(e.key)&&(n(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:o,children:(0,s.jsx)(pi,{activeElements:m,filterInView:u,filter:l})})}),v&&(0,s.jsx)(i.Tooltip,{text:p?(0,d.__)("Reset"):(0,d.__)("Remove"),placement:"top",children:(0,s.jsx)("button",{className:G("dataviews-filters__summary-chip-remove",{"has-values":f}),onClick:()=>{c({...a,page:1,filters:a.filters?.filter(e=>e.field!==l.field)}),p?o.current?.focus():e.current?.focus()},children:(0,s.jsx)(i.Icon,{icon:q})})})]}),renderContent:()=>(0,s.jsxs)(i.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,s.jsx)(fi,{...n}),(0,s.jsx)(ui,{...n})]})})}const _i=window.wp.privateApis,{lock:gi,unlock:bi}=(0,_i.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),{Menu:hi}=bi(i.privateApis);function wi({filters:e,view:t,onChangeView:n,setOpenedFilter:i,triggerProps:r}){const o=e.filter(e=>!e.isVisible);return(0,s.jsxs)(hi,{children:[(0,s.jsx)(hi.TriggerButton,{...r}),(0,s.jsx)(hi.Popover,{children:o.map(e=>(0,s.jsx)(hi.Item,{onClick:()=>{i(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,s.jsx)(hi.ItemLabel,{children:e.name})},e.field))})]})}const xi=(0,r.forwardRef)(function({filters:e,view:t,onChangeView:n,setOpenedFilter:r},o){if(!e.length||e.every(({isPrimary:e})=>e))return null;const l=e.filter(e=>!e.isVisible);return(0,s.jsx)(wi,{triggerProps:{render:(0,s.jsx)(i.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!l.length,ref:o}),children:(0,d.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:r})});function yi({filters:e,view:t,onChangeView:n}){const r=!t.search&&!t.filters?.some(t=>{return void 0!==t.value||(n=t.field,!e.some(e=>e.field===n&&e.isPrimary));var n});return(0,s.jsx)(i.Button,{disabled:r,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:[]})},children:(0,d.__)("Reset")})}function ji(e){let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[N,M]),t=t.filter(e=>A.includes(e)),(t.includes(V)||t.includes(P))&&(t=t.filter(e=>[V,P].includes(e))),t}function Ci(e,t){return(0,r.useMemo)(()=>{const n=[];return e.forEach(e=>{if(!e.elements?.length)return;const i=ji(e);if(0===i.length)return;const r=!!e.filterBy?.isPrimary;n.push({field:e.id,name:e.label,elements:e.elements,singleSelection:i.some(e=>[V,P].includes(e)),operators:i,isVisible:r||!!t.filters?.some(t=>t.field===e.id&&A.includes(t.operator)),isPrimary:r})}),n.sort((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)),n},[e,t])}function Si({filters:e,view:t,onChangeView:n,setOpenedFilter:o,isShowingFilter:l,setIsShowingFilter:a}){const c=(0,r.useRef)(null),u=(0,r.useCallback)(e=>{n(e),a(!0)},[n,a]),m=!!e.filter(e=>e.isVisible).length;if(0===e.length)return null;const p={label:(0,d.__)("Add filter"),"aria-expanded":!1,isPressed:!1},f={label:(0,d._x)("Filter","verb"),"aria-expanded":l,isPressed:l,onClick:()=>{l||o(null),a(!l)}},v=(0,s.jsx)(i.Button,{ref:c,className:"dataviews-filters__visibility-toggle",size:"compact",icon:U,...m?f:p});return(0,s.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:m?(0,s.jsx)(Ii,{buttonRef:c,filtersCount:t.filters?.length,children:v}):(0,s.jsx)(wi,{filters:e,view:t,onChangeView:u,setOpenedFilter:o,triggerProps:{render:v}})})}function Ii({buttonRef:e,filtersCount:t,children:n}){return(0,r.useEffect)(()=>()=>{e.current?.focus()},[e]),(0,s.jsxs)(s.Fragment,{children:[n,!!t&&(0,s.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}const Ei=(0,r.memo)(function(){const{fields:e,view:t,onChangeView:n,openedFilter:o,setOpenedFilter:l}=(0,r.useContext)(W),a=(0,r.useRef)(null),c=Ci(e,t),u=(0,s.jsx)(xi,{filters:c,view:t,onChangeView:n,ref:a,setOpenedFilter:l},"add-filter"),d=c.filter(e=>e.isVisible);if(0===d.length)return null;const m=[...d.map(e=>(0,s.jsx)(vi,{filter:e,view:t,onChangeView:n,addFilterRef:a,openedFilter:o},e.field)),u];return m.push((0,s.jsx)(yi,{filters:c,view:t,onChangeView:n},"reset-filters")),(0,s.jsx)(i.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},className:"dataviews-filters__container",wrap:!0,children:m})}),ki=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),Vi=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})}),Pi=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),Ni=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})});function Mi({selection:e,onChangeSelection:t,item:n,getItemId:r,titleField:o,disabled:l}){const a=r(n),c=!l&&e.includes(a),u=o?.getValue?.({item:n})||(0,d.__)("(no title)");return(0,s.jsx)(i.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":u,"aria-disabled":l,checked:c,onChange:()=>{l||t(e.includes(a)?e.filter(e=>a!==e):[...e,a])}})}const Fi=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),{Menu:Oi,kebabCase:Ai}=bi(i.privateApis);function Di({action:e,onClick:t,items:n}){const r="string"==typeof e.label?e.label:e.label(n);return(0,s.jsx)(i.Button,{label:r,icon:e.icon,disabled:!!e.disabled,accessibleWhenDisabled:!0,isDestructive:e.isDestructive,size:"compact",onClick:t})}function Ti({action:e,onClick:t,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,s.jsx)(Oi.Item,{disabled:e.disabled,onClick:t,children:(0,s.jsx)(Oi.ItemLabel,{children:i})})}function Bi({action:e,items:t,closeModal:n}){const r="string"==typeof e.label?e.label:e.label(t);return(0,s.jsx)(i.Modal,{title:e.modalHeader||r,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:"firstContentElement",size:e.modalSize||"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${Ai(e.id)}`,children:(0,s.jsx)(e.RenderModal,{items:t,closeModal:n})})}function Li({actions:e,item:t,registry:n,setActiveModalAction:i}){return(0,s.jsx)(Oi.Group,{children:e.map(e=>(0,s.jsx)(Ti,{action:e,onClick:()=>{"RenderModal"in e?i(e):e.callback([t],{registry:n})},items:[t]},e.id))})}function Ri({item:e,actions:t,isCompact:n}){const o=(0,x.useRegistry)(),{primaryActions:l,eligibleActions:a}=(0,r.useMemo)(()=>{const n=t.filter(t=>!t.isEligible||t.isEligible(e));return{primaryActions:n.filter(e=>e.isPrimary&&!!e.icon),eligibleActions:n}},[t,e]);return n?(0,s.jsx)(zi,{item:e,actions:a,isSmall:!0,registry:o}):l.length===a.length?(0,s.jsx)(Hi,{item:e,actions:l,registry:o}):(0,s.jsxs)(i.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:"0",width:"auto"},children:[(0,s.jsx)(Hi,{item:e,actions:l,registry:o}),(0,s.jsx)(zi,{item:e,actions:a,registry:o})]})}function zi({item:e,actions:t,isSmall:n,registry:o}){const[l,a]=(0,r.useState)(null);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Oi,{placement:"bottom-end",children:[(0,s.jsx)(Oi.TriggerButton,{render:(0,s.jsx)(i.Button,{size:n?"small":"compact",icon:Fi,label:(0,d.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,className:"dataviews-all-actions-button"})}),(0,s.jsx)(Oi.Popover,{children:(0,s.jsx)(Li,{actions:t,item:e,registry:o,setActiveModalAction:a})})]}),!!l&&(0,s.jsx)(Bi,{action:l,items:[e],closeModal:()=>a(null)})]})}function Hi({item:e,actions:t,registry:n}){const[i,o]=(0,r.useState)(null);return Array.isArray(t)&&0!==t.length?(0,s.jsxs)(s.Fragment,{children:[t.map(t=>(0,s.jsx)(Di,{action:t,onClick:()=>{"RenderModal"in t?o(t):t.callback([e],{registry:n})},items:[e]},t.id)),!!i&&(0,s.jsx)(Bi,{action:i,items:[e],closeModal:()=>o(null)})]}):null}function $i({action:e,items:t,ActionTriggerComponent:n}){const[i,o]=(0,r.useState)(!1),l={action:e,onClick:()=>{o(!0)},items:t};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n,{...l}),i&&(0,s.jsx)(Bi,{action:e,items:t,closeModal:()=>o(!1)})]})}function Wi(e,t){return(0,r.useMemo)(()=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))),[e,t])}function Ui(e,t){return(0,r.useMemo)(()=>t.some(t=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t)))),[e,t])}function Ki({selection:e,onChangeSelection:t,data:n,actions:o,getItemId:l}){const a=(0,r.useMemo)(()=>n.filter(e=>o.some(t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e)))),[n,o]),c=n.filter(t=>e.includes(l(t))&&a.includes(t)),u=c.length===a.length;return(0,s.jsx)(i.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:u,indeterminate:!u&&!!c.length,onChange:()=>{t(u?[]:a.map(e=>l(e)))},"aria-label":u?(0,d.__)("Deselect all"):(0,d.__)("Select all")})}function Gi({action:e,onClick:t,isBusy:n,items:r}){const o="string"==typeof e.label?e.label:e.label(r);return(0,s.jsx)(i.Button,{disabled:n,accessibleWhenDisabled:!0,label:o,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t,isBusy:n,tooltipPosition:"top"})}const qi=[];function Yi({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:i}){const o=(0,x.useRegistry)(),l=(0,r.useMemo)(()=>t.filter(t=>!e.isEligible||e.isEligible(t)),[e,t]);return"RenderModal"in e?(0,s.jsx)($i,{action:e,items:l,ActionTriggerComponent:Gi},e.id):(0,s.jsx)(Gi,{action:e,onClick:async()=>{i(e.id),await e.callback(t,{registry:o}),i(null)},items:l,isBusy:n===e.id},e.id)}function Zi(e,t,n,r,o,l,a,c,u){const m=l.length>0?(0,d.sprintf)(/* translators: %d: number of items. */ /* translators: %d: number of items. */ (0,d._n)("%d Item selected","%d Items selected",l.length),l.length):(0,d.sprintf)(/* translators: %d: number of items. */ /* translators: %d: number of items. */ (0,d._n)("%d Item","%d Items",e.length),e.length);return(0,s.jsxs)(i.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,s.jsx)(Ki,{selection:r,onChangeSelection:u,data:e,actions:t,getItemId:n}),(0,s.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:m}),(0,s.jsxs)(i.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[o.map(e=>(0,s.jsx)(Yi,{action:e,selectedItems:l,actionInProgress:a,setActionInProgress:c},e.id)),l.length>0&&(0,s.jsx)(i.Button,{icon:q,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,d.__)("Cancel"),disabled:!!a,accessibleWhenDisabled:!1,onClick:()=>{u(qi)}})]})]})}function Xi({selection:e,actions:t,onChangeSelection:n,data:i,getItemId:s}){const[o,l]=(0,r.useState)(null),a=(0,r.useRef)(null),c=(0,r.useMemo)(()=>t.filter(e=>e.supportsBulk),[t]),u=(0,r.useMemo)(()=>i.filter(e=>c.some(t=>!t.isEligible||t.isEligible(e))),[i,c]),d=(0,r.useMemo)(()=>i.filter(t=>e.includes(s(t))&&u.includes(t)),[e,i,s,u]),m=(0,r.useMemo)(()=>t.filter(e=>e.supportsBulk&&e.icon&&d.some(t=>!e.isEligible||e.isEligible(t))),[t,d]);return o?(a.current||(a.current=Zi(i,t,s,e,m,d,o,l,n)),a.current):(a.current&&(a.current=null),Zi(i,t,s,e,m,d,o,l,n))}function Ji(){const{data:e,selection:t,actions:n=qi,onChangeSelection:i,getItemId:o}=(0,r.useContext)(W);return(0,s.jsx)(Xi,{selection:t,onChangeSelection:i,data:e,actions:n,getItemId:o})}const Qi=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),er=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),tr=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})}),{Menu:nr}=bi(i.privateApis);function ir({children:e}){return r.Children.toArray(e).filter(Boolean).map((e,t)=>(0,s.jsxs)(r.Fragment,{children:[t>0&&(0,s.jsx)(nr.Separator,{}),e]},t))}const rr=(0,r.forwardRef)(function({fieldId:e,view:t,fields:n,onChangeView:r,onHide:o,setOpenedFilter:l,canMove:a=!0},c){var u;const m=null!==(u=t.fields)&&void 0!==u?u:[],p=m?.indexOf(e),f=t.sort?.field===e;let v=!1,_=!1,g=!1,b=[];const h=n.find(t=>t.id===e);if(!h)return null;v=!1!==h.enableHiding,_=!1!==h.enableSorting;const w=h.header;return b=ji(h),g=!(t.filters?.some(t=>e===t.field)||!h.elements?.length||!b.length||h.filterBy?.isPrimary),(0,s.jsxs)(nr,{children:[(0,s.jsxs)(nr.TriggerButton,{render:(0,s.jsx)(i.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:c,variant:"tertiary"}),children:[w,t.sort&&f&&(0,s.jsx)("span",{"aria-hidden":"true",children:B[t.sort.direction]})]}),(0,s.jsx)(nr.Popover,{style:{minWidth:"240px"},children:(0,s.jsxs)(ir,{children:[_&&(0,s.jsx)(nr.Group,{children:T.map(n=>{const i=t.sort&&f&&t.sort.direction===n,o=`${e}-${n}`;return(0,s.jsx)(nr.RadioItem,{name:"view-table-sorting",value:o,checked:i,onChange:()=>{r({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,s.jsx)(nr.ItemLabel,{children:R[n]})},o)})}),g&&(0,s.jsx)(nr.Group,{children:(0,s.jsx)(nr.Item,{prefix:(0,s.jsx)(i.Icon,{icon:U}),onClick:()=>{l(e),r({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:b[0]}]})},children:(0,s.jsx)(nr.ItemLabel,{children:(0,d.__)("Add filter")})})}),(a||v)&&h&&(0,s.jsxs)(nr.Group,{children:[a&&(0,s.jsx)(nr.Item,{prefix:(0,s.jsx)(i.Icon,{icon:Qi}),disabled:p<1,onClick:()=>{var n;r({...t,fields:[...null!==(n=m.slice(0,p-1))&&void 0!==n?n:[],e,m[p-1],...m.slice(p+1)]})},children:(0,s.jsx)(nr.ItemLabel,{children:(0,d.__)("Move left")})}),a&&(0,s.jsx)(nr.Item,{prefix:(0,s.jsx)(i.Icon,{icon:er}),disabled:p>=m.length-1,onClick:()=>{var n;r({...t,fields:[...null!==(n=m.slice(0,p))&&void 0!==n?n:[],m[p+1],e,...m.slice(p+2)]})},children:(0,s.jsx)(nr.ItemLabel,{children:(0,d.__)("Move right")})}),v&&h&&(0,s.jsx)(nr.Item,{prefix:(0,s.jsx)(i.Icon,{icon:tr}),onClick:()=>{o(h),r({...t,fields:m.filter(t=>t!==e)})},children:(0,s.jsx)(nr.ItemLabel,{children:(0,d.__)("Hide column")})})]})]})})]})}),sr=rr;function or({item:e,isItemClickable:t,onClickItem:n,className:i}){return t(e)&&n?{className:i?`${i} ${i}--clickable`:void 0,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{"Enter"!==t.key&&""!==t.key&&" "!==t.key||(t.stopPropagation(),n(e))}}:{className:i}}const lr=function({item:e,level:t,titleField:n,mediaField:r,descriptionField:o,onClickItem:l,isItemClickable:a}){const c=or({item:e,isItemClickable:a,onClickItem:l,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field"});return(0,s.jsxs)(i.__experimentalHStack,{spacing:3,justify:"flex-start",children:[r&&(0,s.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",children:(0,s.jsx)(r.render,{item:e})}),(0,s.jsxs)(i.__experimentalVStack,{spacing:0,children:[n&&(0,s.jsxs)("div",{...c,children:[void 0!==t&&(0,s.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,s.jsx)(n.render,{item:e})]}),o&&(0,s.jsx)(o.render,{item:e})]})]})};function ar({item:e,fields:t,column:n}){const i=t.find(e=>e.id===n);return i?(0,s.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,s.jsx)(i.render,{item:e})}):null}function cr({hasBulkActions:e,item:t,level:n,actions:i,fields:o,id:l,view:a,titleField:c,mediaField:u,descriptionField:d,selection:m,getItemId:p,isItemClickable:f,onClickItem:v,onChangeSelection:_}){var g;const b=Wi(i,t),h=b&&m.includes(l),[w,x]=(0,r.useState)(!1),{showTitle:y=!0,showMedia:j=!0,showDescription:C=!0}=a,S=(0,r.useRef)(!1),I=null!==(g=a.fields)&&void 0!==g?g:[],E=c&&y||u&&j||d&&C;return(0,s.jsxs)("tr",{className:G("dataviews-view-table__row",{"is-selected":b&&h,"is-hovered":w,"has-bulk-actions":b}),onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},onTouchStart:()=>{S.current=!0},onClick:()=>{b&&(S.current||"Range"===document.getSelection()?.type||_(m.includes(l)?m.filter(e=>l!==e):[l]))},children:[e&&(0,s.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,s.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,s.jsx)(Mi,{item:t,selection:m,onChangeSelection:_,getItemId:p,titleField:c,disabled:!b})})}),E&&(0,s.jsx)("td",{children:(0,s.jsx)(lr,{item:t,level:n,titleField:y?c:void 0,mediaField:j?u:void 0,descriptionField:C?d:void 0,isItemClickable:f,onClickItem:v})}),I.map(e=>{var n;const{width:i,maxWidth:r,minWidth:l}=null!==(n=a.layout?.styles?.[e])&&void 0!==n?n:{};return(0,s.jsx)("td",{style:{width:i,maxWidth:r,minWidth:l},children:(0,s.jsx)(ar,{fields:o,item:t,column:e})},e)}),!!i?.length&&(0,s.jsx)("td",{className:"dataviews-view-table__actions-column",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(Ri,{item:t,actions:i})})]})}const ur={xhuge:{min:3,max:6,default:5},huge:{min:2,max:4,default:4},xlarge:{min:2,max:3,default:3},large:{min:1,max:2,default:2},mobile:{min:1,max:2,default:2}},dr={xhuge:1520,huge:1140,xlarge:780,large:480,mobile:0};function mr(){const e=(0,r.useContext)(W).containerWidth;for(const[t,n]of Object.entries(dr))if(e>=n)return t;return"mobile"}const{Badge:pr}=bi(i.privateApis);function fr({view:e,selection:t,onChangeSelection:n,onClickItem:r,isItemClickable:o,getItemId:l,item:a,actions:c,mediaField:u,titleField:m,descriptionField:f,regularFields:v,badgeFields:_,hasBulkActions:g}){const{showTitle:b=!0,showMedia:h=!0,showDescription:w=!0}=e,x=Wi(c,a),y=l(a),j=(0,p.useInstanceId)(fr),C=t.includes(y),S=u?.render?(0,s.jsx)(u.render,{item:a}):null,I=b&&m?.render?(0,s.jsx)(m.render,{item:a}):null,E=or({item:a,isItemClickable:o,onClickItem:r,className:"dataviews-view-grid__media"}),k=or({item:a,isItemClickable:o,onClickItem:r,className:"dataviews-view-grid__title-field dataviews-title-field"});let V,P;return o(a)&&r&&(I?(V={"aria-labelledby":`dataviews-view-grid__title-field-${j}`},P={id:`dataviews-view-grid__title-field-${j}`}):V={"aria-label":(0,d.__)("Navigate to item")}),(0,s.jsxs)(i.__experimentalVStack,{spacing:0,className:G("dataviews-view-grid__card",{"is-selected":x&&C}),onClickCapture:e=>{if(e.ctrlKey||e.metaKey){if(e.stopPropagation(),e.preventDefault(),!x)return;n(t.includes(y)?t.filter(e=>y!==e):[...t,y])}},children:[h&&S&&(0,s.jsx)("div",{...E,...V,children:S}),g&&h&&S&&(0,s.jsx)(Mi,{item:a,selection:t,onChangeSelection:n,getItemId:l,titleField:m,disabled:!x}),(0,s.jsxs)(i.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,s.jsx)("div",{...k,...P,children:I}),!!c?.length&&(0,s.jsx)(Ri,{item:a,actions:c,isCompact:!0})]}),(0,s.jsxs)(i.__experimentalVStack,{spacing:1,children:[w&&f?.render&&(0,s.jsx)(f.render,{item:a}),!!_?.length&&(0,s.jsx)(i.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:_.map(e=>(0,s.jsx)(pr,{className:"dataviews-view-grid__field-value",children:(0,s.jsx)(e.render,{item:a})},e.id))}),!!v?.length&&(0,s.jsx)(i.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:v.map(e=>(0,s.jsx)(i.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header}),(0,s.jsx)(i.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,s.jsx)(e.render,{item:a})})]})},e.id))})]})]},y)}const{Menu:vr}=bi(i.privateApis);function _r(e){return`${e}-item-wrapper`}function gr(e){return`${e}-dropdown`}function br({idPrefix:e,primaryAction:t,item:n}){const o=(0,x.useRegistry)(),[l,a]=(0,r.useState)(!1),c=function(e,t){return`${e}-primary-action-${t}`}(e,t.id),u="string"==typeof t.label?t.label:t.label([n]);return"RenderModal"in t?(0,s.jsx)("div",{role:"gridcell",children:(0,s.jsx)(i.Composite.Item,{id:c,render:(0,s.jsx)(i.Button,{label:u,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>a(!0)}),children:l&&(0,s.jsx)(Bi,{action:t,items:[n],closeModal:()=>a(!1)})})},t.id):(0,s.jsx)("div",{role:"gridcell",children:(0,s.jsx)(i.Composite.Item,{id:c,render:(0,s.jsx)(i.Button,{label:u,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>{t.callback([n],{registry:o})}})})},t.id)}function hr({view:e,actions:t,idPrefix:n,isSelected:o,item:l,titleField:a,mediaField:c,descriptionField:u,onSelect:m,otherFields:p,onDropdownTriggerKeyDown:f}){const{showTitle:v=!0,showMedia:_=!0,showDescription:g=!0}=e,b=(0,r.useRef)(null),h=`${n}-label`,w=`${n}-description`,y=(0,x.useRegistry)(),[j,C]=(0,r.useState)(!1),[S,I]=(0,r.useState)(null),E=({type:e})=>{C("mouseenter"===e)};(0,r.useEffect)(()=>{o&&b.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})},[o]);const{primaryAction:k,eligibleActions:V}=(0,r.useMemo)(()=>{const e=t.filter(e=>!e.isEligible||e.isEligible(l));return{primaryAction:e.filter(e=>e.isPrimary&&!!e.icon)[0],eligibleActions:e}},[t,l]),P=k&&1===t.length,N=_&&c?.render?(0,s.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,s.jsx)(c.render,{item:l})}):null,M=v&&a?.render?(0,s.jsx)(a.render,{item:l}):null,F=V?.length>0&&(0,s.jsxs)(i.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[k&&(0,s.jsx)(br,{idPrefix:n,primaryAction:k,item:l}),!P&&(0,s.jsxs)("div",{role:"gridcell",children:[(0,s.jsxs)(vr,{placement:"bottom-end",children:[(0,s.jsx)(vr.TriggerButton,{render:(0,s.jsx)(i.Composite.Item,{id:gr(n),render:(0,s.jsx)(i.Button,{size:"small",icon:Fi,label:(0,d.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:f})})}),(0,s.jsx)(vr.Popover,{children:(0,s.jsx)(Li,{actions:V,item:l,registry:y,setActiveModalAction:I})})]}),!!S&&(0,s.jsx)(Bi,{action:S,items:[l],closeModal:()=>I(null)})]})]});return(0,s.jsx)(i.Composite.Row,{ref:b,render:(0,s.jsx)("div",{}),role:"row",className:G({"is-selected":o,"is-hovered":j}),onMouseEnter:E,onMouseLeave:E,children:(0,s.jsxs)(i.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,s.jsx)("div",{role:"gridcell",children:(0,s.jsx)(i.Composite.Item,{id:_r(n),"aria-pressed":o,"aria-labelledby":h,"aria-describedby":w,className:"dataviews-view-list__item",onClick:()=>m(l)})}),(0,s.jsxs)(i.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[N,(0,s.jsxs)(i.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,s.jsxs)(i.__experimentalHStack,{spacing:0,children:[(0,s.jsx)("div",{className:"dataviews-title-field",id:h,children:M}),F]}),g&&u?.render&&(0,s.jsx)("div",{className:"dataviews-view-list__field",children:(0,s.jsx)(u.render,{item:l})}),(0,s.jsx)("div",{className:"dataviews-view-list__fields",id:w,children:p.map(e=>(0,s.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,s.jsx)(i.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,s.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,s.jsx)(e.render,{item:l})})]},e.id))})]})]})]})})}function wr(e){return!!e}const xr=[{type:H,label:(0,d.__)("Table"),component:function({actions:e,data:t,fields:n,getItemId:o,getItemLevel:l,isLoading:a=!1,onChangeView:c,onChangeSelection:u,selection:m,setOpenedFilter:p,onClickItem:f,isItemClickable:v,view:_}){var g;const b=(0,r.useRef)(new Map),h=(0,r.useRef)(),[w,x]=(0,r.useState)(),y=Ui(e,t);(0,r.useEffect)(()=>{h.current&&(h.current.focus(),h.current=void 0)});const j=(0,r.useId)();if(w)return h.current=w,void x(void 0);const C=e=>{const t=b.current.get(e.id),n=t?b.current.get(t.fallback):void 0;x(n?.node)},S=!!t?.length,I=n.find(e=>e.id===_.titleField),E=n.find(e=>e.id===_.mediaField),k=n.find(e=>e.id===_.descriptionField),{showTitle:V=!0,showMedia:P=!0,showDescription:N=!0}=_,M=I&&V||E&&P||k&&N,F=null!==(g=_.fields)&&void 0!==g?g:[],O=(e,t)=>n=>{n?b.current.set(e,{node:n,fallback:F[t>0?t-1:1]}):b.current.delete(e)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("table",{className:G("dataviews-view-table",{[`has-${_.layout?.density}-density`]:_.layout?.density&&["compact","comfortable"].includes(_.layout.density)}),"aria-busy":a,"aria-describedby":j,children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"dataviews-view-table__row",children:[y&&(0,s.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,s.jsx)(Ki,{selection:m,onChangeSelection:u,data:t,actions:e,getItemId:o})}),M&&(0,s.jsx)("th",{scope:"col",children:I&&(0,s.jsx)(sr,{ref:O(I.id,0),fieldId:I.id,view:_,fields:n,onChangeView:c,onHide:C,setOpenedFilter:p,canMove:!1})}),F.map((e,t)=>{var i;const{width:r,maxWidth:o,minWidth:l}=null!==(i=_.layout?.styles?.[e])&&void 0!==i?i:{};return(0,s.jsx)("th",{style:{width:r,maxWidth:o,minWidth:l},"aria-sort":_.sort?.direction&&_.sort?.field===e?L[_.sort.direction]:void 0,scope:"col",children:(0,s.jsx)(sr,{ref:O(e,t),fieldId:e,view:_,fields:n,onChangeView:c,onHide:C,setOpenedFilter:p})},e)}),!!e?.length&&(0,s.jsx)("th",{className:"dataviews-view-table__actions-column",children:(0,s.jsx)("span",{className:"dataviews-view-table-header",children:(0,d.__)("Actions")})})]})}),(0,s.jsx)("tbody",{children:S&&t.map((t,i)=>(0,s.jsx)(cr,{item:t,level:_.showLevels&&"function"==typeof l?l(t):void 0,hasBulkActions:y,actions:e,fields:n,id:o(t)||i.toString(),view:_,titleField:I,mediaField:E,descriptionField:k,selection:m,getItemId:o,onChangeSelection:u,onClickItem:f,isItemClickable:v},o(t)))})]}),(0,s.jsx)("div",{className:G({"dataviews-loading":a,"dataviews-no-results":!S&&!a}),id:j,children:!S&&(0,s.jsx)("p",{children:a?(0,s.jsx)(i.Spinner,{}):(0,d.__)("No results")})})]})},icon:ki,viewConfigOptions:function(){const e=(0,r.useContext)(W),t=e.view;return(0,s.jsxs)(i.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:(0,d.__)("Density"),value:t.layout?.density||"balanced",onChange:n=>{e.onChangeView({...t,layout:{...t.layout,density:n}})},isBlock:!0,children:[(0,s.jsx)(i.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,d._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,s.jsx)(i.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,d._x)("Balanced","Density option for DataView layout")},"balanced"),(0,s.jsx)(i.__experimentalToggleGroupControlOption,{value:"compact",label:(0,d._x)("Compact","Density option for DataView layout")},"compact")]})}},{type:$,label:(0,d.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:o,isLoading:l,onChangeSelection:a,onClickItem:c,isItemClickable:u,selection:m,view:p}){var f;const v=n.find(e=>e.id===p?.titleField),_=n.find(e=>e.id===p?.mediaField),g=n.find(e=>e.id===p?.descriptionField),b=null!==(f=p.fields)&&void 0!==f?f:[],{regularFields:h,badgeFields:w}=b.reduce((e,t)=>{const i=n.find(e=>e.id===t);return i?(e[p.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(i),e):e},{regularFields:[],badgeFields:[]}),x=!!t?.length,y=function(){const e=(0,r.useContext)(W).view,t=mr();return(0,r.useMemo)(()=>{const n=e.layout?.previewSize;let i;if(!n)return;const r=ur[t];return n<r.min&&(i=r.min),n>r.max&&(i=r.max),i},[t,e])}(),j=Ui(e,t),C=y||p.layout?.previewSize,S=C?{gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`}:{};return(0,s.jsxs)(s.Fragment,{children:[x&&(0,s.jsx)(i.__experimentalGrid,{gap:8,columns:2,alignment:"top",className:"dataviews-view-grid",style:S,"aria-busy":l,children:t.map(t=>(0,s.jsx)(fr,{view:p,selection:m,onChangeSelection:a,onClickItem:c,isItemClickable:u,getItemId:o,item:t,actions:e,mediaField:_,titleField:v,descriptionField:g,regularFields:h,badgeFields:w,hasBulkActions:j},o(t)))}),!x&&(0,s.jsx)("div",{className:G({"dataviews-loading":l,"dataviews-no-results":!l}),children:(0,s.jsx)("p",{children:l?(0,s.jsx)(i.Spinner,{}):(0,d.__)("No results")})})]})},icon:Vi,viewConfigOptions:function(){const e=mr(),t=(0,r.useContext)(W),n=t.view,o=ur[e],l=n.layout?.previewSize||o.default,a=(0,r.useMemo)(()=>Array.from({length:o.max-o.min+1},(e,t)=>({value:o.min+t})),[o]);return"mobile"===e?null:(0,s.jsx)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,d.__)("Preview size"),value:o.max+o.min-l,marks:a,min:o.min,max:o.max,withInputField:!1,onChange:(e=0)=>{t.onChangeView({...n,layout:{...n.layout,previewSize:o.max+o.min-e}})},step:1})}},{type:"list",label:(0,d.__)("List"),component:function e(t){var n;const{actions:o,data:l,fields:a,getItemId:c,isLoading:u,onChangeSelection:m,selection:f,view:v}=t,_=(0,p.useInstanceId)(e,"view-list"),g=l?.findLast(e=>f.includes(c(e))),b=a.find(e=>e.id===v.titleField),h=a.find(e=>e.id===v.mediaField),w=a.find(e=>e.id===v.descriptionField),x=(null!==(n=v?.fields)&&void 0!==n?n:[]).map(e=>a.find(t=>e===t.id)).filter(wr),y=e=>m([c(e)]),j=(0,r.useCallback)(e=>`${_}-${c(e)}`,[_,c]),C=(0,r.useCallback)((e,t)=>t.startsWith(j(e)),[j]),[S,I]=(0,r.useState)(void 0);(0,r.useEffect)(()=>{g&&I(_r(j(g)))},[g,j]);const E=l.findIndex(e=>C(e,null!=S?S:"")),k=(0,p.usePrevious)(E),V=-1!==E,P=(0,r.useCallback)((e,t)=>{const n=Math.min(l.length-1,Math.max(0,e));if(!l[n])return;const i=t(j(l[n]));I(i),document.getElementById(i)?.focus()},[l,j]);(0,r.useEffect)(()=>{!V&&void 0!==k&&-1!==k&&P(k,_r)},[V,P,k]);const N=(0,r.useCallback)(e=>{"ArrowDown"===e.key&&(e.preventDefault(),P(E+1,gr)),"ArrowUp"===e.key&&(e.preventDefault(),P(E-1,gr))},[P,E]),M=l?.length;return M?(0,s.jsx)(i.Composite,{id:_,render:(0,s.jsx)("div",{}),className:"dataviews-view-list",role:"grid",activeId:S,setActiveId:I,children:l.map(e=>{const t=j(e);return(0,s.jsx)(hr,{view:v,idPrefix:t,actions:o,item:e,isSelected:e===g,onSelect:y,mediaField:h,titleField:b,descriptionField:w,otherFields:x,onDropdownTriggerKeyDown:N},t)})}):(0,s.jsx)("div",{className:G({"dataviews-loading":u,"dataviews-no-results":!M&&!u}),children:!M&&(0,s.jsx)("p",{children:u?(0,s.jsx)(i.Spinner,{}):(0,d.__)("No results")})})},icon:(0,d.isRTL)()?Pi:Ni}];function yr(){const{actions:e=[],data:t,fields:n,getItemId:i,getItemLevel:o,isLoading:l,view:a,onChangeView:c,selection:u,onChangeSelection:d,setOpenedFilter:m,onClickItem:p,isItemClickable:f}=(0,r.useContext)(W),v=xr.find(e=>e.type===a.type)?.component;return(0,s.jsx)(v,{actions:e,data:t,fields:n,getItemId:i,getItemLevel:o,isLoading:l,onChangeView:c,onChangeSelection:d,selection:u,setOpenedFilter:m,onClickItem:p,isItemClickable:f,view:a})}const jr=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),Cr=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})}),Sr=(0,r.memo)(function(){var e;const{view:t,onChangeView:n,paginationInfo:{totalItems:o=0,totalPages:l}}=(0,r.useContext)(W);if(!o||!l)return null;const a=null!==(e=t.page)&&void 0!==e?e:1,c=Array.from(Array(l)).map((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":a===n?(0,d.sprintf)( // translators: Current page number in total number of pages // translators: Current page number in total number of pages (0,d.__)("Page %1$s of %2$s"),a,l):n.toString()}});return!!o&&1!==l&&(0,s.jsxs)(i.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,s.jsx)(i.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,r.createInterpolateElement)((0,d.sprintf)( // translators: 1: Current page number, 2: Total number of pages. // translators: 1: Current page number, 2: Total number of pages. (0,d._x)("<div>Page</div>%1$s<div>of %2$s</div>","paging"),"<CurrentPage />",l),{div:(0,s.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,s.jsx)(i.SelectControl,{"aria-label":(0,d.__)("Current page"),value:a.toString(),options:c,onChange:e=>{n({...t,page:+e})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,s.jsxs)(i.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,s.jsx)(i.Button,{onClick:()=>n({...t,page:a-1}),disabled:1===a,accessibleWhenDisabled:!0,label:(0,d.__)("Previous page"),icon:(0,d.isRTL)()?jr:Cr,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,s.jsx)(i.Button,{onClick:()=>n({...t,page:a+1}),disabled:a>=l,accessibleWhenDisabled:!0,label:(0,d.__)("Next page"),icon:(0,d.isRTL)()?Cr:jr,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})}),Ir=[];function Er(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:o,actions:l=Ir}=(0,r.useContext)(W),a=Ui(l,o)&&[H,$].includes(e.type);return!t||!n||n<=1&&!a?null:!!t&&(0,s.jsxs)(i.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[a&&(0,s.jsx)(Ji,{}),(0,s.jsx)(Sr,{})]})}const kr=(0,r.memo)(function({label:e}){const{view:t,onChangeView:n}=(0,r.useContext)(W),[o,l,a]=(0,p.useDebouncedInput)(t.search);(0,r.useEffect)(()=>{var e;l(null!==(e=t.search)&&void 0!==e?e:"")},[t.search,l]);const c=(0,r.useRef)(n),u=(0,r.useRef)(t);(0,r.useEffect)(()=>{c.current=n,u.current=t},[n,t]),(0,r.useEffect)(()=>{a!==u.current?.search&&c.current({...u.current,page:1,search:a})},[a]);const m=e||(0,d.__)("Search");return(0,s.jsx)(i.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:l,value:o,label:m,placeholder:m,size:"compact"})}),Vr=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),Pr=(0,s.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(a.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),Nr=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})}),{Menu:Mr}=(window.wp.warning,bi(i.privateApis)),Fr={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function Or({defaultLayouts:e={list:{},grid:{},table:{}}}){const{view:t,onChangeView:n}=(0,r.useContext)(W),o=Object.keys(e);if(o.length<=1)return null;const l=xr.find(e=>t.type===e.type);return(0,s.jsxs)(Mr,{children:[(0,s.jsx)(Mr.TriggerButton,{render:(0,s.jsx)(i.Button,{size:"compact",icon:l?.icon,label:(0,d.__)("Layout")})}),(0,s.jsx)(Mr.Popover,{children:o.map(i=>{const r=xr.find(e=>e.type===i);return r?(0,s.jsx)(Mr.RadioItem,{value:i,name:"view-actions-available-view",checked:i===t.type,hideOnClick:!0,onChange:i=>{switch(i.target.value){case"list":case"grid":case"table":const r={...t};return"layout"in r&&delete r.layout,n({...r,type:i.target.value,...e[i.target.value]})}},children:(0,s.jsx)(Mr.ItemLabel,{children:r.label})},i):null})})]})}function Ar(){const{view:e,fields:t,onChangeView:n}=(0,r.useContext)(W),o=(0,r.useMemo)(()=>t.filter(e=>!1!==e.enableSorting).map(e=>({label:e.label,value:e.id})),[t]);return(0,s.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.__)("Sort by"),value:e.sort?.field,options:o,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function Dr(){const{view:e,fields:t,onChangeView:n}=(0,r.useContext)(W);if(0===t.filter(e=>!1!==e.enableSorting).length)return null;let o=e.sort?.direction;return!o&&e.sort?.field&&(o="desc"),(0,s.jsx)(i.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,d.__)("Order"),value:o,onChange:i=>{"asc"!==i&&"desc"!==i||n({...e,sort:{direction:i,field:e.sort?.field||t.find(e=>!1!==e.enableSorting)?.id||""},showLevels:!1})},children:T.map(e=>(0,s.jsx)(i.__experimentalToggleGroupControlOptionIcon,{value:e,icon:z[e],label:R[e]},e))})}const Tr=[10,20,50,100];function Br(){const{view:e,onChangeView:t}=(0,r.useContext)(W);return(0,s.jsx)(i.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,d.__)("Items per page"),value:e.perPage||10,disabled:!e?.sort?.field,onChange:n=>{const i="number"==typeof n||void 0===n?n:parseInt(n,10);t({...e,perPage:i,page:1})},children:Tr.map(e=>(0,s.jsx)(i.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e))})}function Lr({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:r}){return(0,s.jsxs)(Mr,{onOpenChange:n,children:[(0,s.jsx)(Mr.TriggerButton,{render:(0,s.jsx)(i.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:Fi,label:(0,d.__)("Preview")})}),(0,s.jsx)(Mr.Popover,{children:e?.map(({id:e,label:n})=>(0,s.jsx)(Mr.RadioItem,{value:e,checked:e===r,onChange:()=>{t?.(e),(e=>{setTimeout(()=>{const t=document.querySelector(`.dataviews-field-control__field-${e} .dataviews-field-control__field-preview-options-button`);t instanceof HTMLElement&&t.focus()},50)})(e)},children:(0,s.jsx)(Mr.ItemLabel,{children:n})},e))})]})}function Rr({field:e,label:t,description:n,isVisible:o,isFirst:l,isLast:a,canMove:c=!0,onToggleVisibility:u,onMoveUp:m,onMoveDown:p,previewOptions:f,onChangePreviewOption:v}){const[_,g]=(0,r.useState)(!1);return(0,s.jsx)(i.__experimentalItem,{children:(0,s.jsxs)(i.__experimentalHStack,{expanded:!0,className:G("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":_}),justify:"flex-start",children:[(0,s.jsx)("span",{className:"dataviews-field-control__icon",children:!c&&!e.enableHiding&&(0,s.jsx)(i.Icon,{icon:Vr})}),(0,s.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,s.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,s.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,s.jsxs)(i.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Button,{disabled:l||!c,accessibleWhenDisabled:!0,size:"compact",onClick:m,icon:C,label:l||!c?(0,d.__)("This field can't be moved up"):(0,d.sprintf)(/* translators: %s: field label */ /* translators: %s: field label */ (0,d.__)("Move %s up"),e.label)}),(0,s.jsx)(i.Button,{disabled:a||!c,accessibleWhenDisabled:!0,size:"compact",onClick:p,icon:S,label:a||!c?(0,d.__)("This field can't be moved down"):(0,d.sprintf)(/* translators: %s: field label */ /* translators: %s: field label */ (0,d.__)("Move %s down"),e.label)})]}),u&&(0,s.jsx)(i.Button,{className:"dataviews-field-control__field-visibility-button",disabled:!e.enableHiding,accessibleWhenDisabled:!0,size:"compact",onClick:()=>{u(),setTimeout(()=>{const t=document.querySelector(`.dataviews-field-control__field-${e.id} .dataviews-field-control__field-visibility-button`);t instanceof HTMLElement&&t.focus()},50)},icon:o?tr:Pr,label:o?(0,d.sprintf)(/* translators: %s: field label */ /* translators: %s: field label */ (0,d._x)("Hide %s","field"),e.label):(0,d.sprintf)(/* translators: %s: field label */ /* translators: %s: field label */ (0,d._x)("Show %s","field"),e.label)}),f&&(0,s.jsx)(Lr,{previewOptions:f,onChangePreviewOption:v,onMenuOpenChange:g,activeOption:e.id})]})]})})}function zr({index:e,field:t,view:n,onChangeView:i}){var r;const o=null!==(r=n.fields)&&void 0!==r?r:[],l=void 0!==e&&o.includes(t.id);return(0,s.jsx)(Rr,{field:t,isVisible:l,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===o.length-1,onToggleVisibility:()=>{i({...n,fields:l?o.filter(e=>e!==t.id):[...o,t.id]})},onMoveUp:void 0!==e?()=>{var r;i({...n,fields:[...null!==(r=o.slice(0,e-1))&&void 0!==r?r:[],t.id,o[e-1],...o.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{var r;i({...n,fields:[...null!==(r=o.slice(0,e))&&void 0!==r?r:[],o[e+1],t.id,...o.slice(e+2)]})}:void 0})}function Hr(e){return!!e}function $r(){var e;const{view:t,fields:n,onChangeView:o}=(0,r.useContext)(W),l=[t?.titleField,t?.mediaField,t?.descriptionField].filter(Boolean),a=null!==(e=t.fields)&&void 0!==e?e:[],c=n.filter(e=>!a.includes(e.id)&&!l.includes(e.id)&&"media"!==e.type),u=a.map(e=>n.find(t=>t.id===e)).filter(Hr);if(!u?.length&&!c?.length)return null;const m=n.find(e=>e.id===t.titleField),p=n.find(e=>e.id===t.mediaField),f=n.find(e=>e.id===t.descriptionField),v=n.filter(e=>"media"===e.type);let _;if(v.length>1){var g;const e=Hr(p)&&(null===(g=t.showMedia)||void 0===g||g);_=Hr(p)&&(0,s.jsx)(Rr,{field:p,label:(0,d.__)("Preview"),description:p.label,isVisible:e,onToggleVisibility:()=>{o({...t,showMedia:!e})},canMove:!1,previewOptions:v.map(e=>({label:e.label,id:e.id})),onChangePreviewOption:e=>o({...t,mediaField:e})},p.id)}const b=[{field:m,isVisibleFlag:"showTitle"},{field:p,isVisibleFlag:"showMedia",ui:_},{field:f,isVisibleFlag:"showDescription"}].filter(({field:e})=>Hr(e)),h=b.filter(({field:e,isVisibleFlag:n})=>{var i;return Hr(e)&&(null===(i=t[n])||void 0===i||i)}),w=b.filter(({field:e,isVisibleFlag:n})=>{var i;return Hr(e)&&!(null===(i=t[n])||void 0===i||i)});return(0,s.jsxs)(i.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,s.jsx)(i.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(h.length>0||!!u?.length)&&(0,s.jsxs)(i.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[h.map(({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,s.jsx)(Rr,{field:e,isVisible:!0,onToggleVisibility:()=>{o({...t,[n]:!1})},canMove:!1},e.id)),u.map((e,n)=>(0,s.jsx)(zr,{field:e,view:t,onChangeView:o,index:n},e.id))]})}),(!!c?.length||!!w.length)&&(0,s.jsxs)(i.__experimentalVStack,{spacing:4,children:[(0,s.jsx)(i.BaseControl.VisualLabel,{style:{margin:0},children:(0,d.__)("Hidden")}),(0,s.jsx)(i.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,s.jsxs)(i.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[w.length>0&&w.map(({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,s.jsx)(Rr,{field:e,isVisible:!1,onToggleVisibility:()=>{o({...t,[n]:!0})},canMove:!1},e.id)),c.map(e=>(0,s.jsx)(zr,{field:e,view:t,onChangeView:o},e.id))]})})]})]})}function Wr({title:e,description:t,children:n}){return(0,s.jsxs)(i.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,s.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,s.jsx)(i.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,s.jsx)(i.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,s.jsx)(i.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function Ur(){const{view:e}=(0,r.useContext)(W),t=(0,p.useInstanceId)(Kr,"dataviews-view-config-dropdown"),n=xr.find(t=>t.type===e.type);return(0,s.jsx)(i.Dropdown,{expandOnMobile:!0,popoverProps:{...Fr,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,s.jsx)(i.Button,{size:"compact",icon:Nr,label:(0,d._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,s.jsx)(i.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,s.jsxs)(i.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,s.jsxs)(Wr,{title:(0,d.__)("Appearance"),children:[(0,s.jsxs)(i.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,s.jsx)(Ar,{}),(0,s.jsx)(Dr,{})]}),!!n?.viewConfigOptions&&(0,s.jsx)(n.viewConfigOptions,{}),(0,s.jsx)(Br,{})]}),(0,s.jsx)(Wr,{title:(0,d.__)("Properties"),children:(0,s.jsx)($r,{})})]})})})}function Kr({defaultLayouts:e={list:{},grid:{},table:{}}}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Or,{defaultLayouts:e}),(0,s.jsx)(Ur,{})]})}const Gr=(0,r.memo)(Kr),qr={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:function(e,t){if(""===e)return!1;if(!Number.isInteger(Number(e)))return!1;if(t?.elements){const n=t?.elements.map(e=>e.value);if(!n.includes(Number(e)))return!1}return!0},Edit:"integer"},Yr={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:function(e,t){if(t?.elements){const n=t?.elements?.map(e=>e.value);if(!n.includes(e))return!1}return!0},Edit:"text"},Zr={sort:function(e,t,n){const i=new Date(e).getTime(),r=new Date(t).getTime();return"asc"===n?i-r:r-i},isValid:function(e,t){if(t?.elements){const n=t?.elements.map(e=>e.value);if(!n.includes(e))return!1}return!0},Edit:"datetime"},Xr={datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:o}){const{id:l,label:a}=t,c=t.getValue({item:e}),u=(0,r.useCallback)(e=>n({[l]:e}),[l,n]);return(0,s.jsxs)("fieldset",{className:"dataviews-controls__datetime",children:[!o&&(0,s.jsx)(i.BaseControl.VisualLabel,{as:"legend",children:a}),o&&(0,s.jsx)(i.VisuallyHidden,{as:"legend",children:a}),(0,s.jsx)(i.TimePicker,{currentTime:c,onChange:u,hideLabelFromVision:!0})]})},integer:function({data:e,field:t,onChange:n,hideLabelFromVision:o}){var l;const{id:a,label:c,description:u}=t,d=null!==(l=t.getValue({item:e}))&&void 0!==l?l:"",m=(0,r.useCallback)(e=>n({[a]:Number(e)}),[a,n]);return(0,s.jsx)(i.__experimentalNumberControl,{label:c,help:u,value:d,onChange:m,__next40pxDefaultSize:!0,hideLabelFromVision:o})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:o}){const{id:l,label:a}=t,c=t.getValue({item:e}),u=(0,r.useCallback)(e=>n({[l]:e}),[l,n]);return t.elements?(0,s.jsx)(i.RadioControl,{label:a,onChange:u,options:t.elements,selected:c,hideLabelFromVision:o}):null},select:function({data:e,field:t,onChange:n,hideLabelFromVision:o}){var l,a;const{id:c,label:u}=t,m=null!==(l=t.getValue({item:e}))&&void 0!==l?l:"",p=(0,r.useCallback)(e=>n({[c]:e}),[c,n]),f=[{label:(0,d.__)("Select item"),value:""},...null!==(a=t?.elements)&&void 0!==a?a:[]];return(0,s.jsx)(i.SelectControl,{label:u,value:m,options:f,onChange:p,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:o})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:o}){const{id:l,label:a,placeholder:c}=t,u=t.getValue({item:e}),d=(0,r.useCallback)(e=>n({[l]:e}),[l,n]);return(0,s.jsx)(i.TextControl,{label:a,placeholder:c,value:null!=u?u:"",onChange:d,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:o})}};function Jr(e){if(Object.keys(Xr).includes(e))return Xr[e];throw"Control "+e+" not found"}const Qr=e=>e.id,es=()=>!0,ts=[];function ns({view:e,onChangeView:t,fields:n,search:o=!0,searchLabel:l,actions:a=ts,data:c,getItemId:u=Qr,getItemLevel:d,isLoading:m=!1,paginationInfo:f,defaultLayouts:v,selection:_,onChangeSelection:g,onClickItem:b,isItemClickable:h=es,header:w}){const[x,y]=(0,r.useState)(0),j=(0,p.useResizeObserver)(e=>{y(e[0].borderBoxSize[0].inlineSize)},{box:"border-box"}),[C,S]=(0,r.useState)([]),I=void 0===_||void 0===g,E=I?C:_,[k,V]=(0,r.useState)(null),P=(0,r.useMemo)(()=>function(e){return e.map(e=>{var t,n,i,r;const s="integer"===(o=e.type)?qr:"text"===o?Yr:"datetime"===o?Zr:{sort:(e,t,n)=>"number"==typeof e&&"number"==typeof t?"asc"===n?e-t:t-e:"asc"===n?e.localeCompare(t):t.localeCompare(e),isValid:(e,t)=>{if(t?.elements){const n=t?.elements?.map(e=>e.value);if(!n.includes(e))return!1}return!0},Edit:()=>null};var o;const l=e.getValue||(a=e.id,({item:e})=>{const t=a.split(".");let n=e;for(const e of t)n=n.hasOwnProperty(e)?n[e]:void 0;return n});var a;const c=null!==(t=e.sort)&&void 0!==t?t:function(e,t,n){return s.sort(l({item:e}),l({item:t}),n)},u=null!==(n=e.isValid)&&void 0!==n?n:function(e,t){return s.isValid(l({item:e}),t)},d=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?Jr(e.Edit):e.elements?Jr("select"):"string"==typeof t.Edit?Jr(t.Edit):t.Edit}(e,s),m=e.render||(e.elements?({item:t})=>{const n=l({item:t});return e?.elements?.find(e=>e.value===n)?.label||l({item:t})}:l);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:l,render:m,sort:c,isValid:u,Edit:d,enableHiding:null===(i=e.enableHiding)||void 0===i||i,enableSorting:null===(r=e.enableSorting)||void 0===r||r}})}(n),[n]),N=(0,r.useMemo)(()=>E.filter(e=>c.some(t=>u(t)===e)),[E,c,u]),M=Ci(P,e),[F,O]=(0,r.useState)(()=>(M||[]).some(e=>e.isPrimary));return(0,s.jsx)(W.Provider,{value:{view:e,onChangeView:t,fields:P,actions:a,data:c,isLoading:m,paginationInfo:f,selection:N,onChangeSelection:function(e){const t="function"==typeof e?e(E):e;I&&S(t),g&&g(t)},openedFilter:k,setOpenedFilter:V,getItemId:u,getItemLevel:d,isItemClickable:h,onClickItem:b,containerWidth:x},children:(0,s.jsxs)("div",{className:"dataviews-wrapper",ref:j,children:[(0,s.jsxs)(i.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,s.jsxs)(i.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[o&&(0,s.jsx)(kr,{label:l}),(0,s.jsx)(Si,{filters:M,view:e,onChangeView:t,setOpenedFilter:V,setIsShowingFilter:O,isShowingFilter:F})]}),(0,s.jsxs)(i.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,s.jsx)(Gr,{defaultLayouts:v}),w]})]}),F&&(0,s.jsx)(Ei,{}),(0,s.jsx)(yr,{}),(0,s.jsx)(Er,{})]})})}const is=window.wc.wcSettings;function rs(e,t){let n;switch(t){case"day":n=(0,d._n)("day","days",e,"woocommerce-subscriptions");break;case"week":n=(0,d._n)("week","weeks",e,"woocommerce-subscriptions");break;case"month":n=(0,d._n)("month","months",e,"woocommerce-subscriptions");break;case"year":n=(0,d._n)("year","years",e,"woocommerce-subscriptions");break;default:n=t}return`${e} ${n}`}function ss(){const e=(0,is.getSetting)("currency",{});return{symbol:e.symbol||"$",precision:void 0!==e.precision?e.precision:2,decimalSeparator:e.decimalSeparator||"."}}function os(e,t=!1){const{symbol:n,precision:i,decimalSeparator:r}=ss();return t?i>0?`0${r}${"0".repeat(i)}`:"0":e&&0!==e?`${n}${parseFloat(e).toFixed(i)}`:"—"}const ls={table:{}},as=["frequency","discount","expires","signup_fee","trial"];function cs({plans:e,isProductMode:t,onAddPlan:n,onEditPlan:o,onDeletePlan:l,onReorderPlans:a}){const{labels:c}=w(),[u,m]=(0,r.useState)(null),[p,f]=(0,r.useState)(null!=e?e:[]),v=(0,r.useRef)(null),_=(0,r.useRef)(u),g=(0,r.useRef)(p),b=(0,r.useRef)(e),h=(0,r.useRef)(a);(0,r.useEffect)(()=>{f(null!=e?e:[]),b.current=null!=e?e:[]},[e]),(0,r.useEffect)(()=>{_.current=u},[u]),(0,r.useEffect)(()=>{g.current=p},[p]),(0,r.useEffect)(()=>{h.current=a},[a]);const[x,y]=(0,r.useState)({type:"table",perPage:100,page:1,search:"",filters:[],fields:as,titleField:"drag",layout:{}}),E=(0,r.useMemo)(()=>[{id:"drag",label:(0,d.__)("Reorder","woocommerce-subscriptions"),header:"",enableSorting:!1,enableHiding:!1,render:()=>(0,s.jsx)("span",{className:"wcsatt-column__drag-handle",role:"img","aria-label":(0,d.__)("Drag to reorder","woocommerce-subscriptions"),children:(0,s.jsx)(i.Icon,{icon:j})})},{id:"frequency",label:(0,d.__)("Frequency","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>rs(e.subscription_period_interval,e.subscription_period)},{id:"discount",label:(0,d.__)("Discount","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>function(e){const t=e.subscription_pricing_method||"inherit";if("inherit"===t)return function(e){const t=parseFloat(e||0);return t&&0!==t?`${t}%`:"—"}(e.subscription_discount);if("fixed_discount"===t){const t=parseFloat(e.subscription_discount||0);return t?os(t):"—"}const n=parseFloat(e.subscription_regular_price||0),i=parseFloat(e.subscription_sale_price||0);return n>0&&i>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("del",{children:os(n)})," ",os(i)]}):i>0?os(i):n>0?os(n):"—"}(e)},{id:"expires",label:(0,d.__)("Expiration","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>function(e,t=1){const n=parseInt(e||0,10),i=parseInt(t,10)||1;if(!n||0===n)return"—";const r=Math.max(1,Math.floor(n/i));return(0,d.sprintf)(/* translators: %d: number of payments */ /* translators: %d: number of payments */ (0,d._n)("%d payment","%d payments",r,"woocommerce-subscriptions"),r)}(e.subscription_length,e.subscription_period_interval)},{id:"signup_fee",label:(0,d.__)("Signup fee","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>os(e.subscription_signup_fee)},{id:"trial",label:(0,d.__)("Free trial","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>function(e,t){const n=parseInt(e||0,10);return n<=0?"—":rs(n,t||"day")}(e.subscription_trial_length,e.subscription_trial_period)}],[]),k=(0,r.useCallback)((e,t)=>{const n=g.current,i=n.findIndex(t=>t.id===e.id),r="up"===t?i-1:i+1;if(-1===i||r<0||r>=n.length)return;const s=[...n],[o]=s.splice(i,1);s.splice(r,0,o),f(s),a(s)},[a]),V=(0,r.useMemo)(()=>[{id:"edit",label:(0,d.__)("Edit","woocommerce-subscriptions"),supportsBulk:!1,callback:e=>o(e[0])},{id:"move-up",label:(0,d.__)("Move up","woocommerce-subscriptions"),icon:C,supportsBulk:!1,isEligible:e=>p.findIndex(t=>t.id===e.id)>0,callback:e=>k(e[0],"up")},{id:"move-down",label:(0,d.__)("Move down","woocommerce-subscriptions"),icon:S,supportsBulk:!1,isEligible:e=>{const t=p.findIndex(t=>t.id===e.id);return-1!==t&&t<p.length-1},callback:e=>k(e[0],"down")},{id:"delete",label:(0,d.__)("Delete","woocommerce-subscriptions"),isDestructive:!0,supportsBulk:!1,modalHeader:(0,d.__)("Delete subscription plan","woocommerce-subscriptions"),RenderModal:({items:e,closeModal:t})=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:(0,d.__)("Are you sure you want to delete this subscription plan?","woocommerce-subscriptions")}),(0,s.jsxs)("div",{className:"wcsatt-delete-confirm-modal__actions",children:[(0,s.jsx)(i.Button,{variant:"tertiary",onClick:t,children:(0,d.__)("Cancel","woocommerce-subscriptions")}),(0,s.jsx)(i.Button,{variant:"primary",isDestructive:!0,onClick:()=>{l(e[0].id),t()},children:(0,d.__)("Delete","woocommerce-subscriptions")})]})]})}],[o,l,k,p]),P=(0,r.useCallback)(e=>String(e.id),[]),N=(0,r.useMemo)(()=>({totalItems:p.length,totalPages:1}),[p.length]);return(0,r.useEffect)(()=>{const e=v.current;if(!e)return;const t=e.querySelectorAll(".dataviews-view-table tbody tr"),n=e=>{const t=Number(e.currentTarget.dataset.wcsattIndex);m(t)},i=e=>{e.preventDefault();const t=Number(e.currentTarget.dataset.wcsattIndex),n=_.current;if(null===n||n===t)return;const i=[...g.current],[r]=i.splice(n,1);i.splice(t,0,r),f(i),m(t)},r=async()=>{const e=g.current,t=b.current,n=e.some((e,n)=>e.id!==t[n]?.id);null!==_.current&&n&&await h.current(e),m(null)},s=[];return t.forEach((e,t)=>{var o;e.setAttribute("draggable","true"),e.dataset.wcsattIndex=String(t),e.dataset.planId=String(null!==(o=p[t]?.id)&&void 0!==o?o:""),e.classList.toggle("is-dragging",u===t),e.addEventListener("dragstart",n),e.addEventListener("dragover",i),e.addEventListener("dragend",r),s.push(()=>{e.removeEventListener("dragstart",n),e.removeEventListener("dragover",i),e.removeEventListener("dragend",r)})}),()=>s.forEach(e=>e())},[p,u]),p&&p.length>0?(0,s.jsxs)("div",{className:"wcsatt-plans-table-wrapper",ref:v,children:[(0,s.jsx)(ns,{data:p,fields:E,view:x,onChangeView:y,actions:V,getItemId:P,paginationInfo:N,defaultLayouts:ls,search:!1}),(0,s.jsx)("div",{className:"wcsatt-plans-table-footer "+(t?"is-product-mode":""),children:(0,s.jsx)(i.Button,{variant:"secondary",icon:I,onClick:n,children:c.addButtonText})})]}):(0,s.jsxs)("div",{className:"wcsatt-plans-table-wrapper",children:[(0,s.jsx)("div",{className:"wcsatt-plans-table-empty",children:c.emptyStateMessage}),(0,s.jsx)("div",{className:"wcsatt-plans-table-footer "+(t?"is-product-mode":""),children:(0,s.jsx)(i.Button,{variant:"secondary",icon:I,onClick:n,children:c.addButtonText})})]})}const us={day:90,week:52,month:24,year:5},ds=["day","week","month","year"];function ms(e,t){if(!ds.includes(t))return{valid:!1,message:(0,d.sprintf)(/* translators: %s: the invalid period value */ /* translators: %s: the invalid period value */ (0,d.__)("Invalid trial period: %s. Must be one of: day, week, month, year.","woocommerce-subscriptions"),t)};const n=Number(e);if(isNaN(n))return{valid:!1,message:(0,d.__)("Trial length must be a number.","woocommerce-subscriptions")};const i=Math.floor(n);if(i<0)return{valid:!1,message:(0,d.__)("Trial length cannot be negative.","woocommerce-subscriptions")};const r=us[t];return i>r?{valid:!1,message:(0,d.sprintf)(/* translators: 1: the maximum allowed value, 2: the period */ /* translators: 1: the maximum allowed value, 2: the period */ (0,d.__)("Trial length cannot exceed %1$d %2$ss.","woocommerce-subscriptions"),r,t)}:{valid:!0,message:""}}function ps(e){if(""===e||null==e)return{valid:!0,message:""};const t=Number(e);return isNaN(t)?{valid:!1,message:(0,d.__)("Signup fee must be a number.","woocommerce-subscriptions")}:t<0?{valid:!1,message:(0,d.__)("Signup fee cannot be negative.","woocommerce-subscriptions")}:{valid:!0,message:""}}function fs(e,t){if("inherit"===t)return{valid:!0,message:""};if("override"===t&&(""===e||null==e))return{valid:!1,message:(0,d.__)("Regular price is required when overriding product price.","woocommerce-subscriptions")};const n=Number(e);return isNaN(n)?{valid:!1,message:(0,d.__)("Regular price must be a number.","woocommerce-subscriptions")}:n<0?{valid:!1,message:(0,d.__)("Regular price cannot be negative.","woocommerce-subscriptions")}:{valid:!0,message:""}}function vs(e,t,n){if("inherit"===n)return{valid:!0,message:""};if(""===e||null==e)return{valid:!0,message:""};const i=Number(e);if(isNaN(i))return{valid:!1,message:(0,d.__)("Sale price must be a number.","woocommerce-subscriptions")};if(i<0)return{valid:!1,message:(0,d.__)("Sale price cannot be negative.","woocommerce-subscriptions")};if(""!==t&&null!=t){const e=Number(t);if(!isNaN(e)&&i>=e)return{valid:!1,message:(0,d.__)("Sale price must be less than regular price.","woocommerce-subscriptions")}}return{valid:!0,message:""}}function _s(e,t,n){return"override"!==n||""!==e&&null!=e?{valid:!0,message:""}:{valid:!1,message:(0,d.__)("Regular price is required when overriding product price.","woocommerce-subscriptions")}}function gs(e){return ds.includes(e)?us[e]:null}function bs(){return{validateTrialLength:ms,validateSignupFee:ps,validateRegularPrice:fs,validateSalePrice:vs,validatePriceOverride:_s,getTrialMaxValue:gs}}const hs=(0,s.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(a.Path,{d:"M7 11.5h10V13H7z"})});function ws({label:e,value:t,onChange:n,onBlur:o,min:l=0,max:a=1/0,step:c=1,help:u}){const[m,p]=(0,r.useState)(0),f=(0,r.useRef)(null),v=(0,r.useRef)(!1);function _(){p(0)}function g(e){const i=parseFloat(t||"0");let r=i+e;r>a?r=a:r<l&&(r=l),r!==i&&(n(String(r)),p(e),v.current=!0)}return(0,r.useEffect)(()=>(0!==m?(f.current=setTimeout(function(){const e=parseFloat(t||"0");let i=e+m;i>a?i=a:i<l&&(i=l),i!==e&&n(String(i))},v.current?500:100),v.current=!1):f.current&&clearTimeout(f.current),()=>{f.current&&clearTimeout(f.current)}),[m,t,l,a,n]),(0,s.jsx)(i.__experimentalInputControl,{__next40pxDefaultSize:!0,className:"wcsatt-number-control",type:"number",label:e,value:t,onChange:n,onBlur:o,min:l,max:a,step:c,help:u,suffix:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Button,{icon:I,disabled:parseFloat(t||"0")>=a,onMouseDown:()=>g(c),onMouseLeave:_,onMouseUp:_,onBlur:o,size:"small","aria-hidden":"true","aria-label":(0,d.__)("Increment","woocommerce-subscriptions"),tabIndex:-1}),(0,s.jsx)(i.Button,{icon:hs,disabled:parseFloat(t||"0")<=l,onMouseDown:()=>g(-c),onMouseLeave:_,onMouseUp:_,onBlur:o,size:"small","aria-hidden":"true","aria-label":(0,d.__)("Decrement","woocommerce-subscriptions"),tabIndex:-1})]})})}function xs({period:e,value:t,syncOptions:n,onChange:o}){const l=(0,r.createInterpolateElement)((0,d.__)("Align subscription renewals to a specific day of the week, month or year. <a>Learn more</a>","woocommerce-subscriptions"),{a:(0,s.jsx)(i.ExternalLink,{href:"https://woocommerce.com/document/subscriptions/billing-date-alignment/"})});var a,c;if("week"===e||"month"===e)return(0,s.jsxs)("div",{className:"wcsatt-field-group wcsatt-align-billing-field",children:[(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Align Renewal","woocommerce-subscriptions"),"aria-label":"week"===e?(0,d.__)("Align Renewal – Day of Week","woocommerce-subscriptions"):(0,d.__)("Align Renewal – Day of Month","woocommerce-subscriptions"),value:String(null!==(a=t?.day)&&void 0!==a?a:0),options:null!==(c=n[e])&&void 0!==c?c:[],onChange:e=>o({day:parseInt(e,10)})}),(0,s.jsx)("p",{className:"description wcsatt-align-billing-field__description",children:l})]});if("year"===e){var u,m;const e="object"==typeof t&&null!==t&&t.month?String(parseInt(t.month,10)).padStart(2,"0"):"0",r=null!==(u=n.year)&&void 0!==u?u:[],a=[0,31,28,31,30,31,30,31,31,30,31,30,31],c=null!==(m=a[parseInt(e,10)])&&void 0!==m?m:0,p=Array.from({length:c},(e,t)=>({value:String(t+1),label:String(t+1)})),f=e=>{const n=parseInt(e,10);if(n){var i;const e="object"==typeof t&&null!==t&&t.day?t.day:1,r=null!==(i=a[n])&&void 0!==i?i:31;o({month:n,day:Math.min(e,r)})}else o({day:0})},v=t=>{o({month:parseInt(e,10),day:parseInt(t,10)})};return(0,s.jsxs)("div",{className:"wcsatt-field-group wcsatt-align-billing-field",children:[(0,s.jsxs)("div",{className:"wcsatt-field-group-horizontal",role:"group","aria-label":(0,d.__)("Yearly renewal alignment date","woocommerce-subscriptions"),children:[(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Align Renewal","woocommerce-subscriptions"),"aria-label":(0,d.__)("Align Renewal – Month","woocommerce-subscriptions"),value:e,options:r,onChange:f}),(0,s.jsx)("div",{"aria-live":"polite",children:"0"!==e&&(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Day of Month","woocommerce-subscriptions"),value:"object"==typeof t&&null!==t?String(t.day):"",options:p,onChange:v})})]}),(0,s.jsx)("p",{className:"description wcsatt-align-billing-field__description",children:l})]})}return null}function ys({message:e}){return(0,s.jsx)("p",{className:"wcsatt-error-message","aria-live":"polite",role:"status",children:e||""})}function js({discountType:e,discountValue:t,currencySymbol:n,currencyStep:r,error:o,onTypeChange:l,onValueChange:a,onValueBlur:c}){const u="fixed_discount"===e,m=[{label:(0,d.__)("Percentage","woocommerce-subscriptions"),value:"inherit"},{label:(0,d.__)("Fixed amount","woocommerce-subscriptions"),value:"fixed_discount"}];return(0,s.jsxs)("div",{className:"wcsatt-field-group",children:[(0,s.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,s.jsx)(i.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Discount","woocommerce-subscriptions"),"aria-label":(0,d.__)("Discount value","woocommerce-subscriptions"),type:"number",value:t,onChange:a,onBlur:c,step:u?r:"0.1",min:"0",...!u&&{max:"100"},...u?{prefix:(0,s.jsx)(i.__experimentalInputControlPrefixWrapper,{children:n})}:{suffix:(0,s.jsx)(i.__experimentalInputControlSuffixWrapper,{children:"%"})}}),(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,"aria-label":(0,d.__)("Discount type","woocommerce-subscriptions"),value:e,options:m,onChange:l})]}),(0,s.jsx)(ys,{message:o})]})}function Cs({regularPrice:e,salePrice:t,currencySymbol:n,currencyStep:r,currencyPlaceholder:o,regularPriceError:l,salePriceError:a,onRegularPriceChange:c,onRegularPriceBlur:u,onSalePriceChange:m,onSalePriceBlur:p}){return(0,s.jsx)("div",{className:"wcsatt-field-group",children:(0,s.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(i.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Regular Price","woocommerce-subscriptions"),type:"number",value:e,prefix:(0,s.jsx)(i.__experimentalInputControlPrefixWrapper,{children:n}),onChange:c,onBlur:u,step:r,min:"0",placeholder:o}),(0,s.jsx)(ys,{message:l})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(i.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Sale Price","woocommerce-subscriptions"),type:"number",value:t,prefix:(0,s.jsx)(i.__experimentalInputControlPrefixWrapper,{children:n}),onChange:m,onBlur:p,step:r,min:"0",placeholder:o}),(0,s.jsx)(ys,{message:a})]})]})})}const Ss={day:3650,week:520,month:120,year:10};function Is(e,t){const n=Ss[e]||120;return Math.floor(n/t)}function Es(e,t,n,i){if(!t)return null;const r=parseInt(e,10);return!r||r<1?(0,d.__)("Total number of payments must be at least 1.","woocommerce-subscriptions"):r>Is(n,i)?(0,d.__)("The total subscription duration cannot exceed 10 years.","woocommerce-subscriptions"):null}const ks=(0,r.forwardRef)(function({subscriptionLength:e,billingInterval:t,billingPeriod:n,onChange:o,onFieldChange:l,onValidationChange:a},c){const u=parseInt(e,10)||0,m=parseInt(t,10)||1,p=n||"month",[f,v]=(0,r.useState)(u>0),[_,g]=(0,r.useState)(function(e,t){return e<=0?1:Math.max(1,Math.floor(e/t))}(u,m)),[b,h]=(0,r.useState)(null),w=e=>{h(e),a&&a(e)},x=Is(p,m);return(0,r.useEffect)(()=>{f&&o(String(_*m))},[m]),(0,r.useEffect)(()=>{f&&_>0&&w(Es(_,f,p,m))},[p,m]),(0,r.useImperativeHandle)(c,()=>({validate(){const e=Es(_,f,p,m);return w(e),!e}})),(0,s.jsxs)("div",{className:"wcsatt-field-group",children:[(0,s.jsx)(i.CheckboxControl,{label:(0,d.__)("Expire subscription after a set number of payments","woocommerce-subscriptions"),checked:f,onChange:e=>{v(e),w(null);const t=e&&_<1?1:_;e&&_<1&&g(t);const n=e?String(t*m):"0";o(n),l&&l()}}),f&&(0,s.jsxs)("div",{className:"wcsatt-total-payments-field",children:[(0,s.jsx)(ws,{label:(0,d.__)("Total number of payments","woocommerce-subscriptions"),value:_,onChange:e=>{const t=parseInt(e,10)||0;g(t),w(null);const n=f?String(t*m):"0";o(n),l&&l()},onBlur:()=>{w(Es(_,f,p,m))},min:1,max:x,step:1,help:(0,d.__)("The number of payments, including the initial purchase, before the subscription automatically expires.","woocommerce-subscriptions")}),(0,s.jsx)(ys,{message:b})]})]})});function Vs({plan:e,isDisabled:t=!1,onCancel:n,onSave:o,onFieldChange:l}){var a,c;const{validateTrialLength:u,validateSignupFee:m,validateRegularPrice:p,validateSalePrice:f,getTrialMaxValue:v}=bs(),{isProductContext:_}=w(),g=(0,is.getSetting)("currency",{}).symbol||"$",b=function(){const{precision:e}=ss();return e>0?(1/Math.pow(10,e)).toFixed(e):"1"}(),h=os(0,!0),x=null!==(a=window.wcsatt_admin_params?.sync_options)&&void 0!==a?a:{},y={subscription_period_interval:e?.subscription_period_interval||1,subscription_period:e?.subscription_period||"month",subscription_length:e?.subscription_length||"0",subscription_discount:e?.subscription_discount||"0",subscription_pricing_method:e?.subscription_pricing_method||"inherit",subscription_signup_fee:e?.subscription_signup_fee||"",subscription_trial_length:e?.subscription_trial_length||"0",subscription_trial_period:e?.subscription_trial_period||"day",subscription_payment_sync_date:null!==(c=e?.subscription_payment_sync_date)&&void 0!==c?c:{day:0}};_&&(y.subscription_regular_price=e?.subscription_regular_price||"",y.subscription_sale_price=e?.subscription_sale_price||"");const[j,C]=(0,r.useState)(y),S=_,I=_&&"override"===j.subscription_pricing_method,[E,k]=(0,r.useState)({}),V=e=>{const t=Array.isArray(e)?e:[e];k(e=>{const n={...e};return t.forEach(e=>delete n[e]),n})},P=(0,r.useRef)(!1),N=(0,r.useRef)(null),M=e=>{switch(e){case"subscription_signup_fee":{const e=m(j.subscription_signup_fee);return e.valid?null:e.message}case"subscription_trial_length":{const e=u(j.subscription_trial_length,j.subscription_trial_period);return e.valid?null:e.message}case"subscription_period_interval":return!j.subscription_period_interval||j.subscription_period_interval<1?(0,d.__)("Frequency interval is required and must be at least 1.","woocommerce-subscriptions"):null;case"subscription_discount":return _&&"override"===j.subscription_pricing_method||j.subscription_discount?j.subscription_discount&&parseFloat(j.subscription_discount)<0?(0,d.__)("Discount cannot be negative.","woocommerce-subscriptions"):"inherit"===j.subscription_pricing_method&&j.subscription_discount&&parseFloat(j.subscription_discount)>100?(0,d.__)("Percentage discount cannot exceed 100%.","woocommerce-subscriptions"):null:(0,d.__)("Discount is required.","woocommerce-subscriptions");case"subscription_regular_price":{const e=p(j.subscription_regular_price,j.subscription_pricing_method);return e.valid?null:e.message}case"subscription_sale_price":{const e=f(j.subscription_sale_price,j.subscription_regular_price,j.subscription_pricing_method);return e.valid?null:e.message}default:return null}},F=(e,t)=>{C(n=>({...n,[e]:t})),V(e),l&&l()};(0,r.useEffect)(()=>{if(j.subscription_trial_length>0){const e=u(j.subscription_trial_length,j.subscription_trial_period);e.valid?k(e=>{const t={...e};return delete t.subscription_trial_length,t}):k(t=>({...t,subscription_trial_length:e.message}))}},[j.subscription_trial_period,j.subscription_trial_length,u]),(0,r.useEffect)(()=>{V(["subscription_regular_price","subscription_sale_price","subscription_discount"])},[j.subscription_pricing_method]),(0,r.useEffect)(()=>{P.current?C(e=>({...e,subscription_payment_sync_date:{day:0}})):P.current=!0},[j.subscription_period]);const O=e=>{const t={...E},n=M(e);n?t[e]=n:delete t[e],k(t)},A=t=>{if(t.preventDefault(),!(()=>{const e={},t=["subscription_signup_fee","subscription_trial_length","subscription_period_interval","subscription_discount"];_&&t.push("subscription_regular_price","subscription_sale_price"),t.forEach(t=>{const n=M(t);n&&(e[t]=n)}),k(e);const n=!N.current||N.current.validate();return 0===Object.keys(e).length&&n})())return;const n={...j};e?.id&&(n.id=e.id),o(n)},D=e=>[{label:(0,d._n)("Day","Days",e,"woocommerce-subscriptions"),value:"day"},{label:(0,d._n)("Week","Weeks",e,"woocommerce-subscriptions"),value:"week"},{label:(0,d._n)("Month","Months",e,"woocommerce-subscriptions"),value:"month"},{label:(0,d._n)("Year","Years",e,"woocommerce-subscriptions"),value:"year"}],T=(0,r.useMemo)(()=>D(parseInt(j.subscription_period_interval,10)||1),[j.subscription_period_interval]),B=(0,r.useMemo)(()=>D(parseInt(j.subscription_trial_length,10)||2),[j.subscription_trial_length]),L=[{label:(0,d.__)("Discount the product price","woocommerce-subscriptions"),value:"inherit"},{label:(0,d.__)("Set a custom price","woocommerce-subscriptions"),value:"override"}],R="day"!==j.subscription_period,z=Object.keys(E).length>0,H=t||z;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("form",{onSubmit:A,className:"wcsatt-plan-form",children:(0,s.jsxs)("div",{className:"wcsatt-plan-form-content",children:[!e&&(0,s.jsx)("p",{className:"description",children:_?(0,d.__)("Create a subscription plan for this product.","woocommerce-subscriptions"):(0,d.__)("After adding a plan you'll be able to use it as part of your storewide subscription settings that can be applied to any product.","woocommerce-subscriptions")}),(0,s.jsxs)("div",{className:"wcsatt-field-group",children:[(0,s.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,s.jsx)(ws,{__next40pxDefaultSize:!0,label:(0,d.__)("Frequency","woocommerce-subscriptions"),value:j.subscription_period_interval,onChange:e=>F("subscription_period_interval",parseInt(e,10)||1),onBlur:()=>O("subscription_period_interval"),min:1,max:365}),(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,"aria-label":(0,d.__)("Frequency period","woocommerce-subscriptions"),value:j.subscription_period,options:T,onChange:e=>F("subscription_period",e)})]}),(0,s.jsx)(ys,{message:E.subscription_period_interval})]}),R&&(0,s.jsx)(xs,{period:j.subscription_period,value:j.subscription_payment_sync_date,syncOptions:x,onChange:e=>F("subscription_payment_sync_date",e)}),S&&(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Price","woocommerce-subscriptions"),value:j.subscription_pricing_method,options:L,onChange:e=>F("subscription_pricing_method",e),help:"override"===j.subscription_pricing_method?(0,d.__)("This plan uses a custom price instead of the product's regular price.","woocommerce-subscriptions"):(0,d.__)("This plan uses the product's regular price. Add a discount to offer subscribers a lower price.","woocommerce-subscriptions")}),I&&(0,s.jsx)(Cs,{regularPrice:j.subscription_regular_price,salePrice:j.subscription_sale_price,currencySymbol:g,currencyStep:b,currencyPlaceholder:h,regularPriceError:E.subscription_regular_price,salePriceError:E.subscription_sale_price,onRegularPriceChange:e=>F("subscription_regular_price",e),onRegularPriceBlur:()=>O("subscription_regular_price"),onSalePriceChange:e=>F("subscription_sale_price",e),onSalePriceBlur:()=>O("subscription_sale_price")}),!I&&(0,s.jsx)(js,{discountType:j.subscription_pricing_method,discountValue:j.subscription_discount,currencySymbol:g,currencyStep:b,error:E.subscription_discount,onTypeChange:e=>F("subscription_pricing_method",e),onValueChange:e=>F("subscription_discount",e),onValueBlur:()=>O("subscription_discount")}),(0,s.jsx)(ks,{ref:N,subscriptionLength:j.subscription_length,billingInterval:j.subscription_period_interval,billingPeriod:j.subscription_period,onChange:e=>F("subscription_length",e),onFieldChange:l,onValidationChange:e=>{k(t=>{const n={...t};return e?n.subscription_length=e:delete n.subscription_length,n})}}),(0,s.jsxs)("div",{className:"wcsatt-signup-fee-field",children:[(0,s.jsx)(i.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Signup Fee","woocommerce-subscriptions"),type:"number",value:j.subscription_signup_fee,prefix:(0,s.jsx)(i.__experimentalInputControlPrefixWrapper,{children:g}),onChange:e=>F("subscription_signup_fee",e),onBlur:()=>O("subscription_signup_fee"),step:b,min:"0",placeholder:h}),(0,s.jsx)(ys,{message:E.subscription_signup_fee})]}),(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"wcsatt-field-group",children:[(0,s.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,s.jsx)(ws,{__next40pxDefaultSize:!0,label:(0,d.__)("Free Trial","woocommerce-subscriptions"),value:j.subscription_trial_length,onChange:e=>F("subscription_trial_length",parseInt(e,10)||0),onBlur:()=>O("subscription_trial_length"),min:0,max:v(j.subscription_trial_period)}),(0,s.jsx)(i.SelectControl,{__next40pxDefaultSize:!0,"aria-label":(0,d.__)("Free trial period","woocommerce-subscriptions"),value:j.subscription_trial_period,options:B,onChange:e=>F("subscription_trial_period",e)})]}),(0,s.jsx)(ys,{message:E.subscription_trial_length})]})})]})}),(0,s.jsxs)("div",{className:"wcsatt-plan-modal__actions",children:[(0,s.jsx)(i.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,d.__)("Cancel","woocommerce-subscriptions")}),(0,s.jsx)(i.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",disabled:H,onClick:A,children:(0,d.__)("Save","woocommerce-subscriptions")})]})]})}function Ps({apiError:e}){return(0,s.jsx)("div",{className:"wcsatt-plan-modal__api-error",children:(0,s.jsxs)(i.Notice,{status:"error",isDismissible:!1,children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("strong",{children:(0,d.__)("Error saving plan:","woocommerce-subscriptions")})," ",e]}),(0,s.jsx)("p",{children:(0,d.__)("Please correct the errors and try again.","woocommerce-subscriptions")})]})})}function Ns(){return(0,s.jsx)("div",{className:"wcsatt-plan-modal__duplicate-notice",children:(0,s.jsx)(i.Notice,{status:"error",isDismissible:!1,children:(0,s.jsx)("p",{children:(0,d.__)("This plan matches an existing plan. Update the settings to make it unique, then try saving again.","woocommerce-subscriptions")})})})}function Ms(){return(0,s.jsx)("div",{className:"wcsatt-plan-modal__saving-indicator",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(i.Spinner,{}),(0,s.jsx)("span",{children:(0,d.__)("Saving plan…","woocommerce-subscriptions")})]})})}function Fs({plan:e,duplicateWarning:t=null,apiError:n=null,isSaving:r=!1,onClose:o,onSave:l,onFieldChange:a}){const{labels:c}=w(),u=e?c.modalTitleEdit:c.modalTitle;return(0,s.jsxs)(i.Modal,{title:u,onRequestClose:o,className:"wcsatt-plan-modal",style:{width:"512px",maxWidth:"512px"},shouldCloseOnClickOutside:!r,shouldCloseOnEsc:!r,children:[n&&(0,s.jsx)(Ps,{apiError:n}),t&&(0,s.jsx)(Ns,{}),r&&(0,s.jsx)(Ms,{}),(0,s.jsx)(Vs,{plan:e,onCancel:o,onSave:l,onFieldChange:a,isDisabled:!!t||r,isSaving:r})]})}function Os({isProductMode:e}){const{plans:t,addPlan:n,updatePlan:i,deletePlan:o,reorderPlans:l}=function(){const e=w();return{plans:e.plans,addPlan:e.addPlan,updatePlan:e.updatePlan,deletePlan:e.deletePlan,reorderPlans:e.reorderPlans}}(),{showSuccess:a,showError:c}=function(){const{createNotice:e,removeNotice:t}=(0,x.useDispatch)(y.store);return{showSuccess:(n,i={})=>{const r=`success-${Date.now()}`;e("success",n,{id:r,isDismissible:!0,type:"snackbar",...i}),setTimeout(()=>{t(r)},2e3)},showError:(n,i={})=>{const r=`error-${Date.now()}`;e("error",n,{id:r,isDismissible:!0,type:"snackbar",...i}),setTimeout(()=>{t(r)},3e3)},showInfo:(n,i={})=>{const r=`info-${Date.now()}`;e("info",n,{id:r,isDismissible:!0,type:"snackbar",...i}),setTimeout(()=>{t(r)},3e3)},removeNotification:e=>{t(e)}}}(),[u,m]=(0,r.useState)(!1),[p,f]=(0,r.useState)(null),[v,_]=(0,r.useState)(null),[g,b]=(0,r.useState)(!1),[h,j]=(0,r.useState)(null),C=()=>{m(!1),f(null),_(null),j(null),b(!1)};return(0,s.jsxs)("div",{className:"wcsatt-plan-manager",children:[(0,s.jsx)(cs,{plans:t,onAddPlan:()=>{f(null),m(!0),j(null)},onEditPlan:e=>{f(e),m(!0),j(null)},onDeletePlan:async e=>{const t=await o(e);t.success?a(t.message):c(t.error||(0,d.__)("Unable to delete the plan. Please try again.","woocommerce-subscriptions"))},onReorderPlans:async e=>{const t=await l(e);t.success?a(t.message):c(t.error)},isProductMode:e}),u&&(0,s.jsx)(Fs,{plan:p,duplicateWarning:v,apiError:h,isSaving:g,onClose:C,onSave:async e=>{const{isDuplicate:r,matchingPlan:s}=function(e,t,n=null){const i=e=>""===e||null==e?0:"boolean"==typeof e?e?1:0:"string"==typeof e?parseFloat(e):e,r=e.subscription_pricing_method,s=["subscription_period","subscription_period_interval","subscription_length","subscription_signup_fee","subscription_trial_length","subscription_trial_period"];r?(s.push("subscription_pricing_method"),"override"===r?s.push("subscription_regular_price","subscription_sale_price"):s.push("subscription_discount")):s.push("subscription_discount");const o=t.find(t=>(!n||t.id!==n)&&s.every(n=>{const r=i(e[n]),s=i(t[n]);return"subscription_period"===n||"subscription_trial_period"===n||"subscription_pricing_method"===n?e[n]===t[n]:r===s}));return{isDuplicate:!!o,matchingPlan:o||null}}(e,t,p?.id);if(r)return void _(s);let o;_(null),j(null),b(!0),o=p?.id?await i(p.id,e):await n(e),o.success?(C(),a(o.message)):(j(o.error),b(!1))},onFieldChange:()=>{v&&_(null),h&&j(null)}})]})}function As(){return(0,s.jsx)("div",{className:"wcsatt-plans-app",children:(0,s.jsx)(Os,{})})}const Ds="woocommerce_subscriptions_first_billing_behavior",Ts="woocommerce_subscriptions_days_no_fee",Bs="woocommerce_subscriptions_prorate_virtual",Ls="woocommerce_subscriptions_prorate_physical",Rs="woocommerce_subscriptions_prorate_types_heading",zs="woocommerce_subscriptions_prorate_types_help",Hs="woocommerce_subscriptions_prorate_types_error",$s="woocommerce_subscriptions_downloads_add_line_items",Ws="woocommerce_subscriptions_customer_notifications_offset",Us="woocommerce_subscriptions_product_types_heading",Ks="woocommerce_subscriptions_external_trigger_options_url_display",Gs="wcsatt_subscribe_to_cart_schemes",qs="woocommerce_subscriptions_switch_first_billing_behavior",Ys="woocommerce_subscriptions_switch_first_billing_product_types_title",Zs="woocommerce_subscriptions_switch_first_billing_virtual",Xs="woocommerce_subscriptions_switch_first_billing_physical",Js="woocommerce_subscriptions_switch_first_billing_product_types_error",Qs="woocommerce_subscriptions_apportion_sign_up_fee",eo="woocommerce_subscriptions_switch_fixed_term_behavior",to="woocommerce_subscriptions_switch_fixed_term_product_types_title",no="woocommerce_subscriptions_switch_fixed_term_virtual",io="woocommerce_subscriptions_switch_fixed_term_physical",ro="woocommerce_subscriptions_switch_fixed_term_product_types_error",so="woocommerce_subscriptions_switch_button_text",oo="wcsatt_add_product_to_subscription_eligible",lo="wcsatt_add_cart_to_subscription_eligible",ao="woocommerce_subscriptions_max_customer_suspensions_enable",co="woocommerce_subscriptions_max_customer_suspensions_limit",uo="woocommerce_subscriptions_max_customer_suspensions_per_period",mo="woocommerce_subscriptions_gifting_gifting_checkbox_text",po="woocommerce_subscriptions_gifting_downloadable_products",fo=e=>!0===e||"yes"===e||"1"===e||1===e,vo=e=>fo(e.woocommerce_subscriptions_allow_switching_product_plans)||fo(e.woocommerce_subscriptions_allow_switching_variable)||fo(e.woocommerce_subscriptions_allow_switching_grouped),_o=({values:e})=>vo(e),go=({values:e})=>{return vo(e)&&("upgrades"===(t=e[qs])||"upgrades_and_downgrades"===t);var t},bo=({values:e})=>vo(e)&&"prorate"===e[eo],ho=({values:e})=>fo(e.woocommerce_subscriptions_gifting_enable_gifting),wo=({values:e})=>"prorate"===e[Ds];window.wcSettingsUI&&"function"==typeof window.wcSettingsUI.registerSettingsExtension&&window.wcSettingsUI.registerSettingsExtension({scope:{page:"subscriptions"},fieldOverrides:{[Ds]:o,[qs]:o,[Qs]:o,[eo]:o,[Ys]:l,[to]:l,[Js]:u,[ro]:u,[oo]:o,[lo]:o,[Rs]:l,[zs]:({field:e})=>(0,s.jsx)("p",{className:"woocommerce-subscriptions-settings__help-text",children:e.label}),[Hs]:u,[Ws]:({field:e,value:t,onChange:n})=>{const o=(e=>{var t,n;return e&&"object"==typeof e?{number:null!==(t=e.number)&&void 0!==t?t:"",unit:null!==(n=e.unit)&&void 0!==n?n:"days"}:{number:"",unit:"days"}})(t),l=(a=o.number,c=e.placeholder,m(a)||m(c)||0);var a,c;const u=(0,r.useMemo)(()=>(e=>{const t=(e=>({days:(0,d._n)("Day","Days",e,"woocommerce-subscriptions"),weeks:(0,d._n)("Week","Weeks",e,"woocommerce-subscriptions"),months:(0,d._n)("Month","Months",e,"woocommerce-subscriptions"),years:(0,d._n)("Year","Years",e,"woocommerce-subscriptions")}))(e);return["days","weeks","months","years"].map(e=>({label:t[e],value:e}))})(l),[l]);return(0,s.jsxs)(i.BaseControl,{id:e.id,label:e.label,help:e.description||void 0,__nextHasNoMarginBottom:!0,children:[(0,s.jsxs)("div",{className:"woocommerce-subscriptions-settings__relative-date",children:[(0,s.jsx)(i.__experimentalNumberControl,{id:e.id,className:"woocommerce-subscriptions-settings__relative-date-number",value:o.number,placeholder:e.placeholder,min:1,step:1,spinControls:"custom",onChange:e=>n({...o,number:null!=e?e:""}),__next40pxDefaultSize:!0}),(0,s.jsx)(i.SelectControl,{className:"woocommerce-subscriptions-settings__relative-date-unit",label:(0,d.__)("Reminder timing unit","woocommerce-subscriptions"),hideLabelFromVision:!0,value:o.unit,options:u,onChange:e=>n({...o,unit:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})]}),(0,s.jsx)("input",{type:"hidden",name:`${e.id}[number]`,value:o.number}),(0,s.jsx)("input",{type:"hidden",name:`${e.id}[unit]`,value:o.unit})]})},[Us]:l,[Ks]:({field:e})=>{const t=e.customAttributes||{},n=t["data-url"]||"",r=t["data-regenerate-url"]||"",o=(0,p.useCopyToClipboard)(n);return(0,s.jsxs)(i.BaseControl,{id:e.id,label:e.label,help:e.description||void 0,__nextHasNoMarginBottom:!0,children:[(0,s.jsxs)("div",{className:"woocommerce-subscriptions-settings__cron-url",children:[(0,s.jsx)("input",{id:e.id,className:"woocommerce-subscriptions-settings__cron-url-input",type:"text",readOnly:!0,value:n,onFocus:e=>e.target.select()}),(0,s.jsx)(i.Button,{className:"woocommerce-subscriptions-settings__cron-url-copy",size:"small",icon:f,label:(0,d.__)("Copy URL","woocommerce-subscriptions"),ref:o,disabled:""===n})]}),(0,s.jsx)(i.Button,{className:"woocommerce-subscriptions-settings__cron-url-regenerate",variant:"secondary",href:r,children:(0,d.__)("Generate a new URL","woocommerce-subscriptions")})]})},[Gs]:()=>(0,s.jsx)(h,{children:(0,s.jsx)(As,{})})},fieldVisibility:{[qs]:_o,[Qs]:_o,[eo]:_o,[so]:_o,[Ys]:go,[Zs]:go,[Xs]:go,[to]:bo,[no]:bo,[io]:bo,[Js]:e=>go(e)&&!fo(e.values[Zs])&&!fo(e.values[Xs]),[ro]:e=>bo(e)&&!fo(e.values[no])&&!fo(e.values[io]),[oo]:({values:e})=>fo(e.wcsatt_add_product_to_subscription_enabled),[lo]:({values:e})=>fo(e.wcsatt_add_cart_to_subscription_enabled),[co]:({values:e})=>fo(e[ao]),[uo]:({values:e})=>fo(e[ao])&&fo(e[co]),[mo]:ho,[po]:ho,[Ts]:({values:e})=>"full"===e[Ds],[Rs]:wo,[Bs]:wo,[Ls]:wo,[zs]:wo,[Hs]:e=>wo(e)&&!fo(e.values[Bs])&&!fo(e.values[Ls]),[$s]:({values:e})=>fo(e.woocommerce_subscriptions_enable_downloadable_file_linking),[Ws]:({values:e})=>fo(e.woocommerce_subscriptions_customer_notifications_enabled),[Ks]:({values:e})=>fo(e.woocommerce_subscriptions_external_trigger_enabled)}})},609:e=>{"use strict";e.exports=window.React},731:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),i=new RegExp(n,"g"),r=new RegExp(n,"");function s(e){return t[e]}var o=function(e){return e.replace(i,s)};e.exports=o,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=o},848:(e,t,n)=>{"use strict";e.exports=n(20)},888:(e,t,n)=>{"use strict";e.exports=n(493)}},r={};function s(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e](n,n.exports,s),n.exports}s.m=i,e=[],s.O=(t,n,i,r)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){for(var[n,i,r]=e[u],l=!0,a=0;a<n.length;a++)(!1&r||o>=r)&&Object.keys(s.O).every(e=>s.O[e](n[a]))?n.splice(a--,1):(l=!1,r<o&&(o=r));if(l){e.splice(u--,1);var c=i();void 0!==c&&(t=c)}}return t}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[n,i,r]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,i){if(1&i&&(e=this(e)),8&i)return e;if("object"==typeof e&&e){if(4&i&&e.__esModule)return e;if(16&i&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var o={};t=t||[null,n({}),n([]),n(n)];for(var l=2&i&&e;("object"==typeof l||"function"==typeof l)&&!~t.indexOf(l);l=n(l))Object.getOwnPropertyNames(l).forEach(t=>o[t]=()=>e[t]);return o.default=()=>e,s.d(r,o),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={23:0,15:0};s.O.j=t=>0===e[t];var t=(t,n)=>{var i,r,[o,l,a]=n,c=0;if(o.some(t=>0!==e[t])){for(i in l)s.o(l,i)&&(s.m[i]=l[i]);if(a)var u=a(s)}for(t&&t(n);c<o.length;c++)r=o[c],s.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return s.O(u)},n=globalThis.webpackChunkwoocommerce_subscriptions=globalThis.webpackChunkwoocommerce_subscriptions||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=s.O(void 0,[15],()=>s(506));o=s.O(o)})();
Save File
Cancel