ladle-inject-custom-addons
Version:
Adds a button to the Ladle addon bar
57 lines (49 loc) • 43.6 kB
JavaScript
function fe(...e){return e.flat().filter(t=>t&&!!t.trim()).join(" ")}import{jsx as pn}from"react/jsx-runtime";var it=({icon:e,...t})=>pn("button",{...t,className:fe("ladle-button",t.className),style:{height:36,width:36,borderColor:"transparent",boxShadow:"none",...t.style},children:e});import{jsx as Fe,jsxs as yn}from"react/jsx-runtime";var hn=({size:e=24,...t})=>Fe("svg",{width:e,height:e,viewBox:"0 0 24 24",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...t}),at=({size:e=18,...t})=>yn(hn,{size:e,...t,children:[Fe("path",{d:"M0 0h24v24H0z",stroke:"none"}),Fe("path",{d:"M18 6L6 18M6 6l12 12"})]});import{jsx as _e}from"react/jsx-runtime";var st=({iconProps:e,wrapperProps:t,...n})=>_e("div",{...t,style:{position:"absolute",insetInlineEnd:-6,top:0,...t?.style},children:_e(it,{"aria-label":"Close modal",...n,icon:_e(at,{...e})})});import*as a from"react";import*as Et from"react-dom";function We(){return H=Object.assign||function(e){for(let t=1;t<arguments.length;t++){let n=arguments[t];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},H.apply(this,arguments)}function Xe(e,t,n){return n={path:t,exports:{},require:function(o,r){return gn(o,r??n.path)}},e(n,n.exports),n.exports}function gn(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}function Tt(){throw new Error("setTimeout has not been defined")}function Ct(){throw new Error("clearTimeout has not been defined")}var z=Tt,K=Ct,ie;typeof window<"u"?ie=window:typeof self<"u"?ie=self:ie={};typeof ie.setTimeout=="function"&&(z=setTimeout);typeof ie.clearTimeout=="function"&&(K=clearTimeout);function St(e){if(z===setTimeout)return setTimeout(e,0);if((z===Tt||!z)&&setTimeout)return z=setTimeout,setTimeout(e,0);try{return z(e,0)}catch{try{return z.call(null,e,0)}catch{return z.call(this,e,0)}}}function bn(e){if(K===clearTimeout)return clearTimeout(e);if((K===Ct||!K)&&clearTimeout)return K=clearTimeout,clearTimeout(e);try{return K(e)}catch{try{return K.call(null,e)}catch{return K.call(this,e)}}}var q=[],ae=!1,V,be=-1;function vn(){!ae||!V||(ae=!1,V.length?q=V.concat(q):be=-1,q.length&&Pt())}function Pt(){if(ae)return;let e=St(vn);ae=!0;let t=q.length;for(;t;){for(V=q,q=[];++be<t;)V&&V[be].run();be=-1,t=q.length}V=null,ae=!1,bn(e)}function wn(e){let t=new Array(arguments.length-1);if(arguments.length>1)for(let n=1;n<arguments.length;n++)t[n-1]=arguments[n];q.push(new Ot(e,t)),q.length===1&&!ae&&St(Pt)}function Ot(e,t){this.fun=e,this.array=t}Ot.prototype.run=function(){this.fun.apply(null,this.array)};var En="browser",Tn="browser",Cn=!0,Sn=[],Pn="",On={},Rn={},kn={};function U(){}var Dn=U,xn=U,An=U,In=U,Fn=U,_n=U,Ln=U;function Mn(e){throw new Error("process.binding is not supported")}function Nn(){return"/"}function Bn(e){throw new Error("process.chdir is not supported")}function jn(){return 0}var oe=ie.performance||{},$n=oe.now||oe.mozNow||oe.msNow||oe.oNow||oe.webkitNow||function(){return new Date().getTime()};function Wn(e){let t=$n.call(oe)*.001,n=Math.floor(t),o=Math.floor(t%1*1e9);return e&&(n=n-e[0],o=o-e[1],o<0&&(n--,o+=1e9)),[n,o]}var Yn=new Date;function Un(){return(new Date-Yn)/1e3}var ut={nextTick:wn,title:En,browser:Cn,env:{NODE_ENV:"development"},argv:Sn,version:Pn,versions:On,on:Dn,addListener:xn,once:An,off:In,removeListener:Fn,removeAllListeners:_n,emit:Ln,binding:Mn,cwd:Nn,chdir:Bn,umask:jn,hrtime:Wn,platform:Tn,release:Rn,config:kn,uptime:Un},Hn=function(e,t){let n,o=toObject(e),r;for(let i=1;i<arguments.length;i++){n=Object(arguments[i]);for(let c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);if(getOwnPropertySymbols){r=getOwnPropertySymbols(n);for(let c=0;c<r.length;c++)propIsEnumerable.call(n,r[c])&&(o[r[c]]=n[r[c]])}}return o},Gn=kt()?a.useLayoutEffect:a.useEffect,lt={},Rt=U;{let e=typeof ut<"u"?ut:{env:{NODE_ENV:"development"}},t=e.env;Rt=function(o){lt[o]||(lt[o]=!0)}}function qn(e,t){if(e!=null)if(zn(e))e(t);else try{e.current=t}catch{throw new Error('Cannot assign value "'+t+'" to ref "'+e+'"')}}function kt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Re(e){return a.forwardRef(e)}function Zn(e){return kt()?e?e.ownerDocument:document:null}function zn(e){return!!(e&&{}.toString.call(e)=="[object Function]")}function Kn(e){return typeof e=="string"}var Dt=U;Dt=function(t){let n=a.useRef(t);a.useEffect(function(){return void(n.current=t)},[t]),a.useEffect(function(){return Rt(n.current)},[])};function Xn(){let e=a.useState(Object.create(null)),t=e[1];return a.useCallback(function(){t(Object.create(null))},[])}function Qn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return a.useMemo(function(){return t.every(function(o){return o==null})?null:function(o){t.forEach(function(r){qn(r,o)})}},[].concat(t))}function ve(e,t){return function(n){if(e&&e(n),!n.defaultPrevented)return t(n)}}var xt=function(t){let n=t.children,o=t.type,r=o===void 0?"reach-portal":o,i=a.useRef(null),c=a.useRef(null),l=Xn();return Gn(function(){if(!i.current)return;let u=i.current.ownerDocument;return c.current=u?.createElement(r),u.body.appendChild(c.current),l(),function(){c.current&&c.current.ownerDocument&&c.current.ownerDocument.body.removeChild(c.current)}},[r,l]),c.current?Et.createPortal(n,c.current):a.createElement("span",{ref:i})};xt.displayName="Portal";function Vn(e,t){if(e==null)return{};let n={},o=Object.keys(e),r,i;for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}var Jn=Xe(function(e,t){(function(){let n=typeof Symbol=="function"&&Symbol.for,o=n?Symbol.for("react.element"):60103,r=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,c=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,u=n?Symbol.for("react.provider"):60109,f=n?Symbol.for("react.context"):60110,y=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,g=n?Symbol.for("react.forward_ref"):60112,R=n?Symbol.for("react.suspense"):60113,I=n?Symbol.for("react.suspense_list"):60120,p=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,L=n?Symbol.for("react.block"):60121,M=n?Symbol.for("react.fundamental"):60117,A=n?Symbol.for("react.responder"):60118,F=n?Symbol.for("react.scope"):60119;function N(m){return typeof m=="string"||typeof m=="function"||m===i||m===h||m===l||m===c||m===R||m===I||typeof m=="object"&&m!==null&&(m.$$typeof===b||m.$$typeof===p||m.$$typeof===u||m.$$typeof===f||m.$$typeof===g||m.$$typeof===M||m.$$typeof===A||m.$$typeof===F||m.$$typeof===L)}function k(m){if(typeof m=="object"&&m!==null){let Ie=m.$$typeof;switch(Ie){case o:var he=m.type;switch(he){case y:case h:case i:case l:case c:case R:return he;default:var ct=he&&he.$$typeof;switch(ct){case f:case g:case b:case p:case u:return ct;default:return Ie}}case r:return Ie}}}let W=y,_=h,Y=f,j=u,Z=o,s=g,d=i,v=b,w=p,E=r,P=l,C=c,T=R,S=!1;function D(m){return S||(S=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),x(m)||k(m)===y}function x(m){return k(m)===h}function B(m){return k(m)===f}function $(m){return k(m)===u}function Ae(m){return typeof m=="object"&&m!==null&&m.$$typeof===o}function G(m){return k(m)===g}function ee(m){return k(m)===i}function pe(m){return k(m)===b}function un(m){return k(m)===p}function ln(m){return k(m)===r}function fn(m){return k(m)===l}function dn(m){return k(m)===c}function mn(m){return k(m)===R}t.AsyncMode=W,t.ConcurrentMode=_,t.ContextConsumer=Y,t.ContextProvider=j,t.Element=Z,t.ForwardRef=s,t.Fragment=d,t.Lazy=v,t.Memo=w,t.Portal=E,t.Profiler=P,t.StrictMode=C,t.Suspense=T,t.isAsyncMode=D,t.isConcurrentMode=x,t.isContextConsumer=B,t.isContextProvider=$,t.isElement=Ae,t.isForwardRef=G,t.isFragment=ee,t.isLazy=pe,t.isMemo=un,t.isPortal=ln,t.isProfiler=fn,t.isStrictMode=dn,t.isSuspense=mn,t.isValidElementType=N,t.typeOf=k})()}),At=Xe(function(e){e.exports=Jn}),eo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Q=eo,Ye=function(){};It=Q,Te={},Ft=Function.call.bind(Object.prototype.hasOwnProperty),Ye=function(e){let t="Warning: "+e;typeof console<"u"&&console.error(t);try{throw new Error(t)}catch{}};var It,Te,Ft;function _t(e,t,n,o,r){for(let c in e)if(Ft(e,c)){var i;try{if(typeof e[c]!="function"){let l=Error((o||"React class")+": "+n+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.");throw l.name="Invariant Violation",l}i=e[c](t,c,o,n,null,It)}catch(l){i=l}if(i&&!(i instanceof Error)&&Ye((o||"React class")+": type specification of "+n+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in Te)){Te[i.message]=!0;let l=r?r():"";Ye("Failed "+n+" type: "+i.message+(l??""))}}}_t.resetWarningCache=function(){Te={}};var ft=_t,to=Function.call.bind(Object.prototype.hasOwnProperty),re=function(){};re=function(e){let t="Warning: "+e;typeof console<"u"&&console.error(t);try{throw new Error(t)}catch{}};function ye(){return null}var no=function(e,t){let n=typeof Symbol=="function"&&Symbol.iterator,o="@@iterator";function r(s){let d=s&&(n&&s[n]||s[o]);if(typeof d=="function")return d}let i="<<anonymous>>",c={array:y("array"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:h(),arrayOf:g,element:R(),elementType:I(),instanceOf:p,node:A(),objectOf:L,oneOf:b,oneOfType:M,shape:F,exact:N};function l(s,d){return s===d?s!==0||1/s===1/d:s!==s&&d!==d}function u(s){this.message=s,this.stack=""}u.prototype=Error.prototype;function f(s){var d={},v=0;function w(P,C,T,S,D,x,B){if(S=S||i,x=x||T,B!==Q){if(t){let $=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw $.name="Invariant Violation",$}else if(typeof console<"u"){let $=S+":"+T;!d[$]&&v<3&&(re("You are manually calling a React.PropTypes validation function for the `"+x+"` prop on `"+S+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),d[$]=!0,v++)}}return C[T]==null?P?C[T]===null?new u("The "+D+" `"+x+"` is marked as required "+("in `"+S+"`, but its value is `null`.")):new u("The "+D+" `"+x+"` is marked as required in "+("`"+S+"`, but its value is `undefined`.")):null:s(C,T,S,D,x)}let E=w.bind(null,!1);return E.isRequired=w.bind(null,!0),E}function y(s){function d(v,w,E,P,C,T){let S=v[w];if(_(S)!==s){let x=Y(S);return new u("Invalid "+P+" `"+C+"` of type "+("`"+x+"` supplied to `"+E+"`, expected ")+("`"+s+"`."))}return null}return f(d)}function h(){return f(ye)}function g(s){function d(v,w,E,P,C){if(typeof s!="function")return new u("Property `"+C+"` of component `"+E+"` has invalid PropType notation inside arrayOf.");let T=v[w];if(!Array.isArray(T)){let S=_(T);return new u("Invalid "+P+" `"+C+"` of type "+("`"+S+"` supplied to `"+E+"`, expected an array."))}for(let S=0;S<T.length;S++){let D=s(T,S,E,P,C+"["+S+"]",Q);if(D instanceof Error)return D}return null}return f(d)}function R(){function s(d,v,w,E,P){let C=d[v];if(!e(C)){let T=_(C);return new u("Invalid "+E+" `"+P+"` of type "+("`"+T+"` supplied to `"+w+"`, expected a single ReactElement."))}return null}return f(s)}function I(){function s(d,v,w,E,P){let C=d[v];if(!At.isValidElementType(C)){let T=_(C);return new u("Invalid "+E+" `"+P+"` of type "+("`"+T+"` supplied to `"+w+"`, expected a single ReactElement type."))}return null}return f(s)}function p(s){function d(v,w,E,P,C){if(!(v[w]instanceof s)){let T=s.name||i,S=Z(v[w]);return new u("Invalid "+P+" `"+C+"` of type "+("`"+S+"` supplied to `"+E+"`, expected ")+("instance of `"+T+"`."))}return null}return f(d)}function b(s){if(!Array.isArray(s))return arguments.length>1?re("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):re("Invalid argument supplied to oneOf, expected an array."),ye;function d(v,w,E,P,C){let T=v[w];for(let D=0;D<s.length;D++)if(l(T,s[D]))return null;let S=JSON.stringify(s,function(x,B){return Y(B)==="symbol"?String(B):B});return new u("Invalid "+P+" `"+C+"` of value `"+String(T)+"` "+("supplied to `"+E+"`, expected one of "+S+"."))}return f(d)}function L(s){function d(v,w,E,P,C){if(typeof s!="function")return new u("Property `"+C+"` of component `"+E+"` has invalid PropType notation inside objectOf.");let T=v[w],S=_(T);if(S!=="object")return new u("Invalid "+P+" `"+C+"` of type "+("`"+S+"` supplied to `"+E+"`, expected an object."));for(let D in T)if(to(T,D)){let x=s(T,D,E,P,C+"."+D,Q);if(x instanceof Error)return x}return null}return f(d)}function M(s){if(!Array.isArray(s))return re("Invalid argument supplied to oneOfType, expected an instance of array."),ye;for(let v=0;v<s.length;v++){let w=s[v];if(typeof w!="function")return re("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+j(w)+" at index "+v+"."),ye}function d(v,w,E,P,C){for(let T=0;T<s.length;T++){let S=s[T];if(S(v,w,E,P,C,Q)==null)return null}return new u("Invalid "+P+" `"+C+"` supplied to "+("`"+E+"`."))}return f(d)}function A(){function s(d,v,w,E,P){return k(d[v])?null:new u("Invalid "+E+" `"+P+"` supplied to "+("`"+w+"`, expected a ReactNode."))}return f(s)}function F(s){function d(v,w,E,P,C){let T=v[w],S=_(T);if(S!=="object")return new u("Invalid "+P+" `"+C+"` of type `"+S+"` "+("supplied to `"+E+"`, expected `object`."));for(let D in s){let x=s[D];if(!x)continue;let B=x(T,D,E,P,C+"."+D,Q);if(B)return B}return null}return f(d)}function N(s){function d(v,w,E,P,C){let T=v[w],S=_(T);if(S!=="object")return new u("Invalid "+P+" `"+C+"` of type `"+S+"` "+("supplied to `"+E+"`, expected `object`."));let D=Hn({},v[w],s);for(let x in D){let B=s[x];if(!B)return new u("Invalid "+P+" `"+C+"` key `"+x+"` supplied to `"+E+"`.\nBad object: "+JSON.stringify(v[w],null," ")+`
Valid keys: `+JSON.stringify(Object.keys(s),null," "));let $=B(T,x,E,P,C+"."+x,Q);if($)return $}return null}return f(d)}function k(s){switch(typeof s){case"number":case"string":case"undefined":return!0;case"boolean":return!s;case"object":if(Array.isArray(s))return s.every(k);if(s===null||e(s))return!0;var d=r(s);if(d){let v=d.call(s),w;if(d!==s.entries){for(;!(w=v.next()).done;)if(!k(w.value))return!1}else for(;!(w=v.next()).done;){let E=w.value;if(E&&!k(E[1]))return!1}}else return!1;return!0;default:return!1}}function W(s,d){return s==="symbol"?!0:d?d["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&d instanceof Symbol:!1}function _(s){let d=typeof s;return Array.isArray(s)?"array":s instanceof RegExp?"object":W(d,s)?"symbol":d}function Y(s){if(typeof s>"u"||s===null)return""+s;let d=_(s);if(d==="object"){if(s instanceof Date)return"date";if(s instanceof RegExp)return"regexp"}return d}function j(s){let d=Y(s);switch(d){case"array":case"object":return"an "+d;case"boolean":case"date":case"regexp":return"a "+d;default:return d}}function Z(s){return!s.constructor||!s.constructor.name?i:s.constructor.name}return c.checkPropTypes=ft,c.resetWarningCache=ft.resetWarningCache,c.PropTypes=c,c},O=Xe(function(e){{let t=At,n=!0;e.exports=no(t.isElement,n)}}),Ue="data-focus-lock",Lt="data-focus-lock-disabled",oo="data-no-focus-lock",ro="data-autofocus-inside";function co(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function io(e,t){var n=a.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){let r=n.value;r!==o&&(n.value=o,n.callback(o,r))}}}})[0];return n.callback=t,n.facade}function Mt(e,t){return io(t,function(n){return e.forEach(function(o){return co(o,n)})})}var Le={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"};O.node;var Ce=function(){return Ce=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ce.apply(this,arguments)};function ao(e,t){let n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}function Nt(e){return e}function Bt(e,t){t===void 0&&(t=Nt);let n=[],o=!1;return{read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){let c=t(i,o);return n.push(c),function(){n=n.filter(function(l){return l!==c})}},assignSyncMedium:function(i){for(o=!0;n.length;){let c=n;n=[],c.forEach(i)}n={push:function(c){return i(c)},filter:function(){return n}}},assignMedium:function(i){o=!0;let c=[];if(n.length){let f=n;n=[],f.forEach(i),c=n}let l=function(){let f=c;c=[],f.forEach(i)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(f){c.push(f),u()},filter:function(f){return c=c.filter(f),n}}}}}function Qe(e,t){return t===void 0&&(t=Nt),Bt(e,t)}function jt(e){e===void 0&&(e={});let t=Bt(null);return t.options=Ce({async:!0,ssr:!1},e),t}var $t=function(e){let t=e.sideCar,n=ao(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");let o=t.read();if(!o)throw new Error("Sidecar medium not found");return a.createElement(o,Ce({},n))};$t.isSideCarExport=!0;function so(e,t){return e.useMedium(t),$t}var Wt=Qe({},function(e){let t=e.target,n=e.currentTarget;return{target:t,currentTarget:n}}),Yt=Qe(),uo=Qe(),lo=jt({async:!0}),fo=[],ke=a.forwardRef(function(t,n){let o,r=a.useState(),i=r[0],c=r[1],l=a.useRef(),u=a.useRef(!1),f=a.useRef(null),y=t.children,h=t.disabled,g=t.noFocusGuards,R=t.persistentFocus,I=t.crossFrame,p=t.autoFocus,b=t.allowTextSelection,L=t.group,M=t.className,A=t.whiteList,F=t.shards,N=F===void 0?fo:F,k=t.as,W=k===void 0?"div":k,_=t.lockProps,Y=_===void 0?{}:_,j=t.sideCar,Z=t.returnFocus,s=t.onActivation,d=t.onDeactivation,v=a.useState({}),w=v[0],E=a.useCallback(function(){f.current=f.current||document&&document.activeElement,l.current&&s&&s(l.current),u.current=!0},[s]),P=a.useCallback(function(){u.current=!1,d&&d(l.current)},[d]),C=a.useCallback(function(G){let ee=f.current;if(Z&&ee&&ee.focus){let pe=typeof Z=="object"?Z:void 0;f.current=null,G?Promise.resolve().then(function(){return ee.focus(pe)}):ee.focus(pe)}},[Z]),T=a.useCallback(function(G){u.current&&Wt.useMedium(G)},[]),S=Yt.useMedium,D=a.useCallback(function(G){l.current!==G&&(l.current=G,c(G))},[]);typeof b<"u"&&console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default"),a.useEffect(function(){l.current||console.error("FocusLock: could not obtain ref to internal node")},[]);let x=We((o={},o[Lt]=h&&"disabled",o[Ue]=L,o),Y),B=g!==!0,$=B&&g!=="tail",Ae=Mt([n,D]);return a.createElement(a.Fragment,null,B&&[a.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:h?-1:0,style:Le}),a.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:h?-1:1,style:Le})],!h&&a.createElement(j,{id:w,sideCar:lo,observed:i,disabled:h,persistentFocus:R,crossFrame:I,autoFocus:p,whiteList:A,shards:N,onActivation:E,onDeactivation:P,returnFocus:C}),a.createElement(W,We({ref:Ae},x,{className:M,onBlur:S,onFocus:T}),y),$&&a.createElement("div",{"data-focus-guard":!0,tabIndex:h?-1:0,style:Le}))});ke.propTypes={children:O.node,disabled:O.bool,returnFocus:O.oneOfType([O.bool,O.object]),noFocusGuards:O.bool,allowTextSelection:O.bool,autoFocus:O.bool,persistentFocus:O.bool,crossFrame:O.bool,group:O.string,className:O.string,whiteList:O.func,shards:O.arrayOf(O.any),as:O.oneOfType([O.string,O.func,O.object]),lockProps:O.object,onActivation:O.func,onDeactivation:O.func,sideCar:O.any.isRequired};ke.defaultProps={children:void 0,disabled:!1,returnFocus:!1,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};function He(e,t){return He=Object.setPrototypeOf||function(o,r){return o.__proto__=r,o},He(e,t)}function mo(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,He(e,t)}function po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ho(e,t){{if(typeof e!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof t!="function")throw new Error("Expected handleStateChangeOnClient to be a function.")}function n(o){return o.displayName||o.name||"Component"}return function(r){if(typeof r!="function")throw new Error("Expected WrappedComponent to be a React component.");let i=[],c;function l(){c=e(i.map(function(f){return f.props})),t(c)}let u=function(f){mo(y,f);function y(){return f.apply(this,arguments)||this}y.peek=function(){return c};let h=y.prototype;return h.componentDidMount=function(){i.push(this),l()},h.componentDidUpdate=function(){l()},h.componentWillUnmount=function(){let R=i.indexOf(this);i.splice(R,1),l()},h.render=function(){return a.createElement(r,this.props)},y}(a.PureComponent);return po(u,"displayName","SideEffect("+n(r)+")"),u}}var X=function(e){let t=Array(e.length);for(let n=0;n<e.length;++n)t[n]=e[n];return t},Ge=function(e){return Array.isArray(e)?e:[e]},yo=function(e){let t=new Set,n=e.length;for(let o=0;o<n;o+=1)for(let r=o+1;r<n;r+=1){let i=e[o].compareDocumentPosition(e[r]);(i&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(r),(i&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(o)}return e.filter(function(o,r){return!t.has(r)})},Ut=function(e){return e.parentNode?Ut(e.parentNode):e},Ve=function(e){return Ge(e).filter(Boolean).reduce(function(n,o){let r=o.getAttribute(Ue);return n.push.apply(n,r?yo(X(Ut(o).querySelectorAll("["+Ue+'="'+r+'"]:not(['+Lt+'="disabled"])'))):[o]),n},[])},go=function(e){return!e||!e.getPropertyValue?!1:e.getPropertyValue("display")==="none"||e.getPropertyValue("visibility")==="hidden"},Ht=function(e){return!e||e===document||e&&e.nodeType===Node.DOCUMENT_NODE||!go(window.getComputedStyle(e,null))&&Ht(e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode)},bo=function(e){return!((e.tagName==="INPUT"||e.tagName==="BUTTON")&&(e.type==="hidden"||e.disabled))},Je=function(e){return!!(e&&e.dataset&&e.dataset.focusGuard)},Se=function(e){return!Je(e)},vo=function(e){return!!e},wo=function(e,t){let n=e.tabIndex-t.tabIndex,o=e.index-t.index;if(n){if(!e.tabIndex)return 1;if(!t.tabIndex)return-1}return n||o},Gt=function(e,t,n){return X(e).map(function(o,r){return{node:o,index:r,tabIndex:n&&o.tabIndex===-1?(o.dataset||{}).focusGuard?0:-1:o.tabIndex}}).filter(function(o){return!t||o.tabIndex>=0}).sort(wo)},Eo=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],qe=Eo.join(","),To=qe+", [data-focus-guard]",et=function(e,t){return e.reduce(function(n,o){return n.concat(X(o.querySelectorAll(t?To:qe)),o.parentNode?X(o.parentNode.querySelectorAll(qe)).filter(function(r){return r===o}):[])},[])},Co=function(e){let t=e.querySelectorAll("["+ro+"]");return X(t).map(function(n){return et([n])}).reduce(function(n,o){return n.concat(o)},[])},tt=function(e){return X(e).filter(function(t){return Ht(t)}).filter(function(t){return bo(t)})},Ze=function(e,t){return Gt(tt(et(e,t)),!0,t)},dt=function(e){return Gt(tt(et(e)),!1)},So=function(e){return tt(Co(e))},ze=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&ze(e.parentNode,t),t},Me=function(e,t){let n=ze(e),o=ze(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(o.indexOf(i)>=0)return i}return!1},qt=function(e,t,n){let o=Ge(e),r=Ge(t),i=o[0],c=!1;return r.filter(Boolean).forEach(function(l){c=Me(c||l,l)||c,n.filter(Boolean).forEach(function(u){let f=Me(i,u);f&&(!c||f.contains(c)?c=f:c=Me(f,c))})}),c},Po=function(e){return e.reduce(function(t,n){return t.concat(So(n))},[])},Oo=function(e){let t=Ve(e).filter(Se),n=qt(e,e,t),o=Ze([n],!0),r=Ze(t).filter(function(i){let c=i.node;return Se(c)}).map(function(i){return i.node});return o.map(function(i){let c=i.node,l=i.index;return{node:c,index:l,lockItem:r.indexOf(c)>=0,guard:Je(c)}})},Ro=function(e){return e===document.activeElement},ko=function(e){return!!X(e.querySelectorAll("iframe")).some(function(t){return Ro(t)})},Zt=function(e){let t=document&&document.activeElement;return!t||t.dataset&&t.dataset.focusGuard?!1:Ve(e).reduce(function(n,o){return n||o.contains(t)||ko(o)},!1)},Do=function(){return document&&X(document.querySelectorAll("["+oo+"]")).some(function(e){return e.contains(document.activeElement)})},zt=function(e){return e.tagName==="INPUT"&&e.type==="radio"},xo=function(e,t){return t.filter(zt).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},nt=function(e,t){return zt(e)&&e.name?xo(e,t):e},Ao=function(e){let t=new Set;return e.forEach(function(n){return t.add(nt(n,e))}),e.filter(function(n){return t.has(n)})},mt=function(e){return e[0]&&e.length>1?nt(e[0],e):e[0]},pt=function(e,t){return e.length>1?e.indexOf(nt(e[t],e)):t},Kt="NEW_FOCUS",Io=function(e,t,n,o){let r=e.length,i=e[0],c=e[r-1],l=Je(n);if(e.indexOf(n)>=0)return;let u=t.indexOf(n),f=o?t.indexOf(o):u,y=o?e.indexOf(o):-1,h=u-f,g=t.indexOf(i),R=t.indexOf(c),I=Ao(t),p=I.indexOf(n)-(o?I.indexOf(o):u),b=pt(e,0),L=pt(e,r-1);if(u===-1||y===-1)return Kt;if(!h&&y>=0)return y;if(u<=g&&l&&Math.abs(h)>1)return L;if(u>=R&&l&&Math.abs(h)>1)return b;if(h&&Math.abs(p)>1)return y;if(u<=g)return L;if(u>R)return b;if(h)return Math.abs(h)>1?y:(r+y+h)%r},Fo=function(e){return function(t){return t.autofocus||t.dataset&&!!t.dataset.autofocus||e.indexOf(t)>=0}},_o=function(e,t){let n=new Map;return t.forEach(function(o){return n.set(o.node,o)}),e.map(function(o){return n.get(o)}).filter(vo)},Lo=function(e,t){let n=document&&document.activeElement,o=Ve(e).filter(Se),r=qt(n||e,e,o),i=dt(o),c=Ze(o).filter(function(h){let g=h.node;return Se(g)});if(!c[0]&&(c=i,!c[0]))return;let l=dt([r]).map(function(h){return h.node}),u=_o(l,c),f=u.map(function(h){return h.node}),y=Io(f,l,n,t);if(y===Kt){let h=i.map(function(g){return g.node}).filter(Fo(Po(o)));return{node:h&&h.length?mt(h):mt(f)}}return y===void 0?y:u[y]},Mo=function(e){e.focus(),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},Ne=0,Be=!1,Xt=function(e,t){let n=Lo(e,t);if(!Be&&n){if(Ne>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Be=!0,setTimeout(function(){Be=!1},1);return}Ne++,Mo(n.node),Ne--}};function Qt(e){let t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var No=function(){return document&&document.activeElement===document.body},Bo=function(){return No()||Do()},se=null,ce=null,ue=null,de=!1,jo=function(){return!0},$o=function(t){return(se.whiteList||jo)(t)},Wo=function(t,n){ue={observerNode:t,portaledElement:n}},Yo=function(t){return ue&&ue.portaledElement===t};function ht(e,t,n,o){let r=null,i=e;do{let c=o[i];if(c.guard)c.node.dataset.focusAutoGuard&&(r=c);else if(c.lockItem){if(i!==e)return;r=null}else break}while((i+=n)!==t);r&&(r.node.tabIndex=0)}var Uo=function(t){return t&&"current"in t?t.current:t},Ho=function(t){return t?!!de:de==="meanwhile"},Pe=function(){let t=!1;if(se){let n=se,o=n.observed,r=n.persistentFocus,i=n.autoFocus,c=n.shards,l=n.crossFrame,u=o||ue&&ue.portaledElement,f=document&&document.activeElement;if(u){let y=[u].concat(c.map(Uo).filter(Boolean));if((!f||$o(f))&&(r||Ho(l)||!Bo()||!ce&&i)&&(u&&!(Zt(y)||Yo(f))&&(document&&!ce&&f&&!i?(f.blur&&f.blur(),document.body.focus()):(t=Xt(y,ce),ue={})),de=!1,ce=document&&document.activeElement),document){let h=document&&document.activeElement,g=Oo(y),R=g.map(function(I){return I.node}).indexOf(h);R>-1&&(g.filter(function(I){let p=I.guard,b=I.node;return p&&b.dataset.focusAutoGuard}).forEach(function(I){return I.node.removeAttribute("tabIndex")}),ht(R,g.length,1,g),ht(R,-1,-1,g))}}}return t},Vt=function(t){Pe()&&t&&(t.stopPropagation(),t.preventDefault())},ot=function(){return Qt(Pe)},Go=function(t){let n=t.target,o=t.currentTarget;o.contains(n)||Wo(o,n)},qo=function(){return null};O.node.isRequired;var Jt=function(){de="just",setTimeout(function(){de="meanwhile"},0)},Zo=function(){document.addEventListener("focusin",Vt,!0),document.addEventListener("focusout",ot),window.addEventListener("blur",Jt)},zo=function(){document.removeEventListener("focusin",Vt,!0),document.removeEventListener("focusout",ot),window.removeEventListener("blur",Jt)};function Ko(e){return e.filter(function(t){return!t.disabled})}function Xo(e){let t=e.slice(-1)[0];t&&!se&&Zo();let n=se,o=n&&t&&t.id===n.id;se=t,n&&!o&&(n.onDeactivation(),e.filter(function(r){return r.id===n.id}).length||n.returnFocus(!t)),t?(ce=null,(!o||n.observed!==t.observed)&&t.onActivation(),Pe(),Qt(Pe)):(zo(),ce=null)}Wt.assignSyncMedium(Go);Yt.assignMedium(ot);uo.assignMedium(function(e){return e({moveFocusInside:Xt,focusInside:Zt})});var Qo=ho(Ko,Xo)(qo),en=a.forwardRef(function(t,n){return a.createElement(ke,We({sideCar:Qo,ref:n},t))}),tn=ke.propTypes||{};tn.sideCar;var Vo=Vn(tn,["sideCar"]);en.propTypes=Vo;var le=function(){return le=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},le.apply(this,arguments)};function Jo(e,t){let n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}var we="right-scroll-bar-position",Ee="width-before-scroll-bar",er="with-scroll-bars-hidden",tr="--removed-body-scroll-bar-size",nn=jt(),je=function(){},De=a.forwardRef(function(e,t){let n=a.useRef(null),o=a.useState({onScrollCapture:je,onWheelCapture:je,onTouchMoveCapture:je}),r=o[0],i=o[1],c=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,y=e.enabled,h=e.shards,g=e.sideCar,R=e.noIsolation,I=e.inert,p=e.allowPinchZoom,b=e.as,L=b===void 0?"div":b,M=Jo(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),A=g,F=Mt([n,t]),N=le({},M,r);return a.createElement(a.Fragment,null,y&&a.createElement(A,{sideCar:nn,removeScrollBar:f,shards:h,noIsolation:R,inert:I,setCallbacks:i,allowPinchZoom:!!p,lockRef:n}),c?a.cloneElement(a.Children.only(l),le({},N,{ref:F})):a.createElement(L,le({},N,{className:u,ref:F}),l))});De.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};De.classNames={fullWidth:Ee,zeroRight:we};var nr=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function or(){if(!document)return null;let e=document.createElement("style");e.type="text/css";let t=nr();return t&&e.setAttribute("nonce",t),e}function rr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cr(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var ir=function(){let e=0,t=null;return{add:function(n){e==0&&(t=or())&&(rr(t,n),cr(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ar=function(){let e=ir();return function(t){a.useEffect(function(){return e.add(t),function(){e.remove()}},[])}},on=function(){let e=ar();return function(n){let o=n.styles;return e(o),null}},sr={left:0,top:0,right:0,gap:0},$e=function(e){return parseInt(e||"",10)||0},ur=function(e){let t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[$e(n),$e(o),$e(r)]},yt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return sr;let t=ur(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},lr=on(),fr=function(e,t,n,o){let r=e.left,i=e.top,c=e.right,l=e.gap;return n===void 0&&(n="margin"),`
.`+er+` {
overflow: hidden `+o+`;
padding-right: `+l+"px "+o+`;
}
body {
overflow: hidden `+o+`;
`+[t&&"position: relative "+o+";",n==="margin"&&`
padding-left: `+r+`px;
padding-top: `+i+`px;
padding-right: `+c+`px;
margin-left:0;
margin-top:0;
margin-right: `+l+"px "+o+`;
`,n==="padding"&&"padding-right: "+l+"px "+o+";"].filter(Boolean).join("")+`
}
.`+we+` {
right: `+l+"px "+o+`;
}
.`+Ee+` {
margin-right: `+l+"px "+o+`;
}
.`+we+" ."+we+` {
right: 0 `+o+`;
}
.`+Ee+" ."+Ee+` {
margin-right: 0 `+o+`;
}
body {
`+tr+": "+l+`px;
}
`},dr=function(e){let t=a.useState(yt(e.gapMode)),n=t[0],o=t[1];a.useEffect(function(){o(yt(e.gapMode))},[e.gapMode]);let r=e.noRelative,i=e.noImportant,c=e.gapMode;return a.createElement(lr,{styles:fr(n,!r,c===void 0?"margin":c,i?"":"!important")})},mr=function(e){let t=window.getComputedStyle(e);return t.overflowY!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowY==="visible")},pr=function(e){let t=window.getComputedStyle(e);return t.overflowX!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowX==="visible")},gt=function(e,t){let n=t;do{if(rn(e,n)){let r=cn(e,n),i=r[1],c=r[2];if(i>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},hr=function(e){let t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},yr=function(e){let t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},rn=function(e,t){return e==="v"?mr(t):pr(t)},cn=function(e,t){return e==="v"?hr(t):yr(t)},gr=function(e,t,n,o,r){let i=o,c=n.target,l=t.contains(c),u=!1,f=i>0,y=0,h=0;do{let g=cn(e,c),R=g[0],I=g[1],p=g[2],b=I-p-R;(R||b)&&rn(e,c)&&(y+=b,h+=R),c=c.parentNode}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(f&&(r&&y===0||!r&&i>y)||!f&&(r&&h===0||!r&&-i>h))&&(u=!0),u},Ke=!1;if(typeof window<"u")try{let e=Object.defineProperty({},"passive",{get:function(){return Ke=!0,!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch{Ke=!1}var te=Ke?{passive:!1}:!1,ge=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bt=function(e){return[e.deltaX,e.deltaY]},vt=function(e){return e&&"current"in e?e.current:e},br=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vr=function(e){return`
.block-interactivity-`+e+` {pointer-events: none;}
.allow-interactivity-`+e+` {pointer-events: all;}
`},wr=0,ne=[];function Er(e){let t=a.useRef([]),n=a.useRef([0,0]),o=a.useRef(),r=a.useState(wr++)[0],i=a.useState(function(){return on()})[0],c=a.useRef(e);a.useEffect(function(){c.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-"+r);let p=[e.lockRef.current].concat((e.shards||[]).map(vt)).filter(Boolean);return p.forEach(function(b){return b.classList.add("allow-interactivity-"+r)}),function(){document.body.classList.remove("block-interactivity-"+r),p.forEach(function(b){return b.classList.remove("allow-interactivity-"+r)})}}},[e.inert,e.lockRef.current,e.shards]);let l=a.useCallback(function(p,b){if("touches"in p&&p.touches.length===2)return!c.current.allowPinchZoom;let L=ge(p),M=n.current,A="deltaX"in p?p.deltaX:M[0]-L[0],F="deltaY"in p?p.deltaY:M[1]-L[1],N,k=p.target,W=Math.abs(A)>Math.abs(F)?"h":"v",_=gt(W,k);if(!_)return!0;if(_?N=W:(N=W==="v"?"h":"v",_=gt(W,k)),!_)return!1;if(!o.current&&"changedTouches"in p&&(A||F)&&(o.current=N),!N)return!0;let Y=o.current||N;return gr(Y,b,p,Y==="h"?A:F,!0)},[]),u=a.useCallback(function(p){let b=p;if(!ne.length||ne[ne.length-1]!==i)return;let L="deltaY"in b?bt(b):ge(b),M=t.current.filter(function(A){return A.name===b.type&&A.target===b.target&&br(A.delta,L)})[0];if(M&&M.should){b.preventDefault();return}if(!M){let A=(c.current.shards||[]).map(vt).filter(Boolean).filter(function(N){return N.contains(b.target)});(A.length>0?l(b,A[0]):!c.current.noIsolation)&&b.preventDefault()}},[]),f=a.useCallback(function(p,b,L,M){let A={name:p,delta:b,target:L,should:M};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(F){return F!==A})},1)},[]),y=a.useCallback(function(p){n.current=ge(p),o.current=void 0},[]),h=a.useCallback(function(p){f(p.type,bt(p),p.target,l(p,e.lockRef.current))},[]),g=a.useCallback(function(p){f(p.type,ge(p),p.target,l(p,e.lockRef.current))},[]);a.useEffect(function(){return ne.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,te),document.addEventListener("touchmove",u,te),document.addEventListener("touchstart",y,te),function(){ne=ne.filter(function(p){return p!==i}),document.removeEventListener("wheel",u,te),document.removeEventListener("touchmove",u,te),document.removeEventListener("touchstart",y,te)}},[]);let R=e.removeScrollBar,I=e.inert;return a.createElement(a.Fragment,null,I?a.createElement(i,{styles:vr(r)}):null,R?a.createElement(dr,{gapMode:"margin"}):null)}var Tr=so(nn,Er),an=a.forwardRef(function(e,t){return a.createElement(De,le({},e,{ref:t,sideCar:Tr}))});an.classNames=De.classNames;function H(){return H=Object.assign||function(e){for(let t=1;t<arguments.length;t++){let n=arguments[t];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},H.apply(this,arguments)}function xe(e,t){if(e==null)return{};let n={},o=Object.keys(e),r,i;for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}var sn={allowPinchZoom:O.bool,dangerouslyBypassFocusLock:O.bool,dangerouslyBypassScrollLock:O.bool,initialFocusRef:function(){return null},onDismiss:O.func},J=Re(function(t,n){let o=t.as,r=o===void 0?"div":o,i=t.isOpen,c=i===void 0?!0:i,l=xe(t,["as","isOpen"]);return Dt("dialog"),a.useEffect(function(){c?window.__REACH_DISABLE_TOOLTIPS=!0:window.requestAnimationFrame(function(){window.__REACH_DISABLE_TOOLTIPS=!1})},[c]),c?a.createElement(xt,{"data-reach-dialog-wrapper":""},a.createElement(Cr,H({ref:n,as:r},l))):null});J.displayName="DialogOverlay",J.propTypes=H({},sn,{isOpen:O.bool});var Cr=Re(function(t,n){let o=t.allowPinchZoom,r=t.as,i=r===void 0?"div":r,c=t.dangerouslyBypassFocusLock,l=c===void 0?!1:c,u=t.dangerouslyBypassScrollLock,f=u===void 0?!1:u,y=t.initialFocusRef,h=t.onClick,g=t.onDismiss,R=g===void 0?U:g,I=t.onKeyDown,p=t.onMouseDown,b=t.unstable_lockFocusAcrossFrames,L=b===void 0?!0:b,M=xe(t,["allowPinchZoom","as","dangerouslyBypassFocusLock","dangerouslyBypassScrollLock","initialFocusRef","onClick","onDismiss","onKeyDown","onMouseDown","unstable_lockFocusAcrossFrames"]),A=a.useRef(null),F=a.useRef(null),N=Qn(F,n),k=a.useCallback(function(){y&&y.current&&y.current.focus()},[y]);function W(j){A.current===j.target&&(j.stopPropagation(),R(j))}function _(j){j.key==="Escape"&&(j.stopPropagation(),R(j))}function Y(j){A.current=j.target}return a.useEffect(function(){return F.current?Sr(F.current):void 0},[]),a.createElement(en,{autoFocus:!0,returnFocus:!0,onActivation:k,disabled:l,crossFrame:L},a.createElement(an,{allowPinchZoom:o,enabled:!f},a.createElement(i,H({},M,{ref:N,"data-reach-dialog-overlay":"",onClick:ve(h,W),onKeyDown:ve(I,_),onMouseDown:ve(p,Y)}))))});J.displayName="DialogOverlay",J.propTypes=H({},sn);var me=Re(function(t,n){let o=t.as,r=o===void 0?"div":o,i=t.onClick;t.onKeyDown;let c=xe(t,["as","onClick","onKeyDown"]);return a.createElement(r,H({"aria-modal":"true",role:"dialog",tabIndex:-1},c,{ref:n,"data-reach-dialog-content":"",onClick:ve(i,function(l){l.stopPropagation()})}))});me.displayName="DialogContent",me.propTypes={"aria-label":Oe,"aria-labelledby":Oe};var wt=Re(function(t,n){let o=t.allowPinchZoom,r=o===void 0?!1:o,i=t.initialFocusRef,c=t.isOpen,l=t.onDismiss,u=l===void 0?U:l,f=xe(t,["allowPinchZoom","initialFocusRef","isOpen","onDismiss"]);return a.createElement(J,{allowPinchZoom:r,initialFocusRef:i,isOpen:c,onDismiss:u},a.createElement(me,H({ref:n},f)))});wt.displayName="Dialog",wt.propTypes={isOpen:O.bool,onDismiss:O.func,"aria-label":Oe,"aria-labelledby":Oe};function Sr(e){let t=[],n=[],o=Zn(e);return e?(Array.prototype.forEach.call(o.querySelectorAll("body > *"),function(r){let i,c,l=(i=e.parentNode)==null||(c=i.parentNode)==null?void 0:c.parentNode;if(r===l)return;let u=r.getAttribute("aria-hidden");u!==null&&u!=="false"||(t.push(u),n.push(r),r.setAttribute("aria-hidden","true"))}),function(){n.forEach(function(r,i){let c=t[i];c===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",c)})}):(console.warn("A ref has not yet been attached to a dialog node when attempting to call `createAriaHider`."),U)}function Oe(e,t,n,o,r){let i=`
See https://www.w3.org/TR/wai-aria/#aria-label for details.`;return!e["aria-label"]&&!e["aria-labelledby"]?new Error("A <"+n+"> must have either an `aria-label` or `aria-labelledby` prop.\n "+i):e["aria-label"]&&e["aria-labelledby"]?new Error("You provided both `aria-label` and `aria-labelledby` props to a <"+n+">. If the a label for this component is visible on the screen, that label's component should be given a unique ID prop, and that ID should be passed as the `aria-labelledby` prop into <"+n+">. If the label cannot be determined programmatically from the content of the element, an alternative label should be provided as the `aria-label` prop, which will be used as an `aria-label` on the HTML tag."+i):e[t]!=null&&!Kn(e[t])?new Error("Invalid prop `"+t+"` supplied to `"+n+"`. Expected `string`, received `"+(Array.isArray(r)?"array":typeof r)+"`."):null}import{jsx as rt,jsxs as Pr}from"react/jsx-runtime";var Hr=({label:e,close:t,children:n,modalBodyProps:o={},closeButtonProps:r={},isOpen:i,maxWidth:c="40em",...l})=>rt(J,{"data-testid":"ladle-dialog-overlay",...l,isOpen:i,onDismiss:t,children:Pr(me,{"aria-label":e||"Modal","data-testid":"ladle-dialog",style:{maxWidth:c},children:[rt(st,{...r,onClick:u=>{r.onClick?.(u),!u.isDefaultPrevented()&&t(u)}}),rt("div",{...o,className:fe("ladle-addon-modal-body",o?.id),children:n})]})});export{Hr as AddonDialog};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */