PageSourceSearch

https://oliasoft.com/assets/dialog-BTN-iyNy.js

js oliasoft.com collected 2026-10-06 18:25:00 UTC 12,612 bytes, 1 lines download raw bytes

1import{F as e,M as t}from"./jsx-runtime-DG25VhPR.js";import{n}from"./IconArrowRight-DY--_kmA.js";import{C as r,S as i,_ as a,b as o,c as s,f as c,g as l,h as u,i as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,v as y,x as b}from"./transition-heA_eClo.js";import{A as x,B as S,D as ee,E as te,F as C,H as ne,I as w,K as T,L as E,P as D,R as O,S as k,T as A,V as j,W as re,_ as ie,a as ae,b as M,c as oe,d as se,f as N,g as P,h as ce,i as F,j as I,k as le,l as ue,m as de,n as L,o as fe,q as R,r as pe,s as me,t as z,u as B,w as he,x as V,z as H}from"./use-tab-direction-YJSEIhJQ.js";var ge=n(`outline`,`arrow-up-right`,`ArrowUpRight`,[[`path`,{d:`M17 7l-10 10`,key:`svg-0`}],[`path`,{d:`M8 7l9 0l0 9`,key:`svg-1`}]]),U=e(t(),1),W=(0,U.createContext)(void 0);function G(){return(0,U.useContext)(W)}var _e=`button`;function ve(e,t){let n=G(),{disabled:r=n||!1,autoFocus:i=!1,...a}=e,{isFocusVisible:o,focusProps:s}=R({autoFocus:i}),{isHovered:c,hoverProps:l}=T({isDisabled:r}),{pressed:d,pressProps:p}=j({disabled:r}),m=u({ref:t,type:a.type??`button`,disabled:r||void 0,autoFocus:i},s,l,p),h=S({disabled:r,hover:c,focus:o,active:d,autofocus:i});return f()({ourProps:m,theirProps:a,slot:h,defaultTag:_e,name:`Button`})}var ye=l(ve),K=(0,U.createContext)(null);K.displayName=`DescriptionContext`;function be(){let e=(0,U.useContext)(K);if(e===null){let e=Error(`You used a <Description /> component, but it is not inside a relevant parent.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,be),e}return e}function xe(){let[e,t]=(0,U.useState)([]);return[e.length>0?e.join(` `):void 0,(0,U.useMemo)(()=>function(e){let n=y(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}))),r=(0,U.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return U.createElement(K.Provider,{value:r},e.children)},[t])]}var Se=`p`;function Ce(e,t){let n=(0,H.useId)(),r=G(),{id:i=`headlessui-description-${n}`,...a}=e,s=be(),l=c(t);o(()=>s.register(i),[i,s.register]);let u=S({...s.slot,disabled:r||!1}),d={ref:l,...s.props,id:i};return f()({ourProps:d,theirProps:a,slot:u,defaultTag:Se,name:s.name||`Description`})}var we=l(Ce),Te=Object.assign(we,{});function Ee(e,t){let n=x();return U.createElement(ye,{ref:t,...u({onClick:n},e)})}var De=l(Ee),q=new Map,J=new Map;function Oe(e){let t=J.get(e)??0;return J.set(e,t+1),t===0?(q.set(e,{"aria-hidden":e.getAttribute(`aria-hidden`),inert:e.inert}),e.setAttribute(`aria-hidden`,`true`),e.inert=!0,()=>ke(e)):()=>ke(e)}function ke(e){let t=J.get(e)??1;if(t===1?J.delete(e):J.set(e,t-1),t!==1)return;let n=q.get(e);n&&(n[`aria-hidden`]===null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,n[`aria-hidden`]),e.inert=n.inert,q.delete(e))}function Ae(e,{allowed:t,disallowed:n}={}){let r=A(e,`inert-others`);o(()=>{if(!r)return;let e=i();for(let t of n?.()??[])t&&e.add(Oe(t));let a=t?.()??[];for(let t of a){if(!t)continue;let n=re(t);if(!n)continue;let r=t.parentElement;for(;r&&r!==n.body;){for(let t of r.children)a.some(e=>t.contains(e))||e.add(Oe(t));r=r.parentElement}}return e.dispose},[r,t,n])}function Y(e,t){let n=(0,U.useRef)([]),r=y(e);(0,U.useEffect)(()=>{let e=[...n.current];for(let[i,a]of t.entries())if(n.current[i]!==a){let i=r(t,e);return n.current=t,i}},[r,...t])}function je(e){function t(){document.readyState!==`loading`&&(e(),document.removeEventListener(`DOMContentLoaded`,t))}typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`DOMContentLoaded`,t),t())}var X=[];je(()=>{function e(e){if(!D(e.target)||e.target===document.body||X[0]===e.target)return;let t=e.target;t=t.closest(ie),X.unshift(t??e.target),X=X.filter(e=>e!=null&&e.isConnected),X.splice(10)}window.addEventListener(`click`,e,{capture:!0}),window.addEventListener(`mousedown`,e,{capture:!0}),window.addEventListener(`focus`,e,{capture:!0}),document.body.addEventListener(`click`,e,{capture:!0}),document.body.addEventListener(`mousedown`,e,{capture:!0}),document.body.addEventListener(`focus`,e,{capture:!0})});function Me(e,t=typeof document<`u`?document.defaultView:null,n){let r=A(e,`escape`);N(t,`keydown`,e=>{r&&(e.defaultPrevented||e.key===I.Escape&&n(e))})}function Ne(){let[e]=(0,U.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null),[t,n]=(0,U.useState)(e?.matches??!1);return o(()=>
1{if(!e)return;function t(e){n(e.matches)}return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[e]),t}function Pe(e){if(!e)return new Set;if(typeof e==`function`)return new Set(e());let t=new Set;for(let n of e.current)w(n.current)&&t.add(n.current);return t}var Fe=`div`,Z=(e=>(e[e.None=0]=`None`,e[e.InitialFocus=1]=`InitialFocus`,e[e.TabLock=2]=`TabLock`,e[e.FocusLock=4]=`FocusLock`,e[e.RestoreFocus=8]=`RestoreFocus`,e[e.AutoFocus=16]=`AutoFocus`,e))(Z||{});function Ie(e,t){let n=(0,U.useRef)(null),r=c(n,t),{initialFocus:i,initialFocusFallback:o,containers:s,features:l=15,...u}=e;d()||(l=0);let p=de(n.current);Be(l,{ownerDocument:p});let m=Ve(l,{ownerDocument:p,container:n,initialFocus:i,initialFocusFallback:o});He(l,{ownerDocument:p,container:n,containers:s,previousActiveElement:m});let h=L(),g=y(e=>{if(!C(n.current))return;let t=n.current;(e=>e())(()=>{a(h.current,{[z.Forwards]:()=>{V(t,M.First,{skipElements:[e.relatedTarget,o]})},[z.Backwards]:()=>{V(t,M.Last,{skipElements:[e.relatedTarget,o]})}})})}),_=A(!!(l&2),`focus-trap#tab-lock`),v=b(),x=(0,U.useRef)(!1),S={ref:r,onKeyDown(e){e.key==`Tab`&&(x.current=!0,v.requestAnimationFrame(()=>{x.current=!1}))},onBlur(e){if(!(l&4))return;let t=Pe(s);C(n.current)&&t.add(n.current);let r=e.relatedTarget;D(r)&&r.dataset.headlessuiFocusGuard!==`true`&&(Ue(t,r)||(x.current?V(n.current,a(h.current,{[z.Forwards]:()=>M.Next,[z.Backwards]:()=>M.Previous})|M.WrapAround,{relativeTo:e.target}):D(e.target)&&k(e.target)))}},ee=f();return U.createElement(U.Fragment,null,_&&U.createElement(E,{as:`button`,type:`button`,"data-headlessui-focus-guard":!0,onFocus:g,features:O.Focusable}),ee({ourProps:S,theirProps:u,defaultTag:Fe,name:`FocusTrap`}),_&&U.createElement(E,{as:`button`,type:`button`,"data-headlessui-focus-guard":!0,onFocus:g,features:O.Focusable}))}var Le=l(Ie),Re=Object.assign(Le,{features:Z});function ze(e=!0){let t=(0,U.useRef)(X.slice());return Y(([e],[n])=>{n===!0&&e===!1&&r(()=>{t.current.splice(0)}),n===!1&&e===!0&&(t.current=X.slice())},[e,X,t]),y(()=>t.current.find(e=>e!=null&&e.isConnected)??null)}function Be(e,{ownerDocument:t}){let n=!!(e&8),r=ze(n);Y(()=>{n||ne(t?.body)&&k(r())},[n]),B(()=>{n&&k(r())})}function Ve(e,{ownerDocument:t,container:n,initialFocus:i,initialFocusFallback:a}){let o=(0,U.useRef)(null),s=A(!!(e&1),`focus-trap#initial-focus`),c=g();return Y(()=>{if(e===0)return;if(!s){a!=null&&a.current&&k(a.current);return}let l=n.current;l&&r(()=>{if(!c.current)return;let n=t?.activeElement;if(i!=null&&i.current){if(i?.current===n){o.current=n;return}}else if(l.contains(n)){o.current=n;return}if(i!=null&&i.current)k(i.current);else{if(e&16){if(V(l,M.First|M.AutoFocus)!==P.Error)return}else if(V(l,M.First)!==P.Error)return;if(a!=null&&a.current&&(k(a.current),t?.activeElement===a.current))return;console.warn(`There are no focusable elements inside the <FocusTrap />`)}o.current=t?.activeElement})},[a,s,e]),o}function He(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:i}){let a=g(),o=!!(e&4);N(t?.defaultView,`focus`,e=>{if(!o||!a.current)return;let t=Pe(r);C(n.current)&&t.add(n.current);let s=i.current;if(!s)return;let c=e.target;C(c)?Ue(t,c)?(i.current=c,k(c)):(e.preventDefault(),e.stopPropagation(),k(s)):k(i.current)},!0)}function Ue(e,t){for(let n of e)if(n.contains(t))return!0;return!1}var We=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(We||{}),Ge=(e=>(e[e.SetTitleId=0]=`SetTitleId`,e))(Ge||{}),Ke={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Q=(0,U.createContext)(null);Q.displayName=`DialogContext`;function $(e){let t=(0,U.useContext)(Q);if(t===null){let t=Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$),t}return t}function qe(e,t){return a(t.type,Ke,e,t)}var Je=l(function(e,t){let n=(0,H.useId)(),{id:r=`headlessui-dialog-${n}`,open:i,onClose:a,initialFocus:l,role:u=`dialog`,autoFocus:p=!0,__demoMode:h=!1,unmount:g=!1,...v}=e,b=(0,U.useRef)(!1);u=function(){return u===`dialog`||u===`alertdialog`?u:(b.current||(b.current=!0,console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),`dialog`)}();let x=s();i===void 0&&x!==null&&(i=(x&m.Open)===m.Open);let C=(0,U.useRef)(null),ne=c(C,t),w=de(C.current),T=+!i,[E,D]=(0,U.useReducer)(qe,{titleId:null,descriptionId:null,panelRef:(0,U.createRef)()}),O=y(()=>a(!1)),k=y(e=>D({type:0,id:e})),A=d()?T===0:!1,[j,re]=oe(),ie={get current(){return E.panelRef.current??C.current}},M=ae(),{resolveContainers:N}=pe({mainTreeNode:M,portals:j,defaultContainers:[ie]}),P=x!==null&&(x&m.Closing)===m.Closing;Ae(h||P?!1:A,{allowed:y(()=>[C.current?.closest(`[data-headlessui-portal]`)??null]),disallowed:y(()=>[M?.closest(`body > *:not(#headlessui-portal-root)`)??null])});let F=ee.get(null);o(()=>
1{if(A)return F.actions.push(r),()=>F.actions.pop(r)},[F,r,A]);let I=te(F,(0,U.useCallback)(e=>F.selectors.isTop(e,r),[F,r]));ce(I,N,e=>{e.preventDefault(),O()}),Me(I,w?.defaultView,e=>{e.preventDefault(),e.stopPropagation(),document.activeElement&&`blur`in document.activeElement&&typeof document.activeElement.blur==`function`&&document.activeElement.blur(),O()}),se(h||P?!1:A,w,N),he(A,C,O);let[L,R]=xe(),z=(0,U.useMemo)(()=>[{dialogState:T,close:O,setTitleId:k,unmount:g},E],[T,O,k,g,E]),B=S({open:T===0}),V={ref:ne,id:r,role:u,tabIndex:-1,"aria-modal":h?void 0:T===0||void 0,"aria-labelledby":E.titleId,"aria-describedby":L,unmount:g},ge=!Ne(),W=Z.None;A&&!h&&(W|=Z.RestoreFocus,W|=Z.TabLock,p&&(W|=Z.AutoFocus),ge&&(W|=Z.InitialFocus));let G=f();return U.createElement(_,null,U.createElement(ue,{force:!0},U.createElement(me,null,U.createElement(Q.Provider,{value:z},U.createElement(fe,{target:C},U.createElement(ue,{force:!1},U.createElement(R,{slot:B},U.createElement(re,null,U.createElement(Re,{initialFocus:l,initialFocusFallback:C,containers:N,features:W},U.createElement(le,{value:O},G({ourProps:V,theirProps:v,slot:B,defaultTag:Ye,features:Xe,visible:T===0,name:`Dialog`})))))))))))}),Ye=`div`,Xe=h.RenderStrategy|h.Static;function Ze(e,t){let{transition:n=!1,open:r,...i}=e,a=s(),o=e.hasOwnProperty(`open`)||a!==null,c=e.hasOwnProperty(`onClose`);if(!o&&!c)throw Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!c)throw Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof e.open!=`boolean`)throw Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!=`function`)throw Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(r!==void 0||n)&&!i.static?U.createElement(F,null,U.createElement(v,{show:r,transition:n,unmount:i.unmount},U.createElement(Je,{ref:t,...i}))):U.createElement(F,null,U.createElement(Je,{ref:t,open:r,...i}))}var Qe=`div`;function $e(e,t){let n=(0,H.useId)(),{id:r=`headlessui-dialog-panel-${n}`,transition:i=!1,...a}=e,[{dialogState:o,unmount:s},l]=$(`Dialog.Panel`),u=c(t,l.panelRef),d=S({open:o===0}),m={ref:u,id:r,onClick:y(e=>{e.stopPropagation()})},h=i?p:U.Fragment,g=i?{unmount:s}:{},_=f();return U.createElement(h,{...g},_({ourProps:m,theirProps:a,slot:d,defaultTag:Qe,name:`Dialog.Panel`}))}var et=`div`;function tt(e,t){let{transition:n=!1,...r}=e,[{dialogState:i,unmount:a}]=$(`Dialog.Backdrop`),o=S({open:i===0}),s={ref:t,"aria-hidden":!0},c=n?p:U.Fragment,l=n?{unmount:a}:{},u=f();return U.createElement(c,{...l},u({ourProps:s,theirProps:r,slot:o,defaultTag:et,name:`Dialog.Backdrop`}))}var nt=`h2`;function rt(e,t){let n=(0,H.useId)(),{id:r=`headlessui-dialog-title-${n}`,...i}=e,[{dialogState:a,setTitleId:o}]=$(`Dialog.Title`),s=c(t);(0,U.useEffect)(()=>(o(r),()=>o(null)),[r,o]);let l=S({open:a===0}),u={ref:s,id:r};return f()({ourProps:u,theirProps:i,slot:l,defaultTag:nt,name:`Dialog.Title`})}var it=l(Ze),at=l($e),ot=l(tt),st=l(rt),ct=Object.assign(it,{Panel:at,Title:st,Description:Te});export{De as a,at as i,st as n,ge as o,ct as r,ot as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.