@plainsheet/react 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://https://www.plainsheet.org/">
3
- <img src="https://github.com/plainsheet/plainsheet/raw/main/documents/assets/header.png" width="328" height="167">
3
+ <img src="https://github.com/plainsheet/plainsheet/raw/main/documents/assets/readme-header.png" width="328" height="167">
4
4
  </a>
5
5
  </p>
6
6
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),xt=require("react-dom");function Bt(t){return t!=null}(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var At=Object.defineProperty,Dt=(t,e,n)=>e in t?At(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K=(t,e,n)=>Dt(t,typeof e!="symbol"?e+"":e,n);function x(t){return typeof t=="string"}function Mt(t,e){return t.classList.contains(et(e))}function V(t,e){t.classList.add(et(e))}function ot(t,e){t.classList.remove(et(e))}function X(t,e,n){x(n)&&(x(e)&&ot(t,e),V(t,n))}function et(t){return x(t)?t.trim().replace(/\./g,""):""}function W(t){return t.map(e=>et(e)).filter(Boolean).join(" ")}function Pt(t){return t.map(e=>e==null?void 0:e.trim()).filter(Boolean).map(e=>`.${e}`).join(" ")}const ut="open",dt="hidden";function nt(t,e){const n=e;if(Array.isArray(t)){t.forEach(o=>{Q(o,n),o.setAttribute("aria-modal",n?"true":"false")});return}Q(t,n),t.setAttribute("aria-modal",n?"true":"false")}function Q(t,e){e?(V(t,ut),ot(t,dt)):(V(t,dt),ot(t,ut))}function St(t){return t instanceof HTMLElement}function A(t){return typeof t=="number"&&!Number.isNaN(t)}function Yt(t){St(t)&&t.focus()}function Ft(t){if(!St(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),n=A(e)?parseInt(e,10):-1,o=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),r=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return o||r||n>-1}var T=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(T||{}),rt=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(rt||{}),J=(t=>(t.Hidden="hidden",t))(J||{});function P(t,e,n){const o=document.createElement(t);return e.split(" ").forEach(r=>{V(o,r)}),x(n)&&o.setAttribute("data-testid",n),o}Pt([T.Root,T.ContentWrapper]);function pt(t,e,n,o){switch(o){case"content-height":return e>=t?Et(t,e,n):0;case"middle":return-(t/2-e);case"top":return-(t-e)+n;default:return 0}}function yt(t,e){const n=e<t,o=e>t;return{isUp:n,isDown:o,stayedSame:e===t}}function Ct(t,e){return e<t?-(t-e):e-t}function z(t,e){return t>e?t-e:e-t}function It(t,e){const n=t<e,o=t>e;return{isUp:n,isDown:o,stayedSame:t===e}}function ht(t,e,n){const o=t==="above";return n.filter(r=>{const i=r*e.viewportHeight;return o?e.visibleHeight<i:e.visibleHeight>i})}function Et(t,e,n){return-(t-e)+n}function mt(t){return Number(t.replace("px",""))}function Z(t,...e){return Number(t.toFixed(...e))}function wt(t){const e=/(?<type>\w+)\((?<values>[^)]+)\)/g,n=[];let o;for(;(o=e.exec(t))!==null;){const r=o[1],i=o[2].split(",").map(a=>a.trim());n.push({type:r,values:i})}return n}function Rt(t){const e=t.style.transform,n=wt(e);return{transform:e,transformValues:n}}function kt(t,e){return t.find(o=>o.type.startsWith(e))||null}const at="translate";function M(t){const e=t.style.transform,n=wt(e),o=kt(n,at);return Tt(o??{type:at,values:[]})}function tt(t,{x:e,y:n}){const{transform:o,transformValues:r}=Rt(t),i=kt(r,at);if(i){const a=Tt(i);t.style.transform=`translate(${e??a.x??0}px,${n??a.y??0}px)`;return}if(o){t.style.transform=`${o}, translate(${e??0}px,${n??0}px)`;return}t.style.transform=`translate(${e??0}px,${n??0}px)`}function Tt(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const e=t.values[0],n=t.values[1];return{x:mt(e)??0,y:mt(n)??0}}function it(t){return t!=null}function ft(t,{min:e,max:n}){return it(n)&&t>=n?n:it(e)&&t<=e?e:t}const Wt=(t,e,n)=>{e instanceof HTMLElement&&!Mt(e,T.Handle)&&n.scrollTop>=1||(t.isDragging=!0)},Nt=(t,e,n,o)=>r=>{o.startY=t.getCoordinates(r).y,o.containerStartTranslate=M(e),n.onDragStart()},jt=(t,e,n,o,r)=>i=>{Gt(i,t,n,o,r,e,n.marginTop)};function Gt(t,e,n,o,r,i,a){if(!o.isDragging||!A(o.startY))return;const l=e.getCoordinates(t).y,u=Ct(o.startY,l),h=window.innerHeight,c=i.clientHeight,f=c-(o.containerStartTranslate.y+u);if(f>=h)return;const y=yt(o.startY,l);if(y.isUp&&!n.expandable&&f>=c||n.preventClosing&&f<=c)return;r.start(()=>{tt(i,{y:o.containerStartTranslate.y+u})},0);const s=h-a,C=c-o.containerStartTranslate.y;if(y.isUp){const v=s-C,S=s-f,E=ft(1-Z(S/v,2),{min:0,max:1});n.onDragMove(y,E)}else if(y.isDown){const v=ft(Z(1-f/C,2),{min:0,max:1});n.onDragMove(y,v)}}const Ut=(t,e,n,o,r,i,a)=>l=>{if(!o.isDragging||(o.isDragging=!1,!A(o.startY)))return;n.onDragEnd();const u=o.startY,h=t.getCoordinates(l).y,c=M(e).y,f=yt(u,h),y=window.innerHeight,s=e.clientHeight;if(f.isUp){const C=[...n.snapPoints].sort((E,B)=>E-B),v=s+-c;if(!n.expandable&&v>=s)return;for(const E of C){const B=E*window.innerHeight;if(v<=B){const k=z(v,B);a.translateContainer({startY:c,endY:c-k,animationFrame:r,bottomSheetContainer:e});return}}const S=Et(y,s,n.marginTop);a.translateContainer({startY:c,endY:S,animationFrame:r,bottomSheetContainer:e})}else if(f.isDown){const C=[...n.snapPoints].sort((v,S)=>S-v);for(const v of C){const S=v*window.innerHeight,E=s+-c;if(E>=S){const B=z(E,S);a.translateContainer({startY:c,endY:c+B,animationFrame:r,bottomSheetContainer:e});return}}if(n.preventClosing){const v=s+-c;if(v>=s){const S=z(v,s);a.translateContainer({startY:c,endY:c+S,animationFrame:r,bottomSheetContainer:e})}return}i()}};var G=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(G||{});function bt(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const $t={eventPhase:G.All};class q{constructor(e){K(this,"currentTarget"),this.currentTarget=e}addEventListeners({onStart:e,onStartOptions:n=$t,onMove:o,onEnd:r}){this.addTouchEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r}),this.addMouseEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r})}addTouchEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r}){e&&this.currentTarget.addEventListener("touchstart",i=>{if(n.eventPhase===G.All){e(i);return}bt(i.eventPhase)===n.eventPhase&&e(i)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),r&&this.currentTarget.addEventListener("touchend",r)}addMouseEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r}){e&&this.currentTarget.addEventListener("mousedown",i=>{if(n.eventPhase===G.All){e(i);return}bt(i.eventPhase)===n.eventPhase&&e(i)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),r&&this.currentTarget.addEventListener("mouseup",i=>{r(i)})}removeEventListeners({onStart:e,onMove:n,onEnd:o}){e&&this.currentTarget.removeEventListener("touchstart",e),o&&this.currentTarget.removeEventListener("touchend",o),n&&this.currentTarget.removeEventListener("touchmove",n),e&&this.currentTarget.removeEventListener("mousedown",e),n&&this.currentTarget.removeEventListener("mousemove",n),o&&this.currentTarget.removeEventListener("mouseup",o)}getCoordinates(e){if(e.type==="touchstart"||e.type==="mousedown"){if("touches"in e)return{x:e.touches[0].clientX,y:e.touches[0].clientY};if(e instanceof MouseEvent)return{x:e.clientX,y:e.clientY}}if(e.type==="touchend"||e.type==="mouseup"||e.type==="mousemove"||e.type==="touchmove"){if("touches"in e)return{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY};if(e instanceof MouseEvent)return{x:e.clientX,y:e.clientY}}return{x:0,y:0}}}function Ht(t){const e=t;return`${e} ${e} 0px 0px`}function _t(t,e){const n=Xt(t);qt(n),n.bottomSheetContainer.style.width=t.width;const o=document.createElement("div");o.innerHTML=t.content??"";const r=window.innerHeight;n.bottomSheetContainer.style.maxHeight=`${r}px`,n.bottomSheetContentWrapper.appendChild(o);const i=zt({bottomSheetElements:n,bottomSheetProps:t,options:e});return t.rootStyle&&Object.assign(n.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(n.bottomSheetBackdrop.style,t.backdropStyle),t.containerGapFillerStyle&&Object.assign(n.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(n.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(n.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(n.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:n,eventHandlers:i}}function Xt(t){const e=P("dialog",W([T.Root,rt.Dialog,t.rootClass]),T.Root);e.ariaLabel=t.ariaLabel;const n=P("section",W([T.Container,t.containerClass]),T.Container);t.containerBorderRadius&&(n.style.borderRadius=Ht(t.containerBorderRadius));const o=P("div",T.GapFiller,T.GapFiller);t.containerBackgroundColor&&(n.style.backgroundColor=t.containerBackgroundColor,o.style.backgroundColor=t.containerBackgroundColor);const r=P("button",W([T.Handle,rt.Button,t.shouldShowHandle?null:J.Hidden,t.handleClass]),T.Handle);r.setAttribute("type","button"),r.ariaLabel="bottom sheet close button";const i=P("span",W([T.HandleBar,t.shouldShowHandle?null:J.Hidden]),T.HandleBar),a=P("article",W([T.ContentWrapper,t.contentWrapperClass]),T.ContentWrapper),l=P("div",W([T.Backdrop,t.backdropClass,J.Hidden]),T.Backdrop);return t.backdropColor&&(l.style.backgroundColor=t.backdropColor),t.backDropTransition&&(l.style.transition=t.backDropTransition),{bottomSheetRoot:e,bottomSheetBackdrop:l,bottomSheetContainer:n,bottomSheetHandle:r,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:o}}function qt({bottomSheetRoot:t,bottomSheetContainer:e,bottomSheetHandle:n,bottomSheetHandleBar:o,bottomSheetContentWrapper:r,bottomSheetContainerGapFiller:i}){t.appendChild(e),n.appendChild(o),e.appendChild(n),e.appendChild(r),e.appendChild(i)}function zt({bottomSheetElements:t,bottomSheetProps:e,options:n}){const{bottomSheetRoot:o,bottomSheetContainer:r,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:l,bottomSheetBackdrop:u}=t,{animationFrame:h}=n,c=new q(i),f=new q(l),y=new q(a);let s=[];const C=new q(window),v=Nt(C,r,e,n.draggingState),S=jt(C,r,e,n.draggingState,h),E=Ut(C,r,e,n.draggingState,h,n.onClose,n.bottomSheetState);function B(H){H.target instanceof Element&&!o.contains(H.target)&&n.onClose()}function k(H){Wt(n.draggingState,H.target,t.bottomSheetContentWrapper)}function Y(H){const L=H??e;L.draggable&&L.backgroundDraggable&&(f.addEventListeners({onStart:k,onStartOptions:{eventPhase:G.Target}}),y.addEventListeners({onStart:k})),L.draggable&&C.addEventListeners({onStart:v,onMove:S,onEnd:E}),L.draggable&&window.document.addEventListener("keyup",b=>{b.key==="Escape"&&n.onClose()}),i.addEventListener("keyup",b=>{if(b.key==="ArrowUp"){n.moveUp();return}if(b.key==="ArrowDown"){n.moveDown();return}if(b.shiftKey&&b.key==="Tab"){const d=F(t.bottomSheetContentWrapper);Yt(d)}})}function $(H){const L=H??e;e.shouldCloseOnOutsideClick&&!e.preventClosing?u.addEventListener("click",B):u.style.pointerEvents="none",L.draggable&&(c.addEventListeners({onStart:k}),s.forEach(b=>{b.removeEventListeners({onStart:k})}),s=e.dragTriggers.reduce((b,d)=>{const p=o.querySelectorAll(d);if(!p.length)return b;const g=Array.from(p).map(m=>m instanceof HTMLElement?new q(m):null).filter(m=>!!m);return[...b,...g]},[]),s.forEach(b=>{b.addEventListeners({onStart:k,onStartOptions:{eventPhase:G.Target}})}))}function _(){u.removeEventListener("click",B)}function F(H){let L=[...Array.from(H.childNodes).reverse()];for(;L.length;){const b=L.shift();if(Ft(b))return b;b&&(L=[...L,...Array.from(b.childNodes).reverse()])}return null}function I(){c.removeEventListeners({onStart:k}),f.removeEventListeners({onStart:k}),y.removeEventListeners({onStart:k}),s.forEach(H=>{H.removeEventListeners({onStart:k})}),C.removeEventListeners({onStart:v,onMove:S,onEnd:E})}return{attachEventListeners:Y,clearEventListeners:I,attacheOnOpenEventListeners:$,clearOnOpenEventListeners:_}}class Vt{constructor(){K(this,"animationId"),K(this,"isInProgress"),K(this,"startedAt"),this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(e,n,o=!1){this.isInProgress=!0;const r=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,l=n===0?1:Z(a/n,2),u=l>=1&&!o;e(l),u?this.stop():this.animationId=requestAnimationFrame(r)};this.animationId=requestAnimationFrame(r)}stop(){this.isInProgress=!1,this.startedAt=null,A(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Kt(t){const{startY:e,endY:n,bottomSheetContainer:o,animationFrame:r,onEnd:i,animationTimingFunction:a,animationDuration:l}=t,u=Ct(e,n);r.stop();let h=!1;r.start(c=>{tt(o,{y:e+u*a(c)}),!h&&c>=1&&(i==null||i(),h=!0)},l)}const st=(t,e)=>n=>{Kt({...n,animationTimingFunction:t,animationDuration:e})},j={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!A(t)||t>1||t<0)}function Qt(t,e){const n={set(o,r,i,a){return e(r,i),Reflect.set(o,r,i,a)}};return new Proxy(t,n)}function Zt(...t){console.error(t)}const N={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function te(t){for(const e of Object.values(N))if(e===t)return!0;return!1}function Ot(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&A(t.p1x)&&A(t.p1y)&&A(t.p2x)&&A(t.p2y))}function U(t,e,n,o){return function(l){return a(r(l))};function r(l){let u=0,h=1,c=l,f;if(l===0||l===1)return l;for(;u<h;){if(f=i(c),Math.abs(f-l)<.001)return c;l>f?u=c:h=c,c=(h+u)/2}return c}function i(l){return 3*t*l*Math.pow(1-l,2)+3*n*Math.pow(l,2)*(1-l)+Math.pow(l,3)}function a(l){return 3*e*l*Math.pow(1-l,2)+3*o*Math.pow(l,2)*(1-l)+Math.pow(l,3)}}const gt=U(.25,.1,.25,1),ee=U(.42,0,1,1),Lt=U(.42,0,.58,1),ne=U(.4,.1,.6,1),oe=U(.45,1.5,.55,1);function re(t){switch(t){case N.EASE:return gt;case N.EASE_IN:return ee;case N.EASE_OUT:return Lt;case N.EASE_IN_OUT:return ne;case N.SPRING:return oe;default:return gt}}function vt(t){return typeof t=="boolean"}const ae={ariaLabel:"Bottom sheet",content:"",defaultPosition:j.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function ie(t){const e={...ae},n=Object.entries(t).reduce((o,r)=>{const[i,a]=r;return it(a)&&(o[i]=a),o},{});return{...e,...n}}function ct(t){if(Ot(t)){const{p1x:e,p1y:n,p2x:o,p2y:r}=t;return U(e,n,o,r)}return te(t)?re(t):Lt}function se(t,e,n,o){function r(i,a){switch(i){case"content":x(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":x(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":vt(a)||Q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":vt(a)||Q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":x(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"containerBackgroundColor":x(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":x(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":x(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!x(a))return;X(t.bottomSheetRoot,n.rootClass,a);break;case"containerClass":if(!x(a))return;X(t.bottomSheetContainer,n.containerClass,a);break;case"handleClass":if(!x(a))return;X(t.bottomSheetHandle,n.handleClass,a);break;case"contentWrapperClass":if(!x(a))return;X(t.bottomSheetContentWrapper,n.contentWrapperClass,a);break;case"backdropClass":if(!x(a))return;X(t.bottomSheetBackdrop,n.backdropClass,a);break;case"expandable":o.clearEventListeners(),o.attachEventListeners(n);break;case"preventClosing":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggable":o.clearEventListeners(),o.attachEventListeners(n);break;case"dragTriggers":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggingAnimationTimings":if(Ot(a)){const l=ct(a),u=st(l,n.draggingAnimationDuration);e.translateContainer=u}break;case"draggingAnimationDuration":if(A(a)){const l=ct(n.draggingAnimationTimings),u=st(l,a);e.translateContainer=u}break;case"rootStyle":n.rootStyle&&Object.assign(t.bottomSheetRoot.style,n.rootStyle);break;case"backdropStyle":n.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,n.backdropStyle);break;case"containerStyle":n.containerStyle&&Object.assign(t.bottomSheetContainer.style,n.containerStyle);break;case"containerGapFillerStyle":n.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,n.containerGapFillerStyle);break;case"handleStyle":n.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,n.handleStyle);break;case"contentWrapperStyle":n.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,n.contentWrapperStyle);break}}return r}function ce(t){const e=ie(t),n=ct(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:st(n,e.draggingAnimationDuration)},r={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function i(){r.originalDocumentOverflowY&&r.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=r.originalDocumentOverflowY),r.originalDocumentOverscrollBehavior&&(document.body.style.position=r.originalDocumentOverscrollBehavior)}const a=new Vt,l={animationFrame:a,onClose:E,bottomSheetState:o,draggingState:r,snapTo:b,moveUp:H,moveDown:L},{elements:u,eventHandlers:h}=_t(e,l),c=Qt(e,se(u,o,e,h)),{bottomSheetBackdrop:f,bottomSheetRoot:y,bottomSheetContainer:s}=u,C=d=>{const p=d??window.document.body;p.appendChild(y),p.appendChild(f);const g=window.innerHeight;tt(s,{y:g}),h.attachEventListeners(),o.isMounted=!0},v=()=>{h.clearEventListeners(),Object.values(u).forEach(d=>{d.remove()}),i(),o.isMounted=!1},S=()=>{var d;if(B()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(d=t.beforeOpen)==null||d.call(t),k())return;nt(f,!0),c.shouldShowBackdrop||V(f,"transparent"),nt([s],!0),tt(s,{y:s.clientHeight});const p=window.innerHeight,g=pt(p,s.clientHeight,c.marginTop,c.defaultPosition),m=M(s).y;o.translateContainer({startY:m,endY:g,animationFrame:a,bottomSheetContainer:s,onEnd:t.afterOpen});const O=document.body.style.overflowY;r.originalDocumentOverflowY=O||"initial";const D=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",u.bottomSheetHandle.focus(),h.attacheOnOpenEventListeners()};function E(){var d;if(Y())return;(d=t.beforeClose)==null||d.call(t);const p=M(s).y,g=s.clientHeight;o.translateContainer({startY:p,endY:g,animationFrame:a,bottomSheetContainer:s,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),nt([f,s],!1),h.clearOnOpenEventListeners()}}),i()}function B(){return o.isMounted}function k(){const d=M(s).y,p=window.innerHeight,g=s.clientHeight>=p?p:s.clientHeight;return d<=g}function Y(){return!k()}function $(){const d=M(s).y,p=s.clientHeight,g=window.innerHeight;if(d<=5&&d>=-5)return j.CONTENT_HEIGHT;const m=p-d;if(m===g/2)return j.MIDDLE;const O=g-c.marginTop,D=10;return m<=O+D&&m>=O-D?j.TOP:j.CLOSED}function _(){return s.clientHeight}function F(d){if(!k())return;const p=M(s).y,g=s.clientHeight-p,m=window.innerHeight-d,O=It(g,m),D=z(g,m);o.translateContainer({startY:p,endY:p+(O.isUp?-D:D),animationFrame:a,bottomSheetContainer:s})}function I(d,{viewportHeight:p,visibleHeight:g}){let m=null;for(const O of d){const D=O*p,R=z(g,D);(m===null||R<m)&&(m=R)}return{minOffset:m}}function H(){const d=[...c.snapPoints].reverse(),p=M(s).y,g=s.clientHeight,m=g-p;if(!c.expandable&&m>=g)return;const O=window.innerHeight,D=ht("above",{visibleHeight:m,viewportHeight:O},d),{minOffset:R}=I(D,{visibleHeight:m,viewportHeight:O});if(R===null&&m<O-c.marginTop){o.translateContainer({startY:p,endY:pt(O,g,c.marginTop,"top"),animationFrame:a,bottomSheetContainer:s});return}A(R)&&o.translateContainer({startY:p,endY:p-R,animationFrame:a,bottomSheetContainer:s})}function L(){const d=M(s).y,p=s.clientHeight-d;if(p<1)return;const g=window.innerHeight,m=ht("below",{visibleHeight:p,viewportHeight:g},c.snapPoints),{minOffset:O}=I(m,{visibleHeight:p,viewportHeight:g});A(O)&&o.translateContainer({startY:d,endY:d+O,animationFrame:a,bottomSheetContainer:s})}function b(d){const p=window.innerHeight;if(!Jt(d))return;const g=Z(p*d,2);F(g)}return{props:c,elements:u,mount:C,unmount:v,open:S,close:E,getIsMounted:B,getIsOpen:k,getIsClosed:Y,getPosition:$,getHeight:_,moveTo:F,snapTo:b}}function lt(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>j.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}const le=lt(),ue=w.forwardRef(function(e,n){const{children:o,isOpen:r,setIsOpen:i,afterClose:a,mountingPointRef:l,...u}=e,h=w.useRef(le),[c,f]=w.useState(h.current);w.useImperativeHandle(n,()=>c,[c]);const y=w.useCallback(()=>{i(!1),a==null||a()},[a]);w.useEffect(()=>{r?c.open():c.close()},[r]);const s=w.useRef(null);return w.useEffect(function(){var E;if(l&&!l.current)return;const v=Bt((E=e.mountingPointRef)==null?void 0:E.current)?e.mountingPointRef.current:window.document.body;if(!v||c.getIsMounted())return;const S=ce({content:"",...u,afterClose:y});return S.mount(v),s.current=S.elements.bottomSheetContentWrapper??null,h.current=S,f(S),()=>{c.unmount()}},[e.mountingPointRef,u,y]),w.useEffect(function(){Object.assign(h.current.props,{...u}),f(h.current)},[u]),w.useEffect(function(){return()=>{h.current.unmount()}},[]),s.current?xt.createPortal(e.children,s.current):null}),de=lt();function pe(t={}){const e=w.useRef(de),[n,o]=w.useState(!1),r=!n,[i,a]=w.useState(e.current);w.useEffect(()=>{a(e.current)},[e.current]);const{beforeOpen:l,afterOpen:u,beforeClose:h,afterClose:c,onDragStart:f,onDragMove:y,onDragEnd:s,...C}=t,v=()=>{l==null||l()},S=()=>{u==null||u(),o(!0)},E=()=>{h==null||h()},B=()=>{c==null||c(),o(!1)},k=()=>{f==null||f()},Y=(b,d)=>{y==null||y(b,d)},$=()=>{s==null||s()},_=w.useMemo(()=>({ref:e,isOpen:n,setIsOpen:o,beforeOpen:v,afterOpen:S,beforeClose:E,afterClose:B,onDragStart:k,onDragMove:Y,onDragEnd:$,...C}),[e.current,n,o,t]),F=w.useCallback(()=>{o(!0)},[o]),I=w.useCallback(()=>{o(!1)},[o]),H=w.useCallback((...b)=>{i.moveTo(...b)},[i]),L=w.useCallback((...b)=>{i.snapTo(...b)},[i]);return{props:_,instance:i,isOpen:n,isClosed:r,setIsOpen:o,open:F,close:I,moveTo:H,snapTo:L}}exports.BottomSheet=ue;exports.createPlaceholderBottomSheet=lt;exports.useBottomSheet=pe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),xt=require("react-dom");function Bt(t){return t!=null}(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var At=Object.defineProperty,Dt=(t,e,n)=>e in t?At(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K=(t,e,n)=>Dt(t,typeof e!="symbol"?e+"":e,n);function x(t){return typeof t=="string"}function Mt(t,e){return t.classList.contains(et(e))}function V(t,e){t.classList.add(et(e))}function ot(t,e){t.classList.remove(et(e))}function X(t,e,n){x(n)&&(x(e)&&ot(t,e),V(t,n))}function et(t){return x(t)?t.trim().replace(/\./g,""):""}function W(t){return t.map(e=>et(e)).filter(Boolean).join(" ")}function Pt(t){return t.map(e=>e==null?void 0:e.trim()).filter(Boolean).map(e=>`.${e}`).join(" ")}const ut="open",dt="hidden";function nt(t,e){const n=e;if(Array.isArray(t)){t.forEach(o=>{Q(o,n),o.setAttribute("aria-modal",n?"true":"false")});return}Q(t,n),t.setAttribute("aria-modal",n?"true":"false")}function Q(t,e){e?(V(t,ut),ot(t,dt)):(V(t,dt),ot(t,ut))}function St(t){return t instanceof HTMLElement}function A(t){return typeof t=="number"&&!Number.isNaN(t)}function Yt(t){St(t)&&t.focus()}function Ft(t){if(!St(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),n=A(e)?parseInt(e,10):-1,o=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),r=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return o||r||n>-1}var T=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(T||{}),rt=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(rt||{}),J=(t=>(t.Hidden="hidden",t))(J||{});function P(t,e,n){const o=document.createElement(t);return e.split(" ").forEach(r=>{V(o,r)}),x(n)&&o.setAttribute("data-testid",n),o}Pt([T.Root,T.ContentWrapper]);function pt(t,e,n,o){switch(o){case"content-height":return e>=t?Et(t,e,n):0;case"middle":return-(t/2-e);case"top":return-(t-e)+n;default:return 0}}function yt(t,e){const n=e<t,o=e>t;return{isUp:n,isDown:o,stayedSame:e===t}}function Ct(t,e){return e<t?-(t-e):e-t}function z(t,e){return t>e?t-e:e-t}function It(t,e){const n=t<e,o=t>e;return{isUp:n,isDown:o,stayedSame:t===e}}function ht(t,e,n){const o=t==="above";return n.filter(r=>{const i=r*e.viewportHeight;return o?e.visibleHeight<i:e.visibleHeight>i})}function Et(t,e,n){return-(t-e)+n}function mt(t){return Number(t.replace("px",""))}function Z(t,...e){return Number(t.toFixed(...e))}function wt(t){const e=/(?<type>\w+)\((?<values>[^)]+)\)/g,n=[];let o;for(;(o=e.exec(t))!==null;){const r=o[1],i=o[2].split(",").map(a=>a.trim());n.push({type:r,values:i})}return n}function Rt(t){const e=t.style.transform,n=wt(e);return{transform:e,transformValues:n}}function kt(t,e){return t.find(o=>o.type.startsWith(e))||null}const at="translate";function M(t){const e=t.style.transform,n=wt(e),o=kt(n,at);return Tt(o??{type:at,values:[]})}function tt(t,{x:e,y:n}){const{transform:o,transformValues:r}=Rt(t),i=kt(r,at);if(i){const a=Tt(i);t.style.transform=`translate(${e??a.x??0}px,${n??a.y??0}px)`;return}if(o){t.style.transform=`${o}, translate(${e??0}px,${n??0}px)`;return}t.style.transform=`translate(${e??0}px,${n??0}px)`}function Tt(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const e=t.values[0],n=t.values[1];return{x:mt(e)??0,y:mt(n)??0}}function it(t){return t!=null}function ft(t,{min:e,max:n}){return it(n)&&t>=n?n:it(e)&&t<=e?e:t}const Wt=(t,e,n)=>{e instanceof HTMLElement&&!Mt(e,T.Handle)&&n.scrollTop>=1||(t.isDragging=!0)},Nt=(t,e,n,o)=>r=>{o.startY=t.getCoordinates(r).y,o.containerStartTranslate=M(e),n.onDragStart()},jt=(t,e,n,o,r)=>i=>{Gt(i,t,n,o,r,e,n.marginTop)};function Gt(t,e,n,o,r,i,a){if(!o.isDragging||!A(o.startY))return;const l=e.getCoordinates(t).y,u=Ct(o.startY,l),h=window.innerHeight,s=i.clientHeight,f=s-(o.containerStartTranslate.y+u);if(f>=h)return;const y=yt(o.startY,l);if(y.isUp&&!n.expandable&&f>=s||n.preventClosing&&f<=s)return;r.start(()=>{tt(i,{y:o.containerStartTranslate.y+u})},0);const c=h-a,C=s-o.containerStartTranslate.y;if(y.isUp){const v=c-C,S=c-f,E=ft(1-Z(S/v,2),{min:0,max:1});n.onDragMove(y,E)}else if(y.isDown){const v=ft(Z(1-f/C,2),{min:0,max:1});n.onDragMove(y,v)}}const Ut=(t,e,n,o,r,i,a)=>l=>{if(!o.isDragging||(o.isDragging=!1,!A(o.startY)))return;n.onDragEnd();const u=o.startY,h=t.getCoordinates(l).y,s=M(e).y,f=yt(u,h),y=window.innerHeight,c=e.clientHeight;if(f.isUp){if(!n.expandable)return;const C=[...n.snapPoints].sort((E,B)=>E-B),v=c+-s;for(const E of C){const B=E*window.innerHeight;if(v<=B){const k=z(v,B);a.translateContainer({startY:s,endY:s-k,animationFrame:r,bottomSheetContainer:e});return}}const S=Et(y,c,n.marginTop);a.translateContainer({startY:s,endY:S,animationFrame:r,bottomSheetContainer:e})}else if(f.isDown){const C=[...n.snapPoints].sort((v,S)=>S-v);for(const v of C){const S=v*window.innerHeight,E=c+-s;if(E>=S){const B=z(E,S);a.translateContainer({startY:s,endY:s+B,animationFrame:r,bottomSheetContainer:e});return}}if(n.preventClosing){const v=c+-s;if(v>=c){const S=z(v,c);a.translateContainer({startY:s,endY:s+S,animationFrame:r,bottomSheetContainer:e})}return}i()}};var G=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(G||{});function bt(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const $t={eventPhase:G.All};class q{constructor(e){K(this,"currentTarget"),this.currentTarget=e}addEventListeners({onStart:e,onStartOptions:n=$t,onMove:o,onEnd:r}){this.addTouchEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r}),this.addMouseEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r})}addTouchEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r}){e&&this.currentTarget.addEventListener("touchstart",i=>{if(n.eventPhase===G.All){e(i);return}bt(i.eventPhase)===n.eventPhase&&e(i)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),r&&this.currentTarget.addEventListener("touchend",r)}addMouseEventListeners({onStart:e,onStartOptions:n,onMove:o,onEnd:r}){e&&this.currentTarget.addEventListener("mousedown",i=>{if(n.eventPhase===G.All){e(i);return}bt(i.eventPhase)===n.eventPhase&&e(i)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),r&&this.currentTarget.addEventListener("mouseup",i=>{r(i)})}removeEventListeners({onStart:e,onMove:n,onEnd:o}){e&&this.currentTarget.removeEventListener("touchstart",e),o&&this.currentTarget.removeEventListener("touchend",o),n&&this.currentTarget.removeEventListener("touchmove",n),e&&this.currentTarget.removeEventListener("mousedown",e),n&&this.currentTarget.removeEventListener("mousemove",n),o&&this.currentTarget.removeEventListener("mouseup",o)}getCoordinates(e){if(e.type==="touchstart"||e.type==="mousedown"){if("touches"in e)return{x:e.touches[0].clientX,y:e.touches[0].clientY};if(e instanceof MouseEvent)return{x:e.clientX,y:e.clientY}}if(e.type==="touchend"||e.type==="mouseup"||e.type==="mousemove"||e.type==="touchmove"){if("touches"in e)return{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY};if(e instanceof MouseEvent)return{x:e.clientX,y:e.clientY}}return{x:0,y:0}}}function Ht(t){const e=t;return`${e} ${e} 0px 0px`}function _t(t,e){const n=Xt(t);qt(n),n.bottomSheetContainer.style.width=t.width;const o=document.createElement("div");o.innerHTML=t.content??"";const r=window.innerHeight;n.bottomSheetContainer.style.maxHeight=`${r}px`,n.bottomSheetContentWrapper.appendChild(o);const i=zt({bottomSheetElements:n,bottomSheetProps:t,options:e});return t.rootStyle&&Object.assign(n.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(n.bottomSheetBackdrop.style,t.backdropStyle),t.containerGapFillerStyle&&Object.assign(n.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(n.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(n.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(n.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:n,eventHandlers:i}}function Xt(t){const e=P("dialog",W([T.Root,rt.Dialog,t.rootClass]),T.Root);e.ariaLabel=t.ariaLabel;const n=P("section",W([T.Container,t.containerClass]),T.Container);t.containerBorderRadius&&(n.style.borderRadius=Ht(t.containerBorderRadius));const o=P("div",T.GapFiller,T.GapFiller);t.containerBackgroundColor&&(n.style.backgroundColor=t.containerBackgroundColor,o.style.backgroundColor=t.containerBackgroundColor);const r=P("button",W([T.Handle,rt.Button,t.shouldShowHandle?null:J.Hidden,t.handleClass]),T.Handle);r.setAttribute("type","button"),r.ariaLabel="bottom sheet close button";const i=P("span",W([T.HandleBar,t.shouldShowHandle?null:J.Hidden]),T.HandleBar),a=P("article",W([T.ContentWrapper,t.contentWrapperClass]),T.ContentWrapper),l=P("div",W([T.Backdrop,t.backdropClass,J.Hidden]),T.Backdrop);return t.backdropColor&&(l.style.backgroundColor=t.backdropColor),t.backDropTransition&&(l.style.transition=t.backDropTransition),{bottomSheetRoot:e,bottomSheetBackdrop:l,bottomSheetContainer:n,bottomSheetHandle:r,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:o}}function qt({bottomSheetRoot:t,bottomSheetContainer:e,bottomSheetHandle:n,bottomSheetHandleBar:o,bottomSheetContentWrapper:r,bottomSheetContainerGapFiller:i}){t.appendChild(e),n.appendChild(o),e.appendChild(n),e.appendChild(r),e.appendChild(i)}function zt({bottomSheetElements:t,bottomSheetProps:e,options:n}){const{bottomSheetRoot:o,bottomSheetContainer:r,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:l,bottomSheetBackdrop:u}=t,{animationFrame:h}=n,s=new q(i),f=new q(l),y=new q(a);let c=[];const C=new q(window),v=Nt(C,r,e,n.draggingState),S=jt(C,r,e,n.draggingState,h),E=Ut(C,r,e,n.draggingState,h,n.onClose,n.bottomSheetState);function B(H){H.target instanceof Element&&!o.contains(H.target)&&n.onClose()}function k(H){Wt(n.draggingState,H.target,t.bottomSheetContentWrapper)}function Y(H){const L=H??e;L.draggable&&L.backgroundDraggable&&(f.addEventListeners({onStart:k,onStartOptions:{eventPhase:G.Target}}),y.addEventListeners({onStart:k})),L.draggable&&C.addEventListeners({onStart:v,onMove:S,onEnd:E}),L.draggable&&window.document.addEventListener("keyup",b=>{b.key==="Escape"&&n.onClose()}),i.addEventListener("keyup",b=>{if(b.key==="ArrowUp"){n.moveUp();return}if(b.key==="ArrowDown"){n.moveDown();return}if(b.shiftKey&&b.key==="Tab"){const d=F(t.bottomSheetContentWrapper);Yt(d)}})}function $(H){const L=H??e;e.shouldCloseOnOutsideClick&&!e.preventClosing?u.addEventListener("click",B):u.style.pointerEvents="none",L.draggable&&(s.addEventListeners({onStart:k}),c.forEach(b=>{b.removeEventListeners({onStart:k})}),c=e.dragTriggers.reduce((b,d)=>{const p=o.querySelectorAll(d);if(!p.length)return b;const g=Array.from(p).map(m=>m instanceof HTMLElement?new q(m):null).filter(m=>!!m);return[...b,...g]},[]),c.forEach(b=>{b.addEventListeners({onStart:k,onStartOptions:{eventPhase:G.Target}})}))}function _(){u.removeEventListener("click",B)}function F(H){let L=[...Array.from(H.childNodes).reverse()];for(;L.length;){const b=L.shift();if(Ft(b))return b;b&&(L=[...L,...Array.from(b.childNodes).reverse()])}return null}function I(){s.removeEventListeners({onStart:k}),f.removeEventListeners({onStart:k}),y.removeEventListeners({onStart:k}),c.forEach(H=>{H.removeEventListeners({onStart:k})}),C.removeEventListeners({onStart:v,onMove:S,onEnd:E})}return{attachEventListeners:Y,clearEventListeners:I,attacheOnOpenEventListeners:$,clearOnOpenEventListeners:_}}class Vt{constructor(){K(this,"animationId"),K(this,"isInProgress"),K(this,"startedAt"),this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(e,n,o=!1){this.isInProgress=!0;const r=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,l=n===0?1:Z(a/n,2),u=l>=1&&!o;e(l),u?this.stop():this.animationId=requestAnimationFrame(r)};this.animationId=requestAnimationFrame(r)}stop(){this.isInProgress=!1,this.startedAt=null,A(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Kt(t){const{startY:e,endY:n,bottomSheetContainer:o,animationFrame:r,onEnd:i,animationTimingFunction:a,animationDuration:l}=t,u=Ct(e,n);r.stop();let h=!1;r.start(s=>{tt(o,{y:e+u*a(s)}),!h&&s>=1&&(i==null||i(),h=!0)},l)}const st=(t,e)=>n=>{Kt({...n,animationTimingFunction:t,animationDuration:e})},j={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!A(t)||t>1||t<0)}function Qt(t,e){const n={set(o,r,i,a){return e(r,i),Reflect.set(o,r,i,a)}};return new Proxy(t,n)}function Zt(...t){console.error(t)}const N={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function te(t){for(const e of Object.values(N))if(e===t)return!0;return!1}function Ot(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&A(t.p1x)&&A(t.p1y)&&A(t.p2x)&&A(t.p2y))}function U(t,e,n,o){return function(l){return a(r(l))};function r(l){let u=0,h=1,s=l,f;if(l===0||l===1)return l;for(;u<h;){if(f=i(s),Math.abs(f-l)<.001)return s;l>f?u=s:h=s,s=(h+u)/2}return s}function i(l){return 3*t*l*Math.pow(1-l,2)+3*n*Math.pow(l,2)*(1-l)+Math.pow(l,3)}function a(l){return 3*e*l*Math.pow(1-l,2)+3*o*Math.pow(l,2)*(1-l)+Math.pow(l,3)}}const gt=U(.25,.1,.25,1),ee=U(.42,0,1,1),Lt=U(.42,0,.58,1),ne=U(.4,.1,.6,1),oe=U(.45,1.5,.55,1);function re(t){switch(t){case N.EASE:return gt;case N.EASE_IN:return ee;case N.EASE_OUT:return Lt;case N.EASE_IN_OUT:return ne;case N.SPRING:return oe;default:return gt}}function vt(t){return typeof t=="boolean"}const ae={ariaLabel:"Bottom sheet",content:"",defaultPosition:j.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function ie(t){const e={...ae},n=Object.entries(t).reduce((o,r)=>{const[i,a]=r;return it(a)&&(o[i]=a),o},{});return{...e,...n}}function ct(t){if(Ot(t)){const{p1x:e,p1y:n,p2x:o,p2y:r}=t;return U(e,n,o,r)}return te(t)?re(t):Lt}function se(t,e,n,o){function r(i,a){switch(i){case"content":x(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":x(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":vt(a)||Q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":vt(a)||Q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":x(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"containerBackgroundColor":x(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":x(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":x(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!x(a))return;X(t.bottomSheetRoot,n.rootClass,a);break;case"containerClass":if(!x(a))return;X(t.bottomSheetContainer,n.containerClass,a);break;case"handleClass":if(!x(a))return;X(t.bottomSheetHandle,n.handleClass,a);break;case"contentWrapperClass":if(!x(a))return;X(t.bottomSheetContentWrapper,n.contentWrapperClass,a);break;case"backdropClass":if(!x(a))return;X(t.bottomSheetBackdrop,n.backdropClass,a);break;case"expandable":o.clearEventListeners(),o.attachEventListeners(n);break;case"preventClosing":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggable":o.clearEventListeners(),o.attachEventListeners(n);break;case"dragTriggers":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggingAnimationTimings":if(Ot(a)){const l=ct(a),u=st(l,n.draggingAnimationDuration);e.translateContainer=u}break;case"draggingAnimationDuration":if(A(a)){const l=ct(n.draggingAnimationTimings),u=st(l,a);e.translateContainer=u}break;case"rootStyle":n.rootStyle&&Object.assign(t.bottomSheetRoot.style,n.rootStyle);break;case"backdropStyle":n.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,n.backdropStyle);break;case"containerStyle":n.containerStyle&&Object.assign(t.bottomSheetContainer.style,n.containerStyle);break;case"containerGapFillerStyle":n.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,n.containerGapFillerStyle);break;case"handleStyle":n.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,n.handleStyle);break;case"contentWrapperStyle":n.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,n.contentWrapperStyle);break}}return r}function ce(t){const e=ie(t),n=ct(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:st(n,e.draggingAnimationDuration)},r={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function i(){r.originalDocumentOverflowY&&r.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=r.originalDocumentOverflowY),r.originalDocumentOverscrollBehavior&&(document.body.style.position=r.originalDocumentOverscrollBehavior)}const a=new Vt,l={animationFrame:a,onClose:E,bottomSheetState:o,draggingState:r,snapTo:b,moveUp:H,moveDown:L},{elements:u,eventHandlers:h}=_t(e,l),s=Qt(e,se(u,o,e,h)),{bottomSheetBackdrop:f,bottomSheetRoot:y,bottomSheetContainer:c}=u,C=d=>{const p=d??window.document.body;p.appendChild(y),p.appendChild(f);const g=window.innerHeight;tt(c,{y:g}),h.attachEventListeners(),o.isMounted=!0},v=()=>{h.clearEventListeners(),Object.values(u).forEach(d=>{d.remove()}),i(),o.isMounted=!1},S=()=>{var d;if(B()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(d=t.beforeOpen)==null||d.call(t),k())return;nt(f,!0),s.shouldShowBackdrop||V(f,"transparent"),nt([c],!0),tt(c,{y:c.clientHeight});const p=window.innerHeight,g=pt(p,c.clientHeight,s.marginTop,s.defaultPosition),m=M(c).y;o.translateContainer({startY:m,endY:g,animationFrame:a,bottomSheetContainer:c,onEnd:t.afterOpen});const O=document.body.style.overflowY;r.originalDocumentOverflowY=O||"initial";const D=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",u.bottomSheetHandle.focus(),h.attacheOnOpenEventListeners()};function E(){var d;if(Y())return;(d=t.beforeClose)==null||d.call(t);const p=M(c).y,g=c.clientHeight;o.translateContainer({startY:p,endY:g,animationFrame:a,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),nt([f,c],!1),h.clearOnOpenEventListeners()}}),i()}function B(){return o.isMounted}function k(){const d=M(c).y,p=window.innerHeight,g=c.clientHeight>=p?p:c.clientHeight;return d<=g}function Y(){return!k()}function $(){const d=M(c).y,p=c.clientHeight,g=window.innerHeight;if(d<=5&&d>=-5)return j.CONTENT_HEIGHT;const m=p-d;if(m===g/2)return j.MIDDLE;const O=g-s.marginTop,D=10;return m<=O+D&&m>=O-D?j.TOP:j.CLOSED}function _(){return c.clientHeight}function F(d){if(!k())return;const p=M(c).y,g=c.clientHeight-p,m=window.innerHeight-d,O=It(g,m),D=z(g,m);o.translateContainer({startY:p,endY:p+(O.isUp?-D:D),animationFrame:a,bottomSheetContainer:c})}function I(d,{viewportHeight:p,visibleHeight:g}){let m=null;for(const O of d){const D=O*p,R=z(g,D);(m===null||R<m)&&(m=R)}return{minOffset:m}}function H(){const d=[...s.snapPoints].reverse(),p=M(c).y,g=c.clientHeight,m=g-p;if(!s.expandable&&m>=g)return;const O=window.innerHeight,D=ht("above",{visibleHeight:m,viewportHeight:O},d),{minOffset:R}=I(D,{visibleHeight:m,viewportHeight:O});if(R===null&&m<O-s.marginTop){o.translateContainer({startY:p,endY:pt(O,g,s.marginTop,"top"),animationFrame:a,bottomSheetContainer:c});return}A(R)&&o.translateContainer({startY:p,endY:p-R,animationFrame:a,bottomSheetContainer:c})}function L(){const d=M(c).y,p=c.clientHeight-d;if(p<1)return;const g=window.innerHeight,m=ht("below",{visibleHeight:p,viewportHeight:g},s.snapPoints),{minOffset:O}=I(m,{visibleHeight:p,viewportHeight:g});A(O)&&o.translateContainer({startY:d,endY:d+O,animationFrame:a,bottomSheetContainer:c})}function b(d){const p=window.innerHeight;if(!Jt(d))return;const g=Z(p*d,2);F(g)}return{props:s,elements:u,mount:C,unmount:v,open:S,close:E,getIsMounted:B,getIsOpen:k,getIsClosed:Y,getPosition:$,getHeight:_,moveTo:F,snapTo:b}}function lt(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>j.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}const le=lt(),ue=w.forwardRef(function(e,n){const{children:o,isOpen:r,setIsOpen:i,afterClose:a,mountingPointRef:l,...u}=e,h=w.useRef(le),[s,f]=w.useState(h.current);w.useImperativeHandle(n,()=>s,[s]);const y=w.useCallback(()=>{i(!1),a==null||a()},[a]);w.useEffect(()=>{r?s.open():s.close()},[r]);const c=w.useRef(null);return w.useEffect(function(){var E;if(l&&!l.current)return;const v=Bt((E=e.mountingPointRef)==null?void 0:E.current)?e.mountingPointRef.current:window.document.body;if(!v||s.getIsMounted())return;const S=ce({content:"",...u,afterClose:y});return S.mount(v),c.current=S.elements.bottomSheetContentWrapper??null,h.current=S,f(S),()=>{s.unmount()}},[e.mountingPointRef,u,y]),w.useEffect(function(){Object.assign(h.current.props,{...u}),f(h.current)},[u]),w.useEffect(function(){return()=>{h.current.unmount()}},[]),c.current?xt.createPortal(e.children,c.current):null}),de=lt();function pe(t={}){const e=w.useRef(de),[n,o]=w.useState(!1),r=!n,[i,a]=w.useState(e.current);w.useEffect(()=>{a(e.current)},[e.current]);const{beforeOpen:l,afterOpen:u,beforeClose:h,afterClose:s,onDragStart:f,onDragMove:y,onDragEnd:c,...C}=t,v=()=>{l==null||l()},S=()=>{u==null||u(),o(!0)},E=()=>{h==null||h()},B=()=>{s==null||s(),o(!1)},k=()=>{f==null||f()},Y=(b,d)=>{y==null||y(b,d)},$=()=>{c==null||c()},_=w.useMemo(()=>({ref:e,isOpen:n,setIsOpen:o,beforeOpen:v,afterOpen:S,beforeClose:E,afterClose:B,onDragStart:k,onDragMove:Y,onDragEnd:$,...C}),[e.current,n,o,t]),F=w.useCallback(()=>{o(!0)},[o]),I=w.useCallback(()=>{o(!1)},[o]),H=w.useCallback((...b)=>{i.moveTo(...b)},[i]),L=w.useCallback((...b)=>{i.snapTo(...b)},[i]);return{props:_,instance:i,isOpen:n,isClosed:r,setIsOpen:o,open:F,close:I,moveTo:H,snapTo:L}}exports.BottomSheet=ue;exports.createPlaceholderBottomSheet=lt;exports.useBottomSheet=pe;
@@ -222,20 +222,20 @@ const _t = (t, e, n) => {
222
222
  function qt(t, e, n, o, r, i, a) {
223
223
  if (!o.isDragging || !A(o.startY))
224
224
  return;
225
- const l = e.getCoordinates(t).y, u = wt(o.startY, l), h = window.innerHeight, c = i.clientHeight, f = c - (o.containerStartTranslate.y + u);
225
+ const l = e.getCoordinates(t).y, u = wt(o.startY, l), h = window.innerHeight, s = i.clientHeight, f = s - (o.containerStartTranslate.y + u);
226
226
  if (f >= h)
227
227
  return;
228
228
  const y = Et(o.startY, l);
229
- if (y.isUp && !n.expandable && f >= c || n.preventClosing && f <= c)
229
+ if (y.isUp && !n.expandable && f >= s || n.preventClosing && f <= s)
230
230
  return;
231
231
  r.start(() => {
232
232
  et(i, {
233
233
  y: o.containerStartTranslate.y + u
234
234
  });
235
235
  }, 0);
236
- const s = h - a, C = c - o.containerStartTranslate.y;
236
+ const c = h - a, C = s - o.containerStartTranslate.y;
237
237
  if (y.isUp) {
238
- const v = s - C, S = s - f, E = gt(
238
+ const v = c - C, S = c - f, E = gt(
239
239
  1 - tt(S / v, 2),
240
240
  {
241
241
  min: 0,
@@ -261,13 +261,13 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
261
261
  if (!o.isDragging || (o.isDragging = !1, !A(o.startY)))
262
262
  return;
263
263
  n.onDragEnd();
264
- const u = o.startY, h = t.getCoordinates(l).y, c = D(e).y, f = Et(u, h), y = window.innerHeight, s = e.clientHeight;
264
+ const u = o.startY, h = t.getCoordinates(l).y, s = D(e).y, f = Et(u, h), y = window.innerHeight, c = e.clientHeight;
265
265
  if (f.isUp) {
266
+ if (!n.expandable)
267
+ return;
266
268
  const C = [...n.snapPoints].sort(
267
269
  (E, x) => E - x
268
- ), v = s + -c;
269
- if (!n.expandable && v >= s)
270
- return;
270
+ ), v = c + -s;
271
271
  for (const E of C) {
272
272
  const x = E * window.innerHeight;
273
273
  if (v <= x) {
@@ -276,8 +276,8 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
276
276
  x
277
277
  );
278
278
  a.translateContainer({
279
- startY: c,
280
- endY: c - w,
279
+ startY: s,
280
+ endY: s - w,
281
281
  animationFrame: r,
282
282
  bottomSheetContainer: e
283
283
  });
@@ -286,11 +286,11 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
286
286
  }
287
287
  const S = kt(
288
288
  y,
289
- s,
289
+ c,
290
290
  n.marginTop
291
291
  );
292
292
  a.translateContainer({
293
- startY: c,
293
+ startY: s,
294
294
  endY: S,
295
295
  animationFrame: r,
296
296
  bottomSheetContainer: e
@@ -300,15 +300,15 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
300
300
  (v, S) => S - v
301
301
  );
302
302
  for (const v of C) {
303
- const S = v * window.innerHeight, E = s + -c;
303
+ const S = v * window.innerHeight, E = c + -s;
304
304
  if (E >= S) {
305
305
  const x = V(
306
306
  E,
307
307
  S
308
308
  );
309
309
  a.translateContainer({
310
- startY: c,
311
- endY: c + x,
310
+ startY: s,
311
+ endY: s + x,
312
312
  animationFrame: r,
313
313
  bottomSheetContainer: e
314
314
  });
@@ -316,12 +316,12 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
316
316
  }
317
317
  }
318
318
  if (n.preventClosing) {
319
- const v = s + -c;
320
- if (v >= s) {
321
- const S = V(v, s);
319
+ const v = c + -s;
320
+ if (v >= c) {
321
+ const S = V(v, c);
322
322
  a.translateContainer({
323
- startY: c,
324
- endY: c + S,
323
+ startY: s,
324
+ endY: s + S,
325
325
  animationFrame: r,
326
326
  bottomSheetContainer: e
327
327
  });
@@ -556,12 +556,12 @@ function te({
556
556
  bottomSheetContainerGapFiller: a,
557
557
  bottomSheetContentWrapper: l,
558
558
  bottomSheetBackdrop: u
559
- } = t, { animationFrame: h } = n, c = new X(i), f = new X(
559
+ } = t, { animationFrame: h } = n, s = new X(i), f = new X(
560
560
  l
561
561
  ), y = new X(
562
562
  a
563
563
  );
564
- let s = [];
564
+ let c = [];
565
565
  const C = new X(
566
566
  window
567
567
  ), v = Xt(
@@ -628,19 +628,19 @@ function te({
628
628
  }
629
629
  function U(T) {
630
630
  const O = T ?? e;
631
- e.shouldCloseOnOutsideClick && !e.preventClosing ? u.addEventListener("click", x) : u.style.pointerEvents = "none", O.draggable && (c.addEventListeners({
631
+ e.shouldCloseOnOutsideClick && !e.preventClosing ? u.addEventListener("click", x) : u.style.pointerEvents = "none", O.draggable && (s.addEventListeners({
632
632
  onStart: w
633
- }), s.forEach((b) => {
633
+ }), c.forEach((b) => {
634
634
  b.removeEventListeners({
635
635
  onStart: w
636
636
  });
637
- }), s = e.dragTriggers.reduce((b, d) => {
637
+ }), c = e.dragTriggers.reduce((b, d) => {
638
638
  const p = o.querySelectorAll(d);
639
639
  if (!p.length)
640
640
  return b;
641
641
  const g = Array.from(p).map((m) => m instanceof HTMLElement ? new X(m) : null).filter((m) => !!m);
642
642
  return [...b, ...g];
643
- }, []), s.forEach((b) => {
643
+ }, []), c.forEach((b) => {
644
644
  b.addEventListeners({
645
645
  onStart: w,
646
646
  onStartOptions: {
@@ -666,13 +666,13 @@ function te({
666
666
  return null;
667
667
  }
668
668
  function F() {
669
- c.removeEventListeners({
669
+ s.removeEventListeners({
670
670
  onStart: w
671
671
  }), f.removeEventListeners({
672
672
  onStart: w
673
673
  }), y.removeEventListeners({
674
674
  onStart: w
675
- }), s.forEach((T) => {
675
+ }), c.forEach((T) => {
676
676
  T.removeEventListeners({
677
677
  onStart: w
678
678
  });
@@ -723,10 +723,10 @@ function ne(t) {
723
723
  } = t, u = wt(e, n);
724
724
  r.stop();
725
725
  let h = !1;
726
- r.start((c) => {
726
+ r.start((s) => {
727
727
  et(o, {
728
- y: e + u * a(c)
729
- }), !h && c >= 1 && (i == null || i(), h = !0);
728
+ y: e + u * a(s)
729
+ }), !h && s >= 1 && (i == null || i(), h = !0);
730
730
  }, l);
731
731
  }
732
732
  const ut = (t, e) => (n) => {
@@ -776,15 +776,15 @@ function G(t, e, n, o) {
776
776
  return a(r(l));
777
777
  };
778
778
  function r(l) {
779
- let u = 0, h = 1, c = l, f;
779
+ let u = 0, h = 1, s = l, f;
780
780
  if (l === 0 || l === 1)
781
781
  return l;
782
782
  for (; u < h; ) {
783
- if (f = i(c), Math.abs(f - l) < 1e-3)
784
- return c;
785
- l > f ? u = c : h = c, c = (h + u) / 2;
783
+ if (f = i(s), Math.abs(f - l) < 1e-3)
784
+ return s;
785
+ l > f ? u = s : h = s, s = (h + u) / 2;
786
786
  }
787
- return c;
787
+ return s;
788
788
  }
789
789
  function i(l) {
790
790
  return 3 * t * l * Math.pow(1 - l, 2) + 3 * n * Math.pow(l, 2) * (1 - l) + Math.pow(l, 3);
@@ -1059,7 +1059,7 @@ function me(t) {
1059
1059
  }, { elements: u, eventHandlers: h } = Jt(
1060
1060
  e,
1061
1061
  l
1062
- ), c = re(
1062
+ ), s = re(
1063
1063
  e,
1064
1064
  he(
1065
1065
  u,
@@ -1067,11 +1067,11 @@ function me(t) {
1067
1067
  e,
1068
1068
  h
1069
1069
  )
1070
- ), { bottomSheetBackdrop: f, bottomSheetRoot: y, bottomSheetContainer: s } = u, C = (d) => {
1070
+ ), { bottomSheetBackdrop: f, bottomSheetRoot: y, bottomSheetContainer: c } = u, C = (d) => {
1071
1071
  const p = d ?? window.document.body;
1072
1072
  p.appendChild(y), p.appendChild(f);
1073
1073
  const g = window.innerHeight;
1074
- et(s, {
1074
+ et(c, {
1075
1075
  y: g
1076
1076
  }), h.attachEventListeners(), o.isMounted = !0;
1077
1077
  }, v = () => {
@@ -1084,20 +1084,20 @@ function me(t) {
1084
1084
  'Bottom Sheet is not mounted yet. call the "mount" method first.'
1085
1085
  ), (d = t.beforeOpen) == null || d.call(t), w())
1086
1086
  return;
1087
- ot(f, !0), c.shouldShowBackdrop || K(f, "transparent"), ot([s], !0), et(s, {
1088
- y: s.clientHeight
1087
+ ot(f, !0), s.shouldShowBackdrop || K(f, "transparent"), ot([c], !0), et(c, {
1088
+ y: c.clientHeight
1089
1089
  });
1090
1090
  const p = window.innerHeight, g = mt(
1091
1091
  p,
1092
- s.clientHeight,
1093
- c.marginTop,
1094
- c.defaultPosition
1095
- ), m = D(s).y;
1092
+ c.clientHeight,
1093
+ s.marginTop,
1094
+ s.defaultPosition
1095
+ ), m = D(c).y;
1096
1096
  o.translateContainer({
1097
1097
  startY: m,
1098
1098
  endY: g,
1099
1099
  animationFrame: a,
1100
- bottomSheetContainer: s,
1100
+ bottomSheetContainer: c,
1101
1101
  onEnd: t.afterOpen
1102
1102
  });
1103
1103
  const H = document.body.style.overflowY;
@@ -1110,15 +1110,15 @@ function me(t) {
1110
1110
  if (Y())
1111
1111
  return;
1112
1112
  (d = t.beforeClose) == null || d.call(t);
1113
- const p = D(s).y, g = s.clientHeight;
1113
+ const p = D(c).y, g = c.clientHeight;
1114
1114
  o.translateContainer({
1115
1115
  startY: p,
1116
1116
  endY: g,
1117
1117
  animationFrame: a,
1118
- bottomSheetContainer: s,
1118
+ bottomSheetContainer: c,
1119
1119
  onEnd: () => {
1120
1120
  var m;
1121
- (m = t.afterClose) == null || m.call(t), ot([f, s], !1), h.clearOnOpenEventListeners();
1121
+ (m = t.afterClose) == null || m.call(t), ot([f, c], !1), h.clearOnOpenEventListeners();
1122
1122
  }
1123
1123
  }), i();
1124
1124
  }
@@ -1126,34 +1126,34 @@ function me(t) {
1126
1126
  return o.isMounted;
1127
1127
  }
1128
1128
  function w() {
1129
- const d = D(s).y, p = window.innerHeight, g = s.clientHeight >= p ? p : s.clientHeight;
1129
+ const d = D(c).y, p = window.innerHeight, g = c.clientHeight >= p ? p : c.clientHeight;
1130
1130
  return d <= g;
1131
1131
  }
1132
1132
  function Y() {
1133
1133
  return !w();
1134
1134
  }
1135
1135
  function U() {
1136
- const d = D(s).y, p = s.clientHeight, g = window.innerHeight;
1136
+ const d = D(c).y, p = c.clientHeight, g = window.innerHeight;
1137
1137
  if (d <= 5 && d >= -5)
1138
1138
  return N.CONTENT_HEIGHT;
1139
1139
  const m = p - d;
1140
1140
  if (m === g / 2)
1141
1141
  return N.MIDDLE;
1142
- const H = g - c.marginTop, B = 10;
1142
+ const H = g - s.marginTop, B = 10;
1143
1143
  return m <= H + B && m >= H - B ? N.TOP : N.CLOSED;
1144
1144
  }
1145
1145
  function $() {
1146
- return s.clientHeight;
1146
+ return c.clientHeight;
1147
1147
  }
1148
1148
  function P(d) {
1149
1149
  if (!w())
1150
1150
  return;
1151
- const p = D(s).y, g = s.clientHeight - p, m = window.innerHeight - d, H = Ut(g, m), B = V(g, m);
1151
+ const p = D(c).y, g = c.clientHeight - p, m = window.innerHeight - d, H = Ut(g, m), B = V(g, m);
1152
1152
  o.translateContainer({
1153
1153
  startY: p,
1154
1154
  endY: p + (H.isUp ? -B : B),
1155
1155
  animationFrame: a,
1156
- bottomSheetContainer: s
1156
+ bottomSheetContainer: c
1157
1157
  });
1158
1158
  }
1159
1159
  function F(d, {
@@ -1173,8 +1173,8 @@ function me(t) {
1173
1173
  };
1174
1174
  }
1175
1175
  function T() {
1176
- const d = [...c.snapPoints].reverse(), p = D(s).y, g = s.clientHeight, m = g - p;
1177
- if (!c.expandable && m >= g)
1176
+ const d = [...s.snapPoints].reverse(), p = D(c).y, g = c.clientHeight, m = g - p;
1177
+ if (!s.expandable && m >= g)
1178
1178
  return;
1179
1179
  const H = window.innerHeight, B = ft(
1180
1180
  "above",
@@ -1184,17 +1184,17 @@ function me(t) {
1184
1184
  visibleHeight: m,
1185
1185
  viewportHeight: H
1186
1186
  });
1187
- if (I === null && m < H - c.marginTop) {
1187
+ if (I === null && m < H - s.marginTop) {
1188
1188
  o.translateContainer({
1189
1189
  startY: p,
1190
1190
  endY: mt(
1191
1191
  H,
1192
1192
  g,
1193
- c.marginTop,
1193
+ s.marginTop,
1194
1194
  "top"
1195
1195
  ),
1196
1196
  animationFrame: a,
1197
- bottomSheetContainer: s
1197
+ bottomSheetContainer: c
1198
1198
  });
1199
1199
  return;
1200
1200
  }
@@ -1202,17 +1202,17 @@ function me(t) {
1202
1202
  startY: p,
1203
1203
  endY: p - I,
1204
1204
  animationFrame: a,
1205
- bottomSheetContainer: s
1205
+ bottomSheetContainer: c
1206
1206
  });
1207
1207
  }
1208
1208
  function O() {
1209
- const d = D(s).y, p = s.clientHeight - d;
1209
+ const d = D(c).y, p = c.clientHeight - d;
1210
1210
  if (p < 1)
1211
1211
  return;
1212
1212
  const g = window.innerHeight, m = ft(
1213
1213
  "below",
1214
1214
  { visibleHeight: p, viewportHeight: g },
1215
- c.snapPoints
1215
+ s.snapPoints
1216
1216
  ), { minOffset: H } = F(m, {
1217
1217
  visibleHeight: p,
1218
1218
  viewportHeight: g
@@ -1221,7 +1221,7 @@ function me(t) {
1221
1221
  startY: d,
1222
1222
  endY: d + H,
1223
1223
  animationFrame: a,
1224
- bottomSheetContainer: s
1224
+ bottomSheetContainer: c
1225
1225
  });
1226
1226
  }
1227
1227
  function b(d) {
@@ -1232,7 +1232,7 @@ function me(t) {
1232
1232
  P(g);
1233
1233
  }
1234
1234
  return {
1235
- props: c,
1235
+ props: s,
1236
1236
  elements: u,
1237
1237
  mount: C,
1238
1238
  unmount: v,
@@ -1289,36 +1289,36 @@ const fe = Bt(), Se = Dt(
1289
1289
  afterClose: a,
1290
1290
  mountingPointRef: l,
1291
1291
  ...u
1292
- } = e, h = rt(fe), [c, f] = at(
1292
+ } = e, h = rt(fe), [s, f] = at(
1293
1293
  h.current
1294
1294
  );
1295
1295
  Mt(
1296
1296
  n,
1297
- () => c,
1298
- [c]
1297
+ () => s,
1298
+ [s]
1299
1299
  );
1300
1300
  const y = z(() => {
1301
1301
  i(!1), a == null || a();
1302
1302
  }, [a]);
1303
1303
  q(() => {
1304
- r ? c.open() : c.close();
1304
+ r ? s.open() : s.close();
1305
1305
  }, [r]);
1306
- const s = rt(null);
1306
+ const c = rt(null);
1307
1307
  return q(
1308
1308
  function() {
1309
1309
  var E;
1310
1310
  if (l && !l.current)
1311
1311
  return;
1312
1312
  const v = Ft((E = e.mountingPointRef) == null ? void 0 : E.current) ? e.mountingPointRef.current : window.document.body;
1313
- if (!v || c.getIsMounted())
1313
+ if (!v || s.getIsMounted())
1314
1314
  return;
1315
1315
  const S = me({
1316
1316
  content: "",
1317
1317
  ...u,
1318
1318
  afterClose: y
1319
1319
  });
1320
- return S.mount(v), s.current = S.elements.bottomSheetContentWrapper ?? null, h.current = S, f(S), () => {
1321
- c.unmount();
1320
+ return S.mount(v), c.current = S.elements.bottomSheetContentWrapper ?? null, h.current = S, f(S), () => {
1321
+ s.unmount();
1322
1322
  };
1323
1323
  },
1324
1324
  [e.mountingPointRef, u, y]
@@ -1333,9 +1333,9 @@ const fe = Bt(), Se = Dt(
1333
1333
  return () => {
1334
1334
  h.current.unmount();
1335
1335
  };
1336
- }, []), s.current ? Pt(
1336
+ }, []), c.current ? Pt(
1337
1337
  e.children,
1338
- s.current
1338
+ c.current
1339
1339
  ) : null;
1340
1340
  }
1341
1341
  ), be = Bt();
@@ -1348,10 +1348,10 @@ function ye(t = {}) {
1348
1348
  beforeOpen: l,
1349
1349
  afterOpen: u,
1350
1350
  beforeClose: h,
1351
- afterClose: c,
1351
+ afterClose: s,
1352
1352
  onDragStart: f,
1353
1353
  onDragMove: y,
1354
- onDragEnd: s,
1354
+ onDragEnd: c,
1355
1355
  ...C
1356
1356
  } = t, v = () => {
1357
1357
  l == null || l();
@@ -1360,13 +1360,13 @@ function ye(t = {}) {
1360
1360
  }, E = () => {
1361
1361
  h == null || h();
1362
1362
  }, x = () => {
1363
- c == null || c(), o(!1);
1363
+ s == null || s(), o(!1);
1364
1364
  }, w = () => {
1365
1365
  f == null || f();
1366
1366
  }, Y = (b, d) => {
1367
1367
  y == null || y(b, d);
1368
1368
  }, U = () => {
1369
- s == null || s();
1369
+ c == null || c();
1370
1370
  }, $ = Yt(() => ({
1371
1371
  ref: e,
1372
1372
  isOpen: n,
@@ -1 +1 @@
1
- (function(M,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],S):(M=typeof globalThis<"u"?globalThis:M||self,S(M.BottomSheet={},M.React,M.ReactDOM))})(this,function(M,S,xe){"use strict";function Ae(e){return e!=null}(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var De=Object.defineProperty,Me=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);function L(e){return typeof e=="string"}function Pe(e,t){return e.classList.contains(Q(t))}function _(e,t){e.classList.add(Q(t))}function oe(e,t){e.classList.remove(Q(t))}function X(e,t,n){L(n)&&(L(t)&&oe(e,t),_(e,n))}function Q(e){return L(e)?e.trim().replace(/\./g,""):""}function R(e){return e.map(t=>Q(t)).filter(Boolean).join(" ")}function Ye(e){return e.map(t=>t==null?void 0:t.trim()).filter(Boolean).map(t=>`.${t}`).join(" ")}const de="open",pe="hidden";function re(e,t){const n=t;if(Array.isArray(e)){e.forEach(o=>{Z(o,n),o.setAttribute("aria-modal",n?"true":"false")});return}Z(e,n),e.setAttribute("aria-modal",n?"true":"false")}function Z(e,t){t?(_(e,de),oe(e,pe)):(_(e,pe),oe(e,de))}function he(e){return e instanceof HTMLElement}function A(e){return typeof e=="number"&&!Number.isNaN(e)}function Re(e){he(e)&&e.focus()}function Fe(e){if(!he(e)||e.offsetParent===null||"disabled"in e&&e.disabled)return!1;const t=e.getAttribute("tabindex"),n=A(t)?parseInt(t,10):-1,o=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(e.tagName),r=e instanceof HTMLAnchorElement&&e.href!==""||e instanceof HTMLAreaElement&&e.href!=="";return o||r||n>-1}var k=(e=>(e.Backdrop="pbs-backdrop",e.Root="pbs-root",e.Container="pbs-container",e.GapFiller="pbs-gap-filler",e.Handle="pbs-handle",e.HandleBar="pbs-handle-bar",e.ContentWrapper="pbs-content-wrapper",e))(k||{}),ae=(e=>(e.Button="pbs-button-reset",e.Dialog="pbs-dialog-reset",e))(ae||{}),ee=(e=>(e.Hidden="hidden",e))(ee||{});function Y(e,t,n){const o=document.createElement(e);return t.split(" ").forEach(r=>{_(o,r)}),L(n)&&o.setAttribute("data-testid",n),o}Ye([k.Root,k.ContentWrapper]);function me(e,t,n,o){switch(o){case"content-height":return t>=e?ve(e,t,n):0;case"middle":return-(e/2-t);case"top":return-(e-t)+n;default:return 0}}function fe(e,t){const n=t<e,o=t>e;return{isUp:n,isDown:o,stayedSame:t===e}}function be(e,t){return t<e?-(e-t):t-e}function q(e,t){return e>t?e-t:t-e}function Ie(e,t){const n=e<t,o=e>t;return{isUp:n,isDown:o,stayedSame:e===t}}function ge(e,t,n){const o=e==="above";return n.filter(r=>{const i=r*t.viewportHeight;return o?t.visibleHeight<i:t.visibleHeight>i})}function ve(e,t,n){return-(e-t)+n}function Se(e){return Number(e.replace("px",""))}function te(e,...t){return Number(e.toFixed(...t))}function ye(e){const t=/(?<type>\w+)\((?<values>[^)]+)\)/g,n=[];let o;for(;(o=t.exec(e))!==null;){const r=o[1],i=o[2].split(",").map(a=>a.trim());n.push({type:r,values:i})}return n}function We(e){const t=e.style.transform,n=ye(t);return{transform:t,transformValues:n}}function Ce(e,t){return e.find(o=>o.type.startsWith(t))||null}const ie="translate";function P(e){const t=e.style.transform,n=ye(t),o=Ce(n,ie);return Ee(o??{type:ie,values:[]})}function ne(e,{x:t,y:n}){const{transform:o,transformValues:r}=We(e),i=Ce(r,ie);if(i){const a=Ee(i);e.style.transform=`translate(${t??a.x??0}px,${n??a.y??0}px)`;return}if(o){e.style.transform=`${o}, translate(${t??0}px,${n??0}px)`;return}e.style.transform=`translate(${t??0}px,${n??0}px)`}function Ee(e){if(e.type!=="translate")throw new Error(`Could not get coordinates from ${e.type}, since is not translate.`);const t=e.values[0],n=e.values[1];return{x:Se(t)??0,y:Se(n)??0}}function se(e){return e!=null}function we(e,{min:t,max:n}){return se(n)&&e>=n?n:se(t)&&e<=t?t:e}const Ne=(e,t,n)=>{t instanceof HTMLElement&&!Pe(t,k.Handle)&&n.scrollTop>=1||(e.isDragging=!0)},je=(e,t,n,o)=>r=>{o.startY=e.getCoordinates(r).y,o.containerStartTranslate=P(t),n.onDragStart()},Ge=(e,t,n,o,r)=>i=>{Ue(i,e,n,o,r,t,n.marginTop)};function Ue(e,t,n,o,r,i,a){if(!o.isDragging||!A(o.startY))return;const l=t.getCoordinates(e).y,u=be(o.startY,l),h=window.innerHeight,c=i.clientHeight,f=c-(o.containerStartTranslate.y+u);if(f>=h)return;const C=fe(o.startY,l);if(C.isUp&&!n.expandable&&f>=c||n.preventClosing&&f<=c)return;r.start(()=>{ne(i,{y:o.containerStartTranslate.y+u})},0);const s=h-a,E=c-o.containerStartTranslate.y;if(C.isUp){const v=s-E,y=s-f,w=we(1-te(y/v,2),{min:0,max:1});n.onDragMove(C,w)}else if(C.isDown){const v=we(te(1-f/E,2),{min:0,max:1});n.onDragMove(C,v)}}const $e=(e,t,n,o,r,i,a)=>l=>{if(!o.isDragging||(o.isDragging=!1,!A(o.startY)))return;n.onDragEnd();const u=o.startY,h=e.getCoordinates(l).y,c=P(t).y,f=fe(u,h),C=window.innerHeight,s=t.clientHeight;if(f.isUp){const E=[...n.snapPoints].sort((w,x)=>w-x),v=s+-c;if(!n.expandable&&v>=s)return;for(const w of E){const x=w*window.innerHeight;if(v<=x){const T=q(v,x);a.translateContainer({startY:c,endY:c-T,animationFrame:r,bottomSheetContainer:t});return}}const y=ve(C,s,n.marginTop);a.translateContainer({startY:c,endY:y,animationFrame:r,bottomSheetContainer:t})}else if(f.isDown){const E=[...n.snapPoints].sort((v,y)=>y-v);for(const v of E){const y=v*window.innerHeight,w=s+-c;if(w>=y){const x=q(w,y);a.translateContainer({startY:c,endY:c+x,animationFrame:r,bottomSheetContainer:t});return}}if(n.preventClosing){const v=s+-c;if(v>=s){const y=q(v,s);a.translateContainer({startY:c,endY:c+y,animationFrame:r,bottomSheetContainer:t})}return}i()}};var F=(e=>(e[e.All=-1]="All",e[e.None=0]="None",e[e.Capture=1]="Capture",e[e.Target=2]="Target",e[e.Bubble=3]="Bubble",e))(F||{});function ke(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const _e={eventPhase:F.All};class z{constructor(t){J(this,"currentTarget"),this.currentTarget=t}addEventListeners({onStart:t,onStartOptions:n=_e,onMove:o,onEnd:r}){this.addTouchEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r}),this.addMouseEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r})}addTouchEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r}){t&&this.currentTarget.addEventListener("touchstart",i=>{if(n.eventPhase===F.All){t(i);return}ke(i.eventPhase)===n.eventPhase&&t(i)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),r&&this.currentTarget.addEventListener("touchend",r)}addMouseEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r}){t&&this.currentTarget.addEventListener("mousedown",i=>{if(n.eventPhase===F.All){t(i);return}ke(i.eventPhase)===n.eventPhase&&t(i)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),r&&this.currentTarget.addEventListener("mouseup",i=>{r(i)})}removeEventListeners({onStart:t,onMove:n,onEnd:o}){t&&this.currentTarget.removeEventListener("touchstart",t),o&&this.currentTarget.removeEventListener("touchend",o),n&&this.currentTarget.removeEventListener("touchmove",n),t&&this.currentTarget.removeEventListener("mousedown",t),n&&this.currentTarget.removeEventListener("mousemove",n),o&&this.currentTarget.removeEventListener("mouseup",o)}getCoordinates(t){if(t.type==="touchstart"||t.type==="mousedown"){if("touches"in t)return{x:t.touches[0].clientX,y:t.touches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}if(t.type==="touchend"||t.type==="mouseup"||t.type==="mousemove"||t.type==="touchmove"){if("touches"in t)return{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}return{x:0,y:0}}}function Te(e){const t=e;return`${t} ${t} 0px 0px`}function Xe(e,t){const n=qe(e);ze(n),n.bottomSheetContainer.style.width=e.width;const o=document.createElement("div");o.innerHTML=e.content??"";const r=window.innerHeight;n.bottomSheetContainer.style.maxHeight=`${r}px`,n.bottomSheetContentWrapper.appendChild(o);const i=Ve({bottomSheetElements:n,bottomSheetProps:e,options:t});return e.rootStyle&&Object.assign(n.bottomSheetRoot.style,e.rootStyle),e.backdropStyle&&Object.assign(n.bottomSheetBackdrop.style,e.backdropStyle),e.containerGapFillerStyle&&Object.assign(n.bottomSheetContainer.style,e.containerStyle),e.containerStyle&&Object.assign(n.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle),e.handleStyle&&Object.assign(n.bottomSheetHandleBar.style,e.handleStyle),e.contentWrapperStyle&&Object.assign(n.bottomSheetContentWrapper.style,e.contentWrapperStyle),{elements:n,eventHandlers:i}}function qe(e){const t=Y("dialog",R([k.Root,ae.Dialog,e.rootClass]),k.Root);t.ariaLabel=e.ariaLabel;const n=Y("section",R([k.Container,e.containerClass]),k.Container);e.containerBorderRadius&&(n.style.borderRadius=Te(e.containerBorderRadius));const o=Y("div",k.GapFiller,k.GapFiller);e.containerBackgroundColor&&(n.style.backgroundColor=e.containerBackgroundColor,o.style.backgroundColor=e.containerBackgroundColor);const r=Y("button",R([k.Handle,ae.Button,e.shouldShowHandle?null:ee.Hidden,e.handleClass]),k.Handle);r.setAttribute("type","button"),r.ariaLabel="bottom sheet close button";const i=Y("span",R([k.HandleBar,e.shouldShowHandle?null:ee.Hidden]),k.HandleBar),a=Y("article",R([k.ContentWrapper,e.contentWrapperClass]),k.ContentWrapper),l=Y("div",R([k.Backdrop,e.backdropClass,ee.Hidden]),k.Backdrop);return e.backdropColor&&(l.style.backgroundColor=e.backdropColor),e.backDropTransition&&(l.style.transition=e.backDropTransition),{bottomSheetRoot:t,bottomSheetBackdrop:l,bottomSheetContainer:n,bottomSheetHandle:r,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:o}}function ze({bottomSheetRoot:e,bottomSheetContainer:t,bottomSheetHandle:n,bottomSheetHandleBar:o,bottomSheetContentWrapper:r,bottomSheetContainerGapFiller:i}){e.appendChild(t),n.appendChild(o),t.appendChild(n),t.appendChild(r),t.appendChild(i)}function Ve({bottomSheetElements:e,bottomSheetProps:t,options:n}){const{bottomSheetRoot:o,bottomSheetContainer:r,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:l,bottomSheetBackdrop:u}=e,{animationFrame:h}=n,c=new z(i),f=new z(l),C=new z(a);let s=[];const E=new z(window),v=je(E,r,t,n.draggingState),y=Ge(E,r,t,n.draggingState,h),w=$e(E,r,t,n.draggingState,h,n.onClose,n.bottomSheetState);function x(H){H.target instanceof Element&&!o.contains(H.target)&&n.onClose()}function T(H){Ne(n.draggingState,H.target,e.bottomSheetContentWrapper)}function j(H){const B=H??t;B.draggable&&B.backgroundDraggable&&(f.addEventListeners({onStart:T,onStartOptions:{eventPhase:F.Target}}),C.addEventListeners({onStart:T})),B.draggable&&E.addEventListeners({onStart:v,onMove:y,onEnd:w}),B.draggable&&window.document.addEventListener("keyup",b=>{b.key==="Escape"&&n.onClose()}),i.addEventListener("keyup",b=>{if(b.key==="ArrowUp"){n.moveUp();return}if(b.key==="ArrowDown"){n.moveDown();return}if(b.shiftKey&&b.key==="Tab"){const d=G(e.bottomSheetContentWrapper);Re(d)}})}function V(H){const B=H??t;t.shouldCloseOnOutsideClick&&!t.preventClosing?u.addEventListener("click",x):u.style.pointerEvents="none",B.draggable&&(c.addEventListeners({onStart:T}),s.forEach(b=>{b.removeEventListeners({onStart:T})}),s=t.dragTriggers.reduce((b,d)=>{const p=o.querySelectorAll(d);if(!p.length)return b;const g=Array.from(p).map(m=>m instanceof HTMLElement?new z(m):null).filter(m=>!!m);return[...b,...g]},[]),s.forEach(b=>{b.addEventListeners({onStart:T,onStartOptions:{eventPhase:F.Target}})}))}function K(){u.removeEventListener("click",x)}function G(H){let B=[...Array.from(H.childNodes).reverse()];for(;B.length;){const b=B.shift();if(Fe(b))return b;b&&(B=[...B,...Array.from(b.childNodes).reverse()])}return null}function U(){c.removeEventListeners({onStart:T}),f.removeEventListeners({onStart:T}),C.removeEventListeners({onStart:T}),s.forEach(H=>{H.removeEventListeners({onStart:T})}),E.removeEventListeners({onStart:v,onMove:y,onEnd:w})}return{attachEventListeners:j,clearEventListeners:U,attacheOnOpenEventListeners:V,clearOnOpenEventListeners:K}}class Ke{constructor(){J(this,"animationId"),J(this,"isInProgress"),J(this,"startedAt"),this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(t,n,o=!1){this.isInProgress=!0;const r=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,l=n===0?1:te(a/n,2),u=l>=1&&!o;t(l),u?this.stop():this.animationId=requestAnimationFrame(r)};this.animationId=requestAnimationFrame(r)}stop(){this.isInProgress=!1,this.startedAt=null,A(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Je(e){const{startY:t,endY:n,bottomSheetContainer:o,animationFrame:r,onEnd:i,animationTimingFunction:a,animationDuration:l}=e,u=be(t,n);r.stop();let h=!1;r.start(c=>{ne(o,{y:t+u*a(c)}),!h&&c>=1&&(i==null||i(),h=!0)},l)}const ce=(e,t)=>n=>{Je({...n,animationTimingFunction:e,animationDuration:t})},I={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Qe(e){return!(!A(e)||e>1||e<0)}function Ze(e,t){const n={set(o,r,i,a){return t(r,i),Reflect.set(o,r,i,a)}};return new Proxy(e,n)}function et(...e){console.error(e)}const W={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function tt(e){for(const t of Object.values(W))if(t===e)return!0;return!1}function He(e){return!!(e instanceof Object&&"p1x"in e&&"p1y"in e&&"p2x"in e&&"p2y"in e&&A(e.p1x)&&A(e.p1y)&&A(e.p2x)&&A(e.p2y))}function N(e,t,n,o){return function(l){return a(r(l))};function r(l){let u=0,h=1,c=l,f;if(l===0||l===1)return l;for(;u<h;){if(f=i(c),Math.abs(f-l)<.001)return c;l>f?u=c:h=c,c=(h+u)/2}return c}function i(l){return 3*e*l*Math.pow(1-l,2)+3*n*Math.pow(l,2)*(1-l)+Math.pow(l,3)}function a(l){return 3*t*l*Math.pow(1-l,2)+3*o*Math.pow(l,2)*(1-l)+Math.pow(l,3)}}const Oe=N(.25,.1,.25,1),nt=N(.42,0,1,1),Le=N(.42,0,.58,1),ot=N(.4,.1,.6,1),rt=N(.45,1.5,.55,1);function at(e){switch(e){case W.EASE:return Oe;case W.EASE_IN:return nt;case W.EASE_OUT:return Le;case W.EASE_IN_OUT:return ot;case W.SPRING:return rt;default:return Oe}}function Be(e){return typeof e=="boolean"}const it={ariaLabel:"Bottom sheet",content:"",defaultPosition:I.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function st(e){const t={...it},n=Object.entries(e).reduce((o,r)=>{const[i,a]=r;return se(a)&&(o[i]=a),o},{});return{...t,...n}}function le(e){if(He(e)){const{p1x:t,p1y:n,p2x:o,p2y:r}=e;return N(t,n,o,r)}return tt(e)?at(e):Le}function ct(e,t,n,o){function r(i,a){switch(i){case"content":L(a)&&(e.bottomSheetContentWrapper.innerHTML=a);break;case"width":L(a)&&(e.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Be(a)||Z(e.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Be(a)||Z(e.bottomSheetBackdrop,!1);break;case"containerBorderRadius":L(a)&&(e.bottomSheetContainer.style.borderRadius=Te(a));break;case"containerBackgroundColor":L(a)&&(e.bottomSheetContainer.style.backgroundColor=a,e.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":L(a)&&(e.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":L(a)&&(e.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!L(a))return;X(e.bottomSheetRoot,n.rootClass,a);break;case"containerClass":if(!L(a))return;X(e.bottomSheetContainer,n.containerClass,a);break;case"handleClass":if(!L(a))return;X(e.bottomSheetHandle,n.handleClass,a);break;case"contentWrapperClass":if(!L(a))return;X(e.bottomSheetContentWrapper,n.contentWrapperClass,a);break;case"backdropClass":if(!L(a))return;X(e.bottomSheetBackdrop,n.backdropClass,a);break;case"expandable":o.clearEventListeners(),o.attachEventListeners(n);break;case"preventClosing":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggable":o.clearEventListeners(),o.attachEventListeners(n);break;case"dragTriggers":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggingAnimationTimings":if(He(a)){const l=le(a),u=ce(l,n.draggingAnimationDuration);t.translateContainer=u}break;case"draggingAnimationDuration":if(A(a)){const l=le(n.draggingAnimationTimings),u=ce(l,a);t.translateContainer=u}break;case"rootStyle":n.rootStyle&&Object.assign(e.bottomSheetRoot.style,n.rootStyle);break;case"backdropStyle":n.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,n.backdropStyle);break;case"containerStyle":n.containerStyle&&Object.assign(e.bottomSheetContainer.style,n.containerStyle);break;case"containerGapFillerStyle":n.containerGapFillerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,n.containerGapFillerStyle);break;case"handleStyle":n.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,n.handleStyle);break;case"contentWrapperStyle":n.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,n.contentWrapperStyle);break}}return r}function lt(e){const t=st(e),n=le(e.draggingAnimationTimings),o={isMounted:!1,translateContainer:ce(n,t.draggingAnimationDuration)},r={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function i(){r.originalDocumentOverflowY&&r.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=r.originalDocumentOverflowY),r.originalDocumentOverscrollBehavior&&(document.body.style.position=r.originalDocumentOverscrollBehavior)}const a=new Ke,l={animationFrame:a,onClose:w,bottomSheetState:o,draggingState:r,snapTo:b,moveUp:H,moveDown:B},{elements:u,eventHandlers:h}=Xe(t,l),c=Ze(t,ct(u,o,t,h)),{bottomSheetBackdrop:f,bottomSheetRoot:C,bottomSheetContainer:s}=u,E=d=>{const p=d??window.document.body;p.appendChild(C),p.appendChild(f);const g=window.innerHeight;ne(s,{y:g}),h.attachEventListeners(),o.isMounted=!0},v=()=>{h.clearEventListeners(),Object.values(u).forEach(d=>{d.remove()}),i(),o.isMounted=!1},y=()=>{var d;if(x()||et('Bottom Sheet is not mounted yet. call the "mount" method first.'),(d=e.beforeOpen)==null||d.call(e),T())return;re(f,!0),c.shouldShowBackdrop||_(f,"transparent"),re([s],!0),ne(s,{y:s.clientHeight});const p=window.innerHeight,g=me(p,s.clientHeight,c.marginTop,c.defaultPosition),m=P(s).y;o.translateContainer({startY:m,endY:g,animationFrame:a,bottomSheetContainer:s,onEnd:e.afterOpen});const O=document.body.style.overflowY;r.originalDocumentOverflowY=O||"initial";const D=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",u.bottomSheetHandle.focus(),h.attacheOnOpenEventListeners()};function w(){var d;if(j())return;(d=e.beforeClose)==null||d.call(e);const p=P(s).y,g=s.clientHeight;o.translateContainer({startY:p,endY:g,animationFrame:a,bottomSheetContainer:s,onEnd:()=>{var m;(m=e.afterClose)==null||m.call(e),re([f,s],!1),h.clearOnOpenEventListeners()}}),i()}function x(){return o.isMounted}function T(){const d=P(s).y,p=window.innerHeight,g=s.clientHeight>=p?p:s.clientHeight;return d<=g}function j(){return!T()}function V(){const d=P(s).y,p=s.clientHeight,g=window.innerHeight;if(d<=5&&d>=-5)return I.CONTENT_HEIGHT;const m=p-d;if(m===g/2)return I.MIDDLE;const O=g-c.marginTop,D=10;return m<=O+D&&m>=O-D?I.TOP:I.CLOSED}function K(){return s.clientHeight}function G(d){if(!T())return;const p=P(s).y,g=s.clientHeight-p,m=window.innerHeight-d,O=Ie(g,m),D=q(g,m);o.translateContainer({startY:p,endY:p+(O.isUp?-D:D),animationFrame:a,bottomSheetContainer:s})}function U(d,{viewportHeight:p,visibleHeight:g}){let m=null;for(const O of d){const D=O*p,$=q(g,D);(m===null||$<m)&&(m=$)}return{minOffset:m}}function H(){const d=[...c.snapPoints].reverse(),p=P(s).y,g=s.clientHeight,m=g-p;if(!c.expandable&&m>=g)return;const O=window.innerHeight,D=ge("above",{visibleHeight:m,viewportHeight:O},d),{minOffset:$}=U(D,{visibleHeight:m,viewportHeight:O});if($===null&&m<O-c.marginTop){o.translateContainer({startY:p,endY:me(O,g,c.marginTop,"top"),animationFrame:a,bottomSheetContainer:s});return}A($)&&o.translateContainer({startY:p,endY:p-$,animationFrame:a,bottomSheetContainer:s})}function B(){const d=P(s).y,p=s.clientHeight-d;if(p<1)return;const g=window.innerHeight,m=ge("below",{visibleHeight:p,viewportHeight:g},c.snapPoints),{minOffset:O}=U(m,{visibleHeight:p,viewportHeight:g});A(O)&&o.translateContainer({startY:d,endY:d+O,animationFrame:a,bottomSheetContainer:s})}function b(d){const p=window.innerHeight;if(!Qe(d))return;const g=te(p*d,2);G(g)}return{props:c,elements:u,mount:E,unmount:v,open:y,close:w,getIsMounted:x,getIsOpen:T,getIsClosed:j,getPosition:V,getHeight:K,moveTo:G,snapTo:b}}function ue(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>I.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}const ut=ue(),dt=S.forwardRef(function(t,n){const{children:o,isOpen:r,setIsOpen:i,afterClose:a,mountingPointRef:l,...u}=t,h=S.useRef(ut),[c,f]=S.useState(h.current);S.useImperativeHandle(n,()=>c,[c]);const C=S.useCallback(()=>{i(!1),a==null||a()},[a]);S.useEffect(()=>{r?c.open():c.close()},[r]);const s=S.useRef(null);return S.useEffect(function(){var w;if(l&&!l.current)return;const v=Ae((w=t.mountingPointRef)==null?void 0:w.current)?t.mountingPointRef.current:window.document.body;if(!v||c.getIsMounted())return;const y=lt({content:"",...u,afterClose:C});return y.mount(v),s.current=y.elements.bottomSheetContentWrapper??null,h.current=y,f(y),()=>{c.unmount()}},[t.mountingPointRef,u,C]),S.useEffect(function(){Object.assign(h.current.props,{...u}),f(h.current)},[u]),S.useEffect(function(){return()=>{h.current.unmount()}},[]),s.current?xe.createPortal(t.children,s.current):null}),pt=ue();function ht(e={}){const t=S.useRef(pt),[n,o]=S.useState(!1),r=!n,[i,a]=S.useState(t.current);S.useEffect(()=>{a(t.current)},[t.current]);const{beforeOpen:l,afterOpen:u,beforeClose:h,afterClose:c,onDragStart:f,onDragMove:C,onDragEnd:s,...E}=e,v=()=>{l==null||l()},y=()=>{u==null||u(),o(!0)},w=()=>{h==null||h()},x=()=>{c==null||c(),o(!1)},T=()=>{f==null||f()},j=(b,d)=>{C==null||C(b,d)},V=()=>{s==null||s()},K=S.useMemo(()=>({ref:t,isOpen:n,setIsOpen:o,beforeOpen:v,afterOpen:y,beforeClose:w,afterClose:x,onDragStart:T,onDragMove:j,onDragEnd:V,...E}),[t.current,n,o,e]),G=S.useCallback(()=>{o(!0)},[o]),U=S.useCallback(()=>{o(!1)},[o]),H=S.useCallback((...b)=>{i.moveTo(...b)},[i]),B=S.useCallback((...b)=>{i.snapTo(...b)},[i]);return{props:K,instance:i,isOpen:n,isClosed:r,setIsOpen:o,open:G,close:U,moveTo:H,snapTo:B}}M.BottomSheet=dt,M.createPlaceholderBottomSheet=ue,M.useBottomSheet=ht,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
1
+ (function(M,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],v):(M=typeof globalThis<"u"?globalThis:M||self,v(M.BottomSheet={},M.React,M.ReactDOM))})(this,function(M,v,xe){"use strict";function Ae(e){return e!=null}(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var De=Object.defineProperty,Me=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);function L(e){return typeof e=="string"}function Pe(e,t){return e.classList.contains(Q(t))}function _(e,t){e.classList.add(Q(t))}function oe(e,t){e.classList.remove(Q(t))}function X(e,t,n){L(n)&&(L(t)&&oe(e,t),_(e,n))}function Q(e){return L(e)?e.trim().replace(/\./g,""):""}function R(e){return e.map(t=>Q(t)).filter(Boolean).join(" ")}function Ye(e){return e.map(t=>t==null?void 0:t.trim()).filter(Boolean).map(t=>`.${t}`).join(" ")}const de="open",pe="hidden";function re(e,t){const n=t;if(Array.isArray(e)){e.forEach(o=>{Z(o,n),o.setAttribute("aria-modal",n?"true":"false")});return}Z(e,n),e.setAttribute("aria-modal",n?"true":"false")}function Z(e,t){t?(_(e,de),oe(e,pe)):(_(e,pe),oe(e,de))}function he(e){return e instanceof HTMLElement}function A(e){return typeof e=="number"&&!Number.isNaN(e)}function Re(e){he(e)&&e.focus()}function Fe(e){if(!he(e)||e.offsetParent===null||"disabled"in e&&e.disabled)return!1;const t=e.getAttribute("tabindex"),n=A(t)?parseInt(t,10):-1,o=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(e.tagName),r=e instanceof HTMLAnchorElement&&e.href!==""||e instanceof HTMLAreaElement&&e.href!=="";return o||r||n>-1}var k=(e=>(e.Backdrop="pbs-backdrop",e.Root="pbs-root",e.Container="pbs-container",e.GapFiller="pbs-gap-filler",e.Handle="pbs-handle",e.HandleBar="pbs-handle-bar",e.ContentWrapper="pbs-content-wrapper",e))(k||{}),ae=(e=>(e.Button="pbs-button-reset",e.Dialog="pbs-dialog-reset",e))(ae||{}),ee=(e=>(e.Hidden="hidden",e))(ee||{});function Y(e,t,n){const o=document.createElement(e);return t.split(" ").forEach(r=>{_(o,r)}),L(n)&&o.setAttribute("data-testid",n),o}Ye([k.Root,k.ContentWrapper]);function me(e,t,n,o){switch(o){case"content-height":return t>=e?ve(e,t,n):0;case"middle":return-(e/2-t);case"top":return-(e-t)+n;default:return 0}}function fe(e,t){const n=t<e,o=t>e;return{isUp:n,isDown:o,stayedSame:t===e}}function be(e,t){return t<e?-(e-t):t-e}function q(e,t){return e>t?e-t:t-e}function Ie(e,t){const n=e<t,o=e>t;return{isUp:n,isDown:o,stayedSame:e===t}}function ge(e,t,n){const o=e==="above";return n.filter(r=>{const i=r*t.viewportHeight;return o?t.visibleHeight<i:t.visibleHeight>i})}function ve(e,t,n){return-(e-t)+n}function Se(e){return Number(e.replace("px",""))}function te(e,...t){return Number(e.toFixed(...t))}function ye(e){const t=/(?<type>\w+)\((?<values>[^)]+)\)/g,n=[];let o;for(;(o=t.exec(e))!==null;){const r=o[1],i=o[2].split(",").map(a=>a.trim());n.push({type:r,values:i})}return n}function We(e){const t=e.style.transform,n=ye(t);return{transform:t,transformValues:n}}function Ce(e,t){return e.find(o=>o.type.startsWith(t))||null}const ie="translate";function P(e){const t=e.style.transform,n=ye(t),o=Ce(n,ie);return Ee(o??{type:ie,values:[]})}function ne(e,{x:t,y:n}){const{transform:o,transformValues:r}=We(e),i=Ce(r,ie);if(i){const a=Ee(i);e.style.transform=`translate(${t??a.x??0}px,${n??a.y??0}px)`;return}if(o){e.style.transform=`${o}, translate(${t??0}px,${n??0}px)`;return}e.style.transform=`translate(${t??0}px,${n??0}px)`}function Ee(e){if(e.type!=="translate")throw new Error(`Could not get coordinates from ${e.type}, since is not translate.`);const t=e.values[0],n=e.values[1];return{x:Se(t)??0,y:Se(n)??0}}function se(e){return e!=null}function we(e,{min:t,max:n}){return se(n)&&e>=n?n:se(t)&&e<=t?t:e}const Ne=(e,t,n)=>{t instanceof HTMLElement&&!Pe(t,k.Handle)&&n.scrollTop>=1||(e.isDragging=!0)},je=(e,t,n,o)=>r=>{o.startY=e.getCoordinates(r).y,o.containerStartTranslate=P(t),n.onDragStart()},Ge=(e,t,n,o,r)=>i=>{Ue(i,e,n,o,r,t,n.marginTop)};function Ue(e,t,n,o,r,i,a){if(!o.isDragging||!A(o.startY))return;const l=t.getCoordinates(e).y,u=be(o.startY,l),h=window.innerHeight,s=i.clientHeight,f=s-(o.containerStartTranslate.y+u);if(f>=h)return;const C=fe(o.startY,l);if(C.isUp&&!n.expandable&&f>=s||n.preventClosing&&f<=s)return;r.start(()=>{ne(i,{y:o.containerStartTranslate.y+u})},0);const c=h-a,E=s-o.containerStartTranslate.y;if(C.isUp){const S=c-E,y=c-f,w=we(1-te(y/S,2),{min:0,max:1});n.onDragMove(C,w)}else if(C.isDown){const S=we(te(1-f/E,2),{min:0,max:1});n.onDragMove(C,S)}}const $e=(e,t,n,o,r,i,a)=>l=>{if(!o.isDragging||(o.isDragging=!1,!A(o.startY)))return;n.onDragEnd();const u=o.startY,h=e.getCoordinates(l).y,s=P(t).y,f=fe(u,h),C=window.innerHeight,c=t.clientHeight;if(f.isUp){if(!n.expandable)return;const E=[...n.snapPoints].sort((w,x)=>w-x),S=c+-s;for(const w of E){const x=w*window.innerHeight;if(S<=x){const T=q(S,x);a.translateContainer({startY:s,endY:s-T,animationFrame:r,bottomSheetContainer:t});return}}const y=ve(C,c,n.marginTop);a.translateContainer({startY:s,endY:y,animationFrame:r,bottomSheetContainer:t})}else if(f.isDown){const E=[...n.snapPoints].sort((S,y)=>y-S);for(const S of E){const y=S*window.innerHeight,w=c+-s;if(w>=y){const x=q(w,y);a.translateContainer({startY:s,endY:s+x,animationFrame:r,bottomSheetContainer:t});return}}if(n.preventClosing){const S=c+-s;if(S>=c){const y=q(S,c);a.translateContainer({startY:s,endY:s+y,animationFrame:r,bottomSheetContainer:t})}return}i()}};var F=(e=>(e[e.All=-1]="All",e[e.None=0]="None",e[e.Capture=1]="Capture",e[e.Target=2]="Target",e[e.Bubble=3]="Bubble",e))(F||{});function ke(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const _e={eventPhase:F.All};class z{constructor(t){J(this,"currentTarget"),this.currentTarget=t}addEventListeners({onStart:t,onStartOptions:n=_e,onMove:o,onEnd:r}){this.addTouchEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r}),this.addMouseEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r})}addTouchEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r}){t&&this.currentTarget.addEventListener("touchstart",i=>{if(n.eventPhase===F.All){t(i);return}ke(i.eventPhase)===n.eventPhase&&t(i)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),r&&this.currentTarget.addEventListener("touchend",r)}addMouseEventListeners({onStart:t,onStartOptions:n,onMove:o,onEnd:r}){t&&this.currentTarget.addEventListener("mousedown",i=>{if(n.eventPhase===F.All){t(i);return}ke(i.eventPhase)===n.eventPhase&&t(i)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),r&&this.currentTarget.addEventListener("mouseup",i=>{r(i)})}removeEventListeners({onStart:t,onMove:n,onEnd:o}){t&&this.currentTarget.removeEventListener("touchstart",t),o&&this.currentTarget.removeEventListener("touchend",o),n&&this.currentTarget.removeEventListener("touchmove",n),t&&this.currentTarget.removeEventListener("mousedown",t),n&&this.currentTarget.removeEventListener("mousemove",n),o&&this.currentTarget.removeEventListener("mouseup",o)}getCoordinates(t){if(t.type==="touchstart"||t.type==="mousedown"){if("touches"in t)return{x:t.touches[0].clientX,y:t.touches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}if(t.type==="touchend"||t.type==="mouseup"||t.type==="mousemove"||t.type==="touchmove"){if("touches"in t)return{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}return{x:0,y:0}}}function Te(e){const t=e;return`${t} ${t} 0px 0px`}function Xe(e,t){const n=qe(e);ze(n),n.bottomSheetContainer.style.width=e.width;const o=document.createElement("div");o.innerHTML=e.content??"";const r=window.innerHeight;n.bottomSheetContainer.style.maxHeight=`${r}px`,n.bottomSheetContentWrapper.appendChild(o);const i=Ve({bottomSheetElements:n,bottomSheetProps:e,options:t});return e.rootStyle&&Object.assign(n.bottomSheetRoot.style,e.rootStyle),e.backdropStyle&&Object.assign(n.bottomSheetBackdrop.style,e.backdropStyle),e.containerGapFillerStyle&&Object.assign(n.bottomSheetContainer.style,e.containerStyle),e.containerStyle&&Object.assign(n.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle),e.handleStyle&&Object.assign(n.bottomSheetHandleBar.style,e.handleStyle),e.contentWrapperStyle&&Object.assign(n.bottomSheetContentWrapper.style,e.contentWrapperStyle),{elements:n,eventHandlers:i}}function qe(e){const t=Y("dialog",R([k.Root,ae.Dialog,e.rootClass]),k.Root);t.ariaLabel=e.ariaLabel;const n=Y("section",R([k.Container,e.containerClass]),k.Container);e.containerBorderRadius&&(n.style.borderRadius=Te(e.containerBorderRadius));const o=Y("div",k.GapFiller,k.GapFiller);e.containerBackgroundColor&&(n.style.backgroundColor=e.containerBackgroundColor,o.style.backgroundColor=e.containerBackgroundColor);const r=Y("button",R([k.Handle,ae.Button,e.shouldShowHandle?null:ee.Hidden,e.handleClass]),k.Handle);r.setAttribute("type","button"),r.ariaLabel="bottom sheet close button";const i=Y("span",R([k.HandleBar,e.shouldShowHandle?null:ee.Hidden]),k.HandleBar),a=Y("article",R([k.ContentWrapper,e.contentWrapperClass]),k.ContentWrapper),l=Y("div",R([k.Backdrop,e.backdropClass,ee.Hidden]),k.Backdrop);return e.backdropColor&&(l.style.backgroundColor=e.backdropColor),e.backDropTransition&&(l.style.transition=e.backDropTransition),{bottomSheetRoot:t,bottomSheetBackdrop:l,bottomSheetContainer:n,bottomSheetHandle:r,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:o}}function ze({bottomSheetRoot:e,bottomSheetContainer:t,bottomSheetHandle:n,bottomSheetHandleBar:o,bottomSheetContentWrapper:r,bottomSheetContainerGapFiller:i}){e.appendChild(t),n.appendChild(o),t.appendChild(n),t.appendChild(r),t.appendChild(i)}function Ve({bottomSheetElements:e,bottomSheetProps:t,options:n}){const{bottomSheetRoot:o,bottomSheetContainer:r,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:l,bottomSheetBackdrop:u}=e,{animationFrame:h}=n,s=new z(i),f=new z(l),C=new z(a);let c=[];const E=new z(window),S=je(E,r,t,n.draggingState),y=Ge(E,r,t,n.draggingState,h),w=$e(E,r,t,n.draggingState,h,n.onClose,n.bottomSheetState);function x(H){H.target instanceof Element&&!o.contains(H.target)&&n.onClose()}function T(H){Ne(n.draggingState,H.target,e.bottomSheetContentWrapper)}function j(H){const B=H??t;B.draggable&&B.backgroundDraggable&&(f.addEventListeners({onStart:T,onStartOptions:{eventPhase:F.Target}}),C.addEventListeners({onStart:T})),B.draggable&&E.addEventListeners({onStart:S,onMove:y,onEnd:w}),B.draggable&&window.document.addEventListener("keyup",b=>{b.key==="Escape"&&n.onClose()}),i.addEventListener("keyup",b=>{if(b.key==="ArrowUp"){n.moveUp();return}if(b.key==="ArrowDown"){n.moveDown();return}if(b.shiftKey&&b.key==="Tab"){const d=G(e.bottomSheetContentWrapper);Re(d)}})}function V(H){const B=H??t;t.shouldCloseOnOutsideClick&&!t.preventClosing?u.addEventListener("click",x):u.style.pointerEvents="none",B.draggable&&(s.addEventListeners({onStart:T}),c.forEach(b=>{b.removeEventListeners({onStart:T})}),c=t.dragTriggers.reduce((b,d)=>{const p=o.querySelectorAll(d);if(!p.length)return b;const g=Array.from(p).map(m=>m instanceof HTMLElement?new z(m):null).filter(m=>!!m);return[...b,...g]},[]),c.forEach(b=>{b.addEventListeners({onStart:T,onStartOptions:{eventPhase:F.Target}})}))}function K(){u.removeEventListener("click",x)}function G(H){let B=[...Array.from(H.childNodes).reverse()];for(;B.length;){const b=B.shift();if(Fe(b))return b;b&&(B=[...B,...Array.from(b.childNodes).reverse()])}return null}function U(){s.removeEventListeners({onStart:T}),f.removeEventListeners({onStart:T}),C.removeEventListeners({onStart:T}),c.forEach(H=>{H.removeEventListeners({onStart:T})}),E.removeEventListeners({onStart:S,onMove:y,onEnd:w})}return{attachEventListeners:j,clearEventListeners:U,attacheOnOpenEventListeners:V,clearOnOpenEventListeners:K}}class Ke{constructor(){J(this,"animationId"),J(this,"isInProgress"),J(this,"startedAt"),this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(t,n,o=!1){this.isInProgress=!0;const r=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,l=n===0?1:te(a/n,2),u=l>=1&&!o;t(l),u?this.stop():this.animationId=requestAnimationFrame(r)};this.animationId=requestAnimationFrame(r)}stop(){this.isInProgress=!1,this.startedAt=null,A(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Je(e){const{startY:t,endY:n,bottomSheetContainer:o,animationFrame:r,onEnd:i,animationTimingFunction:a,animationDuration:l}=e,u=be(t,n);r.stop();let h=!1;r.start(s=>{ne(o,{y:t+u*a(s)}),!h&&s>=1&&(i==null||i(),h=!0)},l)}const ce=(e,t)=>n=>{Je({...n,animationTimingFunction:e,animationDuration:t})},I={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Qe(e){return!(!A(e)||e>1||e<0)}function Ze(e,t){const n={set(o,r,i,a){return t(r,i),Reflect.set(o,r,i,a)}};return new Proxy(e,n)}function et(...e){console.error(e)}const W={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function tt(e){for(const t of Object.values(W))if(t===e)return!0;return!1}function He(e){return!!(e instanceof Object&&"p1x"in e&&"p1y"in e&&"p2x"in e&&"p2y"in e&&A(e.p1x)&&A(e.p1y)&&A(e.p2x)&&A(e.p2y))}function N(e,t,n,o){return function(l){return a(r(l))};function r(l){let u=0,h=1,s=l,f;if(l===0||l===1)return l;for(;u<h;){if(f=i(s),Math.abs(f-l)<.001)return s;l>f?u=s:h=s,s=(h+u)/2}return s}function i(l){return 3*e*l*Math.pow(1-l,2)+3*n*Math.pow(l,2)*(1-l)+Math.pow(l,3)}function a(l){return 3*t*l*Math.pow(1-l,2)+3*o*Math.pow(l,2)*(1-l)+Math.pow(l,3)}}const Oe=N(.25,.1,.25,1),nt=N(.42,0,1,1),Le=N(.42,0,.58,1),ot=N(.4,.1,.6,1),rt=N(.45,1.5,.55,1);function at(e){switch(e){case W.EASE:return Oe;case W.EASE_IN:return nt;case W.EASE_OUT:return Le;case W.EASE_IN_OUT:return ot;case W.SPRING:return rt;default:return Oe}}function Be(e){return typeof e=="boolean"}const it={ariaLabel:"Bottom sheet",content:"",defaultPosition:I.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function st(e){const t={...it},n=Object.entries(e).reduce((o,r)=>{const[i,a]=r;return se(a)&&(o[i]=a),o},{});return{...t,...n}}function le(e){if(He(e)){const{p1x:t,p1y:n,p2x:o,p2y:r}=e;return N(t,n,o,r)}return tt(e)?at(e):Le}function ct(e,t,n,o){function r(i,a){switch(i){case"content":L(a)&&(e.bottomSheetContentWrapper.innerHTML=a);break;case"width":L(a)&&(e.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Be(a)||Z(e.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Be(a)||Z(e.bottomSheetBackdrop,!1);break;case"containerBorderRadius":L(a)&&(e.bottomSheetContainer.style.borderRadius=Te(a));break;case"containerBackgroundColor":L(a)&&(e.bottomSheetContainer.style.backgroundColor=a,e.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":L(a)&&(e.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":L(a)&&(e.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!L(a))return;X(e.bottomSheetRoot,n.rootClass,a);break;case"containerClass":if(!L(a))return;X(e.bottomSheetContainer,n.containerClass,a);break;case"handleClass":if(!L(a))return;X(e.bottomSheetHandle,n.handleClass,a);break;case"contentWrapperClass":if(!L(a))return;X(e.bottomSheetContentWrapper,n.contentWrapperClass,a);break;case"backdropClass":if(!L(a))return;X(e.bottomSheetBackdrop,n.backdropClass,a);break;case"expandable":o.clearEventListeners(),o.attachEventListeners(n);break;case"preventClosing":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggable":o.clearEventListeners(),o.attachEventListeners(n);break;case"dragTriggers":o.clearEventListeners(),o.attachEventListeners(n);break;case"draggingAnimationTimings":if(He(a)){const l=le(a),u=ce(l,n.draggingAnimationDuration);t.translateContainer=u}break;case"draggingAnimationDuration":if(A(a)){const l=le(n.draggingAnimationTimings),u=ce(l,a);t.translateContainer=u}break;case"rootStyle":n.rootStyle&&Object.assign(e.bottomSheetRoot.style,n.rootStyle);break;case"backdropStyle":n.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,n.backdropStyle);break;case"containerStyle":n.containerStyle&&Object.assign(e.bottomSheetContainer.style,n.containerStyle);break;case"containerGapFillerStyle":n.containerGapFillerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,n.containerGapFillerStyle);break;case"handleStyle":n.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,n.handleStyle);break;case"contentWrapperStyle":n.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,n.contentWrapperStyle);break}}return r}function lt(e){const t=st(e),n=le(e.draggingAnimationTimings),o={isMounted:!1,translateContainer:ce(n,t.draggingAnimationDuration)},r={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function i(){r.originalDocumentOverflowY&&r.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=r.originalDocumentOverflowY),r.originalDocumentOverscrollBehavior&&(document.body.style.position=r.originalDocumentOverscrollBehavior)}const a=new Ke,l={animationFrame:a,onClose:w,bottomSheetState:o,draggingState:r,snapTo:b,moveUp:H,moveDown:B},{elements:u,eventHandlers:h}=Xe(t,l),s=Ze(t,ct(u,o,t,h)),{bottomSheetBackdrop:f,bottomSheetRoot:C,bottomSheetContainer:c}=u,E=d=>{const p=d??window.document.body;p.appendChild(C),p.appendChild(f);const g=window.innerHeight;ne(c,{y:g}),h.attachEventListeners(),o.isMounted=!0},S=()=>{h.clearEventListeners(),Object.values(u).forEach(d=>{d.remove()}),i(),o.isMounted=!1},y=()=>{var d;if(x()||et('Bottom Sheet is not mounted yet. call the "mount" method first.'),(d=e.beforeOpen)==null||d.call(e),T())return;re(f,!0),s.shouldShowBackdrop||_(f,"transparent"),re([c],!0),ne(c,{y:c.clientHeight});const p=window.innerHeight,g=me(p,c.clientHeight,s.marginTop,s.defaultPosition),m=P(c).y;o.translateContainer({startY:m,endY:g,animationFrame:a,bottomSheetContainer:c,onEnd:e.afterOpen});const O=document.body.style.overflowY;r.originalDocumentOverflowY=O||"initial";const D=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",u.bottomSheetHandle.focus(),h.attacheOnOpenEventListeners()};function w(){var d;if(j())return;(d=e.beforeClose)==null||d.call(e);const p=P(c).y,g=c.clientHeight;o.translateContainer({startY:p,endY:g,animationFrame:a,bottomSheetContainer:c,onEnd:()=>{var m;(m=e.afterClose)==null||m.call(e),re([f,c],!1),h.clearOnOpenEventListeners()}}),i()}function x(){return o.isMounted}function T(){const d=P(c).y,p=window.innerHeight,g=c.clientHeight>=p?p:c.clientHeight;return d<=g}function j(){return!T()}function V(){const d=P(c).y,p=c.clientHeight,g=window.innerHeight;if(d<=5&&d>=-5)return I.CONTENT_HEIGHT;const m=p-d;if(m===g/2)return I.MIDDLE;const O=g-s.marginTop,D=10;return m<=O+D&&m>=O-D?I.TOP:I.CLOSED}function K(){return c.clientHeight}function G(d){if(!T())return;const p=P(c).y,g=c.clientHeight-p,m=window.innerHeight-d,O=Ie(g,m),D=q(g,m);o.translateContainer({startY:p,endY:p+(O.isUp?-D:D),animationFrame:a,bottomSheetContainer:c})}function U(d,{viewportHeight:p,visibleHeight:g}){let m=null;for(const O of d){const D=O*p,$=q(g,D);(m===null||$<m)&&(m=$)}return{minOffset:m}}function H(){const d=[...s.snapPoints].reverse(),p=P(c).y,g=c.clientHeight,m=g-p;if(!s.expandable&&m>=g)return;const O=window.innerHeight,D=ge("above",{visibleHeight:m,viewportHeight:O},d),{minOffset:$}=U(D,{visibleHeight:m,viewportHeight:O});if($===null&&m<O-s.marginTop){o.translateContainer({startY:p,endY:me(O,g,s.marginTop,"top"),animationFrame:a,bottomSheetContainer:c});return}A($)&&o.translateContainer({startY:p,endY:p-$,animationFrame:a,bottomSheetContainer:c})}function B(){const d=P(c).y,p=c.clientHeight-d;if(p<1)return;const g=window.innerHeight,m=ge("below",{visibleHeight:p,viewportHeight:g},s.snapPoints),{minOffset:O}=U(m,{visibleHeight:p,viewportHeight:g});A(O)&&o.translateContainer({startY:d,endY:d+O,animationFrame:a,bottomSheetContainer:c})}function b(d){const p=window.innerHeight;if(!Qe(d))return;const g=te(p*d,2);G(g)}return{props:s,elements:u,mount:E,unmount:S,open:y,close:w,getIsMounted:x,getIsOpen:T,getIsClosed:j,getPosition:V,getHeight:K,moveTo:G,snapTo:b}}function ue(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>I.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}const ut=ue(),dt=v.forwardRef(function(t,n){const{children:o,isOpen:r,setIsOpen:i,afterClose:a,mountingPointRef:l,...u}=t,h=v.useRef(ut),[s,f]=v.useState(h.current);v.useImperativeHandle(n,()=>s,[s]);const C=v.useCallback(()=>{i(!1),a==null||a()},[a]);v.useEffect(()=>{r?s.open():s.close()},[r]);const c=v.useRef(null);return v.useEffect(function(){var w;if(l&&!l.current)return;const S=Ae((w=t.mountingPointRef)==null?void 0:w.current)?t.mountingPointRef.current:window.document.body;if(!S||s.getIsMounted())return;const y=lt({content:"",...u,afterClose:C});return y.mount(S),c.current=y.elements.bottomSheetContentWrapper??null,h.current=y,f(y),()=>{s.unmount()}},[t.mountingPointRef,u,C]),v.useEffect(function(){Object.assign(h.current.props,{...u}),f(h.current)},[u]),v.useEffect(function(){return()=>{h.current.unmount()}},[]),c.current?xe.createPortal(t.children,c.current):null}),pt=ue();function ht(e={}){const t=v.useRef(pt),[n,o]=v.useState(!1),r=!n,[i,a]=v.useState(t.current);v.useEffect(()=>{a(t.current)},[t.current]);const{beforeOpen:l,afterOpen:u,beforeClose:h,afterClose:s,onDragStart:f,onDragMove:C,onDragEnd:c,...E}=e,S=()=>{l==null||l()},y=()=>{u==null||u(),o(!0)},w=()=>{h==null||h()},x=()=>{s==null||s(),o(!1)},T=()=>{f==null||f()},j=(b,d)=>{C==null||C(b,d)},V=()=>{c==null||c()},K=v.useMemo(()=>({ref:t,isOpen:n,setIsOpen:o,beforeOpen:S,afterOpen:y,beforeClose:w,afterClose:x,onDragStart:T,onDragMove:j,onDragEnd:V,...E}),[t.current,n,o,e]),G=v.useCallback(()=>{o(!0)},[o]),U=v.useCallback(()=>{o(!1)},[o]),H=v.useCallback((...b)=>{i.moveTo(...b)},[i]),B=v.useCallback((...b)=>{i.snapTo(...b)},[i]);return{props:K,instance:i,isOpen:n,isClosed:r,setIsOpen:o,open:G,close:U,moveTo:H,snapTo:B}}M.BottomSheet=dt,M.createPlaceholderBottomSheet=ue,M.useBottomSheet=ht,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainsheet/react",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@plainsheet/core": "0.7.10",
34
+ "@plainsheet/core": "0.7.11",
35
35
  "@plainsheet/utility": "0.0.3"
36
36
  },
37
37
  "devDependencies": {