UNPKG

@apideck/react-vault

Version:

<br />

1 lines 306 kB
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),r=require("@apideck/components"),o=e(require("jwt-decode")),a=require("react-i18next"),i=e(require("i18next")),l=require("swr"),s=e(l),u=require("react-dom"),c=require("formik"),d=e(require("markdown-to-jsx")),f=e(require("react-select")),p=require("@apideck/wayfinder"),m=e(require("fuse.js")),g="https://vault.apideck.com/oauth/callback";function h(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){h(a,r,o,i,l,"next",e)}function l(e){h(a,r,o,i,l,"throw",e)}i(void 0)}))}}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function x(e,t){return e(t={exports:{}},t.exports),t.exports}function w(e){return e&&e.default||e}i.use(a.initReactI18next).init({resources:{en:{translation:{Added:"Added",Available:"Available","Manage your integrations":"Manage your integrations","No integrations found":"No integrations found","No integrations have been added yet":"It looks like the application owner did not yet make any integrations available","No connections":"No connections","Search integrations":"Search integrations","Needs configuration":"Needs configuration","Invalid configuration":"Invalid configuration","Not connected":"Not connected",Disabled:"Disabled",Unauthorized:"Unauthorized","Input required":"Input required",Connected:"Connected",Loading:"Loading","Select..":"Select..",Example:"Example","Select field":"Select field","Select custom field":"Select custom field","Enter a field mapping.":"Enter a field mapping.","Search properties":"Search properties","Search fields":"Search fields","No fields found for mapping.":"No fields found for mapping.","No custom fields found for mapping.":"No custom fields found for mapping.","Search connectors":"Search connectors",Type:"Type","None selected":"None selected","Map a property to":"Map a property to","Mapping removed.":"Mapping removed.","Select a source property from your":"Select a source property from your","data to the":"data to the",field:"field","Map properties from your":"Map properties from your","data to one of the fields below":"data to one of the fields below","Signed in":"Signed in",Save:"Save","Trying to connect...":"Trying to connect...","Connection failed":"Connection failed","Could not connect to {{connectionName}}. Please check your credentials":"Could not connect to {{connectionName}}. Please check your credentials.","Need help? View our":"Need help? View our","Connection Guide":"Connection Guide","Successfully connected to {{connectionName}}":"Successfully connected to {{connectionName}}","Please provide default values for the fields below. These will be applied when creating new {{selectedResource}} through our integration.":"Please provide default values for the fields below. These will be applied when creating new {{selectedResource}} through our integration.","Configure the {{name}} integration in the":"Configure the {{name}} integration in the","before linking your account. This integration will not be visible to your users until configured.":"before linking your account. This integration will not be visible to your users until configured.","Something went wrong":"Something went wrong","The integration could not be authorized. Please make sure your settings are correct and try again.":"The integration could not be authorized. Please make sure your settings are correct and try again.",Authorize:"Authorize","Missing required fields":"Missing required fields","Missing required field mappings.":"Missing required field mappings.","Field Mapping":"Field Mapping","Admin configuration required":"Admin configuration required",enabled:"enabled",disabled:"disabled","settings are updated":"settings are updated","Updating failed":"Updating failed","{{connectionName}} is deleted":"{{connectionName}} is deleted","Configurable Resources":"Configurable Resources","Re-authorize":"Re-authorize",Disable:"Disable",Enable:"Enable",Disconnect:"Disconnect",Delete:"Delete",Close:"Close",Connection:"Connection","Are you sure?":"Are you sure?",Settings:"Settings","Configurable resources":"Configurable resources"}},nl:{translation:{Added:"Toegevoegd",Available:"Beschikbaar","Manage your integrations":"Beheer je integraties","No integrations found":"Geen integraties gevonden","No integrations have been added yet":"Er zijn nog geen integraties beschikbaar gesteld door de applicatie eigenaar","No connections":"Geen connecties","Search integrations":"Zoek integraties","Needs configuration":"Configuratie nodig","Invalid configuration":"Ongeldige configuratie","Not connected":"Niet verbonden",Disabled:"Uitgeschakeld",Unauthorized:"Ongeautoriseerd","Input required":"Input vereist",Connected:"Verbonden",Loading:"Laden","Select..":"Selecteer..",Example:"Voorbeeld","Select field":"Selecteer field","Select custom field":"Selecteer custom field","Enter a field mapping.":"Voer een mapping in.","Search properties":"Zoek properties","Search fields":"Zoek fields","No fields found for mapping.":"Geen fields gevonden voor mapping.","No custom fields found for mapping.":"Geen custom fields gevonden voor mapping.","Search connectors":"Zoek connectors",Type:"Type","None selected":"Geen geselecteerd","Map a property to":"Map een property naar","Mapping removed.":"Mapping verwijderd.","Select a source property from your":"Selecteer een bron property van je","data to the":"data naar de",field:"field","Map properties from your":"Map properties van je","data to one of the fields below":"data naar een van de onderstaande fields","Signed in":"Ingelogd",Save:"Opslaan","Trying to connect...":"Verbinding maken...","Connection failed":"Verbinding mislukt","Could not connect to {{connectionName}}. Please check your credentials":"Kon geen verbinding maken met {{connectionName}}. Controleer je credentials.","Need help? View our":"Hulp nodig? Bekijk onze","Connection Guide":"Connection Guide","Successfully connected to {{connectionName}}":"Verbonden met {{connectionName}}","Please provide default values for the fields below. These will be applied when creating new {{selectedResource}} through our integration.":'Vul hieronder standaardwaarden in voor de velden. Deze worden toegepast wanneer je nieuwe "{{selectedResource}}" maakt via onze integratie.',"Configure the {{name}} integration in the":"Configureer de {{name}} integratie in het","before linking your account. This integration will not be visible to your users until configured.":"voordat je je account koppelt. Deze integratie is niet zichtbaar voor je gebruikers totdat deze is geconfigureerd.","Something went wrong":"Er is iets misgegaan","The integration could not be authorized. Please make sure your settings are correct and try again.":"De integratie kon niet worden geautoriseerd. Controleer of je instellingen correct zijn en probeer het opnieuw.",Authorize:"Autoriseren","Missing required fields":"Ontbrekende verplichte velden","Missing required field mappings.":"Ontbrekende verplichte veldmappings.","Field Mapping":"Veldmapping","Admin configuration required":"Admin configuratie vereist",enabled:"ingeschakeld",disabled:"uitgeschakeld","settings are updated":"instellingen zijn bijgewerkt","Updating failed":"Bijwerken mislukt","{{connectionName}} is deleted":"{{connectionName}} is verwijderd","Configurable Resources":"Configruabelen Resources","Re-authorize":"Opnieuw autoriseren",Disable:"Uitschakelen",Enable:"Inschakelen",Disconnect:"Ontkoppelen",Delete:"Verwijderen",Close:"Sluiten",Connection:"Connectie","When you delete a connection you will lose all your configured settings.":"Wanneer je een connectie verwijdert, verlies je al je geconfigureerde instellingen.",Settings:"Instellingen","Configurable resources":"Configruabelen resources"}},fr:{translation:{Added:"Ajouté",Available:"Disponible","Manage your integrations":"Gérer vos intégrations","No integrations found":"Aucune intégration trouvée","No integrations have been added yet":"Il semble que le propriétaire de l'application n'ait pas encore rendu d'intégrations disponibles","No connections":"Aucune connexion","Search integrations":"Rechercher des intégrations","Needs configuration":"Nécessite une configuration","Invalid configuration":"Configuration invalide","Not connected":"Non connecté",Disabled:"Désactivé",Unauthorized:"Non autorisé","Input required":"Saisie requise",Connected:"Connecté",Loading:"Chargement","Select..":"Sélectionner..",Example:"Exemple","Select field":"Sélectionner le champ","Select custom field":"Sélectionner un champ personnalisé","Enter a field mapping.":"Entrez un mappage de champ.","Search properties":"Rechercher des propriétés","Search fields":"Rechercher des champs","No fields found for mapping.":"Aucun champ trouvé pour le mappage.","No custom fields found for mapping.":"Aucun champ personnalisé trouvé pour le mappage.","Search connectors":"Rechercher des connecteurs",Type:"Type","None selected":"Aucun sélectionné","Map a property to":"Mapper une propriété à","Mapping removed.":"Mappage supprimé.","Select a source property from your":"Sélectionnez une propriété source de votre","data to the":"données au",field:"champ","Map properties from your":"Mapper des propriétés de votre","data to one of the fields below":"données vers l'un des champs ci-dessous","Signed in":"Connecté",Save:"Sauvegarder","Trying to connect...":"Tentative de connexion...","Connection failed":"Connexion échouée","Could not connect to {{connectionName}}. Please check your credentials":"Impossible de se connecter à {{connectionName}}. Veuillez vérifier vos identifiants.","Need help? View our":"Besoin d'aide ? Voir notre","Connection Guide":"Guide de Connexion","Successfully connected to {{connectionName}}":"Connecté avec succès à {{connectionName}}","Please provide default values for the fields below. These will be applied when creating new {{selectedResource}} through our integration.":"Veuillez fournir des valeurs par défaut pour les champs ci-dessous. Elles seront appliquées lors de la création de nouveaux {{selectedResource}} via notre intégration.","Configure the {{name}} integration in the":"Configurez l'intégration {{name}} dans le","before linking your account. This integration will not be visible to your users until configured.":"avant de lier votre compte. Cette intégration ne sera pas visible par vos utilisateurs tant qu'elle ne sera pas configurée.","Something went wrong":"Quelque chose a mal tourné","The integration could not be authorized. Please make sure your settings are correct and try again.":"L'intégration n'a pas pu être autorisée. Veuillez vérifier que vos paramètres sont corrects et réessayez.",Authorize:"Autoriser","Missing required fields":"Champs obligatoires manquants","Missing required field mappings.":"Mappages de champs obligatoires manquants.","Field Mapping":"Mappage de champs","Admin configuration required":"Configuration d'admin requise",enabled:"activé",disabled:"désactivé","settings are updated":"les paramètres sont mis à jour","Updating failed":"La mise à jour a échoué","{{connectionName}} is deleted":"{{connectionName}} est supprimé","Configurable Resources":"Ressources configurables","Re-authorize":"Réautoriser",Disable:"Désactiver",Enable:"Activer",Disconnect:"Déconnecter",Delete:"Supprimer",Close:"Fermer",Connection:"Connexion","Are you sure?":"Êtes-vous sûr ?",Settings:"Paramètres","Configurable resources":"Ressources configurables"}},de:{translation:{Added:"Hinzugefügt",Available:"Verfügbar","Manage your integrations":"Ihre Integrationen verwalten","No integrations found":"Keine Integrationen gefunden","No integrations have been added yet":"Es wurden noch keine Integrationen hinzugefügt","No connections":"Keine Verbindungen","Search integrations":"Integrationen suchen","Needs configuration":"Benötigt Konfiguration","Invalid configuration":"Ungültige Konfiguration","Not connected":"Nicht verbunden",Disabled:"Deaktiviert",Unauthorized:"Unautorisiert","Input required":"Eingabe erforderlich",Connected:"Verbunden",Loading:"Laden","Select..":"Auswählen..",Example:"Beispiel","Select field":"Feld auswählen","Select custom field":"Benutzerdefiniertes Feld auswählen","Enter a field mapping.":"Geben Sie eine Feldzuordnung ein.","Search properties":"Eigenschaften suchen","Search fields":"Felder suchen","No fields found for mapping.":"Keine Felder für die Zuordnung gefunden.","No custom fields found for mapping.":"Keine benutzerdefinierten Felder für die Zuordnung gefunden.","Search connectors":"Konnektoren suchen",Type:"Typ","None selected":"Keine ausgewählt","Map a property to":"Eigenschaft zuordnen zu","Mapping removed.":"Zuordnung entfernt.","Select a source property from your":"Wählen Sie eine Quelleigenschaft aus Ihrem","data to the":"Daten zum",field:"Feld","Map properties from your":"Eigenschaften zuordnen von Ihrem","data to one of the fields below":"Daten zu einem der folgenden Felder","Signed in":"Angemeldet",Save:"Speichern","Trying to connect...":"Versuche zu verbinden...","Connection failed":"Verbindung fehlgeschlagen","Could not connect to {{connectionName}}. Please check your credentials":"Verbindung zu {{connectionName}} konnte nicht hergestellt werden. Bitte überprüfen Sie Ihre Anmeldeinformationen","Need help? View our":"Brauchen Sie Hilfe? Sehen Sie sich unser","Connection Guide":"Verbindungsleitfaden","Successfully connected to {{connectionName}}":"Erfolgreich verbunden mit {{connectionName}}","Please provide default values for the fields below. These will be applied when creating new {{selectedResource}} through our integration.":"Bitte geben Sie Standardwerte für die untenstehenden Felder an. Diese werden angewendet, wenn neue {{selectedResource}} über unsere Integration erstellt werden.","Configure the {{name}} integration in the":"Konfigurieren Sie die {{name}}-Integration in der","before linking your account. This integration will not be visible to your users until configured.":"bevor Sie Ihr Konto verknüpfen. Diese Integration ist für Ihre Benutzer nicht sichtbar, bis sie konfiguriert ist.","Something went wrong":"Etwas ist schiefgelaufen","The integration could not be authorized. Please make sure your settings are correct and try again.":"Die Integration konnte nicht autorisiert werden. Bitte stellen Sie sicher, dass Ihre Einstellungen korrekt sind und versuchen Sie es erneut.",Authorize:"Autorisieren","Missing required fields":"Fehlende erforderliche Felder","Missing required field mappings.":"Fehlende erforderliche Feldzuordnungen.","Field Mapping":"Feldzuordnung","Admin configuration required":"Admin-Konfiguration erforderlich",enabled:"aktiviert",disabled:"deaktiviert","settings are updated":"Einstellungen werden aktualisiert","Updating failed":"Aktualisierung fehlgeschlagen","{{connectionName}} is deleted":"{{connectionName}} wurde gelöscht","Configurable Resources":"Konfigurierbare Ressourcen","Re-authorize":"Erneut autorisieren",Disable:"Deaktivieren",Enable:"Aktivieren",Disconnect:"Trennen",Delete:"Löschen",Close:"Schließen",Connection:"Verbindung","Are you sure?":"Sind Sie sicher?",Settings:"Einstellungen","Configurable resources":"Konfigurierbare Ressourcen"}},es:{translation:{Added:"Agregado",Available:"Disponible","Manage your integrations":"Gestiona tus integraciones","No integrations found":"No se encontraron integraciones","No integrations have been added yet":"Aún no se han agregado integraciones","No connections":"Sin conexiones","Search integrations":"Buscar integraciones","Needs configuration":"Necesita configuración","Invalid configuration":"Configuración inválida","Not connected":"No conectado",Disabled:"Deshabilitado",Unauthorized:"No autorizado","Input required":"Se requiere entrada",Connected:"Conectado",Loading:"Cargando","Select..":"Seleccionar..",Example:"Ejemplo","Select field":"Seleccionar campo","Select custom field":"Seleccionar campo personalizado","Enter a field mapping.":"Introduce un mapeo de campo.","Search properties":"Buscar propiedades","Search fields":"Buscar campos","No fields found for mapping.":"No se encontraron campos para mapeo.","No custom fields found for mapping.":"No se encontraron campos personalizados para mapeo.","Search connectors":"Buscar conectores",Type:"Tipo","None selected":"Ninguno seleccionado","Map a property to":"Mapear una propiedad a","Mapping removed.":"Mapeo eliminado.","Select a source property from your":"Selecciona una propiedad fuente de tu","data to the":"datos al",field:"campo","Map properties from your":"Mapear propiedades de tu","data to one of the fields below":"datos a uno de los campos a continuación","Signed in":"Registrado",Save:"Guardar","Trying to connect...":"Intentando conectar...","Connection failed":"Conexión fallida","Could not connect to {{connectionName}}. Please check your credentials":"No se pudo conectar a {{connectionName}}. Por favor, verifica tus credenciales","Need help? View our":"¿Necesitas ayuda? Ver nuestro","Connection Guide":"Guía de Conexión","Successfully connected to {{connectionName}}":"Conectado exitosamente a {{connectionName}}","Please provide default values for the fields below. These will be applied when creating new {{selectedResource}} through our integration.":"Por favor, proporciona valores predeterminados para los campos a continuación. Estos se aplicarán al crear nuevos {{selectedResource}} a través de nuestra integración.","Configure the {{name}} integration in the":"Configura la integración {{name}} en el","before linking your account. This integration will not be visible to your users until configured.":"antes de vincular tu cuenta. Esta integración no será visible para tus usuarios hasta que esté configurada.","Something went wrong":"Algo salió mal","The integration could not be authorized. Please make sure your settings are correct and try again.":"La integración no pudo ser autorizada. Por favor, asegúrate de que tus ajustes son correctos y vuelve a intentarlo.",Authorize:"Autorizar","Missing required fields":"Faltan campos requeridos","Missing required field mappings.":"Faltan mapeos de campos requeridos.","Field Mapping":"Mapeo de Campo","Admin configuration required":"Se requiere configuración de administrador",enabled:"habilitado",disabled:"deshabilitado","settings are updated":"los ajustes están actualizados","Updating failed":"Actualización fallida","{{connectionName}} is deleted":"{{connectionName}} ha sido eliminado","Configurable Resources":"Recursos Configurables","Re-authorize":"Reautorizar",Disable:"Deshabilitar",Enable:"Habilitar",Disconnect:"Desconectar",Delete:"Eliminar",Close:"Cerrar",Connection:"Conexión","Are you sure?":"¿Estás seguro?",Settings:"Ajustes","Configurable resources":"Recursos Configurables"}}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});var E=x((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var o=Object.create((t&&t.prototype instanceof d?t:d).prototype),a=new C(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var l=x(i,n);if(l){if(l===c)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=u(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===c)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(e,n,a),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var c={};function d(){}function f(){}function p(){}var m={};l(m,o,(function(){return this}));var g=Object.getPrototypeOf,h=g&&g(g(k([])));h&&h!==t&&n.call(h,o)&&(m=h);var v=p.prototype=d.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var r;this._invoke=function(o,a){function i(){return new t((function(r,i){!function r(o,a,i,l){var s=u(e[o],e,a);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,l)}),(function(e){r("throw",e,i,l)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,l)}))}l(s.arg)}(o,a,r,i)}))}return r=r?r.then(i,i):i()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function k(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=p,l(v,"constructor",p),l(p,"constructor",f),f.displayName=l(p,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(y.prototype),l(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,o,a){void 0===a&&(a=Promise);var i=new y(s(t,n,r,o),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(v),l(v,i,"Generator"),l(v,o,(function(){return this})),l(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=k,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),C=t.createContext({}),k=function(e){var o=e.token,i=e.appId,u=e.consumerId,c=e.isOpen,d=e.unifiedApi,f=e.serviceId,p=e.unifyBaseUrl,m=e.children,g=e.onConnectionChange,h=e.onConnectionDelete,y=e.onClose,x=t.useState(null),w=x[0],k=x[1],S=t.useState([]),_=S[0],N=S[1],O=t.useState(!1),M=O[0],P=O[1],A=l.useSWRConfig().mutate,I=r.useToast().addToast,T=a.useTranslation().t,L=!(null==d||!d.length||null==f||!f.length),R=t.useMemo((function(){return{Authorization:"Bearer "+o,"X-APIDECK-APP-ID":i,"X-APIDECK-CONSUMER-ID":u,"X-APIDECK-AUTH-TYPE":"JWT","Content-Type":"application/json"}}),[o,i,u]),F=function(){var e=v(E.mark((function e(t){var n;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t,{headers:R});case 2:return n=e.sent,e.next=5,n.json();case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),j=p+"/vault/connections"+(d?"?api="+d:""),D=p+"/vault/connections/"+(null==w?void 0:w.unified_api)+"/"+(null==w?void 0:w.service_id),V=s(j,F,{shouldRetryOnError:!1,revalidateOnFocus:!1}),z=V.data,B=V.error,H=s(w?D:null,F,{shouldRetryOnError:!1}),U=H.data,W=H.error,q=null!=U&&U.data?b({},w,null==U?void 0:U.data):w,$=r.usePrevious(q);t.useEffect((function(){L&&k({unified_api:d,service_id:f})}),[L]),t.useEffect((function(){null!=d&&d.length&&null!=f&&f.length&&$&&(null==$||!$.hasOwnProperty("enabled"))&&null!=q&&q.hasOwnProperty("enabled")&&!q.enabled&&G({unifiedApi:d,serviceId:f,values:{enabled:!0},quiet:!0})}),[q]),t.useEffect((function(){if(q){var e=q.configurable_resources,t=q.state;null!=e&&e.length&&("authorized"===t||"callable"===t)&&!_.length&&!M&&ee()}}),[q]);var G=function(){var e=v(E.mark((function e(t){var n,r,o,a,i,l,s,u,c,d,f,m,h,v;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.unifiedApi,r=t.serviceId,o=t.values,a=t.resource,i=t.quiet,e.prev=1,P(!0),l=p+"/vault/connections/"+n+"/"+r,a&&(l=l+"/"+a+"/config"),e.next=7,fetch(l,{method:"PATCH",headers:R,body:JSON.stringify(o)});case 7:return s=e.sent,e.next=10,s.json();case 10:if(null==(u=e.sent)||!u.data){e.next=24;break}if(L||(d=b({},z,{data:[u.data].concat(null==z||null==(c=z.data)?void 0:c.filter((function(e){return e.id!==u.data.id})))}),A(p+"/vault/connections",d,!1)),f=b({},z,{data:u.data}),A(l,f,!1),k(b({},w,u.data)),!a){e.next=19;break}return e.next=19,ee();case 19:return i||(v=o.hasOwnProperty("enabled")?(null==(m=u.data)?void 0:m.name)+" is "+T(o.enabled?"enabled":"disabled"):(null==(h=u.data)?void 0:h.name)+" "+T("settings are updated"),I({title:v,description:"",type:"success",autoClose:!0})),null==g||g(u.data),e.abrupt("return",u.data);case 24:I({title:T("Updating failed"),description:u.message,type:"error"});case 25:return e.abrupt("return",null);case 28:return e.prev=28,e.t0=e.catch(1),I({title:T("Updating failed"),description:null==e.t0?void 0:e.t0.message,type:"error"}),e.abrupt("return",null);case 32:return e.prev=32,P(!1),e.finish(32);case 35:case"end":return e.stop()}}),e,null,[[1,28,32,35]])})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=v(E.mark((function e(t){var n,r,o;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(p+"/vault/connections/"+t.unified_api+"/"+t.service_id,{method:"DELETE",headers:R});case 3:r=b({},t,{enabled:!1,state:"available"}),o=b({},z,{data:[r].concat(null==(n=z.data)?void 0:n.filter((function(e){return e.id!==t.id})))}),A(j,o,!1),null==h||h(r),L?y():(k(null),I({title:T("{{connectionName}} is deleted",{connectionName:t.name}),type:"success",autoClose:!0})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),I({title:"Deleting "+t.name+" connection failed",description:null==e.t0?void 0:e.t0.message,type:"error"});case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=v(E.mark((function e(t){var n,r,o;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,fetch(p+"/vault/connections/"+w.unified_api+"/"+w.service_id+"/"+t+"/config",{headers:R});case 4:return r=e.sent,e.next=7,r.json();case 7:if(!(o=e.sent).error){e.next=10;break}return e.abrupt("return",o);case 10:return e.abrupt("return",{resource:t,defaults:null==o||null==(n=o.data)?void 0:n.configuration});case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Z=function(){var e=v(E.mark((function e(t){var n,r,o,a;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,fetch(p+"/vault/connections/"+w.unified_api+"/"+w.service_id+"/"+t+"/custom-mapping",{headers:R});case 5:return r=e.sent,e.next=8,r.json();case 8:if(!(o=e.sent).error){e.next=12;break}return I({title:"Failed to fetch custom mappings",description:(null==o||null==(a=o.error)?void 0:a.message)||(null==o?void 0:o.error),type:"error"}),e.abrupt("return",o);case 12:return e.abrupt("return",{resource:t,defaults:null==o||null==(n=o.data)?void 0:n.configuration});case 15:e.prev=15,e.t0=e.catch(2),console.error(e.t0),I({title:"Failed to fetch custom mappings",description:null==e.t0?void 0:e.t0.message,type:"error"});case 19:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(t){return e.apply(this,arguments)}}(),J=function(){var e=v(E.mark((function e(t){var n;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w&&t){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,fetch(p+"/vault/connections/"+w.unified_api+"/"+w.service_id+"/"+t+"/schema",{headers:R});case 5:return n=e.sent,e.next=8,n.json();case 8:return e.abrupt("return",e.sent);case 11:e.prev=11,e.t0=e.catch(2),console.error(e.t0),I({title:"Failed to fetch schema",description:null==e.t0?void 0:e.t0.message,type:"error"});case 15:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(t){return e.apply(this,arguments)}}(),Q=function(){var e=v(E.mark((function e(t){var n;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w&&t){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,fetch(p+"/vault/connections/"+w.unified_api+"/"+w.service_id+"/"+t+"/example",{headers:R});case 5:return n=e.sent,e.next=8,n.json();case 8:return e.abrupt("return",e.sent);case 11:e.prev=11,e.t0=e.catch(2),console.error(e.t0),I({title:"Failed to fetch example",description:null==e.t0?void 0:e.t0.message,type:"error"});case 15:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(t){return e.apply(this,arguments)}}(),X=function(){var e=v(E.mark((function e(t){var n;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w&&t){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,fetch(p+"/vault/connections/"+w.unified_api+"/"+w.service_id+"/"+t+"/custom-fields",{headers:R});case 5:return n=e.sent,e.next=8,n.json();case 8:return e.abrupt("return",e.sent);case 11:e.prev=11,e.t0=e.catch(2),console.error(e.t0),I({title:"Failed to fetch custom fields",description:null==e.t0?void 0:e.t0.message,type:"error"});case 15:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(t){return e.apply(this,arguments)}}(),ee=function(){var e=v(E.mark((function e(){var t,n,r,o,a,i;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],(null==q?void 0:q.configurable_resources).forEach((function(e){t.push(Y(e))})),e.prev=3,P(!0),e.next=7,Promise.all(t);case 7:if(!(r=(n=e.sent).find((function(e){return e.error})))){e.next=14;break}return console.error("Failed to fetch resource config",r),I({title:"Failed to fetch resource config",description:(null==r?void 0:r.message)+" "+(null==r||null==(o=r.detail)||null==(a=o.error)||null==(i=a[0])?void 0:i.message),type:"error",autoClose:!1}),N(n),e.abrupt("return");case 14:N(n),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(3),console.error(e.t0);case 20:return e.prev=20,P(!1),e.finish(20);case 23:case"end":return e.stop()}}),e,null,[[3,17,20,23]])})));return function(){return e.apply(this,arguments)}}();t.useEffect((function(){!w&&null!=_&&_.length&&N([])}),[w]);var te=t.useMemo((function(){var e;return{connections:null==z||null==(e=z.data)?void 0:e.sort((function(e,t){var n;return null==(n=e.name)?void 0:n.localeCompare(t.name)})),deleteConnection:K,sessionExpired:401===(null==z?void 0:z.status_code)||401===(null==U?void 0:U.status_code),detailsError:(null==U?void 0:U.message)||W,error:(null==z?void 0:z.message)||(null==B?void 0:B.message),isLoading:!B&&!z,isLoadingDetails:q&&!q.id,isUpdating:M,resources:_,selectedConnection:q,setSelectedConnection:k,singleConnectionMode:L,updateConnection:G,headers:R,token:o,fetchResourceSchema:J,fetchResourceExample:Q,fetchCustomFields:X,fetchCustomMapping:Z,fetcher:F,unifyBaseUrl:p,connectionsUrl:p+"/vault/connections"}}),[M,w,z,U,c,_,o,B,W,J]);return n.createElement(C.Provider,{value:te},m)},S=function(){return t.useContext(C)},_=t.createContext({}),N=function(e){return n.createElement(_.Provider,{value:{session:e.session}},e.children)},O=function(){return t.useContext(_)};let M="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function P(e){let n=t.useRef(e);return M(()=>{n.current=e},[e]),n}function A(){let e=[],t=[],n={enqueue(e){t.push(e)},addEventListener:(e,t,r,o)=>(e.addEventListener(t,r,o),n.add(()=>e.removeEventListener(t,r,o))),requestAnimationFrame(...e){let t=requestAnimationFrame(...e);return n.add(()=>cancelAnimationFrame(t))},nextFrame:(...e)=>n.requestAnimationFrame(()=>n.requestAnimationFrame(...e)),setTimeout(...e){let t=setTimeout(...e);return n.add(()=>clearTimeout(t))},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0){let[t]=e.splice(n,1);t()}}),dispose(){for(let t of e.splice(0))t()},async workQueue(){for(let e of t.splice(0))await e()}};return n}function I(){let[e]=t.useState(A);return t.useEffect(()=>()=>e.dispose(),[e]),e}let T=function(e){let t=P(e);return n.useCallback((...e)=>t.current(...e),[t])},L={serverHandoffComplete:!1};function R(){let[e,n]=t.useState(L.serverHandoffComplete);return t.useEffect(()=>{!0!==e&&n(!0)},[e]),t.useEffect(()=>{!1===L.serverHandoffComplete&&(L.serverHandoffComplete=!0)},[]),e}var F;let j=0;function D(){return++j}let V=null!=(F=n.useId)?F:function(){let e=R(),[t,r]=n.useState(e?D:null);return M(()=>{null===t&&r(D())},[t]),null!=t?""+t:void 0};function z(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,z),r}function B(e){return"undefined"==typeof window?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let H=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>e+":not([tabindex='-1'])").join(",");var U,W=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(W||{}),q=((U=q||{})[U.Error=0]="Error",U[U.Overflow=1]="Overflow",U[U.Success=2]="Success",U[U.Underflow=3]="Underflow",U),$=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))($||{}),G=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(G||{});function K(e,t=0){var n;return e!==(null==(n=B(e))?void 0:n.body)&&z(t,{0:()=>e.matches(H),1(){let t=e;for(;null!==t;){if(t.matches(H))return!0;t=t.parentElement}return!1}})}function Y(e){null==e||e.focus({preventScroll:!0})}let Z=["textarea","input"].join(",");function J(e,t=(e=>e)){return e.slice().sort((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let a=r.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Q(e,t,n=!0){let r,o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?J(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(H))}(e),i=o.activeElement,l=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,a.indexOf(i))-1;if(4&t)return Math.max(0,a.indexOf(i))+1;if(8&t)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},c=0,d=a.length;do{if(c>=d||c+d<=0)return 0;let e=s+c;if(16&t)e=(e+d)%d;else{if(e<0)return 3;if(e>=d)return 1}r=a[e],null==r||r.focus(u),c+=l}while(r!==o.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,Z))&&n}(r)&&r.select(),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0"),2}function X(e,n,r){let o=P(n);t.useEffect(()=>{function t(e){o.current(e)}return window.addEventListener(e,t,r),()=>window.removeEventListener(e,t,r)},[e,r])}function ee(e,n,r=!0){let o=t.useRef(!1);function a(t,r){if(!o.current||t.defaultPrevented)return;let a=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),i=r(t);if(null!==i&&i.ownerDocument.documentElement.contains(i)){for(let e of a){if(null===e)continue;let t=e instanceof HTMLElement?e:e.current;if(null!=t&&t.contains(i))return}return!K(i,G.Loose)&&-1!==i.tabIndex&&t.preventDefault(),n(t,i)}}t.useEffect(()=>{requestAnimationFrame(()=>{o.current=r})},[r]),X("click",e=>a(e,e=>e.target),!0),X("blur",e=>a(e,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function te(e){var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function ne(e,n){let[r,o]=t.useState(()=>te(e));return M(()=>{o(te(e))},[e.type,e.as]),M(()=>{r||!n.current||n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")},[r,n]),r}let re=Symbol();function oe(...e){let n=t.useRef(e);t.useEffect(()=>{n.current=e},[e]);let r=T(e=>{for(let t of n.current)null!=t&&("function"==typeof t?t(e):t.current=e)});return e.every(e=>null==e||(null==e?void 0:e[re]))?void 0:r}var ae=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ae||{}),ie=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ie||{}),le=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(le||{});function se({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:i}){let l=ce(t,e);if(a)return ue(l,n,r,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=l;if(e)return ue(t,n,r,i)}if(1&s){let{unmount:e=!0,...t}=l;return z(e?0:1,{0:()=>null,1:()=>ue({...t,hidden:!0,style:{display:"none"}},n,r,i)})}return ue(l,n,r,i)}function ue(e,n={},r,o){let{as:a=r,children:i,refName:l="ref",...s}=pe(e,["unmount","static"]),u=void 0!==e.ref?{[l]:e.ref}:{},c="function"==typeof i?i(n):i;s.className&&"function"==typeof s.className&&(s.className=s.className(n));let d={};if(a===t.Fragment&&Object.keys(fe(s)).length>0){if(!t.isValidElement(c)||Array.isArray(c)&&c.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map(e=>" - "+e).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>" - "+e).join("\n")].join("\n"));return t.cloneElement(c,Object.assign({},ce(c.props,fe(pe(s,["ref"]))),d,u))}return t.createElement(a,Object.assign({},pe(s,["ref"]),a!==t.Fragment&&u,a!==t.Fragment&&d),c)}function ce(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(e=>[e,void 0])));for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if(t.defaultPrevented)return;e(t,...r)}}});return t}function de(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function fe(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function pe(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function me(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}var ge=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ge||{});let he=de((function(e,t){let{features:n=1,...r}=e;return se({ourProps:{ref:t,"aria-hidden":2==(2&n)||void 0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&n)&&2!=(2&n)&&{display:"none"}}},theirProps:r,slot:{},defaultTag:"div",name:"Hidden"})})),ve=t.createContext(null);ve.displayName="OpenClosedContext";var be=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(be||{});function ye(){return t.useContext(ve)}function xe({value:e,children:t}){return n.createElement(ve.Provider,{value:e},t)}var we=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(we||{}),Ee=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Ee||{});function Ce(){let e=t.useRef(!1);return M(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ke(...e){return t.useMemo(()=>B(...e),[...e])}function Se(e,n,r,o){let a=P(r);t.useEffect(()=>{function t(e){a.current(e)}return(e=null!=e?e:window).addEventListener(n,t,o),()=>e.removeEventListener(n,t,o)},[e,n,o])}function _e(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function Ne(e,n){let r=t.useRef([]),o=T(e);t.useEffect(()=>{for(let[e,t]of n.entries())if(r.current[e]!==t){let e=o(n);return r.current=n,e}},[o,...n])}var Oe=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(Oe||{});let Me=Object.assign(de((function(e,r){let o=t.useRef(null),a=oe(o,r),{initialFocus:i,containers:l,features:s=30,...u}=e;R()||(s=1);let c=ke(o);!function({ownerDocument:e},n){let r=t.useRef(null);Se(null==e?void 0:e.defaultView,"focusout",e=>{!n||r.current||(r.current=e.target)},!0),Ne(()=>{n||((null==e?void 0:e.activeElement)===(null==e?void 0:e.body)&&Y(r.current),r.current=null)},[n]);let o=t.useRef(!1);t.useEffect(()=>(o.current=!1,()=>{o.current=!0,_e(()=>{!o.current||(Y(r.current),r.current=null)})}),[])}({ownerDocument:c},Boolean(16&s));let d=function({ownerDocument:e,container:n,initialFocus:r},o){let a=t.useRef(null);return Ne(()=>{if(!o)return;let t=n.current;if(!t)return;let i=null==e?void 0:e.activeElement;if(null!=r&&r.current){if((null==r?void 0:r.current)===i)return void(a.current=i)}else if(t.contains(i))return void(a.current=i);null!=r&&r.current?Y(r.current):Q(t,W.First)===q.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),a.current=null==e?void 0:e.activeElement},[o]),a}({ownerDocument:c,container:o,initialFocus:i},Boolean(2&s));!function({ownerDocument:e,container:t,containers:n,previousActiveElement:r},o){let a=Ce();Se(null==e?void 0:e.defaultView,"focus",e=>{if(!o||!a.current)return;let i=new Set(null==n?void 0:n.current);i.add(t);let l=r.current;if(!l)return;let s=e.target;s&&s instanceof HTMLElement?function(e,t){var n;for(let r of e)if(null!=(n=r.current)&&n.contains(t))return!0;return!1}(i,s)?(r.current=s,Y(s)):(e.preventDefault(),e.stopPropagation(),Y(l)):Y(r.current)},!0)}({ownerDocument:c,container:o,containers:l,previousActiveElement:d},Boolean(8&s));let f=function(){let e=t.useRef(0);return X("keydown",t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)},!0),e}(),p=T(()=>{let e=o.current;!e||z(f.current,{[Ee.Forwards]:()=>Q(e,W.First),[Ee.Backwards]:()=>Q(e,W.Last)})}),m={ref:a};return n.createElement(n.Fragment,null,Boolean(4&s)&&n.createElement(he,{as:"button",type:"button",onFocus:p,features:ge.Focusable}),se({ourProps:m,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(4&s)&&n.createElement(he,{as:"button",type:"button",onFocus:p,features:ge.Focusable}))})),{features:Oe}),Pe=new Set,Ae=new Map;function Ie(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Te(e){let t=Ae.get(e);!t||(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}function Le(e,t=!0){M(()=>{if(!t||!e.current)return;let n=e.current,r=B(n);if(r){Pe.add(n);for(let e of Ae.keys())e.contains(n)&&(Te(e),Ae.delete(e));return r.querySelectorAll("body > *").forEach(e=>{if(e instanceof HTMLElement){for(let t of Pe)if(e.contains(t))return;1===Pe.size&&(Ae.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),Ie(e))}}),()=>{if(Pe.delete(n),Pe.size>0)r.querySelectorAll("body > *").forEach(e=>{if(e instanceof HTMLElement&&!Ae.has(e)){for(let t of Pe)if(e.contains(t))return;Ae.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),Ie(e)}});else for(let e of Ae.keys())Te(e),Ae.delete(e)}}},[t])}let Re=t.createContext(!1);function Fe(){return t.useContext(Re)}function je(e){return n.createElement(Re.Provider,{value:e.force},e.children)}let De=t.Fragment,Ve=de((function(e,n){let r=e,o=t.useRef(null),a=oe(function(e,t=!0){return Object.assign(e,{[re]:t})}(e=>{o.current=e}),n),i=ke(o),l=function(e){let n=Fe(),r=t.useContext(Be),o=ke(e),[a,i]=t.useState(()=>{if(!n&&null!==r||"undefined"==typeof window)return null;let e=null==o?void 0:o.getElementById("headlessui-portal-root");if(e)return e;if(null===o)return null;let t=o.createElement("div");return t.setAttribute("id","headlessui-portal-root"),o.body.appendChild(t)});return t.useEffect(()=>{null!==a&&(null!=o&&o.body.contains(a)||null==o||o.body.appendChild(a))},[a,o]),t.useEffect(()=>{n||null!==r&&i(r.current)},[r,i,n]),a}(o),[s]=t.useState(()=>{var e;return"undefined"==typeof window?null:null!=(e=null==i?void 0:i.createElement("div"))?e:null}),c=R(),d=t.useRef(!1);return M(()=>{if(d.current=!1,l&&s)return l.contains(s)||(s.setAttribute("data-headlessui-portal",""),l.appendChild(s)),()=>{d.current=!0,_e(()=>{var e;!d.current||!l||!s||(l.removeChild(s),l.childNodes.length<=0&&(null==(e=l.parentElement)||e.removeChild(l)))})}},[l,s]),c&&l&&s?u.createPortal(se({ourProps:{ref:a},theirProps:r,defaultTag:De,name:"Portal"}),s):null})),ze=t.Fragment,Be=t.createContext(null),He=de((function(e,t){let{target:r,...o}=e,a={ref:oe(t)};return n.createElement(Be.Provider,{value:r},se({ourProps:a,theirProps:o,defaultTag:ze,name:"Popover.Group"}))})),Ue=Object.assign(Ve,{Group:He}),We=t.createContext(null);function qe(){let e=t.useContext(We);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,qe),e}return e}function $e(){let[e,r]=t.useState([]);return[e.length>0?e.join(" "):void 0,t.useMemo(()=>function(e){let o=T(e=>(r(t=>[...t,e]),()=>r(t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))),a=t.useMemo(()=>({register:o,slot:e.slot,name:e.name,props:e.props}),[o,e.slot,e.name,e.props]);return n.createElement(We.Provider