UNPKG

@silk-hq/components

Version:

UI Components by Silk

3 lines (2 loc) 136 kB
/* @silk-hq/components | (c) 2025 Bruno Stasse | SEE LICENSE FILE */ let e,t;import{jsx as n,jsxs as a,Fragment as r}from"react/jsx-runtime";import l from"react-dom";import i,{useContext as s,useMemo as o,useRef as c,useState as u,useEffect as d,useCallback as m,useLayoutEffect as p,useId as g,forwardRef as h,Children as f,isValidElement as v,cloneElement as y,useImperativeHandle as S}from"react";let b="undefined"!=typeof window&&window.document&&window.document.createElement?p:d,k=e=>(t,n)=>"calc("+t+" + ("+n+" - "+t+") * "+e+")",T="undefined"!=typeof window?window.navigator.userAgent:null,w="unknown",A="unknown";if("undefined"!=typeof window&&navigator.userAgentData&&(navigator.userAgentData.brands.some(e=>"Chromium"===e.brand)&&(w="chromium"),"Android"===navigator.userAgentData.platform&&(A="android")),"unknown"===A&&(null==T?void 0:T.match(/android/i))&&(A="android"),"unknown"===w&&((null==T?void 0:T.match(/Chrome/i))?w="chromium":(null==T?void 0:T.match(/Firefox/i))?w="gecko":(null==T?void 0:T.match(/Safari|iPhone/i))&&(w="webkit")),"webkit"===w){if(null==T?void 0:T.match(/iPhone/i))A="ios";else if(null==T?void 0:T.match(/iPad/i))A="ipados";else if(null==T?void 0:T.match(/Macintosh/i))try{null==document||document.createEvent("TouchEvent"),A="ipados"}catch(e){A="macos"}}var E={};E={mapping:{Sheet:{componentName:"a",elementNames:{root:0,view:1,backdrop:2,backdropTrap:3,primaryScrollTrapRoot:4,secondaryScrollTrapRoot:5,scrollContainer:6,frontSpacer:7,backSpacer:8,detentMarker:9,contentWrapper:10,content:11,bleedingBackground:12,stickyContainer:13,sticky:14,leftEdge:15,trigger:16,handle:17,outlet:18},variationSetsNames:{openness:"A",staging:"B",opennessClosedStatus:"C",position:"D",positionCoveredStatus:"E",placement:"F",track:"G",swipeDisabled:"H",swipeOutDisabledWithDetent:"I",swipeOvershootDisabled:"J",bleedDisabled:"K",inertOutside:"L",backdropSwipeable:"M",scrollContainerShouldBePassThrough:"N",swipeTrap:"M"},variationValuesNames:{open:"a",opening:"b",closed:"c",closing:"d",none:"e",top:"f",bottom:"g",left:"h",right:"i",horizontal:"j",vertical:"k",front:"l",covered:"m",true:"o",false:"p",auto:"q",center:"r",pending:"s","flushing-to-preparing-open":"t","flushing-to-preparing-opening":"u","preparing-open":"v","preparing-opening":"x","safe-to-unmount":"y",content:"z",root:"aa","going-down":"ab","going-up":"ac",indeterminate:"ad",idle:"ae","come-back":"af",out:"ag",stepping:"ah",both:"ai",none:"aj"}},ScrollTrap:{componentName:"b",elementNames:{root:0,stabiliser:1},variationSetsNames:{active:"A",axis:"B",automaticallyDisabledForOptimisation:"C"},variationValuesNames:{true:"a",false:"b",horizontal:"e",vertical:"f",both:"g",none:"h"}},Scroll:{componentName:"c",elementNames:{root:0,view:1,scrollContainer:2,content:3,UAScrollbarMeasurer:4,spy:5,startSpacer:6,endSpacer:7},variationSetsNames:{axis:"A",contentPlacement:"B",scrollTrapX:"C",scrollTrapY:"D",scrollGestureOvershoot:"E",scrollDisabled:"F",side:"G",pageScroll:"H",overflowX:"I",overflowY:"J",skipScrollAnimation:"K",scrollAnchoring:"L",scrollSnapType:"M",scrollPadding:"N",scrollTimelineName:"O",nativeScrollbar:"P",scrollOngoing:"Q"},variationValuesNames:{true:"a",false:"b",x:"c",y:"d",both:"e",unset:"f",contain:"g",start:"h",end:"i",center:"j",auto:"k",default:"l",none:"m",mandatoryX:"n",mandatoryY:"o",proximityX:"p",proximityY:"q"}},SlideShow:{componentName:"d",elementNames:{},variationSetsNames:{},variationValuesNames:{}},VisuallyHidden:{componentName:"e",elementNames:{root:0},variationSetsNames:{},variationValuesNames:{}},SpecialWrapper:{componentName:"f",elementNames:{root:0,content:1},variationSetsNames:{},variationValuesNames:{}},Fixed:{componentName:"g",elementNames:{root:0},variationSetsNames:{},variationValuesNames:{}},SheetStack:{componentName:"h",elementNames:{root:0,outlet:1},variationSetsNames:{},variationValuesNames:{}},AutoFocusTarget:{componentName:"i",elementNames:{root:0},variationSetsNames:{},variationValuesNames:{}}}};let C=E.mapping,O=e=>{var t;return null!==(t=C[e].componentName)&&void 0!==t?t:null},x=(e,t)=>{var n;return null!==(n=C[e].elementNames[t])&&void 0!==n?n:null},P=(e,t)=>{var n;return null!==(n=C[e].variationSetsNames[t])&&void 0!==n?n:null},R=(e,t)=>{var n;return null!==(n=C[e].variationValuesNames[t])&&void 0!==n?n:null},I=(e,t)=>m((n,a=[],r)=>{var l,i;let s,o;let c=null!==(i=null==r?void 0:null===(l=r.dataSilk)||void 0===l?void 0:l.filter(Boolean).join(" "))&&void 0!==i?i:"";{let l=O(e);if(s=l+x(e,n),t)for(let n=0;n<a.length;n++){let r=a[n],i=t[r],o=P(e,r),c=R(e,i);s+=null!=i?" "+l+o+c:""}o={className:null==r?void 0:r.className,"data-silk":s+" "+c}}return o},[e,...t?Object.values(t):[]]),D=new WeakMap;var N="function"==typeof Float32Array;function L(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function _(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}function F(e){return e}var M=function(e,t,n,a){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error("bezier x values must be in [0, 1] range");if(e===t&&n===a)return F;for(var r=N?new Float32Array(11):Array(11),l=0;l<11;++l)r[l]=L(.1*l,e,n);return function(l){return 0===l||1===l?l:L(function(t){for(var a=0,l=1;10!==l&&r[l]<=t;++l)a+=.1;var i=a+(t-r[--l])/(r[l+1]-r[l])*.1,s=_(i,e,n);return s>=.001?function(e,t,n,a){for(var r=0;r<4;++r){var l=_(t,n,a);if(0===l)break;var i=L(t,n,a)-e;t-=i/l}return t}(t,i,e,n):0===s?i:function(e,t,n,a,r){var l,i,s=0;do(l=L(i=t+(n-t)/2,a,r)-e)>0?n=i:t=i;while(Math.abs(l)>1e-7&&++s<10)return i}(t,a,a+.1,e,n)}(l),t,a)}};let B=e=>"string"==typeof e?document.querySelector(e):null==e?void 0:e(),W=(e,t)=>Array.isArray(e)?e.includes(t):e===t,V=e=>(null==e?void 0:e.getAttribute("data-silk-clone"))==="true",$=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),U=e=>e instanceof HTMLInputElement&&!$.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable,Y=e=>e instanceof HTMLInputElement&&"color"===e.type||e instanceof HTMLSelectElement,X="undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,H=()=>{var e;return window.innerHeight-200>(null===(e=window.visualViewport)||void 0===e?void 0:e.height)};function G({nativeEvent:e,defaultBehavior:t,handler:n}){let a=t;if(n){if("function"==typeof n){let r={...t,nativeEvent:e,changeDefault:function(e){a={...t,...e},Object.assign(this,e)}};r.changeDefault=r.changeDefault.bind(r),n(r)}else a={...t,...n}}return a}function z(e){if((e.startsWith("rgb(")||e.startsWith("rgba("))&&e.endsWith(")")){let t=e.substring(e.indexOf("(")+1,e.indexOf(")")),n=t.split(",").map(e=>e.trim());return n.slice(0,3).map(e=>parseFloat(e))}return null}let j=e=>{let t=null;return e.startsWith("rgb(")||e.startsWith("rgba(")?t=z(e):e.startsWith("#")&&(t=function(e){let t=e.replace(/^#/,""),n=3===t.length?t.split("").map(e=>e+e).join(""):t;if(!/^[0-9A-Fa-f]{6}$/.test(n))return null;let a=parseInt(n.slice(0,2),16),r=parseInt(n.slice(2,4),16),l=parseInt(n.slice(4,6),16);return[a,r,l]}(e)),t},K=({color:e,overlays:t})=>{let n=[...e],a=t.length;for(let e=0;e<a;e++){let a=t[e],r=a.alpha;for(let e=0;e<3;e++)n[e]=(1-r)*n[e]+r*a.color[e]}return"rgb("+n.join(",")+")"},q=e=>{d(()=>{let t=()=>{H()?e(!0):e(!1)};return t(),visualViewport.addEventListener("resize",t),()=>{visualViewport.removeEventListener("resize",t)}},[e])},J=e=>e.matches('[data-silk~="0ad"]:not([data-silk~="0ai"]) *, [data-silk~="0ab"] *'),Z=e=>{let[t,n]=u(!1),a=m(t=>{e.current&&n(!!t&&!J(e.current))},[e]);return q(a),t},Q=()=>"android"===A&&"chromium"===w&&"undefined"!=typeof window&&!window.matchMedia("(display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen)").matches,ee=()=>{var e,t,n;return"undefined"!=typeof window&&window.navigator.standalone&&(null===(e=document.querySelector("meta[name='viewport']"))||void 0===e?void 0:e.content.includes("viewport-fit=cover"))&&(null===(t=document.querySelector("meta[name='apple-mobile-web-app-capable']"))||void 0===t?void 0:t.content)==="yes"&&(null===(n=document.querySelector("meta[name='apple-mobile-web-app-status-bar-style']"))||void 0===n?void 0:n.content)==="black-translucent"},et=()=>"webkit"===w,en=()=>"undefined"!=typeof document?document.querySelector('meta[name="theme-color"]'):null,ea=({genericContext:e,customContext:t,value:a,children:r})=>t?n(t.Provider,{value:a,children:n(e.Provider,{value:a,children:r})}):n(e.Provider,{value:a,children:r});ea.displayName="CustomisableContext";let er=(e,{duration:t,cubicBezier:n}={duration:500,cubicBezier:[.25,.1,.25,1]})=>{let a=M(...n),r=null,l=(e,n)=>{r||(r=e);let i=e-r,s=a(i/t);i<t?(n(s),requestAnimationFrame(()=>l(document.timeline.currentTime,n))):n(1)};l(document.timeline.currentTime,e)},el=e=>{let t=c(null);return b(()=>{t.current=e}),m((...e)=>{let n=t.current;return n(...e)},[])};function ei(e){for(let t=0;t<e.length;t++)if(!e[t].matches('[data-silk~="0ad"]'))return e[t];return e[0]}let es=(e,t)=>{var n;let{safelyFocusableElements:a,safelyTabbableElements:r}=eg(t,["[data-silk~='0ac']"]),l=eH.autoFocusTargets.filter(t=>"any"===t.layerId||t.layerId===e),i=l.filter(e=>W(e.timing,"present")),s=a.filter(e=>i.map(e=>e.element).includes(e)),o=ei(s),c=ei(r),u=null!==(n=null!=o?o:c)&&void 0!==n?n:t;u.focus({preventScroll:!0})},eo=(e,t,n)=>{let{focus:a}=G({nativeEvent:null,defaultBehavior:{focus:!0},handler:n});a&&es(e,t)},ec=(e,t,n,a)=>{if(!t.contains(document.activeElement)&&document.contains(document.activeElement))return;let{focus:r}=G({nativeEvent:null,defaultBehavior:{focus:!0},handler:n});if(r){var l;let n=eH.autoFocusTargets.filter(t=>"any"===t.layerId||t.layerId===e),r=n.filter(e=>W(e.timing,"dismiss")&&!t.contains(e.element)),{safelyFocusableElements:i}=eg(document.body),s=i.filter(e=>r.map(e=>e.element).includes(e)),o=ei(s),c=null!==(l=null!=o?o:a)&&void 0!==l?l:document.body;c.focus({preventScroll:!0})}},eu=e=>{null!=e.parentNode&&e.parentNode.removeChild(e)},ed=()=>{let e=document.createElement("div");return e.tabIndex=0,e.style.position="fixed",e.setAttribute("aria-hidden","true"),e.setAttribute("data-silk","0aa"),e},em=e=>{let t=ed(),n=ed();return e.insertAdjacentElement("beforebegin",t),e.insertAdjacentElement("afterend",n),()=>{eu(t),eu(n)}},ep=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),eg=(e,t=[])=>{let n=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]","[tabindex]:not([disabled])",...t],a=n.join(","),r=e?[...e.matches(a)?[e]:[],...e.querySelectorAll(a)]:[],l=[...t,"[aria-hidden='true']","[aria-hidden='true'] *","[inert]","[inert] *"],i=r.map(e=>({element:e,tabbable:e.matches(':not([hidden]):not([tabindex^="-"])'),skippable:e.matches(l.join(","))||!ep(e)})),s=i.filter(e=>!e.skippable),o=s.map(e=>e.element),c=i.filter(e=>e.tabbable),u=c.filter(e=>!e.skippable),d=u.map(e=>e.element);return{allFocusableElementsWithData:i,safelyFocusableElements:o,allTabbableElementsWithData:c,safelyTabbableElements:d}},eh=(e,t)=>{let{safelyTabbableElements:n,allTabbableElementsWithData:a,allFocusableElementsWithData:r}=eg(e,["[data-silk~='0ac']"]),l=[...a],i=[...r];return t&&[l,i].forEach(t=>{t.unshift({element:e.previousElementSibling,tabbable:!0,skippable:!0}),t.push({element:e.nextElementSibling,tabbable:!0,skippable:!0})}),{safelyTabbableElements:n,allTabbableElementsWithGuardsWithData:l,allFocusableElementsWithGuardsWithData:i}},ef=(e,t)=>{let n;return(n=t.slice(0,e).reverse().find(e=>!1===e.skippable))||(n=t.slice(e+1-t.length).reverse().find(e=>!1===e.skippable)),n},ev=(e,t)=>{let n;return(n=t.slice(e+1).find(e=>!1===e.skippable))||(n=t.slice(0,e).find(e=>!1===e.skippable)),n},ey=({rootElements:e,e:t,fromElement:n,toElement:a,fallbackElement:r})=>{if(!a)return;let l=[],i=[],s=[];e.forEach(e=>{let{safelyTabbableElements:t,allTabbableElementsWithGuardsWithData:n,allFocusableElementsWithGuardsWithData:a}=eh(e,!0);l=[...l,...t],i=[...i,...n],s=[...s,...a]});let o=i.findIndex(e=>e.element===n),c=i.findIndex(e=>e.element===a),u=i[c],d=s.findIndex(e=>e.element===a),m=!!a&&e.includes(a)&&"-1"===a.getAttribute("tabindex");if(-1===d&&!m){let t=e.find(e=>"-1"===e.getAttribute("tabindex"));null==t||t.focus()}if(null==u?void 0:u.skippable){var p,g,h;l.length?1===l.length?n===l[0]?(t.preventDefault(),t.stopPropagation(),requestAnimationFrame(()=>n.focus())):l[0].focus():o?c<o?null===(g=ef(c,i))||void 0===g||g.element.focus():null===(h=ev(c,i))||void 0===h||h.element.focus():null===(p=ev(c,i))||void 0===p||p.element.focus():null==r||r.focus()}},eS=(e,t,n,a,r)=>{var l;if(null===(l=e.target)||void 0===l?void 0:l.matches("[data-silk-clone]"))return;let i=[],s=[];n.forEach(e=>{let{safelyFocusableElements:t,safelyTabbableElements:n}=eg(e);i=[...i,...t],s=[...s,...n]}),n.includes(e.target)||i.includes(e.target)?e.target&&r(e.target):a?a.focus():s.length?s[0].focus():t.focus()},eb=(e,t)=>{var n;if(null===(n=e.relatedTarget)||void 0===n?void 0:n.matches("[data-silk-clone]"))return;let a=null!=eT?eT:e.target,r=null!=ew?ew:e.relatedTarget;ey({rootElements:t,e:e,fromElement:a,toElement:r}),eT=null,ew=null},ek=(e,t,n,a,r)=>{let l=n.find(t=>t.contains(e.target));"Tab"!==e.key||l||(e.preventDefault(),e.stopPropagation(),eS(e,t,n,a,r))},eT=null,ew=null,eA=({rootElements:e,viewElement:t,elementFocusedLast:n,setElementFocusedLast:a})=>{let r=[];e.forEach(e=>{r.push(em(e))});let l=function(e,t=document){let n=new Set(e),a=new Set,r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>(t instanceof HTMLElement&&"true"===t.dataset.liveAnnouncer&&n.add(t),"HEAD"===t.tagName||"SCRIPT"===t.tagName||n.has(t)||t.parentElement&&a.has(t.parentElement))?NodeFilter.FILTER_REJECT:t instanceof HTMLElement&&"row"===t.getAttribute("role")||e.some(e=>t.contains(e))?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}),l=e=>{var t;let n=null!==(t=D.get(e))&&void 0!==t?t:0;("true"!==e.getAttribute("aria-hidden")||0!==n)&&(0===n&&e.setAttribute("aria-hidden","true"),a.add(e),D.set(e,n+1))},i=r.nextNode();for(;null!=i;)l(i),i=r.nextNode();let s=new MutationObserver(e=>{for(let t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...n,...a].some(e=>e.contains(t.target)))for(let e of t.addedNodes)e instanceof HTMLElement&&"true"===e.dataset.liveAnnouncer?n.add(e):e instanceof Element&&l(e)});return s.observe(t,{childList:!0,subtree:!0}),()=>{for(let e of(s.disconnect(),a)){let t=D.get(e);1===t?(e.removeAttribute("aria-hidden"),D.delete(e)):void 0!==t&&D.set(e,t-1)}}}(e,document),i=t=>eb(t,e),s=r=>eS(r,t,e,n,a),o=r=>ek(r,t,e,n,a);return document.addEventListener("keydown",o),document.addEventListener("focusout",i),document.addEventListener("focusin",s),()=>{document.removeEventListener("focusout",i),document.removeEventListener("focusin",s),document.removeEventListener("keydown",o),l(),r.forEach(e=>e())}},eE=new Set,eC=e=>{eE.add(e)},eO=e=>{eE.delete(e)},ex=(e,t,n,a)=>{let r=e[t],l=r.onClickOutside,i=r.dismissOverlayIfNotAlertDialog,s=r.viewElement,o=r.scrollContainerElement,c=r.backdropElement;if(o===a.target||c===a.target||!(null==s?void 0:s.contains(a.target))&&!n.find(e=>e.element.contains(a.target))&&function(e){for(let t of eH.automaticLayerElements)if(t.contains(e))return!1;return!0}(a.target)){let r=!0,s=!0;if(l){let{dismiss:e,stopOverlayPropagation:t}=G({nativeEvent:a,defaultBehavior:{dismiss:!0,stopOverlayPropagation:!0},handler:l});r=e,s=t}r&&i&&i(),t>0&&!s&&ex(e,t-1,n,a)}},eP=null,eR=(e,t,n)=>{var a;if(eE.size||(null===(a=e.target)||void 0===a?void 0:a.matches('[data-silk~="0ak"] *'))||e.target===document.body&&eP!==document.body||!e.target||!e.target.isConnected)return;let r=t.length;ex(t,r-1,n,e),eP=null},eI=(e,t)=>{let n=e=>eP=e.target,a=n=>eR(n,e,t);return document.addEventListener("pointerdown",n),document.addEventListener("click",a),()=>{document.removeEventListener("pointerdown",n),document.removeEventListener("click",a)}},eD=(e,t,n)=>{let a=e[t],r=a.onEscapeKeyDown,l=a.dismissOverlayIfNotAlertDialog,i=!0,s=!0,o=!0;if(r){let{dismiss:e,nativePreventDefault:t,stopOverlayPropagation:a}=G({nativeEvent:n,defaultBehavior:{nativePreventDefault:!0,dismiss:!0,stopOverlayPropagation:!0},handler:r});i=t,s=e,o=a}i&&n.preventDefault(),s&&l&&l(),t>0&&!o&&eD(e,t-1,n)},eN=(e,t)=>{if("Escape"!==e.key||eE.size)return;let n=t.length;eD(t,n-1,e)},eL=e=>{let t=t=>eN(t,e);return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},e_=e=>(e.setAttribute("aria-hidden","true"),()=>e.removeAttribute("aria-hidden")),eF=e=>{let{allTabbableElementsWithGuardsWithData:t}=eh(e);t.forEach(e=>{e.element.tabIndex=-1})},eM=e=>{var t;return e instanceof HTMLInputElement&&(!!("password"===e.type||"text"===e.type&&"username"===e.autocomplete||(null===(t=e.closest("form"))||void 0===t?void 0:t.querySelector('input[type="password"]')))||void 0)},eB=e=>{var t,n;let a=e.getBoundingClientRect(),r=a.height,l=null!==(n=null===(t=window.visualViewport)||void 0===t?void 0:t.height)&&void 0!==n?n:0,i=l-a.bottom;return i>-r/2&&i<r+32},eW=e=>{var t;return null===(t=null==e?void 0:e.closest('[data-silk~="0ab"], [data-silk~="0ad"]'))||void 0===t?void 0:t.matches('[data-silk~="0ah"]')},eV=()=>{let e=t=>{let n=t.target;if(eW(n)){var a;null===(a=null==n?void 0:n.closest('[data-silk~="0ah"]'))||void 0===a||a.focus({preventScroll:!0}),document.removeEventListener("touchstart",e,{capture:!0})}},t=t=>{let n=t.target,a=t.relatedTarget;if(!a)return document.addEventListener("touchstart",e,{capture:!0,passive:!1});if(eW(a)&&(Y(a)&&document.addEventListener("touchstart",e,{capture:!0,passive:!1}),!(!U(a)&&!Y(a)||V(n)))){if(!eM(a)&&U(n)&&eB(n)){let e=n.cloneNode(!1);e.removeAttribute("id"),e.setAttribute("data-silk-clone","true"),e.style.setProperty("position","fixed"),e.style.setProperty("left","0"),e.style.setProperty("top","0"),e.style.setProperty("transform","translateY(-3000px) scale(0)"),document.documentElement.appendChild(e),ew=a,null==e||e.focus({preventScroll:!0}),setTimeout(()=>{eT=n,ew=a,null==a||a.focus({preventScroll:!0}),e.remove()},32)}else ew=a,null==a||a.focus({preventScroll:!0})}},n=e=>{var t;let n=e.target;!(n!==document.activeElement||!U(n)||H())&&eW(n)&&(null===(t=null==n?void 0:n.closest('[data-silk~="0ab"], [data-silk~="0ad"]'))||void 0===t||t.focus({preventScroll:!0}))},a=e=>{var t;let n=e.target;if(!n||!("setSelectionRange"in n)||!(["password","search","tel","text","url"].includes(n.type)||n instanceof HTMLTextAreaElement)||!0===n._silk_focusedBefore)return;let a=n.value.length;null===(t=n.setSelectionRange)||void 0===t||t.call(n,a,a),n._silk_focusedBefore=!0};return document.addEventListener("blur",t,{capture:!0,passive:!1}),document.addEventListener("touchstart",e,{capture:!0,passive:!0}),document.addEventListener("touchend",n,{capture:!0,passive:!0}),document.addEventListener("focusin",a),()=>{document.removeEventListener("blur",t,{capture:!0}),document.removeEventListener("touchend",n,{capture:!0}),document.removeEventListener("touchstart",e,{capture:!0}),document.removeEventListener("focusin",a)}},e$=["translate","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],eU=null,eY=e=>{eU=e},eX={sheets:[],addSheet:function(e){let t;if(!e.id)return;let n=this.findSheet(e.id);return n?(e.stackId&&(n.stackId=e.stackId),e.sendToOpennessMachine&&(n.sendToOpennessMachine=e.sendToOpennessMachine),t=n):(t={stackingIndex:-1,travelAnimations:[],aggregatedTravelCallback:function(e,t){let n=this.travelAnimations;for(let a=0,r=n.length;a<r;a++)n[a].callback(e,t)},stackingAnimations:[],aggregatedStackingCallback:function(e,t){let n=this.stackingAnimations;for(let a=0,r=n.length;a<r;a++)n[a].callback(e,t)},belowSheetsInStack:[],outlets:new Set,...e},this.sheets.push(t)),this.updateBelowSheetsInStackOfAllSheets(),t},attemptToRemoveSheet:function(e,t){let n=this.findSheet(e);if(n){if(0===n.outlets.size){var a;let t=null===(a=this.findSheet(e))||void 0===a?void 0:a.stackId;this.sheets=this.sheets.filter(t=>t.id!==e),t&&this.updateSelfAndAboveTravelProgressSumInStack(t)}else t&&t(n)}},attemptToRemoveSheetOrCleanup:function(e){this.attemptToRemoveSheet(e,e=>{e.sendToOpennessMachine=null})},findSheet:function(e){return this.sheets.find(t=>t.id===e)},addOutletToSheet:function(e,t){let n=this.findSheet(e);n?n.outlets.add(t):this.addSheet({id:e,outlets:new Set([t])})},removeOutletFromSheet:function(e,t){let n=this.findSheet(e);null==n||n.outlets.delete(t),this.attemptToRemoveSheet(e)},sheetStacks:[],addSheetStack:function(e){let t;let n=this.findSheetStack(e.id);return n||(t={stackingAnimations:[],aggregatedStackingCallback:function(e,t){let n=this.stackingAnimations;for(let a=0,r=n.length;a<r;a++)n[a].callback(e,t)},...e},this.sheetStacks.push(t)),this.updateBelowSheetsInStackOfAllSheets(),t},removeSheetStack:function(e){e&&(this.sheetStacks=this.sheetStacks.filter(t=>t.id!==e),this.removeAllOutletPersistedStylesFromStack(e))},findSheetStack:function(e){return this.sheetStacks.find(t=>t.id===e)},updateBelowSheetsInStackOfAllSheets:function(){this.sheets.forEach(e=>{let t;let n=e.stackId;if(n){t=this.findSheetStack(n);let a=this.sheets.filter(t=>t.stackId===e.stackId),r=a.filter(t=>t.stackId===e.stackId&&t.stackingIndex>e.stackingIndex);t&&(r.unshift(t),t.stackingIndex=a.length-1),e.belowSheetsInStack=r,this.updateSelfAndAboveTravelProgressSumInStack(n)}})},updateSheetStackingIndex:function(e,t){let n=this.findSheet(e);n&&(n.stackingIndex=t),this.updateBelowSheetsInStackOfAllSheets()},updateSheetTravelProgress:function(e,t){let n=this.findSheet(e);n&&n.stackId&&(n.travelProgress=t,this.updateSelfAndAboveTravelProgressSumInStack(n.stackId))},updateSelfAndAboveTravelProgressSumInStack:function(e){let t=this.sheets.filter(t=>t.stackId===e).sort((e,t)=>t.stackingIndex-e.stackingIndex),n=this.findSheetStack(e);n&&t.unshift(n);let a=t.length;for(let e=0;e<a;e++){let n=t[e];n.selfAndAboveTravelProgressSum=[];for(let r=0;r<a;r++)r<=e?n.selfAndAboveTravelProgressSum[r]=0:n.selfAndAboveTravelProgressSum[r]=t.slice(e+1,r+1).reduce((e,t)=>e+t.travelProgress,0)}},addAnimationToSheetOrStack:function({type:e,sheetId:t,stackId:n,element:a,config:r}){let l=r.hasOwnProperty("properties")?r.properties:r,i=[];Object.entries(l).forEach(([e,t])=>{if("ignore"!==t&&t&&"string"!=typeof t){if("function"==typeof t){if(e$.includes(e)){let n=i.findIndex(e=>"transform"===e[0]),a=n=>e+"("+t(n)+")";if(-1!==n){let e=i[n][1];i[n][1]=t=>e(t)+" "+a(t)}else i.push(["transform",a])}else if("transform"===e){let e=i.findIndex(e=>"transform"===e[0]);if(-1!==e){let n=i[e][1];i[e][1]=e=>n(e)+" "+t(e)}else i.push(["transform",t])}else i.push([e,t])}else if("opacity"===e){let e=["opacity",({tween:e})=>e(t[0],t[1])];i.push(e)}else{if(!e.startsWith("scale")&&(!isNaN(t[0])||!isNaN(t[1])))throw Error("Keyframe values used with a 'transform' property require a unit (e.g. 'px', 'em' or '%').");let n=i.findIndex(e=>"transform"===e[0]),a=({tween:n})=>e+"("+n(t[0],t[1])+")";if(-1!==n){let e=i[n][1];i[n][1]=t=>e(t)+" "+a(t)}else i.push(["transform",a])}}});let s=i.map(e=>[(e[0].startsWith("webkit")||e[0].startsWith("moz")?"-":"")+e[0].replace(/[A-Z]/g,"-$&").toLowerCase(),e[1]]),o=s.length,c={target:a,config:i,dashedPropertiesAsArray:s,callback:(e,t)=>{for(let n=0;n<o;n++){let[r,l]=s[n];a.style.setProperty(r,l({progress:e,tween:t}))}}},u=n?this.findSheetStack(n):this.findSheet(t);u&&("travel"===e?u.travelAnimations.push(c):u.stackingAnimations.push(c))},removeAnimationFromSheetOrStack:function({sheetId:e,stackId:t,type:n,element:a}){let r=t?this.findSheetStack(t):this.findSheet(e);if(r){if("travel"===n){let e=r.travelAnimations.filter(e=>e.target!==a);r.travelAnimations=e}else{let e=r.stackingAnimations.filter(e=>e.target!==a);r.stackingAnimations=e}}},removeAllOutletPersistedStylesFromSheet:function(e){let t=this.findSheet(e);t&&[...t.travelAnimations,...t.stackingAnimations].forEach(e=>{e.dashedPropertiesAsArray.forEach(([t])=>{e.target.style.removeProperty(t)})})},removeAllOutletPersistedStylesFromStack:function(e){let t=this.findSheetStack(e);t&&t.stackingAnimations.forEach(e=>{e.dashedPropertiesAsArray.forEach(([t])=>{e.target.style.removeProperty(t)})})},getAggregatedStackingCallbackForSheetsBelow:function(e){let t;let n=this.findSheet(e);return n&&(t=e=>{let t=n.belowSheetsInStack,a=t.length;for(let n=0;n<a;n++){let r=t[n],l=r.selfAndAboveTravelProgressSum[a-1]+e,i=k(l);r.aggregatedStackingCallback(l,i)}}),t},automaticIslandElements:new Set([]),automaticLayerElements:new Set([]),automaticLayerAndIslandDetectionCleanup:null,focusContainmentRootElements:[],focusContainmentCleanup:()=>{},escapeKeyDownListenerCleanup:null,clickOutsideListenerCleanup:null,processLayersAndIslandsChangesTimeout:null,setupAutomaticLayerAndIslandDetection:function(e){let t=document.documentElement,n=document.body,a=()=>{let a;let r=new Set([]),l=new Set([]),i=function(e){let t=e.parentElement;for(;t&&t!==document.body;){if(t.parentElement===document.body)return t;t=t.parentElement}return e.parentElement===document.body?e:null}(e);a=i?i.nextElementSibling:n.firstElementChild;let s=e=>e.matches('[data-silk~="0ag"], [data-silk~="0ab"], [data-silk~="0aa"], [data-silk-clone]'),o=e=>"SCRIPT"!==e.tagName;for(;a;)!s(a)&&o(a)&&r.add(a),a=a.nextElementSibling;let c=t.children;for(let e=0;e<c.length;e++){let t=c[e];"HEAD"===t.tagName||"BODY"===t.tagName||s(t)||l.add(t)}let u=new Set([...r].filter(e=>!this.automaticLayerElements.has(e))),d=new Set([...this.automaticLayerElements].filter(e=>!r.has(e)));this.automaticLayerElements=r;let m=new Set([...l].filter(e=>!this.automaticIslandElements.has(e))),p=new Set([...this.automaticIslandElements].filter(e=>!l.has(e)));this.automaticIslandElements=l,u.forEach(e=>{this.updateLayer({automatic:!0,layerId:null,viewElement:e,inertOutside:!1,onPresentAutoFocus:{focus:!1},onDismissAutoFocus:{focus:!1},dismissOverlayIfNotAlertDialog:()=>{},onClickOutside:{stopOverlayPropagation:!1},onEscapeKeyDown:{stopOverlayPropagation:!1}})}),d.forEach(e=>this.removeLayer(null,e)),m.forEach(e=>this.addIsland({element:e,automatic:!0})),p.forEach(e=>this.removeIsland(null,e))};a();let r=new MutationObserver(()=>{a()});r.observe(t,{childList:!0}),r.observe(n,{childList:!0}),this.automaticLayerAndIslandDetectionCleanup=function(){r.disconnect(),this.layers.forEach(e=>{e.automatic&&this.removeLayer(null,e.viewElement)}),this.automaticLayerElements=new Set([]),this.islands.forEach(e=>{e.automatic&&this.removeIsland(null,e.element)}),this.automaticIslandElements=new Set([]),this.automaticLayerAndIslandDetectionCleanup=null}},moveFocusIfNecessary:function(e,t,n,a,r,l){let i=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.contains(document.activeElement)){i=!0;break}}if(n.length){let e=n.filter(e=>!e.automatic&&!e.external);if(e.length){let t=e[e.length-1];return eo(t.layerId,t.viewElement,t.onPresentAutoFocus)}}if(r.length&&!i){let t=e[e.length-1];if(!t.external)return eo(t.layerId,t.viewElement,t.onPresentAutoFocus)}if(a.length){let e=a.find(e=>e.focusWasInside);if(e){let e=a[0];if(!e.external)return ec(e.layerId,e.viewElement,e.onDismissAutoFocus,e.elementFocusedLastBeforeShowing)}}if(l.length){let t=l.find(e=>e.focusWasInside);if(t){let t=e[e.length-1];if(t)return es(t.layerId,t.viewElement)}}},processLayersAndIslandsChanges:function(){var e;clearTimeout(this.processLayersAndIslandsChangesTimeout);let t=()=>{let e=this.layers.length,t=new Set([]),n,a=this.layers.some(e=>e.inertOutside);if(a){let a=this.islands.filter(e=>!e.componentId||0===e.componentId.length);a.forEach(e=>t.add(e.element));for(let a=e-1;a>=0;a--){let e=this.layers[a];if(e.external&&e.inertOutside){t=new Set([]);break}t.add(e.viewElement);let r=this.islands.filter(t=>t.componentId&&e.layerContextId&&t.componentId.includes(e.layerContextId)),l=this.islands.filter(t=>t.componentId&&e.layerStackContextId&&t.componentId.includes(e.layerStackContextId));if([...r,...l].forEach(e=>{t.add(e.element)}),e.inertOutside){n=e;break}n=e}}let r=[...t],l=!function(e,t){if(e.length!==t.length)return!1;let n=new Set;for(let t of e)n.add(t);for(let e of t)if(!n.has(e))return!1;return!0}(this.focusContainmentRootElements,r);if(this.focusContainmentRootElements=r,l){var i;this.focusContainmentCleanup(),this.focusContainmentCleanup=()=>{},null===(i=this.automaticLayerAndIslandDetectionCleanup)||void 0===i||i.call(this),n&&(this.setupAutomaticLayerAndIslandDetection(null==n?void 0:n.viewElement),this.focusContainmentCleanup=eA({rootElements:this.focusContainmentRootElements,viewElement:null==n?void 0:n.viewElement,elementFocusedLast:eU,setElementFocusedLast:eY}))}this.moveFocusIfNecessary(this.layers,this.focusContainmentRootElements,this.layersJustAdded,this.layersJustRemoved,this.layersJustWentToInertOutsideTrue,this.islandsJustRemoved),this.escapeKeyDownListenerCleanup&&(this.escapeKeyDownListenerCleanup(),this.escapeKeyDownListenerCleanup=null),this.clickOutsideListenerCleanup&&(this.clickOutsideListenerCleanup(),this.clickOutsideListenerCleanup=null),e>0&&(this.escapeKeyDownListenerCleanup=eL(this.layers),this.clickOutsideListenerCleanup=eI(this.layers,this.islands));let s=this.layersJustRemoved.length;if(s)for(let e=0;e<s;e++){let t=this.layersJustRemoved[e],n=t.viewElement,a=t.automatic;n&&!a&&(e_(n),eF(n))}this.islandsJustRemoved=[],this.layersJustAdded=[],this.layersJustRemoved=[],this.layersJustWentToInertOutsideTrue=[]},n=null===(e=this.layersJustAdded[this.layersJustAdded.length-1])||void 0===e?void 0:e.external;n?t():this.processLayersAndIslandsChangesTimeout=setTimeout(t,16)},autoFocusTargets:[],addAutoFocusTarget:function({layerId:e,element:t,timing:n}){this.autoFocusTargets.push({layerId:e,element:t,timing:n})},removeAutoFocusTarget:function(e){this.autoFocusTargets=this.autoFocusTargets.filter(t=>t.element!==e)},islands:[],islandsJustRemoved:[],addIsland:function(e){var t;let n=this.islands[this.islands.length-1],a=(null!==(t=e.id)&&void 0!==t?t:n)?n.id+1:0;return this.islands.push({...e,id:a}),this.processLayersAndIslandsChanges(),a},removeIsland:function(e,t){this.islands=this.islands.filter(n=>{if(e&&n.id&&n.id!==e||t&&n.element&&n.element!==t)return!0;{let e=n.element.contains(document.activeElement);return this.islandsJustRemoved.push({...n,focusWasInside:e}),!1}}),this.processLayersAndIslandsChanges()},layers:[],layersJustAdded:[],layersJustRemoved:[],layersJustWentToInertOutsideTrue:[],updateLayer:function(e){let t=e.layerId,n=e.viewElement,a=!1,r=this.layers;for(let l=0;l<r.length;l++){let i=r[l],s=null!==t?i.layerId===t:i.viewElement===n;if(s){let t={...i,...e};!i.inertOutside&&e.inertOutside&&this.layersJustWentToInertOutsideTrue.push(t),r[l]=t,a=!0;break}}if(!a){var l;let t={...e,elementFocusedLastBeforeShowing:null!==(l=e.elementFocusedLastBeforeShowing)&&void 0!==l?l:document.activeElement};r.push(t),this.layersJustAdded.push(t)}this.processLayersAndIslandsChanges()},removeLayer:function(e,t){var n;this.layers=this.layers.filter(n=>{if(e&&n.layerId&&n.layerId!==e||t&&n.viewElement&&n.viewElement!==t)return!0;{var a;let e=null===(a=n.viewElement)||void 0===a?void 0:a.contains(document.activeElement);return this.layersJustRemoved.push({...n,focusWasInside:e}),!1}}),0===this.layers.filter(e=>!e.automatic).length&&(null===(n=this.automaticLayerAndIslandDetectionCleanup)||void 0===n||n.call(this)),this.processLayersAndIslandsChanges()},nativeFocusScrollPreventers:[],nativeFocusScrollPreventionCleanup:null,addNativeFocusScrollPreventer:function(e){this.nativeFocusScrollPreventers.push({id:e}),this.processNativeFocusScrollPreventersChanges()},removeNativeFocusScrollPreventer:function(e){this.nativeFocusScrollPreventers=this.nativeFocusScrollPreventers.filter(t=>t.id!==e),this.processNativeFocusScrollPreventersChanges()},processNativeFocusScrollPreventersChanges:function(){let e=this.nativeFocusScrollPreventers.length;if(et()&&("ios"===A||"ipados"===A)){if(e)this.nativeFocusScrollPreventionCleanup||(this.nativeFocusScrollPreventionCleanup=eV());else{var t;null===(t=this.nativeFocusScrollPreventionCleanup)||void 0===t||t.call(this),this.nativeFocusScrollPreventionCleanup=null}}},fixedComponents:[],addFixedComponent:function(e){this.fixedComponents.push(e)},updateFixedComponent:function(e){let t=this.fixedComponents.find(t=>t.id===e.id);t&&(e.element&&(t.element=e.element),e.initialInlineCSSTransform&&(t.initialInlineCSSTransform=e.initialInlineCSSTransform),"boolean"==typeof e.compensated&&(t.compensated=e.compensated))},removeFixedComponent:function(e){this.fixedComponents=this.fixedComponents.filter(t=>t.id!==e)},findActualFixedComponentsInsideOutlet:function(e){return this.fixedComponents.filter(t=>{if(t.element&&e)return e.contains(t.element)&&"fixed"===window.getComputedStyle(t.element).getPropertyValue("position")})},themeColorMetaTag:null,underlyingThemeColor:null,themeColorDimmingOverlays:[],storeThemeColorMetaTag:function(){if(this.themeColorMetaTag=en(),!this.themeColorMetaTag){let e=document.createElement("meta");e.name="theme-color",e.content=window.getComputedStyle(document.body).backgroundColor,document.head.appendChild(e),this.themeColorMetaTag=e}},getAndStoreUnderlyingThemeColorAsRGBArray:function(){let e;if(this.themeColorDimmingOverlays.length>0)e=this.underlyingThemeColor;else{var t;this.themeColorMetaTag||this.storeThemeColorMetaTag();let n=null===(t=this.themeColorMetaTag)||void 0===t?void 0:t.content;(e=j(n))||console.warn("`themeColorDimming` prop ignored: Only `theme-color` meta tag with a value in `rgb()`, `rgba()`, or hexadecimal format is supported."),this.underlyingThemeColor=e}return e},updateUnderlyingThemeColor:function(e){let t=j(e);if(!t)throw Error("The color provided to `updateThemeColor` doesn't match `rgb()`, `rgba()`, or hexadecimal format.");this.underlyingThemeColor=t,this.setActualThemeColor()},setActualThemeColor:function(){var e;this.themeColorMetaTag||this.storeThemeColorMetaTag(),null===(e=this.themeColorMetaTag)||void 0===e||e.setAttribute("content",K({color:this.underlyingThemeColor,overlays:this.themeColorDimmingOverlays}))},findThemeColorDimmingOverlay:function(e){return this.themeColorDimmingOverlays.find(t=>t.dimmingOverlayId===e)},findIndexThemeColorDimmingOverlay:function(e){return this.themeColorDimmingOverlays.findIndex(t=>t.dimmingOverlayId===e)},updateThemeColorDimmingOverlay:function(e){let t=e;t.color&&(t={...t,color:z(t.color)});let n=this.findThemeColorDimmingOverlay(t.dimmingOverlayId);return n?Object.assign(n,t):(n=t,this.themeColorDimmingOverlays.push(t)),this.setActualThemeColor(),n},updateThemeColorDimmingOverlayAlphaValue:function(e,t){e.alpha=t,this.setActualThemeColor()},removeThemeColorDimmingOverlay:function(e){let t=this.findThemeColorDimmingOverlay(e);t&&(t.abortRemoval=!1,setTimeout(()=>{(null==t?void 0:t.abortRemoval)||(this.themeColorDimmingOverlays=this.themeColorDimmingOverlays.filter(t=>t.dimmingOverlayId!==e),this.setActualThemeColor(),0!==this.themeColorDimmingOverlays.length||(this.underlyingThemeColor=null,this.themeColorMetaTag=null))},20))}};var eH=eX;let eG=e=>{let t=c(null);return b(()=>{t.current=e}),m((...e)=>{let n=t.current;return n(...e)},[])},ez=e=>"layout"===e?b:d,ej=e=>{var t=null==e?void 0:e.lastIndexOf(":");return -1===t?"":null==e?void 0:e.substring(t+1)},eK=e=>{let t=[],n=[],a=(e,r,{partOfInitial:l})=>{Array.isArray(e)?e.forEach(e=>a(e,r,{partOfInitial:l})):(r+=(r?".":"")+e.name,l&&n.push(r+":"+e.initial),Object.entries(e.states).forEach(([n,i])=>{var s;let o=r+":"+n;i.machine=r,i.path=o,i.reactive=!e.silentOnly,t.push(i),i.machines&&a(i.machines,o,{partOfInitial:l&&e.initial===n})}))};return a(e,"",{partOfInitial:!0}),[n,t]},eq=(e,t)=>e.includes(":")?e:t.substring(0,t.lastIndexOf(":")+1)+e,eJ=e=>{let t=e.split("."),n=[];return t.forEach((e,t)=>{let a=n[t-1],r=(a?a.full+".":"")+e,l=r.substring(0,r.lastIndexOf(":")),i=r.substring(r.lastIndexOf(":")+1);n.push({full:r,withoutState:l,state:i})}),n},eZ=({checkedPoolOfStates:e,referencePoolOfStates:t,callbackOnExclusion:n,callbackOnPresent:a})=>{let r=e.filter(e=>{let r=!0;return e.forEach(l=>{t.forEach(t=>{t.forEach(i=>{l.withoutState===i.withoutState&&(l.state!==i.state?(r=!1,null==n||n({decomposedCheckedState:e,checkedStatePiece:l,decomposedReferenceState:t,referenceStatePiece:i})):a({decomposedCheckedState:e,checkedStatePiece:l,decomposedReferenceState:t,referenceStatePiece:i}))})})}),r});return r},eQ=e=>{let[t,n]=eK(e);return[t,(e,t)=>{let a;let r="string"==typeof t?t:t.type,l=[];n.forEach(n=>{e.includes(n.path)&&(!t.machine||t.machine===n.machine)&&n.messages&&Object.entries(n.messages).forEach(([i,s])=>{if(i===r){if("string"==typeof s)a=i,l.push(eq(s,n.path));else for(let r of s)if(!r.guard||r.guard(e,t)){a=i,l.push(eq(r.target,n.path));break}}})});let i=e.map(e=>eJ(e)),s=l.map(e=>eJ(e)),o=[],c=eZ({checkedPoolOfStates:i,referencePoolOfStates:s,callbackOnExclusion:({decomposedCheckedState:e})=>{o.push(e[e.length-1].full)},callbackOnPresent:({referenceStatePiece:e})=>{e.unchanged=!0}}),u=c.map(e=>e[e.length-1].full),d=[],m=[];s.forEach(e=>{e.forEach((t,a)=>{if(!t.unchanged){var r,l;a<e.length-1&&d.push(t.full);let i=n.find(e=>e.path===t.full);null===(r=i.machines)||void 0===r||null===(l=r.forEach)||void 0===l||l.call(r,t=>{let r=()=>{s.find(e=>e.find(e=>e.withoutState===`${i.path}.${t.name}`))||m.push(`${i.path}.${t.name}:${t.initial}`)};a<e.length-1?i.path+t.name!==e[a+1].withoutState&&r():r();let l=e=>{var t,a;let r=n.find(t=>t.path===e);null===(t=r.machines)||void 0===t||null===(a=t.forEach)||void 0===a||a.call(t,t=>{s.find(e=>e.find(e=>e.withoutState===`${i.path}.${t.name}`))||m.push(`${e}.${t.name}:${t.initial}`),l(`${e}.${t.name}:${t.initial}`)})};l(`${i.path}.${t.name}:${t.initial}`)})}})});let p=[...l,...d,...m],g=[...u,...p],h=[...o,...p],f=n.filter(e=>h.includes(e.path)),v=f.some(e=>e.reactive);return{exitedStates:o,transitionTaken:a,enteredStates:p,nextStates:g,reactive:v}}]},e0=(e,t)=>null==e?void 0:e.toStrings().filter(e=>null==e?void 0:e.startsWith(t)).filter(e=>{var n;return!(null===(n=null==e?void 0:e.slice(t.length))||void 0===n?void 0:n.includes("."))})[0],e1=e=>{let[t,n]=o(()=>eQ(e),[e]),a=c(),r=c([]),l=c([]),i=c([]),s=c([]),d=c(t),p=c({toStrings:()=>t,matches:e=>e5(t,e),lastMessageTreatedRef:a,exitActionsRef:r,transitionActionsRef:l,entryActionsRef:i,selectorsRef:s}),[g,h]=u({...p.current,silent:p.current}),f=c([]),v=m(e=>{f.current.push(e);let t=e=>{let{nextStates:o,exitedStates:c,transitionTaken:u,enteredStates:m,reactive:g}=n(d.current,f.current[0]),v=d.current;if(d.current=o,r.current.forEach(e=>{c.includes(e.state)&&("function"==typeof e.guard?e.guard(v,f.current[0]):e.guard)&&e.callback(f.current[0],e.params)}),l.current.forEach(e=>{c.includes(e.state)&&e.transition===u&&("function"==typeof e.guard?e.guard(v,f.current[0]):e.guard)&&e.callback(f.current[0],e.params)}),i.current.forEach(e=>{m.includes(e.state)&&("function"==typeof e.guard?e.guard(v,f.current[0]):e.guard)&&e.callback(f.current[0],e.params)}),a.current="string"==typeof f.current[0]?{type:f.current[0]}:f.current[0],f.current.shift(),f.current.length)t(g||e);else{let t=o.slice();p.current.toStrings=()=>t,p.current.matches=e=>e5(t,e),p.current.getValues=()=>[ej(t.toStrings)],s.current.forEach(e=>{let t=e.current.selection;e.current.toStrings=()=>[e0(p.current,t)],e.current.matches=e=>e5([e0(p.current,t)],e),e.current.getValues=()=>[ej(e0(p.current,t))]}),(e||g)&&h({...p.current,silent:p.current})}};1===f.current.length&&t()},[n]);return[g,v]},e2=(e,t,n,{message:a="",delay:r=null,...l}={delay:null})=>{d(()=>{let a;return t.matches(n)&&(a=setTimeout(()=>e({type:"",...l}),null!=r?r:0)),()=>{a&&clearTimeout(a)}},[t,n,r,e,a,l])},e3=(e,t,{shallow:n=!0}={})=>{let a=o(()=>e0(e,t),[e,t]),r=c({lastMessageTreatedRef:null==e?void 0:e.lastMessageTreatedRef,exitActionsRef:null==e?void 0:e.exitActionsRef,transitionActionsRef:null==e?void 0:e.transitionActionsRef,entryActionsRef:null==e?void 0:e.entryActionsRef,toStrings:()=>[a],matches:e=>e5([a],e),selection:t,getValues:()=>[ej(a)]}),l=c(Symbol());return b(()=>{let t=e.selectorsRef.current.find(e=>e.id===l.current);t||e.selectorsRef.current.push(r)},[]),o(()=>({...r.current,silent:r.current}),[a])},e5=(e,t)=>Array.isArray(t)?t.some(t=>e.includes(t))||e.some(e=>t.some(t=>(null==e?void 0:e.startsWith(t))&&(null==e?void 0:e.charAt(t.length))===".")):e.includes(t)||e.some(e=>(null==e?void 0:e.startsWith(t))&&(null==e?void 0:e.charAt(t.length))==="."),e4=(e,t,n)=>{let{state:a,callback:r,params:l,empty:i=!1}=n,s=!n.hasOwnProperty("guard")||n.guard,u=o(()=>l?Object.values(l):[],[l]),m=o(()=>t.entryActionsRef,[t]),p=ez("before-paint"===e?"layout":"normal"),g=eG(e=>{((null==e?void 0:e.matches)&&(null==e?void 0:e.matches(a))||!(null==e?void 0:e.matches)&&e5(e,a))&&("function"==typeof s&&s()||"function"!=typeof s&&s)&&r(e.lastMessageTreatedRef.current,l)}),h=c(Symbol());p(()=>{if(!i){if("immediate"===e){let e={id:h.current,state:a,guard:s,callback:r,params:l},t=m.current.findIndex(e=>e.id===h.current);-1===t?m.current.push(e):m.current[t]=e}else g(t)}},"immediate"===e?[e,a,s,r,m,...u]:[e,g,t]),d(()=>()=>{m.current=m.current.filter(e=>e.id!==h.current)},[])},e6=(e,t)=>{let{state:n,transition:a,callback:r,params:l}=t,i=!t.hasOwnProperty("guard")||t.guard,s=o(()=>l?Object.values(l):[],[l]),u=o(()=>e.transitionActionsRef,[e]),m=c(Symbol());d(()=>{let e={id:m.current,state:n,transition:a,guard:i,callback:r,params:l},t=u.current.findIndex(e=>e.id===m.current);-1===t?u.current.push(e):u.current[t]=e},[n,a,i,r,u,...s]),d(()=>()=>{u.current=u.current.filter(e=>e.id!==m.current)},[])},e7=(e,t,n)=>{let{state:a,callback:r,params:l}=n,i=!n.hasOwnProperty("guard")||n.guard,s=o(()=>l?Object.values(l):[],[l]),u=o(()=>t.exitActionsRef,[t]),m=ez("before-paint"===e?"layout":"normal"),p=eG(e=>{((null==e?void 0:e.matches)&&(null==e?void 0:e.matches(a))||!(null==e?void 0:e.matches)&&e5(e,a))&&("function"==typeof i&&i()||"function"!=typeof i&&i)&&r(e.lastMessageTreatedRef.current,l)}),g=c(Symbol());m(()=>{if("immediate"===e){let e={id:g.current,state:a,guard:i,callback:r,params:l},t=u.current.findIndex(e=>e.id===g.current);-1===t?u.current.push(e):u.current[t]=e}return()=>{"immediate"!==e&&p(t)}},"immediate"===e?[e,a,i,r,u,...s]:[e,p,t]),d(()=>()=>{u.current=u.current.filter(e=>e.id!==g.current)},[])},e9=(e,t,n)=>{let{state:a,callback:r,params:l,name:i}=n,s=!n.hasOwnProperty("guard")||n.guard,o=l?Object.values(l):[],u="string"==typeof e?e:e.start,d="string"==typeof e?e:e.update,p=c(null);e4("immediate",t,{state:a,guard:s,callback:m(()=>{p.current=r(null,l)},[r,l]),params:l,empty:"immediate"!==u});let g=ez("before-paint"===d?"layout":"normal"),h=c(!1);g(()=>{let e;let n=(null==t?void 0:t.matches)&&(null==t?void 0:t.matches(a))||!(null==t?void 0:t.matches)&&e5(t,a)||""===a,i="function"==typeof s&&s()||"function"!=typeof s&&s;return n&&i&&(e="immediate"===u?h.current?r(null,l):p.current:r(null,l)),n&&!h.current&&(h.current=!0),()=>{var n;let r=null===(n=t.silent)||void 0===n?void 0:n.matches(a);r||(h.current=!1,p.current=null),null==e||e()}},[""!==a?t:null,a,s,r,...o])},e8=e=>{let t=c({value:e}),[n,a]=u({value:e,silent:t.current}),r=m(e=>{let n="function"==typeof e?e(t.current.value):e;t.current.value=n,a({value:n,silent:t.current})},[]);return[n,r]};function te(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}function tt(...e){return m(te(...e),e)}var tn=(e,t)=>{let n=()=>{null==t||t()},a=e=>{e.preventDefault(),window.addEventListener("touchend",n,{once:!0})},r=e.current;return r.addEventListener("touchstart",a,{passive:!1}),()=>{r&&(r.removeEventListener("touchstart",a,{passive:!1}),window.removeEventListener("touchend",n))}};let ta=!1,tr=0;function tl(e){var t;if(void 0!==g){let t=g();return null!=e?e:t}let[n,a]=u(null!=e?e:ta?++tr:null);return b(()=>{null===n&&a(++tr)},[]),d(()=>{!1===ta&&(ta=!0)},[]),null!==(t=null!=e?e:n)&&void 0!==t?t:void 0}let ti=h((e,t)=>{let{children:a,...r}=e,l=f.toArray(a),i=l.find(tc);if(i){let e=i.props.children,a=l.map(t=>t!==i?t:f.count(e)>1?f.only(null):v(e)?e.props.children:null);return n(ts,{...r,ref:t,children:v(e)?y(e,void 0,a):null})}return n(ts,{...r,ref:t,children:a})});ti.displayName="Slot.Root";let ts=h((e,t)=>{let{children:n,...a}=e,r=function(e){var t,n;let a=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?e.ref:(r=(a=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref}(n);return v(n)?y(n,{...function(e,t){let n={...t};for(let a in t){let r=e[a],l=t[a],i=/^on[A-Z]/.test(a);i?r&&l?n[a]=(...e)=>{l(...e),r(...e)}:r&&(n[a]=r):"style"===a?n[a]={...r,...l}:"className"===a&&(n[a]=[r,l].filter(Boolean).join(" "))}return{...e,...n}}(a,n.props),ref:t?te(t,r):r}):f.count(n)>1?f.only(null):null});ts.displayName="Slot.Anonymous";let to=({children:e})=>n(r,{children:e});function tc(e){return v(e)&&e.type===to}let tu=0,td=[0,0],tm=!1,tp=()=>{clearTimeout(e),tm=!0,e=setTimeout(()=>tm=!1,50)},tg=()=>{tm||window.scrollTo(...td)},th=i.forwardRef((e,t)=>{let{asChild:a,active:r=!0,automaticallyDisabledForOptimisation:l=!0,axis:i="both",preventBodyScroll:s,children:o,"data-silk":u,className:p,...g}=e,h=null==u?void 0:u.includes("0ae"),f=c(null),v=tt(f,t);b(()=>{if(td=[window.screenX,window.scrollY],r&&s){if(0===tu){let e=window.innerWidth,t=document.documentElement.clientWidth,n=window.innerHeight,a=document.documentElement.clientHeight;document.body.style.setProperty("overflow","hidden");let r=`${e-t}px`,l=`${n-a}px`,i=document.querySelectorAll("[data-silk~='0al']");i.forEach(e=>{e.style.setProperty("--x-collapsed-scrollbar-thickness",r),e.style.setProperty("--y-collapsed-scrollbar-thickness",l)}),document.body.style.setProperty("padding-right",r),document.body.style.setProperty("padding-bottom",l),window.addEventListener("resize",tp),window.addEventListener("scroll",tg,{passive:!1}),tu++}else tu++}return()=>{if(r&&s&&0==--tu){let e=document.querySelectorAll("[data-silk~='0al']");document.body.style.removeProperty("overflow"),e.forEach(e=>{e.style.removeProperty("--x-collapsed-scrollbar-thickness"),e.style.removeProperty("--y-collapsed-scrollbar-thickness")}),document.body.style.removeProperty("padding-right"),document.body.style.removeProperty("padding-bottom"),window.removeEventListener("scroll",tg),window.removeEventListener("resize",tp)}}},[s,r]),d(()=>{let e;let t=f.current;return!h&&r&&t&&(e=new ResizeObserver(e=>{e.forEach(()=>{t.scrollTo(300,300)})})).observe(t,{box:"border-box"}),()=>{!h&&r&&t&&e&&(e.unobserve(t),e.disconnect())}},[r,h]);let y=m(e=>{let t=e.currentTarget;t.scrollTo(300,300),"ios"!==A&&"ipados"!==A||CSS.supports("overscroll-behavior: contain")||(t.style.setProperty("overflow","hidden"),setTimeout(()=>{t.style.setProperty("overflow","auto")},10))},[]),S=a?ti:"div",k=I("ScrollTrap",{active:r,automaticallyDisabledForOptimisation:l,axis:i});return n(S,{...k("root",["active","automaticallyDisabledForOptimisation","axis"],{className:p,dataSilk:[u,"0ac","0ae"]}),onScroll:h?void 0:y,...g,ref:v,children:o})});th.displayName="Sheet.Anonymous";let tf=i.forwardRef((e,t)=>{let{asChild:a,className:r,dataSilk:l,children:i,...s}=e,o=a?ti:"div",c=I("ScrollTrap",{});return n(o,{...c("stabiliser",[],{className:r,dataSilk:[l]}),...s,ref:t,children:i})});tf.displayName="Sheet.DDD";let tv={Root:th,Stabiliser:tf},ty=()=>{let e=tl(),t=m(t=>{t?eH.addFixedComponent({id:e,element:t}):eH.removeFixedComponent(e)},[e]);return t},tS=i.forwardRef((e,t)=>{let{asChild:a,children:r,className:l,"data-silk":i,...s}=e,o=ty(),c=tt(o,t),u=I("Fixed",{});return n(tv.Root,{...u("root",[],{className:l,dataSilk:[i,"0al"]}),asChild:a,...s,ref:c,children:r})});tS.displayName="Fixed.Root";let tb=i.forwardRef((e,t)=>{let{asChild:a,children:r,...l}=e;return n(tv.Stabiliser,{asChild:a,...l,ref:t,children:r})});tb.displayName="Fixed.Content";let tk={Root:tS,Content:tb},tT=i.createContext(null);tT.displayName="Sheet.GenericContext";let tw=i.createContext(null);tw.displayName="Sheet.Anonymous";var tA=function(e){let t="cubic-bezier(";if(!e.startsWith(t))return null;let n=e.slice(t.length,-1),a=n.split(",").map(e=>parseFloat(e.trim()));return 4!==a.length||a.some(isNaN)?null:a},tE=({mass:e,stiffness:t,damping:n,initialVelocity:a=0,fromPosition:r,toPosition:l,precision:i})=>{let s=[],o=0,c=Math.abs(l-r),u=0,d=a,m=!1,p=!1,g=-(1e-6*t),h=-(.001*n),f=i/22,v=10*i;for(;!(m&&p);){let t=g*(u-c),n=h*d,a=(t+n)/e;d+=a,u+=d,m=Math.abs(d)<=f,p=Math.abs(c-u)<=v;let r=u/c;s.push(r),o++}let y=o;return{progressValuesArray:s,duration:y}};let tC=()=>CSS.supports("transition-timing-function","linear(0, 1)")&&!et(),tO=({origin:e=0,destination:t=1,animationConfig:n})=>{var a,r,l,i,s,o,c,u,d;let m=[],p;if(n&&n.easing&&"spring"!==n.easing){if("linear"===n.easing){p=null!==(o=n.duration)&&void 0!==o?o:250;let e=p,t=1/(e-1);for(let n=0;n<e;n++){let e=n*t;m.push(isNaN(e)?0:e)}}else{let e;p=null!==(c=n.duration)&&void 0!==c?c:250;let t=p;e="ease"===n.easing?[.25,.1,.25,1]:"ease-in"===n.easing?[.42,0,1,1]:"ease-out"===n.easing?[0,0,.58,1]:"ease-in-out"===n.easing?[.42,0,.58,1]:n.easing.startsWith("cubic-bezier")&&null!==(u=tA(n.easing))&&void 0!==u?u:[.25,.1,.25,1];let a=M(...e);for(let e=0;e<=t;e++)m.push(a(e/t))}}else{let o=tE({stiffness:null!==(a=null==n?void 0:n.stiffness)&&void 0!==a?a:300,damping:null!==(r=null==n?void 0:n.damping)&&void 0!==r?r:34,mass:null!==(l=null==n?void 0:n.mass)&&void 0!==l?l:1,initialVelocity:null!==(i=null==n?void 0:n.initialVelocity)&&void 0!==i?i:0,precision:null!==(s=null==n?void 0:n.precision)&&void 0!==s?s:.1,fromPosition:e,toPosition:t});m=o.progressValuesArray,p=o.duration}return{progressValuesArray:m,easing:"linear",duration:p,delay:null!==(d=null==n?void 0:n.delay)&&void 0!==d?d:0}},tx=(e,t)=>{let n={};return e.forEach(([e,a])=>{let r=k(t);n[e]=a({progress:t,tween:r})}),n},tP=({type:e,progressValuesAr