@headlessui/react
Advanced tools
Comparing version 0.3.0-dc528c0 to 0.3.0-f34c086
@@ -1,5 +0,4 @@ | ||
import React, { ElementType, MutableRefObject } from 'react'; | ||
import React, { Ref, MutableRefObject } from 'react'; | ||
import { Props } from '../../types'; | ||
import { PropsForFeatures } from '../../utils/render'; | ||
declare let DEFAULT_DIALOG_TAG: "div"; | ||
interface DialogRenderPropArg { | ||
@@ -10,23 +9,123 @@ open: boolean; | ||
declare let DialogRenderFeatures: number; | ||
export declare function Dialog<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG>(props: Props<TTag, DialogRenderPropArg, DialogPropsWeControl> & PropsForFeatures<typeof DialogRenderFeatures> & { | ||
export declare let Dialog: <TTag extends React.ElementType<any> = "div">(props: ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: MutableRefObject<HTMLElement>; | ||
}): JSX.Element; | ||
export declare namespace Dialog { | ||
var Overlay: <TTag extends React.ElementType<any> = "div">(props: Props<TTag, OverlayRenderPropArg, OverlayPropsWeControl>, ref: React.Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Title: <TTag extends React.ElementType<any> = "h2">(props: Props<TTag, TitleRenderPropArg, TitlePropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Description: <TTag extends React.ElementType<any> = "p">(props: Props<TTag, DescriptionRenderPropArg, TitlePropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
} | ||
interface OverlayRenderPropArg { | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
} | ||
declare type OverlayPropsWeControl = 'id' | 'aria-hidden' | 'onClick'; | ||
interface TitleRenderPropArg { | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
} | ||
declare type TitlePropsWeControl = 'id' | 'ref'; | ||
interface DescriptionRenderPropArg { | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
} | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-modal">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-modal">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-describedby">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-describedby">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-labelledby">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: DialogRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-labelledby">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
} & { | ||
open: boolean; | ||
onClose(value: boolean): void; | ||
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
}), ref: Ref<HTMLDivElement>) => JSX.Element; | ||
export {}; |
@@ -5,4 +5,4 @@ import { ElementType, MutableRefObject } from 'react'; | ||
export declare function FocusTrap<TTag extends ElementType = typeof DEFAULT_FOCUS_TRAP_TAG>(props: Props<TTag> & { | ||
initialFocus?: MutableRefObject<HTMLElement>; | ||
initialFocus?: MutableRefObject<HTMLElement | null>; | ||
}): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)> | null; | ||
export {}; |
@@ -7,5 +7,4 @@ import { ElementType } from 'react'; | ||
interface PortalRenderPropArg { | ||
open: boolean; | ||
} | ||
export declare function Portal<TTag extends ElementType = typeof DEFAULT_PORTAL_TAG>(props: Props<TTag, PortalRenderPropArg>): import("react").ReactPortal | null; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,o=require("react"),i=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,r,o,i,u){if(void 0===u&&(u=!0),u)return p(e,r,o);var l=null!=i?i:t.None;if(l&t.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,r,o)}if(l&t.RenderStrategy){var m,h=e.unmount,b=void 0===h||h,y=c(e,["unmount"]);return f(b?n.Unmount:n.Hidden,((m={})[n.Unmount]=function(){return null},m[n.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),r,o)},m))}return p(e,r,o)}function p(e,t,n){var r,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?n:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),h=void 0!==e.ref?((r={})[d]=e.ref,r):{},b="function"==typeof l?l(t):l;if(a===o.Fragment&&Object.keys(v).length>0){if(Array.isArray(b)&&b.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!o.isValidElement(b)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return o.cloneElement(b,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),b.props),h))}return o.createElement(a,Object.assign({},m(v,["ref"]),a!==o.Fragment&&h),b)}function v(e){return o.forwardRef(e)}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function h(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.useCallback((function(e){t.forEach((function(t){if(null!==t)return"function"==typeof t?t(e):void(t.current=e)}))}),[t])}function b(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(t||(t={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(n||(n={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,g={serverHandoffComplete:!1},x=0;function w(){return++x}function E(){var e=o.useState(g.serverHandoffComplete?w:null),t=e[0],n=e[1];return y((function(){null===t&&n(w())}),[t]),o.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function C(e){e&&e.focus({preventScroll:!0})}function O(e,t,n){void 0===t&&(t=!0),void 0===n&&(n={});var i=o.useRef("undefined"!=typeof window?document.activeElement:null),u=o.useRef(null),a=o.useRef(!1),c=o.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(S)):[]}),[e]);y((function(){var r,o,l;if(t){a.current=!0;var s=document.activeElement;if(!(null==(r=e.current)?void 0:r.contains(s))){i.current=s;var f=c();if(f.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return function e(t){void 0!==t&&(C(t),document.activeElement!==t?e(f[f.indexOf(t)+1]):u.current=t)}(null!=(o=null==(l=n.initialFocus)?void 0:l.current)?o:f[0]),function(){a.current=!1,C(i.current),i.current=null,u.current=null}}}}),[t,a,n.initialFocus]),y((function(){if(t)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===r.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,n=c(),o=n.length;!function e(r){void 0===r&&(r=0);var i=n.indexOf(document.activeElement),a=n[(i+o+t+r)%o];C(a),a!==document.activeElement?e(r+t):u.current=a}()}}}),[t,c]),y((function(){if(t&&e.current){var n=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var t=u.current;if(t&&a.current){var r=e.target;r&&r instanceof HTMLElement?n.contains(r)?(u.current=r,C(r)):(e.preventDefault(),e.stopPropagation(),C(t)):C(u.current)}}}),[t,a,e])}function I(e,t){return e(t={exports:{}},t.exports),t.exports}var k=I((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,h=m&&m(m(C([])));h&&h!==t&&n.call(h,o)&&(v=h);var b=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=b.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(b),a(b,u,"Generator"),b[o]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),R=k.mark(T);function T(e){var t;return k.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),R)}var L,D,F,P=o.Fragment;function M(e){var t=o.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0];return y((function(){return function(){t&&t.childNodes.length<=1&&document.body.removeChild(t)}}),[t]),t?u.createPortal(d(e,{},P),t):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(D||(D={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(F||(F={}));var A=((L={})[F.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},L[F.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},L),N=o.createContext(null);function j(e){var t=o.useContext(N);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+H.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,j),n}return t}function G(e,t){return f(t.type,A,e,t)}N.displayName="DialogContext";var U=t.RenderStrategy|t.Static;function H(e){var t,n,u=e.open,l=e.onClose,f=e.initialFocus,p=c(e,["open","onClose","initialFocus"]),v=o.useRef(null),m=e.hasOwnProperty("open"),h=e.hasOwnProperty("onClose");if(!m)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!h)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof u)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+u);if("function"!=typeof l)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+l);var b=u?D.Open:D.Closed,g=o.useReducer(G,{titleElement:null,descriptionElement:null}),x=g[0],w=g[1],S=o.useCallback((function(){return l(!1)}),[l]),C=o.useCallback((function(e){return w({type:F.SetTitleElement,element:e})}),[w]),I=o.useCallback((function(e){return w({type:F.SetDescriptionElement,element:e})}),[w]);o.useEffect((function(){function e(e){e.key===r.Escape&&b===D.Open&&S()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[S,b]),o.useEffect((function(){if(b===D.Open){var e=window.scrollX,t=window.scrollY,n=document.documentElement.style.overflow,r=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",function(){document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=r,window.scroll(e,t)}}}),[b]);var k=!!e.static||b===D.Open;O(v,k,{initialFocus:f}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(T(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(v,k);var R="headlessui-dialog-"+E(),L=o.useMemo((function(){return[{dialogState:b,close:S,setTitle:C,setDescription:I},x]}),[b,x,S,C,I]),P=o.useMemo((function(){return{open:b===D.Open,close:S}}),[b,S]),A={ref:v,id:R,role:"dialog","aria-modal":b===D.Open||void 0,"aria-labelledby":null==(t=x.titleElement)?void 0:t.id,"aria-describedby":null==(n=x.descriptionElement)?void 0:n.id};return i.createElement(M,null,i.createElement(N.Provider,{value:L},d(a({},p,A),P,"div",U,b===D.Open)))}var V,_,B,Q=v((function e(t,n){var r=j([H.name,e.name].join("."))[0],i=r.dialogState,u=r.close,c=h(n),l="headlessui-dialog-overlay-"+E(),s=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();u()}),[u]),f=o.useMemo((function(){return{open:i===D.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")}));H.Overlay=Q,H.Title=function e(t){var n=j([H.name,e.name].join("."))[0],r=n.dialogState,i=n.setTitle,u="headlessui-dialog-title-"+E(),c=o.useMemo((function(){return{open:r===D.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"h2")},H.Description=function e(t){var n=j([H.name,e.name].join("."))[0],r=n.dialogState,i=n.setDescription,u="headlessui-dialog-description-"+E(),c=o.useMemo((function(){return{open:r===D.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"p")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(_||(_={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(B||(B={}));var K=((V={})[B.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[_.Open]=_.Closed,t[_.Closed]=_.Open,t))})},V[B.LinkPanel]=function(e){return a({},e,{linkedPanel:!0})},V[B.UnlinkPanel]=function(e){return a({},e,{linkedPanel:!1})},V[B.SetButtonId]=function(e,t){return a({},e,{buttonId:t.buttonId})},V[B.SetPanelId]=function(e,t){return a({},e,{panelId:t.panelId})},V),Y=o.createContext(null);function q(e){var t=o.useContext(Y);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+X.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,q),n}return t}function W(e,t){return f(t.type,K,e,t)}Y.displayName="DisclosureContext";var J=o.Fragment;function X(e){var t="headlessui-disclosure-button-"+E(),n="headlessui-disclosure-panel-"+E(),r=o.useReducer(W,{disclosureState:_.Closed,linkedPanel:!1,buttonId:t,panelId:n}),u=r[0].disclosureState,a=r[1];o.useEffect((function(){return a({type:B.SetButtonId,buttonId:t})}),[t,a]),o.useEffect((function(){return a({type:B.SetPanelId,panelId:n})}),[n,a]);var c=o.useMemo((function(){return{open:u===_.Open}}),[u]);return i.createElement(Y.Provider,{value:r},d(e,c,J))}var $,z,Z,ee,te=v((function e(t,n){var i=q([X.name,e.name].join(".")),u=i[0],c=i[1],l=h(n),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:B.ToggleDisclosure})}}),[c]),f=o.useCallback((function(e){b(e.currentTarget)||t.disabled||c({type:B.ToggleDisclosure})}),[c,t.disabled]),p=o.useMemo((function(){return{open:u.disclosureState===_.Open}}),[u]);return d(a({},t,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===_.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ne=t.RenderStrategy|t.Static,re=v((function e(t,n){var r=q([X.name,e.name].join(".")),u=r[0],c=r[1],l=h(n,(function(){u.linkedPanel||c({type:B.LinkPanel})}));o.useEffect((function(){return function(){return c({type:B.UnlinkPanel})}}),[c]),i.useEffect((function(){var e;u.disclosureState!==_.Closed||null!=(e=t.unmount)&&!e||c({type:B.UnlinkPanel})}),[u.disclosureState,t.unmount,c]);var s=i.useMemo((function(){return{open:u.disclosureState===_.Open}}),[u]);return d(a({},t,{ref:l,id:u.panelId}),s,"div",ne,u.disclosureState===_.Open)}));function oe(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function ie(){var e=o.useState(oe)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function ue(e,t){var n=o.useState(e),r=n[0],i=n[1],u=o.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(t)),r}function ae(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case $.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case $.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case $.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case $.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case $.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case $.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function ce(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}X.Button=te,X.Panel=re,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}($||($={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Z||(Z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ee||(ee={}));var le=((z={})[ee.CloseListbox]=function(e){return e.disabled||e.listboxState===Z.Closed?e:a({},e,{activeOptionIndex:null,listboxState:Z.Closed})},z[ee.OpenListbox]=function(e){return e.disabled||e.listboxState===Z.Open?e:a({},e,{listboxState:Z.Open})},z[ee.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},z[ee.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=ae(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},z[ee.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},z[ee.ClearSearch]=function(e){return e.disabled||e.listboxState===Z.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},z[ee.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},z[ee.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},z),se=o.createContext(null);function fe(e){var t=o.useContext(se);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+ve.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,fe),n}return t}function de(e,t){return f(t.type,le,e,t)}se.displayName="ListboxContext";var pe=o.Fragment;function ve(e){var t=e.value,n=e.onChange,r=e.disabled,u=void 0!==r&&r,a=c(e,["value","onChange","disabled"]),l=ie(),s=o.useReducer(de,{listboxState:Z.Closed,propsRef:{current:{value:t,onChange:n}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:u,options:[],searchQuery:"",activeOptionIndex:null}),f=s[0],p=f.listboxState,v=f.propsRef,m=f.optionsRef,h=f.buttonRef,b=s[1];y((function(){v.current.value=t}),[t,v]),y((function(){v.current.onChange=n}),[n,v]),y((function(){return b({type:ee.SetDisabled,disabled:u})}),[u]),o.useEffect((function(){function e(e){var t,n,r,o=e.target,i=document.activeElement;p===Z.Open&&((null==(t=h.current)?void 0:t.contains(o))||((null==(n=m.current)?void 0:n.contains(o))||b({type:ee.CloseListbox}),i!==document.body&&(null==i?void 0:i.contains(o))||e.defaultPrevented||null==(r=h.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[p,m,h,l,b]);var g=o.useMemo((function(){return{open:p===Z.Open,disabled:u}}),[p,u]);return i.createElement(se.Provider,{value:s},d(a,g,pe))}var me,he,be,ye=v((function e(t,n){var i,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,n),f="headlessui-listbox-button-"+E(),p=ie(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();c.listboxState===Z.Open?(l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=ue((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=o.useMemo((function(){return{open:c.listboxState===Z.Open,disabled:c.disabled}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.optionsRef.current)?void 0:i.id,"aria-expanded":c.listboxState===Z.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),ge=t.RenderStrategy|t.Static,xe=v((function e(t,n){var i,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.optionsRef,n),f="headlessui-listbox-options-"+E(),p=ie(),v=ie(),m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ee.Search,value:e.key});case r.Enter:e.preventDefault(),l({type:ee.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),oe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Next});case r.ArrowUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Previous});case r.Home:case r.PageUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.First});case r.End:case r.PageDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Last});case r.Escape:return e.preventDefault(),l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ee.Search,value:e.key}),v.setTimeout((function(){return l({type:ee.ClearSearch})}),350))}}),[p,l,v,c]),b=ue((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=o.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return d(a({},t,{"aria-activedescendant":null===c.activeOptionIndex||null==(i=c.options[c.activeOptionIndex])?void 0:i.id,"aria-labelledby":b,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",ge,c.listboxState===Z.Open)}));ve.Button=ye,ve.Label=function e(t){var n=fe([ve.name,e.name].join("."))[0],r="headlessui-listbox-label-"+E(),i=o.useCallback((function(){var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[n.buttonRef]),u=o.useMemo((function(){return{open:n.listboxState===Z.Open,disabled:n.disabled}}),[n]);return d(a({},t,{ref:n.labelRef,id:r,onClick:i}),u,"label")},ve.Options=xe,ve.Option=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.value,u=t.className,l=c(t,["disabled","value","className"]),s=fe([ve.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,h=f.propsRef.current.value===i,b=o.useRef({disabled:r,value:i});y((function(){b.current.disabled=r}),[b,r]),y((function(){b.current.value=i}),[b,i]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]);var g=o.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ee.RegisterOption,id:v,dataRef:b}),function(){return p({type:ee.UnregisterOption,id:v})}}),[b,v]),y((function(){var e;f.listboxState===Z.Open&&h&&(p({type:ee.GoToOption,focus:$.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===Z.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var x=o.useCallback((function(e){if(r)return e.preventDefault();g(),p({type:ee.CloseListbox}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,r,g]),w=o.useCallback((function(){if(r)return p({type:ee.GoToOption,focus:$.Nothing});p({type:ee.GoToOption,focus:$.Specific,id:v})}),[r,v,p]),S=o.useCallback((function(){r||m||p({type:ee.GoToOption,focus:$.Specific,id:v})}),[r,m,v,p]),C=o.useCallback((function(){r||m&&p({type:ee.GoToOption,focus:$.Nothing})}),[r,m,p]),O=o.useMemo((function(){return{active:m,selected:h,disabled:r}}),[m,h,r]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:ce(u,O),"aria-disabled":!0===r||void 0,"aria-selected":!0===h||void 0,onClick:x,onFocus:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(he||(he={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(be||(be={}));var we=((me={})[be.CloseMenu]=function(e){return a({},e,{activeItemIndex:null,menuState:he.Closed})},me[be.OpenMenu]=function(e){return a({},e,{menuState:he.Open})},me[be.GoToItem]=function(e,t){var n=ae(t,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},me[be.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},me[be.ClearSearch]=function(e){return a({},e,{searchQuery:""})},me[be.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},me[be.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},me),Ee=o.createContext(null);function Se(e){var t=o.useContext(Ee);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+Ie.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Se),n}return t}function Ce(e,t){return f(t.type,we,e,t)}Ee.displayName="MenuContext";var Oe=o.Fragment;function Ie(e){var t=o.useReducer(Ce,{menuState:he.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),n=t[0],r=n.menuState,u=n.itemsRef,a=n.buttonRef,c=t[1];o.useEffect((function(){function e(e){var t,n,o,i=e.target,l=document.activeElement;r===he.Open&&((null==(t=a.current)?void 0:t.contains(i))||((null==(n=u.current)?void 0:n.contains(i))||c({type:be.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(i))||e.defaultPrevented||null==(o=a.current)||o.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[r,u,a,c]);var l=o.useMemo((function(){return{open:r===he.Open}}),[r]);return i.createElement(Ee.Provider,{value:t},d(e,l,Oe))}var ke=v((function e(t,n){var i,u=Se([Ie.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,n),f="headlessui-menu-button-"+E(),p=ie(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();t.disabled||(c.menuState===he.Open?(l({type:be.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),y=o.useMemo((function(){return{open:c.menuState===he.Open}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.itemsRef.current)?void 0:i.id,"aria-expanded":c.menuState===he.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Re=t.RenderStrategy|t.Static,Te=v((function e(t,n){var i,u,c=Se([Ie.name,e.name].join(".")),l=c[0],s=c[1],f=h(l.itemsRef,n),p="headlessui-menu-items-"+E(),v=ie();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===he.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:be.Search,value:e.key});case r.Enter:var t;e.preventDefault(),s({type:be.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Next});case r.ArrowUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.Previous});case r.Home:case r.PageUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.First});case r.End:case r.PageDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Last});case r.Escape:e.preventDefault(),s({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:be.Search,value:e.key}),v.setTimeout((function(){return s({type:be.ClearSearch})}),350))}}),[s,v,l]),b=o.useMemo((function(){return{open:l.menuState===he.Open}}),[l]);return d(a({},t,{"aria-activedescendant":null===l.activeItemIndex||null==(i=l.items[l.activeItemIndex])?void 0:i.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),b,"div",Re,l.menuState===he.Open)})),Le=o.Fragment;Ie.Button=ke,Ie.Items=Te,Ie.Item=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.className,u=t.onClick,l=c(t,["disabled","className","onClick"]),s=Se([Ie.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===he.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var h=o.useRef({disabled:r});y((function(){h.current.disabled=r}),[h,r]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]),y((function(){return p({type:be.RegisterItem,id:v,dataRef:h}),function(){return p({type:be.UnregisterItem,id:v})}}),[h,v]);var b=o.useCallback((function(e){return r?e.preventDefault():(p({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,r,u]),g=o.useCallback((function(){if(r)return p({type:be.GoToItem,focus:$.Nothing});p({type:be.GoToItem,focus:$.Specific,id:v})}),[r,v,p]),x=o.useCallback((function(){r||m||p({type:be.GoToItem,focus:$.Specific,id:v})}),[r,m,v,p]),w=o.useCallback((function(){r||m&&p({type:be.GoToItem,focus:$.Nothing})}),[r,m,p]),S=o.useMemo((function(){return{active:m,disabled:r}}),[m,r]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:ce(i,S),"aria-disabled":!0===r||void 0,onClick:b,onFocus:g,onPointerMove:x,onMouseMove:x,onPointerLeave:w,onMouseLeave:w}),S,Le)};var De=o.createContext(null);function Fe(e){var t=o.useContext(De);if(null===t){var n=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Fe),n}return t}De.displayName="GroupContext";var Pe,Me=o.Fragment;function Ae(e){var t,n,i=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=o.useContext(De),v=o.useCallback((function(){return u(!i)}),[u,i]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),h=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&v()}),[v]),y=o.useCallback((function(e){return e.preventDefault()}),[]),g=o.useMemo((function(){return{checked:i}}),[i]),x={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ce(l,g),"aria-checked":i,"aria-labelledby":null==p||null==(t=p.label)?void 0:t.id,"aria-describedby":null==p||null==(n=p.description)?void 0:n.id,onClick:m,onKeyUp:h,onKeyPress:y};return"button"===s.as&&Object.assign(x,{type:"button"}),d(a({},s,x),g,"button")}function Ne(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function je(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function Ge(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Ue(e,t,n,r,o){var i=oe(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return je.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){Ge.apply(void 0,[e].concat(n)),je.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=oe();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Pe.Finished)}),i+o[1]):t(Pe.Finished),n.add((function(){return t(Pe.Cancelled)})),n.dispose}(e,(function(n){return Ge.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return Ge.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Pe.Cancelled)})),i.dispose}function He(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Ae.Group=function(e){var t=o.useState(null),n=t[0],r=t[1],u=o.useState(null),a=u[0],c=u[1],l=o.useState(null),s=l[0],f=l[1],p=o.useMemo((function(){return{switch:n,setSwitch:r,label:a,setLabel:c,description:s,setDescription:f}}),[n,r,a,c,s,f]);return i.createElement(De.Provider,{value:p},d(e,{},Me))},Ae.Label=function e(t){var n=Fe([Ae.name,e.name].join(".")),r="headlessui-switch-label-"+E(),i=o.useCallback((function(){n.switch&&(n.switch.click(),n.switch.focus({preventScroll:!0}))}),[n.switch]);return d(a({},t,{ref:n.setLabel,id:r,onClick:i}),{},"label")},Ae.Description=function e(t){var n=Fe([Ae.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Pe||(Pe={}));var Ve,_e=o.createContext(null);_e.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Ve||(Ve={}));var Be=o.createContext(null);function Qe(e){return"children"in e?Qe(e.children):e.current.filter((function(e){return e.state===Ve.Visible})).length>0}function Ke(e){var t=o.useRef(e),r=o.useRef([]),i=function(){var e=o.useRef(!0);return o.useEffect((function(){return function(){e.current=!1}}),[]),e}();o.useEffect((function(){t.current=e}),[e]);var u=o.useCallback((function(e,o){var u;void 0===o&&(o=n.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(o,((u={})[n.Unmount]=function(){r.current.splice(a,1)},u[n.Hidden]=function(){r.current[a].state=Ve.Hidden},u)),!Qe(r)&&i.current&&(null==t.current||t.current()))}),[t,i,r]),a=o.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==Ve.Visible&&(t.state=Ve.Visible):r.current.push({id:e,state:Ve.Visible}),function(){return u(e,n.Unmount)}}),[r,u]);return o.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ye(){}Be.displayName="NestingContext";var qe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function We(e){for(var t,n={},r=s(qe);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:Ye}return n}var Je=t.RenderStrategy;function Xe(e){var t=e.beforeEnter,r=e.afterEnter,u=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,h=e.leaveFrom,b=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=o.useRef(null),w=o.useState(Ve.Visible),S=w[0],C=w[1],O=g.unmount?n.Unmount:n.Hidden,I=function(){var e=o.useContext(_e);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=I.show,R=I.appear,T=function(){var e=o.useContext(Be);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),L=T.register,D=T.unregister,F=Ne(),P=E(),M=o.useRef(!1),A=Ke((function(){M.current||(C(Ve.Hidden),D(P),_.current.afterLeave())}));y((function(){if(P)return L(P)}),[L,P]),y((function(){var e;O===n.Hidden&&P&&(k&&S!==Ve.Visible?C(Ve.Visible):f(S,((e={})[Ve.Hidden]=function(){return D(P)},e[Ve.Visible]=function(){return L(P)},e)))}),[S,P,L,D,k,O]);var N=He(s),j=He(p),G=He(v),U=He(m),H=He(h),V=He(b),_=function(e){var t=o.useRef(We(e));return o.useEffect((function(){t.current=We(e)}),[e]),t}({beforeEnter:t,afterEnter:r,beforeLeave:u,afterLeave:l});o.useEffect((function(){if(S===Ve.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,S]);var B=F&&!R;return y((function(){var e=x.current;if(e&&!B)return M.current=!0,k&&_.current.beforeEnter(),k||_.current.beforeLeave(),k?Ue(e,N,j,G,(function(e){M.current=!1,e===Pe.Finished&&_.current.afterEnter()})):Ue(e,U,H,V,(function(e){M.current=!1,e===Pe.Finished&&(Qe(A)||(C(Ve.Hidden),D(P),_.current.afterLeave()))}))}),[_,P,M,D,A,x,B,k,N,j,G,U,H,V]),i.createElement(Be.Provider,{value:A},d(a({},g,{ref:x}),{},"div",Je,S===Ve.Visible))}function $e(e){var t=e.show,n=e.appear,r=void 0!==n&&n,u=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=o.useState(t?Ve.Visible:Ve.Hidden),f=s[0],p=s[1],v=Ke((function(){p(Ve.Hidden)})),m=Ne(),h=o.useMemo((function(){return{show:t,appear:r||!m}}),[t,r,m]);o.useEffect((function(){t?p(Ve.Visible):Qe(v)||p(Ve.Hidden)}),[t,v]);var b={unmount:u};return i.createElement(Be.Provider,{value:v},i.createElement(_e.Provider,{value:h},d(a({},b,{as:o.Fragment,children:i.createElement(Xe,Object.assign({},b,l))}),{},o.Fragment,Je,f===Ve.Visible)))}$e.Child=Xe,exports.Dialog=H,exports.Disclosure=X,exports.FocusTrap=function(e){var t=o.useRef(null),n=e.initialFocus,r=c(e,["initialFocus"]);return O(t,!0,{initialFocus:n}),d(a({},r,{ref:t}),{},"div")},exports.Listbox=ve,exports.Menu=Ie,exports.Portal=M,exports.Switch=Ae,exports.Transition=$e; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,o=require("react"),i=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,r,o,i,u){if(void 0===u&&(u=!0),u)return p(e,r,o);var l=null!=i?i:t.None;if(l&t.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,r,o)}if(l&t.RenderStrategy){var m,h=e.unmount,b=void 0===h||h,y=c(e,["unmount"]);return f(b?n.Unmount:n.Hidden,((m={})[n.Unmount]=function(){return null},m[n.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),r,o)},m))}return p(e,r,o)}function p(e,t,n){var r,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?n:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),h=void 0!==e.ref?((r={})[d]=e.ref,r):{},b="function"==typeof l?l(t):l;if(a===o.Fragment&&Object.keys(v).length>0){if(Array.isArray(b)&&b.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!o.isValidElement(b)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return o.cloneElement(b,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),b.props),h))}return o.createElement(a,Object.assign({},m(v,["ref"]),a!==o.Fragment&&h),b)}function v(e){return o.forwardRef(e)}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function h(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.useCallback((function(e){t.forEach((function(t){if(null!==t)return"function"==typeof t?t(e):void(t.current=e)}))}),[t])}function b(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(t||(t={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(n||(n={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,g={serverHandoffComplete:!1},x=0;function w(){return++x}function E(){var e=o.useState(g.serverHandoffComplete?w:null),t=e[0],n=e[1];return y((function(){null===t&&n(w())}),[t]),o.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function C(e){e&&e.focus({preventScroll:!0})}function O(e,t,n){void 0===t&&(t=!0),void 0===n&&(n={});var i=o.useRef("undefined"!=typeof window?document.activeElement:null),u=o.useRef(null),a=o.useRef(!1),c=o.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(S)):[]}),[e]);y((function(){var r,o,l,s;if(t){a.current=!0;var f,d=document.activeElement;if(null==(r=n.initialFocus)?void 0:r.current){if((null==(f=n.initialFocus)?void 0:f.current)===d)return}else if(null==(o=e.current)?void 0:o.contains(d))return;i.current=d;var p=c();if(p.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return function e(t){void 0!==t&&(C(t),document.activeElement!==t?e(p[p.indexOf(t)+1]):u.current=t)}(null!=(l=null==(s=n.initialFocus)?void 0:s.current)?l:p[0]),function(){a.current=!1,C(i.current),i.current=null,u.current=null}}}),[t,a,n.initialFocus]),y((function(){if(t)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===r.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,n=c(),o=n.length;!function e(r){void 0===r&&(r=0);var i=n.indexOf(document.activeElement),a=n[(i+o+t+r)%o];C(a),a!==document.activeElement?e(r+t):u.current=a}()}}}),[t,c]),y((function(){if(t&&e.current){var n=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var t=u.current;if(t&&a.current){var r=e.target;r&&r instanceof HTMLElement?n.contains(r)?(u.current=r,C(r)):(e.preventDefault(),e.stopPropagation(),C(t)):C(u.current)}}}),[t,a,e])}function I(e,t){return e(t={exports:{}},t.exports),t.exports}var k=I((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,h=m&&m(m(C([])));h&&h!==t&&n.call(h,o)&&(v=h);var b=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=b.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(b),a(b,u,"Generator"),b[o]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),R=k.mark(T);function T(e){var t;return k.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),R)}var L,D,F,P=o.Fragment;function M(e){var t=o.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0];return y((function(){return function(){t&&t.childNodes.length<=1&&document.body.removeChild(t)}}),[t]),t?u.createPortal(d(e,{},P),t):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(D||(D={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(F||(F={}));var A=((L={})[F.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},L[F.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},L),N=o.createContext(null);function j(e){var t=o.useContext(N);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+B.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,j),n}return t}function G(e,t){return f(t.type,A,e,t)}N.displayName="DialogContext";var U,H,V,_=t.RenderStrategy|t.Static,B=v((function(e,t){var n,u,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=o.useRef(null),b=h(m,t),g=e.hasOwnProperty("open"),x=e.hasOwnProperty("onClose");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!x)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var w=l?D.Open:D.Closed,S=o.useReducer(G,{titleElement:null,descriptionElement:null}),C=S[0],I=S[1],k=o.useCallback((function(){return f(!1)}),[f]),R=o.useCallback((function(e){return I({type:F.SetTitleElement,element:e})}),[I]),L=o.useCallback((function(e){return I({type:F.SetDescriptionElement,element:e})}),[I]);o.useEffect((function(){function e(e){e.key===r.Escape&&w===D.Open&&k()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[k,w]),o.useEffect((function(){if(w===D.Open){var e=window.scrollX,t=window.scrollY,n=document.documentElement.style.overflow,r=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",function(){document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=r,window.scroll(e,t)}}}),[w]);var P=!!e.static||w===D.Open;O(m,P,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(T(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,P);var A="headlessui-dialog-"+E(),j=o.useMemo((function(){return[{dialogState:w,close:k,setTitle:R,setDescription:L},C]}),[w,C,k,R,L]),U=o.useMemo((function(){return{open:w===D.Open,close:k}}),[w,k]),H={ref:b,id:A,role:"dialog","aria-modal":w===D.Open||void 0,"aria-labelledby":null==(n=C.titleElement)?void 0:n.id,"aria-describedby":null==(u=C.descriptionElement)?void 0:u.id};return i.createElement(M,null,i.createElement(N.Provider,{value:j},d(a({},v,H),U,"div",_,w===D.Open)))})),Q=v((function e(t,n){var r=j([B.name,e.name].join("."))[0],i=r.dialogState,u=r.close,c=h(n),l="headlessui-dialog-overlay-"+E(),s=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();u()}),[u]),f=o.useMemo((function(){return{open:i===D.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")}));Object.assign(B,{name:"Dialog",Overlay:Q,Title:function e(t){var n=j([B.name,e.name].join("."))[0],r=n.dialogState,i=n.setTitle,u="headlessui-dialog-title-"+E(),c=o.useMemo((function(){return{open:r===D.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"h2")},Description:function e(t){var n=j([B.name,e.name].join("."))[0],r=n.dialogState,i=n.setDescription,u="headlessui-dialog-description-"+E(),c=o.useMemo((function(){return{open:r===D.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"p")}}),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(H||(H={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(V||(V={}));var K=((U={})[V.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[H.Open]=H.Closed,t[H.Closed]=H.Open,t))})},U[V.LinkPanel]=function(e){return a({},e,{linkedPanel:!0})},U[V.UnlinkPanel]=function(e){return a({},e,{linkedPanel:!1})},U[V.SetButtonId]=function(e,t){return a({},e,{buttonId:t.buttonId})},U[V.SetPanelId]=function(e,t){return a({},e,{panelId:t.panelId})},U),Y=o.createContext(null);function q(e){var t=o.useContext(Y);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+X.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,q),n}return t}function W(e,t){return f(t.type,K,e,t)}Y.displayName="DisclosureContext";var J=o.Fragment;function X(e){var t="headlessui-disclosure-button-"+E(),n="headlessui-disclosure-panel-"+E(),r=o.useReducer(W,{disclosureState:H.Closed,linkedPanel:!1,buttonId:t,panelId:n}),u=r[0].disclosureState,a=r[1];o.useEffect((function(){return a({type:V.SetButtonId,buttonId:t})}),[t,a]),o.useEffect((function(){return a({type:V.SetPanelId,panelId:n})}),[n,a]);var c=o.useMemo((function(){return{open:u===H.Open}}),[u]);return i.createElement(Y.Provider,{value:r},d(e,c,J))}var $,z,Z,ee,te=v((function e(t,n){var i=q([X.name,e.name].join(".")),u=i[0],c=i[1],l=h(n),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:V.ToggleDisclosure})}}),[c]),f=o.useCallback((function(e){b(e.currentTarget)||t.disabled||c({type:V.ToggleDisclosure})}),[c,t.disabled]),p=o.useMemo((function(){return{open:u.disclosureState===H.Open}}),[u]);return d(a({},t,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===H.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ne=t.RenderStrategy|t.Static,re=v((function e(t,n){var r=q([X.name,e.name].join(".")),u=r[0],c=r[1],l=h(n,(function(){u.linkedPanel||c({type:V.LinkPanel})}));o.useEffect((function(){return function(){return c({type:V.UnlinkPanel})}}),[c]),i.useEffect((function(){var e;u.disclosureState!==H.Closed||null!=(e=t.unmount)&&!e||c({type:V.UnlinkPanel})}),[u.disclosureState,t.unmount,c]);var s=i.useMemo((function(){return{open:u.disclosureState===H.Open}}),[u]);return d(a({},t,{ref:l,id:u.panelId}),s,"div",ne,u.disclosureState===H.Open)}));function oe(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function ie(){var e=o.useState(oe)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function ue(e,t){var n=o.useState(e),r=n[0],i=n[1],u=o.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(t)),r}function ae(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case $.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case $.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case $.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case $.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case $.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case $.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function ce(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}X.Button=te,X.Panel=re,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}($||($={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Z||(Z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ee||(ee={}));var le=((z={})[ee.CloseListbox]=function(e){return e.disabled||e.listboxState===Z.Closed?e:a({},e,{activeOptionIndex:null,listboxState:Z.Closed})},z[ee.OpenListbox]=function(e){return e.disabled||e.listboxState===Z.Open?e:a({},e,{listboxState:Z.Open})},z[ee.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},z[ee.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=ae(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},z[ee.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},z[ee.ClearSearch]=function(e){return e.disabled||e.listboxState===Z.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},z[ee.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},z[ee.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},z),se=o.createContext(null);function fe(e){var t=o.useContext(se);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+ve.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,fe),n}return t}function de(e,t){return f(t.type,le,e,t)}se.displayName="ListboxContext";var pe=o.Fragment;function ve(e){var t=e.value,n=e.onChange,r=e.disabled,u=void 0!==r&&r,a=c(e,["value","onChange","disabled"]),l=ie(),s=o.useReducer(de,{listboxState:Z.Closed,propsRef:{current:{value:t,onChange:n}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:u,options:[],searchQuery:"",activeOptionIndex:null}),f=s[0],p=f.listboxState,v=f.propsRef,m=f.optionsRef,h=f.buttonRef,b=s[1];y((function(){v.current.value=t}),[t,v]),y((function(){v.current.onChange=n}),[n,v]),y((function(){return b({type:ee.SetDisabled,disabled:u})}),[u]),o.useEffect((function(){function e(e){var t,n,r,o=e.target,i=document.activeElement;p===Z.Open&&((null==(t=h.current)?void 0:t.contains(o))||((null==(n=m.current)?void 0:n.contains(o))||b({type:ee.CloseListbox}),i!==document.body&&(null==i?void 0:i.contains(o))||e.defaultPrevented||null==(r=h.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[p,m,h,l,b]);var g=o.useMemo((function(){return{open:p===Z.Open,disabled:u}}),[p,u]);return i.createElement(se.Provider,{value:s},d(a,g,pe))}var me,he,be,ye=v((function e(t,n){var i,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,n),f="headlessui-listbox-button-"+E(),p=ie(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();c.listboxState===Z.Open?(l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=ue((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=o.useMemo((function(){return{open:c.listboxState===Z.Open,disabled:c.disabled}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.optionsRef.current)?void 0:i.id,"aria-expanded":c.listboxState===Z.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),ge=t.RenderStrategy|t.Static,xe=v((function e(t,n){var i,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.optionsRef,n),f="headlessui-listbox-options-"+E(),p=ie(),v=ie(),m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ee.Search,value:e.key});case r.Enter:e.preventDefault(),l({type:ee.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),oe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Next});case r.ArrowUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Previous});case r.Home:case r.PageUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.First});case r.End:case r.PageDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Last});case r.Escape:return e.preventDefault(),l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ee.Search,value:e.key}),v.setTimeout((function(){return l({type:ee.ClearSearch})}),350))}}),[p,l,v,c]),b=ue((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=o.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return d(a({},t,{"aria-activedescendant":null===c.activeOptionIndex||null==(i=c.options[c.activeOptionIndex])?void 0:i.id,"aria-labelledby":b,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",ge,c.listboxState===Z.Open)}));ve.Button=ye,ve.Label=function e(t){var n=fe([ve.name,e.name].join("."))[0],r="headlessui-listbox-label-"+E(),i=o.useCallback((function(){var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[n.buttonRef]),u=o.useMemo((function(){return{open:n.listboxState===Z.Open,disabled:n.disabled}}),[n]);return d(a({},t,{ref:n.labelRef,id:r,onClick:i}),u,"label")},ve.Options=xe,ve.Option=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.value,u=t.className,l=c(t,["disabled","value","className"]),s=fe([ve.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,h=f.propsRef.current.value===i,b=o.useRef({disabled:r,value:i});y((function(){b.current.disabled=r}),[b,r]),y((function(){b.current.value=i}),[b,i]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]);var g=o.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ee.RegisterOption,id:v,dataRef:b}),function(){return p({type:ee.UnregisterOption,id:v})}}),[b,v]),y((function(){var e;f.listboxState===Z.Open&&h&&(p({type:ee.GoToOption,focus:$.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===Z.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var x=o.useCallback((function(e){if(r)return e.preventDefault();g(),p({type:ee.CloseListbox}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,r,g]),w=o.useCallback((function(){if(r)return p({type:ee.GoToOption,focus:$.Nothing});p({type:ee.GoToOption,focus:$.Specific,id:v})}),[r,v,p]),S=o.useCallback((function(){r||m||p({type:ee.GoToOption,focus:$.Specific,id:v})}),[r,m,v,p]),C=o.useCallback((function(){r||m&&p({type:ee.GoToOption,focus:$.Nothing})}),[r,m,p]),O=o.useMemo((function(){return{active:m,selected:h,disabled:r}}),[m,h,r]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:ce(u,O),"aria-disabled":!0===r||void 0,"aria-selected":!0===h||void 0,onClick:x,onFocus:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(he||(he={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(be||(be={}));var we=((me={})[be.CloseMenu]=function(e){return a({},e,{activeItemIndex:null,menuState:he.Closed})},me[be.OpenMenu]=function(e){return a({},e,{menuState:he.Open})},me[be.GoToItem]=function(e,t){var n=ae(t,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},me[be.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},me[be.ClearSearch]=function(e){return a({},e,{searchQuery:""})},me[be.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},me[be.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},me),Ee=o.createContext(null);function Se(e){var t=o.useContext(Ee);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+Ie.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Se),n}return t}function Ce(e,t){return f(t.type,we,e,t)}Ee.displayName="MenuContext";var Oe=o.Fragment;function Ie(e){var t=o.useReducer(Ce,{menuState:he.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),n=t[0],r=n.menuState,u=n.itemsRef,a=n.buttonRef,c=t[1];o.useEffect((function(){function e(e){var t,n,o,i=e.target,l=document.activeElement;r===he.Open&&((null==(t=a.current)?void 0:t.contains(i))||((null==(n=u.current)?void 0:n.contains(i))||c({type:be.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(i))||e.defaultPrevented||null==(o=a.current)||o.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[r,u,a,c]);var l=o.useMemo((function(){return{open:r===he.Open}}),[r]);return i.createElement(Ee.Provider,{value:t},d(e,l,Oe))}var ke=v((function e(t,n){var i,u=Se([Ie.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,n),f="headlessui-menu-button-"+E(),p=ie(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();t.disabled||(c.menuState===he.Open?(l({type:be.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),y=o.useMemo((function(){return{open:c.menuState===he.Open}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.itemsRef.current)?void 0:i.id,"aria-expanded":c.menuState===he.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Re=t.RenderStrategy|t.Static,Te=v((function e(t,n){var i,u,c=Se([Ie.name,e.name].join(".")),l=c[0],s=c[1],f=h(l.itemsRef,n),p="headlessui-menu-items-"+E(),v=ie();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===he.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:be.Search,value:e.key});case r.Enter:var t;e.preventDefault(),s({type:be.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Next});case r.ArrowUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.Previous});case r.Home:case r.PageUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.First});case r.End:case r.PageDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Last});case r.Escape:e.preventDefault(),s({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:be.Search,value:e.key}),v.setTimeout((function(){return s({type:be.ClearSearch})}),350))}}),[s,v,l]),b=o.useMemo((function(){return{open:l.menuState===he.Open}}),[l]);return d(a({},t,{"aria-activedescendant":null===l.activeItemIndex||null==(i=l.items[l.activeItemIndex])?void 0:i.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),b,"div",Re,l.menuState===he.Open)})),Le=o.Fragment;Ie.Button=ke,Ie.Items=Te,Ie.Item=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.className,u=t.onClick,l=c(t,["disabled","className","onClick"]),s=Se([Ie.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===he.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var h=o.useRef({disabled:r});y((function(){h.current.disabled=r}),[h,r]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]),y((function(){return p({type:be.RegisterItem,id:v,dataRef:h}),function(){return p({type:be.UnregisterItem,id:v})}}),[h,v]);var b=o.useCallback((function(e){return r?e.preventDefault():(p({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,r,u]),g=o.useCallback((function(){if(r)return p({type:be.GoToItem,focus:$.Nothing});p({type:be.GoToItem,focus:$.Specific,id:v})}),[r,v,p]),x=o.useCallback((function(){r||m||p({type:be.GoToItem,focus:$.Specific,id:v})}),[r,m,v,p]),w=o.useCallback((function(){r||m&&p({type:be.GoToItem,focus:$.Nothing})}),[r,m,p]),S=o.useMemo((function(){return{active:m,disabled:r}}),[m,r]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:ce(i,S),"aria-disabled":!0===r||void 0,onClick:b,onFocus:g,onPointerMove:x,onMouseMove:x,onPointerLeave:w,onMouseLeave:w}),S,Le)};var De=o.createContext(null);function Fe(e){var t=o.useContext(De);if(null===t){var n=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Fe),n}return t}De.displayName="GroupContext";var Pe,Me=o.Fragment;function Ae(e){var t,n,i=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=o.useContext(De),v=o.useCallback((function(){return u(!i)}),[u,i]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),h=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&v()}),[v]),y=o.useCallback((function(e){return e.preventDefault()}),[]),g=o.useMemo((function(){return{checked:i}}),[i]),x={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ce(l,g),"aria-checked":i,"aria-labelledby":null==p||null==(t=p.label)?void 0:t.id,"aria-describedby":null==p||null==(n=p.description)?void 0:n.id,onClick:m,onKeyUp:h,onKeyPress:y};return"button"===s.as&&Object.assign(x,{type:"button"}),d(a({},s,x),g,"button")}function Ne(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function je(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function Ge(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Ue(e,t,n,r,o){var i=oe(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return je.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){Ge.apply(void 0,[e].concat(n)),je.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=oe();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Pe.Finished)}),i+o[1]):t(Pe.Finished),n.add((function(){return t(Pe.Cancelled)})),n.dispose}(e,(function(n){return Ge.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return Ge.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Pe.Cancelled)})),i.dispose}function He(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Ae.Group=function(e){var t=o.useState(null),n=t[0],r=t[1],u=o.useState(null),a=u[0],c=u[1],l=o.useState(null),s=l[0],f=l[1],p=o.useMemo((function(){return{switch:n,setSwitch:r,label:a,setLabel:c,description:s,setDescription:f}}),[n,r,a,c,s,f]);return i.createElement(De.Provider,{value:p},d(e,{},Me))},Ae.Label=function e(t){var n=Fe([Ae.name,e.name].join(".")),r="headlessui-switch-label-"+E(),i=o.useCallback((function(){n.switch&&(n.switch.click(),n.switch.focus({preventScroll:!0}))}),[n.switch]);return d(a({},t,{ref:n.setLabel,id:r,onClick:i}),{},"label")},Ae.Description=function e(t){var n=Fe([Ae.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Pe||(Pe={}));var Ve,_e=o.createContext(null);_e.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Ve||(Ve={}));var Be=o.createContext(null);function Qe(e){return"children"in e?Qe(e.children):e.current.filter((function(e){return e.state===Ve.Visible})).length>0}function Ke(e){var t=o.useRef(e),r=o.useRef([]),i=function(){var e=o.useRef(!0);return o.useEffect((function(){return function(){e.current=!1}}),[]),e}();o.useEffect((function(){t.current=e}),[e]);var u=o.useCallback((function(e,o){var u;void 0===o&&(o=n.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(o,((u={})[n.Unmount]=function(){r.current.splice(a,1)},u[n.Hidden]=function(){r.current[a].state=Ve.Hidden},u)),!Qe(r)&&i.current&&(null==t.current||t.current()))}),[t,i,r]),a=o.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==Ve.Visible&&(t.state=Ve.Visible):r.current.push({id:e,state:Ve.Visible}),function(){return u(e,n.Unmount)}}),[r,u]);return o.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ye(){}Be.displayName="NestingContext";var qe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function We(e){for(var t,n={},r=s(qe);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:Ye}return n}var Je=t.RenderStrategy;function Xe(e){var t=e.beforeEnter,r=e.afterEnter,u=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,h=e.leaveFrom,b=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=o.useRef(null),w=o.useState(Ve.Visible),S=w[0],C=w[1],O=g.unmount?n.Unmount:n.Hidden,I=function(){var e=o.useContext(_e);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=I.show,R=I.appear,T=function(){var e=o.useContext(Be);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),L=T.register,D=T.unregister,F=Ne(),P=E(),M=o.useRef(!1),A=Ke((function(){M.current||(C(Ve.Hidden),D(P),_.current.afterLeave())}));y((function(){if(P)return L(P)}),[L,P]),y((function(){var e;O===n.Hidden&&P&&(k&&S!==Ve.Visible?C(Ve.Visible):f(S,((e={})[Ve.Hidden]=function(){return D(P)},e[Ve.Visible]=function(){return L(P)},e)))}),[S,P,L,D,k,O]);var N=He(s),j=He(p),G=He(v),U=He(m),H=He(h),V=He(b),_=function(e){var t=o.useRef(We(e));return o.useEffect((function(){t.current=We(e)}),[e]),t}({beforeEnter:t,afterEnter:r,beforeLeave:u,afterLeave:l});o.useEffect((function(){if(S===Ve.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,S]);var B=F&&!R;return y((function(){var e=x.current;if(e&&!B)return M.current=!0,k&&_.current.beforeEnter(),k||_.current.beforeLeave(),k?Ue(e,N,j,G,(function(e){M.current=!1,e===Pe.Finished&&_.current.afterEnter()})):Ue(e,U,H,V,(function(e){M.current=!1,e===Pe.Finished&&(Qe(A)||(C(Ve.Hidden),D(P),_.current.afterLeave()))}))}),[_,P,M,D,A,x,B,k,N,j,G,U,H,V]),i.createElement(Be.Provider,{value:A},d(a({},g,{ref:x}),{},"div",Je,S===Ve.Visible))}function $e(e){var t=e.show,n=e.appear,r=void 0!==n&&n,u=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=o.useState(t?Ve.Visible:Ve.Hidden),f=s[0],p=s[1],v=Ke((function(){p(Ve.Hidden)})),m=Ne(),h=o.useMemo((function(){return{show:t,appear:r||!m}}),[t,r,m]);o.useEffect((function(){t?p(Ve.Visible):Qe(v)||p(Ve.Hidden)}),[t,v]);var b={unmount:u};return i.createElement(Be.Provider,{value:v},i.createElement(_e.Provider,{value:h},d(a({},b,{as:o.Fragment,children:i.createElement(Xe,Object.assign({},b,l))}),{},o.Fragment,Je,f===Ve.Visible)))}$e.Child=Xe,exports.Dialog=B,exports.Disclosure=X,exports.FocusTrap=function(e){var t=o.useRef(null),n=e.initialFocus,r=c(e,["initialFocus"]);return O(t,!0,{initialFocus:n}),d(a({},r,{ref:t}),{},"div")},exports.Listbox=ve,exports.Menu=Ie,exports.Portal=M,exports.Switch=Ae,exports.Transition=$e; | ||
//# sourceMappingURL=headlessui.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,t,n){"use strict";var r,o,i,u="default"in t?t.default:t;function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,t,n,i,u){if(void 0===u&&(u=!0),u)return p(e,t,n);var l=null!=i?i:r.None;if(l&r.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,t,n)}if(l&r.RenderStrategy){var m,h=e.unmount,b=void 0===h||h,y=c(e,["unmount"]);return f(b?o.Unmount:o.Hidden,((m={})[o.Unmount]=function(){return null},m[o.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),t,n)},m))}return p(e,t,n)}function p(e,n,r){var o,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?r:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),h=void 0!==e.ref?((o={})[d]=e.ref,o):{},b="function"==typeof l?l(n):l;if(a===t.Fragment&&Object.keys(v).length>0){if(Array.isArray(b)&&b.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!t.isValidElement(b)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return t.cloneElement(b,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),b.props),h))}return t.createElement(a,Object.assign({},m(v,["ref"]),a!==t.Fragment&&h),b)}function v(e){return t.forwardRef(e)}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function h(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useCallback((function(e){n.forEach((function(t){if(null!==t)return"function"==typeof t?t(e):void(t.current=e)}))}),[n])}function b(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(i||(i={}));var y="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,g={serverHandoffComplete:!1},x=0;function w(){return++x}function E(){var e=t.useState(g.serverHandoffComplete?w:null),n=e[0],r=e[1];return y((function(){null===n&&r(w())}),[n]),t.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function C(e){e&&e.focus({preventScroll:!0})}function O(e,n,r){void 0===n&&(n=!0),void 0===r&&(r={});var o=t.useRef("undefined"!=typeof window?document.activeElement:null),u=t.useRef(null),a=t.useRef(!1),c=t.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(S)):[]}),[e]);y((function(){var t,i,l;if(n){a.current=!0;var s=document.activeElement;if(!(null==(t=e.current)?void 0:t.contains(s))){o.current=s;var f=c();if(f.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return function e(t){void 0!==t&&(C(t),document.activeElement!==t?e(f[f.indexOf(t)+1]):u.current=t)}(null!=(i=null==(l=r.initialFocus)?void 0:l.current)?i:f[0]),function(){a.current=!1,C(o.current),o.current=null,u.current=null}}}}),[n,a,r.initialFocus]),y((function(){if(n)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===i.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,n=c(),r=n.length;!function e(o){void 0===o&&(o=0);var i=n.indexOf(document.activeElement),a=n[(i+r+t+o)%r];C(a),a!==document.activeElement?e(o+t):u.current=a}()}}}),[n,c]),y((function(){if(n&&e.current){var t=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var n=u.current;if(n&&a.current){var r=e.target;r&&r instanceof HTMLElement?t.contains(r)?(u.current=r,C(r)):(e.preventDefault(),e.stopPropagation(),C(n)):C(u.current)}}}),[n,a,e])}function I(e,t){return e(t={exports:{}},t.exports),t.exports}var k=I((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,h=m&&m(m(C([])));h&&h!==t&&n.call(h,o)&&(v=h);var b=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=b.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(b),a(b,u,"Generator"),b[o]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),R=k.mark(T);function T(e){var t;return k.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),R)}var L,D,F,P=t.Fragment;function M(e){var r=t.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0];return y((function(){return function(){r&&r.childNodes.length<=1&&document.body.removeChild(r)}}),[r]),r?n.createPortal(d(e,{},P),r):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(D||(D={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(F||(F={}));var A=((L={})[F.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},L[F.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},L),N=t.createContext(null);function j(e){var n=t.useContext(N);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+H.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,j),r}return n}function G(e,t){return f(t.type,A,e,t)}N.displayName="DialogContext";var U=r.RenderStrategy|r.Static;function H(e){var n,r,o=e.open,l=e.onClose,f=e.initialFocus,p=c(e,["open","onClose","initialFocus"]),v=t.useRef(null),m=e.hasOwnProperty("open"),h=e.hasOwnProperty("onClose");if(!m)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!h)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof o)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+o);if("function"!=typeof l)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+l);var b=o?D.Open:D.Closed,g=t.useReducer(G,{titleElement:null,descriptionElement:null}),x=g[0],w=g[1],S=t.useCallback((function(){return l(!1)}),[l]),C=t.useCallback((function(e){return w({type:F.SetTitleElement,element:e})}),[w]),I=t.useCallback((function(e){return w({type:F.SetDescriptionElement,element:e})}),[w]);t.useEffect((function(){function e(e){e.key===i.Escape&&b===D.Open&&S()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[S,b]),t.useEffect((function(){if(b===D.Open){var e=window.scrollX,t=window.scrollY,n=document.documentElement.style.overflow,r=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",function(){document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=r,window.scroll(e,t)}}}),[b]);var k=!!e.static||b===D.Open;O(v,k,{initialFocus:f}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(T(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(v,k);var R="headlessui-dialog-"+E(),L=t.useMemo((function(){return[{dialogState:b,close:S,setTitle:C,setDescription:I},x]}),[b,x,S,C,I]),P=t.useMemo((function(){return{open:b===D.Open,close:S}}),[b,S]),A={ref:v,id:R,role:"dialog","aria-modal":b===D.Open||void 0,"aria-labelledby":null==(n=x.titleElement)?void 0:n.id,"aria-describedby":null==(r=x.descriptionElement)?void 0:r.id};return u.createElement(M,null,u.createElement(N.Provider,{value:L},d(a({},p,A),P,"div",U,b===D.Open)))}var V,_,B,Q=v((function e(n,r){var o=j([H.name,e.name].join("."))[0],i=o.dialogState,u=o.close,c=h(r),l="headlessui-dialog-overlay-"+E(),s=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();u()}),[u]),f=t.useMemo((function(){return{open:i===D.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")}));H.Overlay=Q,H.Title=function e(n){var r=j([H.name,e.name].join("."))[0],o=r.dialogState,i=r.setTitle,u="headlessui-dialog-title-"+E(),c=t.useMemo((function(){return{open:o===D.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"h2")},H.Description=function e(n){var r=j([H.name,e.name].join("."))[0],o=r.dialogState,i=r.setDescription,u="headlessui-dialog-description-"+E(),c=t.useMemo((function(){return{open:o===D.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"p")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(_||(_={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(B||(B={}));var K=((V={})[B.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[_.Open]=_.Closed,t[_.Closed]=_.Open,t))})},V[B.LinkPanel]=function(e){return a({},e,{linkedPanel:!0})},V[B.UnlinkPanel]=function(e){return a({},e,{linkedPanel:!1})},V[B.SetButtonId]=function(e,t){return a({},e,{buttonId:t.buttonId})},V[B.SetPanelId]=function(e,t){return a({},e,{panelId:t.panelId})},V),Y=t.createContext(null);function q(e){var n=t.useContext(Y);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+X.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,q),r}return n}function W(e,t){return f(t.type,K,e,t)}Y.displayName="DisclosureContext";var J=t.Fragment;function X(e){var n="headlessui-disclosure-button-"+E(),r="headlessui-disclosure-panel-"+E(),o=t.useReducer(W,{disclosureState:_.Closed,linkedPanel:!1,buttonId:n,panelId:r}),i=o[0].disclosureState,a=o[1];t.useEffect((function(){return a({type:B.SetButtonId,buttonId:n})}),[n,a]),t.useEffect((function(){return a({type:B.SetPanelId,panelId:r})}),[r,a]);var c=t.useMemo((function(){return{open:i===_.Open}}),[i]);return u.createElement(Y.Provider,{value:o},d(e,c,J))}var $,z,Z,ee,te=v((function e(n,r){var o=q([X.name,e.name].join(".")),u=o[0],c=o[1],l=h(r),s=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:B.ToggleDisclosure})}}),[c]),f=t.useCallback((function(e){b(e.currentTarget)||n.disabled||c({type:B.ToggleDisclosure})}),[c,n.disabled]),p=t.useMemo((function(){return{open:u.disclosureState===_.Open}}),[u]);return d(a({},n,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===_.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ne=r.RenderStrategy|r.Static,re=v((function e(n,r){var o=q([X.name,e.name].join(".")),i=o[0],c=o[1],l=h(r,(function(){i.linkedPanel||c({type:B.LinkPanel})}));t.useEffect((function(){return function(){return c({type:B.UnlinkPanel})}}),[c]),u.useEffect((function(){var e;i.disclosureState!==_.Closed||null!=(e=n.unmount)&&!e||c({type:B.UnlinkPanel})}),[i.disclosureState,n.unmount,c]);var s=u.useMemo((function(){return{open:i.disclosureState===_.Open}}),[i]);return d(a({},n,{ref:l,id:i.panelId}),s,"div",ne,i.disclosureState===_.Open)}));function oe(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function ie(){var e=t.useState(oe)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function ue(e,n){var r=t.useState(e),o=r[0],i=r[1],u=t.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(n)),o}function ae(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case $.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case $.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case $.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case $.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case $.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case $.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function ce(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}X.Button=te,X.Panel=re,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}($||($={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Z||(Z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ee||(ee={}));var le=((z={})[ee.CloseListbox]=function(e){return e.disabled||e.listboxState===Z.Closed?e:a({},e,{activeOptionIndex:null,listboxState:Z.Closed})},z[ee.OpenListbox]=function(e){return e.disabled||e.listboxState===Z.Open?e:a({},e,{listboxState:Z.Open})},z[ee.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},z[ee.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=ae(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},z[ee.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},z[ee.ClearSearch]=function(e){return e.disabled||e.listboxState===Z.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},z[ee.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},z[ee.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},z),se=t.createContext(null);function fe(e){var n=t.useContext(se);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+ve.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,fe),r}return n}function de(e,t){return f(t.type,le,e,t)}se.displayName="ListboxContext";var pe=t.Fragment;function ve(e){var n=e.value,r=e.onChange,o=e.disabled,i=void 0!==o&&o,a=c(e,["value","onChange","disabled"]),l=ie(),s=t.useReducer(de,{listboxState:Z.Closed,propsRef:{current:{value:n,onChange:r}},labelRef:t.createRef(),buttonRef:t.createRef(),optionsRef:t.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),f=s[0],p=f.listboxState,v=f.propsRef,m=f.optionsRef,h=f.buttonRef,b=s[1];y((function(){v.current.value=n}),[n,v]),y((function(){v.current.onChange=r}),[r,v]),y((function(){return b({type:ee.SetDisabled,disabled:i})}),[i]),t.useEffect((function(){function e(e){var t,n,r,o=e.target,i=document.activeElement;p===Z.Open&&((null==(t=h.current)?void 0:t.contains(o))||((null==(n=m.current)?void 0:n.contains(o))||b({type:ee.CloseListbox}),i!==document.body&&(null==i?void 0:i.contains(o))||e.defaultPrevented||null==(r=h.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[p,m,h,l,b]);var g=t.useMemo((function(){return{open:p===Z.Open,disabled:i}}),[p,i]);return u.createElement(se.Provider,{value:s},d(a,g,pe))}var me,he,be,ye=v((function e(n,r){var o,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,r),f="headlessui-listbox-button-"+E(),p=ie(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();c.listboxState===Z.Open?(l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=ue((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=t.useMemo((function(){return{open:c.listboxState===Z.Open,disabled:c.disabled}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.optionsRef.current)?void 0:o.id,"aria-expanded":c.listboxState===Z.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),ge=r.RenderStrategy|r.Static,xe=v((function e(n,r){var o,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.optionsRef,r),f="headlessui-listbox-options-"+E(),p=ie(),v=ie(),m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ee.Search,value:e.key});case i.Enter:e.preventDefault(),l({type:ee.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),oe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Next});case i.ArrowUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Previous});case i.Home:case i.PageUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.First});case i.End:case i.PageDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Last});case i.Escape:return e.preventDefault(),l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case i.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ee.Search,value:e.key}),v.setTimeout((function(){return l({type:ee.ClearSearch})}),350))}}),[p,l,v,c]),b=ue((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=t.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return d(a({},n,{"aria-activedescendant":null===c.activeOptionIndex||null==(o=c.options[c.activeOptionIndex])?void 0:o.id,"aria-labelledby":b,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",ge,c.listboxState===Z.Open)}));ve.Button=ye,ve.Label=function e(n){var r=fe([ve.name,e.name].join("."))[0],o="headlessui-listbox-label-"+E(),i=t.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),u=t.useMemo((function(){return{open:r.listboxState===Z.Open,disabled:r.disabled}}),[r]);return d(a({},n,{ref:r.labelRef,id:o,onClick:i}),u,"label")},ve.Options=xe,ve.Option=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.value,u=n.className,l=c(n,["disabled","value","className"]),s=fe([ve.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,h=f.propsRef.current.value===i,b=t.useRef({disabled:o,value:i});y((function(){b.current.disabled=o}),[b,o]),y((function(){b.current.value=i}),[b,i]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]);var g=t.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ee.RegisterOption,id:v,dataRef:b}),function(){return p({type:ee.UnregisterOption,id:v})}}),[b,v]),y((function(){var e;f.listboxState===Z.Open&&h&&(p({type:ee.GoToOption,focus:$.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===Z.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var x=t.useCallback((function(e){if(o)return e.preventDefault();g(),p({type:ee.CloseListbox}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,o,g]),w=t.useCallback((function(){if(o)return p({type:ee.GoToOption,focus:$.Nothing});p({type:ee.GoToOption,focus:$.Specific,id:v})}),[o,v,p]),S=t.useCallback((function(){o||m||p({type:ee.GoToOption,focus:$.Specific,id:v})}),[o,m,v,p]),C=t.useCallback((function(){o||m&&p({type:ee.GoToOption,focus:$.Nothing})}),[o,m,p]),O=t.useMemo((function(){return{active:m,selected:h,disabled:o}}),[m,h,o]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:ce(u,O),"aria-disabled":!0===o||void 0,"aria-selected":!0===h||void 0,onClick:x,onFocus:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(he||(he={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(be||(be={}));var we=((me={})[be.CloseMenu]=function(e){return a({},e,{activeItemIndex:null,menuState:he.Closed})},me[be.OpenMenu]=function(e){return a({},e,{menuState:he.Open})},me[be.GoToItem]=function(e,t){var n=ae(t,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},me[be.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},me[be.ClearSearch]=function(e){return a({},e,{searchQuery:""})},me[be.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},me[be.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},me),Ee=t.createContext(null);function Se(e){var n=t.useContext(Ee);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+Ie.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Se),r}return n}function Ce(e,t){return f(t.type,we,e,t)}Ee.displayName="MenuContext";var Oe=t.Fragment;function Ie(e){var n=t.useReducer(Ce,{menuState:he.Closed,buttonRef:t.createRef(),itemsRef:t.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=n[0],o=r.menuState,i=r.itemsRef,a=r.buttonRef,c=n[1];t.useEffect((function(){function e(e){var t,n,r,u=e.target,l=document.activeElement;o===he.Open&&((null==(t=a.current)?void 0:t.contains(u))||((null==(n=i.current)?void 0:n.contains(u))||c({type:be.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(u))||e.defaultPrevented||null==(r=a.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[o,i,a,c]);var l=t.useMemo((function(){return{open:o===he.Open}}),[o]);return u.createElement(Ee.Provider,{value:n},d(e,l,Oe))}var ke=v((function e(n,r){var o,u=Se([Ie.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,r),f="headlessui-menu-button-"+E(),p=ie(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();n.disabled||(c.menuState===he.Open?(l({type:be.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),y=t.useMemo((function(){return{open:c.menuState===he.Open}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.itemsRef.current)?void 0:o.id,"aria-expanded":c.menuState===he.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Re=r.RenderStrategy|r.Static,Te=v((function e(n,r){var o,u,c=Se([Ie.name,e.name].join(".")),l=c[0],s=c[1],f=h(l.itemsRef,r),p="headlessui-menu-items-"+E(),v=ie();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===he.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:be.Search,value:e.key});case i.Enter:var t;e.preventDefault(),s({type:be.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Next});case i.ArrowUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.Previous});case i.Home:case i.PageUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.First});case i.End:case i.PageDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Last});case i.Escape:e.preventDefault(),s({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:be.Search,value:e.key}),v.setTimeout((function(){return s({type:be.ClearSearch})}),350))}}),[s,v,l]),b=t.useMemo((function(){return{open:l.menuState===he.Open}}),[l]);return d(a({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(o=l.items[l.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),b,"div",Re,l.menuState===he.Open)})),Le=t.Fragment;Ie.Button=ke,Ie.Items=Te,Ie.Item=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.className,u=n.onClick,l=c(n,["disabled","className","onClick"]),s=Se([Ie.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===he.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var h=t.useRef({disabled:o});y((function(){h.current.disabled=o}),[h,o]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]),y((function(){return p({type:be.RegisterItem,id:v,dataRef:h}),function(){return p({type:be.UnregisterItem,id:v})}}),[h,v]);var b=t.useCallback((function(e){return o?e.preventDefault():(p({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,o,u]),g=t.useCallback((function(){if(o)return p({type:be.GoToItem,focus:$.Nothing});p({type:be.GoToItem,focus:$.Specific,id:v})}),[o,v,p]),x=t.useCallback((function(){o||m||p({type:be.GoToItem,focus:$.Specific,id:v})}),[o,m,v,p]),w=t.useCallback((function(){o||m&&p({type:be.GoToItem,focus:$.Nothing})}),[o,m,p]),S=t.useMemo((function(){return{active:m,disabled:o}}),[m,o]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:ce(i,S),"aria-disabled":!0===o||void 0,onClick:b,onFocus:g,onPointerMove:x,onMouseMove:x,onPointerLeave:w,onMouseLeave:w}),S,Le)};var De=t.createContext(null);function Fe(e){var n=t.useContext(De);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Fe),r}return n}De.displayName="GroupContext";var Pe,Me=t.Fragment;function Ae(e){var n,r,o=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=t.useContext(De),v=t.useCallback((function(){return u(!o)}),[u,o]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),h=t.useCallback((function(e){e.key!==i.Tab&&e.preventDefault(),e.key===i.Space&&v()}),[v]),y=t.useCallback((function(e){return e.preventDefault()}),[]),g=t.useMemo((function(){return{checked:o}}),[o]),x={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ce(l,g),"aria-checked":o,"aria-labelledby":null==p||null==(n=p.label)?void 0:n.id,"aria-describedby":null==p||null==(r=p.description)?void 0:r.id,onClick:m,onKeyUp:h,onKeyPress:y};return"button"===s.as&&Object.assign(x,{type:"button"}),d(a({},s,x),g,"button")}function Ne(){var e=t.useRef(!0);return t.useEffect((function(){e.current=!1}),[]),e.current}function je(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function Ge(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Ue(e,t,n,r,o){var i=oe(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return je.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){Ge.apply(void 0,[e].concat(n)),je.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=oe();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Pe.Finished)}),i+o[1]):t(Pe.Finished),n.add((function(){return t(Pe.Cancelled)})),n.dispose}(e,(function(n){return Ge.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return Ge.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Pe.Cancelled)})),i.dispose}function He(e){return void 0===e&&(e=""),t.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Ae.Group=function(e){var n=t.useState(null),r=n[0],o=n[1],i=t.useState(null),a=i[0],c=i[1],l=t.useState(null),s=l[0],f=l[1],p=t.useMemo((function(){return{switch:r,setSwitch:o,label:a,setLabel:c,description:s,setDescription:f}}),[r,o,a,c,s,f]);return u.createElement(De.Provider,{value:p},d(e,{},Me))},Ae.Label=function e(n){var r=Fe([Ae.name,e.name].join(".")),o="headlessui-switch-label-"+E(),i=t.useCallback((function(){r.switch&&(r.switch.click(),r.switch.focus({preventScroll:!0}))}),[r.switch]);return d(a({},n,{ref:r.setLabel,id:o,onClick:i}),{},"label")},Ae.Description=function e(t){var n=Fe([Ae.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Pe||(Pe={}));var Ve,_e=t.createContext(null);_e.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Ve||(Ve={}));var Be=t.createContext(null);function Qe(e){return"children"in e?Qe(e.children):e.current.filter((function(e){return e.state===Ve.Visible})).length>0}function Ke(e){var n=t.useRef(e),r=t.useRef([]),i=function(){var e=t.useRef(!0);return t.useEffect((function(){return function(){e.current=!1}}),[]),e}();t.useEffect((function(){n.current=e}),[e]);var u=t.useCallback((function(e,t){var u;void 0===t&&(t=o.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(t,((u={})[o.Unmount]=function(){r.current.splice(a,1)},u[o.Hidden]=function(){r.current[a].state=Ve.Hidden},u)),!Qe(r)&&i.current&&(null==n.current||n.current()))}),[n,i,r]),a=t.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==Ve.Visible&&(t.state=Ve.Visible):r.current.push({id:e,state:Ve.Visible}),function(){return u(e,o.Unmount)}}),[r,u]);return t.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ye(){}Be.displayName="NestingContext";var qe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function We(e){for(var t,n={},r=s(qe);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:Ye}return n}var Je=r.RenderStrategy;function Xe(e){var n=e.beforeEnter,r=e.afterEnter,i=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,h=e.leaveFrom,b=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=t.useRef(null),w=t.useState(Ve.Visible),S=w[0],C=w[1],O=g.unmount?o.Unmount:o.Hidden,I=function(){var e=t.useContext(_e);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=I.show,R=I.appear,T=function(){var e=t.useContext(Be);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),L=T.register,D=T.unregister,F=Ne(),P=E(),M=t.useRef(!1),A=Ke((function(){M.current||(C(Ve.Hidden),D(P),_.current.afterLeave())}));y((function(){if(P)return L(P)}),[L,P]),y((function(){var e;O===o.Hidden&&P&&(k&&S!==Ve.Visible?C(Ve.Visible):f(S,((e={})[Ve.Hidden]=function(){return D(P)},e[Ve.Visible]=function(){return L(P)},e)))}),[S,P,L,D,k,O]);var N=He(s),j=He(p),G=He(v),U=He(m),H=He(h),V=He(b),_=function(e){var n=t.useRef(We(e));return t.useEffect((function(){n.current=We(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:i,afterLeave:l});t.useEffect((function(){if(S===Ve.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,S]);var B=F&&!R;return y((function(){var e=x.current;if(e&&!B)return M.current=!0,k&&_.current.beforeEnter(),k||_.current.beforeLeave(),k?Ue(e,N,j,G,(function(e){M.current=!1,e===Pe.Finished&&_.current.afterEnter()})):Ue(e,U,H,V,(function(e){M.current=!1,e===Pe.Finished&&(Qe(A)||(C(Ve.Hidden),D(P),_.current.afterLeave()))}))}),[_,P,M,D,A,x,B,k,N,j,G,U,H,V]),u.createElement(Be.Provider,{value:A},d(a({},g,{ref:x}),{},"div",Je,S===Ve.Visible))}function $e(e){var n=e.show,r=e.appear,o=void 0!==r&&r,i=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=t.useState(n?Ve.Visible:Ve.Hidden),f=s[0],p=s[1],v=Ke((function(){p(Ve.Hidden)})),m=Ne(),h=t.useMemo((function(){return{show:n,appear:o||!m}}),[n,o,m]);t.useEffect((function(){n?p(Ve.Visible):Qe(v)||p(Ve.Hidden)}),[n,v]);var b={unmount:i};return u.createElement(Be.Provider,{value:v},u.createElement(_e.Provider,{value:h},d(a({},b,{as:t.Fragment,children:u.createElement(Xe,Object.assign({},b,l))}),{},t.Fragment,Je,f===Ve.Visible)))}$e.Child=Xe,e.Dialog=H,e.Disclosure=X,e.FocusTrap=function(e){var n=t.useRef(null),r=e.initialFocus,o=c(e,["initialFocus"]);return O(n,!0,{initialFocus:r}),d(a({},o,{ref:n}),{},"div")},e.Listbox=ve,e.Menu=Ie,e.Portal=M,e.Switch=Ae,e.Transition=$e,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,t,n){"use strict";var r,o,i,u="default"in t?t.default:t;function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,t,n,i,u){if(void 0===u&&(u=!0),u)return p(e,t,n);var l=null!=i?i:r.None;if(l&r.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,t,n)}if(l&r.RenderStrategy){var m,h=e.unmount,b=void 0===h||h,y=c(e,["unmount"]);return f(b?o.Unmount:o.Hidden,((m={})[o.Unmount]=function(){return null},m[o.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),t,n)},m))}return p(e,t,n)}function p(e,n,r){var o,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?r:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),h=void 0!==e.ref?((o={})[d]=e.ref,o):{},b="function"==typeof l?l(n):l;if(a===t.Fragment&&Object.keys(v).length>0){if(Array.isArray(b)&&b.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!t.isValidElement(b)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return t.cloneElement(b,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),b.props),h))}return t.createElement(a,Object.assign({},m(v,["ref"]),a!==t.Fragment&&h),b)}function v(e){return t.forwardRef(e)}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function h(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useCallback((function(e){n.forEach((function(t){if(null!==t)return"function"==typeof t?t(e):void(t.current=e)}))}),[n])}function b(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(i||(i={}));var y="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,g={serverHandoffComplete:!1},x=0;function w(){return++x}function E(){var e=t.useState(g.serverHandoffComplete?w:null),n=e[0],r=e[1];return y((function(){null===n&&r(w())}),[n]),t.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function C(e){e&&e.focus({preventScroll:!0})}function O(e,n,r){void 0===n&&(n=!0),void 0===r&&(r={});var o=t.useRef("undefined"!=typeof window?document.activeElement:null),u=t.useRef(null),a=t.useRef(!1),c=t.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(S)):[]}),[e]);y((function(){var t,i,l,s;if(n){a.current=!0;var f,d=document.activeElement;if(null==(t=r.initialFocus)?void 0:t.current){if((null==(f=r.initialFocus)?void 0:f.current)===d)return}else if(null==(i=e.current)?void 0:i.contains(d))return;o.current=d;var p=c();if(p.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return function e(t){void 0!==t&&(C(t),document.activeElement!==t?e(p[p.indexOf(t)+1]):u.current=t)}(null!=(l=null==(s=r.initialFocus)?void 0:s.current)?l:p[0]),function(){a.current=!1,C(o.current),o.current=null,u.current=null}}}),[n,a,r.initialFocus]),y((function(){if(n)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===i.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,n=c(),r=n.length;!function e(o){void 0===o&&(o=0);var i=n.indexOf(document.activeElement),a=n[(i+r+t+o)%r];C(a),a!==document.activeElement?e(o+t):u.current=a}()}}}),[n,c]),y((function(){if(n&&e.current){var t=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var n=u.current;if(n&&a.current){var r=e.target;r&&r instanceof HTMLElement?t.contains(r)?(u.current=r,C(r)):(e.preventDefault(),e.stopPropagation(),C(n)):C(u.current)}}}),[n,a,e])}function I(e,t){return e(t={exports:{}},t.exports),t.exports}var k=I((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,h=m&&m(m(C([])));h&&h!==t&&n.call(h,o)&&(v=h);var b=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=b.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(b),a(b,u,"Generator"),b[o]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),R=k.mark(T);function T(e){var t;return k.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),R)}var L,D,F,P=t.Fragment;function M(e){var r=t.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0];return y((function(){return function(){r&&r.childNodes.length<=1&&document.body.removeChild(r)}}),[r]),r?n.createPortal(d(e,{},P),r):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(D||(D={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(F||(F={}));var A=((L={})[F.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},L[F.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},L),N=t.createContext(null);function j(e){var n=t.useContext(N);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+B.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,j),r}return n}function G(e,t){return f(t.type,A,e,t)}N.displayName="DialogContext";var U,H,V,_=r.RenderStrategy|r.Static,B=v((function(e,n){var r,o,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=t.useRef(null),b=h(m,n),g=e.hasOwnProperty("open"),x=e.hasOwnProperty("onClose");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!x)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var w=l?D.Open:D.Closed,S=t.useReducer(G,{titleElement:null,descriptionElement:null}),C=S[0],I=S[1],k=t.useCallback((function(){return f(!1)}),[f]),R=t.useCallback((function(e){return I({type:F.SetTitleElement,element:e})}),[I]),L=t.useCallback((function(e){return I({type:F.SetDescriptionElement,element:e})}),[I]);t.useEffect((function(){function e(e){e.key===i.Escape&&w===D.Open&&k()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[k,w]),t.useEffect((function(){if(w===D.Open){var e=window.scrollX,t=window.scrollY,n=document.documentElement.style.overflow,r=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",function(){document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=r,window.scroll(e,t)}}}),[w]);var P=!!e.static||w===D.Open;O(m,P,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(T(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,P);var A="headlessui-dialog-"+E(),j=t.useMemo((function(){return[{dialogState:w,close:k,setTitle:R,setDescription:L},C]}),[w,C,k,R,L]),U=t.useMemo((function(){return{open:w===D.Open,close:k}}),[w,k]),H={ref:b,id:A,role:"dialog","aria-modal":w===D.Open||void 0,"aria-labelledby":null==(r=C.titleElement)?void 0:r.id,"aria-describedby":null==(o=C.descriptionElement)?void 0:o.id};return u.createElement(M,null,u.createElement(N.Provider,{value:j},d(a({},v,H),U,"div",_,w===D.Open)))})),Q=v((function e(n,r){var o=j([B.name,e.name].join("."))[0],i=o.dialogState,u=o.close,c=h(r),l="headlessui-dialog-overlay-"+E(),s=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();u()}),[u]),f=t.useMemo((function(){return{open:i===D.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")}));Object.assign(B,{name:"Dialog",Overlay:Q,Title:function e(n){var r=j([B.name,e.name].join("."))[0],o=r.dialogState,i=r.setTitle,u="headlessui-dialog-title-"+E(),c=t.useMemo((function(){return{open:o===D.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"h2")},Description:function e(n){var r=j([B.name,e.name].join("."))[0],o=r.dialogState,i=r.setDescription,u="headlessui-dialog-description-"+E(),c=t.useMemo((function(){return{open:o===D.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"p")}}),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(H||(H={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(V||(V={}));var K=((U={})[V.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[H.Open]=H.Closed,t[H.Closed]=H.Open,t))})},U[V.LinkPanel]=function(e){return a({},e,{linkedPanel:!0})},U[V.UnlinkPanel]=function(e){return a({},e,{linkedPanel:!1})},U[V.SetButtonId]=function(e,t){return a({},e,{buttonId:t.buttonId})},U[V.SetPanelId]=function(e,t){return a({},e,{panelId:t.panelId})},U),Y=t.createContext(null);function q(e){var n=t.useContext(Y);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+X.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,q),r}return n}function W(e,t){return f(t.type,K,e,t)}Y.displayName="DisclosureContext";var J=t.Fragment;function X(e){var n="headlessui-disclosure-button-"+E(),r="headlessui-disclosure-panel-"+E(),o=t.useReducer(W,{disclosureState:H.Closed,linkedPanel:!1,buttonId:n,panelId:r}),i=o[0].disclosureState,a=o[1];t.useEffect((function(){return a({type:V.SetButtonId,buttonId:n})}),[n,a]),t.useEffect((function(){return a({type:V.SetPanelId,panelId:r})}),[r,a]);var c=t.useMemo((function(){return{open:i===H.Open}}),[i]);return u.createElement(Y.Provider,{value:o},d(e,c,J))}var $,z,Z,ee,te=v((function e(n,r){var o=q([X.name,e.name].join(".")),u=o[0],c=o[1],l=h(r),s=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:V.ToggleDisclosure})}}),[c]),f=t.useCallback((function(e){b(e.currentTarget)||n.disabled||c({type:V.ToggleDisclosure})}),[c,n.disabled]),p=t.useMemo((function(){return{open:u.disclosureState===H.Open}}),[u]);return d(a({},n,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===H.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ne=r.RenderStrategy|r.Static,re=v((function e(n,r){var o=q([X.name,e.name].join(".")),i=o[0],c=o[1],l=h(r,(function(){i.linkedPanel||c({type:V.LinkPanel})}));t.useEffect((function(){return function(){return c({type:V.UnlinkPanel})}}),[c]),u.useEffect((function(){var e;i.disclosureState!==H.Closed||null!=(e=n.unmount)&&!e||c({type:V.UnlinkPanel})}),[i.disclosureState,n.unmount,c]);var s=u.useMemo((function(){return{open:i.disclosureState===H.Open}}),[i]);return d(a({},n,{ref:l,id:i.panelId}),s,"div",ne,i.disclosureState===H.Open)}));function oe(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function ie(){var e=t.useState(oe)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function ue(e,n){var r=t.useState(e),o=r[0],i=r[1],u=t.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(n)),o}function ae(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case $.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case $.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case $.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case $.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case $.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case $.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function ce(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}X.Button=te,X.Panel=re,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}($||($={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Z||(Z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ee||(ee={}));var le=((z={})[ee.CloseListbox]=function(e){return e.disabled||e.listboxState===Z.Closed?e:a({},e,{activeOptionIndex:null,listboxState:Z.Closed})},z[ee.OpenListbox]=function(e){return e.disabled||e.listboxState===Z.Open?e:a({},e,{listboxState:Z.Open})},z[ee.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},z[ee.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=ae(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},z[ee.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===Z.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},z[ee.ClearSearch]=function(e){return e.disabled||e.listboxState===Z.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},z[ee.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},z[ee.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},z),se=t.createContext(null);function fe(e){var n=t.useContext(se);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+ve.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,fe),r}return n}function de(e,t){return f(t.type,le,e,t)}se.displayName="ListboxContext";var pe=t.Fragment;function ve(e){var n=e.value,r=e.onChange,o=e.disabled,i=void 0!==o&&o,a=c(e,["value","onChange","disabled"]),l=ie(),s=t.useReducer(de,{listboxState:Z.Closed,propsRef:{current:{value:n,onChange:r}},labelRef:t.createRef(),buttonRef:t.createRef(),optionsRef:t.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),f=s[0],p=f.listboxState,v=f.propsRef,m=f.optionsRef,h=f.buttonRef,b=s[1];y((function(){v.current.value=n}),[n,v]),y((function(){v.current.onChange=r}),[r,v]),y((function(){return b({type:ee.SetDisabled,disabled:i})}),[i]),t.useEffect((function(){function e(e){var t,n,r,o=e.target,i=document.activeElement;p===Z.Open&&((null==(t=h.current)?void 0:t.contains(o))||((null==(n=m.current)?void 0:n.contains(o))||b({type:ee.CloseListbox}),i!==document.body&&(null==i?void 0:i.contains(o))||e.defaultPrevented||null==(r=h.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[p,m,h,l,b]);var g=t.useMemo((function(){return{open:p===Z.Open,disabled:i}}),[p,i]);return u.createElement(se.Provider,{value:s},d(a,g,pe))}var me,he,be,ye=v((function e(n,r){var o,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,r),f="headlessui-listbox-button-"+E(),p=ie(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:$.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();c.listboxState===Z.Open?(l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=ue((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=t.useMemo((function(){return{open:c.listboxState===Z.Open,disabled:c.disabled}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.optionsRef.current)?void 0:o.id,"aria-expanded":c.listboxState===Z.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),ge=r.RenderStrategy|r.Static,xe=v((function e(n,r){var o,u=fe([ve.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.optionsRef,r),f="headlessui-listbox-options-"+E(),p=ie(),v=ie(),m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ee.Search,value:e.key});case i.Enter:e.preventDefault(),l({type:ee.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),oe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Next});case i.ArrowUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Previous});case i.Home:case i.PageUp:return e.preventDefault(),l({type:ee.GoToOption,focus:$.First});case i.End:case i.PageDown:return e.preventDefault(),l({type:ee.GoToOption,focus:$.Last});case i.Escape:return e.preventDefault(),l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case i.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ee.Search,value:e.key}),v.setTimeout((function(){return l({type:ee.ClearSearch})}),350))}}),[p,l,v,c]),b=ue((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=t.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return d(a({},n,{"aria-activedescendant":null===c.activeOptionIndex||null==(o=c.options[c.activeOptionIndex])?void 0:o.id,"aria-labelledby":b,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",ge,c.listboxState===Z.Open)}));ve.Button=ye,ve.Label=function e(n){var r=fe([ve.name,e.name].join("."))[0],o="headlessui-listbox-label-"+E(),i=t.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),u=t.useMemo((function(){return{open:r.listboxState===Z.Open,disabled:r.disabled}}),[r]);return d(a({},n,{ref:r.labelRef,id:o,onClick:i}),u,"label")},ve.Options=xe,ve.Option=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.value,u=n.className,l=c(n,["disabled","value","className"]),s=fe([ve.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,h=f.propsRef.current.value===i,b=t.useRef({disabled:o,value:i});y((function(){b.current.disabled=o}),[b,o]),y((function(){b.current.value=i}),[b,i]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]);var g=t.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ee.RegisterOption,id:v,dataRef:b}),function(){return p({type:ee.UnregisterOption,id:v})}}),[b,v]),y((function(){var e;f.listboxState===Z.Open&&h&&(p({type:ee.GoToOption,focus:$.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===Z.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var x=t.useCallback((function(e){if(o)return e.preventDefault();g(),p({type:ee.CloseListbox}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,o,g]),w=t.useCallback((function(){if(o)return p({type:ee.GoToOption,focus:$.Nothing});p({type:ee.GoToOption,focus:$.Specific,id:v})}),[o,v,p]),S=t.useCallback((function(){o||m||p({type:ee.GoToOption,focus:$.Specific,id:v})}),[o,m,v,p]),C=t.useCallback((function(){o||m&&p({type:ee.GoToOption,focus:$.Nothing})}),[o,m,p]),O=t.useMemo((function(){return{active:m,selected:h,disabled:o}}),[m,h,o]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:ce(u,O),"aria-disabled":!0===o||void 0,"aria-selected":!0===h||void 0,onClick:x,onFocus:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(he||(he={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(be||(be={}));var we=((me={})[be.CloseMenu]=function(e){return a({},e,{activeItemIndex:null,menuState:he.Closed})},me[be.OpenMenu]=function(e){return a({},e,{menuState:he.Open})},me[be.GoToItem]=function(e,t){var n=ae(t,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},me[be.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},me[be.ClearSearch]=function(e){return a({},e,{searchQuery:""})},me[be.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},me[be.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},me),Ee=t.createContext(null);function Se(e){var n=t.useContext(Ee);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+Ie.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Se),r}return n}function Ce(e,t){return f(t.type,we,e,t)}Ee.displayName="MenuContext";var Oe=t.Fragment;function Ie(e){var n=t.useReducer(Ce,{menuState:he.Closed,buttonRef:t.createRef(),itemsRef:t.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=n[0],o=r.menuState,i=r.itemsRef,a=r.buttonRef,c=n[1];t.useEffect((function(){function e(e){var t,n,r,u=e.target,l=document.activeElement;o===he.Open&&((null==(t=a.current)?void 0:t.contains(u))||((null==(n=i.current)?void 0:n.contains(u))||c({type:be.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(u))||e.defaultPrevented||null==(r=a.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[o,i,a,c]);var l=t.useMemo((function(){return{open:o===he.Open}}),[o]);return u.createElement(Ee.Provider,{value:n},d(e,l,Oe))}var ke=v((function e(n,r){var o,u=Se([Ie.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,r),f="headlessui-menu-button-"+E(),p=ie(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:be.GoToItem,focus:$.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();n.disabled||(c.menuState===he.Open?(l({type:be.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:be.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),y=t.useMemo((function(){return{open:c.menuState===he.Open}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.itemsRef.current)?void 0:o.id,"aria-expanded":c.menuState===he.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Re=r.RenderStrategy|r.Static,Te=v((function e(n,r){var o,u,c=Se([Ie.name,e.name].join(".")),l=c[0],s=c[1],f=h(l.itemsRef,r),p="headlessui-menu-items-"+E(),v=ie();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===he.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:be.Search,value:e.key});case i.Enter:var t;e.preventDefault(),s({type:be.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Next});case i.ArrowUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.Previous});case i.Home:case i.PageUp:return e.preventDefault(),s({type:be.GoToItem,focus:$.First});case i.End:case i.PageDown:return e.preventDefault(),s({type:be.GoToItem,focus:$.Last});case i.Escape:e.preventDefault(),s({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:be.Search,value:e.key}),v.setTimeout((function(){return s({type:be.ClearSearch})}),350))}}),[s,v,l]),b=t.useMemo((function(){return{open:l.menuState===he.Open}}),[l]);return d(a({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(o=l.items[l.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),b,"div",Re,l.menuState===he.Open)})),Le=t.Fragment;Ie.Button=ke,Ie.Items=Te,Ie.Item=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.className,u=n.onClick,l=c(n,["disabled","className","onClick"]),s=Se([Ie.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===he.Open&&m){var e=oe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var h=t.useRef({disabled:o});y((function(){h.current.disabled=o}),[h,o]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]),y((function(){return p({type:be.RegisterItem,id:v,dataRef:h}),function(){return p({type:be.UnregisterItem,id:v})}}),[h,v]);var b=t.useCallback((function(e){return o?e.preventDefault():(p({type:be.CloseMenu}),oe().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,o,u]),g=t.useCallback((function(){if(o)return p({type:be.GoToItem,focus:$.Nothing});p({type:be.GoToItem,focus:$.Specific,id:v})}),[o,v,p]),x=t.useCallback((function(){o||m||p({type:be.GoToItem,focus:$.Specific,id:v})}),[o,m,v,p]),w=t.useCallback((function(){o||m&&p({type:be.GoToItem,focus:$.Nothing})}),[o,m,p]),S=t.useMemo((function(){return{active:m,disabled:o}}),[m,o]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:ce(i,S),"aria-disabled":!0===o||void 0,onClick:b,onFocus:g,onPointerMove:x,onMouseMove:x,onPointerLeave:w,onMouseLeave:w}),S,Le)};var De=t.createContext(null);function Fe(e){var n=t.useContext(De);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Fe),r}return n}De.displayName="GroupContext";var Pe,Me=t.Fragment;function Ae(e){var n,r,o=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=t.useContext(De),v=t.useCallback((function(){return u(!o)}),[u,o]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),h=t.useCallback((function(e){e.key!==i.Tab&&e.preventDefault(),e.key===i.Space&&v()}),[v]),y=t.useCallback((function(e){return e.preventDefault()}),[]),g=t.useMemo((function(){return{checked:o}}),[o]),x={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ce(l,g),"aria-checked":o,"aria-labelledby":null==p||null==(n=p.label)?void 0:n.id,"aria-describedby":null==p||null==(r=p.description)?void 0:r.id,onClick:m,onKeyUp:h,onKeyPress:y};return"button"===s.as&&Object.assign(x,{type:"button"}),d(a({},s,x),g,"button")}function Ne(){var e=t.useRef(!0);return t.useEffect((function(){e.current=!1}),[]),e.current}function je(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function Ge(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Ue(e,t,n,r,o){var i=oe(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return je.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){Ge.apply(void 0,[e].concat(n)),je.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=oe();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Pe.Finished)}),i+o[1]):t(Pe.Finished),n.add((function(){return t(Pe.Cancelled)})),n.dispose}(e,(function(n){return Ge.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return Ge.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Pe.Cancelled)})),i.dispose}function He(e){return void 0===e&&(e=""),t.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Ae.Group=function(e){var n=t.useState(null),r=n[0],o=n[1],i=t.useState(null),a=i[0],c=i[1],l=t.useState(null),s=l[0],f=l[1],p=t.useMemo((function(){return{switch:r,setSwitch:o,label:a,setLabel:c,description:s,setDescription:f}}),[r,o,a,c,s,f]);return u.createElement(De.Provider,{value:p},d(e,{},Me))},Ae.Label=function e(n){var r=Fe([Ae.name,e.name].join(".")),o="headlessui-switch-label-"+E(),i=t.useCallback((function(){r.switch&&(r.switch.click(),r.switch.focus({preventScroll:!0}))}),[r.switch]);return d(a({},n,{ref:r.setLabel,id:o,onClick:i}),{},"label")},Ae.Description=function e(t){var n=Fe([Ae.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Pe||(Pe={}));var Ve,_e=t.createContext(null);_e.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Ve||(Ve={}));var Be=t.createContext(null);function Qe(e){return"children"in e?Qe(e.children):e.current.filter((function(e){return e.state===Ve.Visible})).length>0}function Ke(e){var n=t.useRef(e),r=t.useRef([]),i=function(){var e=t.useRef(!0);return t.useEffect((function(){return function(){e.current=!1}}),[]),e}();t.useEffect((function(){n.current=e}),[e]);var u=t.useCallback((function(e,t){var u;void 0===t&&(t=o.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(t,((u={})[o.Unmount]=function(){r.current.splice(a,1)},u[o.Hidden]=function(){r.current[a].state=Ve.Hidden},u)),!Qe(r)&&i.current&&(null==n.current||n.current()))}),[n,i,r]),a=t.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==Ve.Visible&&(t.state=Ve.Visible):r.current.push({id:e,state:Ve.Visible}),function(){return u(e,o.Unmount)}}),[r,u]);return t.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ye(){}Be.displayName="NestingContext";var qe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function We(e){for(var t,n={},r=s(qe);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:Ye}return n}var Je=r.RenderStrategy;function Xe(e){var n=e.beforeEnter,r=e.afterEnter,i=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,h=e.leaveFrom,b=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=t.useRef(null),w=t.useState(Ve.Visible),S=w[0],C=w[1],O=g.unmount?o.Unmount:o.Hidden,I=function(){var e=t.useContext(_e);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=I.show,R=I.appear,T=function(){var e=t.useContext(Be);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),L=T.register,D=T.unregister,F=Ne(),P=E(),M=t.useRef(!1),A=Ke((function(){M.current||(C(Ve.Hidden),D(P),_.current.afterLeave())}));y((function(){if(P)return L(P)}),[L,P]),y((function(){var e;O===o.Hidden&&P&&(k&&S!==Ve.Visible?C(Ve.Visible):f(S,((e={})[Ve.Hidden]=function(){return D(P)},e[Ve.Visible]=function(){return L(P)},e)))}),[S,P,L,D,k,O]);var N=He(s),j=He(p),G=He(v),U=He(m),H=He(h),V=He(b),_=function(e){var n=t.useRef(We(e));return t.useEffect((function(){n.current=We(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:i,afterLeave:l});t.useEffect((function(){if(S===Ve.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,S]);var B=F&&!R;return y((function(){var e=x.current;if(e&&!B)return M.current=!0,k&&_.current.beforeEnter(),k||_.current.beforeLeave(),k?Ue(e,N,j,G,(function(e){M.current=!1,e===Pe.Finished&&_.current.afterEnter()})):Ue(e,U,H,V,(function(e){M.current=!1,e===Pe.Finished&&(Qe(A)||(C(Ve.Hidden),D(P),_.current.afterLeave()))}))}),[_,P,M,D,A,x,B,k,N,j,G,U,H,V]),u.createElement(Be.Provider,{value:A},d(a({},g,{ref:x}),{},"div",Je,S===Ve.Visible))}function $e(e){var n=e.show,r=e.appear,o=void 0!==r&&r,i=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=t.useState(n?Ve.Visible:Ve.Hidden),f=s[0],p=s[1],v=Ke((function(){p(Ve.Hidden)})),m=Ne(),h=t.useMemo((function(){return{show:n,appear:o||!m}}),[n,o,m]);t.useEffect((function(){n?p(Ve.Visible):Qe(v)||p(Ve.Hidden)}),[n,v]);var b={unmount:i};return u.createElement(Be.Provider,{value:v},u.createElement(_e.Provider,{value:h},d(a({},b,{as:t.Fragment,children:u.createElement(Xe,Object.assign({},b,l))}),{},t.Fragment,Je,f===Ve.Visible)))}$e.Child=Xe,e.Dialog=B,e.Disclosure=X,e.FocusTrap=function(e){var n=t.useRef(null),r=e.initialFocus,o=c(e,["initialFocus"]);return O(n,!0,{initialFocus:r}),d(a({},o,{ref:n}),{},"div")},e.Listbox=ve,e.Menu=Ie,e.Portal=M,e.Switch=Ae,e.Transition=$e,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=headlessui.umd.production.min.js.map |
import { MutableRefObject } from 'react'; | ||
export declare function useFocusTrap<TElement extends HTMLElement>(container: MutableRefObject<TElement | null>, enabled?: boolean, options?: { | ||
initialFocus?: MutableRefObject<HTMLElement>; | ||
initialFocus?: MutableRefObject<HTMLElement | null>; | ||
}): void; |
{ | ||
"name": "@headlessui/react", | ||
"version": "0.3.0-dc528c0", | ||
"version": "0.3.0-f34c086", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1648345
10979