(()=>{"use strict";var e={991:e=>{e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;0!=o--;){var i=a[o];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const e=window.React;var t=n.n(e);const r=window.wp.element;function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?h(S,--E):0,x--,10===C&&(x=1,w--),C}function O(){return C=E2||I(C)>3?"":" "}function z(e,t){for(;--t&&O()&&!(C<48||C>102||C>57&&C<65||C>70&&C<97););return M(e,T()+(t<6&&32==A()&&32==O()))}function B(e){for(;O();)switch(C){case e:return E;case 34:case 39:34!==e&&39!==e&&B(C);break;case 40:41===e&&B(e);break;case 92:O()}return E}function $(e,t){for(;O()&&e+C!==57&&(e+C!==84||47!==A()););return"/*"+M(t,E-1)+"*"+u(47===e?e:O())}function F(e){for(;!I(A());)O();return M(e,E)}var U="-ms-",V="-moz-",G="-webkit-",H="comm",W="rule",q="decl",X="@keyframes";function Y(e,t){for(var n="",r=b(e),o=0;o0&&v(I)-p&&y(b>32?te(I+";",r,n,p-1):te(f(I," ","")+";",r,n,p-2),s);break;case 59:I+=";";default:if(y(M=Q(I,t,n,c,d,o,l,S,_=[],R=[],p),a),123===C)if(0===d)Z(I,t,M,M,_,a,p,l,R);else switch(99===m&&110===h(I,3)?100:m){case 100:case 108:case 109:case 115:Z(e,M,M,r&&y(Q(e,M,M,0,0,o,l,S,o,_=[],p),R),o,R,p,l,r?_:R);break;default:Z(I,M,M,M,[""],R,0,l,R)}}c=d=b=0,x=E=1,S=I="",p=i;break;case 58:p=1+v(I),b=w;default:if(x<1)if(123==C)--x;else if(125==C&&0==x++&&125==D())continue;switch(I+=u(C),C*x){case 38:E=d>0?1:(I+="\f",-1);break;case 44:l[c++]=(v(I)-1)*E,E=1;break;case 64:45===A()&&(I+=P(O())),m=A(),d=p=v(S=I+=F(T())),C++;break;case 45:45===w&&2==v(I)&&(x=0)}}return a}function Q(e,t,n,r,o,a,i,l,s,u,d){for(var g=o-1,h=0===o?a:[""],v=b(h),y=0,w=0,x=0;y0?h[k]+" "+E:f(E,/&\f/g,h[k])))&&(s[x++]=C);return _(e,t,n,0===o?W:l,s,u,d)}function ee(e,t,n){return _(e,t,n,H,u(C),m(e,2,-2),0)}function te(e,t,n,r){return _(e,t,n,q,m(e,0,r),m(e,r+1,-1),r)}var ne=function(e,t,n){for(var r=0,o=0;r=o,o=A(),38===r&&12===o&&(t[n]=1),!I(o);)O();return M(e,E)},re=new WeakMap,oe=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||re.get(n))&&!r){re.set(e,!0);for(var o=[],a=function(e,t){return L(function(e,t){var n=-1,r=44;do{switch(I(r)){case 0:38===r&&12===A()&&(t[n]=1),e[n]+=ne(E-1,t,n);break;case 2:e[n]+=P(r);break;case 4:if(44===r){e[++n]=58===A()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=u(r)}}while(r=O());return e}(N(e),t))}(t,o),i=n.props,l=0,s=0;l6)switch(h(e,t+1)){case 109:if(45!==h(e,t+4))break;case 102:return f(e,/(.+:)(.+)-([^]+)/,"$1"+G+"$2-$3$1"+V+(108==h(e,t+3)?"$3":"$2-$3"))+e;case 115:return~g(e,"stretch")?ie(f(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==h(e,t+1))break;case 6444:switch(h(e,v(e)-3-(~g(e,"!important")&&10))){case 107:return f(e,":",":"+G)+e;case 101:return f(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+G+(45===h(e,14)?"inline-":"")+"box$3$1"+G+"$2$3$1"+U+"$2box$3")+e}break;case 5936:switch(h(e,t+11)){case 114:return G+e+U+f(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return G+e+U+f(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return G+e+U+f(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return G+e+U+e+e}return e}var le=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case q:e.return=ie(e.value,e.length);break;case X:return Y([R(e,{value:f(e.value,"@","@"+G)})],r);case W:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Y([R(e,{props:[f(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Y([R(e,{props:[f(t,/:(plac\w+)/,":"+G+"input-$1")]}),R(e,{props:[f(t,/:(plac\w+)/,":-moz-$1")]}),R(e,{props:[f(t,/:(plac\w+)/,U+"input-$1")]})],r)}return""}))}}],se=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,o,a=e.stylisPlugins||le,i={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n96?Ce:Se},Re=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},De=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Ee(t,n,r),we((function(){return function(e,t,n){Ee(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)})),null},Oe=function t(n,r){var a,i,l=n.__emotion_real===n,s=l&&n.__emotion_base||n;void 0!==r&&(a=r.label,i=r.target);var c=Re(n,r,l),u=c||_e(s),d=!u("as");return function(){var p=arguments,f=l&&void 0!==n.__emotion_styles?n.__emotion_styles.slice(0):[];if(void 0!==a&&f.push("label:"+a+";"),null==p[0]||void 0===p[0].raw)f.push.apply(f,p);else{f.push(p[0][0]);for(var g=p.length,h=1;h=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+s;return{name:c,styles:o,next:ve}}(f.concat(m),n.registered,v);h+=n.key+"-"+y.name,void 0!==i&&(h+=" "+i);var w=d&&void 0===c?_e(g):u,x={};for(var k in t)d&&"as"===k||w(k)&&(x[k]=t[k]);return x.className=h,x.ref=r,e.createElement(e.Fragment,null,e.createElement(De,{cache:n,serialized:y,isStringTag:"string"==typeof g}),e.createElement(g,x))},(0,e.forwardRef)((function(t,n){var r=(0,e.useContext)(xe);return m(t,r,n)})));return v.displayName=void 0!==a?a:"Styled("+("string"==typeof s?s:s.displayName||s.name||"Component")+")",v.defaultProps=n.defaultProps,v.__emotion_real=v,v.__emotion_base=s,v.__emotion_styles=f,v.__emotion_forwardProp=c,Object.defineProperty(v,"toString",{value:function(){return"."+i}}),v.withComponent=function(e,n){return t(e,o({},r,n,{shouldForwardProp:Re(v,n,!0)})).apply(void 0,f)},v}}.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Oe[e]=Oe(e)}));const Ae=window.wp.i18n,Te=window.wc.wcSettings;var Me,Ie,Ne,Le,Pe,je,ze,Be,$e,Fe;const Ue=(0,Te.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),Ve=(Ue.pluginUrl,Ue.pluginUrl,Ue.buildPhase,null===(Me=Te.STORE_PAGES.shop)||void 0===Me||Me.permalink,null===(Ie=Te.STORE_PAGES.checkout)||void 0===Ie?void 0:Ie.id),Ge=(null===(Ne=Te.STORE_PAGES.checkout)||void 0===Ne||Ne.permalink,null===(Le=Te.STORE_PAGES.privacy)||void 0===Le||Le.permalink,null===(Pe=Te.STORE_PAGES.privacy)||void 0===Pe||Pe.title,null===(je=Te.STORE_PAGES.terms)||void 0===je||je.permalink,null===(ze=Te.STORE_PAGES.terms)||void 0===ze||ze.title,null===(Be=Te.STORE_PAGES.cart)||void 0===Be||Be.id,null===($e=Te.STORE_PAGES.cart)||void 0===$e||$e.permalink,null!==(Fe=Te.STORE_PAGES.myaccount)&&void 0!==Fe&&Fe.permalink?Te.STORE_PAGES.myaccount.permalink:(0,Te.getSetting)("wpLoginUrl","/wp-login.php"),(0,Te.getSetting)("localPickupEnabled",!1),(0,Te.getSetting)("countries",{})),He=(0,Te.getSetting)("countryData",{}),We=(Object.fromEntries(Object.keys(He).filter((e=>!0===He[e].allowBilling)).map((e=>[e,Ge[e]||""]))),Object.fromEntries(Object.keys(He).filter((e=>!0===He[e].allowBilling)).map((e=>[e,He[e].states||[]]))),Object.fromEntries(Object.keys(He).filter((e=>!0===He[e].allowShipping)).map((e=>[e,Ge[e]||""]))),Object.fromEntries(Object.keys(He).filter((e=>!0===He[e].allowShipping)).map((e=>[e,He[e].states||[]]))),Object.fromEntries(Object.keys(He).map((e=>[e,He[e].locale||[]]))),window.wp.components),qe=Oe.div` display: flex; flex-flow: column; margin-bottom: 24px; &:last-child { margin-bottom: 0; } @media ( min-width: 800px ) { flex-flow: row; } .components-base-control { label { text-transform: none !important; } } `,Xe=Oe.div` flex: 0 1 auto; margin-bottom: 24px; @media ( min-width: 800px ) { flex: 0 0 250px; margin: 0 32px 0 0; } h2 { font-size: 16px; line-height: 24px; } p { font-size: 13px; line-height: 17.89px; margin: 12px 0; } > :last-child { margin-bottom: 0; } `,Ye=Oe.div` flex: 1 1 auto; margin-bottom: 12px; `,Ke=({Description:t=(()=>null),children:n,...r})=>(0,e.createElement)(qe,{...r},(0,e.createElement)(Xe,null,(0,e.createElement)(t,null)),(0,e.createElement)(Ye,null,n)),Je=Oe(We.Card)` border-radius: 3px; `,Ze=Oe(We.CardBody)` padding: 24px; // increasing the specificity of the styles to override the Gutenberg ones &.is-size-medium.is-size-medium { padding: 24px; } h4 { margin-top: 0; margin-bottom: 1em; } > * { margin-top: 0; margin-bottom: 1.5em; // fixing the spacing on the inputs and their help text, to ensure it is consistent &:last-child { margin-bottom: 0; > :last-child { margin-bottom: 0; } } } input, select { margin: 0; } // spacing adjustment on "Express checkouts > Show express checkouts on" list ul > li:last-child { margin-bottom: 0; .components-base-control__field { margin-bottom: 0; } } `,Qe=({children:t,...n})=>(0,e.createElement)(Je,null,(0,e.createElement)(Ze,{...n},t)),et=window.wp.url,tt=window.wp.apiFetch;var nt=n.n(tt);const rt=window.wp.data;var ot=n(991),at=n.n(ot);const it=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object,lt={enabled:!1,title:(0,Ae.__)("Local Pickup","woocommerce"),tax_status:"taxable",cost:""},st={hasLegacyPickup:!1,storeCountry:"",storeState:""},ct=()=>{const e=hydratedScreenSettings.pickupLocationSettings;return{enabled:null!=e&&e.enabled?"yes"===(null==e?void 0:e.enabled):lt.enabled,title:(null==e?void 0:e.title)||lt.title,tax_status:(null==e?void 0:e.tax_status)||lt.tax_status,cost:(null==e?void 0:e.cost)||lt.cost}},ut=()=>(hydratedScreenSettings.pickupLocations||[]).map(((e,t)=>({...e,id:(0,et.cleanForSlug)(e.name)+"-"+t}))),dt=hydratedScreenSettings.readonlySettings||st,pt=(0,Te.getSetting)("countries",[]),ft=(0,Te.getSetting)("countryStates",[]),gt={options:Object.keys(pt).map((e=>{const t=ft[e]||{};if(0===Object.keys(t).length)return{options:[{value:e,label:pt[e]}]};const n=Object.keys(t).map((n=>({value:`${e}:${n}`,label:`${pt[e]} — ${t[n]}`})));return{label:pt[e],options:[...n]}}))},ht=(0,r.createContext)({settings:lt,readOnlySettings:st,setSettingField:()=>()=>{},pickupLocations:[],setPickupLocations:()=>{},toggleLocation:()=>{},updateLocation:()=>{},isSaving:!1,save:()=>{}}),mt=()=>(0,r.useContext)(ht),vt=({children:t})=>{const[n,o]=(0,r.useState)(!1),[a,i]=(0,r.useState)(ut),[l,s]=(0,r.useState)(ct),c=(0,r.useCallback)((e=>t=>{s((n=>({...n,[e]:t})))}),[]),u=(0,r.useCallback)((e=>{i((t=>{const n=t.findIndex((({id:t})=>t===e)),r=[...t];return r[n].enabled=!t[n].enabled,r}))}),[]),d=(0,r.useCallback)((()=>{const e={pickup_location_settings:{enabled:l.enabled?"yes":"no",title:l.title,tax_status:["taxable","none"].includes(l.tax_status)?l.tax_status:"taxable",cost:l.cost},pickup_locations:a.map((e=>({name:e.name,address:e.address,details:e.details,enabled:e.enabled})))};o(!0),nt()({path:"/wp/v2/settings",method:"POST",data:e}).then((t=>{o(!1),at()(t.pickup_location_settings,e.pickup_location_settings)&&at()(t.pickup_locations,e.pickup_locations)&&(0,rt.dispatch)("core/notices").createSuccessNotice((0,Ae.__)("Local Pickup settings have been saved.","woocommerce"))}))}),[l,a]),p={settings:l,setSettingField:c,readOnlySettings:dt,pickupLocations:a,setPickupLocations:i,toggleLocation:u,updateLocation:(e,t)=>{i((n=>"new"===e?[...n,{...t,id:(0,et.cleanForSlug)(t.name)+"-"+n.length}]:n.map((n=>n.id===e?t:n)).filter(Boolean)))},isSaving:n,save:d};return(0,e.createElement)(ht.Provider,{value:p},t)},bt=()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",null,(0,Ae.__)("General","woocommerce")),(0,e.createElement)("p",null,(0,Ae.__)("Enable or disable local pickup on your store, and define costs. Local pickup is only available from the block checkout.","woocommerce")),(0,e.createElement)(We.ExternalLink,{href:`${Te.ADMIN_URL}post.php?post=${Ve}&action=edit`},(0,Ae.__)("View checkout page","woocommerce"))),yt=Oe(We.Notice)` margin-left: 0; margin-right: 0; `,wt=()=>{const{settings:t,setSettingField:n,readOnlySettings:o}=mt(),[a,i]=(0,r.useState)(!!t.cost),l=(0,Te.getSetting)("shippingCostRequiresAddress",!1);return(0,e.createElement)(Ke,{Description:bt},(0,e.createElement)(Qe,null,o.hasLegacyPickup&&(0,e.createElement)(yt,{status:"warning",isDismissible:!1},(0,r.createInterpolateElement)((0,Ae.__)("Enabling this will produce duplicate options at checkout. Remove the local pickup shipping method from your shipping zones.","woocommerce"),{a:(0,e.createElement)("a",{href:`${Te.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`,target:"_blank",rel:"noopener noreferrer"})})),(0,e.createElement)(We.CheckboxControl,{checked:t.enabled,name:"local_pickup_enabled",onChange:n("enabled"),label:(0,Ae.__)("Enable local pickup","woocommerce"),help:(0,e.createElement)("span",null,(0,Ae.__)("When enabled, local pickup will appear as an option on the block based checkout.","woocommerce"),l?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("br",null),(0,Ae.__)('If local pickup is enabled, the "Hide shipping costs until an address is entered" setting will be ignored.',"woocommerce")):null)}),(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("Title","woocommerce"),name:"local_pickup_title",help:(0,Ae.__)("This is the shipping method title shown to customers.","woocommerce"),placeholder:(0,Ae.__)("Local Pickup","woocommerce"),value:t.title,onChange:n("title"),disabled:!1,autoComplete:"off",required:!0,onInvalid:e=>{e.target.setCustomValidity((0,Ae.__)("Local pickup title is required","woocommerce"))},onInput:e=>{e.target.setCustomValidity("")}}),(0,e.createElement)(We.CheckboxControl,{checked:a,onChange:()=>{i(!a),n("cost")("")},label:(0,Ae.__)("Add a price for customers who choose local pickup","woocommerce"),help:(0,Ae.__)("By default, the local pickup shipping method is free.","woocommerce")}),a?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("Cost","woocommerce"),name:"local_pickup_cost",help:(0,Ae.__)("Optional cost to charge for local pickup.","woocommerce"),placeholder:(0,Ae.__)("Free","woocommerce"),type:"number",pattern:"[0-9]+\\.?[0-9]*",min:0,value:t.cost,onChange:n("cost"),disabled:!1,autoComplete:"off"}),(0,e.createElement)(We.SelectControl,{label:(0,Ae.__)("Taxes","woocommerce"),name:"local_pickup_tax_status",help:(0,Ae.__)("If a cost is defined, this controls if taxes are applied to that cost.","woocommerce"),options:[{label:(0,Ae.__)("Taxable","woocommerce"),value:"taxable"},{label:(0,Ae.__)("Not taxable","woocommerce"),value:"none"}],value:t.tax_status,onChange:n("tax_status"),disabled:!1})):null))},xt=(0,r.forwardRef)((function({icon:e,size:t=24,...n},o){return(0,r.cloneElement)(e,{width:t,height:t,...n,ref:o})})),kt=window.wp.primitives,Et=(0,e.createElement)(kt.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(kt.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})),Ct=window.ReactDOM,St="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function _t(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Rt(e){return"nodeType"in e}function Dt(e){var t,n;return e?_t(e)?e:Rt(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Ot(e){const{Document:t}=Dt(e);return e instanceof t}function At(e){return!_t(e)&&e instanceof Dt(e).HTMLElement}function Tt(e){return e?_t(e)?e.document:Rt(e)?Ot(e)?e:At(e)?e.ownerDocument:document:document:document}const Mt=St?e.useLayoutEffect:e.useEffect;function It(t){const n=(0,e.useRef)(t);return Mt((()=>{n.current=t})),(0,e.useCallback)((function(){for(var e=arguments.length,t=new Array(e),r=0;r{r.current!==t&&(r.current=t)}),n),r}function Lt(t,n){const r=(0,e.useRef)();return(0,e.useMemo)((()=>{const e=t(r.current);return r.current=e,e}),[...n])}function Pt(t){const n=It(t),r=(0,e.useRef)(null),o=(0,e.useCallback)((e=>{e!==r.current&&(null==n||n(e,r.current)),r.current=e}),[]);return[r,o]}function jt(t){const n=(0,e.useRef)();return(0,e.useEffect)((()=>{n.current=t}),[t]),n.current}let zt={};function Bt(t,n){return(0,e.useMemo)((()=>{if(n)return n;const e=null==zt[t]?0:zt[t]+1;return zt[t]=e,t+"-"+e}),[t,n])}function $t(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const Ft=$t(1),Ut=$t(-1);function Vt(e){if(!e)return!1;const{KeyboardEvent:t}=Dt(e.target);return t&&e instanceof t}function Gt(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Dt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Ht=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ht.Translate.toString(e),Ht.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Wt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qt(e){return e.matches(Wt)?e:e.querySelector(Wt)}const Xt={display:"none"};function Yt(e){let{id:n,value:r}=e;return t().createElement("div",{id:n,style:Xt},r)}const Kt={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function Jt(e){let{id:n,announcement:r}=e;return t().createElement("div",{id:n,style:Kt,role:"status","aria-live":"assertive","aria-atomic":!0},r)}const Zt=(0,e.createContext)(null),Qt={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},en={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tn(n){let{announcements:r=en,container:o,hiddenTextDescribedById:a,screenReaderInstructions:i=Qt}=n;const{announce:l,announcement:s}=function(){const[t,n]=(0,e.useState)("");return{announce:(0,e.useCallback)((e=>{null!=e&&n(e)}),[]),announcement:t}}(),c=Bt("DndLiveRegion"),[u,d]=(0,e.useState)(!1);if((0,e.useEffect)((()=>{d(!0)}),[]),function(t){const n=(0,e.useContext)(Zt);(0,e.useEffect)((()=>{if(!n)throw new Error("useDndMonitor must be used within a children of ");return n(t)}),[t,n])}((0,e.useMemo)((()=>({onDragStart(e){let{active:t}=e;l(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&l(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;l(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;l(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;l(r.onDragCancel({active:t,over:n}))}})),[l,r])),!u)return null;const p=t().createElement(t().Fragment,null,t().createElement(Yt,{id:a,value:i.draggable}),t().createElement(Jt,{id:c,announcement:s}));return o?(0,Ct.createPortal)(p,o):p}var nn;function rn(){}function on(t,n){return(0,e.useMemo)((()=>({sensor:t,options:null!=n?n:{}})),[t,n])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(nn||(nn={}));const an=Object.freeze({x:0,y:0});function ln(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function sn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function cn(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const un=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=cn(t,t.left,t.top),a=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=(i=cn(r),l=o,Math.sqrt(Math.pow(i.x-l.x,2)+Math.pow(i.y-l.y,2)));a.push({id:t,data:{droppableContainer:e,value:n}})}}var i,l;return a.sort(ln)};function dn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=a-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,a=n.get(r);if(a){const n=dn(a,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(sn)};function fn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:an}function gn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const hn=gn(1);const mn={ignoreTransform:!1};function vn(e,t){void 0===t&&(t=mn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Dt(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:l}=r,s=e.left-i-(1-o)*parseFloat(n),c=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:c,right:s+u,bottom:c+d,left:s}}(n,t,r))}const{top:r,left:o,width:a,height:i,bottom:l,right:s}=n;return{top:r,left:o,width:a,height:i,bottom:l,right:s}}function bn(e){return vn(e,{ignoreTransform:!0})}function yn(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(Ot(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!At(o)||function(e){return e instanceof Dt(e).SVGElement}(o))return n;if(n.includes(o))return n;const a=Dt(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=Dt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,a)&&n.push(o),function(e,t){return void 0===t&&(t=Dt(e).getComputedStyle(e)),"fixed"===t.position}(o,a)?n:r(o.parentNode)}(e):n}function wn(e){const[t]=yn(e,1);return null!=t?t:null}function xn(e){return St&&e?_t(e)?e:Rt(e)?Ot(e)||e===Tt(e).scrollingElement?window:At(e)?e:null:null:null}function kn(e){return _t(e)?e.scrollX:e.scrollLeft}function En(e){return _t(e)?e.scrollY:e.scrollTop}function Cn(e){return{x:kn(e),y:En(e)}}var Sn;function Rn(e){return!(!St||!e)&&e===document.scrollingElement}function Dn(e){const t={x:0,y:0},n=Rn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Sn||(Sn={}));const On={x:.2,y:.2};function An(e,t,n,r,o){let{top:a,left:i,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=On);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=Dn(e),f={x:0,y:0},g={x:0,y:0},h=t.height*o.y,m=t.width*o.x;return!c&&a<=t.top+h?(f.y=Sn.Backward,g.y=r*Math.abs((t.top+h-a)/h)):!u&&s>=t.bottom-h&&(f.y=Sn.Forward,g.y=r*Math.abs((t.bottom-h-s)/h)),!p&&l>=t.right-m?(f.x=Sn.Forward,g.x=r*Math.abs((t.right-m-l)/m)):!d&&i<=t.left+m&&(f.x=Sn.Backward,g.x=r*Math.abs((t.left+m-i)/m)),{direction:f,speed:g}}function Tn(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Mn(e){return e.reduce(((e,t)=>Ft(e,Cn(t))),an)}const In=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+kn(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+En(t)),0)}]];class Nn{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=yn(t),r=Mn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of In)for(const a of t)Object.defineProperty(this,a,{get:()=>{const t=o(n),i=r[e]-t;return this.rect[a]+i},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ln{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Pn(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var jn,zn,Bn;function $n(e){e.preventDefault()}function Fn(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(jn||(jn={})),(Bn=zn||(zn={})).Space="Space",Bn.Down="ArrowDown",Bn.Right="ArrowRight",Bn.Left="ArrowLeft",Bn.Up="ArrowUp",Bn.Esc="Escape",Bn.Enter="Enter";const Un={start:[zn.Space,zn.Enter],cancel:[zn.Esc],end:[zn.Space,zn.Enter]},Vn=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case zn.Right:return{...n,x:n.x+25};case zn.Left:return{...n,x:n.x-25};case zn.Down:return{...n,y:n.y+25};case zn.Up:return{...n,y:n.y-25}}};class Gn{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Ln(Tt(t)),this.windowListeners=new Ln(Dt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(jn.Resize,this.handleCancel),this.windowListeners.add(jn.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(jn.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=vn),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);wn(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(an)}handleKeyDown(e){if(Vt(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Un,coordinateGetter:a=Vn,scrollBehavior:i="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:an;this.referenceCoordinates||(this.referenceCoordinates=c);const u=a(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=Ut(u,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:a,isRight:l,isLeft:s,isBottom:c,maxScroll:d,minScroll:p}=Dn(n),f=Tn(n),g={x:Math.min(o===zn.Right?f.right-f.width/2:f.right,Math.max(o===zn.Right?f.left:f.left+f.width/2,u.x)),y:Math.min(o===zn.Down?f.bottom-f.height/2:f.bottom,Math.max(o===zn.Down?f.top:f.top+f.height/2,u.y))},h=o===zn.Right&&!l||o===zn.Left&&!s,m=o===zn.Down&&!c||o===zn.Up&&!a;if(h&&g.x!==u.x){const e=n.scrollLeft+t.x,a=o===zn.Right&&e<=d.x||o===zn.Left&&e>=p.x;if(a&&!t.y)return void n.scrollTo({left:e,behavior:i});r.x=a?n.scrollLeft-e:o===zn.Right?n.scrollLeft-d.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:i});break}if(m&&g.y!==u.y){const e=n.scrollTop+t.y,a=o===zn.Down&&e<=d.y||o===zn.Up&&e>=p.y;if(a&&!t.x)return void n.scrollTo({top:e,behavior:i});r.y=a?n.scrollTop-e:o===zn.Down?n.scrollTop-d.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:i});break}}this.handleMove(e,Ft(Ut(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Hn(e){return Boolean(e&&"distance"in e)}function Wn(e){return Boolean(e&&"delay"in e)}Gn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Un,onActivation:o}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const t=a.activatorNode.current;return!(t&&e.target!==t||(e.preventDefault(),null==o||o({event:e.nativeEvent}),0))}return!1}}];class qn{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Dt(e);return e instanceof t?e:Tt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:a}=o;this.props=e,this.events=t,this.document=Tt(a),this.documentListeners=new Ln(this.document),this.listeners=new Ln(n),this.windowListeners=new Ln(Dt(a)),this.initialCoordinates=null!=(r=Gt(o))?r:an,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(jn.Resize,this.handleCancel),this.windowListeners.add(jn.DragStart,$n),this.windowListeners.add(jn.VisibilityChange,this.handleCancel),this.windowListeners.add(jn.ContextMenu,$n),this.documentListeners.add(jn.Keydown,this.handleKeydown),t){if(Hn(t))return;if(Wn(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(jn.Click,Fn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(jn.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:a,options:{activationConstraint:i}}=o;if(!r)return;const l=null!=(t=Gt(e))?t:an,s=Ut(r,l);if(!n&&i){if(Wn(i))return Pn(s,i.tolerance)?this.handleCancel():void 0;if(Hn(i))return null!=i.tolerance&&Pn(s,i.tolerance)?this.handleCancel():Pn(s,i.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===zn.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Xn={move:{name:"pointermove"},end:{name:"pointerup"}};class Yn extends qn{constructor(e){const{event:t}=e,n=Tt(t.target);super(e,Xn,n)}}Yn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button||(null==r||r({event:n}),0))}}];const Kn={move:{name:"mousemove"},end:{name:"mouseup"}};var Jn;!function(e){e[e.RightClick=2]="RightClick"}(Jn||(Jn={}));class Zn extends qn{constructor(e){super(e,Kn,Tt(e.event.target))}}Zn.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Jn.RightClick&&(null==r||r({event:n}),!0)}}];const Qn={move:{name:"touchmove"},end:{name:"touchend"}};class er extends qn{constructor(e){super(e,Qn)}static setup(){return window.addEventListener(Qn.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Qn.move.name,e)};function e(){}}}var tr,nr;er.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1||(null==r||r({event:n}),0))}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(tr||(tr={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(nr||(nr={}));const rr={x:{[Sn.Backward]:!1,[Sn.Forward]:!1},y:{[Sn.Backward]:!1,[Sn.Forward]:!1}};var or,ar;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(or||(or={})),function(e){e.Optimized="optimized"}(ar||(ar={}));const ir=new Map;function lr(e,t){return Lt((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function sr(t){let{callback:n,disabled:r}=t;const o=It(n),a=(0,e.useMemo)((()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)}),[r]);return(0,e.useEffect)((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function cr(e){return new Nn(vn(e),e)}function ur(t,n,r){void 0===n&&(n=cr);const[o,a]=(0,e.useReducer)((function(e){if(!t)return null;var o;if(!1===t.isConnected)return null!=(o=null!=e?e:r)?o:null;const a=n(t);return JSON.stringify(e)===JSON.stringify(a)?e:a}),null),i=function(t){let{callback:n,disabled:r}=t;const o=It(n),a=(0,e.useMemo)((()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)}),[o,r]);return(0,e.useEffect)((()=>()=>null==a?void 0:a.disconnect()),[a]),a}({callback(e){if(t)for(const n of e){const{type:e,target:r}=n;if("childList"===e&&r instanceof HTMLElement&&r.contains(t)){a();break}}}}),l=sr({callback:a});return Mt((()=>{a(),t?(null==l||l.observe(t),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==i||i.disconnect())}),[t]),o}const dr=[];function pr(t,n){void 0===n&&(n=[]);const r=(0,e.useRef)(null);return(0,e.useEffect)((()=>{r.current=null}),n),(0,e.useEffect)((()=>{const e=t!==an;e&&!r.current&&(r.current=t),!e&&r.current&&(r.current=null)}),[t]),r.current?Ut(t,r.current):an}function fr(t){return(0,e.useMemo)((()=>t?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(t):null),[t])}const gr=[];const hr=[{sensor:Yn,options:{}},{sensor:Gn,options:{}}],mr={current:{}},vr={draggable:{measure:bn},droppable:{measure:bn,strategy:or.WhileDragging,frequency:ar.Optimized},dragOverlay:{measure:vn}};class br extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const yr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new br,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vr,measureDroppableContainers:rn,windowRect:null,measuringScheduled:!1},wr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:rn,draggableNodes:new Map,over:null,measureDroppableContainers:rn},xr=(0,e.createContext)(wr),kr=(0,e.createContext)(yr);function Er(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new br}}}function Cr(e,t){switch(t.type){case nn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case nn.DragEnd:case nn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new br(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case nn.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new br(e.droppable.containers);return i.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case nn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new br(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Sr(t){let{disabled:n}=t;const{active:r,activatorEvent:o,draggableNodes:a}=(0,e.useContext)(xr),i=jt(o),l=jt(null==r?void 0:r.id);return(0,e.useEffect)((()=>{if(!n&&!o&&i&&null!=l){if(!Vt(i))return;if(document.activeElement===i.target)return;const e=a.get(l);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=qt(e);if(t){t.focus();break}}}))}}),[o,n,a,l,i]),null}const _r=(0,e.createContext)({...an,scaleX:1,scaleY:1});var Rr;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Rr||(Rr={}));const Dr=(0,e.memo)((function(n){var r,o,a,i;let{id:l,accessibility:s,autoScroll:c=!0,children:u,sensors:d=hr,collisionDetection:p=pn,measuring:f,modifiers:g,...h}=n;const m=(0,e.useReducer)(Cr,void 0,Er),[v,b]=m,[y,w]=function(){const[t]=(0,e.useState)((()=>new Set)),n=(0,e.useCallback)((e=>(t.add(e),()=>t.delete(e))),[t]);return[(0,e.useCallback)((e=>{let{type:n,event:r}=e;t.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[t]),n]}(),[x,k]=(0,e.useState)(Rr.Uninitialized),E=x===Rr.Initialized,{draggable:{active:C,nodes:S,translate:_},droppable:{containers:R}}=v,D=C?S.get(C):null,O=(0,e.useRef)({initial:null,translated:null}),A=(0,e.useMemo)((()=>{var e;return null!=C?{id:C,data:null!=(e=null==D?void 0:D.data)?e:mr,rect:O}:null}),[C,D]),T=(0,e.useRef)(null),[M,I]=(0,e.useState)(null),[N,L]=(0,e.useState)(null),P=Nt(h,Object.values(h)),j=Bt("DndDescribedBy",l),z=(0,e.useMemo)((()=>R.getEnabled()),[R]),B=($=f,(0,e.useMemo)((()=>({draggable:{...vr.draggable,...null==$?void 0:$.draggable},droppable:{...vr.droppable,...null==$?void 0:$.droppable},dragOverlay:{...vr.dragOverlay,...null==$?void 0:$.dragOverlay}})),[null==$?void 0:$.draggable,null==$?void 0:$.droppable,null==$?void 0:$.dragOverlay]));var $;const{droppableRects:F,measureDroppableContainers:U,measuringScheduled:V}=function(t,n){let{dragging:r,dependencies:o,config:a}=n;const[i,l]=(0,e.useState)(null),{frequency:s,measure:c,strategy:u}=a,d=(0,e.useRef)(t),p=function(){switch(u){case or.Always:return!1;case or.BeforeDragging:return r;default:return!r}}(),f=Nt(p),g=(0,e.useCallback)((function(e){void 0===e&&(e=[]),f.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[f]),h=(0,e.useRef)(null),m=Lt((e=>{if(p&&!r)return ir;if(!e||e===ir||d.current!==t||null!=i){const e=new Map;for(let n of t){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){e.set(n.id,n.rect.current);continue}const t=n.node.current,r=t?new Nn(c(t),t):null;n.rect.current=r,r&&e.set(n.id,r)}return e}return e}),[t,i,r,p,c]);return(0,e.useEffect)((()=>{d.current=t}),[t]),(0,e.useEffect)((()=>{p||g()}),[r,p]),(0,e.useEffect)((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),(0,e.useEffect)((()=>{p||"number"!=typeof s||null!==h.current||(h.current=setTimeout((()=>{g(),h.current=null}),s))}),[s,p,g,...o]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:null!=i}}(z,{dragging:E,dependencies:[_.x,_.y],config:B.droppable}),G=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return Lt((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(S,C),H=(0,e.useMemo)((()=>N?Gt(N):null),[N]),W=function(){const e=!1===(null==M?void 0:M.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,n=E&&!e&&!t;return"object"==typeof c?{...c,enabled:n}:{enabled:n}}(),q=function(e,t){return lr(e,t)}(G,B.draggable.measure);!function(t){let{activeNode:n,measure:r,initialRect:o,config:a=!0}=t;const i=(0,e.useRef)(!1),{x:l,y:s}="boolean"==typeof a?{x:a,y:a}:a;Mt((()=>{if(!l&&!s||!n)return void(i.current=!1);if(i.current||!o)return;const e=null==n?void 0:n.node.current;if(!e||!1===e.isConnected)return;const t=fn(r(e),o);if(l||(t.x=0),s||(t.y=0),i.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){const n=wn(e);n&&n.scrollBy({top:t.y,left:t.x})}}),[n,l,s,o,r])}({activeNode:C?S.get(C):null,config:W.layoutShiftCompensation,initialRect:q,measure:B.draggable.measure});const X=ur(G,B.draggable.measure,q),Y=ur(G?G.parentElement:null),K=(0,e.useRef)({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),J=R.getNodeFor(null==(r=K.current.over)?void 0:r.id),Z=function(t){let{measure:n}=t;const[r,o]=(0,e.useState)(null),a=sr({callback:(0,e.useCallback)((e=>{for(const{target:t}of e)if(At(t)){o((e=>{const r=n(t);return e?{...e,width:r.width,height:r.height}:r}));break}}),[n])}),i=(0,e.useCallback)((e=>{const t=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return At(t)?t:e}(e);null==a||a.disconnect(),t&&(null==a||a.observe(t)),o(t?n(t):null)}),[n,a]),[l,s]=Pt(i);return(0,e.useMemo)((()=>({nodeRef:l,rect:r,setRef:s})),[r,l,s])}({measure:B.dragOverlay.measure}),Q=null!=(o=Z.nodeRef.current)?o:G,ee=E?null!=(a=Z.rect)?a:X:null,te=Boolean(Z.nodeRef.current&&Z.rect),ne=fn(re=te?null:X,lr(re));var re;const oe=fr(Q?Dt(Q):null),ae=function(t){const n=(0,e.useRef)(t),r=Lt((e=>t?e&&e!==dr&&t&&n.current&&t.parentNode===n.current.parentNode?e:yn(t):dr),[t]);return(0,e.useEffect)((()=>{n.current=t}),[t]),r}(E?null!=J?J:G:null),ie=function(t,n){void 0===n&&(n=vn);const[r]=t,o=fr(r?Dt(r):null),[a,i]=(0,e.useReducer)((function(){return t.length?t.map((e=>Rn(e)?o:new Nn(n(e),e))):gr}),gr),l=sr({callback:i});return t.length>0&&a===gr&&i(),Mt((()=>{t.length?t.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),i())}),[t]),a}(ae),le=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(g,{transform:{x:_.x-ne.x,y:_.y-ne.y,scaleX:1,scaleY:1},activatorEvent:N,active:A,activeNodeRect:X,containerNodeRect:Y,draggingNodeRect:ee,over:K.current.over,overlayNodeRect:Z.rect,scrollableAncestors:ae,scrollableAncestorRects:ie,windowRect:oe}),se=H?Ft(H,_):null,ce=function(t){const[n,r]=(0,e.useState)(null),o=(0,e.useRef)(t),a=(0,e.useCallback)((e=>{const t=xn(e.target);t&&r((e=>e?(e.set(t,Cn(t)),new Map(e)):null))}),[]);return(0,e.useEffect)((()=>{const e=o.current;if(t!==e){n(e);const i=t.map((e=>{const t=xn(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Cn(t)]):null})).filter((e=>null!=e));r(i.length?new Map(i):null),o.current=t}return()=>{n(t),n(e)};function n(e){e.forEach((e=>{const t=xn(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,t]),(0,e.useMemo)((()=>t.length?n?Array.from(n.values()).reduce(((e,t)=>Ft(e,t)),an):Mn(t):an),[t,n])}(ae),ue=pr(ce),de=pr(ce,[X]),pe=Ft(le,ue),fe=ee?hn(ee,le):null,ge=A&&fe?p({active:A,collisionRect:fe,droppableRects:F,droppableContainers:z,pointerCoordinates:se}):null,he=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n.id}(ge),[me,ve]=(0,e.useState)(null),be=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?le:Ft(le,de),null!=(i=null==me?void 0:me.rect)?i:null,X),ye=(0,e.useCallback)(((e,t)=>{let{sensor:n,options:r}=t;if(null==T.current)return;const o=S.get(T.current);if(!o)return;const a=e.nativeEvent,i=new n({active:T.current,activeNode:o,event:a,options:r,context:K,onStart(e){const t=T.current;if(null==t)return;const n=S.get(t);if(!n)return;const{onDragStart:r}=P.current,o={active:{id:t,data:n.data,rect:O}};(0,Ct.unstable_batchedUpdates)((()=>{null==r||r(o),k(Rr.Initializing),b({type:nn.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:o})}))},onMove(e){b({type:nn.DragMove,coordinates:e})},onEnd:l(nn.DragEnd),onCancel:l(nn.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=K.current;let i=null;if(t&&o){const{cancelDrop:l}=P.current;i={activatorEvent:a,active:t,collisions:n,delta:o,over:r},e===nn.DragEnd&&"function"==typeof l&&await Promise.resolve(l(i))&&(e=nn.DragCancel)}T.current=null,(0,Ct.unstable_batchedUpdates)((()=>{b({type:e}),k(Rr.Uninitialized),ve(null),I(null),L(null);const t=e===nn.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=P.current[t];null==e||e(i),y({type:t,event:i})}}))}}(0,Ct.unstable_batchedUpdates)((()=>{I(i),L(e.nativeEvent)}))}),[S]),we=(0,e.useCallback)(((e,t)=>(n,r)=>{const o=n.nativeEvent,a=S.get(r);if(null!==T.current||!a||o.dndKit||o.defaultPrevented)return;const i={active:a};!0===e(n,t.options,i)&&(o.dndKit={capturedBy:t.sensor},T.current=r,ye(n,t))}),[S,ye]),xe=function(t,n){return(0,e.useMemo)((()=>t.reduce(((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:n(e.handler,t)})))]}),[])),[t,n])}(d,we);!function(t){(0,e.useEffect)((()=>{if(!St)return;const e=t.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const t of e)null==t||t()}}),t.map((e=>{let{sensor:t}=e;return t})))}(d),Mt((()=>{X&&x===Rr.Initializing&&k(Rr.Initialized)}),[X,x]),(0,e.useEffect)((()=>{const{onDragMove:e}=P.current,{active:t,activatorEvent:n,collisions:r,over:o}=K.current;if(!t||!n)return;const a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:o};(0,Ct.unstable_batchedUpdates)((()=>{null==e||e(a),y({type:"onDragMove",event:a})}))}),[pe.x,pe.y]),(0,e.useEffect)((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=K.current;if(!e||null==T.current||!t||!o)return;const{onDragOver:a}=P.current,i=r.get(he),l=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};(0,Ct.unstable_batchedUpdates)((()=>{ve(l),null==a||a(s),y({type:"onDragOver",event:s})}))}),[he]),Mt((()=>{K.current={activatorEvent:N,active:A,activeNode:G,collisionRect:fe,collisions:ge,droppableRects:F,draggableNodes:S,draggingNode:Q,draggingNodeRect:ee,droppableContainers:R,over:me,scrollableAncestors:ae,scrollAdjustedTranslate:pe},O.current={initial:ee,translated:fe}}),[A,G,ge,fe,S,Q,ee,F,R,me,ae,pe]),function(t){let{acceleration:n,activator:r=tr.Pointer,canScroll:o,draggingRect:a,enabled:i,interval:l=5,order:s=nr.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:p,threshold:f}=t;const g=function(e){let{delta:t,disabled:n}=e;const r=jt(t);return Lt((e=>{if(n||!r||!e)return rr;const o=Math.sign(t.x-r.x),a=Math.sign(t.y-r.y);return{x:{[Sn.Backward]:e.x[Sn.Backward]||-1===o,[Sn.Forward]:e.x[Sn.Forward]||1===o},y:{[Sn.Backward]:e.y[Sn.Backward]||-1===a,[Sn.Forward]:e.y[Sn.Forward]||1===a}}}),[n,t,r])}({delta:p,disabled:!i}),[h,m]=function(){const t=(0,e.useRef)(null);return[(0,e.useCallback)(((e,n)=>{t.current=setInterval(e,n)}),[]),(0,e.useCallback)((()=>{null!==t.current&&(clearInterval(t.current),t.current=null)}),[])]}(),v=(0,e.useRef)({x:0,y:0}),b=(0,e.useRef)({x:0,y:0}),y=(0,e.useMemo)((()=>{switch(r){case tr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case tr.DraggableRect:return a}}),[r,a,c]),w=(0,e.useRef)(null),x=(0,e.useCallback)((()=>{const e=w.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)}),[]),k=(0,e.useMemo)((()=>s===nr.TreeOrder?[...u].reverse():u),[s,u]);(0,e.useEffect)((()=>{if(i&&u.length&&y){for(const e of k){if(!1===(null==o?void 0:o(e)))continue;const t=u.indexOf(e),r=d[t];if(!r)continue;const{direction:a,speed:i}=An(e,r,y,n,f);for(const e of["x","y"])g[e][a[e]]||(i[e]=0,a[e]=0);if(i.x>0||i.y>0)return m(),w.current=e,h(x,l),v.current=i,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},m()}else m()}),[n,x,o,m,i,l,JSON.stringify(y),JSON.stringify(g),h,u,k,d,JSON.stringify(f)])}({...W,delta:_,draggingRect:fe,pointerCoordinates:se,scrollableAncestors:ae,scrollableAncestorRects:ie});const ke=(0,e.useMemo)((()=>({active:A,activeNode:G,activeNodeRect:X,activatorEvent:N,collisions:ge,containerNodeRect:Y,dragOverlay:Z,draggableNodes:S,droppableContainers:R,droppableRects:F,over:me,measureDroppableContainers:U,scrollableAncestors:ae,scrollableAncestorRects:ie,measuringConfiguration:B,measuringScheduled:V,windowRect:oe})),[A,G,X,N,ge,Y,Z,S,R,F,me,U,ae,ie,B,V,oe]),Ee=(0,e.useMemo)((()=>({activatorEvent:N,activators:xe,active:A,activeNodeRect:X,ariaDescribedById:{draggable:j},dispatch:b,draggableNodes:S,over:me,measureDroppableContainers:U})),[N,xe,A,X,b,j,S,me,U]);return t().createElement(Zt.Provider,{value:w},t().createElement(xr.Provider,{value:Ee},t().createElement(kr.Provider,{value:ke},t().createElement(_r.Provider,{value:be},u)),t().createElement(Sr,{disabled:!1===(null==s?void 0:s.restoreFocus)})),t().createElement(tn,{...s,hiddenTextDescribedById:j}))})),Or=(0,e.createContext)(null),Ar="button",Tr="Droppable";const Mr={timeout:25},Ir=e=>{let{transform:t}=e;return{...t,x:0}};function Nr(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Lr(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function Pr(e){return null!==e&&e>=0}const jr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=Nr(t,r,n),i=t[o],l=a[o];return l&&i?{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}:null},zr={scaleX:1,scaleY:1},Br=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:a,overIndex:i}=e;const l=null!=(t=a[n])?t:r;if(!l)return null;if(o===n){const e=a[i];return e?{x:0,y:nn&&o<=i?{x:0,y:-l.height-s,...zr}:o=i?{x:0,y:l.height+s,...zr}:{x:0,y:0,...zr}},$r="Sortable",Fr=t().createContext({activeIndex:-1,containerId:$r,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jr,disabled:{draggable:!1,droppable:!1}});function Ur(n){let{children:r,id:o,items:a,strategy:i=jr,disabled:l=!1}=n;const{active:s,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:p}=(0,e.useContext)(kr),f=Bt($r,o),g=Boolean(null!==c.rect),h=(0,e.useMemo)((()=>a.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[a]),m=null!=s,v=s?h.indexOf(s.id):-1,b=d?h.indexOf(d.id):-1,y=(0,e.useRef)(h),w=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{w&&m&&p(h)}),[w,h,m,p]),(0,e.useEffect)((()=>{y.current=h}),[h]);const E=(0,e.useMemo)((()=>({activeIndex:v,containerId:f,disabled:k,disableTransforms:x,items:h,overIndex:b,useDragOverlay:g,sortedRects:Lr(h,u),strategy:i})),[v,f,k.draggable,k.droppable,x,h,b,u,g,i]);return t().createElement(Fr.Provider,{value:E},r)}const Vr=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Nr(n,r,o).indexOf(t)},Gr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:s,transition:c}=e;return!(!c||!r||l!==a&&o===i||!n&&(i===o||t!==s))},Hr={duration:200,easing:"ease"},Wr="transform",qr=Ht.Transition.toString({property:Wr,duration:0,easing:"linear"}),Xr={roleDescription:"sortable"};function Yr(t){let{animateLayoutChanges:n=Gr,attributes:r,disabled:o,data:a,getNewIndex:i=Vr,id:l,strategy:s,resizeObserverConfig:c,transition:u=Hr}=t;const{items:d,containerId:p,activeIndex:f,disabled:g,disableTransforms:h,sortedRects:m,overIndex:v,useDragOverlay:b,strategy:y}=(0,e.useContext)(Fr),w=function(e,t){var n,r;return"boolean"==typeof e?{draggable:e,droppable:!1}:{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(o,g),x=d.indexOf(l),k=(0,e.useMemo)((()=>({sortable:{containerId:p,index:x,items:d},...a})),[p,a,x,d]),E=(0,e.useMemo)((()=>d.slice(d.indexOf(l))),[d,l]),{rect:C,node:S,isOver:_,setNodeRef:R}=function(t){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:a}=t;const i=Bt("Droppable"),{active:l,dispatch:s,over:c,measureDroppableContainers:u}=(0,e.useContext)(xr),d=(0,e.useRef)({disabled:r}),p=(0,e.useRef)(!1),f=(0,e.useRef)(null),g=(0,e.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:v}={...Mr,...a},b=Nt(null!=m?m:o),y=sr({callback:(0,e.useCallback)((()=>{p.current?(null!=g.current&&clearTimeout(g.current),g.current=setTimeout((()=>{u(Array.isArray(b.current)?b.current:[b.current]),g.current=null}),v)):p.current=!0}),[v]),disabled:h||!l}),w=(0,e.useCallback)(((e,t)=>{y&&(t&&(y.unobserve(t),p.current=!1),e&&y.observe(e))}),[y]),[x,k]=Pt(w),E=Nt(n);return(0,e.useEffect)((()=>{y&&x.current&&(y.disconnect(),p.current=!1,y.observe(x.current))}),[x,y]),Mt((()=>(s({type:nn.RegisterDroppable,element:{id:o,key:i,disabled:r,node:x,rect:f,data:E}}),()=>s({type:nn.UnregisterDroppable,key:i,id:o}))),[o]),(0,e.useEffect)((()=>{r!==d.current.disabled&&(s({type:nn.SetDroppableDisabled,id:o,key:i,disabled:r}),d.current.disabled=r)}),[o,i,r,s]),{active:l,rect:f,isOver:(null==c?void 0:c.id)===o,node:x,over:c,setNodeRef:k}}({id:l,data:k,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:D,activatorEvent:O,activeNodeRect:A,attributes:T,setNodeRef:M,listeners:I,isDragging:N,over:L,setActivatorNodeRef:P,transform:j}=function(t){let{id:n,data:r,disabled:o=!1,attributes:a}=t;const i=Bt(Tr),{activators:l,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:p,over:f}=(0,e.useContext)(xr),{role:g=Ar,roleDescription:h="draggable",tabIndex:m=0}=null!=a?a:{},v=(null==c?void 0:c.id)===n,b=(0,e.useContext)(v?_r:Or),[y,w]=Pt(),[x,k]=Pt(),E=function(t,n){return(0,e.useMemo)((()=>t.reduce(((e,t)=>{let{eventName:r,handler:o}=t;return e[r]=e=>{o(e,n)},e}),{})),[t,n])}(l,n),C=Nt(r);return Mt((()=>(p.set(n,{id:n,key:i,node:y,activatorNode:x,data:C}),()=>{const e=p.get(n);e&&e.key===i&&p.delete(n)})),[p,n]),{active:c,activatorEvent:s,activeNodeRect:u,attributes:(0,e.useMemo)((()=>({role:g,tabIndex:m,"aria-disabled":o,"aria-pressed":!(!v||g!==Ar)||void 0,"aria-roledescription":h,"aria-describedby":d.draggable})),[o,g,m,v,h,d.draggable]),isDragging:v,listeners:o?void 0:E,node:y,over:f,setNodeRef:w,setActivatorNodeRef:k,transform:b}}({id:l,data:k,attributes:{...Xr,...r},disabled:w.draggable}),z=function(){for(var t=arguments.length,n=new Array(t),r=0;re=>{n.forEach((t=>t(e)))}),n)}(R,M),B=Boolean(D),$=B&&!h&&Pr(f)&&Pr(v),F=!b&&N,U=F&&$?j:null,V=$?null!=U?U:(null!=s?s:y)({rects:m,activeNodeRect:A,activeIndex:f,overIndex:v,index:x}):null,G=Pr(f)&&Pr(v)?i({id:l,items:d,activeIndex:f,overIndex:v}):x,H=null==D?void 0:D.id,W=(0,e.useRef)({activeId:H,items:d,newIndex:G,containerId:p}),q=d!==W.current.items,X=n({active:D,containerId:p,isDragging:N,isSorting:B,id:l,index:x,items:d,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:u,wasDragging:null!=W.current.activeId}),Y=function(t){let{disabled:n,index:r,node:o,rect:a}=t;const[i,l]=(0,e.useState)(null),s=(0,e.useRef)(r);return Mt((()=>{if(!n&&r!==s.current&&o.current){const e=a.current;if(e){const t=vn(o.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&l(n)}}r!==s.current&&(s.current=r)}),[n,r,o,a]),(0,e.useEffect)((()=>{i&&l(null)}),[i]),i}({disabled:!X,index:x,node:S,rect:C});return(0,e.useEffect)((()=>{B&&W.current.newIndex!==G&&(W.current.newIndex=G),p!==W.current.containerId&&(W.current.containerId=p),d!==W.current.items&&(W.current.items=d)}),[B,G,p,d]),(0,e.useEffect)((()=>{if(H===W.current.activeId)return;if(H&&!W.current.activeId)return void(W.current.activeId=H);const e=setTimeout((()=>{W.current.activeId=H}),50);return()=>clearTimeout(e)}),[H]),{active:D,activeIndex:f,attributes:T,data:k,rect:C,index:x,newIndex:G,items:d,isOver:_,isSorting:B,isDragging:N,listeners:I,node:S,overIndex:v,over:L,setNodeRef:z,setActivatorNodeRef:P,setDroppableNodeRef:R,setDraggableNodeRef:M,transform:null!=Y?Y:V,transition:Y||q&&W.current.newIndex===x?qr:F&&!Vt(O)||!u?void 0:B||X?Ht.Transition.toString({...u,property:Wr}):void 0}}zn.Down,zn.Right,zn.Up,zn.Left;const Kr=({children:t,id:n})=>{const{attributes:r,listeners:o,transform:a,transition:i,setNodeRef:l}=Yr({id:n}),s={transform:Ht.Transform.toString(a),transition:i};return(0,e.createElement)("tr",{ref:l,style:s},(0,e.createElement)(e.Fragment,null,(0,e.createElement)("td",{style:{width:"1%"}},(0,e.createElement)(xt,{icon:Et,size:14,className:"sortable-table__handle",...r,...o})),t))},Jr=Oe.table` background: #fff; border: 0; border-radius: 3px; box-shadow: 0 0 0 1px rgb( 0 0 0 / 10% ); border-spacing: 0; width: 100%; clear: both; margin: 0; font-size: 14px; .align-left { text-align: left; .components-flex { justify-content: flex-start; gap: 0; } } .align-right { text-align: right; .components-flex { justify-content: flex-end; gap: 0; } } .align-center { text-align: center; > * { margin: 0 auto; } .components-flex { display: block; } } .sortable-table__handle { cursor: move; } th { position: relative; color: #2c3338; text-align: left; vertical-align: middle; vertical-align: top; word-wrap: break-word; } tbody { td { vertical-align: top; margin-bottom: 9px; } } tfoot { td { text-align: left; vertical-align: middle; } } thead, tfoot, tbody { td, th { border-top: 1px solid rgb( 0 0 0 / 10% ); border-bottom: 1px solid rgb( 0 0 0 / 10% ); padding: 16px 0 16px 24px; line-height: 1.5; &:last-child { padding-right: 24px; } > svg, > .components-base-control { margin: 3px 0; } } } thead th { border-top: 0; } tfoot td { border-bottom: 0; } `,Zr=({columns:t,data:n,setData:o,className:a,footerContent:i,placeholder:l})=>{const s=(0,r.useMemo)((()=>n.map((({id:e})=>e))),[n]),c=function(){for(var t=arguments.length,n=new Array(t),r=0;r[...n].filter((e=>null!=e))),[...n])}(on(Zn,{}),on(er,{}),on(Gn,{})),u=(e,t)=>{const n=(null==e?void 0:e.align)||"left",r=(null==e?void 0:e.width)||"auto";return{className:`${t}-${e.name} align-${n}`,style:{width:r}}};return(0,e.createElement)(Dr,{sensors:c,onDragEnd:function(e){const{active:t,over:r}=e;if(null!==t&&null!==r&&(null==t?void 0:t.id)!==(null==r?void 0:r.id)){const e=Nr(n,s.indexOf(t.id),s.indexOf(r.id));o(e)}},collisionDetection:un,modifiers:[Ir]},(0,e.createElement)(Jr,{className:`${a} sortable-table`},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,t.map(((t,n)=>(0,e.createElement)("th",{key:t.name,...u(t,"sortable-table__column"),colSpan:0===n?2:1},t.label))))),i&&(0,e.createElement)("tfoot",null,(0,e.createElement)("tr",null,(0,e.createElement)("td",{colSpan:t.length+1},(0,e.createElement)(i,null)))),(0,e.createElement)("tbody",null,(0,e.createElement)(Ur,{items:s,strategy:Br},n.length?n.map((n=>n&&(0,e.createElement)(Kr,{key:n.id,id:n.id,className:a},t.map((t=>{return(0,e.createElement)("td",{key:`${n.id}-${t.name}`,...u(t,"sortable-table__column")},t.renderCallback?t.renderCallback(n):(0,e.createElement)(e.Fragment,null,(r=n,o=t.name,it(r)&&o in r&&n[t.name])));var r,o}))))):(0,e.createElement)("tr",null,(0,e.createElement)("td",{colSpan:t.length+1},l))))))},Qr=Oe(We.Modal)` max-width: 600px; border-radius: 4px; @media ( min-width: 600px ) { min-width: 560px; } .components-modal__header { padding: 12px 24px; border-bottom: 1px solid #e0e0e0; position: relative; height: auto; width: auto; margin: 0 -24px 16px; @media ( max-width: 599px ) { button { display: none; } } } .components-modal__content { margin: 0; padding: 0 24px; @media ( max-width: 599px ) { display: flex; flex-direction: column; hr:last-of-type { margin-top: auto; } } .components-base-control { label { margin-top: 8px; text-transform: none !important; } } } `,eo=Oe.div` display: flex; justify-content: flex-end; border-top: 1px solid #e0e0e0; margin: 24px -24px 0; padding: 24px; > * { &:not( :first-of-type ) { margin-left: 8px; } } .button-link-delete { margin-right: auto; color: #d63638; } `,to=({children:t,actions:n,title:r,onRequestClose:o,...a})=>(0,e.createElement)(Qr,{title:r,onRequestClose:o,...a},t,(0,e.createElement)(eo,null,n)),no=({formRef:t,values:n,setValues:r})=>{const{country:o,state:a}=n.address,i=e=>t=>{r((n=>({...n,[e]:t})))},l=e=>t=>{r((n=>({...n,address:{...n.address,[e]:t}})))},s=ft[o]&&Object.keys(ft[o]).length>0;return(0,e.createElement)("form",{ref:t},(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("Location name","woocommerce"),name:"location_name",value:n.name,onChange:i("name"),autoComplete:"off",required:!0,onInvalid:e=>{e.target.setCustomValidity((0,Ae.__)("A Location title is required","woocommerce"))},onInput:e=>{e.target.setCustomValidity("")}}),(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("Address","woocommerce"),name:"location_address",placeholder:(0,Ae.__)("Address","woocommerce"),value:n.address.address_1,onChange:l("address_1"),autoComplete:"off"}),(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("City","woocommerce"),name:"location_city",hideLabelFromVision:!0,placeholder:(0,Ae.__)("City","woocommerce"),value:n.address.city,onChange:l("city"),autoComplete:"off"}),(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("Postcode / ZIP","woocommerce"),name:"location_postcode",hideLabelFromVision:!0,placeholder:(0,Ae.__)("Postcode / ZIP","woocommerce"),value:n.address.postcode,onChange:l("postcode"),autoComplete:"off"}),!s&&(0,e.createElement)(We.TextControl,{placeholder:(0,Ae.__)("State","woocommerce"),value:a,onChange:l("state")}),(0,e.createElement)(We.SelectControl,{name:"location_country_state",label:(0,Ae.__)("Country / State","woocommerce"),hideLabelFromVision:!0,placeholder:(0,Ae.__)("Country / State","woocommerce"),value:!a&&s?`${o}:${Object.keys(ft[o])[0]}`:`${o}${a&&null!==(c=ft[o])&&void 0!==c&&c[a]?":"+a:""}`,onChange:e=>{const[t,n=""]=e.split(":");l("country")(t),l("state")(n)}},gt.options.map((t=>t.label?(0,e.createElement)("optgroup",{key:t.label,label:t.label},t.options.map((t=>(0,e.createElement)("option",{key:t.value,value:t.value},t.label)))):(0,e.createElement)("option",{key:t.options[0].value,value:t.options[0].value},t.options[0].label)))),(0,e.createElement)(We.TextControl,{label:(0,Ae.__)("Pickup details","woocommerce"),name:"pickup_details",value:n.details,onChange:i("details"),autoComplete:"off"}));var c},ro=({locationData:t,editingLocation:n,onClose:o,onSave:a,onDelete:i})=>{const l=(0,r.useRef)(null),[s,c]=(0,r.useState)(t);return t?(0,e.createElement)(to,{onRequestClose:o,title:"new"===n?(0,Ae.__)("Pickup location","woocommerce"):(0,Ae.__)("Edit pickup location","woocommerce"),actions:(0,e.createElement)(e.Fragment,null,"new"!==n&&(0,e.createElement)(We.Button,{variant:"link",className:"button-link-delete",onClick:()=>{i(),o()}},(0,Ae.__)("Delete location","woocommerce")),(0,e.createElement)(We.Button,{variant:"secondary",onClick:o},(0,Ae.__)("Cancel","woocommerce")),(0,e.createElement)(We.Button,{variant:"primary",onClick:()=>{(null==l?void 0:l.current).reportValidity()&&(a(s),o())}},(0,Ae.__)("Done","woocommerce")))},(0,e.createElement)(no,{formRef:l,values:s,setValues:c})):null},oo=()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",null,(0,Ae.__)("Pickup locations","woocommerce")),(0,e.createElement)("p",null,(0,Ae.__)("Define pickup locations for your customers to choose from during checkout.","woocommerce")),(0,e.createElement)(We.ExternalLink,{href:"https://woocommerce.com/document/woocommerce-blocks-local-pickup/"},(0,Ae.__)("Learn more","woocommerce"))),ao=Oe.address` color: #757575; font-style: normal; display: inline; margin-left: 12px; `,io=()=>{const{pickupLocations:t,setPickupLocations:n,toggleLocation:o,updateLocation:a,readOnlySettings:i}=mt(),[l,s]=(0,r.useState)(""),c=[{name:"name",label:(0,Ae.__)("Pickup location","woocommerce"),width:"50%",renderCallback:t=>(0,e.createElement)(e.Fragment,null,t.name,(0,e.createElement)(ao,null,(e=>{var t;const n=it(e)&&{...e,country:"string"==typeof e.country&&pt[e.country],state:"string"==typeof e.country&&"string"==typeof e.state&&null!==(t=ft[e.country])&&void 0!==t&&t[e.state]?ft[e.country][e.state]:e.state};return Object.values(n).filter((e=>""!==e)).join(", ")})(t.address)))},{name:"enabled",label:(0,Ae.__)("Enabled","woocommerce"),align:"right",renderCallback:t=>{return(0,e.createElement)(We.ToggleControl,{checked:(n=t.enabled,"boolean"==typeof n&&t.enabled),onChange:()=>o(t.id)});var n}},{name:"edit",label:"",align:"center",width:"1%",renderCallback:t=>(0,e.createElement)("button",{type:"button",className:"button-link-edit button-link",onClick:()=>{s(t.id)}},(0,Ae.__)("Edit","woocommerce"))}];return(0,e.createElement)(Ke,{Description:oo},(0,e.createElement)(Zr,{className:"pickup-locations",columns:c,data:t,setData:e=>{n(e)},placeholder:(0,Ae.__)("When you add a pickup location, it will appear here.","woocommerce"),footerContent:()=>(0,e.createElement)(We.Button,{variant:"secondary",onClick:()=>{s("new")}},(0,Ae.__)("Add pickup location","woocommerce"))}),l&&(0,e.createElement)(ro,{locationData:"new"===l?{name:"",details:"",enabled:!0,address:{address_1:"",city:"",state:i.storeState,postcode:"",country:i.storeCountry}}:t.find((({id:e})=>e===l))||null,editingLocation:l,onSave:e=>{a(l,e)},onClose:()=>s(""),onDelete:()=>{a(l,null),s("")}}))},lo=Oe(Ke)` text-align: right; padding-top: 0; margin-top: 0; `,so=()=>{const{isSaving:t,save:n}=mt();return(0,e.createElement)(lo,{className:"submit"},(0,e.createElement)(We.Button,{variant:"primary",isBusy:t,disabled:t,onClick:e=>{var t;e.preventDefault();const r=e.target;null!=r&&null!==(t=r.form)&&void 0!==t&&t.reportValidity()&&n()},type:"submit"},(0,Ae.__)("Save changes","woocommerce")))},co=Oe.form` margin: 48px auto 0; max-width: 1032px; display: flex; flex-flow: column; @media ( min-width: 960px ) { padding: 0 56px; } `,uo=document.getElementById("wc-shipping-method-pickup-location-settings-container");uo&&(0,r.render)((0,e.createElement)((()=>(0,e.createElement)(co,{id:"local-pickup-settings"},(0,e.createElement)(vt,null,(0,e.createElement)(wt,null),(0,e.createElement)(io,null),(0,e.createElement)(so,null)))),null),uo)})()})();