@flarehr/salpac-finops-admin 1.0.1187 → 1.0.1188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,7 +10,7 @@ var e=Object.defineProperty,t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=nu
|
|
|
10
10
|
${({disabled:e})=>e&&{cursor:`not-allowed`,"--tw-bg-opacity":`1`,backgroundColor:`rgb(156 163 175 / var(--tw-bg-opacity, 1))`,":hover":{"--tw-bg-opacity":`1`,backgroundColor:`rgb(156 163 175 / var(--tw-bg-opacity, 1))`}}}
|
|
11
11
|
`,Va=({as:e,download:t,href:n,disabled:r,children:i,onClick:a,type:o})=>U(Ba,{as:e||`button`,download:t,href:n,type:o||`button`,disabled:r,onClick:a,children:i}),Ha=({blob:e,children:t,fileName:n})=>{let[r,i]=N();return P(()=>{let t=URL.createObjectURL(e);return i(t),()=>{URL.revokeObjectURL(t),i(void 0)}},[e]),U(Va,{as:`a`,href:r??`#`,download:n,children:t})},Ua=di.div`
|
|
12
12
|
${()=>({height:`1.5rem`,width:`1.5rem`,"@keyframes spin":{to:{transform:`rotate(360deg)`}},animation:`spin 1s linear infinite`,borderRadius:`9999px`,borderWidth:`2px`,borderColor:`var(--fl-color-primary-600)`,borderLeftColor:`transparent`,borderTopColor:`transparent`})}
|
|
13
|
-
`,Wa=async e=>{try{let t=await e.response?.text();return JSON.parse(t)}catch{return{}}},Ga=e=>new Date(Date.now()+e*24*60*60*1e3).toISOString().split(`T`)[0],Ka=(e=new Date)=>{let t=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],n=e=>e.toString().padStart(2,`0`);return`${n(e.getDate())}-${t[e.getMonth()]}-${e.getFullYear()}_${n(e.getHours())}-${n(e.getMinutes())}`},qa=15e3,Ja=class e extends Error{_response;get response(){return this._response}constructor(t,n){super(t),this._response=n,Object.setPrototypeOf(this,e.prototype)}},Ya=async(e,t,n,r)=>{let i=r instanceof FormData,a={"x-app-version":`1.0.1187`,authorization:`Bearer ${t}`};r&&!i&&(a[`content-type`]=`application/json`);let o=await fetch(e,{method:n,body:r&&!i?JSON.stringify(r):r,headers:{"x-app-version":`1.0.1187`,authorization:`Bearer ${t}`},signal:AbortSignal?.timeout?.(qa)});if(!o.ok)throw new Ja(`[API Error] Status: ${o.status}, ${o.statusText}`,o);return o},Xa=async(e,t,n,r)=>{let i=await Ya(e,t,n,r);return i.headers.get(`Content-Type`)?.includes(`application/json`)?await i.json():await i.blob()},Za=ye({backend:{url:``,accessToken:``}}),Qa=()=>Je(Za),$a=e=>{let t=Qa();return I(()=>e(t),[e,t])},eo=e=>async t=>{let n=new FormData;return n.append(`source`,t.source),n.append(`transactionFile`,t.transactionsFile),Xa(new URL(`${e.backend.url}/salary-packaging/admin/v1.0/catche/receipt-batch`),e.backend.accessToken,`POST`,n)},to=e=>async t=>Xa(new URL(`${e.backend.url}/salary-packaging/admin/v1.0/reports/${t.report}?startDate=${t.startDate||``}&endDate=${t.endDate||``}&groupCode=${t.groupCode||``}&clientId=${t.clientId||``}`),e.backend.accessToken,`GET`),no=(e,t)=>async n=>{let r=Ga(2);return Ya(new URL(`${e.backend.url}${t}`),e.backend.accessToken,`POST`,{startDate:n,endDate:r})},ro=e=>no(e,`/salary-packaging/admin/v1.0/ingest/clients`),io=e=>no(e,`/salary-packaging/admin/v1.0/ingest/drivers`),ao=e=>no(e,`/salary-packaging/admin/v1.0/ingest/contract-budgets`),oo=e=>no(e,`/salary-packaging/admin/v1.0/ingest/invoice-items`),so=e=>no(e,`/salary-packaging/admin/v1.0/ingest/deleted-invoice-items`),co=e=>no(e,`/salary-packaging/admin/v1.0/ingest/vehicle-contracts`),lo=e=>async()=>Xa(new URL(`${e.backend.url}/salary-packaging/admin/v1.0/account-search/uploads/latest`),e.backend.accessToken,`GET`),uo=()=>({postCatcheReceiptBatch:$a(eo),getCatcheReport:$a(to),ingestClients:$a(ro),ingestDrivers:$a(io),ingestContractBudgets:$a(ao),ingestInvoiceItems:$a(oo),ingestDeletedInvoiceItems:$a(so),ingestVehicleContracts:$a(co),getEmployerSearchCsv:$a(lo)}),fo=Object.defineProperty,po=(e,t,n)=>t in e?fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mo=(e,t,n)=>(po(e,typeof t==`symbol`?t:t+``,n),n),ho=new class{constructor(){mo(this,`current`,this.detect()),mo(this,`handoffState`,`pending`),mo(this,`currentId`,0)}set(e){this.current!==e&&(this.handoffState=`pending`,this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current===`server`}get isClient(){return this.current===`client`}detect(){return typeof window>`u`||typeof document>`u`?`server`:`client`}handoff(){this.handoffState===`pending`&&(this.handoffState=`complete`)}get isHandoffComplete(){return this.handoffState===`complete`}},go=(e,t)=>{ho.isServer?P(e,t):Ge(e,t)};function _o(e){let t=F(e);return go(()=>{t.current=e},[e]),t}function vo(e,t){let[n,r]=N(e),i=_o(e);return go(()=>r(i.current),[i,r,...t]),n}var Z=function(e){let t=_o(e);return L.useCallback((...e)=>t.current(...e),[t])};function yo(e,t,n){let[r,i]=N(n),a=e!==void 0,o=F(a),s=F(!1),c=F(!1);return a&&!o.current&&!s.current?(s.current=!0,o.current=a,console.error(`A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.`)):!a&&o.current&&!c.current&&(c.current=!0,o.current=a,console.error(`A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.`)),[a?e:r,Z(e=>(a||i(e),t?.(e)))]}function bo(e){typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function xo(){let e=[],t={addEventListener(e,n,r,i){return e.addEventListener(n,r,i),t.add(()=>e.removeEventListener(n,r,i))},requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...e){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...e))},setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return bo(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=xo();return e(t),this.add(()=>t.dispose())},add(t){return e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}},dispose(){for(let t of e.splice(0))t()}};return t}function So(){let[e]=N(xo);return P(()=>()=>e.dispose(),[e]),e}function Co(){let e=typeof document>`u`;return`useSyncExternalStore`in ot?(e=>e.useSyncExternalStore)(ot)(()=>()=>{},()=>!1,()=>!e):!1}function wo(){let e=Co(),[t,n]=N(ho.isHandoffComplete);return t&&ho.isHandoffComplete===!1&&n(!1),P(()=>{t!==!0&&n(!0)},[t]),P(()=>ho.handoff(),[]),e?!1:t}var To=L.useId??function(){let e=wo(),[t,n]=L.useState(e?()=>ho.nextId():null);return go(()=>{t===null&&n(ho.nextId())},[t]),t==null?void 0:``+t};function Q(e,t,...n){if(e in t){let r=t[e];return typeof r==`function`?r(...n):r}let r=Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(`, `)}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Q),r}function Eo(e){return ho.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty(`current`)&&e.current instanceof Node?e.current.ownerDocument:document}var Do=[`[contentEditable=true]`,`[tabindex]`,`a[href]`,`area[href]`,`button:not([disabled])`,`iframe`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`].map(e=>`${e}:not([tabindex='-1'])`).join(`,`),Oo=(e=>(e[e.First=1]=`First`,e[e.Previous=2]=`Previous`,e[e.Next=4]=`Next`,e[e.Last=8]=`Last`,e[e.WrapAround=16]=`WrapAround`,e[e.NoScroll=32]=`NoScroll`,e))(Oo||{}),ko=(e=>(e[e.Error=0]=`Error`,e[e.Overflow=1]=`Overflow`,e[e.Success=2]=`Success`,e[e.Underflow=3]=`Underflow`,e))(ko||{}),Ao=(e=>(e[e.Previous=-1]=`Previous`,e[e.Next=1]=`Next`,e))(Ao||{}),jo=(e=>(e[e.Strict=0]=`Strict`,e[e.Loose=1]=`Loose`,e))(jo||{});function Mo(e,t=0){return e===Eo(e)?.body?!1:Q(t,{0(){return e.matches(Do)},1(){let t=e;for(;t!==null;){if(t.matches(Do))return!0;t=t.parentElement}return!1}})}var No=(e=>(e[e.Keyboard=0]=`Keyboard`,e[e.Mouse=1]=`Mouse`,e))(No||{});typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible=``)},!0),document.addEventListener(`click`,e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible=``)},!0)),[`textarea`,`input`].join(`,`);function Po(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),i=t(n);if(r===null||i===null)return 0;let a=r.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Fo(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Io(){return/Android/gi.test(window.navigator.userAgent)}function Lo(){return Fo()||Io()}function Ro(e,t,n){let r=_o(t);P(()=>{function t(e){r.current(e)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)},[e,n])}function zo(e,t,n){let r=_o(t);P(()=>{function t(e){r.current(e)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)},[e,n])}function Bo(e,t,n=!0){let r=F(!1);P(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function i(n,i){if(!r.current||n.defaultPrevented)return;let a=i(n);if(a===null||!a.getRootNode().contains(a)||!a.isConnected)return;let o=function e(t){return typeof t==`function`?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e);for(let e of o){if(e===null)continue;let t=e instanceof HTMLElement?e:e.current;if(t!=null&&t.contains(a)||n.composed&&n.composedPath().includes(t))return}return!Mo(a,jo.Loose)&&a.tabIndex!==-1&&n.preventDefault(),t(n,a)}let a=F(null);Ro(`pointerdown`,e=>{r.current&&(a.current=e.composedPath?.call(e)?.[0]||e.target)},!0),Ro(`mousedown`,e=>{r.current&&(a.current=e.composedPath?.call(e)?.[0]||e.target)},!0),Ro(`click`,e=>{Lo()||(a.current&&=(i(e,()=>a.current),null))},!0),Ro(`touchend`,e=>i(e,()=>e.target instanceof HTMLElement?e.target:null),!0),zo(`blur`,e=>i(e,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Vo(e){if(e.type)return e.type;let t=e.as??`button`;if(typeof t==`string`&&t.toLowerCase()===`button`)return`button`}function Ho(e,t){let[n,r]=N(()=>Vo(e));return go(()=>{r(Vo(e))},[e.type,e.as]),go(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute(`type`)&&r(`button`)},[n,t]),n}var Uo=Symbol();function Wo(...e){let t=F(e);P(()=>{t.current=e},[e]);let n=Z(e=>{for(let n of t.current)n!=null&&(typeof n==`function`?n(e):n.current=e)});return e.every(e=>e==null||e?.[Uo])?void 0:n}function Go(e){return[e.screenX,e.screenY]}function Ko(){let e=F([-1,-1]);return{wasMoved(t){let n=Go(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Go(t)}}}function qo(...e){return Array.from(new Set(e.flatMap(e=>typeof e==`string`?e.split(` `):[]))).filter(Boolean).join(` `)}var Jo=(e=>(e[e.None=0]=`None`,e[e.RenderStrategy=1]=`RenderStrategy`,e[e.Static=2]=`Static`,e))(Jo||{}),Yo=(e=>(e[e.Unmount=0]=`Unmount`,e[e.Hidden=1]=`Hidden`,e))(Yo||{});function Xo({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:a=!0,name:o,mergeRefs:s}){s??=Qo;let c=$o(t,e);if(a)return Zo(c,n,r,o,s);let l=i??0;if(l&2){let{static:e=!1,...t}=c;if(e)return Zo(t,n,r,o,s)}if(l&1){let{unmount:e=!0,...t}=c;return Q(+!e,{0(){return null},1(){return Zo({...t,hidden:!0,style:{display:`none`}},n,r,o,s)}})}return Zo(c,n,r,o,s)}function Zo(e,t={},n,r,i){let{as:a=n,children:o,refName:s=`ref`,...c}=ns(e,[`unmount`,`static`]),l=e.ref===void 0?{}:{[s]:e.ref},u=typeof o==`function`?o(t):o;`className`in c&&c.className&&typeof c.className==`function`&&(c.className=c.className(t));let d={};if(t){let e=!1,n=[];for(let[r,i]of Object.entries(t))typeof i==`boolean`&&(e=!0),i===!0&&n.push(r);e&&(d[`data-headlessui-state`]=n.join(` `))}if(a===w&&Object.keys(ts(c)).length>0){if(!Zt(u)||Array.isArray(u)&&u.length>1)throw Error([`Passing props on "Fragment"!`,``,`The current component <${r} /> is rendering a "Fragment".`,`However we need to passthrough the following props:`,Object.keys(c).map(e=>` - ${e}`).join(`
|
|
13
|
+
`,Wa=async e=>{try{let t=await e.response?.text();return JSON.parse(t)}catch{return{}}},Ga=e=>new Date(Date.now()+e*24*60*60*1e3).toISOString().split(`T`)[0],Ka=(e=new Date)=>{let t=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],n=e=>e.toString().padStart(2,`0`);return`${n(e.getDate())}-${t[e.getMonth()]}-${e.getFullYear()}_${n(e.getHours())}-${n(e.getMinutes())}`},qa=15e3,Ja=class e extends Error{_response;get response(){return this._response}constructor(t,n){super(t),this._response=n,Object.setPrototypeOf(this,e.prototype)}},Ya=async(e,t,n,r)=>{let i=r instanceof FormData,a={"x-app-version":`1.0.1188`,authorization:`Bearer ${t}`};r&&!i&&(a[`content-type`]=`application/json`);let o=await fetch(e,{method:n,body:r&&!i?JSON.stringify(r):r,headers:{"x-app-version":`1.0.1188`,authorization:`Bearer ${t}`},signal:AbortSignal?.timeout?.(qa)});if(!o.ok)throw new Ja(`[API Error] Status: ${o.status}, ${o.statusText}`,o);return o},Xa=async(e,t,n,r)=>{let i=await Ya(e,t,n,r);return i.headers.get(`Content-Type`)?.includes(`application/json`)?await i.json():await i.blob()},Za=ye({backend:{url:``,accessToken:``}}),Qa=()=>Je(Za),$a=e=>{let t=Qa();return I(()=>e(t),[e,t])},eo=e=>async t=>{let n=new FormData;return n.append(`source`,t.source),n.append(`transactionFile`,t.transactionsFile),Xa(new URL(`${e.backend.url}/salary-packaging/admin/v1.0/catche/receipt-batch`),e.backend.accessToken,`POST`,n)},to=e=>async t=>Xa(new URL(`${e.backend.url}/salary-packaging/admin/v1.0/reports/${t.report}?startDate=${t.startDate||``}&endDate=${t.endDate||``}&groupCode=${t.groupCode||``}&clientId=${t.clientId||``}`),e.backend.accessToken,`GET`),no=(e,t)=>async n=>{let r=Ga(2);return Ya(new URL(`${e.backend.url}${t}`),e.backend.accessToken,`POST`,{startDate:n,endDate:r})},ro=e=>no(e,`/salary-packaging/admin/v1.0/ingest/clients`),io=e=>no(e,`/salary-packaging/admin/v1.0/ingest/drivers`),ao=e=>no(e,`/salary-packaging/admin/v1.0/ingest/contract-budgets`),oo=e=>no(e,`/salary-packaging/admin/v1.0/ingest/invoice-items`),so=e=>no(e,`/salary-packaging/admin/v1.0/ingest/deleted-invoice-items`),co=e=>no(e,`/salary-packaging/admin/v1.0/ingest/vehicle-contracts`),lo=e=>async()=>Xa(new URL(`${e.backend.url}/salary-packaging/admin/v1.0/account-search/uploads/latest`),e.backend.accessToken,`GET`),uo=()=>({postCatcheReceiptBatch:$a(eo),getCatcheReport:$a(to),ingestClients:$a(ro),ingestDrivers:$a(io),ingestContractBudgets:$a(ao),ingestInvoiceItems:$a(oo),ingestDeletedInvoiceItems:$a(so),ingestVehicleContracts:$a(co),getEmployerSearchCsv:$a(lo)}),fo=Object.defineProperty,po=(e,t,n)=>t in e?fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mo=(e,t,n)=>(po(e,typeof t==`symbol`?t:t+``,n),n),ho=new class{constructor(){mo(this,`current`,this.detect()),mo(this,`handoffState`,`pending`),mo(this,`currentId`,0)}set(e){this.current!==e&&(this.handoffState=`pending`,this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current===`server`}get isClient(){return this.current===`client`}detect(){return typeof window>`u`||typeof document>`u`?`server`:`client`}handoff(){this.handoffState===`pending`&&(this.handoffState=`complete`)}get isHandoffComplete(){return this.handoffState===`complete`}},go=(e,t)=>{ho.isServer?P(e,t):Ge(e,t)};function _o(e){let t=F(e);return go(()=>{t.current=e},[e]),t}function vo(e,t){let[n,r]=N(e),i=_o(e);return go(()=>r(i.current),[i,r,...t]),n}var Z=function(e){let t=_o(e);return L.useCallback((...e)=>t.current(...e),[t])};function yo(e,t,n){let[r,i]=N(n),a=e!==void 0,o=F(a),s=F(!1),c=F(!1);return a&&!o.current&&!s.current?(s.current=!0,o.current=a,console.error(`A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.`)):!a&&o.current&&!c.current&&(c.current=!0,o.current=a,console.error(`A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.`)),[a?e:r,Z(e=>(a||i(e),t?.(e)))]}function bo(e){typeof queueMicrotask==`function`?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function xo(){let e=[],t={addEventListener(e,n,r,i){return e.addEventListener(n,r,i),t.add(()=>e.removeEventListener(n,r,i))},requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...e){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...e))},setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return bo(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=xo();return e(t),this.add(()=>t.dispose())},add(t){return e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}},dispose(){for(let t of e.splice(0))t()}};return t}function So(){let[e]=N(xo);return P(()=>()=>e.dispose(),[e]),e}function Co(){let e=typeof document>`u`;return`useSyncExternalStore`in ot?(e=>e.useSyncExternalStore)(ot)(()=>()=>{},()=>!1,()=>!e):!1}function wo(){let e=Co(),[t,n]=N(ho.isHandoffComplete);return t&&ho.isHandoffComplete===!1&&n(!1),P(()=>{t!==!0&&n(!0)},[t]),P(()=>ho.handoff(),[]),e?!1:t}var To=L.useId??function(){let e=wo(),[t,n]=L.useState(e?()=>ho.nextId():null);return go(()=>{t===null&&n(ho.nextId())},[t]),t==null?void 0:``+t};function Q(e,t,...n){if(e in t){let r=t[e];return typeof r==`function`?r(...n):r}let r=Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(`, `)}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Q),r}function Eo(e){return ho.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty(`current`)&&e.current instanceof Node?e.current.ownerDocument:document}var Do=[`[contentEditable=true]`,`[tabindex]`,`a[href]`,`area[href]`,`button:not([disabled])`,`iframe`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`].map(e=>`${e}:not([tabindex='-1'])`).join(`,`),Oo=(e=>(e[e.First=1]=`First`,e[e.Previous=2]=`Previous`,e[e.Next=4]=`Next`,e[e.Last=8]=`Last`,e[e.WrapAround=16]=`WrapAround`,e[e.NoScroll=32]=`NoScroll`,e))(Oo||{}),ko=(e=>(e[e.Error=0]=`Error`,e[e.Overflow=1]=`Overflow`,e[e.Success=2]=`Success`,e[e.Underflow=3]=`Underflow`,e))(ko||{}),Ao=(e=>(e[e.Previous=-1]=`Previous`,e[e.Next=1]=`Next`,e))(Ao||{}),jo=(e=>(e[e.Strict=0]=`Strict`,e[e.Loose=1]=`Loose`,e))(jo||{});function Mo(e,t=0){return e===Eo(e)?.body?!1:Q(t,{0(){return e.matches(Do)},1(){let t=e;for(;t!==null;){if(t.matches(Do))return!0;t=t.parentElement}return!1}})}var No=(e=>(e[e.Keyboard=0]=`Keyboard`,e[e.Mouse=1]=`Mouse`,e))(No||{});typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible=``)},!0),document.addEventListener(`click`,e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible=``)},!0)),[`textarea`,`input`].join(`,`);function Po(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),i=t(n);if(r===null||i===null)return 0;let a=r.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Fo(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Io(){return/Android/gi.test(window.navigator.userAgent)}function Lo(){return Fo()||Io()}function Ro(e,t,n){let r=_o(t);P(()=>{function t(e){r.current(e)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)},[e,n])}function zo(e,t,n){let r=_o(t);P(()=>{function t(e){r.current(e)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)},[e,n])}function Bo(e,t,n=!0){let r=F(!1);P(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function i(n,i){if(!r.current||n.defaultPrevented)return;let a=i(n);if(a===null||!a.getRootNode().contains(a)||!a.isConnected)return;let o=function e(t){return typeof t==`function`?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e);for(let e of o){if(e===null)continue;let t=e instanceof HTMLElement?e:e.current;if(t!=null&&t.contains(a)||n.composed&&n.composedPath().includes(t))return}return!Mo(a,jo.Loose)&&a.tabIndex!==-1&&n.preventDefault(),t(n,a)}let a=F(null);Ro(`pointerdown`,e=>{r.current&&(a.current=e.composedPath?.call(e)?.[0]||e.target)},!0),Ro(`mousedown`,e=>{r.current&&(a.current=e.composedPath?.call(e)?.[0]||e.target)},!0),Ro(`click`,e=>{Lo()||(a.current&&=(i(e,()=>a.current),null))},!0),Ro(`touchend`,e=>i(e,()=>e.target instanceof HTMLElement?e.target:null),!0),zo(`blur`,e=>i(e,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Vo(e){if(e.type)return e.type;let t=e.as??`button`;if(typeof t==`string`&&t.toLowerCase()===`button`)return`button`}function Ho(e,t){let[n,r]=N(()=>Vo(e));return go(()=>{r(Vo(e))},[e.type,e.as]),go(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute(`type`)&&r(`button`)},[n,t]),n}var Uo=Symbol();function Wo(...e){let t=F(e);P(()=>{t.current=e},[e]);let n=Z(e=>{for(let n of t.current)n!=null&&(typeof n==`function`?n(e):n.current=e)});return e.every(e=>e==null||e?.[Uo])?void 0:n}function Go(e){return[e.screenX,e.screenY]}function Ko(){let e=F([-1,-1]);return{wasMoved(t){let n=Go(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Go(t)}}}function qo(...e){return Array.from(new Set(e.flatMap(e=>typeof e==`string`?e.split(` `):[]))).filter(Boolean).join(` `)}var Jo=(e=>(e[e.None=0]=`None`,e[e.RenderStrategy=1]=`RenderStrategy`,e[e.Static=2]=`Static`,e))(Jo||{}),Yo=(e=>(e[e.Unmount=0]=`Unmount`,e[e.Hidden=1]=`Hidden`,e))(Yo||{});function Xo({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:a=!0,name:o,mergeRefs:s}){s??=Qo;let c=$o(t,e);if(a)return Zo(c,n,r,o,s);let l=i??0;if(l&2){let{static:e=!1,...t}=c;if(e)return Zo(t,n,r,o,s)}if(l&1){let{unmount:e=!0,...t}=c;return Q(+!e,{0(){return null},1(){return Zo({...t,hidden:!0,style:{display:`none`}},n,r,o,s)}})}return Zo(c,n,r,o,s)}function Zo(e,t={},n,r,i){let{as:a=n,children:o,refName:s=`ref`,...c}=ns(e,[`unmount`,`static`]),l=e.ref===void 0?{}:{[s]:e.ref},u=typeof o==`function`?o(t):o;`className`in c&&c.className&&typeof c.className==`function`&&(c.className=c.className(t));let d={};if(t){let e=!1,n=[];for(let[r,i]of Object.entries(t))typeof i==`boolean`&&(e=!0),i===!0&&n.push(r);e&&(d[`data-headlessui-state`]=n.join(` `))}if(a===w&&Object.keys(ts(c)).length>0){if(!Zt(u)||Array.isArray(u)&&u.length>1)throw Error([`Passing props on "Fragment"!`,``,`The current component <${r} /> is rendering a "Fragment".`,`However we need to passthrough the following props:`,Object.keys(c).map(e=>` - ${e}`).join(`
|
|
14
14
|
`),``,`You can apply a few solutions:`,['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',`Render a single element as the child so that we can forward the props onto that element.`].map(e=>` - ${e}`).join(`
|
|
15
15
|
`)].join(`
|
|
16
16
|
`));let e=u.props,t=typeof e?.className==`function`?(...t)=>qo(e?.className(...t),c.className):qo(e?.className,c.className),n=t?{className:t}:{};return en(u,Object.assign({},$o(u.props,ts(ns(c,[`ref`]))),d,l,{ref:i(u.ref,l.ref)},n))}return x(a,Object.assign({},ns(c,[`ref`]),a!==w&&l,a!==w&&d),u)}function Qo(...e){return e.every(e=>e==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n==`function`?n(t):n.current=t)}}function $o(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith(`on`)&&typeof r[e]==`function`?(n[e]??(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t[`aria-disabled`])return Object.assign(t,Object.fromEntries(Object.keys(n).map(e=>[e,void 0])));for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||t?.nativeEvent instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function es(e){return Object.assign(yt(e),{displayName:e.displayName??e.name})}function ts(e){let t=Object.assign({},e);for(let e in t)t[e]===void 0&&delete t[e];return t}function ns(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}var rs=`div`,is=(e=>(e[e.None=1]=`None`,e[e.Focusable=2]=`Focusable`,e[e.Hidden=4]=`Hidden`,e))(is||{});function as(e,t){let{features:n=1,...r}=e;return Xo({ourProps:{ref:t,"aria-hidden":(n&2)==2?!0:r[`aria-hidden`]??void 0,hidden:(n&4)==4?!0:void 0,style:{position:`fixed`,top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,...(n&4)==4&&(n&2)!=2&&{display:`none`}}},theirProps:r,slot:{},defaultTag:rs,name:`Hidden`})}var os=es(as),ss=ye(null);ss.displayName=`OpenClosedContext`;var cs=(e=>(e[e.Open=1]=`Open`,e[e.Closed=2]=`Closed`,e[e.Closing=4]=`Closing`,e[e.Opening=8]=`Opening`,e))(cs||{});function ls(){return Je(ss)}function us({value:e,children:t}){return L.createElement(ss.Provider,{value:e},t)}function ds(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=t?.getAttribute(`disabled`)===``;return r&&fs(n)?!1:r}function fs(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function ps(e){throw Error(`Unexpected object: `+e)}var ms=(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`,e))(ms||{});function hs(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=r??-1;switch(e.focus){case 0:for(let e=0;e<n.length;++e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 1:for(let e=i-1;e>=0;--e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 2:for(let e=i+1;e<n.length;++e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 3:for(let e=n.length-1;e>=0;--e)if(!t.resolveDisabled(n[e],e,n))return e;return r;case 4:for(let r=0;r<n.length;++r)if(t.resolveId(n[r],r,n)===e.id)return r;return r;case 5:return null;default:ps(e)}}function gs(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))vs(n,_s(t,r),i);return n}function _s(e,t){return e?e+`[`+t+`]`:t}function vs(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())vs(e,_s(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):typeof n==`boolean`?e.push([t,n?`1`:`0`]):typeof n==`string`?e.push([t,n]):typeof n==`number`?e.push([t,`${n}`]):n==null?e.push([t,``]):gs(n,t,e)}var $=(e=>(e.Space=` `,e.Enter=`Enter`,e.Escape=`Escape`,e.Backspace=`Backspace`,e.Delete=`Delete`,e.ArrowLeft=`ArrowLeft`,e.ArrowUp=`ArrowUp`,e.ArrowRight=`ArrowRight`,e.ArrowDown=`ArrowDown`,e.Home=`Home`,e.End=`End`,e.PageUp=`PageUp`,e.PageDown=`PageDown`,e.Tab=`Tab`,e))($||{});function ys(){let e=F(!1);return go(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var bs=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function xs(e){let t=e.innerText??``,n=e.cloneNode(!0);if(!(n instanceof HTMLElement))return t;let r=!1;for(let e of n.querySelectorAll(`[hidden],[aria-hidden],[role="img"]`))e.remove(),r=!0;let i=r?n.innerText??``:t;return bs.test(i)&&(i=i.replace(bs,``)),i}function Ss(e){let t=e.getAttribute(`aria-label`);if(typeof t==`string`)return t.trim();let n=e.getAttribute(`aria-labelledby`);if(n){let e=n.split(` `).map(e=>{let t=document.getElementById(e);if(t){let e=t.getAttribute(`aria-label`);return typeof e==`string`?e.trim():xs(t).trim()}return null}).filter(Boolean);if(e.length>0)return e.join(`, `)}return xs(e).trim()}function Cs(e){let t=F(``),n=F(``);return Z(()=>{let r=e.current;if(!r)return``;let i=r.innerText;if(t.current===i)return n.current;let a=Ss(r).trim().toLowerCase();return t.current=i,n.current=a,a})}var ws=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(ws||{}),Ts=(e=>(e[e.Single=0]=`Single`,e[e.Multi=1]=`Multi`,e))(Ts||{}),Es=(e=>(e[e.Pointer=0]=`Pointer`,e[e.Other=1]=`Other`,e))(Es||{}),Ds=(e=>(e[e.OpenListbox=0]=`OpenListbox`,e[e.CloseListbox=1]=`CloseListbox`,e[e.GoToOption=2]=`GoToOption`,e[e.Search=3]=`Search`,e[e.ClearSearch=4]=`ClearSearch`,e[e.RegisterOption=5]=`RegisterOption`,e[e.UnregisterOption=6]=`UnregisterOption`,e[e.RegisterLabel=7]=`RegisterLabel`,e))(Ds||{});function Os(e,t=e=>e){let n=e.activeOptionIndex===null?null:e.options[e.activeOptionIndex],r=Po(t(e.options.slice()),e=>e.dataRef.current.domRef.current),i=n?r.indexOf(n):null;return i===-1&&(i=null),{options:r,activeOptionIndex:i}}var ks={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,r=e.options.findIndex(e=>n(e.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=Os(e),r=hs(t,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...n,searchQuery:``,activeOptionIndex:r,activationTrigger:t.trigger??1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=+(e.searchQuery===``),r=e.searchQuery+t.value.toLowerCase(),i=(e.activeOptionIndex===null?e.options:e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n))).find(e=>!e.dataRef.current.disabled&&e.dataRef.current.textValue?.startsWith(r)),a=i?e.options.indexOf(i):-1;return a===-1||a===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:a,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===``?e:{...e,searchQuery:``}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=Os(e,e=>[...e,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=Os(e,e=>{let n=e.findIndex(e=>e.id===t.id);return n!==-1&&e.splice(n,1),e});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},As=ye(null);As.displayName=`ListboxActionsContext`;function js(e){let t=Je(As);if(t===null){let t=Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,js),t}return t}var Ms=ye(null);Ms.displayName=`ListboxDataContext`;function Ns(e){let t=Je(Ms);if(t===null){let t=Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Ns),t}return t}function Ps(e,t){return Q(t.type,ks,e,t)}var Fs=w;function Is(e,t){let{value:n,defaultValue:r,form:i,name:a,onChange:o,by:s=(e,t)=>e===t,disabled:c=!1,horizontal:l=!1,multiple:u=!1,...d}=e,f=l?`horizontal`:`vertical`,p=Wo(t),[m=u?[]:void 0,h]=yo(n,o,r),[g,_]=We(Ps,{dataRef:C(),listboxState:1,options:[],searchQuery:``,labelId:null,activeOptionIndex:null,activationTrigger:1}),v=F({static:!1,hold:!1}),y=F(null),b=F(null),x=F(null),S=Z(typeof s==`string`?(e,t)=>{let n=s;return e?.[n]===t?.[n]}:s),w=qe(e=>Q(T.mode,{1:()=>m.some(t=>S(t,e)),0:()=>S(m,e)}),[m]),T=I(()=>({...g,value:m,disabled:c,mode:+!!u,orientation:f,compare:S,isSelected:w,optionsPropsRef:v,labelRef:y,buttonRef:b,optionsRef:x}),[m,c,u,g]);go(()=>{g.dataRef.current=T},[T]),Bo([T.buttonRef,T.optionsRef],(e,t)=>{var n;_({type:1}),Mo(t,jo.Loose)||(e.preventDefault(),(n=T.buttonRef.current)==null||n.focus())},T.listboxState===0);let E=I(()=>({open:T.listboxState===0,disabled:c,value:m}),[T,c,m]),D=Z(e=>{let t=T.options.find(t=>t.id===e);t&&A(t.dataRef.current.value)}),ee=Z(()=>{if(T.activeOptionIndex!==null){let{dataRef:e,id:t}=T.options[T.activeOptionIndex];A(e.current.value),_({type:2,focus:ms.Specific,id:t})}}),O=Z(()=>_({type:0})),te=Z(()=>_({type:1})),ne=Z((e,t,n)=>e===ms.Specific?_({type:2,focus:ms.Specific,id:t,trigger:n}):_({type:2,focus:e,trigger:n})),re=Z((e,t)=>(_({type:5,id:e,dataRef:t}),()=>_({type:6,id:e}))),k=Z(e=>(_({type:7,id:e}),()=>_({type:7,id:null}))),A=Z(e=>Q(T.mode,{0(){return h?.(e)},1(){let t=T.value.slice(),n=t.findIndex(t=>S(t,e));return n===-1?t.push(e):t.splice(n,1),h?.(t)}})),ie=Z(e=>_({type:3,value:e})),ae=Z(()=>_({type:4})),oe=I(()=>({onChange:A,registerOption:re,registerLabel:k,goToOption:ne,closeListbox:te,openListbox:O,selectActiveOption:ee,selectOption:D,search:ie,clearSearch:ae}),[]),se={ref:p},ce=F(null),le=So();return P(()=>{ce.current&&r!==void 0&&le.addEventListener(ce.current,`reset`,()=>{h?.(r)})},[ce,h]),L.createElement(As.Provider,{value:oe},L.createElement(Ms.Provider,{value:T},L.createElement(us,{value:Q(T.listboxState,{0:cs.Open,1:cs.Closed})},a!=null&&m!=null&&gs({[a]:m}).map(([e,t],n)=>L.createElement(os,{features:is.Hidden,ref:n===0?e=>{ce.current=e?.closest(`form`)??null}:void 0,...ts({key:e,as:`input`,type:`hidden`,hidden:!0,readOnly:!0,form:i,disabled:c,name:e,value:t})})),Xo({ourProps:se,theirProps:d,slot:E,defaultTag:Fs,name:`Listbox`}))))}var Ls=`button`;function Rs(e,t){let n=To(),{id:r=`headlessui-listbox-button-${n}`,...i}=e,a=Ns(`Listbox.Button`),o=js(`Listbox.Button`),s=Wo(a.buttonRef,t),c=So(),l=Z(e=>{switch(e.key){case $.Space:case $.Enter:case $.ArrowDown:e.preventDefault(),o.openListbox(),c.nextFrame(()=>{a.value||o.goToOption(ms.First)});break;case $.ArrowUp:e.preventDefault(),o.openListbox(),c.nextFrame(()=>{a.value||o.goToOption(ms.Last)});break}}),u=Z(e=>{switch(e.key){case $.Space:e.preventDefault();break}}),d=Z(e=>{if(ds(e.currentTarget))return e.preventDefault();a.listboxState===0?(o.closeListbox(),c.nextFrame(()=>a.buttonRef.current?.focus({preventScroll:!0}))):(e.preventDefault(),o.openListbox())}),f=vo(()=>{if(a.labelId)return[a.labelId,r].join(` `)},[a.labelId,r]),p=I(()=>({open:a.listboxState===0,disabled:a.disabled,value:a.value}),[a]);return Xo({ourProps:{ref:s,id:r,type:Ho(e,a.buttonRef),"aria-haspopup":`listbox`,"aria-controls":a.optionsRef.current?.id,"aria-expanded":a.listboxState===0,"aria-labelledby":f,disabled:a.disabled,onKeyDown:l,onKeyUp:u,onClick:d},theirProps:i,slot:p,defaultTag:Ls,name:`Listbox.Button`})}var zs=`label`;function Bs(e,t){let n=To(),{id:r=`headlessui-listbox-label-${n}`,...i}=e,a=Ns(`Listbox.Label`),o=js(`Listbox.Label`),s=Wo(a.labelRef,t);go(()=>o.registerLabel(r),[r]);let c=Z(()=>a.buttonRef.current?.focus({preventScroll:!0})),l=I(()=>({open:a.listboxState===0,disabled:a.disabled}),[a]);return Xo({ourProps:{ref:s,id:r,onClick:c},theirProps:i,slot:l,defaultTag:zs,name:`Listbox.Label`})}var Vs=`ul`,Hs=Jo.RenderStrategy|Jo.Static;function Us(e,t){var n;let r=To(),{id:i=`headlessui-listbox-options-${r}`,...a}=e,o=Ns(`Listbox.Options`),s=js(`Listbox.Options`),c=Wo(o.optionsRef,t),l=So(),u=So(),d=ls(),f=d===null?o.listboxState===0:(d&cs.Open)===cs.Open;P(()=>{let e=o.optionsRef.current;e&&o.listboxState===0&&e!==Eo(e)?.activeElement&&e.focus({preventScroll:!0})},[o.listboxState,o.optionsRef]);let p=Z(e=>{switch(u.dispose(),e.key){case $.Space:if(o.searchQuery!==``)return e.preventDefault(),e.stopPropagation(),s.search(e.key);case $.Enter:if(e.preventDefault(),e.stopPropagation(),o.activeOptionIndex!==null){let{dataRef:e}=o.options[o.activeOptionIndex];s.onChange(e.current.value)}o.mode===0&&(s.closeListbox(),xo().nextFrame(()=>o.buttonRef.current?.focus({preventScroll:!0})));break;case Q(o.orientation,{vertical:$.ArrowDown,horizontal:$.ArrowRight}):return e.preventDefault(),e.stopPropagation(),s.goToOption(ms.Next);case Q(o.orientation,{vertical:$.ArrowUp,horizontal:$.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),s.goToOption(ms.Previous);case $.Home:case $.PageUp:return e.preventDefault(),e.stopPropagation(),s.goToOption(ms.First);case $.End:case $.PageDown:return e.preventDefault(),e.stopPropagation(),s.goToOption(ms.Last);case $.Escape:return e.preventDefault(),e.stopPropagation(),s.closeListbox(),l.nextFrame(()=>o.buttonRef.current?.focus({preventScroll:!0}));case $.Tab:e.preventDefault(),e.stopPropagation();break;default:e.key.length===1&&(s.search(e.key),u.setTimeout(()=>s.clearSearch(),350));break}}),m=vo(()=>o.buttonRef.current?.id,[o.buttonRef.current]),h=I(()=>({open:o.listboxState===0}),[o]);return Xo({ourProps:{"aria-activedescendant":o.activeOptionIndex===null||(n=o.options[o.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":o.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":o.orientation,id:i,onKeyDown:p,role:`listbox`,tabIndex:0,ref:c},theirProps:a,slot:h,defaultTag:Vs,features:Hs,visible:f,name:`Listbox.Options`})}var Ws=`li`;function Gs(e,t){let n=To(),{id:r=`headlessui-listbox-option-${n}`,disabled:i=!1,value:a,...o}=e,s=Ns(`Listbox.Option`),c=js(`Listbox.Option`),l=s.activeOptionIndex===null?!1:s.options[s.activeOptionIndex].id===r,u=s.isSelected(a),d=F(null),f=Cs(d),p=_o({disabled:i,value:a,domRef:d,get textValue(){return f()}}),m=Wo(t,d);go(()=>{if(s.listboxState!==0||!l||s.activationTrigger===0)return;let e=xo();return e.requestAnimationFrame(()=>{var e,t;(t=(e=d.current)?.scrollIntoView)==null||t.call(e,{block:`nearest`})}),e.dispose},[d,l,s.listboxState,s.activationTrigger,s.activeOptionIndex]),go(()=>c.registerOption(r,p),[p,r]);let h=Z(e=>{if(i)return e.preventDefault();c.onChange(a),s.mode===0&&(c.closeListbox(),xo().nextFrame(()=>s.buttonRef.current?.focus({preventScroll:!0})))}),g=Z(()=>{if(i)return c.goToOption(ms.Nothing);c.goToOption(ms.Specific,r)}),_=Ko(),v=Z(e=>_.update(e)),y=Z(e=>{_.wasMoved(e)&&(i||l||c.goToOption(ms.Specific,r,0))}),b=Z(e=>{_.wasMoved(e)&&(i||l&&c.goToOption(ms.Nothing))}),x=I(()=>({active:l,selected:u,disabled:i}),[l,u,i]);return Xo({ourProps:{id:r,ref:m,role:`option`,tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":u,disabled:void 0,onClick:h,onFocus:g,onPointerEnter:v,onMouseEnter:v,onPointerMove:y,onMouseMove:y,onPointerLeave:b,onMouseLeave:b},theirProps:o,slot:x,defaultTag:Ws,name:`Listbox.Option`})}var Ks=es(Is),qs=es(Rs),Js=es(Bs),Ys=es(Us),Xs=es(Gs),Zs=Object.assign(Ks,{Button:qs,Label:Js,Options:Ys,Option:Xs});function Qs(e=0){let[t,n]=N(e),r=ys();return{flags:t,addFlag:qe(e=>{r.current&&n(t=>t|e)},[t,r]),hasFlag:qe(e=>!!(t&e),[t]),removeFlag:qe(e=>{r.current&&n(t=>t&~e)},[n,r]),toggleFlag:qe(e=>{r.current&&n(t=>t^e)},[n])}}function $s(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ec(e,...t){e&&t.length>0&&e.classList.add(...t)}function tc(e,...t){e&&t.length>0&&e.classList.remove(...t)}function nc(e,t){let n=xo();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(e),[a,o]=[r,i].map(e=>{let[t=0]=e.split(`,`).filter(Boolean).map(e=>e.includes(`ms`)?parseFloat(e):parseFloat(e)*1e3).sort((e,t)=>t-e);return t}),s=a+o;if(s!==0){n.group(n=>{n.setTimeout(()=>{t(),n.dispose()},s),n.addEventListener(e,`transitionrun`,e=>{e.target===e.currentTarget&&n.dispose()})});let r=n.addEventListener(e,`transitionend`,e=>{e.target===e.currentTarget&&(t(),r())})}else t();return n.add(()=>t()),n.dispose}function rc(e,t,n,r){let i=n?`enter`:`leave`,a=xo(),o=r===void 0?()=>{}:$s(r);i===`enter`&&(e.removeAttribute(`hidden`),e.style.display=``);let s=Q(i,{enter:()=>t.enter,leave:()=>t.leave}),c=Q(i,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),l=Q(i,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return tc(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ec(e,...t.base,...s,...l),a.nextFrame(()=>{tc(e,...t.base,...s,...l),ec(e,...t.base,...s,...c),nc(e,()=>(tc(e,...t.base,...s),ec(e,...t.base,...t.entered),o()))}),a.dispose}function ic({immediate:e,container:t,direction:n,classes:r,onStart:i,onStop:a}){let o=ys(),s=So(),c=_o(n);go(()=>{e&&(c.current=`enter`)},[e]),go(()=>{let e=xo();s.add(e.dispose);let n=t.current;if(n&&c.current!==`idle`&&o.current)return e.dispose(),i.current(c.current),e.add(rc(n,r.current,c.current===`enter`,()=>{e.dispose(),a.current(c.current)})),e.dispose},[n])}function ac(e=``){return e.split(/\s+/).filter(e=>e.length>1)}var oc=ye(null);oc.displayName=`TransitionContext`;var sc=(e=>(e.Visible=`visible`,e.Hidden=`hidden`,e))(sc||{});function cc(){let e=Je(oc);if(e===null)throw Error(`A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.`);return e}function lc(){let e=Je(uc);if(e===null)throw Error(`A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.`);return e}var uc=ye(null);uc.displayName=`NestingContext`;function dc(e){return`children`in e?dc(e.children):e.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e===`visible`).length>0}function fc(e,t){let n=_o(e),r=F([]),i=ys(),a=So(),o=Z((e,t=Yo.Hidden)=>{let o=r.current.findIndex(({el:t})=>t===e);o!==-1&&(Q(t,{[Yo.Unmount](){r.current.splice(o,1)},[Yo.Hidden](){r.current[o].state=`hidden`}}),a.microTask(()=>{var e;!dc(r)&&i.current&&((e=n.current)==null||e.call(n))}))}),s=Z(e=>{let t=r.current.find(({el:t})=>t===e);return t?t.state!==`visible`&&(t.state=`visible`):r.current.push({el:e,state:`visible`}),()=>o(e,Yo.Unmount)}),c=F([]),l=F(Promise.resolve()),u=F({enter:[],leave:[],idle:[]}),d=Z((e,n,r)=>{c.current.splice(0),t&&(t.chains.current[n]=t.chains.current[n].filter(([t])=>t!==e)),t?.chains.current[n].push([e,new Promise(e=>{c.current.push(e)})]),t?.chains.current[n].push([e,new Promise(e=>{Promise.all(u.current[n].map(([e,t])=>t)).then(()=>e())})]),n===`enter`?l.current=l.current.then(()=>t?.wait.current).then(()=>r(n)):r(n)}),f=Z((e,t,n)=>{Promise.all(u.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;(e=c.current.shift())==null||e()}).then(()=>n(t))});return I(()=>({children:r,register:s,unregister:o,onStart:d,onStop:f,wait:l,chains:u}),[s,o,r,d,f,u,l])}function pc(){}var mc=[`beforeEnter`,`afterEnter`,`beforeLeave`,`afterLeave`];function hc(e){let t={};for(let n of mc)t[n]=e[n]??pc;return t}function gc(e){let t=F(hc(e));return P(()=>{t.current=hc(e)},[e]),t}var _c=`div`,vc=Jo.RenderStrategy;function yc(e,t){var n;let{beforeEnter:r,afterEnter:i,beforeLeave:a,afterLeave:o,enter:s,enterFrom:c,enterTo:l,entered:u,leave:d,leaveFrom:f,leaveTo:p,...m}=e,h=F(null),g=Wo(h,t),_=(n=m.unmount)==null||n?Yo.Unmount:Yo.Hidden,{show:v,appear:y,initial:b}=cc(),[x,S]=N(v?`visible`:`hidden`),C=lc(),{register:w,unregister:T}=C;P(()=>w(h),[w,h]),P(()=>{if(_===Yo.Hidden&&h.current){if(v&&x!==`visible`){S(`visible`);return}return Q(x,{hidden:()=>T(h),visible:()=>w(h)})}},[x,h,w,T,v,_]);let E=_o({base:ac(m.className),enter:ac(s),enterFrom:ac(c),enterTo:ac(l),entered:ac(u),leave:ac(d),leaveFrom:ac(f),leaveTo:ac(p)}),D=gc({beforeEnter:r,afterEnter:i,beforeLeave:a,afterLeave:o}),ee=wo();P(()=>{if(ee&&x===`visible`&&h.current===null)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[h,x,ee]);let O=b&&!y,te=y&&v&&b,ne=!ee||O?`idle`:v?`enter`:`leave`,re=Qs(0),k=Z(e=>Q(e,{enter:()=>{re.addFlag(cs.Opening),D.current.beforeEnter()},leave:()=>{re.addFlag(cs.Closing),D.current.beforeLeave()},idle:()=>{}})),A=Z(e=>Q(e,{enter:()=>{re.removeFlag(cs.Opening),D.current.afterEnter()},leave:()=>{re.removeFlag(cs.Closing),D.current.afterLeave()},idle:()=>{}})),ie=fc(()=>{S(`hidden`),T(h)},C),ae=F(!1);ic({immediate:te,container:h,classes:E,direction:ne,onStart:_o(e=>{ae.current=!0,ie.onStart(h,e,k)}),onStop:_o(e=>{ae.current=!1,ie.onStop(h,e,A),e===`leave`&&!dc(ie)&&(S(`hidden`),T(h))})});let oe=m,se={ref:g};return te?oe={...oe,className:qo(m.className,...E.current.enter,...E.current.enterFrom)}:ae.current&&(oe.className=qo(m.className,h.current?.className),oe.className===``&&delete oe.className),L.createElement(uc.Provider,{value:ie},L.createElement(us,{value:Q(x,{visible:cs.Open,hidden:cs.Closed})|re.flags},Xo({ourProps:se,theirProps:oe,defaultTag:_c,features:vc,visible:x===`visible`,name:`Transition.Child`})))}function bc(e,t){let{show:n,appear:r=!1,unmount:i=!0,...a}=e,o=F(null),s=Wo(o,t);wo();let c=ls();if(n===void 0&&c!==null&&(n=(c&cs.Open)===cs.Open),![!0,!1].includes(n))throw Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,u]=N(n?`visible`:`hidden`),d=fc(()=>{u(`hidden`)}),[f,p]=N(!0),m=F([n]);go(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),p(!1))},[m,n]);let h=I(()=>({show:n,appear:r,initial:f}),[n,r,f]);P(()=>{if(n)u(`visible`);else if(!dc(d))u(`hidden`);else{let e=o.current;if(!e)return;let t=e.getBoundingClientRect();t.x===0&&t.y===0&&t.width===0&&t.height===0&&u(`hidden`)}},[n,d]);let g={unmount:i},_=Z(()=>{var t;f&&p(!1),(t=e.beforeEnter)==null||t.call(e)}),v=Z(()=>{var t;f&&p(!1),(t=e.beforeLeave)==null||t.call(e)});return L.createElement(uc.Provider,{value:d},L.createElement(oc.Provider,{value:h},Xo({ourProps:{...g,as:w,children:L.createElement(Cc,{ref:s,...g,...a,beforeEnter:_,beforeLeave:v})},theirProps:{},defaultTag:w,features:vc,visible:l===`visible`,name:`Transition`})))}function xc(e,t){let n=Je(oc)!==null,r=ls()!==null;return L.createElement(L.Fragment,null,!n&&r?L.createElement(Sc,{ref:t,...e}):L.createElement(Cc,{ref:t,...e}))}var Sc=es(bc),Cc=es(yc),wc=es(xc),Tc=Object.assign(Sc,{Child:wc,Root:Sc}),Ec=di(Zs.Button)`
|