@inertiaui/modal-react 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inertiaui-modal.js +1125 -1758
- package/dist/inertiaui-modal.umd.cjs +7 -36
- package/package.json +5 -5
|
@@ -1,41 +1,12 @@
|
|
|
1
|
-
(function($,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core")):typeof define=="function"&&define.amd?define(["exports","react","axios","@inertiajs/react","@inertiajs/core"],l):($=typeof globalThis<"u"?globalThis:$||self,l($.InertiaUIModal={},$.React,$.Axios,$.react,$.core))})(this,function($,l,le,ge,Tr){"use strict";var pa=Object.defineProperty;var ma=($,l,le)=>l in $?pa($,l,{enumerable:!0,configurable:!0,writable:!0,value:le}):$[l]=le;var se=($,l,le)=>ma($,typeof l!="symbol"?l+"":l,le);function Sr(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Se=Sr(l),Oe={type:"modal",navigate:!1,modal:{closeButton:!0,closeExplicitly:!1,maxWidth:"2xl",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white rounded",position:"center"},slideover:{closeButton:!0,closeExplicitly:!1,maxWidth:"md",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white min-h-screen",position:"right"}};class Or{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(Oe))}put(e,r){if(typeof e=="object"){this.config={type:e.type??Oe.type,navigate:e.navigate??Oe.navigate,modal:{...Oe.modal,...e.modal??{}},slideover:{...Oe.slideover,...e.slideover??{}}};return}const n=e.split(".");let s=this.config;for(let o=0;o<n.length-1;o++)s=s[n[o]]=s[n[o]]||{};s[n[n.length-1]]=r}get(e){if(typeof e>"u")return this.config;const r=e.split(".");let n=this.config;for(const s of r){if(n[s]===void 0)return null;n=n[s]}return n}}const _e=new Or,Cr=()=>_e.reset(),kr=(t,e)=>_e.put(t,e),Me=t=>_e.get(t),ye=(t,e)=>_e.get(t?`slideover.${e}`:`modal.${e}`);var et={exports:{}},Ce={};/**
|
|
2
|
-
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var xt;function Pr(){if(xt)return Ce;xt=1;var t=l,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(b,u,y){var w,x={},P=null,C=null;y!==void 0&&(P=""+y),u.key!==void 0&&(P=""+u.key),u.ref!==void 0&&(C=u.ref);for(w in u)n.call(u,w)&&!o.hasOwnProperty(w)&&(x[w]=u[w]);if(b&&b.defaultProps)for(w in u=b.defaultProps,u)x[w]===void 0&&(x[w]=u[w]);return{$$typeof:e,type:b,key:P,ref:C,props:x,_owner:s.current}}return Ce.Fragment=r,Ce.jsx=i,Ce.jsxs=i,Ce}var ke={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Et;function jr(){return Et||(Et=1,process.env.NODE_ENV!=="production"&&function(){var t=l,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),b=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),m=Symbol.iterator,T="@@iterator";function f(a){if(a===null||typeof a!="object")return null;var h=m&&a[m]||a[T];return typeof h=="function"?h:null}var v=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(a){{for(var h=arguments.length,E=new Array(h>1?h-1:0),j=1;j<h;j++)E[j-1]=arguments[j];O("error",a,E)}}function O(a,h,E){{var j=v.ReactDebugCurrentFrame,L=j.getStackAddendum();L!==""&&(h+="%s",E=E.concat([L]));var U=E.map(function(_){return String(_)});U.unshift("Warning: "+h),Function.prototype.apply.call(console[a],console,U)}}var k=!1,g=!1,D=!1,H=!1,G=!1,Z;Z=Symbol.for("react.module.reference");function X(a){return!!(typeof a=="string"||typeof a=="function"||a===n||a===o||G||a===s||a===y||a===w||H||a===C||k||g||D||typeof a=="object"&&a!==null&&(a.$$typeof===P||a.$$typeof===x||a.$$typeof===i||a.$$typeof===b||a.$$typeof===u||a.$$typeof===Z||a.getModuleId!==void 0))}function z(a,h,E){var j=a.displayName;if(j)return j;var L=h.displayName||h.name||"";return L!==""?E+"("+L+")":E}function A(a){return a.displayName||"Context"}function d(a){if(a==null)return null;if(typeof a.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case n:return"Fragment";case r:return"Portal";case o:return"Profiler";case s:return"StrictMode";case y:return"Suspense";case w:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case b:var h=a;return A(h)+".Consumer";case i:var E=a;return A(E._context)+".Provider";case u:return z(a,a.render,"ForwardRef");case x:var j=a.displayName||null;return j!==null?j:d(a.type)||"Memo";case P:{var L=a,U=L._payload,_=L._init;try{return d(_(U))}catch{return null}}}return null}var c=Object.assign,S=0,M,R,W,N,B,K,re;function V(){}V.__reactDisabledLog=!0;function ne(){{if(S===0){M=console.log,R=console.info,W=console.warn,N=console.error,B=console.group,K=console.groupCollapsed,re=console.groupEnd;var a={configurable:!0,enumerable:!0,value:V,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}S++}}function ee(){{if(S--,S===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:c({},a,{value:M}),info:c({},a,{value:R}),warn:c({},a,{value:W}),error:c({},a,{value:N}),group:c({},a,{value:B}),groupCollapsed:c({},a,{value:K}),groupEnd:c({},a,{value:re})})}S<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=v.ReactCurrentDispatcher,ie;function te(a,h,E){{if(ie===void 0)try{throw Error()}catch(L){var j=L.stack.trim().match(/\n( *(at )?)/);ie=j&&j[1]||""}return`
|
|
18
|
-
`+ie+a}}var ue=!1,Je;{var Kn=typeof WeakMap=="function"?WeakMap:Map;Je=new Kn}function or(a,h){if(!a||ue)return"";{var E=Je.get(a);if(E!==void 0)return E}var j;ue=!0;var L=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var U;U=fe.current,fe.current=null,ne();try{if(h){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(Q){j=Q}Reflect.construct(a,[],_)}else{try{_.call()}catch(Q){j=Q}a.call(_.prototype)}}else{try{throw Error()}catch(Q){j=Q}a()}}catch(Q){if(Q&&j&&typeof Q.stack=="string"){for(var I=Q.stack.split(`
|
|
19
|
-
`),J=j.stack.split(`
|
|
20
|
-
`),q=I.length-1,Y=J.length-1;q>=1&&Y>=0&&I[q]!==J[Y];)Y--;for(;q>=1&&Y>=0;q--,Y--)if(I[q]!==J[Y]){if(q!==1||Y!==1)do if(q--,Y--,Y<0||I[q]!==J[Y]){var ae=`
|
|
21
|
-
`+I[q].replace(" at new "," at ");return a.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",a.displayName)),typeof a=="function"&&Je.set(a,ae),ae}while(q>=1&&Y>=0);break}}}finally{ue=!1,fe.current=U,ee(),Error.prepareStackTrace=L}var Te=a?a.displayName||a.name:"",be=Te?te(Te):"";return typeof a=="function"&&Je.set(a,be),be}function Hn(a,h,E){return or(a,!1)}function Vn(a){var h=a.prototype;return!!(h&&h.isReactComponent)}function Ze(a,h,E){if(a==null)return"";if(typeof a=="function")return or(a,Vn(a));if(typeof a=="string")return te(a);switch(a){case y:return te("Suspense");case w:return te("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case u:return Hn(a.render);case x:return Ze(a.type,h,E);case P:{var j=a,L=j._payload,U=j._init;try{return Ze(U(L),h,E)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,ur={},dr=v.ReactDebugCurrentFrame;function Qe(a){if(a){var h=a._owner,E=Ze(a.type,a._source,h?h.type:null);dr.setExtraStackFrame(E)}else dr.setExtraStackFrame(null)}function qn(a,h,E,j,L){{var U=Function.call.bind(Ae);for(var _ in a)if(U(a,_)){var I=void 0;try{if(typeof a[_]!="function"){var J=Error((j||"React class")+": "+E+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}I=a[_](h,_,j,E,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(q){I=q}I&&!(I instanceof Error)&&(Qe(L),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",j||"React class",E,_,typeof I),Qe(null)),I instanceof Error&&!(I.message in ur)&&(ur[I.message]=!0,Qe(L),p("Failed %s type: %s",E,I.message),Qe(null))}}}var Yn=Array.isArray;function ht(a){return Yn(a)}function Xn(a){{var h=typeof Symbol=="function"&&Symbol.toStringTag,E=h&&a[Symbol.toStringTag]||a.constructor.name||"Object";return E}}function zn(a){try{return cr(a),!1}catch{return!0}}function cr(a){return""+a}function fr(a){if(zn(a))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xn(a)),cr(a)}var vr=v.ReactCurrentOwner,Gn={key:!0,ref:!0,__self:!0,__source:!0},pr,mr;function Jn(a){if(Ae.call(a,"ref")){var h=Object.getOwnPropertyDescriptor(a,"ref").get;if(h&&h.isReactWarning)return!1}return a.ref!==void 0}function Zn(a){if(Ae.call(a,"key")){var h=Object.getOwnPropertyDescriptor(a,"key").get;if(h&&h.isReactWarning)return!1}return a.key!==void 0}function Qn(a,h){typeof a.ref=="string"&&vr.current}function ea(a,h){{var E=function(){pr||(pr=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",h))};E.isReactWarning=!0,Object.defineProperty(a,"key",{get:E,configurable:!0})}}function ta(a,h){{var E=function(){mr||(mr=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",h))};E.isReactWarning=!0,Object.defineProperty(a,"ref",{get:E,configurable:!0})}}var ra=function(a,h,E,j,L,U,_){var I={$$typeof:e,type:a,key:h,ref:E,props:_,_owner:U};return I._store={},Object.defineProperty(I._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(I,"_self",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.defineProperty(I,"_source",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.freeze&&(Object.freeze(I.props),Object.freeze(I)),I};function na(a,h,E,j,L){{var U,_={},I=null,J=null;E!==void 0&&(fr(E),I=""+E),Zn(h)&&(fr(h.key),I=""+h.key),Jn(h)&&(J=h.ref,Qn(h,L));for(U in h)Ae.call(h,U)&&!Gn.hasOwnProperty(U)&&(_[U]=h[U]);if(a&&a.defaultProps){var q=a.defaultProps;for(U in q)_[U]===void 0&&(_[U]=q[U])}if(I||J){var Y=typeof a=="function"?a.displayName||a.name||"Unknown":a;I&&ea(_,Y),J&&ta(_,Y)}return ra(a,I,J,L,j,vr.current,_)}}var bt=v.ReactCurrentOwner,hr=v.ReactDebugCurrentFrame;function Ee(a){if(a){var h=a._owner,E=Ze(a.type,a._source,h?h.type:null);hr.setExtraStackFrame(E)}else hr.setExtraStackFrame(null)}var gt;gt=!1;function yt(a){return typeof a=="object"&&a!==null&&a.$$typeof===e}function br(){{if(bt.current){var a=d(bt.current.type);if(a)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+a+"`."}return""}}function aa(a){return""}var gr={};function ia(a){{var h=br();if(!h){var E=typeof a=="string"?a:a.displayName||a.name;E&&(h=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+E+">.")}return h}}function yr(a,h){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var E=ia(h);if(gr[E])return;gr[E]=!0;var j="";a&&a._owner&&a._owner!==bt.current&&(j=" It was passed a child from "+d(a._owner.type)+"."),Ee(a),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',E,j),Ee(null)}}function wr(a,h){{if(typeof a!="object")return;if(ht(a))for(var E=0;E<a.length;E++){var j=a[E];yt(j)&&yr(j,h)}else if(yt(a))a._store&&(a._store.validated=!0);else if(a){var L=f(a);if(typeof L=="function"&&L!==a.entries)for(var U=L.call(a),_;!(_=U.next()).done;)yt(_.value)&&yr(_.value,h)}}}function sa(a){{var h=a.type;if(h==null||typeof h=="string")return;var E;if(typeof h=="function")E=h.propTypes;else if(typeof h=="object"&&(h.$$typeof===u||h.$$typeof===x))E=h.propTypes;else return;if(E){var j=d(h);qn(E,a.props,"prop",j,a)}else if(h.PropTypes!==void 0&&!gt){gt=!0;var L=d(h);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",L||"Unknown")}typeof h.getDefaultProps=="function"&&!h.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function la(a){{for(var h=Object.keys(a.props),E=0;E<h.length;E++){var j=h[E];if(j!=="children"&&j!=="key"){Ee(a),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",j),Ee(null);break}}a.ref!==null&&(Ee(a),p("Invalid attribute `ref` supplied to `React.Fragment`."),Ee(null))}}var xr={};function Er(a,h,E,j,L,U){{var _=X(a);if(!_){var I="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(I+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=aa();J?I+=J:I+=br();var q;a===null?q="null":ht(a)?q="array":a!==void 0&&a.$$typeof===e?(q="<"+(d(a.type)||"Unknown")+" />",I=" Did you accidentally export a JSX literal instead of a component?"):q=typeof a,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,I)}var Y=na(a,h,E,L,U);if(Y==null)return Y;if(_){var ae=h.children;if(ae!==void 0)if(j)if(ht(ae)){for(var Te=0;Te<ae.length;Te++)wr(ae[Te],a);Object.freeze&&Object.freeze(ae)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else wr(ae,a)}if(Ae.call(h,"key")){var be=d(a),Q=Object.keys(h).filter(function(va){return va!=="key"}),wt=Q.length>0?"{key: someKey, "+Q.join(": ..., ")+": ...}":"{key: someKey}";if(!xr[be+wt]){var fa=Q.length>0?"{"+Q.join(": ..., ")+": ...}":"{}";p(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s {...props} />
|
|
28
|
-
React keys must be passed directly to JSX without using spread:
|
|
29
|
-
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,wt,be,fa,be),xr[be+wt]=!0}}return a===n?la(Y):sa(Y),Y}}function oa(a,h,E){return Er(a,h,E,!0)}function ua(a,h,E){return Er(a,h,E,!1)}var da=ua,ca=oa;ke.Fragment=n,ke.jsx=da,ke.jsxs=ca}()),ke}process.env.NODE_ENV==="production"?et.exports=Pr():et.exports=jr();var F=et.exports;const Tt={modifiedElements:[],bodyState:{hasOverflowHidden:!1,hasPointerEventsNone:!1,originalPaddingRight:""},prepare(){const t=window.innerWidth-document.documentElement.clientWidth;this.bodyState.originalPaddingRight=document.body.style.paddingRight;const e=parseInt(window.getComputedStyle(document.body).paddingRight,10);document.body.style.paddingRight=`${e+t}px`,document.body.classList.contains("overflow-hidden")||(document.body.classList.add("overflow-hidden"),this.bodyState.hasOverflowHidden=!0),document.body.classList.contains("pointer-events-none")||(document.body.classList.add("pointer-events-none"),this.bodyState.hasPointerEventsNone=!0),Array.from(document.body.children).forEach(r=>{!r.classList.contains("im-dialog")&&r.getAttribute("aria-hidden")!=="true"&&(r.setAttribute("aria-hidden","true"),this.modifiedElements.push(r))})},cleanup(){this.bodyState.hasOverflowHidden&&(document.body.classList.remove("overflow-hidden"),this.bodyState.hasOverflowHidden=!1),this.bodyState.hasPointerEventsNone&&(document.body.classList.remove("pointer-events-none"),this.bodyState.hasPointerEventsNone=!1),document.body.style.paddingRight=this.bodyState.originalPaddingRight,this.bodyState.originalPaddingRight="",this.modifiedElements.forEach(t=>{t.removeAttribute("aria-hidden")}),this.modifiedElements=[]}};function tt(t="inertiaui_modal_"){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${t}${crypto.randomUUID()}`:`${t}${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}function Fr(t,e){return Array.isArray(t)?t.filter(r=>!e.includes(r)):Object.keys(t).reduce((r,n)=>(e.includes(n)||(r[n]=t[n]),r),{})}function St(t,e){return Array.isArray(t)?t.filter(r=>e.includes(r)):e.reduce((r,n)=>(n in t&&(r[n]=t[n]),r),{})}function Nr(t){return Array.isArray(t)?t.filter(e=>e!==null):Object.keys(t).reduce((e,r)=>(r in t&&t[r]!==null&&(e[r]=t[r]),e),{})}function Ir(t,e=3,r=10){return new Promise((n,s)=>{const o=t();if(o){n(o);return}let i=e*1e3/r;const b=setInterval(()=>{const u=t();u&&(clearInterval(b),n(u)),--i<=0&&(clearInterval(b),s(new Error("Condition not met in time")))},r)})}function Pe(t){return t?(t=t.replace(/_/g,"-"),t=t.replace(/-+/g,"-"),/[A-Z]/.test(t)?(t=t.replace(/\s+/g,"").replace(/_/g,"").replace(/(?:^|\s|-)+([A-Za-z])/g,(e,r)=>r.toUpperCase()),t=t.replace(/(.)(?=[A-Z])/g,"$1-"),t.toLowerCase()):t):""}const Re=l.createContext(null);Re.displayName="ModalStackContext";let Ot=null,Ct=null,je=null,rt=null,nt=[],we={};const kt=({children:t})=>{const[e,r]=l.useState([]),[n,s]=l.useState({}),o=T=>{r(f=>{const v=T([...f]),p=O=>{var k;return v.length<2?!0:((k=v.map(g=>({id:g.id,shouldRender:g.shouldRender})).reverse().find(g=>g.shouldRender))==null?void 0:k.id)===O};return v.forEach((O,k)=>{v[k].onTopOfStack=p(O.id),v[k].getParentModal=()=>k<1?null:v.slice(0,k).reverse().find(g=>g.isOpen),v[k].getChildModal=()=>k===v.length-1?null:v.slice(k+1).find(g=>g.isOpen)}),v})};l.useEffect(()=>{nt=e},[e]);class i{constructor(f,v,p,O,k){se(this,"show",()=>{o(f=>f.map(v=>(v.id===this.id&&!v.isOpen&&(v.isOpen=!0,v.shouldRender=!0),v)))});se(this,"setOpen",f=>{f?this.show():this.close()});se(this,"close",()=>{o(f=>f.map(v=>{var p;return v.id===this.id&&v.isOpen&&(Object.keys(v.listeners).forEach(O=>{v.off(O)}),v.isOpen=!1,(p=v.onCloseCallback)==null||p.call(v)),v}))});se(this,"afterLeave",()=>{this.isOpen||o(f=>{const v=f.map(p=>{var O;return p.id===this.id&&!p.isOpen&&(p.shouldRender=!1,(O=p.afterLeaveCallback)==null||O.call(p),p.afterLeaveCallback=null),p});return this.index===0?[]:v})});se(this,"on",(f,v)=>{f=Pe(f),this.listeners[f]=this.listeners[f]??[],this.listeners[f].push(v)});se(this,"off",(f,v)=>{var p;f=Pe(f),v?this.listeners[f]=((p=this.listeners[f])==null?void 0:p.filter(O=>O!==v))??[]:delete this.listeners[f]});se(this,"emit",(f,...v)=>{var p;(p=this.listeners[Pe(f)])==null||p.forEach(O=>O(...v))});se(this,"registerEventListenersFromProps",f=>{const v=[];return Object.keys(f).filter(p=>p.startsWith("on")).forEach(p=>{const O=Pe(p).replace(/^on-/,"");this.on(O,f[p]),v.push(()=>this.off(O,f[p]))}),()=>v.forEach(p=>p())});se(this,"reload",(f={})=>{var p;let v=Object.keys(this.response.props);f.only&&(v=St(v,f.only)),f.except&&(v=Fr(v,f.except)),(p=this.response)!=null&&p.url&&le.get(this.response.url,{headers:{Accept:"text/html, application/xhtml+xml","X-Inertia":!0,"X-Inertia-Partial-Component":this.response.component,"X-Inertia-Version":this.response.version,"X-Inertia-Partial-Data":v.join(","),"X-InertiaUI-Modal":tt(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":je}}).then(O=>{this.updateProps(O.data.props)})});se(this,"updateProps",f=>{Object.assign(this.props,f),o(v=>v)});if(this.id=v.id??tt(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=f,this.props=v.props,this.response=v,this.config=p??{},this.onCloseCallback=O,this.afterLeaveCallback=k,we[this.id]){this.config={...this.config,...we[this.id].config??{}};const g=we[this.id].onClose,D=we[this.id].onAfterLeave;g&&(this.onCloseCallback=O?()=>{O(),g()}:g),D&&(this.afterLeaveCallback=k?()=>{k(),D()}:D),delete we[this.id]}this.index=-1,this.getParentModal=()=>null,this.getChildModal=()=>null,this.onTopOfStack=!0}static generateId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`inertiaui_modal_${crypto.randomUUID()}`:`inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}}const b=(T,f={},v=null,p=null)=>Ct(T.component).then(O=>u(O,T,f,v,p)),u=(T,f,v,p,O)=>{const k=new i(T,f,v,p,O);return k.index=e.length,o(g=>[...g,k]),k.show(),k};function y(T,f,v,p){if(!n[T])throw new Error(`The local modal "${T}" has not been registered.`);const O=u(null,{},f,v,p);return O.name=T,n[T].callback(O),O}const w=(T,f={})=>x(T,f.method??"get",f.data??{},f.headers??{},f.config??{},f.onClose,f.onAfterLeave,f.queryStringArrayFormat??"brackets",f.navigate??Me("navigate")).then(v=>{const p=f.listeners??{};return Object.keys(p).forEach(O=>{const k=Pe(O);v.on(k,p[O])}),v}),x=(T,f,v={},p={},O={},k=null,g=null,D="brackets",H=!1)=>{const G=tt();return new Promise((Z,X)=>{if(T.startsWith("#")){Z(y(T.substring(1),O,k,g));return}const[z,A]=Tr.mergeDataIntoQueryString(f,T||"",v,D);let d=H&&e.length===0;if(e.length===0&&(je=typeof window<"u"?window.location.href:""),p={...p,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":Ot,"X-InertiaUI-Modal":G,"X-InertiaUI-Modal-Use-Router":d?1:0,"X-InertiaUI-Modal-Base-Url":je},d)return rt=null,we[G]={config:O,onClose:k,onAfterLeave:g},ge.router.visit(z,{method:f,data:A,headers:p,preserveScroll:!0,preserveState:!0,onError:X,onFinish:()=>{Ir(()=>rt).then(Z)}});le({url:z,method:f,data:A,headers:p}).then(c=>Z(b(c.data,O,k,g))).catch(c=>{X(c)})})},m={stack:e,localModals:n,push:u,pushFromResponseData:b,closeAll:()=>{nt.reverse().forEach(T=>T.close())},reset:()=>o(()=>[]),visit:x,visitModal:w,registerLocalModal:(T,f)=>{s(v=>({...v,[T]:{name:T,callback:f}}))},removeLocalModal:T=>{s(f=>{const v={...f};return delete v[T],v})}};return F.jsx(Re.Provider,{value:m,children:t})},Fe=()=>{const t=l.useContext(Re);if(t===null)throw new Error("useModalStack must be used within a ModalStackProvider");return t},Pt=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],jt=t=>{t.initialPage&&(Ot=t.initialPage.version),t.resolveComponent&&(Ct=t.resolveComponent)},Ar=(t,e)=>{jt(e);const r=({Component:n,props:s,key:o})=>{const i=()=>{const b=l.createElement(n,{key:o,...s});return typeof n.layout=="function"?n.layout(b):Array.isArray(n.layout)?n.layout.concat(b).reverse().reduce((y,w)=>l.createElement(w,s,y)):b};return F.jsxs(F.Fragment,{children:[i(),F.jsx(Ft,{})]})};return F.jsx(kt,{children:F.jsx(t,{...e,children:r})})},Ft=({children:t})=>{var b;const e=l.useContext(Re);let r=!1,n=!1;l.useEffect(()=>ge.router.on("start",()=>r=!0),[]),l.useEffect(()=>ge.router.on("finish",()=>r=!1),[]),l.useEffect(()=>ge.router.on("navigate",function(u){const y=u.detail.page.props._inertiaui_modal;if(!y){n&&e.closeAll();return}n=y,je=y.baseUrl,e.pushFromResponseData(y,{},()=>{if(!y.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!r&&window.location.href!==y.baseUrl&&ge.router.visit(y.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(w=>{rt=w})}),[]);const s=u=>(nt.length&&(u.headers["X-InertiaUI-Modal-Base-Url"]=je),u);l.useEffect(()=>(le.interceptors.request.use(s),()=>le.interceptors.request.eject(s)),[]);const o=ge.usePage(),i=l.useRef();return l.useEffect(()=>{var w,x;const u=(w=o.props)==null?void 0:w._inertiaui_modal,y=i.current;i.current=u,u&&y&&u.component===y.component&&u.url===y.url&&((x=e.stack[0])==null||x.updateProps(u.props??{}))},[(b=o.props)==null?void 0:b._inertiaui_modal]),F.jsxs(F.Fragment,{children:[t,e.stack.length>0&&F.jsx(Nt,{index:0})]})},at=l.createContext(null);at.displayName="ModalIndexContext";const it=()=>{const t=l.useContext(at);if(t===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return t},Nt=({index:t})=>{const{stack:e}=Fe(),r=l.useMemo(()=>e[t],[e,t]);return(r==null?void 0:r.component)&&F.jsx(at.Provider,{value:t,children:F.jsx(r.component,{...r.props,onModalEvent:(...n)=>r.emit(...n)})})},st=l.forwardRef(({name:t,children:e,onFocus:r=null,onBlur:n=null,onClose:s=null,onSuccess:o=null,...i},b)=>{const u=it(),{stack:y,registerLocalModal:w,removeLocalModal:x}=Fe(),[P,C]=l.useState(null),m=l.useMemo(()=>t?P:y[u],[t,P,u,y]),T=l.useMemo(()=>{var g;return(g=y.find(D=>D.shouldRender&&D.index>(m==null?void 0:m.index)))==null?void 0:g.index},[u,y]),f=l.useMemo(()=>(m==null?void 0:m.config.slideover)??i.slideover??Me("type")==="slideover",[i.slideover]),v=l.useMemo(()=>({slideover:f,closeButton:i.closeButton??ye(f,"closeButton"),closeExplicitly:i.closeExplicitly??ye(f,"closeExplicitly"),maxWidth:i.maxWidth??ye(f,"maxWidth"),paddingClasses:i.paddingClasses??ye(f,"paddingClasses"),panelClasses:i.panelClasses??ye(f,"panelClasses"),position:i.position??ye(f,"position"),...m==null?void 0:m.config}),[i,m==null?void 0:m.config]);l.useEffect(()=>{if(t){let g=null;return w(t,D=>{g=D.registerEventListenersFromProps(i),C(D)}),()=>{g==null||g(),g=null,x(t)}}return m.registerEventListenersFromProps(i)},[t]);const p=l.useRef(m);l.useEffect(()=>{p.current=m},[m]),l.useEffect(()=>{m!==null&&(m.isOpen?o==null||o():s==null||s())},[m==null?void 0:m.isOpen]);const[O,k]=l.useState(!1);return l.useEffect(()=>{O&&m!==null&&m.isOpen&&(m.onTopOfStack?r==null||r():n==null||n()),k(!0)},[m==null?void 0:m.onTopOfStack]),l.useImperativeHandle(b,()=>({afterLeave:()=>{var g;return(g=p.current)==null?void 0:g.afterLeave()},close:()=>{var g;return(g=p.current)==null?void 0:g.close()},emit:(...g)=>{var D;return(D=p.current)==null?void 0:D.emit(...g)},getChildModal:()=>{var g;return(g=p.current)==null?void 0:g.getChildModal()},getParentModal:()=>{var g;return(g=p.current)==null?void 0:g.getParentModal()},reload:(...g)=>{var D;return(D=p.current)==null?void 0:D.reload(...g)},setOpen:()=>{var g;return(g=p.current)==null?void 0:g.setOpen()},get id(){var g;return(g=p.current)==null?void 0:g.id},get index(){var g;return(g=p.current)==null?void 0:g.index},get isOpen(){var g;return(g=p.current)==null?void 0:g.isOpen},get config(){var g;return(g=p.current)==null?void 0:g.config},get modalContext(){return p.current},get onTopOfStack(){var g;return(g=p.current)==null?void 0:g.onTopOfStack},get shouldRender(){var g;return(g=p.current)==null?void 0:g.shouldRender}}),[m]),(m==null?void 0:m.shouldRender)&&F.jsxs(F.Fragment,{children:[typeof e=="function"?e({afterLeave:m.afterLeave,close:m.close,config:v,emit:m.emit,getChildModal:m.getChildModal,getParentModal:m.getParentModal,id:m.id,index:m.index,isOpen:m.isOpen,modalContext:m,onTopOfStack:m.onTopOfStack,reload:m.reload,setOpen:m.setOpen,shouldRender:m.shouldRender}):e,T&&F.jsx(Nt,{index:T})]})});st.displayName="HeadlessModal";function It(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=It(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function De(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=It(t))&&(n&&(n+=" "),n+=e);return n}var _r=Object.defineProperty,Mr=(t,e,r)=>e in t?_r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lt=(t,e,r)=>(Mr(t,typeof e!="symbol"?e+"":e,r),r);let Rr=class{constructor(){lt(this,"current",this.detect()),lt(this,"handoffState","pending"),lt(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"}},Le=new Rr;function Dr(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function $e(){let t=[],e={addEventListener(r,n,s,o){return r.addEventListener(n,s,o),e.add(()=>r.removeEventListener(n,s,o))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return e.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return e.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Dr(()=>{n.current&&r[0]()}),e.add(()=>{n.current=!1})},style(r,n,s){let o=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:s}),this.add(()=>{Object.assign(r.style,{[n]:o})})},group(r){let n=$e();return r(n),this.add(()=>n.dispose())},add(r){return t.includes(r)||t.push(r),()=>{let n=t.indexOf(r);if(n>=0)for(let s of t.splice(n,1))s()}},dispose(){for(let r of t.splice(0))r()}};return e}function At(){let[t]=l.useState($e);return l.useEffect(()=>()=>t.dispose(),[t]),t}let de=(t,e)=>{Le.isServer?l.useEffect(t,e):l.useLayoutEffect(t,e)};function _t(t){let e=l.useRef(t);return de(()=>{e.current=t},[t]),e}let oe=function(t){let e=_t(t);return l.useCallback((...r)=>e.current(...r),[e])};function ot(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function We(t,e,...r){if(t in e){let s=e[t];return typeof s=="function"?s(...r):s}let n=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(s=>`"${s}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,We),n}var Mt=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(Mt||{}),ce=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(ce||{});function Rt(){let t=$r();return l.useCallback(e=>Lr({mergeRefs:t,...e}),[t])}function Lr({ourProps:t,theirProps:e,slot:r,defaultTag:n,features:s,visible:o=!0,name:i,mergeRefs:b}){b=b??Wr;let u=Dt(e,t);if(o)return Ue(u,r,n,i,b);let y=s??0;if(y&2){let{static:w=!1,...x}=u;if(w)return Ue(x,r,n,i,b)}if(y&1){let{unmount:w=!0,...x}=u;return We(w?0:1,{0(){return null},1(){return Ue({...x,hidden:!0,style:{display:"none"}},r,n,i,b)}})}return Ue(u,r,n,i,b)}function Ue(t,e={},r,n,s){let{as:o=r,children:i,refName:b="ref",...u}=dt(t,["unmount","static"]),y=t.ref!==void 0?{[b]:t.ref}:{},w=typeof i=="function"?i(e):i;"className"in u&&u.className&&typeof u.className=="function"&&(u.className=u.className(e)),u["aria-labelledby"]&&u["aria-labelledby"]===u.id&&(u["aria-labelledby"]=void 0);let x={};if(e){let P=!1,C=[];for(let[m,T]of Object.entries(e))typeof T=="boolean"&&(P=!0),T===!0&&C.push(m.replace(/([A-Z])/g,f=>`-${f.toLowerCase()}`));if(P){x["data-headlessui-state"]=C.join(" ");for(let m of C)x[`data-${m}`]=""}}if(o===l.Fragment&&(Object.keys(ve(u)).length>0||Object.keys(ve(x)).length>0))if(!l.isValidElement(w)||Array.isArray(w)&&w.length>1){if(Object.keys(ve(u)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ve(u)).concat(Object.keys(ve(x))).map(P=>` - ${P}`).join(`
|
|
31
|
-
`),"","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(P=>` - ${P}`).join(`
|
|
1
|
+
(function(C,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react"),require("react/jsx-runtime"),require("axios"),require("@inertiajs/react"),require("@inertiajs/core")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime","axios","@inertiajs/react","@inertiajs/core"],s):(C=typeof globalThis<"u"?globalThis:C||self,s(C.InertiaUIModal={},C.React,C.jsxRuntime,C.Axios,C.react,C.core))})(this,function(C,s,T,he,te,Mt){"use strict";var Yn=Object.defineProperty;var Jn=(C,s,T)=>s in C?Yn(C,s,{enumerable:!0,configurable:!0,writable:!0,value:T}):C[s]=T;var q=(C,s,T)=>Jn(C,typeof s!="symbol"?s+"":s,T);function At(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const ie=At(s),se={type:"modal",navigate:!1,modal:{closeButton:!0,closeExplicitly:!1,maxWidth:"2xl",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white rounded",position:"center"},slideover:{closeButton:!0,closeExplicitly:!1,maxWidth:"md",paddingClasses:"p-4 sm:p-6",panelClasses:"bg-white min-h-screen",position:"right"}};class Lt{constructor(){this.config={},this.reset()}reset(){this.config=JSON.parse(JSON.stringify(se))}put(e,n){if(typeof e=="object"){this.config={type:e.type??se.type,navigate:e.navigate??se.navigate,modal:{...se.modal,...e.modal??{}},slideover:{...se.slideover,...e.slideover??{}}};return}const r=e.split(".");let i=this.config;for(let l=0;l<r.length-1;l++)i=i[r[l]]=i[r[l]]||{};i[r[r.length-1]]=n}get(e){if(typeof e>"u")return this.config;const n=e.split(".");let r=this.config;for(const i of n){if(r[i]===void 0)return null;r=r[i]}return r}}const ve=new Lt,jt=()=>ve.reset(),Dt=(t,e)=>ve.put(t,e),pe=t=>ve.get(t),ne=(t,e)=>ve.get(t?`slideover.${e}`:`modal.${e}`),ze={modifiedElements:[],bodyState:{hasOverflowHidden:!1,hasPointerEventsNone:!1,originalPaddingRight:""},prepare(){const t=window.innerWidth-document.documentElement.clientWidth;this.bodyState.originalPaddingRight=document.body.style.paddingRight;const e=parseInt(window.getComputedStyle(document.body).paddingRight,10);document.body.style.paddingRight=`${e+t}px`,document.body.classList.contains("overflow-hidden")||(document.body.classList.add("overflow-hidden"),this.bodyState.hasOverflowHidden=!0),document.body.classList.contains("pointer-events-none")||(document.body.classList.add("pointer-events-none"),this.bodyState.hasPointerEventsNone=!0),Array.from(document.body.children).forEach(n=>{!n.classList.contains("im-dialog")&&n.getAttribute("aria-hidden")!=="true"&&(n.setAttribute("aria-hidden","true"),this.modifiedElements.push(n))})},cleanup(){this.bodyState.hasOverflowHidden&&(document.body.classList.remove("overflow-hidden"),this.bodyState.hasOverflowHidden=!1),this.bodyState.hasPointerEventsNone&&(document.body.classList.remove("pointer-events-none"),this.bodyState.hasPointerEventsNone=!1),document.body.style.paddingRight=this.bodyState.originalPaddingRight,this.bodyState.originalPaddingRight="",this.modifiedElements.forEach(t=>{t.removeAttribute("aria-hidden")}),this.modifiedElements=[]}};function Me(t="inertiaui_modal_"){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${t}${crypto.randomUUID()}`:`${t}${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}function $t(t,e){return Array.isArray(t)?t.filter(n=>!e.includes(n)):Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{})}function Ge(t,e){return Array.isArray(t)?t.filter(n=>e.includes(n)):e.reduce((n,r)=>(r in t&&(n[r]=t[r]),n),{})}function Ut(t){return Array.isArray(t)?t.filter(e=>e!==null):Object.keys(t).reduce((e,n)=>(n in t&&t[n]!==null&&(e[n]=t[n]),e),{})}function Wt(t,e=3,n=10){return new Promise((r,i)=>{const l=t();if(l){r(l);return}let a=e*1e3/n;const v=setInterval(()=>{const o=t();o&&(clearInterval(v),r(o)),--a<=0&&(clearInterval(v),i(new Error("Condition not met in time")))},n)})}function le(t){return t?(t=t.replace(/_/g,"-"),t=t.replace(/-+/g,"-"),/[A-Z]/.test(t)?(t=t.replace(/\s+/g,"").replace(/_/g,"").replace(/(?:^|\s|-)+([A-Za-z])/g,(e,n)=>n.toUpperCase()),t=t.replace(/(.)(?=[A-Z])/g,"$1-"),t.toLowerCase()):t):""}const me=s.createContext(null);me.displayName="ModalStackContext";let Ze=null,Ye=null,oe=null,Ae=null,Le=[],re={};const Je=({children:t})=>{const[e,n]=s.useState([]),[r,i]=s.useState({}),l=y=>{n(c=>{const h=y([...c]),p=w=>{var N;return h.length<2?!0:((N=h.map(m=>({id:m.id,shouldRender:m.shouldRender})).reverse().find(m=>m.shouldRender))==null?void 0:N.id)===w};return h.forEach((w,N)=>{h[N].onTopOfStack=p(w.id),h[N].getParentModal=()=>N<1?null:h.slice(0,N).reverse().find(m=>m.isOpen),h[N].getChildModal=()=>N===h.length-1?null:h.slice(N+1).find(m=>m.isOpen)}),h})};s.useEffect(()=>{Le=e},[e]);class a{constructor(c,h,p,w,N){q(this,"show",()=>{l(c=>c.map(h=>(h.id===this.id&&!h.isOpen&&(h.isOpen=!0,h.shouldRender=!0),h)))});q(this,"setOpen",c=>{c?this.show():this.close()});q(this,"close",()=>{l(c=>c.map(h=>{var p;return h.id===this.id&&h.isOpen&&(Object.keys(h.listeners).forEach(w=>{h.off(w)}),h.isOpen=!1,(p=h.onCloseCallback)==null||p.call(h)),h}))});q(this,"afterLeave",()=>{this.isOpen||l(c=>{const h=c.map(p=>{var w;return p.id===this.id&&!p.isOpen&&(p.shouldRender=!1,(w=p.afterLeaveCallback)==null||w.call(p),p.afterLeaveCallback=null),p});return this.index===0?[]:h})});q(this,"on",(c,h)=>{c=le(c),this.listeners[c]=this.listeners[c]??[],this.listeners[c].push(h)});q(this,"off",(c,h)=>{var p;c=le(c),h?this.listeners[c]=((p=this.listeners[c])==null?void 0:p.filter(w=>w!==h))??[]:delete this.listeners[c]});q(this,"emit",(c,...h)=>{var p;(p=this.listeners[le(c)])==null||p.forEach(w=>w(...h))});q(this,"registerEventListenersFromProps",c=>{const h=[];return Object.keys(c).filter(p=>p.startsWith("on")).forEach(p=>{const w=le(p).replace(/^on-/,"");this.on(w,c[p]),h.push(()=>this.off(w,c[p]))}),()=>h.forEach(p=>p())});q(this,"reload",(c={})=>{var p;let h=Object.keys(this.response.props);c.only&&(h=Ge(h,c.only)),c.except&&(h=$t(h,c.except)),(p=this.response)!=null&&p.url&&he.get(this.response.url,{headers:{Accept:"text/html, application/xhtml+xml","X-Inertia":!0,"X-Inertia-Partial-Component":this.response.component,"X-Inertia-Version":this.response.version,"X-Inertia-Partial-Data":h.join(","),"X-InertiaUI-Modal":Me(),"X-InertiaUI-Modal-Use-Router":0,"X-InertiaUI-Modal-Base-Url":oe}}).then(w=>{this.updateProps(w.data.props)})});q(this,"updateProps",c=>{Object.assign(this.props,c),l(h=>h)});if(this.id=h.id??Me(),this.isOpen=!1,this.shouldRender=!1,this.listeners={},this.component=c,this.props=h.props,this.response=h,this.config=p??{},this.onCloseCallback=w,this.afterLeaveCallback=N,re[this.id]){this.config={...this.config,...re[this.id].config??{}};const m=re[this.id].onClose,P=re[this.id].onAfterLeave;m&&(this.onCloseCallback=w?()=>{w(),m()}:m),P&&(this.afterLeaveCallback=N?()=>{N(),P()}:P),delete re[this.id]}this.index=-1,this.getParentModal=()=>null,this.getChildModal=()=>null,this.onTopOfStack=!0}static generateId(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`inertiaui_modal_${crypto.randomUUID()}`:`inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2,9)}`}}const v=(y,c={},h=null,p=null)=>Ye(y.component).then(w=>o(w,y,c,h,p)),o=(y,c,h,p,w)=>{const N=new a(y,c,h,p,w);return N.index=e.length,l(m=>[...m,N]),N.show(),N};function b(y,c,h,p){if(!r[y])throw new Error(`The local modal "${y}" has not been registered.`);const w=o(null,{},c,h,p);return w.name=y,r[y].callback(w),w}const g=(y,c={})=>E(y,c.method??"get",c.data??{},c.headers??{},c.config??{},c.onClose,c.onAfterLeave,c.queryStringArrayFormat??"brackets",c.navigate??pe("navigate")).then(h=>{const p=c.listeners??{};return Object.keys(p).forEach(w=>{const N=le(w);h.on(N,p[w])}),h}),E=(y,c,h={},p={},w={},N=null,m=null,P="brackets",j=!1)=>{const B=Me();return new Promise((H,U)=>{if(y.startsWith("#")){H(b(y.substring(1),w,N,m));return}const[W,k]=Mt.mergeDataIntoQueryString(c,y||"",h,P);let u=j&&e.length===0;if(e.length===0&&(oe=typeof window<"u"?window.location.href:""),p={...p,Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0,"X-Inertia-Version":Ze,"X-InertiaUI-Modal":B,"X-InertiaUI-Modal-Use-Router":u?1:0,"X-InertiaUI-Modal-Base-Url":oe},u)return Ae=null,re[B]={config:w,onClose:N,onAfterLeave:m},te.router.visit(W,{method:c,data:k,headers:p,preserveScroll:!0,preserveState:!0,onError:U,onFinish:()=>{Wt(()=>Ae).then(H)}});he({url:W,method:c,data:k,headers:p}).then(d=>H(v(d.data,w,N,m))).catch(d=>{U(d)})})},f={stack:e,localModals:r,push:o,pushFromResponseData:v,closeAll:()=>{Le.reverse().forEach(y=>y.close())},reset:()=>l(()=>[]),visit:E,visitModal:g,registerLocalModal:(y,c)=>{i(h=>({...h,[y]:{name:y,callback:c}}))},removeLocalModal:y=>{i(c=>{const h={...c};return delete h[y],h})}};return T.jsx(me.Provider,{value:f,children:t})},ue=()=>{const t=s.useContext(me);if(t===null)throw new Error("useModalStack must be used within a ModalStackProvider");return t},Qe=["closeButton","closeExplicitly","maxWidth","paddingClasses","panelClasses","position","slideover"],Re=t=>{t.initialPage&&(Ze=t.initialPage.version),t.resolveComponent&&(Ye=t.resolveComponent)},Bt=(t,e)=>{Re(e);const n=({Component:r,props:i,key:l})=>{const a=()=>{const v=s.createElement(r,{key:l,...i});return typeof r.layout=="function"?r.layout(v):Array.isArray(r.layout)?r.layout.concat(v).reverse().reduce((b,g)=>s.createElement(g,i,b)):v};return T.jsxs(T.Fragment,{children:[a(),T.jsx(et,{})]})};return T.jsx(Je,{children:T.jsx(t,{...e,children:n})})},et=({children:t})=>{var v;const e=s.useContext(me);let n=!1,r=!1;s.useEffect(()=>te.router.on("start",()=>n=!0),[]),s.useEffect(()=>te.router.on("finish",()=>n=!1),[]),s.useEffect(()=>te.router.on("navigate",function(o){const b=o.detail.page.props._inertiaui_modal;if(!b){r&&e.closeAll();return}r=b,oe=b.baseUrl,e.pushFromResponseData(b,{},()=>{if(!b.baseUrl){console.error("No base url in modal response data so cannot navigate back");return}!n&&window.location.href!==b.baseUrl&&te.router.visit(b.baseUrl,{preserveScroll:!0,preserveState:!0})}).then(g=>{Ae=g})}),[]);const i=o=>(Le.length&&(o.headers["X-InertiaUI-Modal-Base-Url"]=oe),o);s.useEffect(()=>(he.interceptors.request.use(i),()=>he.interceptors.request.eject(i)),[]);const l=te.usePage(),a=s.useRef();return s.useEffect(()=>{var g,E;const o=(g=l.props)==null?void 0:g._inertiaui_modal,b=a.current;a.current=o,o&&b&&o.component===b.component&&o.url===b.url&&((E=e.stack[0])==null||E.updateProps(o.props??{}))},[(v=l.props)==null?void 0:v._inertiaui_modal]),T.jsxs(T.Fragment,{children:[t,e.stack.length>0&&T.jsx(tt,{index:0})]})},je=s.createContext(null);je.displayName="ModalIndexContext";const De=()=>{const t=s.useContext(je);if(t===void 0)throw new Error("useModalIndex must be used within a ModalIndexProvider");return t},tt=({index:t})=>{const{stack:e}=ue(),n=s.useMemo(()=>e[t],[e,t]);return(n==null?void 0:n.component)&&T.jsx(je.Provider,{value:t,children:T.jsx(n.component,{...n.props,onModalEvent:(...r)=>n.emit(...r)})})},$e=s.forwardRef(({name:t,children:e,onFocus:n=null,onBlur:r=null,onClose:i=null,onSuccess:l=null,...a},v)=>{const o=De(),{stack:b,registerLocalModal:g,removeLocalModal:E}=ue(),[F,S]=s.useState(null),f=s.useMemo(()=>t?F:b[o],[t,F,o,b]),y=s.useMemo(()=>{var m;return(m=b.find(P=>P.shouldRender&&P.index>(f==null?void 0:f.index)))==null?void 0:m.index},[o,b]),c=s.useMemo(()=>(f==null?void 0:f.config.slideover)??a.slideover??pe("type")==="slideover",[a.slideover]),h=s.useMemo(()=>({slideover:c,closeButton:a.closeButton??ne(c,"closeButton"),closeExplicitly:a.closeExplicitly??ne(c,"closeExplicitly"),maxWidth:a.maxWidth??ne(c,"maxWidth"),paddingClasses:a.paddingClasses??ne(c,"paddingClasses"),panelClasses:a.panelClasses??ne(c,"panelClasses"),position:a.position??ne(c,"position"),...f==null?void 0:f.config}),[a,f==null?void 0:f.config]);s.useEffect(()=>{if(t){let m=null;return g(t,P=>{m=P.registerEventListenersFromProps(a),S(P)}),()=>{m==null||m(),m=null,E(t)}}return f.registerEventListenersFromProps(a)},[t]);const p=s.useRef(f);s.useEffect(()=>{p.current=f},[f]),s.useEffect(()=>{f!==null&&(f.isOpen?l==null||l():i==null||i())},[f==null?void 0:f.isOpen]);const[w,N]=s.useState(!1);return s.useEffect(()=>{w&&f!==null&&f.isOpen&&(f.onTopOfStack?n==null||n():r==null||r()),N(!0)},[f==null?void 0:f.onTopOfStack]),s.useImperativeHandle(v,()=>({afterLeave:()=>{var m;return(m=p.current)==null?void 0:m.afterLeave()},close:()=>{var m;return(m=p.current)==null?void 0:m.close()},emit:(...m)=>{var P;return(P=p.current)==null?void 0:P.emit(...m)},getChildModal:()=>{var m;return(m=p.current)==null?void 0:m.getChildModal()},getParentModal:()=>{var m;return(m=p.current)==null?void 0:m.getParentModal()},reload:(...m)=>{var P;return(P=p.current)==null?void 0:P.reload(...m)},setOpen:()=>{var m;return(m=p.current)==null?void 0:m.setOpen()},get id(){var m;return(m=p.current)==null?void 0:m.id},get index(){var m;return(m=p.current)==null?void 0:m.index},get isOpen(){var m;return(m=p.current)==null?void 0:m.isOpen},get config(){var m;return(m=p.current)==null?void 0:m.config},get modalContext(){return p.current},get onTopOfStack(){var m;return(m=p.current)==null?void 0:m.onTopOfStack},get shouldRender(){var m;return(m=p.current)==null?void 0:m.shouldRender}}),[f]),(f==null?void 0:f.shouldRender)&&T.jsxs(T.Fragment,{children:[typeof e=="function"?e({afterLeave:f.afterLeave,close:f.close,config:h,emit:f.emit,getChildModal:f.getChildModal,getParentModal:f.getParentModal,id:f.id,index:f.index,isOpen:f.isOpen,modalContext:f,onTopOfStack:f.onTopOfStack,reload:f.reload,setOpen:f.setOpen,shouldRender:f.shouldRender}):e,y&&T.jsx(tt,{index:y})]})});$e.displayName="HeadlessModal";function nt(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=nt(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function be(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=nt(t))&&(r&&(r+=" "),r+=e);return r}var Ht=Object.defineProperty,Kt=(t,e,n)=>e in t?Ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ue=(t,e,n)=>(Kt(t,typeof e!="symbol"?e+"":e,n),n);let qt=class{constructor(){Ue(this,"current",this.detect()),Ue(this,"handoffState","pending"),Ue(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"}},ge=new qt;function Xt(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function ye(){let t=[],e={addEventListener(n,r,i,l){return n.addEventListener(r,i,l),e.add(()=>n.removeEventListener(r,i,l))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return e.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Xt(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,i){let l=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:i}),this.add(()=>{Object.assign(n.style,{[r]:l})})},group(n){let r=ye();return n(r),this.add(()=>r.dispose())},add(n){return t.includes(n)||t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let i of t.splice(r,1))i()}},dispose(){for(let n of t.splice(0))n()}};return e}function rt(){let[t]=s.useState(ye);return s.useEffect(()=>()=>t.dispose(),[t]),t}let z=(t,e)=>{ge.isServer?s.useEffect(t,e):s.useLayoutEffect(t,e)};function at(t){let e=s.useRef(t);return z(()=>{e.current=t},[t]),e}let _=function(t){let e=at(t);return s.useCallback((...n)=>e.current(...n),[e])};function We(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function we(t,e,...n){if(t in e){let i=e[t];return typeof i=="function"?i(...n):i}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,we),r}var it=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(it||{}),G=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(G||{});function st(){let t=Vt();return s.useCallback(e=>_t({mergeRefs:t,...e}),[t])}function _t({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:i,visible:l=!0,name:a,mergeRefs:v}){v=v??zt;let o=lt(e,t);if(l)return xe(o,n,r,a,v);let b=i??0;if(b&2){let{static:g=!1,...E}=o;if(g)return xe(E,n,r,a,v)}if(b&1){let{unmount:g=!0,...E}=o;return we(g?0:1,{0(){return null},1(){return xe({...E,hidden:!0,style:{display:"none"}},n,r,a,v)}})}return xe(o,n,r,a,v)}function xe(t,e={},n,r,i){let{as:l=n,children:a,refName:v="ref",...o}=He(t,["unmount","static"]),b=t.ref!==void 0?{[v]:t.ref}:{},g=typeof a=="function"?a(e):a;"className"in o&&o.className&&typeof o.className=="function"&&(o.className=o.className(e)),o["aria-labelledby"]&&o["aria-labelledby"]===o.id&&(o["aria-labelledby"]=void 0);let E={};if(e){let F=!1,S=[];for(let[f,y]of Object.entries(e))typeof y=="boolean"&&(F=!0),y===!0&&S.push(f.replace(/([A-Z])/g,c=>`-${c.toLowerCase()}`));if(F){E["data-headlessui-state"]=S.join(" ");for(let f of S)E[`data-${f}`]=""}}if(l===s.Fragment&&(Object.keys(Y(o)).length>0||Object.keys(Y(E)).length>0))if(!s.isValidElement(g)||Array.isArray(g)&&g.length>1){if(Object.keys(Y(o)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Y(o)).concat(Object.keys(Y(E))).map(F=>` - ${F}`).join(`
|
|
2
|
+
`),"","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(F=>` - ${F}`).join(`
|
|
32
3
|
`)].join(`
|
|
33
|
-
`))}else{let
|
|
34
|
-
`)),[]});var
|
|
4
|
+
`))}else{let F=g.props,S=F==null?void 0:F.className,f=typeof S=="function"?(...h)=>We(S(...h),o.className):We(S,o.className),y=f?{className:f}:{},c=lt(g.props,Y(He(o,["ref"])));for(let h in E)h in c&&delete E[h];return s.cloneElement(g,Object.assign({},c,E,b,{ref:i(Gt(g),b.ref)},y))}return s.createElement(l,Object.assign({},He(o,["ref"]),l!==s.Fragment&&b,l!==s.Fragment&&E),g)}function Vt(){let t=s.useRef([]),e=s.useCallback(n=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return t.current=n,e}}function zt(...t){return t.every(e=>e==null)?void 0:e=>{for(let n of t)n!=null&&(typeof n=="function"?n(e):n.current=e)}}function lt(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(r[i])):e[i]=r[i];if(e.disabled||e["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[i=>{var l;return(l=i==null?void 0:i.preventDefault)==null?void 0:l.call(i)}]);for(let r in n)Object.assign(e,{[r](i,...l){let a=n[r];for(let v of a){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;v(i,...l)}}});return e}function Be(t){var e;return Object.assign(s.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Y(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function He(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}function Gt(t){return s.version.split(".")[0]>="19"?t.props.ref:t.ref}let Zt=Symbol();function ot(...t){let e=s.useRef(t);s.useEffect(()=>{e.current=t},[t]);let n=_(r=>{for(let i of e.current)i!=null&&(typeof i=="function"?i(r):i.current=r)});return t.every(r=>r==null||(r==null?void 0:r[Zt]))?void 0:n}function Yt(t=0){let[e,n]=s.useState(t),r=s.useCallback(o=>n(o),[e]),i=s.useCallback(o=>n(b=>b|o),[e]),l=s.useCallback(o=>(e&o)===o,[e]),a=s.useCallback(o=>n(b=>b&~o),[n]),v=s.useCallback(o=>n(b=>b^o),[n]);return{flags:e,setFlag:r,addFlag:i,hasFlag:l,removeFlag:a,toggleFlag:v}}var ut,dt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ut=process==null?void 0:process.env)==null?void 0:ut.NODE_ENV)==="test"&&typeof((dt=Element==null?void 0:Element.prototype)==null?void 0:dt.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
5
|
+
`)),[]});var Jt=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(Jt||{});function Qt(t){let e={};for(let n in t)t[n]===!0&&(e[`data-${n}`]="");return e}function Rt(t,e,n,r){let[i,l]=s.useState(n),{hasFlag:a,addFlag:v,removeFlag:o}=Yt(t&&i?3:0),b=s.useRef(!1),g=s.useRef(!1),E=rt();return z(()=>{var F;if(t){if(n&&l(!0),!e){n&&v(3);return}return(F=r==null?void 0:r.start)==null||F.call(r,n),en(e,{inFlight:b,prepare(){g.current?g.current=!1:g.current=b.current,b.current=!0,!g.current&&(n?(v(3),o(4)):(v(4),o(2)))},run(){g.current?n?(o(3),v(4)):(o(4),v(3)):n?o(1):v(1)},done(){var S;g.current&&typeof e.getAnimations=="function"&&e.getAnimations().length>0||(b.current=!1,o(7),n||l(!1),(S=r==null?void 0:r.end)==null||S.call(r,n))}})}},[t,n,e,E]),t?[i,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function en(t,{prepare:e,run:n,done:r,inFlight:i}){let l=ye();return nn(t,{prepare:e,inFlight:i}),l.nextFrame(()=>{n(),l.requestAnimationFrame(()=>{l.add(tn(t,r))})}),l.dispose}function tn(t,e){var n,r;let i=ye();if(!t)return i.dispose;let l=!1;i.add(()=>{l=!0});let a=(r=(n=t.getAnimations)==null?void 0:n.call(t).filter(v=>v instanceof CSSTransition))!=null?r:[];return a.length===0?(e(),i.dispose):(Promise.allSettled(a.map(v=>v.finished)).then(()=>{l||e()}),i.dispose)}function nn(t,{inFlight:e,prepare:n}){if(e!=null&&e.current){n();return}let r=t.style.transition;t.style.transition="none",n(),t.offsetHeight,t.style.transition=r}/*!
|
|
35
6
|
* tabbable 6.2.0
|
|
36
7
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
37
|
-
*/var Ut=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Be=Ut.join(","),Bt=typeof Element>"u",pe=Bt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ke=!Bt&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},He=function t(e,r){var n;r===void 0&&(r=!0);var s=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),o=s===""||s==="true",i=o||r&&e&&t(e.parentNode);return i},Gr=function(e){var r,n=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"contenteditable");return n===""||n==="true"},Kt=function(e,r,n){if(He(e))return[];var s=Array.prototype.slice.apply(e.querySelectorAll(Be));return r&&pe.call(e,Be)&&s.unshift(e),s=s.filter(n),s},Ht=function t(e,r,n){for(var s=[],o=Array.from(e);o.length;){var i=o.shift();if(!He(i,!1))if(i.tagName==="SLOT"){var b=i.assignedElements(),u=b.length?b:i.children,y=t(u,!0,n);n.flatten?s.push.apply(s,y):s.push({scopeParent:i,candidates:y})}else{var w=pe.call(i,Be);w&&n.filter(i)&&(r||!e.includes(i))&&s.push(i);var x=i.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(i),P=!He(x,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(x&&P){var C=t(x===!0?i.children:x.children,!0,n);n.flatten?s.push.apply(s,C):s.push({scopeParent:i,candidates:C})}else o.unshift.apply(o,i.children)}}return s},Vt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},me=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Gr(e))&&!Vt(e)?0:e.tabIndex},Jr=function(e,r){var n=me(e);return n<0&&r&&!Vt(e)?0:n},Zr=function(e,r){return e.tabIndex===r.tabIndex?e.documentOrder-r.documentOrder:e.tabIndex-r.tabIndex},qt=function(e){return e.tagName==="INPUT"},Qr=function(e){return qt(e)&&e.type==="hidden"},en=function(e){var r=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return r},tn=function(e,r){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===r)return e[n]},rn=function(e){if(!e.name)return!0;var r=e.form||Ke(e),n=function(b){return r.querySelectorAll('input[type="radio"][name="'+b+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=n(window.CSS.escape(e.name));else try{s=n(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var o=tn(s,e.form);return!o||o===e},nn=function(e){return qt(e)&&e.type==="radio"},an=function(e){return nn(e)&&!rn(e)},sn=function(e){var r,n=e&&Ke(e),s=(r=n)===null||r===void 0?void 0:r.host,o=!1;if(n&&n!==e){var i,b,u;for(o=!!((i=s)!==null&&i!==void 0&&(b=i.ownerDocument)!==null&&b!==void 0&&b.contains(s)||e!=null&&(u=e.ownerDocument)!==null&&u!==void 0&&u.contains(e));!o&&s;){var y,w,x;n=Ke(s),s=(y=n)===null||y===void 0?void 0:y.host,o=!!((w=s)!==null&&w!==void 0&&(x=w.ownerDocument)!==null&&x!==void 0&&x.contains(s))}}return o},Yt=function(e){var r=e.getBoundingClientRect(),n=r.width,s=r.height;return n===0&&s===0},ln=function(e,r){var n=r.displayCheck,s=r.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var o=pe.call(e,"details>summary:first-of-type"),i=o?e.parentElement:e;if(pe.call(i,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="legacy-full"){if(typeof s=="function"){for(var b=e;e;){var u=e.parentElement,y=Ke(e);if(u&&!u.shadowRoot&&s(u)===!0)return Yt(e);e.assignedSlot?e=e.assignedSlot:!u&&y!==e.ownerDocument?e=y.host:e=u}e=b}if(sn(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Yt(e);return!1},on=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var r=e.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var n=0;n<r.children.length;n++){var s=r.children.item(n);if(s.tagName==="LEGEND")return pe.call(r,"fieldset[disabled] *")?!0:!s.contains(e)}return!0}r=r.parentElement}return!1},Ve=function(e,r){return!(r.disabled||He(r)||Qr(r)||ln(r,e)||en(r)||on(r))},ct=function(e,r){return!(an(r)||me(r)<0||!Ve(e,r))},un=function(e){var r=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},dn=function t(e){var r=[],n=[];return e.forEach(function(s,o){var i=!!s.scopeParent,b=i?s.scopeParent:s,u=Jr(b,i),y=i?t(s.candidates):b;u===0?i?r.push.apply(r,y):r.push(b):n.push({documentOrder:o,tabIndex:u,item:s,isScope:i,content:y})}),n.sort(Zr).reduce(function(s,o){return o.isScope?s.push.apply(s,o.content):s.push(o.content),s},[]).concat(r)},cn=function(e,r){r=r||{};var n;return r.getShadowRoot?n=Ht([e],r.includeContainer,{filter:ct.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:un}):n=Kt(e,r.includeContainer,ct.bind(null,r)),dn(n)},fn=function(e,r){r=r||{};var n;return r.getShadowRoot?n=Ht([e],r.includeContainer,{filter:Ve.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):n=Kt(e,r.includeContainer,Ve.bind(null,r)),n},xe=function(e,r){if(r=r||{},!e)throw new Error("No node provided");return pe.call(e,Be)===!1?!1:ct(r,e)},vn=Ut.concat("iframe").join(","),ft=function(e,r){if(r=r||{},!e)throw new Error("No node provided");return pe.call(e,vn)===!1?!1:Ve(r,e)};let vt=l.createContext(null);vt.displayName="OpenClosedContext";var he=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(he||{});function Xt(){return l.useContext(vt)}function pn({value:t,children:e}){return l.createElement(vt.Provider,{value:t},e)}function mn(){let t=typeof document>"u";return"useSyncExternalStore"in Se?(e=>e.useSyncExternalStore)(Se)(()=>()=>{},()=>!1,()=>!t):!1}function zt(){let t=mn(),[e,r]=Se.useState(Le.isHandoffComplete);return e&&Le.isHandoffComplete===!1&&r(!1),Se.useEffect(()=>{e!==!0&&r(!0)},[e]),Se.useEffect(()=>Le.handoff(),[]),t?!1:e}function hn(){let t=l.useRef(!1);return de(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Gt(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:Zt)!==l.Fragment||l.Children.count(t.children)===1}let qe=l.createContext(null);qe.displayName="TransitionContext";var bn=(t=>(t.Visible="visible",t.Hidden="hidden",t))(bn||{});function gn(){let t=l.useContext(qe);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function yn(){let t=l.useContext(Ye);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let Ye=l.createContext(null);Ye.displayName="NestingContext";function Xe(t){return"children"in t?Xe(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function Jt(t,e){let r=_t(t),n=l.useRef([]),s=hn(),o=At(),i=oe((C,m=ce.Hidden)=>{let T=n.current.findIndex(({el:f})=>f===C);T!==-1&&(We(m,{[ce.Unmount](){n.current.splice(T,1)},[ce.Hidden](){n.current[T].state="hidden"}}),o.microTask(()=>{var f;!Xe(n)&&s.current&&((f=r.current)==null||f.call(r))}))}),b=oe(C=>{let m=n.current.find(({el:T})=>T===C);return m?m.state!=="visible"&&(m.state="visible"):n.current.push({el:C,state:"visible"}),()=>i(C,ce.Unmount)}),u=l.useRef([]),y=l.useRef(Promise.resolve()),w=l.useRef({enter:[],leave:[]}),x=oe((C,m,T)=>{u.current.splice(0),e&&(e.chains.current[m]=e.chains.current[m].filter(([f])=>f!==C)),e==null||e.chains.current[m].push([C,new Promise(f=>{u.current.push(f)})]),e==null||e.chains.current[m].push([C,new Promise(f=>{Promise.all(w.current[m].map(([v,p])=>p)).then(()=>f())})]),m==="enter"?y.current=y.current.then(()=>e==null?void 0:e.wait.current).then(()=>T(m)):T(m)}),P=oe((C,m,T)=>{Promise.all(w.current[m].splice(0).map(([f,v])=>v)).then(()=>{var f;(f=u.current.shift())==null||f()}).then(()=>T(m))});return l.useMemo(()=>({children:n,register:b,unregister:i,onStart:x,onStop:P,wait:y,chains:w}),[b,i,n,x,P,w,y])}let Zt=l.Fragment,Qt=Mt.RenderStrategy;function wn(t,e){var r,n;let{transition:s=!0,beforeEnter:o,afterEnter:i,beforeLeave:b,afterLeave:u,enter:y,enterFrom:w,enterTo:x,entered:P,leave:C,leaveFrom:m,leaveTo:T,...f}=t,[v,p]=l.useState(null),O=l.useRef(null),k=Gt(t),g=Lt(...k?[O,e,p]:e===null?[]:[e]),D=(r=f.unmount)==null||r?ce.Unmount:ce.Hidden,{show:H,appear:G,initial:Z}=gn(),[X,z]=l.useState(H?"visible":"hidden"),A=yn(),{register:d,unregister:c}=A;de(()=>d(O),[d,O]),de(()=>{if(D===ce.Hidden&&O.current){if(H&&X!=="visible"){z("visible");return}return We(X,{hidden:()=>c(O),visible:()=>d(O)})}},[X,O,d,c,H,D]);let S=zt();de(()=>{if(k&&S&&X==="visible"&&O.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[O,X,S,k]);let M=Z&&!G,R=G&&H&&Z,W=l.useRef(!1),N=Jt(()=>{W.current||(z("hidden"),c(O))},A),B=oe(ie=>{W.current=!0;let te=ie?"enter":"leave";N.onStart(O,te,ue=>{ue==="enter"?o==null||o():ue==="leave"&&(b==null||b())})}),K=oe(ie=>{let te=ie?"enter":"leave";W.current=!1,N.onStop(O,te,ue=>{ue==="enter"?i==null||i():ue==="leave"&&(u==null||u())}),te==="leave"&&!Xe(N)&&(z("hidden"),c(O))});l.useEffect(()=>{k&&s||(B(H),K(H))},[H,k,s]);let re=!(!s||!k||!S||M),[,V]=qr(re,v,H,{start:B,end:K}),ne=ve({ref:g,className:((n=ot(f.className,R&&y,R&&w,V.enter&&y,V.enter&&V.closed&&w,V.enter&&!V.closed&&x,V.leave&&C,V.leave&&!V.closed&&m,V.leave&&V.closed&&T,!V.transition&&H&&P))==null?void 0:n.trim())||void 0,...Vr(V)}),ee=0;X==="visible"&&(ee|=he.Open),X==="hidden"&&(ee|=he.Closed),V.enter&&(ee|=he.Opening),V.leave&&(ee|=he.Closing);let fe=Rt();return l.createElement(Ye.Provider,{value:N},l.createElement(pn,{value:ee},fe({ourProps:ne,theirProps:f,defaultTag:Zt,features:Qt,visible:X==="visible",name:"Transition.Child"})))}function xn(t,e){let{show:r,appear:n=!1,unmount:s=!0,...o}=t,i=l.useRef(null),b=Gt(t),u=Lt(...b?[i,e]:e===null?[]:[e]);zt();let y=Xt();if(r===void 0&&y!==null&&(r=(y&he.Open)===he.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[w,x]=l.useState(r?"visible":"hidden"),P=Jt(()=>{r||x("hidden")}),[C,m]=l.useState(!0),T=l.useRef([r]);de(()=>{C!==!1&&T.current[T.current.length-1]!==r&&(T.current.push(r),m(!1))},[T,r]);let f=l.useMemo(()=>({show:r,appear:n,initial:C}),[r,n,C]);de(()=>{r?x("visible"):!Xe(P)&&i.current!==null&&x("hidden")},[r,P]);let v={unmount:s},p=oe(()=>{var g;C&&m(!1),(g=t.beforeEnter)==null||g.call(t)}),O=oe(()=>{var g;C&&m(!1),(g=t.beforeLeave)==null||g.call(t)}),k=Rt();return l.createElement(Ye.Provider,{value:P},l.createElement(qe.Provider,{value:f},k({ourProps:{...v,as:l.Fragment,children:l.createElement(er,{ref:u,...v,...o,beforeEnter:p,beforeLeave:O})},theirProps:{},defaultTag:l.Fragment,features:Qt,visible:w==="visible",name:"Transition"})))}function En(t,e){let r=l.useContext(qe)!==null,n=Xt()!==null;return l.createElement(l.Fragment,null,!r&&n?l.createElement(pt,{ref:e,...t}):l.createElement(er,{ref:e,...t}))}let pt=ut(xn),er=ut(wn),ze=ut(En),Tn=Object.assign(pt,{Child:ze,Root:pt});function tr({onClick:t}){return F.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:t,children:[F.jsx("span",{className:"sr-only",children:"Close"}),F.jsx("svg",{className:"size-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true",children:F.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}/*!
|
|
8
|
+
*/var ct=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ee=ct.join(","),ft=typeof Element>"u",J=ft?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Se=!ft&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},Ne=function t(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),l=i===""||i==="true",a=l||n&&e&&t(e.parentNode);return a},rn=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},ht=function(e,n,r){if(Ne(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Ee));return n&&J.call(e,Ee)&&i.unshift(e),i=i.filter(r),i},vt=function t(e,n,r){for(var i=[],l=Array.from(e);l.length;){var a=l.shift();if(!Ne(a,!1))if(a.tagName==="SLOT"){var v=a.assignedElements(),o=v.length?v:a.children,b=t(o,!0,r);r.flatten?i.push.apply(i,b):i.push({scopeParent:a,candidates:b})}else{var g=J.call(a,Ee);g&&r.filter(a)&&(n||!e.includes(a))&&i.push(a);var E=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),F=!Ne(E,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(E&&F){var S=t(E===!0?a.children:E.children,!0,r);r.flatten?i.push.apply(i,S):i.push({scopeParent:a,candidates:S})}else l.unshift.apply(l,a.children)}}return i},pt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Q=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||rn(e))&&!pt(e)?0:e.tabIndex},an=function(e,n){var r=Q(e);return r<0&&n&&!pt(e)?0:r},sn=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},mt=function(e){return e.tagName==="INPUT"},ln=function(e){return mt(e)&&e.type==="hidden"},on=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},un=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},dn=function(e){if(!e.name)return!0;var n=e.form||Se(e),r=function(v){return n.querySelectorAll('input[type="radio"][name="'+v+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var l=un(i,e.form);return!l||l===e},cn=function(e){return mt(e)&&e.type==="radio"},fn=function(e){return cn(e)&&!dn(e)},hn=function(e){var n,r=e&&Se(e),i=(n=r)===null||n===void 0?void 0:n.host,l=!1;if(r&&r!==e){var a,v,o;for(l=!!((a=i)!==null&&a!==void 0&&(v=a.ownerDocument)!==null&&v!==void 0&&v.contains(i)||e!=null&&(o=e.ownerDocument)!==null&&o!==void 0&&o.contains(e));!l&&i;){var b,g,E;r=Se(i),i=(b=r)===null||b===void 0?void 0:b.host,l=!!((g=i)!==null&&g!==void 0&&(E=g.ownerDocument)!==null&&E!==void 0&&E.contains(i))}}return l},bt=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},vn=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var l=J.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(J.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var v=e;e;){var o=e.parentElement,b=Se(e);if(o&&!o.shadowRoot&&i(o)===!0)return bt(e);e.assignedSlot?e=e.assignedSlot:!o&&b!==e.ownerDocument?e=b.host:e=o}e=v}if(hn(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bt(e);return!1},pn=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return J.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},Te=function(e,n){return!(n.disabled||Ne(n)||ln(n)||vn(n,e)||on(n)||pn(n))},Ke=function(e,n){return!(fn(n)||Q(n)<0||!Te(e,n))},mn=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},bn=function t(e){var n=[],r=[];return e.forEach(function(i,l){var a=!!i.scopeParent,v=a?i.scopeParent:i,o=an(v,a),b=a?t(i.candidates):v;o===0?a?n.push.apply(n,b):n.push(v):r.push({documentOrder:l,tabIndex:o,item:i,isScope:a,content:b})}),r.sort(sn).reduce(function(i,l){return l.isScope?i.push.apply(i,l.content):i.push(l.content),i},[]).concat(n)},gn=function(e,n){n=n||{};var r;return n.getShadowRoot?r=vt([e],n.includeContainer,{filter:Ke.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:mn}):r=ht(e,n.includeContainer,Ke.bind(null,n)),bn(r)},yn=function(e,n){n=n||{};var r;return n.getShadowRoot?r=vt([e],n.includeContainer,{filter:Te.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=ht(e,n.includeContainer,Te.bind(null,n)),r},ae=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return J.call(e,Ee)===!1?!1:Ke(n,e)},wn=ct.concat("iframe").join(","),qe=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return J.call(e,wn)===!1?!1:Te(n,e)};let Xe=s.createContext(null);Xe.displayName="OpenClosedContext";var R=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(R||{});function gt(){return s.useContext(Xe)}function xn({value:t,children:e}){return s.createElement(Xe.Provider,{value:t},e)}function En(){let t=typeof document>"u";return"useSyncExternalStore"in ie?(e=>e.useSyncExternalStore)(ie)(()=>()=>{},()=>!1,()=>!t):!1}function yt(){let t=En(),[e,n]=ie.useState(ge.isHandoffComplete);return e&&ge.isHandoffComplete===!1&&n(!1),ie.useEffect(()=>{e!==!0&&n(!0)},[e]),ie.useEffect(()=>ge.handoff(),[]),t?!1:e}function Sn(){let t=s.useRef(!1);return z(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function wt(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:Et)!==s.Fragment||s.Children.count(t.children)===1}let Fe=s.createContext(null);Fe.displayName="TransitionContext";var Nn=(t=>(t.Visible="visible",t.Hidden="hidden",t))(Nn||{});function Tn(){let t=s.useContext(Fe);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function Fn(){let t=s.useContext(Oe);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let Oe=s.createContext(null);Oe.displayName="NestingContext";function ke(t){return"children"in t?ke(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function xt(t,e){let n=at(t),r=s.useRef([]),i=Sn(),l=rt(),a=_((S,f=G.Hidden)=>{let y=r.current.findIndex(({el:c})=>c===S);y!==-1&&(we(f,{[G.Unmount](){r.current.splice(y,1)},[G.Hidden](){r.current[y].state="hidden"}}),l.microTask(()=>{var c;!ke(r)&&i.current&&((c=n.current)==null||c.call(n))}))}),v=_(S=>{let f=r.current.find(({el:y})=>y===S);return f?f.state!=="visible"&&(f.state="visible"):r.current.push({el:S,state:"visible"}),()=>a(S,G.Unmount)}),o=s.useRef([]),b=s.useRef(Promise.resolve()),g=s.useRef({enter:[],leave:[]}),E=_((S,f,y)=>{o.current.splice(0),e&&(e.chains.current[f]=e.chains.current[f].filter(([c])=>c!==S)),e==null||e.chains.current[f].push([S,new Promise(c=>{o.current.push(c)})]),e==null||e.chains.current[f].push([S,new Promise(c=>{Promise.all(g.current[f].map(([h,p])=>p)).then(()=>c())})]),f==="enter"?b.current=b.current.then(()=>e==null?void 0:e.wait.current).then(()=>y(f)):y(f)}),F=_((S,f,y)=>{Promise.all(g.current[f].splice(0).map(([c,h])=>h)).then(()=>{var c;(c=o.current.shift())==null||c()}).then(()=>y(f))});return s.useMemo(()=>({children:r,register:v,unregister:a,onStart:E,onStop:F,wait:b,chains:g}),[v,a,r,E,F,g,b])}let Et=s.Fragment,St=it.RenderStrategy;function On(t,e){var n,r;let{transition:i=!0,beforeEnter:l,afterEnter:a,beforeLeave:v,afterLeave:o,enter:b,enterFrom:g,enterTo:E,entered:F,leave:S,leaveFrom:f,leaveTo:y,...c}=t,[h,p]=s.useState(null),w=s.useRef(null),N=wt(t),m=ot(...N?[w,e,p]:e===null?[]:[e]),P=(n=c.unmount)==null||n?G.Unmount:G.Hidden,{show:j,appear:B,initial:H}=Tn(),[U,W]=s.useState(j?"visible":"hidden"),k=Fn(),{register:u,unregister:d}=k;z(()=>u(w),[u,w]),z(()=>{if(P===G.Hidden&&w.current){if(j&&U!=="visible"){W("visible");return}return we(U,{hidden:()=>d(w),visible:()=>u(w)})}},[U,w,u,d,j,P]);let x=yt();z(()=>{if(N&&x&&U==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,U,x,N]);let I=H&&!B,M=B&&j&&H,A=s.useRef(!1),O=xt(()=>{A.current||(W("hidden"),d(w))},k),L=_(ee=>{A.current=!0;let Z=ee?"enter":"leave";O.onStart(w,Z,fe=>{fe==="enter"?l==null||l():fe==="leave"&&(v==null||v())})}),D=_(ee=>{let Z=ee?"enter":"leave";A.current=!1,O.onStop(w,Z,fe=>{fe==="enter"?a==null||a():fe==="leave"&&(o==null||o())}),Z==="leave"&&!ke(O)&&(W("hidden"),d(w))});s.useEffect(()=>{N&&i||(L(j),D(j))},[j,N,i]);let V=!(!i||!N||!x||I),[,$]=Rt(V,h,j,{start:L,end:D}),X=Y({ref:m,className:((r=We(c.className,M&&b,M&&g,$.enter&&b,$.enter&&$.closed&&g,$.enter&&!$.closed&&E,$.leave&&S,$.leave&&!$.closed&&f,$.leave&&$.closed&&y,!$.transition&&j&&F))==null?void 0:r.trim())||void 0,...Qt($)}),K=0;U==="visible"&&(K|=R.Open),U==="hidden"&&(K|=R.Closed),$.enter&&(K|=R.Opening),$.leave&&(K|=R.Closing);let Ie=st();return s.createElement(Oe.Provider,{value:O},s.createElement(xn,{value:K},Ie({ourProps:X,theirProps:c,defaultTag:Et,features:St,visible:U==="visible",name:"Transition.Child"})))}function kn(t,e){let{show:n,appear:r=!1,unmount:i=!0,...l}=t,a=s.useRef(null),v=wt(t),o=ot(...v?[a,e]:e===null?[]:[e]);yt();let b=gt();if(n===void 0&&b!==null&&(n=(b&R.Open)===R.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[g,E]=s.useState(n?"visible":"hidden"),F=xt(()=>{n||E("hidden")}),[S,f]=s.useState(!0),y=s.useRef([n]);z(()=>{S!==!1&&y.current[y.current.length-1]!==n&&(y.current.push(n),f(!1))},[y,n]);let c=s.useMemo(()=>({show:n,appear:r,initial:S}),[n,r,S]);z(()=>{n?E("visible"):!ke(F)&&a.current!==null&&E("hidden")},[n,F]);let h={unmount:i},p=_(()=>{var m;S&&f(!1),(m=t.beforeEnter)==null||m.call(t)}),w=_(()=>{var m;S&&f(!1),(m=t.beforeLeave)==null||m.call(t)}),N=st();return s.createElement(Oe.Provider,{value:F},s.createElement(Fe.Provider,{value:c},N({ourProps:{...h,as:s.Fragment,children:s.createElement(Nt,{ref:o,...h,...l,beforeEnter:p,beforeLeave:w})},theirProps:{},defaultTag:s.Fragment,features:St,visible:g==="visible",name:"Transition"})))}function Cn(t,e){let n=s.useContext(Fe)!==null,r=gt()!==null;return s.createElement(s.Fragment,null,!n&&r?s.createElement(_e,{ref:e,...t}):s.createElement(Nt,{ref:e,...t}))}let _e=Be(kn),Nt=Be(On),Ce=Be(Cn),Pn=Object.assign(_e,{Child:Ce,Root:_e});function Tt({onClick:t}){return T.jsxs("button",{type:"button",className:"im-close-button text-gray-400 hover:text-gray-500",onClick:t,children:[T.jsx("span",{className:"sr-only",children:"Close"}),T.jsx("svg",{className:"size-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true",children:T.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]})}/*!
|
|
38
9
|
* focus-trap 7.6.2
|
|
39
10
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
40
|
-
*/function
|
|
41
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function nr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rr(Object(r),!0).forEach(function(n){On(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Pn(t){return Sn(t)||Cn(t)||Nn(t)||kn()}function jn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fn(t){var e=jn(t,"string");return typeof e=="symbol"?e:e+""}function Nn(t,e){if(t){if(typeof t=="string")return mt(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mt(t,e):void 0}}var ar={activateTrap:function(e,r){if(e.length>0){var n=e[e.length-1];n!==r&&n.pause()}var s=e.indexOf(r);s===-1||e.splice(s,1),e.push(r)},deactivateTrap:function(e,r){var n=e.indexOf(r);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},In=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},An=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},Ne=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},_n=function(e){return Ne(e)&&!e.shiftKey},Mn=function(e){return Ne(e)&&e.shiftKey},ir=function(e){return setTimeout(e,0)},Ie=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return typeof e=="function"?e.apply(void 0,n):e},Ge=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Rn=[],Dn=function(e,r){var n=(r==null?void 0:r.document)||document,s=(r==null?void 0:r.trapStack)||Rn,o=nr({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:_n,isKeyBackward:Mn},r),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},b,u=function(d,c,S){return d&&d[c]!==void 0?d[c]:o[S||c]},y=function(d,c){var S=typeof(c==null?void 0:c.composedPath)=="function"?c.composedPath():void 0;return i.containerGroups.findIndex(function(M){var R=M.container,W=M.tabbableNodes;return R.contains(d)||(S==null?void 0:S.includes(R))||W.find(function(N){return N===d})})},w=function(d){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=c.hasFallback,M=S===void 0?!1:S,R=c.params,W=R===void 0?[]:R,N=o[d];if(typeof N=="function"&&(N=N.apply(void 0,Pn(W))),N===!0&&(N=void 0),!N){if(N===void 0||N===!1)return N;throw new Error("`".concat(d,"` was specified but was not a node, or did not return a node"))}var B=N;if(typeof N=="string"){try{B=n.querySelector(N)}catch(K){throw new Error("`".concat(d,'` appears to be an invalid selector; error="').concat(K.message,'"'))}if(!B&&!M)throw new Error("`".concat(d,"` as selector refers to no known node"))}return B},x=function(){var d=w("initialFocus",{hasFallback:!0});if(d===!1)return!1;if(d===void 0||d&&!ft(d,o.tabbableOptions))if(y(n.activeElement)>=0)d=n.activeElement;else{var c=i.tabbableGroups[0],S=c&&c.firstTabbableNode;d=S||w("fallbackFocus")}else d===null&&(d=w("fallbackFocus"));if(!d)throw new Error("Your focus-trap needs to have at least one focusable element");return d},P=function(){if(i.containerGroups=i.containers.map(function(d){var c=cn(d,o.tabbableOptions),S=fn(d,o.tabbableOptions),M=c.length>0?c[0]:void 0,R=c.length>0?c[c.length-1]:void 0,W=S.find(function(K){return xe(K)}),N=S.slice().reverse().find(function(K){return xe(K)}),B=!!c.find(function(K){return me(K)>0});return{container:d,tabbableNodes:c,focusableNodes:S,posTabIndexesFound:B,firstTabbableNode:M,lastTabbableNode:R,firstDomTabbableNode:W,lastDomTabbableNode:N,nextTabbableNode:function(re){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ne=c.indexOf(re);return ne<0?V?S.slice(S.indexOf(re)+1).find(function(ee){return xe(ee)}):S.slice(0,S.indexOf(re)).reverse().find(function(ee){return xe(ee)}):c[ne+(V?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(d){return d.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!w("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find(function(d){return d.posTabIndexesFound})&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},C=function(d){var c=d.activeElement;if(c)return c.shadowRoot&&c.shadowRoot.activeElement!==null?C(c.shadowRoot):c},m=function(d){if(d!==!1&&d!==C(document)){if(!d||!d.focus){m(x());return}d.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=d,In(d)&&d.select()}},T=function(d){var c=w("setReturnFocus",{params:[d]});return c||(c===!1?!1:d)},f=function(d){var c=d.target,S=d.event,M=d.isBackward,R=M===void 0?!1:M;c=c||Ge(S),P();var W=null;if(i.tabbableGroups.length>0){var N=y(c,S),B=N>=0?i.containerGroups[N]:void 0;if(N<0)R?W=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:W=i.tabbableGroups[0].firstTabbableNode;else if(R){var K=i.tabbableGroups.findIndex(function(ie){var te=ie.firstTabbableNode;return c===te});if(K<0&&(B.container===c||ft(c,o.tabbableOptions)&&!xe(c,o.tabbableOptions)&&!B.nextTabbableNode(c,!1))&&(K=N),K>=0){var re=K===0?i.tabbableGroups.length-1:K-1,V=i.tabbableGroups[re];W=me(c)>=0?V.lastTabbableNode:V.lastDomTabbableNode}else Ne(S)||(W=B.nextTabbableNode(c,!1))}else{var ne=i.tabbableGroups.findIndex(function(ie){var te=ie.lastTabbableNode;return c===te});if(ne<0&&(B.container===c||ft(c,o.tabbableOptions)&&!xe(c,o.tabbableOptions)&&!B.nextTabbableNode(c))&&(ne=N),ne>=0){var ee=ne===i.tabbableGroups.length-1?0:ne+1,fe=i.tabbableGroups[ee];W=me(c)>=0?fe.firstTabbableNode:fe.firstDomTabbableNode}else Ne(S)||(W=B.nextTabbableNode(c))}}else W=w("fallbackFocus");return W},v=function(d){var c=Ge(d);if(!(y(c,d)>=0)){if(Ie(o.clickOutsideDeactivates,d)){b.deactivate({returnFocus:o.returnFocusOnDeactivate});return}Ie(o.allowOutsideClick,d)||d.preventDefault()}},p=function(d){var c=Ge(d),S=y(c,d)>=0;if(S||c instanceof Document)S&&(i.mostRecentlyFocusedNode=c);else{d.stopImmediatePropagation();var M,R=!0;if(i.mostRecentlyFocusedNode)if(me(i.mostRecentlyFocusedNode)>0){var W=y(i.mostRecentlyFocusedNode),N=i.containerGroups[W].tabbableNodes;if(N.length>0){var B=N.findIndex(function(K){return K===i.mostRecentlyFocusedNode});B>=0&&(o.isKeyForward(i.recentNavEvent)?B+1<N.length&&(M=N[B+1],R=!1):B-1>=0&&(M=N[B-1],R=!1))}}else i.containerGroups.some(function(K){return K.tabbableNodes.some(function(re){return me(re)>0})})||(R=!1);else R=!1;R&&(M=f({target:i.mostRecentlyFocusedNode,isBackward:o.isKeyBackward(i.recentNavEvent)})),m(M||i.mostRecentlyFocusedNode||x())}i.recentNavEvent=void 0},O=function(d){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=d;var S=f({event:d,isBackward:c});S&&(Ne(d)&&d.preventDefault(),m(S))},k=function(d){(o.isKeyForward(d)||o.isKeyBackward(d))&&O(d,o.isKeyBackward(d))},g=function(d){An(d)&&Ie(o.escapeDeactivates,d)!==!1&&(d.preventDefault(),b.deactivate())},D=function(d){var c=Ge(d);y(c,d)>=0||Ie(o.clickOutsideDeactivates,d)||Ie(o.allowOutsideClick,d)||(d.preventDefault(),d.stopImmediatePropagation())},H=function(){if(i.active)return ar.activateTrap(s,b),i.delayInitialFocusTimer=o.delayInitialFocus?ir(function(){m(x())}):m(x()),n.addEventListener("focusin",p,!0),n.addEventListener("mousedown",v,{capture:!0,passive:!1}),n.addEventListener("touchstart",v,{capture:!0,passive:!1}),n.addEventListener("click",D,{capture:!0,passive:!1}),n.addEventListener("keydown",k,{capture:!0,passive:!1}),n.addEventListener("keydown",g),b},G=function(){if(i.active)return n.removeEventListener("focusin",p,!0),n.removeEventListener("mousedown",v,!0),n.removeEventListener("touchstart",v,!0),n.removeEventListener("click",D,!0),n.removeEventListener("keydown",k,!0),n.removeEventListener("keydown",g),b},Z=function(d){var c=d.some(function(S){var M=Array.from(S.removedNodes);return M.some(function(R){return R===i.mostRecentlyFocusedNode})});c&&m(x())},X=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Z):void 0,z=function(){X&&(X.disconnect(),i.active&&!i.paused&&i.containers.map(function(d){X.observe(d,{subtree:!0,childList:!0})}))};return b={get active(){return i.active},get paused(){return i.paused},activate:function(d){if(i.active)return this;var c=u(d,"onActivate"),S=u(d,"onPostActivate"),M=u(d,"checkCanFocusTrap");M||P(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,c==null||c();var R=function(){M&&P(),H(),z(),S==null||S()};return M?(M(i.containers.concat()).then(R,R),this):(R(),this)},deactivate:function(d){if(!i.active)return this;var c=nr({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},d);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,G(),i.active=!1,i.paused=!1,z(),ar.deactivateTrap(s,b);var S=u(c,"onDeactivate"),M=u(c,"onPostDeactivate"),R=u(c,"checkCanReturnFocus"),W=u(c,"returnFocus","returnFocusOnDeactivate");S==null||S();var N=function(){ir(function(){W&&m(T(i.nodeFocusedBeforeActivation)),M==null||M()})};return W&&R?(R(T(i.nodeFocusedBeforeActivation)).then(N,N),this):(N(),this)},pause:function(d){if(i.paused||!i.active)return this;var c=u(d,"onPause"),S=u(d,"onPostPause");return i.paused=!0,c==null||c(),G(),z(),S==null||S(),this},unpause:function(d){if(!i.paused||!i.active)return this;var c=u(d,"onUnpause"),S=u(d,"onPostUnpause");return i.paused=!1,c==null||c(),P(),H(),z(),S==null||S(),this},updateContainerElements:function(d){var c=[].concat(d).filter(Boolean);return i.containers=c.map(function(S){return typeof S=="string"?n.querySelector(S):S}),i.active&&P(),z(),this}},b.updateContainerElements(e),b};function sr(t,e,r){let n=null;return t&&(n=Dn(t,{clickOutsideDeactivates:!e,escapeDeactivates:!e,onDeactivate:()=>r==null?void 0:r(),fallbackFocus:()=>t}),n.activate()),{deactivate:()=>{n==null||n.deactivate(),n=null},wrapper:t}}const Ln=({modalContext:t,config:e,children:r})=>{const[n,s]=l.useState(!1),o=l.useRef(null),[i,b]=l.useState(null);function u(){b(sr(o.current,e==null?void 0:e.closeExplicitly,()=>t.close())),s(!0)}return l.useEffect(()=>()=>i==null?void 0:i.deactivate(),[i]),F.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:F.jsx("div",{className:De("im-modal-positioner flex min-h-full justify-center",{"items-start":e.position==="top","items-center":e.position==="center","items-end":e.position==="bottom"}),children:F.jsx(ze,{as:"div",ref:o,enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",afterEnter:u,afterLeave:t.afterLeave,className:De("im-modal-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",t.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":e.maxWidth==="sm","sm:max-w-md":e.maxWidth==="md","sm:max-w-md md:max-w-lg":e.maxWidth==="lg","sm:max-w-md md:max-w-xl":e.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":e.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":e.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":e.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":e.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":e.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":e.maxWidth==="7xl"}),children:F.jsxs("div",{className:`im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,"data-inertiaui-modal-entered":n,children:[e.closeButton&&F.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:F.jsx(tr,{onClick:t.close})}),typeof r=="function"?r({modalContext:t,config:e}):r]})})})})},$n=({modalContext:t,config:e,children:r})=>{const[n,s]=l.useState(!1),o=l.useRef(null),[i,b]=l.useState(null);function u(){b(sr(o.current,e==null?void 0:e.closeExplicitly,()=>t.close())),s(!0)}return l.useEffect(()=>()=>i==null?void 0:i.deactivate(),[i]),F.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:F.jsx("div",{className:De("im-slideover-positioner flex min-h-full items-center",{"justify-start rtl:justify-end":(e==null?void 0:e.position)==="left","justify-end rtl:justify-start":(e==null?void 0:e.position)==="right"}),children:F.jsx(ze,{as:"div",ref:o,enterFrom:`opacity-0 ${e.position==="left"?"-translate-x-full":"translate-x-full"}`,enterTo:"opacity-100 translate-x-0",leaveFrom:"opacity-100 translate-x-0",leaveTo:`opacity-0 ${e.position==="left"?"-translate-x-full":"translate-x-full"}`,afterEnter:u,afterLeave:t.afterLeave,className:De("im-slideover-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",t.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":e.maxWidth==="sm","sm:max-w-md":e.maxWidth==="md","sm:max-w-md md:max-w-lg":e.maxWidth==="lg","sm:max-w-md md:max-w-xl":e.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":e.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":e.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":e.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":e.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":e.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":e.maxWidth==="7xl"}),children:F.jsxs("div",{className:`im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,"data-inertiaui-modal-entered":n,children:[e.closeButton&&F.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:F.jsx(tr,{onClick:t.close})}),typeof r=="function"?r({modalContext:t,config:e}):r]})})})})},lr=l.forwardRef(({name:t,children:e,onFocus:r=null,onBlur:n=null,onClose:s=null,onSuccess:o=null,onAfterLeave:i=null,...b},u)=>{const y=x=>typeof e=="function"?e(x):e,w=l.useRef(null);return l.useEffect(()=>{var x;if(((x=w==null?void 0:w.current)==null?void 0:x.index)===0)return Tt.prepare(),()=>Tt.cleanup()},[w]),l.useImperativeHandle(u,()=>w.current,[w]),F.jsx(st,{ref:w,name:t,onFocus:r,onBlur:n,onClose:s,onSuccess:o,...b,children:({afterLeave:x,close:P,config:C,emit:m,getChildModal:T,getParentModal:f,id:v,index:p,isOpen:O,modalContext:k,onTopOfStack:g,reload:D,setOpen:H,shouldRender:G})=>F.jsx(Tn,{appear:!0,show:O??!1,afterLeave:i,children:F.jsxs("div",{className:"im-dialog relative z-20","data-inertiaui-modal-id":v,"data-inertiaui-modal-index":p,children:[p===0?F.jsx(ze,{enter:"transition transform ease-in-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition transform ease-in-out duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:g?F.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):F.jsx("div",{})}):null,p>0&&g?F.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,C.slideover?F.jsx($n,{modalContext:k,config:C,children:y({afterLeave:x,close:P,config:C,emit:m,getChildModal:T,getParentModal:f,id:v,index:p,isOpen:O,modalContext:k,onTopOfStack:g,reload:D,setOpen:H,shouldRender:G})}):F.jsx(Ln,{modalContext:k,config:C,children:y({afterLeave:x,close:P,config:C,emit:m,getChildModal:T,getParentModal:f,id:v,index:p,isOpen:O,modalContext:k,onTopOfStack:g,reload:D,setOpen:H,shouldRender:G})})]})})})});lr.displayName="Modal";const Wn=({href:t,method:e="get",data:r={},as:n="a",headers:s={},queryStringArrayFormat:o="brackets",onAfterLeave:i=null,onBlur:b=null,onClose:u=null,onError:y=null,onFocus:w=null,onStart:x=null,onSuccess:P=null,navigate:C=null,children:m,...T})=>{const[f,v]=l.useState(!1),[p,O]=l.useState(null),{stack:k,visit:g}=Fe(),D=l.useMemo(()=>C??Me("navigate"),[C]),H={},G={};Object.keys(T).forEach(c=>{Pt.includes(c)||(c.startsWith("on")&&typeof T[c]=="function"?c.toLowerCase()in window?H[c]=T[c]:G[c]=T[c]:H[c]=T[c])});const[Z,X]=l.useState(!1);l.useEffect(()=>{p&&(p.onTopOfStack&&Z?w==null||w():!p.onTopOfStack&&!Z&&(b==null||b()),X(!p.onTopOfStack))},[k]);const z=l.useCallback(()=>{u==null||u()},[u]),A=l.useCallback(()=>{O(null),i==null||i()},[i]),d=l.useCallback(c=>{c==null||c.preventDefault(),!f&&(t.startsWith("#")||(v(!0),x==null||x()),g(t,e,r,s,Nr(St(T,Pt)),()=>z(k.length),A,o,D).then(S=>{O(S),S.registerEventListenersFromProps(G),P==null||P()}).catch(S=>{console.error(S),y==null||y(S)}).finally(()=>v(!1)))},[t,e,r,s,o,T,z,A]);return F.jsx(n,{...H,href:t,onClick:d,children:typeof m=="function"?m({loading:f}):m})};function Un(){return Fe().stack[it()]??null}const Bn=t=>e=>(e.default.layout=r=>l.createElement(t,{},r),e);$.HeadlessModal=st,$.Modal=lr,$.ModalLink=Wn,$.ModalRoot=Ft,$.ModalStackProvider=kt,$.getConfig=Me,$.initFromPageProps=jt,$.putConfig=kr,$.renderApp=Ar,$.resetConfig=Cr,$.setPageLayout=Bn,$.useModal=Un,$.useModalIndex=it,$.useModalStack=Fe,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|
|
11
|
+
*/function Ve(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function In(t){if(Array.isArray(t))return Ve(t)}function Mn(t,e,n){return(e=$n(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function An(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ln(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ot(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ft(Object(n),!0).forEach(function(r){Mn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ft(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function jn(t){return In(t)||An(t)||Un(t)||Ln()}function Dn(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $n(t){var e=Dn(t,"string");return typeof e=="symbol"?e:e+""}function Un(t,e){if(t){if(typeof t=="string")return Ve(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(t,e):void 0}}var kt={activateTrap:function(e,n){if(e.length>0){var r=e[e.length-1];r!==n&&r.pause()}var i=e.indexOf(n);i===-1||e.splice(i,1),e.push(n)},deactivateTrap:function(e,n){var r=e.indexOf(n);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},Wn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Bn=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},de=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Hn=function(e){return de(e)&&!e.shiftKey},Kn=function(e){return de(e)&&e.shiftKey},Ct=function(e){return setTimeout(e,0)},ce=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,r):e},Pe=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},qn=[],Xn=function(e,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||qn,l=Ot({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Hn,isKeyBackward:Kn},n),a={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},v,o=function(u,d,x){return u&&u[d]!==void 0?u[d]:l[x||d]},b=function(u,d){var x=typeof(d==null?void 0:d.composedPath)=="function"?d.composedPath():void 0;return a.containerGroups.findIndex(function(I){var M=I.container,A=I.tabbableNodes;return M.contains(u)||(x==null?void 0:x.includes(M))||A.find(function(O){return O===u})})},g=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=d.hasFallback,I=x===void 0?!1:x,M=d.params,A=M===void 0?[]:M,O=l[u];if(typeof O=="function"&&(O=O.apply(void 0,jn(A))),O===!0&&(O=void 0),!O){if(O===void 0||O===!1)return O;throw new Error("`".concat(u,"` was specified but was not a node, or did not return a node"))}var L=O;if(typeof O=="string"){try{L=r.querySelector(O)}catch(D){throw new Error("`".concat(u,'` appears to be an invalid selector; error="').concat(D.message,'"'))}if(!L&&!I)throw new Error("`".concat(u,"` as selector refers to no known node"))}return L},E=function(){var u=g("initialFocus",{hasFallback:!0});if(u===!1)return!1;if(u===void 0||u&&!qe(u,l.tabbableOptions))if(b(r.activeElement)>=0)u=r.activeElement;else{var d=a.tabbableGroups[0],x=d&&d.firstTabbableNode;u=x||g("fallbackFocus")}else u===null&&(u=g("fallbackFocus"));if(!u)throw new Error("Your focus-trap needs to have at least one focusable element");return u},F=function(){if(a.containerGroups=a.containers.map(function(u){var d=gn(u,l.tabbableOptions),x=yn(u,l.tabbableOptions),I=d.length>0?d[0]:void 0,M=d.length>0?d[d.length-1]:void 0,A=x.find(function(D){return ae(D)}),O=x.slice().reverse().find(function(D){return ae(D)}),L=!!d.find(function(D){return Q(D)>0});return{container:u,tabbableNodes:d,focusableNodes:x,posTabIndexesFound:L,firstTabbableNode:I,lastTabbableNode:M,firstDomTabbableNode:A,lastDomTabbableNode:O,nextTabbableNode:function(V){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,X=d.indexOf(V);return X<0?$?x.slice(x.indexOf(V)+1).find(function(K){return ae(K)}):x.slice(0,x.indexOf(V)).reverse().find(function(K){return ae(K)}):d[X+($?1:-1)]}}}),a.tabbableGroups=a.containerGroups.filter(function(u){return u.tabbableNodes.length>0}),a.tabbableGroups.length<=0&&!g("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find(function(u){return u.posTabIndexesFound})&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},S=function(u){var d=u.activeElement;if(d)return d.shadowRoot&&d.shadowRoot.activeElement!==null?S(d.shadowRoot):d},f=function(u){if(u!==!1&&u!==S(document)){if(!u||!u.focus){f(E());return}u.focus({preventScroll:!!l.preventScroll}),a.mostRecentlyFocusedNode=u,Wn(u)&&u.select()}},y=function(u){var d=g("setReturnFocus",{params:[u]});return d||(d===!1?!1:u)},c=function(u){var d=u.target,x=u.event,I=u.isBackward,M=I===void 0?!1:I;d=d||Pe(x),F();var A=null;if(a.tabbableGroups.length>0){var O=b(d,x),L=O>=0?a.containerGroups[O]:void 0;if(O<0)M?A=a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:A=a.tabbableGroups[0].firstTabbableNode;else if(M){var D=a.tabbableGroups.findIndex(function(ee){var Z=ee.firstTabbableNode;return d===Z});if(D<0&&(L.container===d||qe(d,l.tabbableOptions)&&!ae(d,l.tabbableOptions)&&!L.nextTabbableNode(d,!1))&&(D=O),D>=0){var V=D===0?a.tabbableGroups.length-1:D-1,$=a.tabbableGroups[V];A=Q(d)>=0?$.lastTabbableNode:$.lastDomTabbableNode}else de(x)||(A=L.nextTabbableNode(d,!1))}else{var X=a.tabbableGroups.findIndex(function(ee){var Z=ee.lastTabbableNode;return d===Z});if(X<0&&(L.container===d||qe(d,l.tabbableOptions)&&!ae(d,l.tabbableOptions)&&!L.nextTabbableNode(d))&&(X=O),X>=0){var K=X===a.tabbableGroups.length-1?0:X+1,Ie=a.tabbableGroups[K];A=Q(d)>=0?Ie.firstTabbableNode:Ie.firstDomTabbableNode}else de(x)||(A=L.nextTabbableNode(d))}}else A=g("fallbackFocus");return A},h=function(u){var d=Pe(u);if(!(b(d,u)>=0)){if(ce(l.clickOutsideDeactivates,u)){v.deactivate({returnFocus:l.returnFocusOnDeactivate});return}ce(l.allowOutsideClick,u)||u.preventDefault()}},p=function(u){var d=Pe(u),x=b(d,u)>=0;if(x||d instanceof Document)x&&(a.mostRecentlyFocusedNode=d);else{u.stopImmediatePropagation();var I,M=!0;if(a.mostRecentlyFocusedNode)if(Q(a.mostRecentlyFocusedNode)>0){var A=b(a.mostRecentlyFocusedNode),O=a.containerGroups[A].tabbableNodes;if(O.length>0){var L=O.findIndex(function(D){return D===a.mostRecentlyFocusedNode});L>=0&&(l.isKeyForward(a.recentNavEvent)?L+1<O.length&&(I=O[L+1],M=!1):L-1>=0&&(I=O[L-1],M=!1))}}else a.containerGroups.some(function(D){return D.tabbableNodes.some(function(V){return Q(V)>0})})||(M=!1);else M=!1;M&&(I=c({target:a.mostRecentlyFocusedNode,isBackward:l.isKeyBackward(a.recentNavEvent)})),f(I||a.mostRecentlyFocusedNode||E())}a.recentNavEvent=void 0},w=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a.recentNavEvent=u;var x=c({event:u,isBackward:d});x&&(de(u)&&u.preventDefault(),f(x))},N=function(u){(l.isKeyForward(u)||l.isKeyBackward(u))&&w(u,l.isKeyBackward(u))},m=function(u){Bn(u)&&ce(l.escapeDeactivates,u)!==!1&&(u.preventDefault(),v.deactivate())},P=function(u){var d=Pe(u);b(d,u)>=0||ce(l.clickOutsideDeactivates,u)||ce(l.allowOutsideClick,u)||(u.preventDefault(),u.stopImmediatePropagation())},j=function(){if(a.active)return kt.activateTrap(i,v),a.delayInitialFocusTimer=l.delayInitialFocus?Ct(function(){f(E())}):f(E()),r.addEventListener("focusin",p,!0),r.addEventListener("mousedown",h,{capture:!0,passive:!1}),r.addEventListener("touchstart",h,{capture:!0,passive:!1}),r.addEventListener("click",P,{capture:!0,passive:!1}),r.addEventListener("keydown",N,{capture:!0,passive:!1}),r.addEventListener("keydown",m),v},B=function(){if(a.active)return r.removeEventListener("focusin",p,!0),r.removeEventListener("mousedown",h,!0),r.removeEventListener("touchstart",h,!0),r.removeEventListener("click",P,!0),r.removeEventListener("keydown",N,!0),r.removeEventListener("keydown",m),v},H=function(u){var d=u.some(function(x){var I=Array.from(x.removedNodes);return I.some(function(M){return M===a.mostRecentlyFocusedNode})});d&&f(E())},U=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(H):void 0,W=function(){U&&(U.disconnect(),a.active&&!a.paused&&a.containers.map(function(u){U.observe(u,{subtree:!0,childList:!0})}))};return v={get active(){return a.active},get paused(){return a.paused},activate:function(u){if(a.active)return this;var d=o(u,"onActivate"),x=o(u,"onPostActivate"),I=o(u,"checkCanFocusTrap");I||F(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=r.activeElement,d==null||d();var M=function(){I&&F(),j(),W(),x==null||x()};return I?(I(a.containers.concat()).then(M,M),this):(M(),this)},deactivate:function(u){if(!a.active)return this;var d=Ot({onDeactivate:l.onDeactivate,onPostDeactivate:l.onPostDeactivate,checkCanReturnFocus:l.checkCanReturnFocus},u);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,B(),a.active=!1,a.paused=!1,W(),kt.deactivateTrap(i,v);var x=o(d,"onDeactivate"),I=o(d,"onPostDeactivate"),M=o(d,"checkCanReturnFocus"),A=o(d,"returnFocus","returnFocusOnDeactivate");x==null||x();var O=function(){Ct(function(){A&&f(y(a.nodeFocusedBeforeActivation)),I==null||I()})};return A&&M?(M(y(a.nodeFocusedBeforeActivation)).then(O,O),this):(O(),this)},pause:function(u){if(a.paused||!a.active)return this;var d=o(u,"onPause"),x=o(u,"onPostPause");return a.paused=!0,d==null||d(),B(),W(),x==null||x(),this},unpause:function(u){if(!a.paused||!a.active)return this;var d=o(u,"onUnpause"),x=o(u,"onPostUnpause");return a.paused=!1,d==null||d(),F(),j(),W(),x==null||x(),this},updateContainerElements:function(u){var d=[].concat(u).filter(Boolean);return a.containers=d.map(function(x){return typeof x=="string"?r.querySelector(x):x}),a.active&&F(),W(),this}},v.updateContainerElements(e),v};function Pt(t,e,n){let r=null;return t&&(r=Xn(t,{clickOutsideDeactivates:!e,escapeDeactivates:!e,onDeactivate:()=>n==null?void 0:n(),fallbackFocus:()=>t}),r.activate()),{deactivate:()=>{r==null||r.deactivate(),r=null},wrapper:t}}const _n=({modalContext:t,config:e,children:n})=>{const[r,i]=s.useState(!1),l=s.useRef(null),[a,v]=s.useState(null);function o(){v(Pt(l.current,e==null?void 0:e.closeExplicitly,()=>t.close())),i(!0)}return s.useEffect(()=>()=>a==null?void 0:a.deactivate(),[a]),T.jsx("div",{className:"im-modal-container fixed inset-0 z-40 overflow-y-auto p-4",children:T.jsx("div",{className:be("im-modal-positioner flex min-h-full justify-center",{"items-start":e.position==="top","items-center":e.position==="center","items-end":e.position==="bottom"}),children:T.jsx(Ce,{as:"div",ref:l,enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",afterEnter:o,afterLeave:t.afterLeave,className:be("im-modal-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",t.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":e.maxWidth==="sm","sm:max-w-md":e.maxWidth==="md","sm:max-w-md md:max-w-lg":e.maxWidth==="lg","sm:max-w-md md:max-w-xl":e.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":e.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":e.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":e.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":e.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":e.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":e.maxWidth==="7xl"}),children:T.jsxs("div",{className:`im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,"data-inertiaui-modal-entered":r,children:[e.closeButton&&T.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:T.jsx(Tt,{onClick:t.close})}),typeof n=="function"?n({modalContext:t,config:e}):n]})})})})},Vn=({modalContext:t,config:e,children:n})=>{const[r,i]=s.useState(!1),l=s.useRef(null),[a,v]=s.useState(null);function o(){v(Pt(l.current,e==null?void 0:e.closeExplicitly,()=>t.close())),i(!0)}return s.useEffect(()=>()=>a==null?void 0:a.deactivate(),[a]),T.jsx("div",{className:"im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden",children:T.jsx("div",{className:be("im-slideover-positioner flex min-h-full items-center",{"justify-start rtl:justify-end":(e==null?void 0:e.position)==="left","justify-end rtl:justify-start":(e==null?void 0:e.position)==="right"}),children:T.jsx(Ce,{as:"div",ref:l,enterFrom:`opacity-0 ${e.position==="left"?"-translate-x-full":"translate-x-full"}`,enterTo:"opacity-100 translate-x-0",leaveFrom:"opacity-100 translate-x-0",leaveTo:`opacity-0 ${e.position==="left"?"-translate-x-full":"translate-x-full"}`,afterEnter:o,afterLeave:t.afterLeave,className:be("im-slideover-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",t.onTopOfStack?"":"blur-sm",{"sm:max-w-sm":e.maxWidth==="sm","sm:max-w-md":e.maxWidth==="md","sm:max-w-md md:max-w-lg":e.maxWidth==="lg","sm:max-w-md md:max-w-xl":e.maxWidth==="xl","sm:max-w-md md:max-w-xl lg:max-w-2xl":e.maxWidth==="2xl","sm:max-w-md md:max-w-xl lg:max-w-3xl":e.maxWidth==="3xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl":e.maxWidth==="4xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl":e.maxWidth==="5xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl":e.maxWidth==="6xl","sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl":e.maxWidth==="7xl"}),children:T.jsxs("div",{className:`im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,"data-inertiaui-modal-entered":r,children:[e.closeButton&&T.jsx("div",{className:"absolute right-0 top-0 pr-3 pt-3",children:T.jsx(Tt,{onClick:t.close})}),typeof n=="function"?n({modalContext:t,config:e}):n]})})})})},It=s.forwardRef(({name:t,children:e,onFocus:n=null,onBlur:r=null,onClose:i=null,onSuccess:l=null,onAfterLeave:a=null,...v},o)=>{const b=E=>typeof e=="function"?e(E):e,g=s.useRef(null);return s.useEffect(()=>{var E;if(((E=g==null?void 0:g.current)==null?void 0:E.index)===0)return ze.prepare(),()=>ze.cleanup()},[g]),s.useImperativeHandle(o,()=>g.current,[g]),T.jsx($e,{ref:g,name:t,onFocus:n,onBlur:r,onClose:i,onSuccess:l,...v,children:({afterLeave:E,close:F,config:S,emit:f,getChildModal:y,getParentModal:c,id:h,index:p,isOpen:w,modalContext:N,onTopOfStack:m,reload:P,setOpen:j,shouldRender:B})=>T.jsx(Pn,{appear:!0,show:w??!1,afterLeave:a,children:T.jsxs("div",{className:"im-dialog relative z-20","data-inertiaui-modal-id":h,"data-inertiaui-modal-index":p,children:[p===0?T.jsx(Ce,{enter:"transition transform ease-in-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition transform ease-in-out duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:m?T.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75","aria-hidden":"true"}):T.jsx("div",{})}):null,p>0&&m?T.jsx("div",{className:"im-backdrop fixed inset-0 z-30 bg-black/75"}):null,S.slideover?T.jsx(Vn,{modalContext:N,config:S,children:b({afterLeave:E,close:F,config:S,emit:f,getChildModal:y,getParentModal:c,id:h,index:p,isOpen:w,modalContext:N,onTopOfStack:m,reload:P,setOpen:j,shouldRender:B})}):T.jsx(_n,{modalContext:N,config:S,children:b({afterLeave:E,close:F,config:S,emit:f,getChildModal:y,getParentModal:c,id:h,index:p,isOpen:w,modalContext:N,onTopOfStack:m,reload:P,setOpen:j,shouldRender:B})})]})})})});It.displayName="Modal";const zn=({href:t,method:e="get",data:n={},as:r="a",headers:i={},queryStringArrayFormat:l="brackets",onAfterLeave:a=null,onBlur:v=null,onClose:o=null,onError:b=null,onFocus:g=null,onStart:E=null,onSuccess:F=null,navigate:S=null,children:f,...y})=>{const[c,h]=s.useState(!1),[p,w]=s.useState(null),{stack:N,visit:m}=ue(),P=s.useMemo(()=>S??pe("navigate"),[S]),j={},B={};Object.keys(y).forEach(d=>{Qe.includes(d)||(d.startsWith("on")&&typeof y[d]=="function"?d.toLowerCase()in window?j[d]=y[d]:B[d]=y[d]:j[d]=y[d])});const[H,U]=s.useState(!1);s.useEffect(()=>{p&&(p.onTopOfStack&&H?g==null||g():!p.onTopOfStack&&!H&&(v==null||v()),U(!p.onTopOfStack))},[N]);const W=s.useCallback(()=>{o==null||o()},[o]),k=s.useCallback(()=>{w(null),a==null||a()},[a]),u=s.useCallback(d=>{d==null||d.preventDefault(),!c&&(t.startsWith("#")||(h(!0),E==null||E()),m(t,e,n,i,Ut(Ge(y,Qe)),()=>W(N.length),k,l,P).then(x=>{w(x),x.registerEventListenersFromProps(B),F==null||F()}).catch(x=>{console.error(x),b==null||b(x)}).finally(()=>h(!1)))},[t,e,n,i,l,y,W,k]);return T.jsx(r,{...j,href:t,onClick:u,children:typeof f=="function"?f({loading:c}):f})};function Gn(){return ue().stack[De()]??null}const Zn=t=>e=>(e.default.layout=n=>s.createElement(t,{},n),e);C.HeadlessModal=$e,C.Modal=It,C.ModalLink=zn,C.ModalRoot=et,C.ModalStackProvider=Je,C.getConfig=pe,C.initFromPageProps=Re,C.putConfig=Dt,C.renderApp=Bt,C.resetConfig=jt,C.setPageLayout=Zn,C.useModal=Gn,C.useModalIndex=De,C.useModalStack=ue,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiaui/modal-react",
|
|
3
3
|
"author": "Pascal Baljet <pascal@protone.media>",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.18.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"focus-trap": "^7.6.2",
|
|
42
42
|
"prettier-plugin-tailwindcss": "^0.5.12",
|
|
43
43
|
"prettier": "^3.2.4",
|
|
44
|
-
"react-dom": "^18.2.0",
|
|
45
|
-
"react": "^18.2.0",
|
|
44
|
+
"react-dom": "^18.2.0||^19.0.0",
|
|
45
|
+
"react": "^18.2.0||^19.0.0",
|
|
46
46
|
"vite-plugin-eslint": "^1.8.1",
|
|
47
47
|
"vite": "^5.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@inertiajs/react": "^1.3.0||^2.0.0",
|
|
51
51
|
"axios": "^1.6.0",
|
|
52
|
-
"react": "^18.2.0",
|
|
53
|
-
"react-dom": "^18.2.0"
|
|
52
|
+
"react": "^18.2.0||^19.0.0",
|
|
53
|
+
"react-dom": "^18.2.0||^19.0.0"
|
|
54
54
|
}
|
|
55
55
|
}
|