← Back
Editing: admin.js
(()=>{var e,t,n,i={20:(e,t,n)=>{"use strict";var i=n(609),s=Symbol.for("react.element"),r=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,r={},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)&&(r[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===r[i]&&(r[i]=t[i]);return{$$typeof:s,type:e,key:c,ref:u,props:r,_owner:l.current}}t.Fragment=r,t.jsx=c,t.jsxs=c},338:(e,t,n)=>{"use strict";var i=n(795);t.H=i.createRoot,i.hydrateRoot},349:(e,t,n)=>{"use strict";const i=window.wp.element;var s=n(609),r=n.t(s,2),o=n(338);const l=window.wp.components,a=window.wp.primitives;var c=n(848);const u=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),d=window.wp.i18n,m=window.wp.apiFetch;var p=n.n(m);const f=({imagesPath:e,redirectUrl:t,data:n,dismissOption:i,isSubscriptionsListing:r,onDismissPersist:o})=>{const[a,m]=(0,s.useState)(r),f=(0,s.useRef)(!1),{headerImage:v,heading:g,description:b,primaryButton:h,secondaryButton:_}=n,w=()=>{if(f.current)return;const e="?page=wc-admin"===window.location.search;m(e)};(0,s.useEffect)(()=>{if(r)return;const{pushState:e,replaceState:t}=window.history;window.history.pushState=function(...t){e.apply(window.history,t),window.dispatchEvent(new Event("pushState"))},window.history.replaceState=function(...e){t.apply(window.history,e),window.dispatchEvent(new Event("replaceState"))},window.addEventListener("popstate",w),window.addEventListener("replaceState",w),window.addEventListener("pushState",w),w()},[]);const x=e=>{var n;"function"==typeof o?o(i):(n=i,p()({path:`/wc/v3/subscriptions/settings/${n}`,method:"post",data:{value:true}})),f.current=!0,"done-btn"===e&&t?window.location.href=t:(m(!1),window.removeEventListener("popstate",w),window.removeEventListener("replaceState",w),window.removeEventListener("pushState",w))};return a?(0,c.jsx)("div",{className:"woocommerce-subscriptions-announcement",children:(0,c.jsx)("div",{className:"woocommerce-subscriptions-announcement__container",children:(0,c.jsxs)(l.Card,{className:"woocommerce-tour-kit-step",elevation:2,children:[(0,c.jsx)(l.CardHeader,{isBorderless:!0,size:"small",className:"woocommerce-tour-kit-step__header",children:(0,c.jsx)(l.Flex,{className:"woocommerce-tour-kit-step-controls",justify:"flex-end",children:(0,c.jsx)(l.Button,{className:"woocommerce-tour-kit-step-controls__close-btn",label:(0,d.__)("Close","woocommerce-subscriptions"),icon:(0,c.jsx)(l.Icon,{icon:u,viewBox:"6 4 12 14"}),iconSize:16,onClick:()=>x("close-btn")})})}),v&&(0,c.jsx)(l.CardMedia,{className:"woocommerce-tour-kit-step__header-image",children:(0,c.jsx)("img",{src:e+"/"+v,alt:(0,d.__)("Step image","woocommerce-subscriptions")})}),(0,c.jsxs)(l.CardBody,{className:"woocommerce-tour-kit-step__body",size:"small",children:[(0,c.jsx)("h2",{className:"woocommerce-tour-kit-step__heading",children:g}),(0,c.jsx)("p",{className:"woocommerce-tour-kit-step__description",dangerouslySetInnerHTML:{__html:b}})]}),(0,c.jsx)(l.CardFooter,{isBorderless:!0,size:"small",children:(0,c.jsx)("div",{className:"woocommerce-tour-kit-step-navigation",children:(0,c.jsxs)("div",{children:[_.text&&(0,c.jsx)(l.Button,{className:"woocommerce-tour-kit-step-navigation__back-btn",variant:"tertiary",onClick:()=>x("close-btn"),children:_.text}),(0,c.jsx)(l.Button,{className:"woocommerce-tour-kit-step-navigation__next-btn",variant:"primary",disabled:h.isDisabled,onClick:()=>x("done-btn"),children:h.text||(0,d.__)("Done","woocommerce-subscriptions")})]})})})]})})}):null};if(window?.wcsDownloadsSettings?.isStandaloneDownloadsEnabled){const{imagesPath:e,pluginsUrl:t,isSubscriptionsListing:n,isStandaloneDownloadsEnabled:i}=window.wcsDownloadsSettings,s=(0,o.H)(document.getElementById("wcs-downloads-welcome-announcement-root")),r=(()=>{const e=(0,d.__)("WooCommerce Subscription Downloads is now part of WooCommerce Subscriptions","woocommerce-subscriptions"),t=`${(0,d.__)("No separate extension required! WooCommerce Subscriptions now allows you to include simple and variable products with your subscriptions. And to make it easier, you can now configure which simple and variable products to include when creating a subscription product.","woocommerce-subscriptions")}\n\t\t<br /><br />\n\t\t${(0,d.__)("The WooCommerce Subscription Downloads extension can now be disabled via Plugins.","woocommerce-subscriptions")}`,n=(0,d.__)("Go to plugins","woocommerce-subscriptions");return{name:"gifting-announcement",heading:e,headerImage:"gifting-modal-icon.svg",description:t,secondaryButton:{text:(0,d.__)("Maybe later","woocommerce-subscriptions")},primaryButton:{text:n}}})();s.render((0,c.jsx)(f,{imagesPath:e,data:r,dismissOption:"woocommerce_subscriptions_downloads_is_welcome_announcement_dismissed",redirectUrl:t,isSubscriptionsListing:!!n}))}!function(){const e=document.getElementById("wcs-gifting-welcome-announcement-root");if(!e)return;const t=(0,o.H)(e),n=(e=>{const t=e?(0,d.__)("Gifting is now part of WooCommerce Subscriptions","woocommerce-subscriptions"):(0,d.__)("Introducing subscription gifting","woocommerce-subscriptions"),n=e?`${(0,d.__)("No separate extension needed! The built-in gifting feature is fully compatible with product, cart and checkout blocks, plus you can now choose which subscription products can be gifted.","woocommerce-subscriptions")}\n\t\t\t<br /><br />\n\t\t\t${(0,d.__)("The Gifting for WooCommerce Subscriptions extension can now be disabled via Plugins.","woocommerce-subscriptions")}`:(0,d.__)("Let your shoppers purchase subscriptions as gifts using the new built-in gifting feature in WooCommerce Subscriptions. It works seamlessly with product, cart and checkout blocks, and can be enabled storewide or managed per product.","woocommerce-subscriptions"),i=e?(0,d.__)("Go to plugins","woocommerce-subscriptions"):(0,d.__)("Set up gifting","woocommerce-subscriptions");return{name:"gifting-announcement",heading:t,headerImage:"gifting-modal-icon.svg",description:n,secondaryButton:{text:(0,d.__)("Maybe later","woocommerce-subscriptions")},primaryButton:{text:i}}})(window.wcsGiftingSettings.isStandaloneGiftingEnabled),{imagesPath:i,pluginsUrl:s,subscriptionsUrl:r,isStandaloneGiftingEnabled:l,isSubscriptionsListing:a}=window.wcsGiftingSettings;t.render((0,c.jsx)(f,{imagesPath:i,data:n,dismissOption:"woocommerce_subscriptions_gifting_is_welcome_announcement_dismissed",redirectUrl:l?s:r,isSubscriptionsListing:!!a}))}(),function(){const e=document.getElementById("wcs-subscription-plans-welcome-announcement-root");if(!e)return;if(!window.wcsSubscriptionPlansWelcomeSettings)return;const{imagesPath:t,pluginsUrl:n,isStandaloneApfsActive:i,isSubscriptionsListing:s,dismissNotice:r,ajaxUrl:l,dismissNonce:a}=window.wcsSubscriptionPlansWelcomeSettings,u=(e=>({name:"subscription-plans-welcome-announcement",heading:e?(0,d.__)("All Products is now part of WooCommerce Subscriptions","woocommerce-subscriptions"):(0,d.__)("All Products features are now part of WooCommerce Subscriptions","woocommerce-subscriptions"),headerImage:"subscription-plans-modal-icon.svg",description:e?`${(0,d.__)("You now get All Products features as part of WooCommerce Subscriptions. You'll also get more flexibility with storewide subscription plans, support for free trials, signup fees, and gifting, plus bulk editing for product purchase options — and more.","woocommerce-subscriptions")}<br /><br />${(0,d.__)("The WooCommerce All Products for Subscriptions plugin can be disabled.","woocommerce-subscriptions")}`:(0,d.__)("Simple products can now be sold as a one-time purchase, a subscription, or both. Choose the purchase options in each product's subscription settings — making your catalog easier to manage and helping customers pick what works best for them.","woocommerce-subscriptions"),secondaryButton:{},primaryButton:{text:e?(0,d.__)("Go to Plugins","woocommerce-subscriptions"):(0,d.__)("Dismiss","woocommerce-subscriptions")}}))(i);(0,o.H)(e).render((0,c.jsx)(f,{imagesPath:t,data:u,dismissOption:r,redirectUrl:i?n:"",isSubscriptionsListing:!!s,onDismissPersist:()=>function(e,t,n){const i=new URLSearchParams;return i.append("action","woocommerce_dismiss_satt_notice"),i.append("notice",e),i.append("security",n),fetch(t,{method:"POST",credentials:"same-origin",keepalive:!0,body:i}).catch(e=>{console.error("WooCommerce Subscriptions: failed to persist welcome announcement dismissal",e)})}(r,l,a)}))}();const v=e=>Math.abs(Math.trunc(Number(e))),g=()=>{const e=document.querySelectorAll('tr.wc-settings-row-reminder-timing td.forminp input[type="number"]');e.length&&e.forEach(e=>{const t=e.closest(".forminp"),n=t?t.querySelector("select"):null;if(!n)return;n.setAttribute("aria-label",(0,d.__)("Reminder timing unit","woocommerce-subscriptions"));const i=()=>((e,t)=>{const n=(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")}))((i=e.value,s=e.placeholder,v(i)||v(s)||0));var i,s;Array.from(t.options).forEach(e=>{const t=n[e.value];t&&e.textContent!==t&&(e.textContent=t)})})(e,n);e.addEventListener("input",i),e.addEventListener("change",i),i()})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",g):g();const b=(0,i.createContext)(null),h=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 _({children:e,productId:t=null}){const n=!!t,[s,r]=(0,i.useState)("simple");(0,i.useEffect)(()=>{if(n){const e=document.getElementById("wcsatt-product-plans-root");if(e){const t=e.getAttribute("data-product-type")||"simple";r(t)}}},[n]);const o=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")},[l,a]=(0,i.useState)(null);(0,i.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;a(Array.isArray(t)?t:[])}else a([])},[n]);const u=(0,i.useCallback)(async e=>{const i=n?`/wc/v3/products/${t}/subscription-plans`:"/wc/v3/subscriptions/storewide-plans",s=await h(()=>p()({path:i,method:"POST",data:e}),(0,d.__)("Unable to save the plan. Please try again.","woocommerce-subscriptions"));return s.success&&a(e=>[...e,s.data]),s},[n,t]),m=(0,i.useCallback)(async(e,i)=>{const s=n?`/wc/v3/products/${t}/subscription-plans/${e}`:`/wc/v3/subscriptions/storewide-plans/${e}`,r=await h(()=>p()({path:s,method:"PUT",data:i}),(0,d.__)("Unable to update the plan. Please try again.","woocommerce-subscriptions"));return r.success&&a(t=>t.map(t=>t.id===e?r.data:t)),r},[n,t]),f=(0,i.useCallback)(async e=>{const i=n?`/wc/v3/products/${t}/subscription-plans/${e}`:`/wc/v3/subscriptions/storewide-plans/${e}`,s=await h(()=>p()({path:i,method:"DELETE"}),(0,d.__)("Unable to delete the plan. Please try again.","woocommerce-subscriptions"));return s.success&&a(t=>t.filter(t=>t.id!==e)),s},[n,t]),v=(0,i.useCallback)(async e=>{const i=l;a(e);const s=e.map(e=>e.id),r=n?`/wc/v3/products/${t}/subscription-plans/reorder`:"/wc/v3/subscriptions/storewide-plans/reorder",o=await h(()=>p()({path:r,method:"PUT",data:{plan_ids:s}}),(0,d.__)("Unable to save your changes. Please try again.","woocommerce-subscriptions"));return o.success||a(i),o},[l,n,t]),g={labels:o,productId:t,productType:s,isProductContext:n,plans:l,addPlan:u,updatePlan:m,deletePlan:f,reorderPlans:v};return(0,c.jsx)(b.Provider,{value:g,children:e})}function w(){const e=(0,i.useContext)(b);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,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),S=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(a.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),C=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.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,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),E=window.wp.compose,k=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),P=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),N="is",V="isNot",M="isAny",F="isNone",O="isAll",A="isNotAll",D=[N,V,M,F,O,A],T={[N]:{key:"is-filter",label:(0,d.__)("Is")},[V]:{key:"is-not-filter",label:(0,d.__)("Is not")},[M]:{key:"is-any-filter",label:(0,d.__)("Is any")},[F]:{key:"is-none-filter",label:(0,d.__)("Is none")},[O]:{key:"is-all-filter",label:(0,d.__)("Is all")},[A]:{key:"is-not-all-filter",label:(0,d.__)("Is not all")}},B=["asc","desc"],L={asc:"↑",desc:"↓"},R={asc:"ascending",desc:"descending"},H={asc:(0,d.__)("Sort ascending"),desc:(0,d.__)("Sort descending")},z={asc:k,desc:P},W="table",$="grid",U=(0,i.createContext)({view:{type:W},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,containerWidth:0}),K=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(a.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})});function G(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=G(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}const q=function(){for(var e,t,n=0,i="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=G(e))&&(i&&(i+=" "),i+=t);return i};function Y(...e){}function X(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function Z(...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}function se(e,t){"function"==typeof e?e(t):e&&(e.current=t)}var re,oe="undefined"!=typeof window&&!!(null==(re=window.document)?void 0:re.createElement);function le(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function ae(e,t=!1){var n;const{activeElement:i}=le(e);if(!(null==i?void 0:i.nodeName))return null;if("IFRAME"===i.tagName&&(null==(n=i.contentDocument)?void 0:n.body))return ae(i.contentDocument.body,t);if(t){const e=i.getAttribute("aria-activedescendant");if(e){const t=le(i).getElementById(e);if(t)return t}}return i}function ce(e,t){return e===t||e.contains(t)}function ue(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==de.indexOf(e.type)}var de=["button","color","file","image","reset","submit"];function me(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function pe(e){return e.isContentEditable||me(e)}function fe(e){let t=0,n=0;if(me(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const i=le(e).getSelection();if((null==i?void 0:i.rangeCount)&&i.anchorNode&&ce(e,i.anchorNode)&&i.focusNode&&ce(e,i.focusNode)){const s=i.getRangeAt(0),r=s.cloneRange();r.selectNodeContents(e),r.setEnd(s.startContainer,s.startOffset),t=r.toString().length,r.setEnd(s.endContainer,s.endOffset),n=r.toString().length}}return{start:t,end:n}}function ve(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function ge(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 ge(e.parentElement)||document.scrollingElement||document.body}function be(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function he(){return!!oe&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function _e(){return oe&&he()&&/apple/i.test(navigator.vendor)}function we(e){return e.target===e.currentTarget}function xe(e,t){const n=new FocusEvent("blur",t),i=e.dispatchEvent(n),s={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent("focusout",s)),i}function ye(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function je(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return!i||!ce(n,i)}function Se(e,t,n,i){const s=(e=>{if(i){const t=setTimeout(e,i);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,r,!0),n()}),r=()=>{s(),n()};return e.addEventListener(t,r,{once:!0,capture:!0}),s}function Ce(e,t,n,i=window){const s=[];try{i.document.addEventListener(e,t,n);for(const r of Array.from(i.frames))s.push(Ce(e,t,n,r))}catch{}return()=>{try{i.document.removeEventListener(e,t,n)}catch{}for(const e of s)e()}}var Ie={...r},Ee=Ie.useId,ke=(Ie.useDeferredValue,Ie.useInsertionEffect),Pe=oe?s.useLayoutEffect:s.useEffect;function Ne(e){const t=(0,s.useRef)(()=>{throw new Error("Cannot call an event handler while rendering.")});return ke?ke(()=>{t.current=e}):t.current=e,(0,s.useCallback)((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}function Ve(...e){return(0,s.useMemo)(()=>{if(e.some(Boolean))return t=>{for(const n of e)se(n,t)}},e)}function Me(e){if(Ee){const t=Ee();return e||t}const[t,n]=(0,s.useState)(e);return Pe(()=>{if(e||t)return;const i=Math.random().toString(36).slice(2,8);n(`id-${i}`)},[e,t]),e||t}function Fe(e,t){const n=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(n.current)return e();n.current=!0},t),(0,s.useEffect)(()=>()=>{n.current=!1},[])}function Oe(e){return Ne("function"==typeof e?e:()=>e)}function Ae(e,t,n=[]){const i=(0,s.useCallback)(n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n)),[...n,e.wrapElement]);return{...e,wrapElement:i}}function De(e,t,n){const i=e.onLoadedMetadataCapture,r=(0,s.useMemo)(()=>Object.assign(()=>{},i,...void 0!==n?[{[t]:n}]:[]),[i,t,n]);return[null==i?void 0:i[t],{onLoadedMetadataCapture:r}]}var Te=!1,Be=!1,Le=0,Re=0;function He(e){(function(e){const t=e.movementX||e.screenX-Le,n=e.movementY||e.screenY-Re;return Le=e.screenX,Re=e.screenY,t||n||!1})(e)&&(Be=!0)}function ze(){Be=!1}function We(e){const t=s.forwardRef((t,n)=>e({...t,ref:n}));return t.displayName=e.displayName||e.name,t}function $e(e,t){return s.memo(e,t)}function Ue(e,t){const{wrapElement:n,render:i,...r}=t,o=Ve(t.ref,function(e){return function(e){return!!e&&!!(0,s.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e)?{...e.props}.ref||e.ref:null}(i));let l;if(s.isValidElement(i)){const e={...i.props,ref:o};l=s.cloneElement(i,function(e,t){const n={...e};for(const i in t){if(!X(t,i))continue;if("className"===i){const i="className",s=e[i],r=t[i];n[i]=s&&r?`${s} ${r}`:r||s;continue}if("style"===i){const i="style";n[i]=e[i]?{...e[i],...t[i]}:t[i];continue}const s=t[i];if(i.startsWith("on")){if("function"!=typeof s)continue;const t=e[i];if("function"==typeof t){n[i]=(...e)=>{s(...e),t(...e)};continue}}n[i]=s}return n}(r,e))}else l=i?i(r):(0,c.jsx)(e,{...r});return n?n(l):l}function Ke(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function Ge(e=[],t=[]){const n=s.createContext(void 0),i=s.createContext(void 0),r=()=>s.useContext(n),o=t=>e.reduceRight((e,n)=>(0,c.jsx)(n,{...t,children:e}),(0,c.jsx)(n.Provider,{...t}));return{context:n,scopedContext:i,useContext:r,useScopedContext:(e=!1)=>{const t=s.useContext(i),n=r();return e?t:t||n},useProviderContext:()=>{const e=s.useContext(i),t=r();if(!e||e!==t)return t},ContextProvider:o,ScopedContextProvider:e=>(0,c.jsx)(o,{...e,children:t.reduceRight((t,n)=>(0,c.jsx)(n,{...e,children:t}),(0,c.jsx)(i.Provider,{...e}))})}}var qe=Ge(),Ye=qe.useContext,Xe=(qe.useScopedContext,qe.useProviderContext,Ge([qe.ContextProvider],[qe.ScopedContextProvider])),Ze=Xe.useContext,Je=(Xe.useScopedContext,Xe.useProviderContext),Qe=Xe.ContextProvider,et=Xe.ScopedContextProvider,tt=(0,s.createContext)(void 0),nt=(0,s.createContext)(void 0),it=((0,s.createContext)(null),(0,s.createContext)(null),Ge([Qe],[et])),st=it.useContext;function rt(e,t){const n=e.__unstableInternals;return ee(n,"Invalid store"),n[t]}function ot(e,...t){let n=e,i=n,s=Symbol(),r=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,r,o=!1)=>{var a;if(!X(n,e))return;const p=(f=r,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 g=n;n={...n,[e]:p};const b=Symbol();s=b,l.add(e);const h=(t,i,s)=>{var r;const o=m.get(t);o&&!o.some(t=>s?s.has(t):t===e)||(null==(r=d.get(t))||r(),d.set(t,t(n,i)))};for(const e of c)h(e,g);queueMicrotask(()=>{if(s!==b)return;const e=n;for(const e of u)h(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 s=()=>{o.delete(i),o.size||r()};if(e)return s;const l=(c=n,Object.keys(c)).map(e=>Z(...t.map(t=>{var n;const i=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(i&&X(i,e))return ut(t,[e],t=>{f(e,t[e],!0)})})));var c;const u=[];for(const e of a)u.push(e());const d=t.map(at);return r=Z(...l,...u,...d),s},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=>ot(function(e,t){const n={};for(const i of t)X(e,i)&&(n[i]=e[i]);return n}(n,e),v),omit:e=>ot(function(e,t){const n={...e};for(const e of t)X(n,e)&&delete n[e];return n}(n,e),v)}};return v}function lt(e,...t){if(e)return rt(e,"setup")(...t)}function at(e,...t){if(e)return rt(e,"init")(...t)}function ct(e,...t){if(e)return rt(e,"subscribe")(...t)}function ut(e,...t){if(e)return rt(e,"sync")(...t)}function dt(e,...t){if(e)return rt(e,"batch")(...t)}function mt(e,...t){if(e)return rt(e,"omit")(...t)}function pt(...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=ot(n,...e);return Object.assign({},...e,i)}it.useScopedContext,it.useProviderContext,it.ContextProvider,it.ScopedContextProvider;var ft=n(888);function vt(e,t=Q){const n=s.useCallback(t=>e?ct(e,null,t):()=>{},[e]),i=()=>{const n="string"==typeof t?t:null,i="function"==typeof t?t:null,s=null==e?void 0:e.getState();return i?i(s):s&&n&&X(s,n)?s[n]:void 0};return(0,ft.useSyncExternalStore)(n,i,i)}function gt(e,t){const n=s.useRef({}),i=s.useCallback(t=>e?ct(e,null,t):()=>{},[e]),r=()=>{const i=null==e?void 0:e.getState();let s=!1;const r=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(i);t!==r[e]&&(r[e]=t,s=!0)}if("string"==typeof n){if(!i)continue;if(!X(i,n))continue;const t=i[n];t!==r[e]&&(r[e]=t,s=!0)}}return s&&(n.current={...r}),n.current};return(0,ft.useSyncExternalStore)(i,r,r)}function bt(e,t,n,i){const r=X(t,n)?t[n]:void 0,o=i?t[i]:void 0,l=function(e){const t=(0,s.useRef)(e);return Pe(()=>{t.current=e}),t}({value:r,setValue:o});Pe(()=>ut(e,[n],(e,t)=>{const{value:i,setValue:s}=l.current;s&&e[n]!==t[n]&&e[n]!==i&&s(e[n])}),[e,n]),Pe(()=>{if(void 0!==r)return e.setState(n,r),dt(e,[n],()=>{void 0!==r&&e.setState(n,r)})})}function ht(e,t,n){return function(e,t,n){return Fe(t,[n.store,n.disclosure]),bt(e,n,"open","setOpen"),bt(e,n,"mounted","setMounted"),bt(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}(e,t,n)}function _t(e,t,n){return bt(e=function(e,t,n){return Fe(t,[n.store]),bt(e,n,"items","setItems"),e}(e,t,n),n,"activeId","setActiveId"),bt(e,n,"includesBaseElement"),bt(e,n,"virtualFocus"),bt(e,n,"orientation"),bt(e,n,"rtl"),bt(e,n,"focusLoop"),bt(e,n,"focusWrap"),bt(e,n,"focusShift"),e}function wt(e){const t=[];for(const n of e)t.push(...n);return t}function xt(e){return e.slice().reverse()}function yt(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,[]),s=new Map(i.map(e=>[e.id,e])),r={items:i,renderedItems:ie(null==n?void 0:n.renderedItems,[])},o=null==(l=e.store)?void 0:l.__unstablePrivateStore;var l;const a=ot({items:i,renderedItems:r.renderedItems},o),c=ot(r,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],[s,r])=>{const o=t(n),l=t(r);return o===l?0:o&&l?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(o,l)?(e>s&&(i=!0),-1):(e<s&&(i=!0),1):0}),i?n.map(([e,t])=>t):e}(e,e=>e.element);a.setState("renderedItems",t),c.setState("renderedItems",t)};lt(c,()=>at(a)),lt(a,()=>dt(a,["items"],e=>{c.setState("items",e.items)})),lt(a,()=>dt(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),s=null==(t=[...e].reverse().find(e=>!!e.element))?void 0:t.element;let r=null==(n=null==i?void 0:i.element)?void 0:n.parentElement;if(!s)return le(r).body;for(;r;){if(r.contains(s))return r;r=r.parentElement}return le(r).body}(e.renderedItems),s=new IntersectionObserver(()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame(()=>u(e.renderedItems)))},{root:i});for(const t of e.renderedItems)t.element&&s.observe(t.element);return()=>{cancelAnimationFrame(n),s.disconnect()}}));const d=(e,t,n=!1)=>{let i;return t(t=>{const n=t.findIndex(({id:t})=>t===e.id),r=t.slice();if(-1!==n){i=t[n];const o={...i,...e};r[n]=o,s.set(e.id,o)}else r.push(e),s.set(e.id,e);return r}),()=>{t(t=>{if(!i)return n&&s.delete(e.id),t.filter(({id:t})=>t!==e.id);const r=t.findIndex(({id:t})=>t===e.id);if(-1===r)return t;const o=t.slice();return o[r]=i,s.set(e.id,i),o})}},m=e=>d(e,e=>a.setState("items",e),!0);return{...c,registerItem:m,renderItem:e=>Z(m(e),d(e,e=>a.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=s.get(e);if(!t){const{items:n}=a.getState();t=n.find(t=>t.id===e),t&&s.set(e,t)}return t||null},__unstablePrivateStore:a}}var jt={id:null};function St(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function Ct(e,t){return e.filter(e=>e.rowId===t)}function It(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 Et(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function kt(e){return{id:"__EMPTY_ITEM__",disabled:!0,rowId:e}}var Pt=_e()&&oe&&!!navigator.maxTouchPoints;function Nt({tag:e,...t}={}){const n=pt(t.store,function(e,...t){if(e)return rt(e,"pick")(...t)}(e,["value","rtl"])),i=null==e?void 0:e.getState(),s=null==n?void 0:n.getState(),r=ie(t.activeId,null==s?void 0:s.activeId,t.defaultActiveId,null),o=function(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),i=yt(e),s=ie(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),r=ot({...i.getState(),id:ie(e.id,null==n?void 0:n.id)??`id-${Math.random().toString(36).slice(2,8)}`,activeId:s,baseElement:ie(null==n?void 0:n.baseElement,null),includesBaseElement:ie(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===s),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);lt(r,()=>ut(r,["renderedItems","activeId"],e=>{r.setState("activeId",t=>{var n;return void 0!==t?t:null==(n=St(e.renderedItems))?void 0:n.id})}));const o=(e="next",t={})=>{var n,i;const s=r.getState(),{skip:o=0,activeId:l=s.activeId,focusShift:a=s.focusShift,focusLoop:c=s.focusLoop,focusWrap:u=s.focusWrap,includesBaseElement:d=s.includesBaseElement,renderedItems:m=s.renderedItems,rtl:p=s.rtl}=t,f="up"===e||"down"===e,v="next"===e||"down"===e,g=v?p&&!f:!p||f,b=a&&!o;let h=f?wt(function(e,t,n){const i=Et(e);for(const s of e)for(let e=0;e<i;e+=1){const i=s[e];if(!i||n&&i.disabled){const i=0===e&&n?St(s):s[e-1];s[e]=i&&t!==i.id&&n?i:kt(null==i?void 0:i.rowId)}}return e}(It(m),l,b)):m;if(h=g?xt(h):h,h=f?function(e){const t=It(e),n=Et(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}(h):h,null==l)return null==(n=St(h))?void 0:n.id;const _=h.find(e=>e.id===l);if(!_)return null==(i=St(h))?void 0:i.id;const w=h.some(e=>e.rowId),x=h.indexOf(_),y=h.slice(x+1),j=Ct(y,_.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 S=c&&(f?"horizontal"!==c:"vertical"!==c),C=w&&u&&(f?"horizontal"!==u:"vertical"!==u),I=v?(!w||f)&&S&&d:!!f&&d;if(S){const e=function(e,t,n=!1){const i=e.findIndex(e=>e.id===t);return[...e.slice(i+1),...n?[jt]:[],...e.slice(0,i)]}(C&&!I?h:Ct(h,_.rowId),l,I),t=St(e,l);return null==t?void 0:t.id}if(C){const e=St(I?j:y,l);return I?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const E=St(j,l);return!E&&I?null:null==E?void 0:E.id};return{...i,...r,setBaseElement:e=>r.setState("baseElement",e),setActiveId:e=>r.setState("activeId",e),move:e=>{void 0!==e&&(r.setState("activeId",e),r.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=St(r.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=St(xt(r.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:r,includesBaseElement:ie(t.includesBaseElement,null==s?void 0:s.includesBaseElement,!0),orientation:ie(t.orientation,null==s?void 0:s.orientation,"vertical"),focusLoop:ie(t.focusLoop,null==s?void 0:s.focusLoop,!0),focusWrap:ie(t.focusWrap,null==s?void 0:s.focusWrap,!0),virtualFocus:ie(t.virtualFocus,null==s?void 0:s.virtualFocus,!0)}),l=function({popover:e,...t}={}){const n=pt(t.store,mt(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),i=null==n?void 0:n.getState(),s=function(e={}){return function(e={}){const t=pt(e.store,mt(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),i=ie(e.open,null==n?void 0:n.open,e.defaultOpen,!1),s=ie(e.animated,null==n?void 0:n.animated,!1),r=ot({open:i,animated:s,animating:!!s&&i,mounted:i,contentElement:ie(null==n?void 0:n.contentElement,null),disclosureElement:ie(null==n?void 0:n.disclosureElement,null)},t);return lt(r,()=>ut(r,["animated","animating"],e=>{e.animated||r.setState("animating",!1)})),lt(r,()=>ct(r,["open"],()=>{r.getState().animated&&r.setState("animating",!0)})),lt(r,()=>ut(r,["open","animating"],e=>{r.setState("mounted",e.open||e.animating)})),{...r,disclosure:e.disclosure,setOpen:e=>r.setState("open",e),show:()=>r.setState("open",!0),hide:()=>r.setState("open",!1),toggle:()=>r.setState("open",e=>!e),stopAnimation:()=>r.setState("animating",!1),setContentElement:e=>r.setState("contentElement",e),setDisclosureElement:e=>r.setState("disclosureElement",e)}}(e)}({...t,store:n}),r=ie(t.placement,null==i?void 0:i.placement,"bottom"),o=ot({...s.getState(),placement:r,currentPlacement:r,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")},s,n);return{...s,...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==s?void 0:s.placement,"bottom-start")}),a=ie(t.value,null==s?void 0:s.value,t.defaultValue,""),c=ie(t.selectedValue,null==s?void 0:s.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==s?void 0:s.resetValueOnSelect,u),resetValueOnHide:ie(t.resetValueOnHide,null==s?void 0:s.resetValueOnHide,u&&!e),activeValue:null==s?void 0:s.activeValue},m=ot(d,o,l,n);return Pt&<(m,()=>ut(m,["virtualFocus"],()=>{m.setState("virtualFocus",!1)})),lt(m,()=>{if(e)return Z(ut(m,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),ut(e,["values"],e=>{m.setState("selectedValue",e.values)}))}),lt(m,()=>ut(m,["resetValueOnHide","mounted"],e=>{e.resetValueOnHide&&(e.mounted||m.setState("value",a))})),lt(m,()=>ut(m,["open"],e=>{e.open||(m.setState("activeId",r),m.setState("moves",0))})),lt(m,()=>ut(m,["moves","activeId"],(e,t)=>{e.moves===t.moves&&m.setState("activeValue",void 0)})),lt(m,()=>dt(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 Vt(e={}){e=function(e){const t=st();return function(e){return{id:Me(e.id),...e}}(e={...e,tag:void 0!==e.tag?e.tag:t})}(e);const[t,n]=function(e,t){const[n,i]=s.useState(()=>e(t));Pe(()=>at(n),[n]);const r=s.useCallback(e=>vt(n,e),[n]);return[s.useMemo(()=>({...n,useState:r}),[n,r]),Ne(()=>{i(n=>e({...t,...n.getState()}))})]}(Nt,e);return function(e,t,n){return Fe(t,[n.tag]),bt(e,n,"value","setValue"),bt(e,n,"selectedValue","setSelectedValue"),bt(e,n,"resetValueOnHide"),bt(e,n,"resetValueOnSelect"),Object.assign(_t(function(e,t,n){return Fe(t,[n.popover]),bt(e,n,"placement"),ht(e,t,n)}(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var Mt=Ge(),Ft=(Mt.useContext,Mt.useScopedContext,Mt.useProviderContext),Ot=Ge([Mt.ContextProvider],[Mt.ScopedContextProvider]),At=(Ot.useContext,Ot.useScopedContext,Ot.useProviderContext,Ot.ContextProvider),Dt=Ot.ScopedContextProvider,Tt=((0,s.createContext)(void 0),(0,s.createContext)(void 0),Ge([At],[Dt])),Bt=(Tt.useContext,Tt.useScopedContext,Tt.useProviderContext),Lt=Tt.ContextProvider,Rt=Tt.ScopedContextProvider,Ht=(0,s.createContext)(void 0),zt=Ge([Lt,Qe],[Rt,et]),Wt=zt.useContext,$t=zt.useScopedContext,Ut=zt.useProviderContext,Kt=zt.ContextProvider,Gt=zt.ScopedContextProvider,qt=(0,s.createContext)(void 0),Yt=(0,s.createContext)(!1);function Xt(e={}){const t=Vt(e);return(0,c.jsx)(Kt,{value:t,children:e.children})}var Zt=Ke(function({store:e,...t}){const n=Ut();ee(e=e||n,!1);const i=vt(e,e=>{var t;return null==(t=e.baseElement)?void 0:t.id});return ne(t={htmlFor:i,...t})}),Jt=$e(We(function(e){return Ue("label",Zt(e))}));function Qt(e,t){return t&&e.item(t)||null}var en=Symbol("FOCUS_SILENTLY");function tn(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 nn=(0,s.createContext)(!0);function sn(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 rn(e){const t=ae(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}var on=Symbol("accessibleWhenDisabled"),ln=_e(),an=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],cn=["button","color","file","image","reset","submit"];function un({focusable:e,trulyDisabled:t,nativeTabbable:n,supportsDisabled:i,safariTabIndex:s,tabIndexProp:r}){return e?t?n&&!i?-1:void 0:n?s&&null==r?0:r:null!=r?r:0:r}function dn(e,t){return Ne(n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())})}var mn=!1,pn=!0;function fn(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(pn=!1))}function vn(e){e.metaKey||e.ctrlKey||e.altKey||(pn=!0)}var gn=Ke(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:n,onFocusVisible:i,...r}){const o=(0,s.useRef)(null),[l,a]=De(r,on,t);null!=t||(t=l),(0,s.useEffect)(()=>{e&&(mn||(Ce("mousedown",fn,!0),Ce("keydown",vn,!0),mn=!0))},[e]);const c=e&&te(r),u=c&&!t,[d,m]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&u&&d&&m(!1)},[e,u,d]),(0,s.useEffect)(()=>{if(!e)return;if(!d)return;const t=o.current;if(!t)return;if("undefined"==typeof IntersectionObserver)return;const n=new IntersectionObserver(()=>{sn(t)||m(!1)});return n.observe(t),()=>n.disconnect()},[e,d]);const p=dn(r.onKeyPressCapture,c),f=dn(r.onMouseDownCapture,c),v=dn(r.onClickCapture,c),g=(t,n)=>{if(n&&(t.currentTarget=n),!e)return;const s=t.currentTarget;s&&rn(s)&&(null==i||i(t),t.defaultPrevented||(s.dataset.focusVisible="true",m(!0)))},b=r.onKeyDownCapture,h=Ne(t=>{if(null==b||b(t),t.defaultPrevented)return;if(!e)return;if(d)return;if(t.metaKey)return;if(t.altKey)return;if(t.ctrlKey)return;if(!we(t))return;const n=t.currentTarget;Se(n,"focusout",()=>g(t,n))}),_=r.onFocusCapture,w=Ne(t=>{if(null==_||_(t),t.defaultPrevented)return;if(!e)return;if(!we(t))return void m(!1);const n=t.currentTarget;pn||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):an.includes(i))}(t.target)?Se(t.target,"focusout",()=>g(t,n)):m(!1)}),x=r.onBlur,y=Ne(t=>{null==x||x(t),e&&je(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),m(!1))}),j=(0,s.useContext)(nn),S=Ne(t=>{e&&n&&t&&j&&queueMicrotask(()=>{rn(t)||sn(t)&&t.focus()})}),C=function(e,t){const n=e=>{if("string"==typeof e)return e},[i,r]=(0,s.useState)(()=>n(t));return Pe(()=>{const i=e&&"current"in e?e.current:e;r((null==i?void 0:i.tagName.toLowerCase())||n(t))},[e,t]),i}(o),I=e&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(C),E=e&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(C),[k,P]=(0,s.useState)(!1);ln&&(0,s.useEffect)(()=>{if(!e)return;const t=o.current;if(!t)return;const n=t.tagName.toLowerCase(),i=t.type;P(function(e,t){return"button"===e||!("input"!==e||!t)&&("checkbox"===t||"radio"===t||cn.includes(t))}(n,i))},[e]);const N=r.style,V=(0,s.useMemo)(()=>u?{pointerEvents:"none",...N}:N,[u,N]);return ne(r={"data-focus-visible":e&&d||void 0,"data-autofocus":n||void 0,"aria-disabled":c||void 0,...r,...a,ref:Ve(o,S,r.ref),style:V,tabIndex:un({focusable:e,trulyDisabled:u,nativeTabbable:I,supportsDisabled:E,safariTabIndex:k,tabIndexProp:r.tabIndex}),disabled:!(!E||!u)||void 0,contentEditable:c?void 0:r.contentEditable,onKeyPressCapture:p,onClickCapture:v,onMouseDownCapture:f,onKeyDownCapture:h,onFocusCapture:w,onBlur:y})});function bn(e,t,n){return Ne(i=>{var s;if(null==t||t(i),i.defaultPrevented)return;if(i.isPropagationStopped())return;if(!we(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&&!me(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(i))return;const r=e.getState(),o=null==(s=Qt(e,r.activeId))?void 0:s.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 hn(e,t){const{virtualFocus:n,baseElement:i}=e.getState();if(!n||!i||!me(i))return void t();const s=i.scrollLeft,r=i.scrollTop;t(),i.scrollLeft=s,i.scrollTop=r}We(function(e){return Ue("div",gn(e))});var wn=Ke(function({store:e,composite:t=!0,focusOnMove:n=t,moveOnKeyPress:i=!0,...r}){const o=Je();ee(e=e||o,!1);const l=(0,s.useRef)(null),a=(0,s.useRef)(null),u=function(e){const[t,n]=(0,s.useState)(!1),i=(0,s.useCallback)(()=>n(!0),[]),r=vt(e,t=>Qt(e,t.activeId));return(0,s.useEffect)(()=>{const i=null==r?void 0:r.element;t&&i&&(n(!1),hn(e,()=>{i.focus({preventScroll:!0})}))},[e,r,t]),i}(e),d=vt(e,"moves"),[,m]=function(e){const[t,n]=(0,s.useState)(null);return Pe(()=>{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,s.useEffect)(()=>{var i;if(!e)return;if(!d)return;if(!t)return;if(!n)return;const{activeId:s}=e.getState(),r=null==(i=Qt(e,s))?void 0:i.element;r&&hn(e,()=>{var e;"scrollIntoView"in(e=r)?(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"})):e.focus()})},[e,d,t,n]),Pe(()=>{if(!e)return;if(!d)return;if(!t)return;const{baseElement:n,activeId:i}=e.getState();if(null!==i)return;if(!n)return;const s=a.current;a.current=null,s&&xe(s,{relatedTarget:n}),rn(n)||n.focus()},[e,d,t]);const p=vt(e,"activeId"),f=vt(e,"virtualFocus");Pe(()=>{var n;if(!e)return;if(!t)return;if(!f)return;const i=a.current;if(a.current=null,!i)return;const s=(null==(n=Qt(e,p))?void 0:n.element)||ae(i);s!==i&&xe(i,{relatedTarget:s})},[e,p,f,t]);const v=bn(e,r.onKeyDownCapture,a),g=bn(e,r.onKeyUpCapture,a),b=r.onFocusCapture,h=Ne(t=>{if(null==b||b(t),t.defaultPrevented)return;if(!e)return;const{virtualFocus:n}=e.getState();if(!n)return;const i=t.relatedTarget,s=function(e){const t=e[en];return delete e[en],t}(t.currentTarget);we(t)&&s&&(t.stopPropagation(),a.current=i)}),_=r.onFocus,w=Ne(n=>{if(null==_||_(n),n.defaultPrevented)return;if(!t)return;if(!e)return;const{relatedTarget:i}=n,{virtualFocus:s}=e.getState();s?we(n)&&!tn(e,i)&&queueMicrotask(u):we(n)&&e.setActiveId(null)}),x=r.onBlurCapture,y=Ne(t=>{var n;if(null==x||x(t),t.defaultPrevented)return;if(!e)return;const{virtualFocus:i,activeId:s}=e.getState();if(!i)return;const r=null==(n=Qt(e,s))?void 0:n.element,o=t.relatedTarget,l=tn(e,o),c=a.current;a.current=null,we(t)&&l?(o===r?c&&c!==o&&xe(c,t):r?xe(r,t):c&&xe(c,t),t.stopPropagation()):!tn(e,t.target)&&r&&xe(r,t)}),j=r.onKeyDown,S=Oe(i),C=Ne(t=>{var n;if(null==j||j(t),t.nativeEvent.isComposing)return;if(t.defaultPrevented)return;if(!e)return;if(!we(t))return;const{orientation:i,renderedItems:s,activeId:r}=e.getState(),o=Qt(e,r);if(null==(n=null==o?void 0:o.element)?void 0:n.isConnected)return;const l="horizontal"!==i,a="vertical"!==i,c=s.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&me(t.currentTarget))return;const u={ArrowUp:(c||l)&&(()=>{if(c){const e=function(e){return e.find(e=>!e.disabled)}(wt(xt(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}(s))));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(!S(t))return;t.preventDefault(),e.move(n)}}});r=Ae(r,t=>(0,c.jsx)(Qe,{value:e,children:t}),[e]);const I=vt(e,n=>{var i;if(e&&t&&n.virtualFocus)return null==(i=Qt(e,n.activeId))?void 0:i.id});r={"aria-activedescendant":I,...r,ref:Ve(l,m,r.ref),onKeyDownCapture:v,onKeyUpCapture:g,onFocusCapture:h,onFocus:w,onBlurCapture:y,onKeyDown:C};const E=vt(e,e=>t&&(e.virtualFocus||null===e.activeId));return gn({focusable:E,...r})}),xn=(We(function(e){return Ue("div",wn(e))}),Ke(function({store:e,...t}){const n=Bt();return e=e||n,{...t,ref:Ve(null==e?void 0:e.setAnchorElement,t.ref)}}));function yn(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 jn(e,t){return!!t&&null!=e&&(e=J(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}We(function(e){return Ue("div",xn(e))});var Sn=Ke(function({store:e,focusable:t=!0,autoSelect:n=!1,getAutoSelectId:i,setValueOnChange:r,showMinLength:o=0,showOnChange:l,showOnMouseDown:a,showOnClick:c=a,showOnKeyDown:u,showOnKeyPress:d=u,blurActiveItemOnClick:m,setValueOnClick:p=!0,moveOnKeyPress:f=!0,autoComplete:v="list",...g}){const b=Ut();ee(e=e||b,!1);const h=(0,s.useRef)(null),[_,w]=(0,s.useReducer)(()=>[],[]),x=(0,s.useRef)(!1),y=(0,s.useRef)(!1),j=vt(e,e=>e.virtualFocus&&n),S="inline"===v||"both"===v,[C,I]=(0,s.useState)(S);!function(e,t){const n=(0,s.useRef)(!1);Pe(()=>{n.current?S&&I(!0):n.current=!0},t),Pe(()=>()=>{n.current=!1},[])}(0,[S]);const E=vt(e,"value"),k=(0,s.useRef)(void 0);(0,s.useEffect)(()=>ut(e,["selectedValue","activeId"],(e,t)=>{k.current=t.selectedValue}),[e]);const P=vt(e,e=>{var t;if(S&&C){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=k.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}}),N=vt(e,"renderedItems"),V=vt(e,"open"),M=vt(e,"contentElement"),F=(0,s.useMemo)(()=>{if(!S)return E;if(!C)return E;if(yn(N,P,j)){if(jn(E,P)){const e=(null==P?void 0:P.slice(E.length))||"";return E+e}return E}return P||E},[S,C,N,P,j,E]);(0,s.useEffect)(()=>{const e=h.current;if(!e)return;const t=()=>I(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,s.useEffect)(()=>{if(!S)return;if(!C)return;if(!P)return;if(!yn(N,P,j))return;if(!jn(E,P))return;let e=Y;return queueMicrotask(()=>{const t=h.current;if(!t)return;const{start:n,end:i}=fe(t),s=E.length,r=P.length;be(t,s,r),e=()=>{if(!rn(t))return;const{start:e,end:o}=fe(t);e===s&&o===r&&be(t,n,i)}}),()=>e()},[_,S,C,P,N,j,E]);const O=(0,s.useRef)(null),A=Ne(i),D=(0,s.useRef)(null),T=(0,s.useRef)(!1),B=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!V)return;if(!M)return;const t=ge(M);if(!t)return;O.current=t;const n=()=>{x.current=!1,T.current=!0},i=()=>{if(B.current||(T.current=!0),!e)return;if(!x.current)return;const{activeId:t}=e.getState();null!==t&&t!==D.current&&(x.current=!1)},s={passive:!0,capture:!0};return t.addEventListener("wheel",n,s),t.addEventListener("touchmove",n,s),t.addEventListener("scroll",i,s),()=>{t.removeEventListener("wheel",n,!0),t.removeEventListener("touchmove",n,!0),t.removeEventListener("scroll",i,!0)}},[V,M,e]),Pe(()=>{T.current=!1,E&&(y.current||(x.current=!0))},[E]),Pe(()=>{"always"!==j&&V||(x.current=V)},[j,V]);const L=vt(e,"resetValueOnSelect");Fe(()=>{var t,n;const i=x.current;if(!e)return;if(!V)return;if(!i&&(!L||T.current))return;const{baseElement:s,contentElement:r,activeId:o}=e.getState();if(!s||rn(s)){if(null==r?void 0:r.hasAttribute("data-placing")){const e=new MutationObserver(w);return e.observe(r,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(j&&i){const n=A(N),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}(N))?t:e.first();D.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&&(B.current=!0,t.scrollIntoView({block:"nearest",inline:"nearest"}),requestAnimationFrame(()=>{B.current=!1}))}}},[e,V,_,E,j,L,A,N]),(0,s.useEffect)(()=>{if(!S)return;const t=h.current;if(!t)return;const n=[t,M].filter(e=>!!e),i=t=>{n.every(e=>je(t,e))&&(null==e||e.setValue(F))};for(const e of n)e.addEventListener("focusout",i);return()=>{for(const e of n)e.removeEventListener("focusout",i)}},[S,M,e,F]);const R=e=>e.currentTarget.value.length>=o,H=g.onChange,z=Oe(null!=l?l:R),W=Oe(null!=r?r:!e.tag),$=Ne(t=>{if(null==H||H(t),t.defaultPrevented)return;if(!e)return;const n=t.currentTarget,{value:i,selectionStart:s,selectionEnd:r}=n,o=t.nativeEvent;if(x.current=!0,function(e){return"input"===e.type}(o)&&(o.isComposing&&(x.current=!1,y.current=!0),S)){const e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=s===i.length;I(e&&t)}if(W(t)){const t=i===e.getState().value;e.setValue(i),queueMicrotask(()=>{be(n,s,r)}),S&&j&&t&&w()}z(t)&&e.show(),j&&x.current||e.setActiveId(null)}),U=g.onCompositionEnd,K=Ne(e=>{x.current=!0,y.current=!1,null==U||U(e),e.defaultPrevented||j&&w()}),G=g.onMouseDown,q=Oe(null!=m?m:()=>e.getState().includesBaseElement),X=Oe(p),Z=Oe(null!=c?c:R),J=Ne(t=>{null==G||G(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(q(t)&&e.setActiveId(null),X(t)&&e.setValue(F),Z(t)&&Se(t.currentTarget,"mouseup",e.show))}),Q=g.onKeyDown,te=Oe(null!=d?d:R),ne=Ne(t=>{if(null==Q||Q(t),t.repeat||(x.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||te(t)&&(t.preventDefault(),e.show())}),ie=g.onBlur,se=Ne(e=>{x.current=!1,null==ie||ie(e),e.defaultPrevented}),re=Me(g.id),oe=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(v)?v:void 0,le=vt(e,e=>null===e.activeId);return g={role:"combobox","aria-autocomplete":oe,"aria-haspopup":ve(M,"listbox"),"aria-expanded":V,"aria-controls":null==M?void 0:M.id,"data-active-item":le||void 0,value:F,...g,id:re,ref:Ve(h,g.ref),onChange:$,onCompositionEnd:K,onMouseDown:J,onKeyDown:ne,onBlur:se},g=wn({store:e,focusable:t,...g,moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(f,e)&&(S&&I(!0),!0)}),g=xn({store:e,...g}),{autoComplete:"off",...g}}),Cn=We(function(e){return Ue("input",Sn(e))}),In=n(795);function En(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function kn(...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 Pn(e,t,n){return!(n||!1===t||e&&!t)}var Nn=Ke(function({store:e,alwaysVisible:t,...n}){const i=Ft();ee(e=e||i,!1);const r=(0,s.useRef)(null),o=Me(n.id),[l,a]=(0,s.useState)(null),u=vt(e,"open"),d=vt(e,"mounted"),m=vt(e,"animated"),p=vt(e,"contentElement"),f=vt(e.disclosure,"contentElement"),v=(0,s.useRef)(!1);Pe(()=>{r.current&&(null==e||e.setContentElement(r.current))},[e]),Pe(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),Pe(()=>{if(m){if(null==p?void 0:p.isConnected)return function(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}(()=>{a(u?"enter":d?"leave":null)});a(null)}else u?v.current&&(v.current=!1,a("enter")):(v.current=!0,a(null))},[m,p,u,d]),Pe(()=>{if(!e)return;if(!m)return;if(!l)return;if(!p)return;const t=()=>null==e?void 0:e.setState("animating",!1),n=()=>(0,In.flushSync)(t);if("leave"===l&&u)return;if("enter"===l&&!u)return;if("number"==typeof m)return En(m,n);const{transitionDuration:i,animationDuration:s,transitionDelay:r,animationDelay:o}=getComputedStyle(p),{transitionDuration:a="0",animationDuration:c="0",transitionDelay:d="0",animationDelay:v="0"}=f?getComputedStyle(f):{},g=kn(r,o,d,v)+kn(i,s,a,c);return g?En(Math.max(g-1e3/60,0),n):("enter"===l&&e.setState("animated",!1),void t())},[e,m,p,f,u,l]),n=Ae(n,t=>(0,c.jsx)(Dt,{value:e,children:t}),[e]);const g=Pn(d,n.hidden,t),b=n.style,h=(0,s.useMemo)(()=>g?{...b,display:"none"}:b,[g,b]);return ne(n={"data-open":u||void 0,"data-enter":"enter"===l||void 0,"data-leave":"leave"===l||void 0,hidden:g,...n,id:o,ref:Ve(o?e.setContentElement:null,r,n.ref),style:h})}),Vn=We(function(e){return Ue("div",Nn(e))}),Mn=(We(function({unmountOnHide:e,...t}){const n=Ft();return!1===vt(t.store||n,t=>!e||(null==t?void 0:t.mounted))?null:(0,c.jsx)(Vn,{...t})}),Ke(function({store:e,alwaysVisible:t,...n}){const i=$t(!0),r=Wt(),o=!!(e=e||r)&&e===i;ee(e,!1);const l=(0,s.useRef)(null),a=Me(n.id),u=vt(e,"mounted"),d=Pn(u,n.hidden,t),m=d?{...n.style,display:"none"}:n.style,p=vt(e,e=>Array.isArray(e.selectedValue)),f=function(e,t,n){const i=function(e){const[t]=(0,s.useState)(e);return t}(n),[r,o]=(0,s.useState)(i);return(0,s.useEffect)(()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const s=()=>{const e=n.getAttribute(t);o(null==e?i:e)},r=new MutationObserver(s);return r.observe(n,{attributeFilter:[t]}),s(),()=>r.disconnect()},[e,t,i]),r}(l,"role",n.role),v=("listbox"===f||"tree"===f||"grid"===f)&&p||void 0,[g,b]=(0,s.useState)(!1),h=vt(e,"contentElement");Pe(()=>{if(!u)return;const e=l.current;if(!e)return;if(h!==e)return;const t=()=>{b(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()},[u,h]),g||(n={role:"listbox","aria-multiselectable":v,...n}),n=Ae(n,t=>(0,c.jsx)(Gt,{value:e,children:(0,c.jsx)(Ht.Provider,{value:f,children:t})}),[e,f]);const _=!a||i&&o?null:e.setContentElement;return ne(n={hidden:d,...n,id:a,ref:Ve(_,l,n.ref),style:m})})),Fn=We(function(e){return Ue("div",Mn(e))});function On(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var An=Symbol("composite-hover"),Dn=Ke(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:n=!!t,...i}){const r=Ze();ee(e=e||r,!1);const o=((0,s.useEffect)(()=>{Te||(Ce("mousemove",He,!0),Ce("mousedown",ze,!0),Ce("mouseup",ze,!0),Ce("keydown",ze,!0),Ce("scroll",ze,!0),Te=!0)},[]),Ne(()=>Be)),l=i.onMouseMove,a=Oe(t),c=Ne(t=>{if(null==l||l(t),!t.defaultPrevented&&o()&&a(t)){if(!function(e){const t=ae(e);if(!t)return!1;if(ce(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&&!rn(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),u=i.onMouseLeave,d=Oe(n),m=Ne(t=>{var n;null==u||u(t),t.defaultPrevented||o()&&(function(e){const t=On(e);return!!t&&ce(e.currentTarget,t)}(t)||function(e){let t=On(e);if(!t)return!1;do{if(X(t,An)&&t[An])return!0;t=t.parentElement}while(t);return!1}(t)||a(t)&&d(t)&&(null==e||e.setActiveId(null),null==(n=null==e?void 0:e.getState().baseElement)||n.focus()))}),p=(0,s.useCallback)(e=>{e&&(e[An]=!0)},[]);return ne(i={...i,ref:Ve(p,i.ref),onMouseMove:c,onMouseLeave:m})}),Tn=($e(We(function(e){return Ue("div",Dn(e))})),Ke(function({store:e,shouldRegisterItem:t=!0,getItem:n=Q,element:i,...r}){const o=Ye();e=e||o;const l=Me(r.id),a=(0,s.useRef)(i);return(0,s.useEffect)(()=>{const i=a.current;if(!l)return;if(!i)return;if(!t)return;const s=n({id:l,element:i});return null==e?void 0:e.renderItem(s)},[l,t,n,e]),ne(r={...r,ref:Ve(a,r.ref)})}));function Bn(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?ue(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(ue(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}We(function(e){return Ue("div",Tn(e))});var Ln=Symbol("command"),Rn=Ke(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...n}){const i=(0,s.useRef)(null),[r,o]=(0,s.useState)(!1);(0,s.useEffect)(()=>{i.current&&o(ue(i.current))},[]);const[l,a]=(0,s.useState)(!1),c=(0,s.useRef)(!1),u=te(n),[d,m]=De(n,Ln,!0),p=n.onKeyDown,f=Ne(n=>{null==p||p(n);const i=n.currentTarget;if(n.defaultPrevented)return;if(d)return;if(u)return;if(!we(n))return;if(me(i))return;if(i.isContentEditable)return;const s=e&&"Enter"===n.key,r=t&&" "===n.key,o="Enter"===n.key&&!e,l=" "===n.key&&!t;if(o||l)n.preventDefault();else if(s||r){const e=Bn(n);if(s){if(!e){n.preventDefault();const{view:e,...t}=n,s=()=>ye(i,t);oe&&/firefox\//i.test(navigator.userAgent)?Se(i,"keyup",s):queueMicrotask(s)}}else r&&(c.current=!0,e||(n.preventDefault(),a(!0)))}}),v=n.onKeyUp,g=Ne(e=>{if(null==v||v(e),e.defaultPrevented)return;if(d)return;if(u)return;if(e.metaKey)return;const n=t&&" "===e.key;if(c.current&&n&&(c.current=!1,!Bn(e))){e.preventDefault(),a(!1);const t=e.currentTarget,{view:n,...i}=e;queueMicrotask(()=>ye(t,i))}});return n={"data-active":l||void 0,type:r?"button":void 0,...m,...n,ref:Ve(i,n.ref),onKeyDown:f,onKeyUp:g},gn(n)});function Hn(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function zn(e,t,n,i=!1){var s;if(!t)return;if(!n)return;const{renderedItems:r}=t.getState(),o=ge(e);if(!o)return;const l=function(e,t=!1){const n=e.clientHeight,{top:i}=e.getBoundingClientRect(),s=1.5*Math.max(.875*n,n-40),r=t?n-s+i:s+i;return"HTML"===e.tagName?r+e.scrollTop:r}(o,i);let a,c;for(let e=0;e<r.length;e+=1){const r=a;if(a=n(e),!a)break;if(a===r)continue;const o=null==(s=Qt(t,a))?void 0:s.element;if(!o)continue;const u=Hn(o,i)-l,d=Math.abs(u);if(i&&u<=0||!i&&u>=0){void 0!==c&&c<d&&(a=r);break}c=d}return a}We(function(e){return Ue("button",Rn(e))});var Wn=Ke(function({store:e,rowId:t,preventScrollOnKeyDown:n=!1,moveOnKeyPress:i=!0,tabbable:r=!1,getItem:o,"aria-setsize":l,"aria-posinset":a,...u}){const d=Ze();e=e||d;const m=Me(u.id),p=(0,s.useRef)(null),f=(0,s.useContext)(nt),v=te(u)&&!u.accessibleWhenDisabled,{rowId:g,baseElement:b,isActiveItem:h,ariaSetSize:_,ariaPosInSet:w,isTabbable:x}=gt(e,{rowId:e=>t||(e&&(null==f?void 0:f.baseElement)&&f.baseElement===e.baseElement?f.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===m,ariaSetSize:e=>null!=l?l:e&&(null==f?void 0:f.ariaSetSize)&&f.baseElement===e.baseElement?f.ariaSetSize:void 0,ariaPosInSet(e){if(null!=a)return a;if(!e)return;if(!(null==f?void 0:f.ariaPosInSet))return;if(f.baseElement!==e.baseElement)return;const t=e.renderedItems.filter(e=>e.rowId===g);return f.ariaPosInSet+t.findIndex(e=>e.id===m)},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===m}}),y=(0,s.useCallback)(e=>{var t;const n={...e,id:m||e.id,rowId:g,disabled:v,children:null==(t=e.element)?void 0:t.textContent};return o?o(n):n},[m,g,v,o]),j=u.onFocus,S=(0,s.useRef)(!1),C=Ne(t=>{if(null==j||j(t),t.defaultPrevented)return;if(function(e){return Boolean(e.currentTarget&&!ce(e.currentTarget,e.target))}(t))return;if(!m)return;if(!e)return;if(function(e,t){return!we(e)&&tn(t,e.target)}(t,e))return;const{virtualFocus:n,baseElement:i}=e.getState();var s;(e.setActiveId(m),pe(t.currentTarget)&&function(e,t=!1){if(me(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=le(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(t.currentTarget),n)&&(we(t)&&(pe(s=t.currentTarget)||"INPUT"===s.tagName&&!ue(s)||(null==i?void 0:i.isConnected)&&(_e()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),S.current=!0,t.relatedTarget===i||tn(e,t.relatedTarget)?function(e){e[en]=!0,e.focus({preventScroll:!0})}(i):i.focus())))}),I=u.onBlurCapture,E=Ne(t=>{if(null==I||I(t),t.defaultPrevented)return;const n=null==e?void 0:e.getState();(null==n?void 0:n.virtualFocus)&&S.current&&(S.current=!1,t.preventDefault(),t.stopPropagation())}),k=u.onKeyDown,P=Oe(n),N=Oe(i),V=Ne(t=>{if(null==k||k(t),t.defaultPrevented)return;if(!we(t))return;if(!e)return;const{currentTarget:n}=t,i=e.getState(),s=e.item(m),r=!!(null==s?void 0:s.rowId),o="horizontal"!==i.orientation,l="vertical"!==i.orientation,a=()=>!(!r&&!l&&i.baseElement&&me(i.baseElement)),c={ArrowUp:(r||o)&&e.up,ArrowRight:(r||l)&&e.next,ArrowDown:(r||o)&&e.down,ArrowLeft:(r||l)&&e.previous,Home:()=>{if(a())return!r||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(a())return!r||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>zn(n,e,null==e?void 0:e.up,!0),PageDown:()=>zn(n,e,null==e?void 0:e.down)}[t.key];if(c){if(pe(n)){const e=fe(n),i=l&&"ArrowLeft"===t.key,s=l&&"ArrowRight"===t.key,r=o&&"ArrowUp"===t.key,a=o&&"ArrowDown"===t.key;if(s||a){const{length:t}=function(e){if(me(e))return e.value;if(e.isContentEditable){const t=le(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(n);if(e.end!==t)return}else if((i||r)&&0!==e.start)return}const i=c();if(P(t)||void 0!==i){if(!N(t))return;t.preventDefault(),e.move(i)}}}),M=(0,s.useMemo)(()=>({id:m,baseElement:b}),[m,b]);return u=Ae(u,e=>(0,c.jsx)(tt.Provider,{value:M,children:e}),[M]),u={"data-active-item":h||void 0,...u,id:m,ref:Ve(p,u.ref),tabIndex:x?u.tabIndex:-1,onFocus:C,onBlurCapture:E,onKeyDown:V},u=Rn(u),u=Tn({store:e,...u,getItem:y,shouldRegisterItem:!!m&&u.shouldRegisterItem}),ne({...u,"aria-setsize":_,"aria-posinset":w})});function $n(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}$e(We(function(e){return Ue("button",Wn(e))}));var Un=Ke(function({store:e,value:t,hideOnClick:n,setValueOnClick:i,selectValueOnClick:r=!0,resetValueOnSelect:o,focusOnHover:l=!1,moveOnKeyPress:a=!0,getItem:u,...d}){var m;const p=$t();ee(e=e||p,!1);const{resetValueOnSelectState:f,multiSelectable:v,selected:g}=gt(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)}),b=(0,s.useCallback)(e=>{const n={...e,value:t};return u?u(n):n},[t,u]);i=null!=i?i:!v,n=null!=n?n:null!=t&&!v;const h=d.onClick,_=Oe(i),w=Oe(r),x=Oe(null!=(m=null!=o?o:f)?m:v),y=Oe(n),j=Ne(n=>{null==h||h(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=he();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&&(w(n)&&(x(n)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),_(n)&&(null==e||e.setValue(t))),y(n)&&(null==e||e.hide()))}),S=d.onKeyDown,C=Ne(t=>{if(null==S||S(t),t.defaultPrevented)return;const n=null==e?void 0:e.getState().baseElement;n&&(rn(n)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>n.focus()),me(n)&&(null==e||e.setValue(n.value))))});v&&null!=g&&(d={"aria-selected":g,...d}),d=Ae(d,e=>(0,c.jsx)(qt.Provider,{value:t,children:(0,c.jsx)(Yt.Provider,{value:null!=g&&g,children:e})}),[t,g]),d={role:$n((0,s.useContext)(Ht)),children:t,...d,onClick:j,onKeyDown:C};const I=Oe(a);return d=Wn({store:e,...d,getItem:b,moveOnKeyPress:t=>{if(!I(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}}),Dn({store:e,focusOnHover:l,...d})}),Kn=$e(We(function(e){return Ue("div",Un(e))}));function Gn(e){return J(e).toLowerCase()}var qn=Ke(function({store:e,value:t,userValue:n,...i}){const r=$t();e=e||r;const o=(0,s.useContext)(qt),l=null!=t?t:o,a=vt(e,e=>null!=n?n:null==e?void 0:e.value);return ne(i={children:(0,s.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(Gn);var i;const s=[],r=(e,t=!1)=>(0,c.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},s.length),o=function(e){return e.sort(([e],[t])=>e-t)}(function(e){return e.filter(([e,t],n,i)=>!i.some(([i,s],r)=>r!==n&&i<=e&&i+s>=e+t))}(function(e,t){const n=[];for(const i of t){let t=0;const s=i.length;for(;-1!==e.indexOf(i,t);){const r=e.indexOf(i,t);-1!==r&&n.push([r,s]),t=r+1}}return n}(Gn(e),new Set(n)))),l=o[0];if(!l)return s.push(r(e,!0)),s;const[a]=l,u=[e.slice(0,a),...o.flatMap(([t,n],i)=>{var s;const r=e.slice(t,t+n),l=null==(s=o[i+1])?void 0:s[0];return[r,e.slice(t+n,l)]})];return u.forEach((e,t)=>{e&&s.push(r(e,t%2==0))}),s}(l,a):l},[l,a]),...i})}),Yn=We(function(e){return Ue("span",qn(e))}),Xn=n(731),Zn=n.n(Xn);const Jn=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),Qn=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),ei=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Circle,{cx:12,cy:12,r:3})});function ti(e=""){return Zn()(e.trim().toLowerCase())}const ni=[],ii=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:ni,si=(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 ri(e,t){return`${e}-${t}`}function oi({view:e,filter:t,onChangeView:n}){const s=(0,E.useInstanceId)(oi,"dataviews-filter-list-box"),[r,o]=(0,i.useState)(1===t.operators?.length?void 0:null),a=e.filters?.find(e=>e.field===t.field),u=ii(t,a);return(0,c.jsx)(l.Composite,{virtualFocus:!0,focusLoop:!0,activeId:r,setActiveId:o,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:()=>{!r&&t.elements.length&&o(ri(s,t.elements[0].value))},render:(0,c.jsx)(l.Composite.Typeahead,{}),children:t.elements.map(i=>(0,c.jsxs)(l.Composite.Hover,{render:(0,c.jsx)(l.Composite.Item,{id:ri(s,i.value),render:(0,c.jsx)("div",{"aria-label":i.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{var s,r;const o=a?[...(null!==(s=e.filters)&&void 0!==s?s:[]).map(e=>e.field===t.field?{...e,operator:a.operator||t.operators[0],value:si(t,a,i.value)}:e)]:[...null!==(r=e.filters)&&void 0!==r?r:[],{field:t.field,operator:t.operators[0],value:si(t,a,i.value)}];n({...e,page:1,filters:o})}}),children:[(0,c.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&u===i.value&&(0,c.jsx)(l.Icon,{icon:ei}),!t.singleSelection&&u.includes(i.value)&&(0,c.jsx)(l.Icon,{icon:Jn})]}),(0,c.jsx)("span",{children:i.label})]},i.value))})}function li({view:e,filter:t,onChangeView:n}){const[s,r]=(0,i.useState)(""),o=(0,i.useDeferredValue)(s),a=e.filters?.find(e=>e.field===t.field),u=ii(t,a),m=(0,i.useMemo)(()=>{const e=ti(o);return t.elements.filter(t=>ti(t.label).includes(e))},[t.elements,o]);return(0,c.jsxs)(Xt,{selectedValue:u,setSelectedValue:i=>{var s,r;const o=a?[...(null!==(s=e.filters)&&void 0!==s?s:[]).map(e=>e.field===t.field?{...e,operator:a.operator||t.operators[0],value:i}:e)]:[...null!==(r=e.filters)&&void 0!==r?r:[],{field:t.field,operator:t.operators[0],value:i}];n({...e,page:1,filters:o})},setValue:r,children:[(0,c.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,c.jsx)(Jt,{render:(0,c.jsx)(l.VisuallyHidden,{children:(0,d.__)("Search items")}),children:(0,d.__)("Search items")}),(0,c.jsx)(Cn,{autoSelect:"always",placeholder:(0,d.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,c.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,c.jsx)(l.Icon,{icon:Qn})})]}),(0,c.jsxs)(Fn,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[m.map(e=>(0,c.jsxs)(Kn,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[(0,c.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&u===e.value&&(0,c.jsx)(l.Icon,{icon:ei}),!t.singleSelection&&u.includes(e.value)&&(0,c.jsx)(l.Icon,{icon:Jn})]}),(0,c.jsxs)("span",{children:[(0,c.jsx)(Yn,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,c.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value)),!m.length&&(0,c.jsx)("p",{children:(0,d.__)("No results found")})]})]})}function ai(e){const t=e.filter.elements.length>10?li:oi;return(0,c.jsx)(t,{...e})}const ci="Enter",ui=" ",di=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const s={Name:(0,c.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,c.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};return t?.operator===M?(0,i.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(", ")),s):t?.operator===F?(0,i.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(", ")),s):t?.operator===O?(0,i.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(", ")),s):t?.operator===A?(0,i.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(", ")),s):t?.operator===N?(0,i.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),s):t?.operator===V?(0,i.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),s):(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 mi({filter:e,view:t,onChangeView:n}){const i=e.operators?.map(e=>({value:e,label:T[e]?.label})),s=t.filters?.find(t=>t.field===e.field),r=s?.operator||e.operators[0];return i.length>1&&(0,c.jsxs)(l.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,c.jsx)(l.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,c.jsx)(l.SelectControl,{label:(0,d.__)("Conditions"),value:r,options:i,onChange:i=>{var r,o;const l=i,a=s?[...(null!==(r=t.filters)&&void 0!==r?r:[]).map(t=>t.field===e.field?{...t,operator:l}:t)]:[...null!==(o=t.filters)&&void 0!==o?o:[],{field:e.field,operator:l,value:void 0}];n({...t,page:1,filters:a})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function pi({addFilterRef:e,openedFilter:t,...n}){const s=(0,i.useRef)(null),{filter:r,view:o,onChangeView:a}=n,m=o.filters?.find(e=>e.field===r.field),p=r.elements.filter(e=>r.singleSelection?e.value===m?.value:m?.value?.includes(e.value)),f=r.isPrimary,v=void 0!==m?.value,g=!f||v;return(0,c.jsx)(l.Dropdown,{defaultOpen:t===r.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{s.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,c.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,c.jsx)(l.Tooltip,{text:(0,d.sprintf)(/* translators: 1: Filter name. */ /* translators: 1: Filter name. */ (0,d.__)("Filter by: %1$s"),r.name.toLowerCase()),placement:"top",children:(0,c.jsx)("div",{className:q("dataviews-filters__summary-chip",{"has-reset":g,"has-values":v}),role:"button",tabIndex:0,onClick:n,onKeyDown:e=>{[ci,ui].includes(e.key)&&(n(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:s,children:(0,c.jsx)(di,{activeElements:p,filterInView:m,filter:r})})}),g&&(0,c.jsx)(l.Tooltip,{text:f?(0,d.__)("Reset"):(0,d.__)("Remove"),placement:"top",children:(0,c.jsx)("button",{className:q("dataviews-filters__summary-chip-remove",{"has-values":v}),onClick:()=>{a({...o,page:1,filters:o.filters?.filter(e=>e.field!==r.field)}),f?s.current?.focus():e.current?.focus()},children:(0,c.jsx)(l.Icon,{icon:u})})})]}),renderContent:()=>(0,c.jsxs)(l.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,c.jsx)(mi,{...n}),(0,c.jsx)(ai,{...n})]})})}const fi=window.wp.privateApis,{lock:vi,unlock:gi}=(0,fi.__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:bi}=gi(l.privateApis);function hi({filters:e,view:t,onChangeView:n,setOpenedFilter:i,triggerProps:s}){const r=e.filter(e=>!e.isVisible);return(0,c.jsxs)(bi,{children:[(0,c.jsx)(bi.TriggerButton,{...s}),(0,c.jsx)(bi.Popover,{children:r.map(e=>(0,c.jsx)(bi.Item,{onClick:()=>{i(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,c.jsx)(bi.ItemLabel,{children:e.name})},e.field))})]})}const _i=(0,i.forwardRef)(function({filters:e,view:t,onChangeView:n,setOpenedFilter:i},s){if(!e.length||e.every(({isPrimary:e})=>e))return null;const r=e.filter(e=>!e.isVisible);return(0,c.jsx)(hi,{triggerProps:{render:(0,c.jsx)(l.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!r.length,ref:s}),children:(0,d.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:i})});function wi({filters:e,view:t,onChangeView:n}){const i=!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,c.jsx)(l.Button,{disabled:i,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:[]})},children:(0,d.__)("Reset")})}function xi(e){let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[M,F]),t=t.filter(e=>D.includes(e)),(t.includes(N)||t.includes(V))&&(t=t.filter(e=>[N,V].includes(e))),t}function yi(e,t){return(0,i.useMemo)(()=>{const n=[];return e.forEach(e=>{if(!e.elements?.length)return;const i=xi(e);if(0===i.length)return;const s=!!e.filterBy?.isPrimary;n.push({field:e.id,name:e.label,elements:e.elements,singleSelection:i.some(e=>[N,V].includes(e)),operators:i,isVisible:s||!!t.filters?.some(t=>t.field===e.id&&D.includes(t.operator)),isPrimary:s})}),n.sort((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)),n},[e,t])}function ji({filters:e,view:t,onChangeView:n,setOpenedFilter:s,isShowingFilter:r,setIsShowingFilter:o}){const a=(0,i.useRef)(null),u=(0,i.useCallback)(e=>{n(e),o(!0)},[n,o]),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":r,isPressed:r,onClick:()=>{r||s(null),o(!r)}},v=(0,c.jsx)(l.Button,{ref:a,className:"dataviews-filters__visibility-toggle",size:"compact",icon:K,...m?f:p});return(0,c.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:m?(0,c.jsx)(Si,{buttonRef:a,filtersCount:t.filters?.length,children:v}):(0,c.jsx)(hi,{filters:e,view:t,onChangeView:u,setOpenedFilter:s,triggerProps:{render:v}})})}function Si({buttonRef:e,filtersCount:t,children:n}){return(0,i.useEffect)(()=>()=>{e.current?.focus()},[e]),(0,c.jsxs)(c.Fragment,{children:[n,!!t&&(0,c.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}const Ci=(0,i.memo)(function(){const{fields:e,view:t,onChangeView:n,openedFilter:s,setOpenedFilter:r}=(0,i.useContext)(U),o=(0,i.useRef)(null),a=yi(e,t),u=(0,c.jsx)(_i,{filters:a,view:t,onChangeView:n,ref:o,setOpenedFilter:r},"add-filter"),d=a.filter(e=>e.isVisible);if(0===d.length)return null;const m=[...d.map(e=>(0,c.jsx)(pi,{filter:e,view:t,onChangeView:n,addFilterRef:o,openedFilter:s},e.field)),u];return m.push((0,c.jsx)(wi,{filters:a,view:t,onChangeView:n},"reset-filters")),(0,c.jsx)(l.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},className:"dataviews-filters__container",wrap:!0,children:m})}),Ii=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.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"})}),Ei=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.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"})}),ki=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),Pi=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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 Ni({selection:e,onChangeSelection:t,item:n,getItemId:i,titleField:s,disabled:r}){const o=i(n),a=!r&&e.includes(o),u=s?.getValue?.({item:n})||(0,d.__)("(no title)");return(0,c.jsx)(l.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":u,"aria-disabled":r,checked:a,onChange:()=>{r||t(e.includes(o)?e.filter(e=>o!==e):[...e,o])}})}const Vi=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),{Menu:Mi,kebabCase:Fi}=gi(l.privateApis);function Oi({action:e,onClick:t,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,c.jsx)(l.Button,{label:i,icon:e.icon,disabled:!!e.disabled,accessibleWhenDisabled:!0,isDestructive:e.isDestructive,size:"compact",onClick:t})}function Ai({action:e,onClick:t,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,c.jsx)(Mi.Item,{disabled:e.disabled,onClick:t,children:(0,c.jsx)(Mi.ItemLabel,{children:i})})}function Di({action:e,items:t,closeModal:n}){const i="string"==typeof e.label?e.label:e.label(t);return(0,c.jsx)(l.Modal,{title:e.modalHeader||i,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:"firstContentElement",size:e.modalSize||"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${Fi(e.id)}`,children:(0,c.jsx)(e.RenderModal,{items:t,closeModal:n})})}function Ti({actions:e,item:t,registry:n,setActiveModalAction:i}){return(0,c.jsx)(Mi.Group,{children:e.map(e=>(0,c.jsx)(Ai,{action:e,onClick:()=>{"RenderModal"in e?i(e):e.callback([t],{registry:n})},items:[t]},e.id))})}function Bi({item:e,actions:t,isCompact:n}){const s=(0,x.useRegistry)(),{primaryActions:r,eligibleActions:o}=(0,i.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,c.jsx)(Li,{item:e,actions:o,isSmall:!0,registry:s}):r.length===o.length?(0,c.jsx)(Ri,{item:e,actions:r,registry:s}):(0,c.jsxs)(l.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:"0",width:"auto"},children:[(0,c.jsx)(Ri,{item:e,actions:r,registry:s}),(0,c.jsx)(Li,{item:e,actions:o,registry:s})]})}function Li({item:e,actions:t,isSmall:n,registry:s}){const[r,o]=(0,i.useState)(null);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(Mi,{placement:"bottom-end",children:[(0,c.jsx)(Mi.TriggerButton,{render:(0,c.jsx)(l.Button,{size:n?"small":"compact",icon:Vi,label:(0,d.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,className:"dataviews-all-actions-button"})}),(0,c.jsx)(Mi.Popover,{children:(0,c.jsx)(Ti,{actions:t,item:e,registry:s,setActiveModalAction:o})})]}),!!r&&(0,c.jsx)(Di,{action:r,items:[e],closeModal:()=>o(null)})]})}function Ri({item:e,actions:t,registry:n}){const[s,r]=(0,i.useState)(null);return Array.isArray(t)&&0!==t.length?(0,c.jsxs)(c.Fragment,{children:[t.map(t=>(0,c.jsx)(Oi,{action:t,onClick:()=>{"RenderModal"in t?r(t):t.callback([e],{registry:n})},items:[e]},t.id)),!!s&&(0,c.jsx)(Di,{action:s,items:[e],closeModal:()=>r(null)})]}):null}function Hi({action:e,items:t,ActionTriggerComponent:n}){const[s,r]=(0,i.useState)(!1),o={action:e,onClick:()=>{r(!0)},items:t};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{...o}),s&&(0,c.jsx)(Di,{action:e,items:t,closeModal:()=>r(!1)})]})}function zi(e,t){return(0,i.useMemo)(()=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))),[e,t])}function Wi(e,t){return(0,i.useMemo)(()=>t.some(t=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t)))),[e,t])}function $i({selection:e,onChangeSelection:t,data:n,actions:s,getItemId:r}){const o=(0,i.useMemo)(()=>n.filter(e=>s.some(t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e)))),[n,s]),a=n.filter(t=>e.includes(r(t))&&o.includes(t)),u=a.length===o.length;return(0,c.jsx)(l.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:u,indeterminate:!u&&!!a.length,onChange:()=>{t(u?[]:o.map(e=>r(e)))},"aria-label":u?(0,d.__)("Deselect all"):(0,d.__)("Select all")})}function Ui({action:e,onClick:t,isBusy:n,items:i}){const s="string"==typeof e.label?e.label:e.label(i);return(0,c.jsx)(l.Button,{disabled:n,accessibleWhenDisabled:!0,label:s,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t,isBusy:n,tooltipPosition:"top"})}const Ki=[];function Gi({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:s}){const r=(0,x.useRegistry)(),o=(0,i.useMemo)(()=>t.filter(t=>!e.isEligible||e.isEligible(t)),[e,t]);return"RenderModal"in e?(0,c.jsx)(Hi,{action:e,items:o,ActionTriggerComponent:Ui},e.id):(0,c.jsx)(Ui,{action:e,onClick:async()=>{s(e.id),await e.callback(t,{registry:r}),s(null)},items:o,isBusy:n===e.id},e.id)}function qi(e,t,n,i,s,r,o,a,m){const p=r.length>0?(0,d.sprintf)(/* translators: %d: number of items. */ /* translators: %d: number of items. */ (0,d._n)("%d Item selected","%d Items selected",r.length),r.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,c.jsxs)(l.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,c.jsx)($i,{selection:i,onChangeSelection:m,data:e,actions:t,getItemId:n}),(0,c.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:p}),(0,c.jsxs)(l.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[s.map(e=>(0,c.jsx)(Gi,{action:e,selectedItems:r,actionInProgress:o,setActionInProgress:a},e.id)),r.length>0&&(0,c.jsx)(l.Button,{icon:u,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,d.__)("Cancel"),disabled:!!o,accessibleWhenDisabled:!1,onClick:()=>{m(Ki)}})]})]})}function Yi({selection:e,actions:t,onChangeSelection:n,data:s,getItemId:r}){const[o,l]=(0,i.useState)(null),a=(0,i.useRef)(null),c=(0,i.useMemo)(()=>t.filter(e=>e.supportsBulk),[t]),u=(0,i.useMemo)(()=>s.filter(e=>c.some(t=>!t.isEligible||t.isEligible(e))),[s,c]),d=(0,i.useMemo)(()=>s.filter(t=>e.includes(r(t))&&u.includes(t)),[e,s,r,u]),m=(0,i.useMemo)(()=>t.filter(e=>e.supportsBulk&&e.icon&&d.some(t=>!e.isEligible||e.isEligible(t))),[t,d]);return o?(a.current||(a.current=qi(s,t,r,e,m,d,o,l,n)),a.current):(a.current&&(a.current=null),qi(s,t,r,e,m,d,o,l,n))}function Xi(){const{data:e,selection:t,actions:n=Ki,onChangeSelection:s,getItemId:r}=(0,i.useContext)(U);return(0,c.jsx)(Yi,{selection:t,onChangeSelection:s,data:e,actions:n,getItemId:r})}const Zi=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),Ji=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),Qi=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.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:es}=gi(l.privateApis);function ts({children:e}){return i.Children.toArray(e).filter(Boolean).map((e,t)=>(0,c.jsxs)(i.Fragment,{children:[t>0&&(0,c.jsx)(es.Separator,{}),e]},t))}const ns=(0,i.forwardRef)(function({fieldId:e,view:t,fields:n,onChangeView:i,onHide:s,setOpenedFilter:r,canMove:o=!0},a){var u;const m=null!==(u=t.fields)&&void 0!==u?u:[],p=m?.indexOf(e),f=t.sort?.field===e;let v=!1,g=!1,b=!1,h=[];const _=n.find(t=>t.id===e);if(!_)return null;v=!1!==_.enableHiding,g=!1!==_.enableSorting;const w=_.header;return h=xi(_),b=!(t.filters?.some(t=>e===t.field)||!_.elements?.length||!h.length||_.filterBy?.isPrimary),(0,c.jsxs)(es,{children:[(0,c.jsxs)(es.TriggerButton,{render:(0,c.jsx)(l.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:a,variant:"tertiary"}),children:[w,t.sort&&f&&(0,c.jsx)("span",{"aria-hidden":"true",children:L[t.sort.direction]})]}),(0,c.jsx)(es.Popover,{style:{minWidth:"240px"},children:(0,c.jsxs)(ts,{children:[g&&(0,c.jsx)(es.Group,{children:B.map(n=>{const s=t.sort&&f&&t.sort.direction===n,r=`${e}-${n}`;return(0,c.jsx)(es.RadioItem,{name:"view-table-sorting",value:r,checked:s,onChange:()=>{i({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,c.jsx)(es.ItemLabel,{children:H[n]})},r)})}),b&&(0,c.jsx)(es.Group,{children:(0,c.jsx)(es.Item,{prefix:(0,c.jsx)(l.Icon,{icon:K}),onClick:()=>{r(e),i({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:h[0]}]})},children:(0,c.jsx)(es.ItemLabel,{children:(0,d.__)("Add filter")})})}),(o||v)&&_&&(0,c.jsxs)(es.Group,{children:[o&&(0,c.jsx)(es.Item,{prefix:(0,c.jsx)(l.Icon,{icon:Zi}),disabled:p<1,onClick:()=>{var n;i({...t,fields:[...null!==(n=m.slice(0,p-1))&&void 0!==n?n:[],e,m[p-1],...m.slice(p+1)]})},children:(0,c.jsx)(es.ItemLabel,{children:(0,d.__)("Move left")})}),o&&(0,c.jsx)(es.Item,{prefix:(0,c.jsx)(l.Icon,{icon:Ji}),disabled:p>=m.length-1,onClick:()=>{var n;i({...t,fields:[...null!==(n=m.slice(0,p))&&void 0!==n?n:[],m[p+1],e,...m.slice(p+2)]})},children:(0,c.jsx)(es.ItemLabel,{children:(0,d.__)("Move right")})}),v&&_&&(0,c.jsx)(es.Item,{prefix:(0,c.jsx)(l.Icon,{icon:Qi}),onClick:()=>{s(_),i({...t,fields:m.filter(t=>t!==e)})},children:(0,c.jsx)(es.ItemLabel,{children:(0,d.__)("Hide column")})})]})]})})]})});function is({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 ss=function({item:e,level:t,titleField:n,mediaField:i,descriptionField:s,onClickItem:r,isItemClickable:o}){const a=is({item:e,isItemClickable:o,onClickItem:r,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field"});return(0,c.jsxs)(l.__experimentalHStack,{spacing:3,justify:"flex-start",children:[i&&(0,c.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",children:(0,c.jsx)(i.render,{item:e})}),(0,c.jsxs)(l.__experimentalVStack,{spacing:0,children:[n&&(0,c.jsxs)("div",{...a,children:[void 0!==t&&(0,c.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,c.jsx)(n.render,{item:e})]}),s&&(0,c.jsx)(s.render,{item:e})]})]})};function rs({item:e,fields:t,column:n}){const i=t.find(e=>e.id===n);return i?(0,c.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,c.jsx)(i.render,{item:e})}):null}function os({hasBulkActions:e,item:t,level:n,actions:s,fields:r,id:o,view:l,titleField:a,mediaField:u,descriptionField:d,selection:m,getItemId:p,isItemClickable:f,onClickItem:v,onChangeSelection:g}){var b;const h=zi(s,t),_=h&&m.includes(o),[w,x]=(0,i.useState)(!1),{showTitle:y=!0,showMedia:j=!0,showDescription:S=!0}=l,C=(0,i.useRef)(!1),I=null!==(b=l.fields)&&void 0!==b?b:[],E=a&&y||u&&j||d&&S;return(0,c.jsxs)("tr",{className:q("dataviews-view-table__row",{"is-selected":h&&_,"is-hovered":w,"has-bulk-actions":h}),onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},onTouchStart:()=>{C.current=!0},onClick:()=>{h&&(C.current||"Range"===document.getSelection()?.type||g(m.includes(o)?m.filter(e=>o!==e):[o]))},children:[e&&(0,c.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,c.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,c.jsx)(Ni,{item:t,selection:m,onChangeSelection:g,getItemId:p,titleField:a,disabled:!h})})}),E&&(0,c.jsx)("td",{children:(0,c.jsx)(ss,{item:t,level:n,titleField:y?a:void 0,mediaField:j?u:void 0,descriptionField:S?d:void 0,isItemClickable:f,onClickItem:v})}),I.map(e=>{var n;const{width:i,maxWidth:s,minWidth:o}=null!==(n=l.layout?.styles?.[e])&&void 0!==n?n:{};return(0,c.jsx)("td",{style:{width:i,maxWidth:s,minWidth:o},children:(0,c.jsx)(rs,{fields:r,item:t,column:e})},e)}),!!s?.length&&(0,c.jsx)("td",{className:"dataviews-view-table__actions-column",onClick:e=>e.stopPropagation(),children:(0,c.jsx)(Bi,{item:t,actions:s})})]})}const ls={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}},as={xhuge:1520,huge:1140,xlarge:780,large:480,mobile:0};function cs(){const e=(0,i.useContext)(U).containerWidth;for(const[t,n]of Object.entries(as))if(e>=n)return t;return"mobile"}const{Badge:us}=gi(l.privateApis);function ds({view:e,selection:t,onChangeSelection:n,onClickItem:i,isItemClickable:s,getItemId:r,item:o,actions:a,mediaField:u,titleField:m,descriptionField:p,regularFields:f,badgeFields:v,hasBulkActions:g}){const{showTitle:b=!0,showMedia:h=!0,showDescription:_=!0}=e,w=zi(a,o),x=r(o),y=(0,E.useInstanceId)(ds),j=t.includes(x),S=u?.render?(0,c.jsx)(u.render,{item:o}):null,C=b&&m?.render?(0,c.jsx)(m.render,{item:o}):null,I=is({item:o,isItemClickable:s,onClickItem:i,className:"dataviews-view-grid__media"}),k=is({item:o,isItemClickable:s,onClickItem:i,className:"dataviews-view-grid__title-field dataviews-title-field"});let P,N;return s(o)&&i&&(C?(P={"aria-labelledby":`dataviews-view-grid__title-field-${y}`},N={id:`dataviews-view-grid__title-field-${y}`}):P={"aria-label":(0,d.__)("Navigate to item")}),(0,c.jsxs)(l.__experimentalVStack,{spacing:0,className:q("dataviews-view-grid__card",{"is-selected":w&&j}),onClickCapture:e=>{if(e.ctrlKey||e.metaKey){if(e.stopPropagation(),e.preventDefault(),!w)return;n(t.includes(x)?t.filter(e=>x!==e):[...t,x])}},children:[h&&S&&(0,c.jsx)("div",{...I,...P,children:S}),g&&h&&S&&(0,c.jsx)(Ni,{item:o,selection:t,onChangeSelection:n,getItemId:r,titleField:m,disabled:!w}),(0,c.jsxs)(l.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,c.jsx)("div",{...k,...N,children:C}),!!a?.length&&(0,c.jsx)(Bi,{item:o,actions:a,isCompact:!0})]}),(0,c.jsxs)(l.__experimentalVStack,{spacing:1,children:[_&&p?.render&&(0,c.jsx)(p.render,{item:o}),!!v?.length&&(0,c.jsx)(l.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:v.map(e=>(0,c.jsx)(us,{className:"dataviews-view-grid__field-value",children:(0,c.jsx)(e.render,{item:o})},e.id))}),!!f?.length&&(0,c.jsx)(l.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:f.map(e=>(0,c.jsx)(l.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header}),(0,c.jsx)(l.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,c.jsx)(e.render,{item:o})})]})},e.id))})]})]},x)}const{Menu:ms}=gi(l.privateApis);function ps(e){return`${e}-item-wrapper`}function fs(e){return`${e}-dropdown`}function vs({idPrefix:e,primaryAction:t,item:n}){const s=(0,x.useRegistry)(),[r,o]=(0,i.useState)(!1),a=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,c.jsx)("div",{role:"gridcell",children:(0,c.jsx)(l.Composite.Item,{id:a,render:(0,c.jsx)(l.Button,{label:u,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>o(!0)}),children:r&&(0,c.jsx)(Di,{action:t,items:[n],closeModal:()=>o(!1)})})},t.id):(0,c.jsx)("div",{role:"gridcell",children:(0,c.jsx)(l.Composite.Item,{id:a,render:(0,c.jsx)(l.Button,{label:u,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>{t.callback([n],{registry:s})}})})},t.id)}function gs({view:e,actions:t,idPrefix:n,isSelected:s,item:r,titleField:o,mediaField:a,descriptionField:u,onSelect:m,otherFields:p,onDropdownTriggerKeyDown:f}){const{showTitle:v=!0,showMedia:g=!0,showDescription:b=!0}=e,h=(0,i.useRef)(null),_=`${n}-label`,w=`${n}-description`,y=(0,x.useRegistry)(),[j,S]=(0,i.useState)(!1),[C,I]=(0,i.useState)(null),E=({type:e})=>{S("mouseenter"===e)};(0,i.useEffect)(()=>{s&&h.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})},[s]);const{primaryAction:k,eligibleActions:P}=(0,i.useMemo)(()=>{const e=t.filter(e=>!e.isEligible||e.isEligible(r));return{primaryAction:e.filter(e=>e.isPrimary&&!!e.icon)[0],eligibleActions:e}},[t,r]),N=k&&1===t.length,V=g&&a?.render?(0,c.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,c.jsx)(a.render,{item:r})}):null,M=v&&o?.render?(0,c.jsx)(o.render,{item:r}):null,F=P?.length>0&&(0,c.jsxs)(l.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[k&&(0,c.jsx)(vs,{idPrefix:n,primaryAction:k,item:r}),!N&&(0,c.jsxs)("div",{role:"gridcell",children:[(0,c.jsxs)(ms,{placement:"bottom-end",children:[(0,c.jsx)(ms.TriggerButton,{render:(0,c.jsx)(l.Composite.Item,{id:fs(n),render:(0,c.jsx)(l.Button,{size:"small",icon:Vi,label:(0,d.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:f})})}),(0,c.jsx)(ms.Popover,{children:(0,c.jsx)(Ti,{actions:P,item:r,registry:y,setActiveModalAction:I})})]}),!!C&&(0,c.jsx)(Di,{action:C,items:[r],closeModal:()=>I(null)})]})]});return(0,c.jsx)(l.Composite.Row,{ref:h,render:(0,c.jsx)("div",{}),role:"row",className:q({"is-selected":s,"is-hovered":j}),onMouseEnter:E,onMouseLeave:E,children:(0,c.jsxs)(l.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,c.jsx)("div",{role:"gridcell",children:(0,c.jsx)(l.Composite.Item,{id:ps(n),"aria-pressed":s,"aria-labelledby":_,"aria-describedby":w,className:"dataviews-view-list__item",onClick:()=>m(r)})}),(0,c.jsxs)(l.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[V,(0,c.jsxs)(l.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,c.jsxs)(l.__experimentalHStack,{spacing:0,children:[(0,c.jsx)("div",{className:"dataviews-title-field",id:_,children:M}),F]}),b&&u?.render&&(0,c.jsx)("div",{className:"dataviews-view-list__field",children:(0,c.jsx)(u.render,{item:r})}),(0,c.jsx)("div",{className:"dataviews-view-list__fields",id:w,children:p.map(e=>(0,c.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,c.jsx)(l.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,c.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,c.jsx)(e.render,{item:r})})]},e.id))})]})]})]})})}function bs(e){return!!e}const hs=[{type:W,label:(0,d.__)("Table"),component:function({actions:e,data:t,fields:n,getItemId:s,getItemLevel:r,isLoading:o=!1,onChangeView:a,onChangeSelection:u,selection:m,setOpenedFilter:p,onClickItem:f,isItemClickable:v,view:g}){var b;const h=(0,i.useRef)(new Map),_=(0,i.useRef)(),[w,x]=(0,i.useState)(),y=Wi(e,t);(0,i.useEffect)(()=>{_.current&&(_.current.focus(),_.current=void 0)});const j=(0,i.useId)();if(w)return _.current=w,void x(void 0);const S=e=>{const t=h.current.get(e.id),n=t?h.current.get(t.fallback):void 0;x(n?.node)},C=!!t?.length,I=n.find(e=>e.id===g.titleField),E=n.find(e=>e.id===g.mediaField),k=n.find(e=>e.id===g.descriptionField),{showTitle:P=!0,showMedia:N=!0,showDescription:V=!0}=g,M=I&&P||E&&N||k&&V,F=null!==(b=g.fields)&&void 0!==b?b:[],O=(e,t)=>n=>{n?h.current.set(e,{node:n,fallback:F[t>0?t-1:1]}):h.current.delete(e)};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("table",{className:q("dataviews-view-table",{[`has-${g.layout?.density}-density`]:g.layout?.density&&["compact","comfortable"].includes(g.layout.density)}),"aria-busy":o,"aria-describedby":j,children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{className:"dataviews-view-table__row",children:[y&&(0,c.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,c.jsx)($i,{selection:m,onChangeSelection:u,data:t,actions:e,getItemId:s})}),M&&(0,c.jsx)("th",{scope:"col",children:I&&(0,c.jsx)(ns,{ref:O(I.id,0),fieldId:I.id,view:g,fields:n,onChangeView:a,onHide:S,setOpenedFilter:p,canMove:!1})}),F.map((e,t)=>{var i;const{width:s,maxWidth:r,minWidth:o}=null!==(i=g.layout?.styles?.[e])&&void 0!==i?i:{};return(0,c.jsx)("th",{style:{width:s,maxWidth:r,minWidth:o},"aria-sort":g.sort?.direction&&g.sort?.field===e?R[g.sort.direction]:void 0,scope:"col",children:(0,c.jsx)(ns,{ref:O(e,t),fieldId:e,view:g,fields:n,onChangeView:a,onHide:S,setOpenedFilter:p})},e)}),!!e?.length&&(0,c.jsx)("th",{className:"dataviews-view-table__actions-column",children:(0,c.jsx)("span",{className:"dataviews-view-table-header",children:(0,d.__)("Actions")})})]})}),(0,c.jsx)("tbody",{children:C&&t.map((t,i)=>(0,c.jsx)(os,{item:t,level:g.showLevels&&"function"==typeof r?r(t):void 0,hasBulkActions:y,actions:e,fields:n,id:s(t)||i.toString(),view:g,titleField:I,mediaField:E,descriptionField:k,selection:m,getItemId:s,onChangeSelection:u,onClickItem:f,isItemClickable:v},s(t)))})]}),(0,c.jsx)("div",{className:q({"dataviews-loading":o,"dataviews-no-results":!C&&!o}),id:j,children:!C&&(0,c.jsx)("p",{children:o?(0,c.jsx)(l.Spinner,{}):(0,d.__)("No results")})})]})},icon:Ii,viewConfigOptions:function(){const e=(0,i.useContext)(U),t=e.view;return(0,c.jsxs)(l.__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,c.jsx)(l.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,d._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,c.jsx)(l.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,d._x)("Balanced","Density option for DataView layout")},"balanced"),(0,c.jsx)(l.__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:s,isLoading:r,onChangeSelection:o,onClickItem:a,isItemClickable:u,selection:m,view:p}){var f;const v=n.find(e=>e.id===p?.titleField),g=n.find(e=>e.id===p?.mediaField),b=n.find(e=>e.id===p?.descriptionField),h=null!==(f=p.fields)&&void 0!==f?f:[],{regularFields:_,badgeFields:w}=h.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,i.useContext)(U).view,t=cs();return(0,i.useMemo)(()=>{const n=e.layout?.previewSize;let i;if(!n)return;const s=ls[t];return n<s.min&&(i=s.min),n>s.max&&(i=s.max),i},[t,e])}(),j=Wi(e,t),S=y||p.layout?.previewSize,C=S?{gridTemplateColumns:`repeat(${S}, minmax(0, 1fr))`}:{};return(0,c.jsxs)(c.Fragment,{children:[x&&(0,c.jsx)(l.__experimentalGrid,{gap:8,columns:2,alignment:"top",className:"dataviews-view-grid",style:C,"aria-busy":r,children:t.map(t=>(0,c.jsx)(ds,{view:p,selection:m,onChangeSelection:o,onClickItem:a,isItemClickable:u,getItemId:s,item:t,actions:e,mediaField:g,titleField:v,descriptionField:b,regularFields:_,badgeFields:w,hasBulkActions:j},s(t)))}),!x&&(0,c.jsx)("div",{className:q({"dataviews-loading":r,"dataviews-no-results":!r}),children:(0,c.jsx)("p",{children:r?(0,c.jsx)(l.Spinner,{}):(0,d.__)("No results")})})]})},icon:Ei,viewConfigOptions:function(){const e=cs(),t=(0,i.useContext)(U),n=t.view,s=ls[e],r=n.layout?.previewSize||s.default,o=(0,i.useMemo)(()=>Array.from({length:s.max-s.min+1},(e,t)=>({value:s.min+t})),[s]);return"mobile"===e?null:(0,c.jsx)(l.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,d.__)("Preview size"),value:s.max+s.min-r,marks:o,min:s.min,max:s.max,withInputField:!1,onChange:(e=0)=>{t.onChangeView({...n,layout:{...n.layout,previewSize:s.max+s.min-e}})},step:1})}},{type:"list",label:(0,d.__)("List"),component:function e(t){var n;const{actions:s,data:r,fields:o,getItemId:a,isLoading:u,onChangeSelection:m,selection:p,view:f}=t,v=(0,E.useInstanceId)(e,"view-list"),g=r?.findLast(e=>p.includes(a(e))),b=o.find(e=>e.id===f.titleField),h=o.find(e=>e.id===f.mediaField),_=o.find(e=>e.id===f.descriptionField),w=(null!==(n=f?.fields)&&void 0!==n?n:[]).map(e=>o.find(t=>e===t.id)).filter(bs),x=e=>m([a(e)]),y=(0,i.useCallback)(e=>`${v}-${a(e)}`,[v,a]),j=(0,i.useCallback)((e,t)=>t.startsWith(y(e)),[y]),[S,C]=(0,i.useState)(void 0);(0,i.useEffect)(()=>{g&&C(ps(y(g)))},[g,y]);const I=r.findIndex(e=>j(e,null!=S?S:"")),k=(0,E.usePrevious)(I),P=-1!==I,N=(0,i.useCallback)((e,t)=>{const n=Math.min(r.length-1,Math.max(0,e));if(!r[n])return;const i=t(y(r[n]));C(i),document.getElementById(i)?.focus()},[r,y]);(0,i.useEffect)(()=>{!P&&void 0!==k&&-1!==k&&N(k,ps)},[P,N,k]);const V=(0,i.useCallback)(e=>{"ArrowDown"===e.key&&(e.preventDefault(),N(I+1,fs)),"ArrowUp"===e.key&&(e.preventDefault(),N(I-1,fs))},[N,I]),M=r?.length;return M?(0,c.jsx)(l.Composite,{id:v,render:(0,c.jsx)("div",{}),className:"dataviews-view-list",role:"grid",activeId:S,setActiveId:C,children:r.map(e=>{const t=y(e);return(0,c.jsx)(gs,{view:f,idPrefix:t,actions:s,item:e,isSelected:e===g,onSelect:x,mediaField:h,titleField:b,descriptionField:_,otherFields:w,onDropdownTriggerKeyDown:V},t)})}):(0,c.jsx)("div",{className:q({"dataviews-loading":u,"dataviews-no-results":!M&&!u}),children:!M&&(0,c.jsx)("p",{children:u?(0,c.jsx)(l.Spinner,{}):(0,d.__)("No results")})})},icon:(0,d.isRTL)()?ki:Pi}];function _s(){const{actions:e=[],data:t,fields:n,getItemId:s,getItemLevel:r,isLoading:o,view:l,onChangeView:a,selection:u,onChangeSelection:d,setOpenedFilter:m,onClickItem:p,isItemClickable:f}=(0,i.useContext)(U),v=hs.find(e=>e.type===l.type)?.component;return(0,c.jsx)(v,{actions:e,data:t,fields:n,getItemId:s,getItemLevel:r,isLoading:o,onChangeView:a,onChangeSelection:d,selection:u,setOpenedFilter:m,onClickItem:p,isItemClickable:f,view:l})}const ws=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),xs=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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"})}),ys=(0,i.memo)(function(){var e;const{view:t,onChangeView:n,paginationInfo:{totalItems:s=0,totalPages:r}}=(0,i.useContext)(U);if(!s||!r)return null;const o=null!==(e=t.page)&&void 0!==e?e:1,a=Array.from(Array(r)).map((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":o===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"),o,r):n.toString()}});return!!s&&1!==r&&(0,c.jsxs)(l.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,c.jsx)(l.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,i.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 />",r),{div:(0,c.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,c.jsx)(l.SelectControl,{"aria-label":(0,d.__)("Current page"),value:o.toString(),options:a,onChange:e=>{n({...t,page:+e})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,c.jsxs)(l.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,c.jsx)(l.Button,{onClick:()=>n({...t,page:o-1}),disabled:1===o,accessibleWhenDisabled:!0,label:(0,d.__)("Previous page"),icon:(0,d.isRTL)()?ws:xs,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,c.jsx)(l.Button,{onClick:()=>n({...t,page:o+1}),disabled:o>=r,accessibleWhenDisabled:!0,label:(0,d.__)("Next page"),icon:(0,d.isRTL)()?xs:ws,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})}),js=[];function Ss(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:s,actions:r=js}=(0,i.useContext)(U),o=Wi(r,s)&&[W,$].includes(e.type);return!t||!n||n<=1&&!o?null:!!t&&(0,c.jsxs)(l.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[o&&(0,c.jsx)(Xi,{}),(0,c.jsx)(ys,{})]})}const Cs=(0,i.memo)(function({label:e}){const{view:t,onChangeView:n}=(0,i.useContext)(U),[s,r,o]=(0,E.useDebouncedInput)(t.search);(0,i.useEffect)(()=>{var e;r(null!==(e=t.search)&&void 0!==e?e:"")},[t.search,r]);const a=(0,i.useRef)(n),u=(0,i.useRef)(t);(0,i.useEffect)(()=>{a.current=n,u.current=t},[n,t]),(0,i.useEffect)(()=>{o!==u.current?.search&&a.current({...u.current,page:1,search:o})},[o]);const m=e||(0,d.__)("Search");return(0,c.jsx)(l.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:r,value:s,label:m,placeholder:m,size:"compact"})}),Is=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.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"})}),Es=(0,c.jsx)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.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"})}),ks=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.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:Ps}=(window.wp.warning,gi(l.privateApis)),Ns={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function Vs({defaultLayouts:e={list:{},grid:{},table:{}}}){const{view:t,onChangeView:n}=(0,i.useContext)(U),s=Object.keys(e);if(s.length<=1)return null;const r=hs.find(e=>t.type===e.type);return(0,c.jsxs)(Ps,{children:[(0,c.jsx)(Ps.TriggerButton,{render:(0,c.jsx)(l.Button,{size:"compact",icon:r?.icon,label:(0,d.__)("Layout")})}),(0,c.jsx)(Ps.Popover,{children:s.map(i=>{const s=hs.find(e=>e.type===i);return s?(0,c.jsx)(Ps.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 s={...t};return"layout"in s&&delete s.layout,n({...s,type:i.target.value,...e[i.target.value]})}},children:(0,c.jsx)(Ps.ItemLabel,{children:s.label})},i):null})})]})}function Ms(){const{view:e,fields:t,onChangeView:n}=(0,i.useContext)(U),s=(0,i.useMemo)(()=>t.filter(e=>!1!==e.enableSorting).map(e=>({label:e.label,value:e.id})),[t]);return(0,c.jsx)(l.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.__)("Sort by"),value:e.sort?.field,options:s,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function Fs(){const{view:e,fields:t,onChangeView:n}=(0,i.useContext)(U);if(0===t.filter(e=>!1!==e.enableSorting).length)return null;let s=e.sort?.direction;return!s&&e.sort?.field&&(s="desc"),(0,c.jsx)(l.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,d.__)("Order"),value:s,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:B.map(e=>(0,c.jsx)(l.__experimentalToggleGroupControlOptionIcon,{value:e,icon:z[e],label:H[e]},e))})}const Os=[10,20,50,100];function As(){const{view:e,onChangeView:t}=(0,i.useContext)(U);return(0,c.jsx)(l.__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:Os.map(e=>(0,c.jsx)(l.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e))})}function Ds({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:i}){return(0,c.jsxs)(Ps,{onOpenChange:n,children:[(0,c.jsx)(Ps.TriggerButton,{render:(0,c.jsx)(l.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:Vi,label:(0,d.__)("Preview")})}),(0,c.jsx)(Ps.Popover,{children:e?.map(({id:e,label:n})=>(0,c.jsx)(Ps.RadioItem,{value:e,checked:e===i,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,c.jsx)(Ps.ItemLabel,{children:n})},e))})]})}function Ts({field:e,label:t,description:n,isVisible:s,isFirst:r,isLast:o,canMove:a=!0,onToggleVisibility:u,onMoveUp:m,onMoveDown:p,previewOptions:f,onChangePreviewOption:v}){const[g,b]=(0,i.useState)(!1);return(0,c.jsx)(l.__experimentalItem,{children:(0,c.jsxs)(l.__experimentalHStack,{expanded:!0,className:q("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":g}),justify:"flex-start",children:[(0,c.jsx)("span",{className:"dataviews-field-control__icon",children:!a&&!e.enableHiding&&(0,c.jsx)(l.Icon,{icon:Is})}),(0,c.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,c.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,c.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,c.jsxs)(l.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[s&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Button,{disabled:r||!a,accessibleWhenDisabled:!0,size:"compact",onClick:m,icon:S,label:r||!a?(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,c.jsx)(l.Button,{disabled:o||!a,accessibleWhenDisabled:!0,size:"compact",onClick:p,icon:C,label:o||!a?(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,c.jsx)(l.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:s?Qi:Es,label:s?(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,c.jsx)(Ds,{previewOptions:f,onChangePreviewOption:v,onMenuOpenChange:b,activeOption:e.id})]})]})})}function Bs({index:e,field:t,view:n,onChangeView:i}){var s;const r=null!==(s=n.fields)&&void 0!==s?s:[],o=void 0!==e&&r.includes(t.id);return(0,c.jsx)(Ts,{field:t,isVisible:o,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===r.length-1,onToggleVisibility:()=>{i({...n,fields:o?r.filter(e=>e!==t.id):[...r,t.id]})},onMoveUp:void 0!==e?()=>{var s;i({...n,fields:[...null!==(s=r.slice(0,e-1))&&void 0!==s?s:[],t.id,r[e-1],...r.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{var s;i({...n,fields:[...null!==(s=r.slice(0,e))&&void 0!==s?s:[],r[e+1],t.id,...r.slice(e+2)]})}:void 0})}function Ls(e){return!!e}function Rs(){var e;const{view:t,fields:n,onChangeView:s}=(0,i.useContext)(U),r=[t?.titleField,t?.mediaField,t?.descriptionField].filter(Boolean),o=null!==(e=t.fields)&&void 0!==e?e:[],a=n.filter(e=>!o.includes(e.id)&&!r.includes(e.id)&&"media"!==e.type),u=o.map(e=>n.find(t=>t.id===e)).filter(Ls);if(!u?.length&&!a?.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 g;if(v.length>1){var b;const e=Ls(p)&&(null===(b=t.showMedia)||void 0===b||b);g=Ls(p)&&(0,c.jsx)(Ts,{field:p,label:(0,d.__)("Preview"),description:p.label,isVisible:e,onToggleVisibility:()=>{s({...t,showMedia:!e})},canMove:!1,previewOptions:v.map(e=>({label:e.label,id:e.id})),onChangePreviewOption:e=>s({...t,mediaField:e})},p.id)}const h=[{field:m,isVisibleFlag:"showTitle"},{field:p,isVisibleFlag:"showMedia",ui:g},{field:f,isVisibleFlag:"showDescription"}].filter(({field:e})=>Ls(e)),_=h.filter(({field:e,isVisibleFlag:n})=>{var i;return Ls(e)&&(null===(i=t[n])||void 0===i||i)}),w=h.filter(({field:e,isVisibleFlag:n})=>{var i;return Ls(e)&&!(null===(i=t[n])||void 0===i||i)});return(0,c.jsxs)(l.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,c.jsx)(l.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(_.length>0||!!u?.length)&&(0,c.jsxs)(l.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[_.map(({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,c.jsx)(Ts,{field:e,isVisible:!0,onToggleVisibility:()=>{s({...t,[n]:!1})},canMove:!1},e.id)),u.map((e,n)=>(0,c.jsx)(Bs,{field:e,view:t,onChangeView:s,index:n},e.id))]})}),(!!a?.length||!!w.length)&&(0,c.jsxs)(l.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(l.BaseControl.VisualLabel,{style:{margin:0},children:(0,d.__)("Hidden")}),(0,c.jsx)(l.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,c.jsxs)(l.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[w.length>0&&w.map(({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,c.jsx)(Ts,{field:e,isVisible:!1,onToggleVisibility:()=>{s({...t,[n]:!0})},canMove:!1},e.id)),a.map(e=>(0,c.jsx)(Bs,{field:e,view:t,onChangeView:s},e.id))]})})]})]})}function Hs({title:e,description:t,children:n}){return(0,c.jsxs)(l.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,c.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,c.jsx)(l.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,c.jsx)(l.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,c.jsx)(l.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function zs(){const{view:e}=(0,i.useContext)(U),t=(0,E.useInstanceId)(Ws,"dataviews-view-config-dropdown"),n=hs.find(t=>t.type===e.type);return(0,c.jsx)(l.Dropdown,{expandOnMobile:!0,popoverProps:{...Ns,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,c.jsx)(l.Button,{size:"compact",icon:ks,label:(0,d._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,c.jsx)(l.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,c.jsxs)(l.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,c.jsxs)(Hs,{title:(0,d.__)("Appearance"),children:[(0,c.jsxs)(l.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,c.jsx)(Ms,{}),(0,c.jsx)(Fs,{})]}),!!n?.viewConfigOptions&&(0,c.jsx)(n.viewConfigOptions,{}),(0,c.jsx)(As,{})]}),(0,c.jsx)(Hs,{title:(0,d.__)("Properties"),children:(0,c.jsx)(Rs,{})})]})})})}function Ws({defaultLayouts:e={list:{},grid:{},table:{}}}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Vs,{defaultLayouts:e}),(0,c.jsx)(zs,{})]})}const $s=(0,i.memo)(Ws),Us={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"},Ks={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"},Gs={sort:function(e,t,n){const i=new Date(e).getTime(),s=new Date(t).getTime();return"asc"===n?i-s:s-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"},qs={datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:r,label:o}=t,a=t.getValue({item:e}),u=(0,i.useCallback)(e=>n({[r]:e}),[r,n]);return(0,c.jsxs)("fieldset",{className:"dataviews-controls__datetime",children:[!s&&(0,c.jsx)(l.BaseControl.VisualLabel,{as:"legend",children:o}),s&&(0,c.jsx)(l.VisuallyHidden,{as:"legend",children:o}),(0,c.jsx)(l.TimePicker,{currentTime:a,onChange:u,hideLabelFromVision:!0})]})},integer:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var r;const{id:o,label:a,description:u}=t,d=null!==(r=t.getValue({item:e}))&&void 0!==r?r:"",m=(0,i.useCallback)(e=>n({[o]:Number(e)}),[o,n]);return(0,c.jsx)(l.__experimentalNumberControl,{label:a,help:u,value:d,onChange:m,__next40pxDefaultSize:!0,hideLabelFromVision:s})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:r,label:o}=t,a=t.getValue({item:e}),u=(0,i.useCallback)(e=>n({[r]:e}),[r,n]);return t.elements?(0,c.jsx)(l.RadioControl,{label:o,onChange:u,options:t.elements,selected:a,hideLabelFromVision:s}):null},select:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var r,o;const{id:a,label:u}=t,m=null!==(r=t.getValue({item:e}))&&void 0!==r?r:"",p=(0,i.useCallback)(e=>n({[a]:e}),[a,n]),f=[{label:(0,d.__)("Select item"),value:""},...null!==(o=t?.elements)&&void 0!==o?o:[]];return(0,c.jsx)(l.SelectControl,{label:u,value:m,options:f,onChange:p,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:r,label:o,placeholder:a}=t,u=t.getValue({item:e}),d=(0,i.useCallback)(e=>n({[r]:e}),[r,n]);return(0,c.jsx)(l.TextControl,{label:o,placeholder:a,value:null!=u?u:"",onChange:d,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})}};function Ys(e){if(Object.keys(qs).includes(e))return qs[e];throw"Control "+e+" not found"}const Xs=e=>e.id,Zs=()=>!0,Js=[];function Qs({view:e,onChangeView:t,fields:n,search:s=!0,searchLabel:r,actions:o=Js,data:a,getItemId:u=Xs,getItemLevel:d,isLoading:m=!1,paginationInfo:p,defaultLayouts:f,selection:v,onChangeSelection:g,onClickItem:b,isItemClickable:h=Zs,header:_}){const[w,x]=(0,i.useState)(0),y=(0,E.useResizeObserver)(e=>{x(e[0].borderBoxSize[0].inlineSize)},{box:"border-box"}),[j,S]=(0,i.useState)([]),C=void 0===v||void 0===g,I=C?j:v,[k,P]=(0,i.useState)(null),N=(0,i.useMemo)(()=>function(e){return e.map(e=>{var t,n,i,s;const r="integer"===(o=e.type)?Us:"text"===o?Ks:"datetime"===o?Gs:{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 r.sort(l({item:e}),l({item:t}),n)},u=null!==(n=e.isValid)&&void 0!==n?n:function(e,t){return r.isValid(l({item:e}),t)},d=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?Ys(e.Edit):e.elements?Ys("select"):"string"==typeof t.Edit?Ys(t.Edit):t.Edit}(e,r),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===(s=e.enableSorting)||void 0===s||s}})}(n),[n]),V=(0,i.useMemo)(()=>I.filter(e=>a.some(t=>u(t)===e)),[I,a,u]),M=yi(N,e),[F,O]=(0,i.useState)(()=>(M||[]).some(e=>e.isPrimary));return(0,c.jsx)(U.Provider,{value:{view:e,onChangeView:t,fields:N,actions:o,data:a,isLoading:m,paginationInfo:p,selection:V,onChangeSelection:function(e){const t="function"==typeof e?e(I):e;C&&S(t),g&&g(t)},openedFilter:k,setOpenedFilter:P,getItemId:u,getItemLevel:d,isItemClickable:h,onClickItem:b,containerWidth:w},children:(0,c.jsxs)("div",{className:"dataviews-wrapper",ref:y,children:[(0,c.jsxs)(l.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,c.jsxs)(l.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[s&&(0,c.jsx)(Cs,{label:r}),(0,c.jsx)(ji,{filters:M,view:e,onChangeView:t,setOpenedFilter:P,setIsShowingFilter:O,isShowingFilter:F})]}),(0,c.jsxs)(l.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,c.jsx)($s,{defaultLayouts:f}),_]})]}),F&&(0,c.jsx)(Ci,{}),(0,c.jsx)(_s,{}),(0,c.jsx)(Ss,{})]})})}const er=window.wc.wcSettings;function tr(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 nr(){const e=(0,er.getSetting)("currency",{});return{symbol:e.symbol||"$",precision:void 0!==e.precision?e.precision:2,decimalSeparator:e.decimalSeparator||"."}}function ir(e,t=!1){const{symbol:n,precision:i,decimalSeparator:s}=nr();return t?i>0?`0${s}${"0".repeat(i)}`:"0":e&&0!==e?`${n}${parseFloat(e).toFixed(i)}`:"—"}function sr(e,t){const n=parseInt(e||0,10);return n<=0?"—":tr(n,t||"day")}function rr(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?ir(t):"—"}const n=parseFloat(e.subscription_regular_price||0),i=parseFloat(e.subscription_sale_price||0);return n>0&&i>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("del",{children:ir(n)})," ",ir(i)]}):i>0?ir(i):n>0?ir(n):"—"}function or(e,t=1){const n=parseInt(e||0,10),i=parseInt(t,10)||1;if(!n||0===n)return"—";const s=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",s,"woocommerce-subscriptions"),s)}const lr={table:{}},ar=["frequency","discount","expires","signup_fee","trial"];function cr({plans:e,isProductMode:t,onAddPlan:n,onEditPlan:s,onDeletePlan:r,onReorderPlans:o}){const{labels:a}=w(),[u,m]=(0,i.useState)(null),[p,f]=(0,i.useState)(null!=e?e:[]),v=(0,i.useRef)(null),g=(0,i.useRef)(u),b=(0,i.useRef)(p),h=(0,i.useRef)(e),_=(0,i.useRef)(o);(0,i.useEffect)(()=>{f(null!=e?e:[]),h.current=null!=e?e:[]},[e]),(0,i.useEffect)(()=>{g.current=u},[u]),(0,i.useEffect)(()=>{b.current=p},[p]),(0,i.useEffect)(()=>{_.current=o},[o]);const[x,y]=(0,i.useState)({type:"table",perPage:100,page:1,search:"",filters:[],fields:ar,titleField:"drag",layout:{}}),E=(0,i.useMemo)(()=>[{id:"drag",label:(0,d.__)("Reorder","woocommerce-subscriptions"),header:"",enableSorting:!1,enableHiding:!1,render:()=>(0,c.jsx)("span",{className:"wcsatt-column__drag-handle",role:"img","aria-label":(0,d.__)("Drag to reorder","woocommerce-subscriptions"),children:(0,c.jsx)(l.Icon,{icon:j})})},{id:"frequency",label:(0,d.__)("Frequency","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>tr(e.subscription_period_interval,e.subscription_period)},{id:"discount",label:(0,d.__)("Discount","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>rr(e)},{id:"expires",label:(0,d.__)("Expiration","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>or(e.subscription_length,e.subscription_period_interval)},{id:"signup_fee",label:(0,d.__)("Signup fee","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>ir(e.subscription_signup_fee)},{id:"trial",label:(0,d.__)("Free trial","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>sr(e.subscription_trial_length,e.subscription_trial_period)}],[]),k=(0,i.useCallback)((e,t)=>{const n=b.current,i=n.findIndex(t=>t.id===e.id),s="up"===t?i-1:i+1;if(-1===i||s<0||s>=n.length)return;const r=[...n],[l]=r.splice(i,1);r.splice(s,0,l),f(r),o(r)},[o]),P=(0,i.useMemo)(()=>[{id:"edit",label:(0,d.__)("Edit","woocommerce-subscriptions"),supportsBulk:!1,callback:e=>s(e[0])},{id:"move-up",label:(0,d.__)("Move up","woocommerce-subscriptions"),icon:S,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:C,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,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{children:(0,d.__)("Are you sure you want to delete this subscription plan?","woocommerce-subscriptions")}),(0,c.jsxs)("div",{className:"wcsatt-delete-confirm-modal__actions",children:[(0,c.jsx)(l.Button,{variant:"tertiary",onClick:t,children:(0,d.__)("Cancel","woocommerce-subscriptions")}),(0,c.jsx)(l.Button,{variant:"primary",isDestructive:!0,onClick:()=>{r(e[0].id),t()},children:(0,d.__)("Delete","woocommerce-subscriptions")})]})]})}],[s,r,k,p]),N=(0,i.useCallback)(e=>String(e.id),[]),V=(0,i.useMemo)(()=>({totalItems:p.length,totalPages:1}),[p.length]);return(0,i.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=g.current;if(null===n||n===t)return;const i=[...b.current],[s]=i.splice(n,1);i.splice(t,0,s),f(i),m(t)},s=async()=>{const e=b.current,t=h.current,n=e.some((e,n)=>e.id!==t[n]?.id);null!==g.current&&n&&await _.current(e),m(null)},r=[];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",s),r.push(()=>{e.removeEventListener("dragstart",n),e.removeEventListener("dragover",i),e.removeEventListener("dragend",s)})}),()=>r.forEach(e=>e())},[p,u]),p&&p.length>0?(0,c.jsxs)("div",{className:"wcsatt-plans-table-wrapper",ref:v,children:[(0,c.jsx)(Qs,{data:p,fields:E,view:x,onChangeView:y,actions:P,getItemId:N,paginationInfo:V,defaultLayouts:lr,search:!1}),(0,c.jsx)("div",{className:"wcsatt-plans-table-footer "+(t?"is-product-mode":""),children:(0,c.jsx)(l.Button,{variant:"secondary",icon:I,onClick:n,children:a.addButtonText})})]}):(0,c.jsxs)("div",{className:"wcsatt-plans-table-wrapper",children:[(0,c.jsx)("div",{className:"wcsatt-plans-table-empty",children:a.emptyStateMessage}),(0,c.jsx)("div",{className:"wcsatt-plans-table-footer "+(t?"is-product-mode":""),children:(0,c.jsx)(l.Button,{variant:"secondary",icon:I,onClick:n,children:a.addButtonText})})]})}const ur={day:90,week:52,month:24,year:5},dr=["day","week","month","year"];function mr(e,t){if(!dr.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 s=ur[t];return i>s?{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"),s,t)}:{valid:!0,message:""}}function pr(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 fr(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 vr(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 gr(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 br(e){return dr.includes(e)?ur[e]:null}function hr(){return{validateTrialLength:mr,validateSignupFee:pr,validateRegularPrice:fr,validateSalePrice:vr,validatePriceOverride:gr,getTrialMaxValue:br}}const _r=(0,c.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(a.Path,{d:"M7 11.5h10V13H7z"})});function wr({label:e,value:t,onChange:n,onBlur:s,min:r=0,max:o=1/0,step:a=1,help:u}){const[m,p]=(0,i.useState)(0),f=(0,i.useRef)(null),v=(0,i.useRef)(!1);function g(){p(0)}function b(e){const i=parseFloat(t||"0");let s=i+e;s>o?s=o:s<r&&(s=r),s!==i&&(n(String(s)),p(e),v.current=!0)}return(0,i.useEffect)(()=>(0!==m?(f.current=setTimeout(function(){const e=parseFloat(t||"0");let i=e+m;i>o?i=o:i<r&&(i=r),i!==e&&n(String(i))},v.current?500:100),v.current=!1):f.current&&clearTimeout(f.current),()=>{f.current&&clearTimeout(f.current)}),[m,t,r,o,n]),(0,c.jsx)(l.__experimentalInputControl,{__next40pxDefaultSize:!0,className:"wcsatt-number-control",type:"number",label:e,value:t,onChange:n,onBlur:s,min:r,max:o,step:a,help:u,suffix:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Button,{icon:I,disabled:parseFloat(t||"0")>=o,onMouseDown:()=>b(a),onMouseLeave:g,onMouseUp:g,onBlur:s,size:"small","aria-hidden":"true","aria-label":(0,d.__)("Increment","woocommerce-subscriptions"),tabIndex:-1}),(0,c.jsx)(l.Button,{icon:_r,disabled:parseFloat(t||"0")<=r,onMouseDown:()=>b(-a),onMouseLeave:g,onMouseUp:g,onBlur:s,size:"small","aria-hidden":"true","aria-label":(0,d.__)("Decrement","woocommerce-subscriptions"),tabIndex:-1})]})})}function xr({period:e,value:t,syncOptions:n,onChange:s}){const r=(0,i.createInterpolateElement)((0,d.__)("Align subscription renewals to a specific day of the week, month or year. <a>Learn more</a>","woocommerce-subscriptions"),{a:(0,c.jsx)(l.ExternalLink,{href:"https://woocommerce.com/document/subscriptions/billing-date-alignment/"})});var o,a;if("week"===e||"month"===e)return(0,c.jsxs)("div",{className:"wcsatt-field-group wcsatt-align-billing-field",children:[(0,c.jsx)(l.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!==(o=t?.day)&&void 0!==o?o:0),options:null!==(a=n[e])&&void 0!==a?a:[],onChange:e=>s({day:parseInt(e,10)})}),(0,c.jsx)("p",{className:"description wcsatt-align-billing-field__description",children:r})]});if("year"===e){var u,m;const e="object"==typeof t&&null!==t&&t.month?String(parseInt(t.month,10)).padStart(2,"0"):"0",i=null!==(u=n.year)&&void 0!==u?u:[],o=[0,31,28,31,30,31,30,31,31,30,31,30,31],a=null!==(m=o[parseInt(e,10)])&&void 0!==m?m:0,p=Array.from({length:a},(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=o[n])&&void 0!==i?i:31;s({month:n,day:Math.min(e,r)})}else s({day:0})},v=t=>{s({month:parseInt(e,10),day:parseInt(t,10)})};return(0,c.jsxs)("div",{className:"wcsatt-field-group wcsatt-align-billing-field",children:[(0,c.jsxs)("div",{className:"wcsatt-field-group-horizontal",role:"group","aria-label":(0,d.__)("Yearly renewal alignment date","woocommerce-subscriptions"),children:[(0,c.jsx)(l.SelectControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Align Renewal","woocommerce-subscriptions"),"aria-label":(0,d.__)("Align Renewal – Month","woocommerce-subscriptions"),value:e,options:i,onChange:f}),(0,c.jsx)("div",{"aria-live":"polite",children:"0"!==e&&(0,c.jsx)(l.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,c.jsx)("p",{className:"description wcsatt-align-billing-field__description",children:r})]})}return null}function yr({message:e}){return(0,c.jsx)("p",{className:"wcsatt-error-message","aria-live":"polite",role:"status",children:e||""})}function jr({discountType:e,discountValue:t,currencySymbol:n,currencyStep:i,error:s,onTypeChange:r,onValueChange:o,onValueBlur:a}){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,c.jsxs)("div",{className:"wcsatt-field-group",children:[(0,c.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,c.jsx)(l.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Discount","woocommerce-subscriptions"),"aria-label":(0,d.__)("Discount value","woocommerce-subscriptions"),type:"number",value:t,onChange:o,onBlur:a,step:u?i:"0.1",min:"0",...!u&&{max:"100"},...u?{prefix:(0,c.jsx)(l.__experimentalInputControlPrefixWrapper,{children:n})}:{suffix:(0,c.jsx)(l.__experimentalInputControlSuffixWrapper,{children:"%"})}}),(0,c.jsx)(l.SelectControl,{__next40pxDefaultSize:!0,"aria-label":(0,d.__)("Discount type","woocommerce-subscriptions"),value:e,options:m,onChange:r})]}),(0,c.jsx)(yr,{message:s})]})}function Sr({regularPrice:e,salePrice:t,currencySymbol:n,currencyStep:i,currencyPlaceholder:s,regularPriceError:r,salePriceError:o,onRegularPriceChange:a,onRegularPriceBlur:u,onSalePriceChange:m,onSalePriceBlur:p}){return(0,c.jsx)("div",{className:"wcsatt-field-group",children:(0,c.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)(l.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Regular Price","woocommerce-subscriptions"),type:"number",value:e,prefix:(0,c.jsx)(l.__experimentalInputControlPrefixWrapper,{children:n}),onChange:a,onBlur:u,step:i,min:"0",placeholder:s}),(0,c.jsx)(yr,{message:r})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)(l.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Sale Price","woocommerce-subscriptions"),type:"number",value:t,prefix:(0,c.jsx)(l.__experimentalInputControlPrefixWrapper,{children:n}),onChange:m,onBlur:p,step:i,min:"0",placeholder:s}),(0,c.jsx)(yr,{message:o})]})]})})}const Cr={day:3650,week:520,month:120,year:10};function Ir(e,t){const n=Cr[e]||120;return Math.floor(n/t)}function Er(e,t,n,i){if(!t)return null;const s=parseInt(e,10);return!s||s<1?(0,d.__)("Total number of payments must be at least 1.","woocommerce-subscriptions"):s>Ir(n,i)?(0,d.__)("The total subscription duration cannot exceed 10 years.","woocommerce-subscriptions"):null}const kr=(0,i.forwardRef)(function({subscriptionLength:e,billingInterval:t,billingPeriod:n,onChange:s,onFieldChange:r,onValidationChange:o},a){const u=parseInt(e,10)||0,m=parseInt(t,10)||1,p=n||"month",[f,v]=(0,i.useState)(u>0),[g,b]=(0,i.useState)(function(e,t){return e<=0?1:Math.max(1,Math.floor(e/t))}(u,m)),[h,_]=(0,i.useState)(null),w=e=>{_(e),o&&o(e)},x=Ir(p,m);return(0,i.useEffect)(()=>{f&&s(String(g*m))},[m]),(0,i.useEffect)(()=>{f&&g>0&&w(Er(g,f,p,m))},[p,m]),(0,i.useImperativeHandle)(a,()=>({validate(){const e=Er(g,f,p,m);return w(e),!e}})),(0,c.jsxs)("div",{className:"wcsatt-field-group",children:[(0,c.jsx)(l.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&&g<1?1:g;e&&g<1&&b(t);const n=e?String(t*m):"0";s(n),r&&r()}}),f&&(0,c.jsxs)("div",{className:"wcsatt-total-payments-field",children:[(0,c.jsx)(wr,{label:(0,d.__)("Total number of payments","woocommerce-subscriptions"),value:g,onChange:e=>{const t=parseInt(e,10)||0;b(t),w(null);const n=f?String(t*m):"0";s(n),r&&r()},onBlur:()=>{w(Er(g,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,c.jsx)(yr,{message:h})]})]})});function Pr({plan:e,isDisabled:t=!1,onCancel:n,onSave:s,onFieldChange:r}){var o,a;const{validateTrialLength:u,validateSignupFee:m,validateRegularPrice:p,validateSalePrice:f,getTrialMaxValue:v}=hr(),{isProductContext:g}=w(),b=(0,er.getSetting)("currency",{}).symbol||"$",h=function(){const{precision:e}=nr();return e>0?(1/Math.pow(10,e)).toFixed(e):"1"}(),_=ir(0,!0),x=null!==(o=window.wcsatt_admin_params?.sync_options)&&void 0!==o?o:{},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!==(a=e?.subscription_payment_sync_date)&&void 0!==a?a:{day:0}};g&&(y.subscription_regular_price=e?.subscription_regular_price||"",y.subscription_sale_price=e?.subscription_sale_price||"");const[j,S]=(0,i.useState)(y),C=g,I=g&&"override"===j.subscription_pricing_method,[E,k]=(0,i.useState)({}),P=e=>{const t=Array.isArray(e)?e:[e];k(e=>{const n={...e};return t.forEach(e=>delete n[e]),n})},N=(0,i.useRef)(!1),V=(0,i.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 g&&"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)=>{S(n=>({...n,[e]:t})),P(e),r&&r()};(0,i.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,i.useEffect)(()=>{P(["subscription_regular_price","subscription_sale_price","subscription_discount"])},[j.subscription_pricing_method]),(0,i.useEffect)(()=>{N.current?S(e=>({...e,subscription_payment_sync_date:{day:0}})):N.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"];g&&t.push("subscription_regular_price","subscription_sale_price"),t.forEach(t=>{const n=M(t);n&&(e[t]=n)}),k(e);const n=!V.current||V.current.validate();return 0===Object.keys(e).length&&n})())return;const n={...j};e?.id&&(n.id=e.id),s(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,i.useMemo)(()=>D(parseInt(j.subscription_period_interval,10)||1),[j.subscription_period_interval]),B=(0,i.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,H=Object.keys(E).length>0,z=t||H;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("form",{onSubmit:A,className:"wcsatt-plan-form",children:(0,c.jsxs)("div",{className:"wcsatt-plan-form-content",children:[!e&&(0,c.jsx)("p",{className:"description",children:g?(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,c.jsxs)("div",{className:"wcsatt-field-group",children:[(0,c.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,c.jsx)(wr,{__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,c.jsx)(l.SelectControl,{__next40pxDefaultSize:!0,"aria-label":(0,d.__)("Frequency period","woocommerce-subscriptions"),value:j.subscription_period,options:T,onChange:e=>F("subscription_period",e)})]}),(0,c.jsx)(yr,{message:E.subscription_period_interval})]}),R&&(0,c.jsx)(xr,{period:j.subscription_period,value:j.subscription_payment_sync_date,syncOptions:x,onChange:e=>F("subscription_payment_sync_date",e)}),C&&(0,c.jsx)(l.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,c.jsx)(Sr,{regularPrice:j.subscription_regular_price,salePrice:j.subscription_sale_price,currencySymbol:b,currencyStep:h,currencyPlaceholder:_,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,c.jsx)(jr,{discountType:j.subscription_pricing_method,discountValue:j.subscription_discount,currencySymbol:b,currencyStep:h,error:E.subscription_discount,onTypeChange:e=>F("subscription_pricing_method",e),onValueChange:e=>F("subscription_discount",e),onValueBlur:()=>O("subscription_discount")}),(0,c.jsx)(kr,{ref:V,subscriptionLength:j.subscription_length,billingInterval:j.subscription_period_interval,billingPeriod:j.subscription_period,onChange:e=>F("subscription_length",e),onFieldChange:r,onValidationChange:e=>{k(t=>{const n={...t};return e?n.subscription_length=e:delete n.subscription_length,n})}}),(0,c.jsxs)("div",{className:"wcsatt-signup-fee-field",children:[(0,c.jsx)(l.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Signup Fee","woocommerce-subscriptions"),type:"number",value:j.subscription_signup_fee,prefix:(0,c.jsx)(l.__experimentalInputControlPrefixWrapper,{children:b}),onChange:e=>F("subscription_signup_fee",e),onBlur:()=>O("subscription_signup_fee"),step:h,min:"0",placeholder:_}),(0,c.jsx)(yr,{message:E.subscription_signup_fee})]}),(0,c.jsx)("div",{children:(0,c.jsxs)("div",{className:"wcsatt-field-group",children:[(0,c.jsxs)("div",{className:"wcsatt-field-group-horizontal",children:[(0,c.jsx)(wr,{__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,c.jsx)(l.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,c.jsx)(yr,{message:E.subscription_trial_length})]})})]})}),(0,c.jsxs)("div",{className:"wcsatt-plan-modal__actions",children:[(0,c.jsx)(l.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,d.__)("Cancel","woocommerce-subscriptions")}),(0,c.jsx)(l.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",disabled:z,onClick:A,children:(0,d.__)("Save","woocommerce-subscriptions")})]})]})}function Nr({apiError:e}){return(0,c.jsx)("div",{className:"wcsatt-plan-modal__api-error",children:(0,c.jsxs)(l.Notice,{status:"error",isDismissible:!1,children:[(0,c.jsxs)("p",{children:[(0,c.jsx)("strong",{children:(0,d.__)("Error saving plan:","woocommerce-subscriptions")})," ",e]}),(0,c.jsx)("p",{children:(0,d.__)("Please correct the errors and try again.","woocommerce-subscriptions")})]})})}function Vr(){return(0,c.jsx)("div",{className:"wcsatt-plan-modal__duplicate-notice",children:(0,c.jsx)(l.Notice,{status:"error",isDismissible:!1,children:(0,c.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 Mr(){return(0,c.jsx)("div",{className:"wcsatt-plan-modal__saving-indicator",children:(0,c.jsxs)("div",{children:[(0,c.jsx)(l.Spinner,{}),(0,c.jsx)("span",{children:(0,d.__)("Saving plan…","woocommerce-subscriptions")})]})})}function Fr({plan:e,duplicateWarning:t=null,apiError:n=null,isSaving:i=!1,onClose:s,onSave:r,onFieldChange:o}){const{labels:a}=w(),u=e?a.modalTitleEdit:a.modalTitle;return(0,c.jsxs)(l.Modal,{title:u,onRequestClose:s,className:"wcsatt-plan-modal",style:{width:"512px",maxWidth:"512px"},shouldCloseOnClickOutside:!i,shouldCloseOnEsc:!i,children:[n&&(0,c.jsx)(Nr,{apiError:n}),t&&(0,c.jsx)(Vr,{}),i&&(0,c.jsx)(Mr,{}),(0,c.jsx)(Pr,{plan:e,onCancel:s,onSave:r,onFieldChange:o,isDisabled:!!t||i,isSaving:i})]})}function Or({isProductMode:e}){const{plans:t,addPlan:n,updatePlan:s,deletePlan:r,reorderPlans:o}=function(){const e=w();return{plans:e.plans,addPlan:e.addPlan,updatePlan:e.updatePlan,deletePlan:e.deletePlan,reorderPlans:e.reorderPlans}}(),{showSuccess:l,showError:a}=function(){const{createNotice:e,removeNotice:t}=(0,x.useDispatch)(y.store);return{showSuccess:(n,i={})=>{const s=`success-${Date.now()}`;e("success",n,{id:s,isDismissible:!0,type:"snackbar",...i}),setTimeout(()=>{t(s)},2e3)},showError:(n,i={})=>{const s=`error-${Date.now()}`;e("error",n,{id:s,isDismissible:!0,type:"snackbar",...i}),setTimeout(()=>{t(s)},3e3)},showInfo:(n,i={})=>{const s=`info-${Date.now()}`;e("info",n,{id:s,isDismissible:!0,type:"snackbar",...i}),setTimeout(()=>{t(s)},3e3)},removeNotification:e=>{t(e)}}}(),[u,m]=(0,i.useState)(!1),[p,f]=(0,i.useState)(null),[v,g]=(0,i.useState)(null),[b,h]=(0,i.useState)(!1),[_,j]=(0,i.useState)(null),S=()=>{m(!1),f(null),g(null),j(null),h(!1)};return(0,c.jsxs)("div",{className:"wcsatt-plan-manager",children:[(0,c.jsx)(cr,{plans:t,onAddPlan:()=>{f(null),m(!0),j(null)},onEditPlan:e=>{f(e),m(!0),j(null)},onDeletePlan:async e=>{const t=await r(e);t.success?l(t.message):a(t.error||(0,d.__)("Unable to delete the plan. Please try again.","woocommerce-subscriptions"))},onReorderPlans:async e=>{const t=await o(e);t.success?l(t.message):a(t.error)},isProductMode:e}),u&&(0,c.jsx)(Fr,{plan:p,duplicateWarning:v,apiError:_,isSaving:b,onClose:S,onSave:async e=>{const{isDuplicate:i,matchingPlan:r}=function(e,t,n=null){const i=e=>""===e||null==e?0:"boolean"==typeof e?e?1:0:"string"==typeof e?parseFloat(e):e,s=e.subscription_pricing_method,r=["subscription_period","subscription_period_interval","subscription_length","subscription_signup_fee","subscription_trial_length","subscription_trial_period"];s?(r.push("subscription_pricing_method"),"override"===s?r.push("subscription_regular_price","subscription_sale_price"):r.push("subscription_discount")):r.push("subscription_discount");const o=t.find(t=>(!n||t.id!==n)&&r.every(n=>{const s=i(e[n]),r=i(t[n]);return"subscription_period"===n||"subscription_trial_period"===n||"subscription_pricing_method"===n?e[n]===t[n]:s===r}));return{isDuplicate:!!o,matchingPlan:o||null}}(e,t,p?.id);if(i)return void g(r);let o;g(null),j(null),h(!0),o=p?.id?await s(p.id,e):await n(e),o.success?(S(),l(o.message)):(j(o.error),h(!1))},onFieldChange:()=>{v&&g(null),_&&j(null)}})]})}function Ar(){return(0,c.jsx)("div",{className:"wcsatt-plans-app",children:(0,c.jsx)(Or,{})})}const Dr={table:{}},Tr=["discount","expires","signup_fee","trial"],Br=[{id:"wcsatt-storewide-select",label:(0,d.__)("Select","woocommerce-subscriptions"),supportsBulk:!0,isEligible:()=>!0,callback:()=>{}}];function Lr({error:e}){return(0,c.jsx)("div",{className:"wcsatt-storewide-plan-selector",children:(0,c.jsxs)("div",{className:"wcsatt-error",children:[(0,c.jsx)("p",{className:"wcsatt-error-message",children:(0,d.__)("Failed to load storewide plans.","woocommerce-subscriptions")}),(0,c.jsx)("p",{className:"wcsatt-error-details",children:e})]})})}function Rr(){return(0,c.jsx)("div",{className:"wcsatt-storewide-plan-selector",children:(0,c.jsx)("div",{className:"wcsatt-empty-state",children:(0,c.jsx)("p",{children:(0,d.__)("No storewide subscription plans configured. Create plans in your storewide subscription plan settings first.","woocommerce-subscriptions")})})})}function Hr({selected:e,onChange:t}){return(0,c.jsx)(l.RadioControl,{label:(0,d.__)("Subscription plan selection","woocommerce-subscriptions"),selected:e,options:[{label:(0,c.jsxs)(c.Fragment,{children:[(0,d.__)("Use all storewide subscription plans","woocommerce-subscriptions"),(0,c.jsx)("span",{className:"wcsatt-selection-mode__help",children:(0,d.__)("New storewide subscription plans will be included automatically.","woocommerce-subscriptions")})]}),value:"all"},{label:(0,d.__)("Select storewide subscription plans","woocommerce-subscriptions"),value:"specific"}],onChange:t})}function zr(){return(0,c.jsx)(l.Notice,{status:"warning",isDismissible:!1,children:(0,d.__)('Please select at least one plan, or switch to "Use all storewide subscription plans" mode.',"woocommerce-subscriptions")})}function Wr(){const[e,t]=(0,i.useState)("all"),[n,s]=(0,i.useState)([]),[r,o]=(0,i.useState)([]),[l,a]=(0,i.useState)(null),[u,m]=(0,i.useState)({type:"table",perPage:100,page:1,search:"",filters:[],fields:Tr,titleField:"frequency",layout:{}}),p="specific"===e;(0,i.useEffect)(()=>{const e=document.querySelector('input[name="_wcsatt_storewide_selection_mode"]');e&&e.value&&t(e.value);const n=document.querySelector('input[name="_wcsatt_selected_storewide_plans"]');if(n&&n.value)try{const e=JSON.parse(n.value);Array.isArray(e)&&s(e.map(String))}catch(e){console.error("Failed to parse selected plan IDs:",e)}},[]),(0,i.useEffect)(()=>{try{const e=window.wcsatt_admin_params?.storewide_plans||[];o(e),a(null)}catch(e){a(e.message||(0,d.__)("Failed to load storewide plans","woocommerce-subscriptions"))}},[]),(0,i.useEffect)(()=>{const t=document.querySelector('input[name="_wcsatt_storewide_selection_mode"]');t&&(t.value=e);const i=document.querySelector('input[name="_wcsatt_selected_storewide_plans"]');i&&(i.value="specific"===e?JSON.stringify(n):"");const s=document.querySelector("form#post");s&&s.dispatchEvent(new Event("change",{bubbles:!0}))},[e,n]);const f=(0,i.useCallback)(e=>{t(e),"all"===e?s([]):"specific"===e&&s(e=>e.length>0?e:r.map(e=>String(e.id)))},[r]),v=(0,i.useMemo)(()=>[{id:"frequency",label:(0,d.__)("Frequency","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,getValue:({item:e})=>tr(e.subscription_period_interval,e.subscription_period),render:({item:e})=>tr(e.subscription_period_interval,e.subscription_period)},{id:"discount",label:(0,d.__)("Discount","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>rr(e)},{id:"expires",label:(0,d.__)("Expiration","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>or(e.subscription_length,e.subscription_period_interval)},{id:"signup_fee",label:(0,d.__)("Signup fee","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>ir(e.subscription_signup_fee)},{id:"trial",label:(0,d.__)("Free trial","woocommerce-subscriptions"),enableSorting:!1,enableHiding:!1,render:({item:e})=>sr(e.subscription_trial_length,e.subscription_trial_period)}],[]),g=(0,i.useCallback)(e=>String(e.id),[]),b=(0,i.useMemo)(()=>({totalItems:r.length,totalPages:1}),[r.length]);if(l)return(0,c.jsx)(Lr,{error:l});if(!r||0===r.length)return(0,c.jsx)(Rr,{});const h=p?{selection:n,onChangeSelection:s,actions:Br}:{};return(0,c.jsxs)("div",{className:"wcsatt-storewide-plan-selector",children:[(0,c.jsx)("div",{className:"wcsatt-selection-mode",children:(0,c.jsx)(Hr,{selected:e,onChange:f})}),(0,c.jsx)("div",{className:"wcsatt-storewide-plans-table-wrapper",children:(0,c.jsx)(Qs,{data:r,fields:v,view:u,onChangeView:m,getItemId:g,paginationInfo:b,defaultLayouts:Dr,search:!1,...h})}),p&&0===n.length&&(0,c.jsx)(zr,{})]})}function $r({initialChecked:e,onChangeNotify:t}){const[n,s]=(0,i.useState)(e);return(0,i.useEffect)(()=>{const e=document.getElementById("wcsatt-subscription-gifting");e&&(e.value=n?"enabled":"disabled")},[n]),(0,c.jsx)("div",{className:"wcsatt-section",children:(0,c.jsxs)(l.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,c.jsx)(l.BaseControl.VisualLabel,{children:(0,d.__)("Gifting","woocommerce-subscriptions")}),(0,c.jsx)(l.CheckboxControl,{label:(0,d.__)("Allow shoppers to purchase subscriptions as gifts for others.","woocommerce-subscriptions"),checked:n,onChange:e=>{s(e),t&&t()}})]})})}function Ur(e,t){const n=document.getElementById(e);n&&(n.value=t)}function Kr(){const e=document.getElementById("wcsatt-product-plans-root"),t=e?.dataset.initialMode||"disable",n=e?.dataset.allowOneOff||"yes",s="yes"===e?.dataset.giftingEnabled,[r,o]=(0,i.useState)(t),[a,u]=(0,i.useState)("yes"===n);(0,i.useEffect)(()=>{Ur("wcsatt-schemes-status",r)},[r]),(0,i.useEffect)(()=>{Ur("wcsatt-allow-one-off",a?"yes":"")},[a]);const m=(0,i.useCallback)(()=>{const e=document.querySelector("form#post");e&&e.dispatchEvent(new Event("change",{bubbles:!0}))},[]),p="inherit"===r,f="override"===r,v=p||f;return(0,c.jsxs)("div",{className:"wcsatt-product-plans-app",children:[(0,c.jsx)("div",{className:"wcsatt-purchase-options",children:(0,c.jsx)(l.SelectControl,{__next40pxDefaultSize:!0,label:(0,d.__)("Purchase options","woocommerce-subscriptions"),value:r,options:[{label:(0,d.__)("Use storewide subscription plans","woocommerce-subscriptions"),value:"inherit"},{label:(0,d.__)("Create custom subscription plans","woocommerce-subscriptions"),value:"override"},{label:(0,d.__)("Sell one-time only","woocommerce-subscriptions"),value:"disable"}],onChange:e=>{o(e),m()},help:(()=>{switch(r){case"inherit":return(0,d.__)("This product will use the storewide subscription plans from your subscription settings.","woocommerce-subscriptions");case"override":return(0,d.__)("This product will use custom subscription plans instead of your storewide subscription plans.","woocommerce-subscriptions");case"disable":return(0,d.__)("This product will only be available as a one-time purchase.","woocommerce-subscriptions");default:return""}})()})}),v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"wcsatt-section",children:[f&&(0,c.jsx)(l.BaseControl,{id:"wcsatt-custom-plans",label:(0,d.__)("Subscription plans for this product","woocommerce-subscriptions")}),p&&(0,c.jsx)(Wr,{}),f&&(0,c.jsx)(Or,{isProductMode:!0})]}),(0,c.jsx)("div",{className:"wcsatt-section",children:(0,c.jsx)(l.BaseControl,{id:"wcsatt-one-time-purchases",label:(0,d.__)("One-time purchases","woocommerce-subscriptions"),children:(0,c.jsx)(l.CheckboxControl,{label:(0,d.__)("Customers can buy this product without subscribing","woocommerce-subscriptions"),checked:a,onChange:e=>{u(e),m()}})})}),s&&(0,c.jsx)($r,{initialChecked:"yes"===e?.dataset.giftingChecked,onChangeNotify:m})]})]})}document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("wcsatt-storewide-plans-root");e&&(0,i.createRoot)(e).render((0,c.jsx)(_,{children:(0,c.jsx)(Ar,{})}));const t=document.getElementById("wcsatt-product-plans-root");if(t){const e=t.dataset.productId;(0,i.createRoot)(t).render((0,c.jsx)(_,{productId:e?parseInt(e,10):null,children:(0,c.jsx)(Kr,{})}))}})},493:(e,t,n)=>{"use strict";var i=n(609),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=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!s(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=r({inst:{value:n,getSnapshot:t}}),s=i[0].inst,u=i[1];return l(function(){s.value=n,s.getSnapshot=t,c(s)&&u({inst:s})},[e,n,t]),o(function(){return c(s)&&u({inst:s}),e(function(){c(s)&&u({inst:s})})},[e]),a(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},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"),s=new RegExp(n,"");function r(e){return t[e]}var o=function(e){return e.replace(i,r)};e.exports=o,e.exports.has=function(e){return!!e.match(s)},e.exports.remove=o},795:e=>{"use strict";e.exports=window.ReactDOM},848:(e,t,n)=>{"use strict";e.exports=n(20)},888:(e,t,n)=>{"use strict";e.exports=n(493)}},s={};function r(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return i[e](n,n.exports,r),n.exports}r.m=i,e=[],r.O=(t,n,i,s)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){for(var[n,i,s]=e[u],l=!0,a=0;a<n.length;a++)(!1&s||o>=s)&&Object.keys(r.O).every(e=>r.O[e](n[a]))?n.splice(a--,1):(l=!1,s<o&&(o=s));if(l){e.splice(u--,1);var c=i();void 0!==c&&(t=c)}}return t}s=s||0;for(var u=e.length;u>0&&e[u-1][2]>s;u--)e[u]=e[u-1];e[u]=[n,i,s]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.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 s=Object.create(null);r.r(s);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,r.d(s,o),s},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={884:0,15:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var i,s,[o,l,a]=n,c=0;if(o.some(t=>0!==e[t])){for(i in l)r.o(l,i)&&(r.m[i]=l[i]);if(a)var u=a(r)}for(t&&t(n);c<o.length;c++)s=o[c],r.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return r.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=r.O(void 0,[15],()=>r(349));o=r.O(o)})();
Save File
Cancel